|
@@ -237,27 +237,27 @@
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col :xs="24" :sm="24" :md="24" :lg="16" :xl="16">
|
|
|
- <a-form-model-item label="收货地址" required style="margin: 0;" :label-col="{span:4}" :wrapper-col="{span:20}">
|
|
|
+ <a-form-model-item label="收货地址" style="margin: 0;" :label-col="{span:4}" :wrapper-col="{span:20}">
|
|
|
<a-row :gutter="20">
|
|
|
<!-- 地址 -->
|
|
|
<a-col span="8">
|
|
|
<a-form-model-item prop="receiveProvinceSn">
|
|
|
- <a-select id="merchantInfoManagementEdit-receiveProvinceSn" @change="getCityList" v-model="form.receiveProvinceSn" placeholder="请选择省">
|
|
|
- <a-select-option v-for="item in addrProvinceList" :value="item.sn" :key="item.sn + 'a'">{{ item.name }}</a-select-option>
|
|
|
+ <a-select id="merchantInfoManagementEdit-receiveProvinceSn" @change="getCityList1" v-model="form.receiveProvinceSn" placeholder="请选择省">
|
|
|
+ <a-select-option v-for="item in addrProvinceList1" :value="item.sn" :key="item.sn + 'a'">{{ item.name }}</a-select-option>
|
|
|
</a-select>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col span="8">
|
|
|
<a-form-model-item prop="receiveCitySn">
|
|
|
- <a-select id="merchantInfoManagementEdit-receiveCitySn" @change="getAreaList" v-model="form.receiveCitySn" placeholder="请选择市">
|
|
|
- <a-select-option v-for="item in addrCityList" :value="item.sn" :key="item.sn + 'b'">{{ item.name }}</a-select-option>
|
|
|
+ <a-select id="merchantInfoManagementEdit-receiveCitySn" @change="getAreaList1" v-model="form.receiveCitySn" placeholder="请选择市">
|
|
|
+ <a-select-option v-for="item in addrCityList1" :value="item.sn" :key="item.sn + 'b'">{{ item.name }}</a-select-option>
|
|
|
</a-select>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col span="8">
|
|
|
<a-form-model-item prop="receiveDistrictSn">
|
|
|
- <a-select id="merchantInfoManagementEdit-receiveDistrictSn" @change="areaCharged" v-model="form.receiveDistrictSn" placeholder="请选择区/县">
|
|
|
- <a-select-option v-for="item in addrDistrictList" :value="item.sn" :key="item.sn + 'c'">{{ item.name }}</a-select-option>
|
|
|
+ <a-select id="merchantInfoManagementEdit-receiveDistrictSn" @change="areaCharged1" v-model="form.receiveDistrictSn" placeholder="请选择区/县">
|
|
|
+ <a-select-option v-for="item in addrDistrictList1" :value="item.sn" :key="item.sn + 'c'">{{ item.name }}</a-select-option>
|
|
|
</a-select>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
@@ -371,6 +371,7 @@
|
|
|
<script>
|
|
|
import { getArea } from '@/api/data'
|
|
|
import { VSelect } from '@/components'
|
|
|
+import { dealerSave } from '@/api/dealer'
|
|
|
export default {
|
|
|
components: { VSelect },
|
|
|
data () {
|
|
@@ -384,13 +385,44 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
form: {
|
|
|
- time: ''
|
|
|
+ isShowSpecialPrice: 0
|
|
|
+ },
|
|
|
+ rules: {
|
|
|
+ dealerName: [
|
|
|
+ { required: true, message: '请输入经销商名称', trigger: 'change' }
|
|
|
+ ],
|
|
|
+ dealerAlias: [
|
|
|
+ { required: true, message: '请输入经销商别名', trigger: 'change' }
|
|
|
+ ],
|
|
|
+ dealerType: [
|
|
|
+ { required: true, message: '请选择商户类型', trigger: 'change' }
|
|
|
+ ],
|
|
|
+ contact: [
|
|
|
+ { required: true, message: '请输入联系人1', trigger: 'change' }
|
|
|
+ ],
|
|
|
+ contactMobile: [
|
|
|
+ { required: true, message: '请输入联系手机1', trigger: 'change' }
|
|
|
+ ],
|
|
|
+ provinceSn: [
|
|
|
+ { required: true, message: '请选择省', trigger: 'change' }
|
|
|
+ ],
|
|
|
+ citySn: [
|
|
|
+ { required: true, message: '请选择市', trigger: 'change' }
|
|
|
+ ],
|
|
|
+ districtSn: [
|
|
|
+ { required: true, message: '请选择区县', trigger: 'change' }
|
|
|
+ ],
|
|
|
+ address: [
|
|
|
+ { required: true, message: '请输入详细地址', trigger: 'change' }
|
|
|
+ ]
|
|
|
},
|
|
|
- rules: {},
|
|
|
brandData: [],
|
|
|
addrProvinceList: [], // 省下拉
|
|
|
addrCityList: [], // 市下拉
|
|
|
addrDistrictList: [], // 区下拉
|
|
|
+ addrProvinceList1: [], // 省下拉
|
|
|
+ addrCityList1: [], // 市下拉
|
|
|
+ addrDistrictList1: [], // 区下拉
|
|
|
dateFormat: 'YYYY-MM-DD'
|
|
|
}
|
|
|
},
|
|
@@ -400,10 +432,24 @@ export default {
|
|
|
return date && date.valueOf() > Date.now()
|
|
|
},
|
|
|
// 提交
|
|
|
- handleSubmit () {},
|
|
|
+ handleSubmit () {
|
|
|
+ this.$refs.ruleForm.validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ console.log(this.form, 'form data')
|
|
|
+ dealerSave(this.form).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ this.$message.success(res.message)
|
|
|
+ this.handleBack()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
// 返回
|
|
|
handleBack () {
|
|
|
- this.$router.push({ path: '/dealerManagement/merchantInfoManagement/list' })
|
|
|
+ this.$router.push({ name: 'merchantInfoManagementList' })
|
|
|
},
|
|
|
// 获取城市列表
|
|
|
getCityList (val) {
|
|
@@ -414,9 +460,9 @@ export default {
|
|
|
this.addrCityList = []
|
|
|
this.addrDistrictList = []
|
|
|
this.form.citySn = undefined
|
|
|
- this.form.countySn = undefined
|
|
|
- this.form.supplierAddress = ''
|
|
|
- this.getArea('city', val)
|
|
|
+ this.form.districtSn = undefined
|
|
|
+ this.form.address = ''
|
|
|
+ this.getArea('city', val, 0)
|
|
|
},
|
|
|
// 获取区县列表
|
|
|
getAreaList (val) {
|
|
@@ -425,9 +471,9 @@ export default {
|
|
|
this.form.cityName = this.addrCityList[index].name
|
|
|
}
|
|
|
this.addrDistrictList = []
|
|
|
- this.form.countySn = undefined
|
|
|
- this.form.supplierAddress = ''
|
|
|
- this.getArea('district', val)
|
|
|
+ this.form.districtSn = undefined
|
|
|
+ this.form.address = ''
|
|
|
+ this.getArea('district', val, 0)
|
|
|
},
|
|
|
// 区县变更
|
|
|
areaCharged (val) {
|
|
@@ -435,32 +481,82 @@ export default {
|
|
|
if (index >= 0) {
|
|
|
this.form.districtName = this.addrDistrictList[index].name
|
|
|
}
|
|
|
- this.form.supplierAddress = ''
|
|
|
+ this.form.address = ''
|
|
|
+ },
|
|
|
+ // 获取城市列表
|
|
|
+ getCityList1 (val) {
|
|
|
+ const index = this.addrProvinceList1.findIndex(item => item.sn == val)
|
|
|
+ if (index >= 0) {
|
|
|
+ this.form.receiveProvinceName = this.addrProvinceList[index].name
|
|
|
+ }
|
|
|
+ this.addrCityList1 = []
|
|
|
+ this.addrDistrictList1 = []
|
|
|
+ this.form.receiveCitySn = undefined
|
|
|
+ this.form.receiveDistrictSn = undefined
|
|
|
+ this.form.receiveAddress = ''
|
|
|
+ this.getArea('city', val, 1)
|
|
|
+ },
|
|
|
+ // 获取区县列表
|
|
|
+ getAreaList1 (val) {
|
|
|
+ const index = this.addrCityList1.findIndex(item => item.sn == val)
|
|
|
+ if (index >= 0) {
|
|
|
+ this.form.receiveCityName = this.addrCityList1[index].name
|
|
|
+ }
|
|
|
+ this.addrDistrictList1 = []
|
|
|
+ this.form.receiveDistrictSn = undefined
|
|
|
+ this.form.receiveAddress = ''
|
|
|
+ this.getArea('district', val, 1)
|
|
|
+ },
|
|
|
+ // 区县变更
|
|
|
+ areaCharged1 (val) {
|
|
|
+ const index = this.addrDistrictList1.findIndex(item => item.sn == val)
|
|
|
+ if (index >= 0) {
|
|
|
+ this.form.receiveDistrictName = this.addrDistrictList1[index].name
|
|
|
+ }
|
|
|
+ this.form.receiveAddress = ''
|
|
|
},
|
|
|
// 省/市/区
|
|
|
- getArea (type, sn) {
|
|
|
+ getArea (leve, sn, index) {
|
|
|
let params
|
|
|
- if (type == 'province') {
|
|
|
- params = { level: '1' }
|
|
|
+ if (leve == 'province') {
|
|
|
+ params = { type: '2' }
|
|
|
} else {
|
|
|
- params = { psn: sn }
|
|
|
+ params = { parentId: sn, type: leve == 'city' ? '3' : '4' }
|
|
|
}
|
|
|
getArea(params).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
- if (type == 'province') {
|
|
|
- this.addrProvinceList = res.data || []
|
|
|
- } else if (type == 'city') {
|
|
|
- this.addrCityList = res.data || []
|
|
|
- } else if (type == 'district') {
|
|
|
- this.addrDistrictList = res.data || []
|
|
|
+ if (leve == 'province') {
|
|
|
+ this.addrProvinceList = JSON.parse(JSON.stringify(res.data || []))
|
|
|
+ if (index == 1) {
|
|
|
+ this.addrProvinceList1 = JSON.parse(JSON.stringify(res.data || []))
|
|
|
+ }
|
|
|
+ } else if (leve == 'city') {
|
|
|
+ this.addrCityList = JSON.parse(JSON.stringify(res.data || []))
|
|
|
+ if (index == 1) {
|
|
|
+ this.addrCityList1 = JSON.parse(JSON.stringify(res.data || []))
|
|
|
+ }
|
|
|
+ } else if (leve == 'district') {
|
|
|
+ this.addrDistrictList = JSON.parse(JSON.stringify(res.data || []))
|
|
|
+ if (index == 1) {
|
|
|
+ this.addrDistrictList1 = JSON.parse(JSON.stringify(res.data || []))
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
- if (type == 'province') {
|
|
|
+ if (leve == 'province') {
|
|
|
this.addrProvinceList = []
|
|
|
- } else if (type == 'city') {
|
|
|
+ if (index == 1) {
|
|
|
+ this.addrProvinceList1 = []
|
|
|
+ }
|
|
|
+ } else if (leve == 'city') {
|
|
|
this.addrCityList = []
|
|
|
- } else if (type == 'district') {
|
|
|
+ if (index == 1) {
|
|
|
+ this.addrCityList1 = []
|
|
|
+ }
|
|
|
+ } else if (leve == 'district') {
|
|
|
this.addrDistrictList = []
|
|
|
+ if (index == 1) {
|
|
|
+ this.addrDistrictList1 = []
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
})
|