155 lines
3.8 KiB
Vue
155 lines
3.8 KiB
Vue
<template>
|
||
<view class="">
|
||
|
||
<view class="jsfm-item">
|
||
<u-row justify="between" align="top">
|
||
<view style="width: 100%;">
|
||
<u-row justify="between" style="margin-bottom: 10px;">
|
||
<u-col span="3">
|
||
<text class="font-28 font-weight pr-10" align="center">长(cm)</text>
|
||
</u-col>
|
||
<u-col span="3">
|
||
<text class="font-28 font-weight pr-10" align="center">宽(cm)</text>
|
||
</u-col>
|
||
<u-col span="3">
|
||
<text class="font-28 font-weight pr-10" align="center">高(cm)</text>
|
||
</u-col>
|
||
<u-col span="3">
|
||
<text class="font-28 font-weight pr-10" align="center">件数</text>
|
||
</u-col>
|
||
</u-row>
|
||
</view>
|
||
</u-row>
|
||
<u-row justify="between" align="top">
|
||
<!-- <text class="font-28 pt-20 font-weight">尺寸</text> -->
|
||
<view style="width: 100%;">
|
||
<u-row justify="between">
|
||
<u-col span="3">
|
||
<tpx-input v-model:value="modelInfo.length" placeholder="" inputAlign="center" suffix="" _digit="4" style="border-radius: 0px;"></tpx-input>
|
||
</u-col>
|
||
<u-col span="3">
|
||
<tpx-input v-model:value="modelInfo.width" placeholder="" inputAlign="center" suffix="" _digit="4" style="border-radius: 0px;"></tpx-input>
|
||
</u-col>
|
||
<u-col span="3">
|
||
<tpx-input v-model:value="modelInfo.height" placeholder="" inputAlign="center" suffix="" _digit="4" style="border-radius: 0px;"></tpx-input>
|
||
</u-col>
|
||
<u-col span="3">
|
||
<tpx-input placeholder="" v-model:value="modelInfo.cargoQty" inputAlign="center" type="number" suffix="" :_maxNum="cargoQtyMaxNum" style="border-radius: 0px;"></tpx-input>
|
||
</u-col>
|
||
</u-row>
|
||
</view>
|
||
</u-row>
|
||
</view>
|
||
<view class="jsfm-item">
|
||
<u-row justify="between">
|
||
<!-- <u-row>
|
||
<text class="font-28 font-weight pr-10">件数</text>
|
||
<view style="width: 200rpx;">
|
||
<tpx-input placeholder="件数" v-model:value="modelInfo.cargoQty" inputAlign="center" type="number" suffix="件" :_maxNum="cargoQtyMaxNum" style="border-radius: 0px;"></tpx-input>
|
||
</view>
|
||
</u-row> -->
|
||
<u-row>
|
||
<text class="font-28 font-weight pr-10">体积:</text>
|
||
<view style="">
|
||
{{modelInfo.volume || '0'}}
|
||
<text class="clr-sub">m³</text>
|
||
</view>
|
||
</u-row>
|
||
</u-row>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
export default {
|
||
computed: {
|
||
modelInfo: {
|
||
get(){
|
||
return this.value
|
||
}
|
||
},
|
||
calChangeVal(){
|
||
const { length, width, height, cargoQty } = this.modelInfo
|
||
return {
|
||
length, width, height, cargoQty
|
||
}
|
||
},
|
||
cargoQtyMaxNum(){
|
||
// 限制数量的最大值
|
||
let { cargoList, parcelQty } = this.submitVal
|
||
let curQty = (+this.modelInfo.cargoQty) || 0
|
||
let qtMaxNum = parcelQty + curQty
|
||
cargoList.map(t=> {
|
||
if(t.cargoQty) {
|
||
qtMaxNum = qtMaxNum - t.cargoQty
|
||
}
|
||
})
|
||
if(qtMaxNum < 0) {
|
||
qtMaxNum = 0
|
||
}
|
||
return qtMaxNum
|
||
}
|
||
},
|
||
watch: {
|
||
calChangeVal: {
|
||
handler: function(newVal){
|
||
this.calculateVplume(newVal)
|
||
},
|
||
deep: true
|
||
}
|
||
},
|
||
props: {
|
||
value: {
|
||
default () {
|
||
return { }
|
||
}
|
||
},
|
||
submitVal: {
|
||
default () {
|
||
return {}
|
||
}
|
||
},
|
||
},
|
||
data() {
|
||
return {
|
||
}
|
||
},
|
||
created() {
|
||
},
|
||
onHide() {
|
||
|
||
},
|
||
unmounted() {
|
||
|
||
},
|
||
|
||
methods: {
|
||
calculateVplume(calVal) {
|
||
setTimeout(()=> {
|
||
let volume = this.modelInfo.volume
|
||
const { length, width, height, cargoQty } = calVal
|
||
console.log("cargoQty======v", cargoQty)
|
||
if(length && width && height && cargoQty){
|
||
volume = length/100 * width/100 * height/100 * cargoQty
|
||
}
|
||
if(volume && volume.toFixed) {
|
||
volume = volume.toFixed(4)
|
||
this.modelInfo.volume = volume
|
||
} else {
|
||
this.modelInfo.volume = 0
|
||
}
|
||
}, 500);
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style scoped lang="scss">
|
||
.shet-cont{
|
||
padding: 0;
|
||
}
|
||
.jsfm-item{
|
||
margin-top: 30rpx;
|
||
}
|
||
|
||
</style> |