emis-app/components/buns-post-edit-templates/bpe-gooditemsize-tmp.vue
2024-05-27 11:01:17 +08:00

89 lines
1.8 KiB
Vue

<template>
<view class="">
<view class="jsfm-item">
<u-row justify="between" align="top">
<text class="font-28 pt-20 font-weight">尺寸</text>
<view style="width: 70%;">
<u-row justify="between">
<u-col span="3.7">
<tpx-input v-model:value="modelInfo.length" @change="calculateVplume" placeholder="长" inputAlign="right" suffix="cm" _digit="5"></tpx-input>
</u-col>
<u-col span="3.7">
<tpx-input v-model:value="modelInfo.width" @change="calculateVplume" placeholder="宽" inputAlign="right" suffix="cm" _digit="5"></tpx-input>
</u-col>
<u-col span="3.7">
<tpx-input v-model:value="modelInfo.height" @change="calculateVplume" placeholder="高" inputAlign="right" suffix="cm" _digit="5"></tpx-input>
</u-col>
</u-row>
</view>
</u-row>
</view>
<view class="jsfm-item">
<u-row justify="between" align="top">
<text class="font-28 font-weight">体积</text>
<view style="">
{{modelInfo.volume || '0'}}
<text class="clr-sub">m³</text>
</view>
</u-row>
</view>
</view>
</template>
<script>
export default {
computed: {
modelInfo: {
get(){
return this.value
}
}
},
props: {
value: {
default () {
return { }
}
}
},
data() {
return {
}
},
created() {
},
onHide() {
},
unmounted() {
},
methods: {
calculateVplume() {
setTimeout(()=> {
let volume = this.modelInfo.volume
const { length, width, height } = this.modelInfo
if(length && width && height){
volume = length/100 * width/100 * height/100
}
if(volume && volume.toFixed) {
volume = volume.toFixed(5)
this.modelInfo.volume = volume
}
}, 500);
}
}
}
</script>
<style scoped lang="scss">
.shet-cont{
padding: 0;
}
.jsfm-item{
margin-top: 30rpx;
}
</style>