Commit 29f61456 authored by xiejb's avatar xiejb

货主多选功能

parent 393da7d7
......@@ -28,7 +28,7 @@
:error.sync="error"
:offset="10"
@load="onLoad">
<van-radio-group v-model="checked">
<!-- <van-radio-group v-model="checked">
<van-cell-group>
<van-cell :title="titleInitial(item)" clickable @click="itemClick(item,index)" v-for="(item,index) in postDataList"
:key="index">
......@@ -37,7 +37,17 @@
</template>
</van-cell>
</van-cell-group>
</van-radio-group>
</van-radio-group> -->
<van-checkbox-group v-model="checkedList">
<van-cell-group>
<van-cell :title="titleInitial(item)" clickable @click="itemClick(item,index)" v-for="(item,index) in postDataList"
:key="index">
<template #right-icon>
<van-checkbox :name="item.comPartyId" />
</template>
</van-cell>
</van-cell-group>
</van-checkbox-group>
</van-list>
</van-pull-refresh>
</div>
......@@ -71,7 +81,8 @@ export default {
pageSize: 10,
postDataList: [],
checked: '',
choosedPost: {}
checkedList: [],
choosedPost: []
}
},
computed: {
......@@ -85,8 +96,8 @@ export default {
default: false
},
customer: {
type: Object,
default: () => {}
type: Array,
default: () => []
},
chinfo: {
type: Object,
......@@ -103,11 +114,15 @@ export default {
this.postShow = val
if (val) {
this.postDataList = []
this.checkedList = []
this.choosedPost = JSON.parse(JSON.stringify(this.customer))
this.checked = !this.customer.comPartyId ? '' : this.customer.comPartyId
console.log(this.checked)
// this.checked = !this.customer.comPartyId ? '' : this.customer.comPartyId
// console.log(this.checked)
this.customer.forEach((res)=>{
this.checkedList.push(res.comPartyId)
})
this.currentPage = 1
this.onLoad()
this.onRefresh()
}
},
postShow (val) {
......@@ -140,10 +155,11 @@ export default {
},
onCancelClick() {
this.postShow = false
this.checkedList = []
this.$emit('cancleclick')
},
onConfirmClick() {
if (!this.choosedPost.comPartyId) {
if (this.choosedPost.length === 0) {
Dialog.alert({
title: '温馨提示',
message: '请选择选项!'
......@@ -158,8 +174,15 @@ export default {
})
},
itemClick(item, index) {
this.checked = item.comPartyId
this.choosedPost = item
// this.checked = item.comPartyId
// this.choosedPost = item
if(this.checkedList.indexOf(item.comPartyId) > -1) {
this.choosedPost.splice(this.checkedList.indexOf(item.comPartyId),1)
this.checkedList.splice(this.checkedList.indexOf(item.comPartyId),1)
} else {
this.checkedList.push(item.comPartyId)
this.choosedPost.push(item)
}
},
onRefresh() {
// 刷新接口
......
......@@ -133,7 +133,7 @@ export default {
},
moreSearchInfo: {
supplier: '', // 供应商
consignor: '', // 货主
consignor: [], // 货主
goods: '', // 商品
client: '', // 客户
orderNo: '', // 订单号
......@@ -159,8 +159,13 @@ export default {
},
// 货主
consignor () {
if (this.moreSearchInfo.consignor.comPartyId) {
return !this.moreSearchInfo.consignor ? '' : (this.moreSearchInfo.consignor.comPartyId + '/(' + this.moreSearchInfo.consignor.partyOpcode + ')' + this.moreSearchInfo.consignor.partyName)
// if (this.moreSearchInfo.consignor.comPartyId) {
// return !this.moreSearchInfo.consignor ? '' : (this.moreSearchInfo.consignor.comPartyId + '/(' + this.moreSearchInfo.consignor.partyOpcode + ')' + this.moreSearchInfo.consignor.partyName)
// } else {
// return ''
// }
if (this.moreSearchInfo.consignor) {
return this.fieldStitching()
} else {
return ''
}
......@@ -271,6 +276,20 @@ export default {
}
this.showPost(data.page);
},
// 字段拼接
fieldStitching() {
let str = ''
if (this.moreSearchInfo.consignor.length === 1) {
str = this.goodsInfoStitching(this.moreSearchInfo.consignor[0])
} else if (this.moreSearchInfo.consignor.length > 1) {
str = this.goodsInfoStitching(this.moreSearchInfo.consignor[0]) + '......'
}
return str
},
// 商品信息拼接
goodsInfoStitching(model) {
return model.comPartyId + '/(' + model.partyOpcode + ')/' + model.partyName
}
}
}
</script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment