|
@@ -1,7 +1,7 @@
|
|
<template>
|
|
<template>
|
|
<a-modal
|
|
<a-modal
|
|
v-model="opened"
|
|
v-model="opened"
|
|
- title="选择客户"
|
|
|
|
|
|
+ :title="title"
|
|
centered
|
|
centered
|
|
:maskClosable="false"
|
|
:maskClosable="false"
|
|
:confirmLoading="confirmLoading"
|
|
:confirmLoading="confirmLoading"
|
|
@@ -20,18 +20,16 @@
|
|
<a-row :gutter="15">
|
|
<a-row :gutter="15">
|
|
<a-col :span="8">
|
|
<a-col :span="8">
|
|
<a-form-model-item label="客户名称" prop="buyerSn">
|
|
<a-form-model-item label="客户名称" prop="buyerSn">
|
|
- <a-auto-complete
|
|
|
|
|
|
+ <a-select
|
|
id="chooseCustom-buyerSn"
|
|
id="chooseCustom-buyerSn"
|
|
|
|
+ show-search
|
|
placeholder="请选择客户"
|
|
placeholder="请选择客户"
|
|
- allowClear
|
|
|
|
v-model="form.buyerSn"
|
|
v-model="form.buyerSn"
|
|
:filter-option="filterOption"
|
|
:filter-option="filterOption"
|
|
@select="custSelect"
|
|
@select="custSelect"
|
|
@change="custChange">
|
|
@change="custChange">
|
|
- <template slot="dataSource">
|
|
|
|
- <a-select-option v-for="item in custAllList" :key="item.customerSn" :title="item.id">{{ item.customerName }}</a-select-option>
|
|
|
|
- </template>
|
|
|
|
- </a-auto-complete>
|
|
|
|
|
|
+ <a-select-option v-for="item in custAllList" :key="item.id" :value="item.customerSn">{{ item.customerName }}</a-select-option>
|
|
|
|
+ </a-select>
|
|
</a-form-model-item>
|
|
</a-form-model-item>
|
|
</a-col>
|
|
</a-col>
|
|
<a-col :span="16">
|
|
<a-col :span="16">
|
|
@@ -109,7 +107,7 @@
|
|
<a-col :span="20">
|
|
<a-col :span="20">
|
|
<v-select
|
|
<v-select
|
|
code="PRICE_TYPE"
|
|
code="PRICE_TYPE"
|
|
- :disabled="!isEdit"
|
|
|
|
|
|
+ :disabled="isEdit"
|
|
id="chooseCustom-priceType"
|
|
id="chooseCustom-priceType"
|
|
v-model="form.priceType"
|
|
v-model="form.priceType"
|
|
allowClear
|
|
allowClear
|
|
@@ -193,6 +191,7 @@ export default {
|
|
data () {
|
|
data () {
|
|
return {
|
|
return {
|
|
opened: this.show,
|
|
opened: this.show,
|
|
|
|
+ title: '选择客户',
|
|
confirmLoading: false,
|
|
confirmLoading: false,
|
|
formItemLayout: {
|
|
formItemLayout: {
|
|
labelCol: { span: 8 },
|
|
labelCol: { span: 8 },
|
|
@@ -200,7 +199,7 @@ export default {
|
|
},
|
|
},
|
|
form: {
|
|
form: {
|
|
buyerName: '', // 客户名称
|
|
buyerName: '', // 客户名称
|
|
- buyerSn: '', // 客户sn
|
|
|
|
|
|
+ buyerSn: undefined, // 客户sn
|
|
consigneeTel: '', // 联系电话
|
|
consigneeTel: '', // 联系电话
|
|
consigneeName: '', // 联系人
|
|
consigneeName: '', // 联系人
|
|
shippingAddressProvinceSn: undefined, // 省
|
|
shippingAddressProvinceSn: undefined, // 省
|
|
@@ -211,7 +210,7 @@ export default {
|
|
shippingAddressCountyName: '',
|
|
shippingAddressCountyName: '',
|
|
shippingAddress: '', // 详细地址
|
|
shippingAddress: '', // 详细地址
|
|
fax: '', // 客户传真
|
|
fax: '', // 客户传真
|
|
- dispatchType: '', // 配送方式
|
|
|
|
|
|
+ dispatchType: undefined, // 配送方式
|
|
satelliteFlag: 0, // 是否卫星仓客户
|
|
satelliteFlag: 0, // 是否卫星仓客户
|
|
customerTypeSn: undefined, // 客户类型
|
|
customerTypeSn: undefined, // 客户类型
|
|
priceType: '', // 价格类型
|
|
priceType: '', // 价格类型
|
|
@@ -264,7 +263,8 @@ export default {
|
|
addrDistrictList: [], // 区下拉
|
|
addrDistrictList: [], // 区下拉
|
|
userList: [], // 业务员 下拉
|
|
userList: [], // 业务员 下拉
|
|
custId: undefined, // 客户id
|
|
custId: undefined, // 客户id
|
|
- isEdit: true, // 是否可编辑
|
|
|
|
|
|
+ isEdit: false, // 是否可编辑
|
|
|
|
+ isChangeCust: false, // 是否更换客户
|
|
interId: null
|
|
interId: null
|
|
}
|
|
}
|
|
},
|
|
},
|
|
@@ -276,10 +276,29 @@ export default {
|
|
// 客户 select
|
|
// 客户 select
|
|
custSelect (v) {
|
|
custSelect (v) {
|
|
console.log(v, 'custSelect')
|
|
console.log(v, 'custSelect')
|
|
|
|
+ const _this = this
|
|
const cust = this.custAllList.find(item => item.customerSn == v)
|
|
const cust = this.custAllList.find(item => item.customerSn == v)
|
|
|
|
+ if (this.isEdit) {
|
|
|
|
+ // 变更了客户信息
|
|
|
|
+ if (cust.customerSn !== this.form.customerSn) {
|
|
|
|
+ this.isChangeCust = true
|
|
|
|
+ this.$confirm({
|
|
|
|
+ title: '提示',
|
|
|
|
+ content: '更换客户后信息需要重新完善,确认要更换吗?',
|
|
|
|
+ centered: true,
|
|
|
|
+ onOk () {
|
|
|
|
+ _this.custId = cust.id
|
|
|
|
+ _this.form.buyerName = cust.customerName
|
|
|
|
+ _this.isEdit = false
|
|
|
|
+ _this.getDetail()
|
|
|
|
+ _this.$emit('updateData')
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ }
|
|
this.custId = cust.id
|
|
this.custId = cust.id
|
|
this.form.buyerName = cust.customerName
|
|
this.form.buyerName = cust.customerName
|
|
- this.isEdit = false
|
|
|
|
this.getDetail()
|
|
this.getDetail()
|
|
},
|
|
},
|
|
// 客户 change
|
|
// 客户 change
|
|
@@ -287,17 +306,15 @@ export default {
|
|
console.log(val, 'custChange')
|
|
console.log(val, 'custChange')
|
|
this.$refs.ruleForm.resetFields()
|
|
this.$refs.ruleForm.resetFields()
|
|
this.custId = undefined
|
|
this.custId = undefined
|
|
- this.isEdit = true
|
|
|
|
},
|
|
},
|
|
// 编辑客户信息
|
|
// 编辑客户信息
|
|
editCust (data) {
|
|
editCust (data) {
|
|
console.log(data)
|
|
console.log(data)
|
|
|
|
+ this.title = '编辑客户信息'
|
|
|
|
+ this.isEdit = true
|
|
if (data.shippingAddressProvinceSn) { this.getArea('city', data.shippingAddressProvinceSn) }
|
|
if (data.shippingAddressProvinceSn) { this.getArea('city', data.shippingAddressProvinceSn) }
|
|
if (data.shippingAddressCitySn) { this.getArea('district', data.shippingAddressCitySn) }
|
|
if (data.shippingAddressCitySn) { this.getArea('district', data.shippingAddressCitySn) }
|
|
this.form = Object.assign(this.form, data)
|
|
this.form = Object.assign(this.form, data)
|
|
- // this.interId = setInterval(() => {
|
|
|
|
-
|
|
|
|
- // }, 100)
|
|
|
|
},
|
|
},
|
|
// 获取详情
|
|
// 获取详情
|
|
getDetail () {
|
|
getDetail () {
|
|
@@ -364,22 +381,27 @@ export default {
|
|
if (valid) {
|
|
if (valid) {
|
|
// 保存客户信息
|
|
// 保存客户信息
|
|
_this.handleSaveCust()
|
|
_this.handleSaveCust()
|
|
- // 新建或编辑销售单
|
|
|
|
- const form = this.form
|
|
|
|
- console.log(form, 'save data')
|
|
|
|
- salesSave(form).then(res => {
|
|
|
|
- if (res.status == 200) {
|
|
|
|
- _this.$message.success(res.message)
|
|
|
|
- _this.$emit('ok', res.data)
|
|
|
|
- _this.cancel()
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
|
|
+ // 保存销售单
|
|
|
|
+ _this.salesSaveFun()
|
|
} else {
|
|
} else {
|
|
console.log('error submit!!')
|
|
console.log('error submit!!')
|
|
return false
|
|
return false
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
+ // 新建或编辑销售单
|
|
|
|
+ salesSaveFun () {
|
|
|
|
+ const _this = this
|
|
|
|
+ const form = this.form
|
|
|
|
+ console.log(form, 'save data')
|
|
|
|
+ salesSave(form).then(res => {
|
|
|
|
+ if (res.status == 200) {
|
|
|
|
+ _this.$message.success(res.message)
|
|
|
|
+ _this.$emit('ok', res.data)
|
|
|
|
+ _this.cancel()
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
cancel () {
|
|
cancel () {
|
|
this.opened = false
|
|
this.opened = false
|
|
this.$refs.ruleForm.resetFields()
|
|
this.$refs.ruleForm.resetFields()
|