|
@@ -32,7 +32,7 @@
|
|
|
<a-select-option v-for="item in custAllList" :key="item.customerSn" :title="item.id">{{ item.customerName }}</a-select-option>
|
|
|
</template>
|
|
|
</a-auto-complete>
|
|
|
- </a-button></a-form-model-item>
|
|
|
+ </a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col :span="16">
|
|
|
<a-form-model-item><a-button type="dashed" icon="plus">
|
|
@@ -46,22 +46,22 @@
|
|
|
<a-row :gutter="15">
|
|
|
<!-- 客户地址 -->
|
|
|
<a-col span="8">
|
|
|
- <a-form-model-item prop="provinceSn">
|
|
|
- <a-select id="chooseCustom-provinceSn" @change="getCityList" v-model="form.provinceSn" placeholder="请选择省">
|
|
|
+ <a-form-model-item prop="shippingAddressProvinceSn">
|
|
|
+ <a-select id="chooseCustom-provinceSn" @change="getCityList" v-model="form.shippingAddressProvinceSn" placeholder="请选择省">
|
|
|
<a-select-option v-for="item in addrProvinceList" :value="item.id" :key="item.id + 'a'">{{ item.name }}</a-select-option>
|
|
|
</a-select>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col span="8">
|
|
|
- <a-form-model-item prop="citySn">
|
|
|
- <a-select id="chooseCustom-citySn" @change="getAreaList" v-model="form.citySn" placeholder="请选择市">
|
|
|
+ <a-form-model-item prop="shippingAddressCitySn">
|
|
|
+ <a-select id="chooseCustom-citySn" @change="getAreaList" v-model="form.shippingAddressCitySn" placeholder="请选择市">
|
|
|
<a-select-option v-for="item in addrCityList" :value="item.id" :key="item.id + 'b'">{{ item.name }}</a-select-option>
|
|
|
</a-select>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col span="8">
|
|
|
- <a-form-model-item prop="countySn">
|
|
|
- <a-select id="chooseCustom-countySn" @change="areaCharged" v-model="form.countySn" placeholder="请选择区/县">
|
|
|
+ <a-form-model-item prop="shippingAddressCountySn">
|
|
|
+ <a-select id="chooseCustom-countySn" @change="areaCharged" v-model="form.shippingAddressCountySn" placeholder="请选择区/县">
|
|
|
<a-select-option v-for="item in addrDistrictList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
|
|
|
</a-select>
|
|
|
</a-form-model-item>
|
|
@@ -149,8 +149,8 @@
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col :span="8">
|
|
|
- <a-form-model-item label="铺货出库" prop="distributionFalg">
|
|
|
- <v-select code="FLAG" id="chooseCustom-distributionFalg" v-model="form.distributionFalg" allowClear placeholder="请选择"></v-select>
|
|
|
+ <a-form-model-item label="铺货出库" prop="distributionFlag">
|
|
|
+ <v-select code="FLAG" id="chooseCustom-distributionFlag" v-model="form.distributionFlag" allowClear placeholder="请选择"></v-select>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
</a-row>
|
|
@@ -180,8 +180,8 @@
|
|
|
|
|
|
<script>
|
|
|
import { getArea } from '@/api/data'
|
|
|
-import { custAllList, custFindById, custSave } from '@/api/customer'
|
|
|
-import { salesInsert } from '@/api/sales'
|
|
|
+import { custAllList, custFindById, custSave, updateByCustomerSn } from '@/api/customer'
|
|
|
+import { salesInsert, salesUpdate } from '@/api/sales'
|
|
|
import { getUserAllList } from '@/api/power-user'
|
|
|
import { VSelect } from '@/components'
|
|
|
export default {
|
|
@@ -203,11 +203,11 @@ export default {
|
|
|
buyerSn: '', // 客户sn
|
|
|
consigneeTel: '', // 联系电话
|
|
|
consigneeName: '', // 联系人
|
|
|
- provinceSn: undefined, // 省
|
|
|
+ shippingAddressProvinceSn: undefined, // 省
|
|
|
shippingAddressProvinceName: '',
|
|
|
- citySn: undefined, // 市
|
|
|
+ shippingAddressCitySn: undefined, // 市
|
|
|
shippingAddressCityName: '',
|
|
|
- countySn: undefined, // 区
|
|
|
+ shippingAddressCountySn: undefined, // 区
|
|
|
shippingAddressCountyName: '',
|
|
|
shippingAddress: '', // 详细地址
|
|
|
fax: '', // 客户传真
|
|
@@ -219,11 +219,10 @@ export default {
|
|
|
settleStyle: '', // 收款方式
|
|
|
salesManSn: undefined, // 业务员
|
|
|
salesManName: '',
|
|
|
- distributionFalg: '0', // 铺货出库
|
|
|
+ distributionFlag: '0', // 铺货出库
|
|
|
salesTragetType: 'C',
|
|
|
remarks: '' // 备注
|
|
|
},
|
|
|
- custInfo: {}, // 客户信息
|
|
|
rules: {
|
|
|
buyerSn: [
|
|
|
{ required: true, message: '请输入客户名称', trigger: ['change', 'blur'] }
|
|
@@ -231,13 +230,13 @@ export default {
|
|
|
consigneeTel: [
|
|
|
{ required: true, message: '请输入联系电话', trigger: 'blur' }
|
|
|
],
|
|
|
- provinceSn: [
|
|
|
+ shippingAddressProvinceSn: [
|
|
|
{ required: true, message: '请选择省', trigger: 'change' }
|
|
|
],
|
|
|
- citySn: [
|
|
|
+ shippingAddressCitySn: [
|
|
|
{ required: true, message: '请选择市', trigger: 'change' }
|
|
|
],
|
|
|
- countySn: [
|
|
|
+ shippingAddressCountySn: [
|
|
|
{ required: true, message: '请选择区/县', trigger: 'change' }
|
|
|
],
|
|
|
shippingAddress: [
|
|
@@ -252,7 +251,7 @@ export default {
|
|
|
settleStyle: [
|
|
|
{ required: true, message: '请选择收款方式', trigger: 'change' }
|
|
|
],
|
|
|
- distributionFalg: [
|
|
|
+ distributionFlag: [
|
|
|
{ required: true, message: '请选择是否铺货出库', trigger: 'change' }
|
|
|
]
|
|
|
// salesManSn: [
|
|
@@ -265,7 +264,8 @@ export default {
|
|
|
addrDistrictList: [], // 区下拉
|
|
|
userList: [], // 业务员 下拉
|
|
|
custId: undefined, // 客户id
|
|
|
- isEdit: true // 是否可编辑
|
|
|
+ isEdit: true, // 是否可编辑
|
|
|
+ interId: null
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
@@ -275,6 +275,7 @@ export default {
|
|
|
},
|
|
|
// 客户 select
|
|
|
custSelect (v) {
|
|
|
+ console.log(v, 'custSelect')
|
|
|
const cust = this.custAllList.find(item => item.customerSn == v)
|
|
|
this.custId = cust.id
|
|
|
this.form.buyerName = cust.customerName
|
|
@@ -283,18 +284,20 @@ export default {
|
|
|
},
|
|
|
// 客户 change
|
|
|
custChange (val) {
|
|
|
- if (val == undefined || val == '') {
|
|
|
- this.$refs.ruleForm.resetFields()
|
|
|
- }
|
|
|
+ console.log(val, 'custChange')
|
|
|
+ this.$refs.ruleForm.resetFields()
|
|
|
this.custId = undefined
|
|
|
this.isEdit = true
|
|
|
},
|
|
|
// 编辑客户信息
|
|
|
editCust (data) {
|
|
|
console.log(data)
|
|
|
- if (data.provinceSn) { this.getArea('city', data.provinceSn) }
|
|
|
- if (data.citySn) { this.getArea('district', data.citySn) }
|
|
|
- this.form = data
|
|
|
+ if (data.shippingAddressProvinceSn) { this.getArea('city', data.shippingAddressProvinceSn) }
|
|
|
+ if (data.shippingAddressCitySn) { this.getArea('district', data.shippingAddressCitySn) }
|
|
|
+ this.form = Object.assign(this.form, data)
|
|
|
+ // this.interId = setInterval(() => {
|
|
|
+
|
|
|
+ // }, 100)
|
|
|
},
|
|
|
// 获取详情
|
|
|
getDetail () {
|
|
@@ -308,11 +311,11 @@ export default {
|
|
|
buyerSn: data.customerSn, // 客户sn
|
|
|
consigneeTel: data.contactTel, // 联系电话
|
|
|
consigneeName: data.contactName, // 联系人
|
|
|
- provinceSn: data.provinceSn, // 省
|
|
|
+ shippingAddressProvinceSn: data.provinceSn, // 省
|
|
|
shippingAddressProvinceName: data.provinceName,
|
|
|
- citySn: data.citySn, // 市
|
|
|
+ shippingAddressCitySn: data.citySn, // 市
|
|
|
shippingAddressCityName: data.cityName,
|
|
|
- countySn: data.countySn, // 区
|
|
|
+ shippingAddressCountySn: data.countySn, // 区
|
|
|
shippingAddressCountyName: data.countyName,
|
|
|
shippingAddress: data.customerAddr, // 详细地址
|
|
|
fax: data.fax, // 客户传真
|
|
@@ -322,8 +325,6 @@ export default {
|
|
|
priceType: data.priceType, // 价格类型
|
|
|
settleStyle: data.settleStyleSn // 收款方式
|
|
|
})
|
|
|
- // 临时存储客户信息
|
|
|
- this.custInfo = data
|
|
|
} else {
|
|
|
this.$message.error('获取客户信息失败')
|
|
|
this.$refs.ruleForm.resetFields()
|
|
@@ -333,16 +334,16 @@ export default {
|
|
|
},
|
|
|
// 保存客户信息
|
|
|
handleSaveCust () {
|
|
|
- custSave({
|
|
|
- id: this.custInfo.id,
|
|
|
+ updateByCustomerSn({
|
|
|
+ customerSn: this.form.buyerSn,
|
|
|
customerName: this.form.buyerName,
|
|
|
contactTel: this.form.consigneeTel, // 联系电话
|
|
|
contactName: this.form.consigneeName, // 联系人
|
|
|
- provinceSn: this.form.provinceSn, // 省
|
|
|
+ provinceSn: this.form.shippingAddressProvinceSn, // 省
|
|
|
provinceName: this.form.shippingAddressProvinceName,
|
|
|
- citySn: this.form.citySn, // 市
|
|
|
+ citySn: this.form.shippingAddressCitySn, // 市
|
|
|
cityName: this.form.shippingAddressCityName,
|
|
|
- countySn: this.form.countySn, // 区
|
|
|
+ countySn: this.form.shippingAddressCountySn, // 区
|
|
|
countyName: this.form.shippingAddressCountyName,
|
|
|
customerAddr: this.form.shippingAddress, // 详细地址
|
|
|
dispatchType: this.form.dispatchType, // 配送方式
|
|
@@ -366,13 +367,24 @@ export default {
|
|
|
// 新建销售单
|
|
|
const form = this.form
|
|
|
console.log(form, 'save data')
|
|
|
- salesInsert(form).then(res => {
|
|
|
- if (res.status == 200) {
|
|
|
- _this.$message.success(res.message)
|
|
|
- _this.$emit('ok', res.data)
|
|
|
- _this.cancel()
|
|
|
- }
|
|
|
- })
|
|
|
+ // 编辑
|
|
|
+ if (this.form.id) {
|
|
|
+ salesUpdate(form).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ _this.$message.success(res.message)
|
|
|
+ _this.$emit('ok', res.data)
|
|
|
+ _this.cancel()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ salesInsert(form).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ _this.$message.success(res.message)
|
|
|
+ _this.$emit('ok', res.data)
|
|
|
+ _this.cancel()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
} else {
|
|
|
console.log('error submit!!')
|
|
|
return false
|
|
@@ -410,9 +422,9 @@ export default {
|
|
|
console.log(val, '-------------')
|
|
|
this.addrCityList = []
|
|
|
this.addrDistrictList = []
|
|
|
- this.form.citySn = undefined
|
|
|
+ this.form.shippingAddressCitySn = undefined
|
|
|
this.form.shippingAddressCityName = ''
|
|
|
- this.form.countySn = undefined
|
|
|
+ this.form.shippingAddressCountySn = undefined
|
|
|
this.form.shippingAddressCountyName = ''
|
|
|
this.form.shippingAddress = ''
|
|
|
this.form.shippingAddressCountyName = this.addrProvinceList.find(item => item.id == val).name
|
|
@@ -421,7 +433,7 @@ export default {
|
|
|
// 获取区县列表
|
|
|
getAreaList (val) {
|
|
|
this.addrDistrictList = []
|
|
|
- this.form.countySn = undefined
|
|
|
+ this.form.shippingAddressCountySn = undefined
|
|
|
this.form.shippingAddressCountyName = ''
|
|
|
this.form.shippingAddress = ''
|
|
|
this.form.shippingAddressCityName = this.addrCityList.find(item => item.id == val).name
|