emis-app/components/buns-post-edit-templates/bpe-gooditem-edit-tmp.vue
2024-04-27 23:19:55 +08:00

117 lines
2.7 KiB
Vue

<template>
<view v-for="(item, index) in modelInfo.cargoList" class="yditem">
<view class="ydi-lab">
<text @click="handleEditGood(item, index)" class="font-weight">{{item.goodsName}}</text>
<view>
<u-icon @click="handleDelGood(index)" name="trash" size="32"></u-icon>
</view>
</view>
<view class="ydi-lab mt-10">
<view @click="handleEditGood(item, index)" style="width: 100%;">
<u-row justify="between">
<view class="clr-sub">{{item.nationArea}}</view>
<view><text class="clr-sub">预报</text> {{item.cargoQty}}</view>
</u-row>
<view class="clr-prm pt-10">{{item.price}} CNY</view>
</view>
</view>
<view class="ydi-lab mt-10">
<u-row>
<text class="pr-20 clr-prm">异常</text>
<uni-number-box :min="0" v-model="item.abnormalQty" :max="10000" background="#fff"></uni-number-box>
</u-row>
<u-row>
<text class="pr-20">实入仓</text>
<uni-number-box :min="0" v-model="item.cargoQty" :max="10000" background="#fff"></uni-number-box>
</u-row>
</view>
</view>
<u-button @click="handleEditGood" custom-style="border-radius: 16rpx;height: 66rpx;" type="primary" plain="true">
<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>
<buns-goodinfo-sheet v-model:show="goodinfoModal.show" v-model:value="goodinfoModal.value" @onSure="handleGoodChange"></buns-goodinfo-sheet>
</template>
<script>
export default {
computed: {
modelInfo: {
get(){
return this.value
}
},
dicData() {
return this.$store.getters.dicData
}
},
props: {
value: {
default () {
return { }
}
}
},
data() {
return {
goodinfoModal:{
show: false,
value: {},
index: undefined
}
}
},
created() {
},
onHide() {
},
unmounted() {
},
methods: {
handleDelGood(index) {
this.modelInfo.cargoList.splice(index, 1)
},
handleEditGood(item = { nationArea: '中国' }, index) {
this.goodinfoModal.show = true
this.goodinfoModal.value = item
this.goodinfoModal.index = index
},
handleGoodChange(val) {
if(typeof this.goodinfoModal.index == 'undefined') {
// 新增回调处理
this.modelInfo.cargoList.push(val)
} else {
Object.assign(this.modelInfo.cargoList[this.goodinfoModal.index], val)
}
}
}
}
</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>