emis-app/components/buns-post-edit-templates/bpe-gooditem-edit-tmp.vue

152 lines
3.6 KiB
Vue
Raw Normal View History

2024-01-31 09:17:34 +00:00
<template>
2024-04-27 15:19:55 +00:00
<view v-for="(item, index) in modelInfo.cargoList" class="yditem">
2024-01-31 09:17:34 +00:00
<view class="ydi-lab">
2024-04-27 15:19:55 +00:00
<text @click="handleEditGood(item, index)" class="font-weight">{{item.goodsName}}</text>
2024-01-31 09:17:34 +00:00
<view>
<u-icon @click="handleDelGood(index)" name="trash" size="32"></u-icon>
</view>
</view>
<view class="ydi-lab mt-10">
2024-04-27 15:19:55 +00:00
<view @click="handleEditGood(item, index)" style="width: 100%;">
2024-05-25 16:20:09 +00:00
<u-row justify="between" custom-style="flex-wrap: wrap;">
<u-col v-if="item.nationArea" span="6">
<view class="pt-5">
<text class="clr-sub pr-10">产地</text>{{item.nationArea}}
</view>
</u-col>
<u-col span="6">
<view class="pt-5">
<text class="clr-sub pr-10">预报</text> {{item.cargoQty}}
</view>
</u-col>
<u-col v-if="item.price" span="6">
<view class="pt-5">
<text class="clr-sub pr-10">单价</text>{{item.price}} CNY
</view>
</u-col>
<u-col span="12">
<view class="pt-5">
<text class="clr-sub pr-10">尺寸</text>
{{item.length || '0'}}cm<text class="clr-sub pl-10 pr-10">*</text>
{{item.width || '0'}}cm<text class="clr-sub pl-10 pr-10 ">*</text>
{{item.length || '0'}}cm
</view>
</u-col>
<u-col span="12">
<view class="pt-5">
<text class="clr-sub pr-10">体积</text>
{{item.volume || '0'}}m³
</view>
</u-col>
2024-01-31 09:17:34 +00:00
</u-row>
</view>
</view>
2024-05-25 16:20:09 +00:00
2024-01-31 09:17:34 +00:00
<view class="ydi-lab mt-10">
<u-row>
<text class="pr-20 clr-prm">异常</text>
2024-04-27 15:19:55 +00:00
<uni-number-box :min="0" v-model="item.abnormalQty" :max="10000" background="#fff"></uni-number-box>
2024-01-31 09:17:34 +00:00
</u-row>
<u-row>
<text class="pr-20">实入仓</text>
2024-04-27 15:19:55 +00:00
<uni-number-box :min="0" v-model="item.cargoQty" :max="10000" background="#fff"></uni-number-box>
2024-01-31 09:17:34 +00:00
</u-row>
</view>
</view>
2024-04-27 12:44:15 +00:00
<u-button @click="handleEditGood" custom-style="border-radius: 16rpx;height: 66rpx;" type="primary" plain="true">
2024-01-31 09:17:34 +00:00
<u-row justify="center">
<view>
<u-icon name="plus" size="30" color="#B12D29"></u-icon>
</view>
<text class="pl-10">增加货物</text>
</u-row>
</u-button>
2024-05-25 16:20:09 +00:00
<buns-goodinfo-sheet v-model:show="goodinfoModal.show" v-model:value="goodinfoModal.value" :showMode="showMode" @onSure="handleGoodChange"></buns-goodinfo-sheet>
2024-01-31 09:17:34 +00:00
</template>
<script>
export default {
computed: {
2024-04-27 15:19:55 +00:00
modelInfo: {
2024-01-31 09:17:34 +00:00
get(){
return this.value
}
2024-04-27 15:19:55 +00:00
},
dicData() {
return this.$store.getters.dicData
2024-01-31 09:17:34 +00:00
}
},
props: {
value: {
default () {
return { }
}
2024-05-25 16:20:09 +00:00
},
showMode: {
default () {
return '1' // 1 只显示商品名称、体积; 2:显示全部商品信息
}
2024-01-31 09:17:34 +00:00
}
},
data() {
return {
goodinfoModal:{
show: false,
2024-04-27 15:19:55 +00:00
value: {},
index: undefined
2024-01-31 09:17:34 +00:00
}
}
},
created() {
},
onHide() {
},
unmounted() {
},
methods: {
2024-04-27 15:19:55 +00:00
handleDelGood(index) {
this.modelInfo.cargoList.splice(index, 1)
},
handleEditGood(item = { nationArea: '中国' }, index) {
2024-01-31 09:17:34 +00:00
this.goodinfoModal.show = true
this.goodinfoModal.value = item
2024-04-27 15:19:55 +00:00
this.goodinfoModal.index = index
2024-01-31 09:17:34 +00:00
},
2024-04-27 15:19:55 +00:00
handleGoodChange(val) {
if(typeof this.goodinfoModal.index == 'undefined') {
// 新增回调处理
2024-05-07 13:53:45 +00:00
this.modelInfo.cargoList.push({
abnormalQty: 0,
...val
})
2024-04-27 15:19:55 +00:00
} else {
Object.assign(this.modelInfo.cargoList[this.goodinfoModal.index], val)
}
}
2024-01-31 09:17:34 +00:00
}
}
</script>
<style scoped lang="scss">
.yditem{
padding: 20rpx 20rpx;
background-color: #F6F6F6;
border-radius: 10rpx;
margin-bottom: 20rpx;
}
.ydi-lab{
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
</style>