优化修改收货地址的地区选择县时的逻辑

This commit is contained in:
赵毅 2025-10-09 09:46:13 +08:00
parent 4169e76f53
commit 89d39117ba

View File

@ -161,23 +161,24 @@ export default {
console.log('省份没变,查市跟区', this.cityList)
let newDist = this.cityList[sq];
console.log('新的市信息', newDist);
if (this.xsq.ad_code !== newDist.ad_code) {
console.log('新市区跟旧市区不一')
if (!this.xsq || this.xsq.ad_code !== newDist.ad_code) {
console.log('新市区跟旧市区不一')
this.xsq = newDist;
this.confirmCity = newDist;
this.getDistList(newDist, x);
} else {
console.log('新市区跟旧市区一');
console.log('新市区跟旧市区一');
this.confirmDist = this.defaultDist[x]
}
return
}
const res = await request(apiArr.getArea, 'POST', { parent_ad_code: this.confirmProv1.ad_code }, { silent: false });
this.cityList = res.rows;
let newDist;
this.defaultCity = res.rows;
this.confirmCity = res.rows[0]; //
this.getDistList(newDist, x);
this.xsq = res.rows[0]; // xsq
this.getDistList(this.xsq, x);
},
// /
async getDistList(xsq, x) {
@ -293,16 +294,18 @@ export default {
bindChange(e) {
console.log('[1231331], e', e);
const { value } = e.detail;
// // /
let newCrty = this.provList[value[0]];
console.log('新的省份信息', newCrty);
console.log('旧的省信息', this.confirmProv1);
//
if (newCrty.ad_code === this.confirmProv1.ad_code) {
console.log('省份信息没变');
this.sf = false;
} else {
this.sf = true;
}
console.log('this.cityListthis.cityList', this.cityList);
this.confirmProv1 = newCrty
this.getCityList(value[1], value[2])