|
@@ -21,15 +21,7 @@
|
|
|
<a-row :gutter="15">
|
|
|
<a-col :span="8">
|
|
|
<a-form-model-item label="客户名称" prop="buyerSn">
|
|
|
- <a-select
|
|
|
- id="chooseCustom-buyerSn"
|
|
|
- show-search
|
|
|
- placeholder="请选择客户"
|
|
|
- v-model="form.buyerSn"
|
|
|
- :filter-option="filterOption"
|
|
|
- @change="custChange">
|
|
|
- <a-select-option v-for="item in custAllList" :key="item.id" :value="item.customerSn">{{ item.customerName }}</a-select-option>
|
|
|
- </a-select>
|
|
|
+ <custList ref="custList" id="chooseCustom-buyerSn" @change="custChange" v-model="form.buyerSn"></custList>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col :span="16" v-if="$hasPermissions('B_customer_customerInfo_add')">
|
|
@@ -196,15 +188,16 @@
|
|
|
|
|
|
<script>
|
|
|
import { getArea } from '@/api/data'
|
|
|
-import { custAllList, custFindById, custSave, updateByCustomerSn } from '@/api/customer'
|
|
|
+import { custFindById, updateByCustomerSn } from '@/api/customer'
|
|
|
import { salesSave } from '@/api/sales'
|
|
|
import { getUserAllList } from '@/api/power-user'
|
|
|
import { settleStyleQueryAll } from '@/api/settleStyle'
|
|
|
import { VSelect } from '@/components'
|
|
|
+import custList from '@/views/common/custList.vue'
|
|
|
import CustomerManagementEdit from '@/views/customerManagement/customerInfo/edit.vue'
|
|
|
export default {
|
|
|
name: 'ChooseCustomModal',
|
|
|
- components: { VSelect, CustomerManagementEdit },
|
|
|
+ components: { VSelect, CustomerManagementEdit, custList },
|
|
|
props: {
|
|
|
show: [Boolean]
|
|
|
},
|
|
@@ -273,7 +266,6 @@ export default {
|
|
|
// { required: true, message: '请选择业务员', trigger: 'change' }
|
|
|
// ]
|
|
|
},
|
|
|
- custAllList: [], // 客户 下拉数据
|
|
|
addrProvinceList: [], // 省下拉
|
|
|
addrCityList: [], // 市下拉
|
|
|
addrDistrictList: [], // 区下拉
|
|
@@ -299,20 +291,18 @@ export default {
|
|
|
console.log(data, this.isEdit)
|
|
|
this.isNewCust = false
|
|
|
// 更新客户信息
|
|
|
- this.custAllList.unshift(data)
|
|
|
- setTimeout(() => {
|
|
|
- this.custChange(data.customerSn)
|
|
|
- }, 300)
|
|
|
+ this.$refs.custList.setData({ key: data.customerSn, label: data.customerName, row: data })
|
|
|
+ this.custChange({ key: data.customerSn, label: data.customerName, row: data })
|
|
|
},
|
|
|
// 业务员
|
|
|
salesManChange (id) {
|
|
|
this.form.salesManName = this.userList.find(item => item.id == id).name
|
|
|
},
|
|
|
// 客户 change
|
|
|
- custChange (val) {
|
|
|
- console.log(val, 'custChange')
|
|
|
+ custChange (obj) {
|
|
|
const _this = this
|
|
|
- const cust = this.custAllList.find(item => item.customerSn == val)
|
|
|
+ const cust = obj.row
|
|
|
+ this.form.buyerSn = cust.customerSn
|
|
|
// 编辑
|
|
|
if (this.isEdit) {
|
|
|
this.$confirm({
|
|
@@ -426,19 +416,11 @@ export default {
|
|
|
onOk () {
|
|
|
// 保存客户信息
|
|
|
_this.handleSaveCust()
|
|
|
- // // 保存销售单
|
|
|
- // if (_this.form.buyerSn) {
|
|
|
- // _this.salesSaveFun()
|
|
|
- // }
|
|
|
}
|
|
|
})
|
|
|
} else {
|
|
|
// 保存客户信息
|
|
|
_this.handleSaveCust()
|
|
|
- // // 保存销售单
|
|
|
- // if (_this.form.buyerSn) {
|
|
|
- // _this.salesSaveFun()
|
|
|
- // }
|
|
|
}
|
|
|
} else {
|
|
|
console.log('error submit!!')
|
|
@@ -474,17 +456,6 @@ export default {
|
|
|
this.isNewCust = false
|
|
|
this.$refs.newCust.getBaseData()
|
|
|
},
|
|
|
- // 客户无分页列表数据
|
|
|
- getCustAllList () {
|
|
|
- const _this = this
|
|
|
- custAllList().then(res => {
|
|
|
- if (res.status == 200) {
|
|
|
- _this.custAllList = res.data || []
|
|
|
- } else {
|
|
|
- _this.custAllList = []
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
// 获取业务员列表数据
|
|
|
getUserAllList () {
|
|
|
getUserAllList({ loginFlag: 1 }).then(res => {
|
|
@@ -549,11 +520,6 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- filterOption (input, option) {
|
|
|
- return (
|
|
|
- option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
|
- )
|
|
|
- },
|
|
|
// 获取收款方式
|
|
|
getSettleStyle () {
|
|
|
settleStyleQueryAll().then(res => {
|
|
@@ -568,7 +534,6 @@ export default {
|
|
|
this.opened = newValue
|
|
|
if (newValue) {
|
|
|
this.getArea('province')
|
|
|
- this.getCustAllList()
|
|
|
this.getUserAllList()
|
|
|
this.getSettleStyle()
|
|
|
}
|