|
@@ -53,23 +53,23 @@
|
|
|
<a-row :gutter="15">
|
|
|
<!-- 客户地址 -->
|
|
|
<a-col span="8">
|
|
|
- <a-form-model-item prop="province">
|
|
|
- <a-select id="customerManagementEdit-province" @change="getCityList" v-model="form.province" placeholder="请选择省">
|
|
|
+ <a-form-model-item prop="provinceId">
|
|
|
+ <a-select id="customerManagementEdit-provinceId" @change="getCityList" v-model="form.provinceId" 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="city">
|
|
|
- <a-select id="customerManagementEdit-city" @change="getAreaList" v-model="form.city" placeholder="请选择市">
|
|
|
+ <a-form-model-item prop="cityId">
|
|
|
+ <a-select id="customerManagementEdit-cityId" @change="getAreaList" v-model="form.cityId" 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="district">
|
|
|
- <a-select id="customerManagementEdit-district" @change="areaCharged" v-model="form.district" placeholder="请选择区/县">
|
|
|
- <a-select-option v-for="item in addrDistrictList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
|
|
|
+ <a-form-model-item prop="areaId">
|
|
|
+ <a-select id="customerManagementEdit-areaId" @change="areaCharged" v-model="form.areaId" placeholder="请选择区/县">
|
|
|
+ <a-select-option v-for="item in addrAreaList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
|
|
|
</a-select>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
@@ -105,8 +105,8 @@
|
|
|
</a-col>
|
|
|
<a-col :span="8">
|
|
|
<a-form-model-item label="是否卫星仓客户" prop="contactPhone">
|
|
|
- <a-select id="customerManagementEdit-districtCode" v-model="form.districtCode" placeholder="请选择">
|
|
|
- <a-select-option v-for="item in addrDistrictList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
|
|
|
+ <a-select id="customerManagementEdit-areaCode" v-model="form.areaCode" placeholder="请选择">
|
|
|
+ <a-select-option v-for="item in addrAreaList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
|
|
|
</a-select>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
@@ -115,7 +115,7 @@
|
|
|
<a-col :span="8">
|
|
|
<a-form-model-item label="客户类型" prop="custType">
|
|
|
<a-select id="customerManagementEdit-custType" v-model="form.custType" allowClear placeholder="请选择客户类型">
|
|
|
- <a-select-option v-for="item in addrDistrictList" :value="item.id" :key="item.id">{{ item.name }}</a-select-option>
|
|
|
+ <a-select-option v-for="item in addrAreaList" :value="item.id" :key="item.id">{{ item.name }}</a-select-option>
|
|
|
</a-select>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
@@ -126,7 +126,7 @@
|
|
|
</a-col>
|
|
|
<a-col :span="8">
|
|
|
<a-form-model-item label="支付方式" prop="payType">
|
|
|
- <v-select code="PAY_FASHION" id="customerManagementEdit-payType" v-model="form.payType" allowClear placeholder="请选择支付方式"></v-select>
|
|
|
+ <v-select code="PAY_FASHION" id="customerManagementEdit-payType" v-model="form.payType" allowClear placeholder="请选择支付方式" />
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
</a-row>
|
|
@@ -173,17 +173,17 @@ export default {
|
|
|
name: '', // 客户名称
|
|
|
mobile: '', // 联系手机
|
|
|
contact: '', // 联系人
|
|
|
- province: undefined, // 省
|
|
|
- provinceName: '',
|
|
|
- city: undefined, // 市
|
|
|
- cityName: '',
|
|
|
- district: undefined, // 区
|
|
|
- districtName: '',
|
|
|
+ provinceId: undefined, // 省
|
|
|
+ province: '',
|
|
|
+ cityId: undefined, // 市
|
|
|
+ city: '',
|
|
|
+ areaId: undefined, // 区
|
|
|
+ area: '',
|
|
|
address: '', // 详细地址
|
|
|
fax: '', // 客户传真
|
|
|
distributionType: '', // 配送方式
|
|
|
remarks: '', // 是否卫星仓客户
|
|
|
- custType: '', // 客户类型
|
|
|
+ custType: undefined, // 客户类型
|
|
|
priceType: '', // 价格类型
|
|
|
payType: '', // 支付方式
|
|
|
paymentType: '', // 收款方式
|
|
@@ -196,36 +196,31 @@ export default {
|
|
|
mobile: [
|
|
|
{ required: true, message: '请输入联系手机', trigger: 'blur' }
|
|
|
],
|
|
|
- province: [
|
|
|
+ provinceId: [
|
|
|
{ required: true, message: '请选择省', trigger: 'change' }
|
|
|
],
|
|
|
- city: [
|
|
|
+ cityId: [
|
|
|
{ required: true, message: '请选择市', trigger: 'change' }
|
|
|
],
|
|
|
- district: [
|
|
|
+ areaId: [
|
|
|
{ required: true, message: '请选择区/县', trigger: 'change' }
|
|
|
],
|
|
|
priceType: [
|
|
|
- { required: true, message: '请选择价格类型', trigger: 'change' }
|
|
|
+ { required: true, message: '请选择价格类型', trigger: ['change', 'blur'] }
|
|
|
],
|
|
|
payType: [
|
|
|
- { required: true, message: '请选择支付方式', trigger: 'change' }
|
|
|
+ { required: true, message: '请选择支付方式', trigger: ['change', 'blur'] }
|
|
|
],
|
|
|
paymentType: [
|
|
|
- { required: true, message: '请选择收款方式', trigger: 'change' }
|
|
|
+ { required: true, message: '请选择收款方式', trigger: ['change', 'blur'] }
|
|
|
]
|
|
|
},
|
|
|
addrProvinceList: [], // 省下拉
|
|
|
addrCityList: [], // 市下拉
|
|
|
- addrDistrictList: [], // 区下拉
|
|
|
+ addrAreaList: [], // 区下拉
|
|
|
custTypeList: [], // 客户类型 下拉数据
|
|
|
}
|
|
|
},
|
|
|
- computed: {
|
|
|
- isEdit () {
|
|
|
- return this.$route.name === 'customerManagementEdit'
|
|
|
- }
|
|
|
- },
|
|
|
methods: {
|
|
|
// 获取客户信息
|
|
|
getDetail () {
|
|
@@ -249,18 +244,21 @@ export default {
|
|
|
const _this = this
|
|
|
this.$refs.ruleForm.validate(valid => {
|
|
|
if (valid) {
|
|
|
- const form = values.form
|
|
|
- form.desc = _this.form.desc
|
|
|
- form.id = this.isEdit ? this.$route.params.id : null
|
|
|
+ const form = _this.form
|
|
|
+ form.id = this.$route.params.id ? this.$route.params.id : null
|
|
|
+ let areas = [ form.provinceId, form.cityId, form.areaId ]
|
|
|
+ form.areas = areas.join(',')
|
|
|
+ delete form.provinceId
|
|
|
+ delete form.cityId
|
|
|
console.log(form,'-----提交信息')
|
|
|
- // custSave(form).then(res => {
|
|
|
- // if (res.status == 200) {
|
|
|
- // _this.$message.success(res.message)
|
|
|
- // setTimeout(() => {
|
|
|
- // _this.$router.push({ path: '/shop/goods/list' })
|
|
|
- // }, 1000)
|
|
|
- // }
|
|
|
- // })
|
|
|
+ custSave(form).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ _this.$message.success(res.message)
|
|
|
+ setTimeout(() => {
|
|
|
+ _this.$router.push({ path: '/salesManagement/customerManagement/list' })
|
|
|
+ }, 1000)
|
|
|
+ }
|
|
|
+ })
|
|
|
} else {
|
|
|
console.log('error submit!!')
|
|
|
return false
|
|
@@ -271,7 +269,7 @@ export default {
|
|
|
handleBack(){
|
|
|
this.$router.push({ path: '/salesManagement/customerManagement/list' })
|
|
|
},
|
|
|
- // 获取省列表'
|
|
|
+ // 获取省列表
|
|
|
getProvinceList () {
|
|
|
getProvince().then(res => {
|
|
|
if (res.status == 200) {
|
|
@@ -283,10 +281,16 @@ export default {
|
|
|
},
|
|
|
// 获取城市列表
|
|
|
getCityList (val) {
|
|
|
+ const _this = this
|
|
|
+ this.addrProvinceList.map(item => {
|
|
|
+ if(item.id == val){
|
|
|
+ _this.form.province = item.name
|
|
|
+ }
|
|
|
+ })
|
|
|
this.addrCityList = []
|
|
|
- this.addrDistrictList = []
|
|
|
- this.form.cityCode = undefined
|
|
|
- this.form.districtCode = undefined
|
|
|
+ this.addrAreaList = []
|
|
|
+ this.form.cityId = undefined
|
|
|
+ this.form.areaId = undefined
|
|
|
this.form.address = ''
|
|
|
this.getCityListRequest(val)
|
|
|
},
|
|
@@ -303,8 +307,14 @@ export default {
|
|
|
},
|
|
|
// 获取区县列表
|
|
|
getAreaList (val) {
|
|
|
- this.addrDistrictList = []
|
|
|
- this.form.districtCode = undefined
|
|
|
+ const _this = this
|
|
|
+ this.addrCityList.map(item => {
|
|
|
+ if(item.id == val){
|
|
|
+ _this.form.city = item.name
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.addrAreaList = []
|
|
|
+ this.form.areaId = undefined
|
|
|
this.form.address = ''
|
|
|
this.getAreaListRequest(val)
|
|
|
},
|
|
@@ -313,14 +323,20 @@ export default {
|
|
|
id: val
|
|
|
}).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
- this.addrDistrictList = res.data || []
|
|
|
+ this.addrAreaList = res.data || []
|
|
|
} else {
|
|
|
- this.addrDistrictList = []
|
|
|
+ this.addrAreaList = []
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
// 区县变更
|
|
|
areaCharged (val) {
|
|
|
+ const _this = this
|
|
|
+ this.addrAreaList.map(item => {
|
|
|
+ if(item.id == val){
|
|
|
+ _this.form.area = item.name
|
|
|
+ }
|
|
|
+ })
|
|
|
this.form.address = ''
|
|
|
}
|
|
|
},
|
|
@@ -329,7 +345,7 @@ export default {
|
|
|
vm.getProvinceList() // 省市区
|
|
|
vm.getCustTypeList() // 客户类型
|
|
|
vm.$refs.ruleForm.resetFields()
|
|
|
- if (vm.isEdit) { // 编辑页
|
|
|
+ if (vm.$route.params.id) { // 编辑页
|
|
|
vm.getDetail()
|
|
|
}
|
|
|
})
|