emis-sapp/components/buns-post-edit-templates/bpe-gooditemsize-tmp.vue

146 lines
3.3 KiB
Vue
Raw Normal View History

2024-05-31 10:42:15 +00:00
<template>
<view class="">
2025-01-12 10:00:51 +00:00
<!-- 隐藏长宽高 -->
<view v-if="false" class="jsfm-item">
2024-05-31 10:42:15 +00:00
<u-row justify="between" align="top">
2024-06-11 09:35:55 +00:00
<!-- <text class="font-28 pt-20 font-weight">尺寸</text> -->
<view style="width: 100%;">
2024-05-31 10:42:15 +00:00
<u-row justify="between">
<u-col span="3.7">
2024-08-27 12:19:15 +00:00
<tpx-input v-model:value="modelInfo.length" placeholder="长" inputAlign="right" suffix="cm" _digit="4"></tpx-input>
2024-05-31 10:42:15 +00:00
</u-col>
<u-col span="3.7">
2024-08-27 12:19:15 +00:00
<tpx-input v-model:value="modelInfo.width" placeholder="宽" inputAlign="right" suffix="cm" _digit="4"></tpx-input>
2024-05-31 10:42:15 +00:00
</u-col>
<u-col span="3.7">
2024-08-27 12:19:15 +00:00
<tpx-input v-model:value="modelInfo.height" placeholder="高" inputAlign="right" suffix="cm" _digit="4"></tpx-input>
2024-05-31 10:42:15 +00:00
</u-col>
</u-row>
</view>
</u-row>
</view>
<view class="jsfm-item">
2024-12-08 03:19:24 +00:00
<tpx-text-item :required="true" label="数量" >
2024-07-31 15:37:10 +00:00
<template #right>
2024-12-08 03:19:24 +00:00
<tpx-input placeholder="请填写" v-model:value="modelInfo.cargoQty" inputAlign="right" :customStyle="`${comInSty}`" type="number" :_maxNum="cargoQtyMaxNum"
>
<template #suffix>
<tpx-select v-model:value="modelInfo.unit" :list="goodNumUnitList"
mode="drop" :dropRightWidth="300"
>
2024-12-12 11:03:14 +00:00
<u-row custom-style="gap: 6rpx;padding: 0 6rpx;" justify="between">
<tpx-text-dic :value="modelInfo.unit" :list="goodNumUnitList" :placeholder="goodNumUnitList[0].title"></tpx-text-dic>
<u-icon :name="'arrow-down-fill'"
size="18" custom-style=""
></u-icon>
2024-12-08 03:19:24 +00:00
</u-row>
</tpx-select>
</template>
</tpx-input>
2024-07-31 15:37:10 +00:00
</template>
</tpx-text-item>
2024-05-31 10:42:15 +00:00
</view>
</view>
</template>
<script>
2024-12-08 03:19:24 +00:00
import { goodNumUnitList } from "@/common/enum"
2024-05-31 10:42:15 +00:00
export default {
computed: {
modelInfo: {
get(){
return this.value
}
2024-06-02 15:02:19 +00:00
},
calChangeVal(){
const { length, width, height, cargoQty } = this.modelInfo
return {
length, width, height, cargoQty
}
2024-06-11 09:35:55 +00:00
},
cargoQtyMaxNum(){
2024-12-12 17:12:58 +00:00
// 限制数量的最大值
let { cargoList, parcelQty } = this.submitVal
let curQty = (+this.modelInfo.cargoQty) || 0
let qtMaxNum = parcelQty + curQty
2024-12-12 11:03:14 +00:00
cargoList.map(t=> {
2024-12-12 17:12:58 +00:00
if(t.cargoQty) {
qtMaxNum = qtMaxNum - t.cargoQty
}
})
if(qtMaxNum < 0) {
qtMaxNum = 0
}
2024-06-11 09:35:55 +00:00
return qtMaxNum
2024-06-02 15:02:19 +00:00
}
},
watch: {
calChangeVal: {
handler: function(newVal){
this.calculateVplume(newVal)
},
deep: true
2024-05-31 10:42:15 +00:00
}
},
props: {
value: {
default () {
return { }
}
2024-06-11 09:35:55 +00:00
},
submitVal: {
default () {
return {}
}
},
2024-08-02 09:41:30 +00:00
comInSty: {
default () {
return ''
}
},
2024-05-31 10:42:15 +00:00
},
data() {
return {
2024-12-08 03:19:24 +00:00
goodNumUnitList,
2024-05-31 10:42:15 +00:00
}
},
created() {
},
onHide() {
},
unmounted() {
},
methods: {
2024-06-02 15:02:19 +00:00
calculateVplume(calVal) {
2024-05-31 10:42:15 +00:00
setTimeout(()=> {
let volume = this.modelInfo.volume
2024-06-02 15:02:19 +00:00
const { length, width, height, cargoQty } = calVal
console.log("cargoQty======v", cargoQty)
if(length && width && height && cargoQty){
volume = length/100 * width/100 * height/100 * cargoQty
2024-05-31 10:42:15 +00:00
}
if(volume && volume.toFixed) {
2024-09-03 06:12:49 +00:00
volume = volume.toFixed(4)
2024-05-31 10:42:15 +00:00
this.modelInfo.volume = volume
2024-06-02 15:02:19 +00:00
} else {
this.modelInfo.volume = 0
2024-05-31 10:42:15 +00:00
}
}, 500);
}
}
}
</script>
<style scoped lang="scss">
.shet-cont{
padding: 0;
}
.jsfm-item{
margin-top: 30rpx;
}
</style>