emis-app/components/buns-post-edit-templates/bpe-gooditem-edit-tmp.vue
2024-06-02 00:21:36 +08:00

114 lines
2.5 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="edm-input-item">
<tpx-select v-model:value="modelInfo.goodsType" v-model:resObject="goodsRes" :getListFun="getGoodsList" :transKeyVal="{valKey: 'goodsName',titleKey: 'goodsName'}"
mode="drop" @onChange="handleChooseGood" type="multiple"
>
<tpx-text-item label="货物大类" :value="modelInfo.goodsType"></tpx-text-item>
</tpx-select>
</view>
<view class="edm-input-item">
<tpx-text-item label="货物名称">
<template v-slot:right>
<tpx-input v-model:value="modelInfo.goodsInfo" inputAlign="right"></tpx-input>
</template>
</tpx-text-item>
</view>
<view v-for="(item, index) in modelInfo.cargoList" class="yditem">
<view class="ydi-lab">
<text class="font-weight">{{item.goodsName}}</text>
<view>
<u-icon @click="handleDelGood(index)" name="trash" size="32"></u-icon>
</view>
</view>
<bpe-gooditem-filed-edit-tmp :value="item"></bpe-gooditem-filed-edit-tmp>
</view>
<!-- <u-button @click="handleAddGood" 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> -->
</template>
<script>
import BpeGooditemFiledEditTmp from "@/components/buns-post-edit-templates/bpe-gooditem-filed-edit-tmp"
import * as apiService from "@/common/api"
export default {
components: { BpeGooditemFiledEditTmp },
computed: {
modelInfo: {
get(){
return this.value
}
},
dicData() {
return this.$store.getters.dicData
}
},
props: {
value: {
default () {
return { }
}
},
showMode: {
default () {
return '1' // 1 只显示商品名称、体积; 2:显示全部商品信息
}
}
},
data() {
return {
goodsRes: { list: [] },
}
},
created() {
},
onHide() {
},
unmounted() {
},
methods: {
getGoodsList: apiService.getGoodsList,
handleDelGood(index) {
this.modelInfo.cargoList.splice(index, 1)
},
handleAddGood(item = { }) {
this.modelInfo.cargoList.push({
...item
})
},
handleChooseGood(val, name){
this.modelInfo.goodsInfo = name
}
}
}
</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;
}
.edm-input-item{
padding: 8rpx 0;
border-bottom: 2rpx solid #F6F6F6;
}
</style>