Commit 5c7a3d88 by 张立顺

fix bug

1 parent 1146ee0d
...@@ -298,6 +298,7 @@ export default { ...@@ -298,6 +298,7 @@ export default {
} catch { } catch {
return; return;
} }
this.syncEditDataRegionFromProvinceCityRef();
const params = this.buildSubmitVerificationPayload( const params = this.buildSubmitVerificationPayload(
merchantBrandList merchantBrandList
); );
......
...@@ -32,6 +32,21 @@ function parentMerchantSupportsAccountType(parentRow, typeDictValue) { ...@@ -32,6 +32,21 @@ function parentMerchantSupportsAccountType(parentRow, typeDictValue) {
return allowed.includes(tv); return allowed.includes(tv);
} }
/** 省市区树节点上的行政区划码(高德 adcode;部分网关仅返回 code / citycode) */
function districtTreeNodeCode(node) {
if (!node || typeof node !== "object") return "";
const raw =
node.adcode != null && node.adcode !== ""
? node.adcode
: node.code != null && node.code !== ""
? node.code
: node.citycode != null && node.citycode !== ""
? node.citycode
: "";
if (raw === "" || raw == null) return "";
return String(raw).trim();
}
/** 解析商户名校验接口返回值(boolean / data.exists / data 等) */ /** 解析商户名校验接口返回值(boolean / data.exists / data 等) */
export function normalizeMerchantNameDuplicateResponse(res) { export function normalizeMerchantNameDuplicateResponse(res) {
if (res == null) return false; if (res == null) return false;
...@@ -479,13 +494,13 @@ export default { ...@@ -479,13 +494,13 @@ export default {
const v = value == null ? "" : String(value); const v = value == null ? "" : String(value);
if ( if (
!/^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{6,20}$/.test( !/^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{6,20}$/.test(
v, v
) )
) { ) {
callback( callback(
new Error( new Error(
"登录密码须为6-20位,仅字母与数字且须同时包含字母与数字", "登录密码须为6-20位,仅字母与数字且须同时包含字母与数字"
), )
); );
return false; return false;
} }
...@@ -652,9 +667,14 @@ export default { ...@@ -652,9 +667,14 @@ export default {
this.$refs.provinceForm.resetAddressForm(); this.$refs.provinceForm.resetAddressForm();
} }
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.editFormRef?.$refs[ const editForm = this.$refs.editFormRef;
this.editChildRef if (
]?.clearValidate(); editForm &&
typeof editForm.resetPasswordToggle === "function"
) {
editForm.resetPasswordToggle();
}
editForm?.$refs[this.editChildRef]?.clearValidate();
}); });
}, },
getOptionsList(formName, hasAll = true, refreshSigle) { getOptionsList(formName, hasAll = true, refreshSigle) {
...@@ -935,6 +955,90 @@ export default { ...@@ -935,6 +955,90 @@ export default {
this.$refs.provinceForm.init(provinceData); this.$refs.provinceForm.init(provinceData);
} }
}, },
/**
* 提交前将 ProvinceCity 内部 provinceForm 中的编码补进 editData。
* 地图短路径校验通过时 editData 可能缺 provinceCode;组件内可能已有 adcode。
* 仅补空字段,避免覆盖用户已生效的数据。
*/
syncEditDataRegionFromProvinceCityRef() {
const root = this.$refs.provinceForm;
const pf = root && root.provinceForm;
const norm = (x) =>
x != null && String(x).trim() !== "" ? String(x).trim() : "";
const fill = (key, val) => {
const v = norm(val);
if (v && !norm(this.editData[key])) {
this.editData[key] = v;
}
};
if (pf) {
fill("provinceCode", pf.provinceCode);
fill("cityCode", pf.cityCode);
fill("districtCode", pf.townCode);
fill("provinceName", pf.provinceName);
fill("cityName", pf.cityName);
fill("districtName", pf.townName);
}
if (!root) return;
// 有省名无省码:行政树节点可能只有 code 无 adcode,或地图逆地理仅写入名称
const pname = norm(this.editData.provinceName);
const allData = root.AllData;
if (
pname &&
!norm(this.editData.provinceCode) &&
Array.isArray(allData) &&
allData.length
) {
const prov = allData.find(
(item) =>
item &&
item.name &&
(item.name === pname ||
item.name.indexOf(pname) !== -1 ||
pname.indexOf(item.name) !== -1)
);
const pc = prov ? districtTreeNodeCode(prov) : "";
if (pc) this.editData.provinceCode = pc;
}
const cname = norm(this.editData.cityName);
const cityList = root.cityList;
if (
cname &&
!norm(this.editData.cityCode) &&
Array.isArray(cityList) &&
cityList.length
) {
const city = cityList.find(
(item) =>
item &&
item.name &&
(item.name === cname ||
item.name.indexOf(cname) !== -1 ||
cname.indexOf(item.name) !== -1)
);
const cc = city ? districtTreeNodeCode(city) : "";
if (cc) this.editData.cityCode = cc;
}
const dname = norm(this.editData.districtName);
const townList = root.townList;
if (
dname &&
!norm(this.editData.districtCode) &&
Array.isArray(townList) &&
townList.length
) {
const town = townList.find(
(item) =>
item &&
item.name &&
(item.name === dname ||
item.name.indexOf(dname) !== -1 ||
dname.indexOf(item.name) !== -1)
);
const dc = town ? districtTreeNodeCode(town) : "";
if (dc) this.editData.districtCode = dc;
}
},
selectProvince(val) { selectProvince(val) {
this.$set(this.editData, "detailAddress", ""); this.$set(this.editData, "detailAddress", "");
this.editData.cityName = ""; this.editData.cityName = "";
...@@ -947,12 +1051,8 @@ export default { ...@@ -947,12 +1051,8 @@ export default {
this.editData.longitude = ""; this.editData.longitude = "";
if (val && typeof val === "object" && val.name) { if (val && typeof val === "object" && val.name) {
this.editData.provinceName = val.name; this.editData.provinceName = val.name;
const pc = const pc = districtTreeNodeCode(val);
val.adcode != null && val.adcode !== "" this.editData.provinceCode = pc;
? val.adcode
: val.code;
this.editData.provinceCode =
pc != null && pc !== "" ? String(pc) : "";
} else { } else {
this.editData.provinceName = ""; this.editData.provinceName = "";
this.editData.provinceCode = ""; this.editData.provinceCode = "";
...@@ -961,12 +1061,8 @@ export default { ...@@ -961,12 +1061,8 @@ export default {
selectCity(val) { selectCity(val) {
if (val && typeof val === "object" && val.name) { if (val && typeof val === "object" && val.name) {
this.editData.cityName = val.name; this.editData.cityName = val.name;
const cc = const cc = districtTreeNodeCode(val);
val.adcode != null && val.adcode !== "" this.editData.cityCode = cc;
? val.adcode
: val.code;
this.editData.cityCode =
cc != null && cc !== "" ? String(cc) : "";
} else { } else {
this.editData.cityName = ""; this.editData.cityName = "";
this.editData.cityCode = ""; this.editData.cityCode = "";
...@@ -982,12 +1078,8 @@ export default { ...@@ -982,12 +1078,8 @@ export default {
selectTown(val) { selectTown(val) {
if (val && typeof val === "object" && val.name) { if (val && typeof val === "object" && val.name) {
this.editData.districtName = val.name; this.editData.districtName = val.name;
const dc = const dc = districtTreeNodeCode(val);
val.adcode != null && val.adcode !== "" this.editData.districtCode = dc;
? val.adcode
: val.code;
this.editData.districtCode =
dc != null && dc !== "" ? String(dc) : "";
} else { } else {
this.editData.districtName = ""; this.editData.districtName = "";
this.editData.districtCode = ""; this.editData.districtCode = "";
......
...@@ -163,6 +163,19 @@ export default { ...@@ -163,6 +163,19 @@ export default {
} }
}, },
methods: { methods: {
/** 行政区划节点上的编码(高德常用 adcode;部分网关数据为 code / citycode) */
districtNodeCode(node) {
if (!node || typeof node !== 'object') return ''
const raw =
node.adcode != null && node.adcode !== ''
? node.adcode
: node.code != null && node.code !== ''
? node.code
: node.citycode != null && node.citycode !== ''
? node.citycode
: ''
return raw !== '' && raw != null ? String(raw).trim() : ''
},
/* /*
* @params:传入的为一个key-value的对象 * @params:传入的为一个key-value的对象
1、keywords --查询关键字,只支持单个关键词语搜索关键词支持:行政区名称、citycode、adcode 1、keywords --查询关键字,只支持单个关键词语搜索关键词支持:行政区名称、citycode、adcode
...@@ -243,17 +256,17 @@ export default { ...@@ -243,17 +256,17 @@ export default {
if (item.name.indexOf(province) != -1) { if (item.name.indexOf(province) != -1) {
this.provinceForm.provinceName = item.name this.provinceForm.provinceName = item.name
this.cityList = item.districts this.cityList = item.districts
this.provinceForm.provinceCode = item.adcode this.provinceForm.provinceCode = this.districtNodeCode(item)
if (city) { if (city) {
this.cityList.map(itm => { this.cityList.map(itm => {
if (itm.name.indexOf(city) != -1) { if (itm.name.indexOf(city) != -1) {
this.provinceForm.cityCode = itm.adcode this.provinceForm.cityCode = this.districtNodeCode(itm)
this.provinceForm.cityName = itm.name this.provinceForm.cityName = itm.name
this.townList = itm.districts this.townList = itm.districts
if (townName) { if (townName) {
this.townList.map(itmx => { this.townList.map(itmx => {
if (itmx.name.indexOf(townName) != -1) { if (itmx.name.indexOf(townName) != -1) {
this.provinceForm.townCode = itmx.adcode this.provinceForm.townCode = this.districtNodeCode(itmx)
this.provinceForm.townName = itmx.name this.provinceForm.townName = itmx.name
} }
}) })
...@@ -270,9 +283,14 @@ export default { ...@@ -270,9 +283,14 @@ export default {
this.provinceForm.fullAddress = '' this.provinceForm.fullAddress = ''
this.provinceForm.cityName = '' this.provinceForm.cityName = ''
this.provinceForm.townName = '' this.provinceForm.townName = ''
this.provinceForm.cityCode = ''
this.provinceForm.townCode = ''
if (val) { if (val) {
this.cityList = val.districts this.cityList = val.districts
const raw = this.districtNodeCode(val)
this.provinceForm.provinceCode = raw
} else { } else {
this.provinceForm.provinceCode = ''
val = '' val = ''
} }
// 选择省 // 选择省
...@@ -283,9 +301,13 @@ export default { ...@@ -283,9 +301,13 @@ export default {
this.provinceForm.cityName = val ? val.name : '' this.provinceForm.cityName = val ? val.name : ''
this.provinceForm.fullAddress = '' this.provinceForm.fullAddress = ''
this.provinceForm.townName = '' this.provinceForm.townName = ''
this.provinceForm.townCode = ''
if (val) { if (val) {
this.townList = val.districts this.townList = val.districts
const raw = this.districtNodeCode(val)
this.provinceForm.cityCode = raw
} else { } else {
this.provinceForm.cityCode = ''
val = '' val = ''
} }
// 选择市 // 选择市
...@@ -295,6 +317,12 @@ export default { ...@@ -295,6 +317,12 @@ export default {
selectTown(val) { selectTown(val) {
this.provinceForm.townName = val ? val.name : '' this.provinceForm.townName = val ? val.name : ''
this.provinceForm.fullAddress = '' this.provinceForm.fullAddress = ''
if (val) {
const raw = this.districtNodeCode(val)
this.provinceForm.townCode = raw
} else {
this.provinceForm.townCode = ''
}
// 选择区 // 选择区
this.$emit('selectTown', val) this.$emit('selectTown', val)
}, },
...@@ -319,6 +347,8 @@ export default { ...@@ -319,6 +347,8 @@ export default {
const adStr = const adStr =
mapData.adcode != null && mapData.adcode !== '' mapData.adcode != null && mapData.adcode !== ''
? String(mapData.adcode) ? String(mapData.adcode)
: mapData.code != null && mapData.code !== ''
? String(mapData.code)
: '' : ''
const setCodesFromAdcode = () => { const setCodesFromAdcode = () => {
if (adStr.length >= 3) { if (adStr.length >= 3) {
...@@ -366,10 +396,7 @@ export default { ...@@ -366,10 +396,7 @@ export default {
this.provinceForm.provinceName = foundP.name this.provinceForm.provinceName = foundP.name
this.cityList = foundP.districts || [] this.cityList = foundP.districts || []
this.provinceForm.provinceCode = this.provinceForm.provinceCode = this.districtNodeCode(foundP)
foundP.adcode != null && foundP.adcode !== ''
? String(foundP.adcode)
: ''
let foundC = null let foundC = null
for (let j = 0; j < this.cityList.length; j++) { for (let j = 0; j < this.cityList.length; j++) {
...@@ -394,9 +421,7 @@ export default { ...@@ -394,9 +421,7 @@ export default {
this.provinceForm.cityName = foundC.name this.provinceForm.cityName = foundC.name
this.provinceForm.cityCode = this.provinceForm.cityCode =
foundC.adcode != null && foundC.adcode !== '' this.districtNodeCode(foundC) || adStr
? String(foundC.adcode)
: adStr
this.townList = foundC.districts || [] this.townList = foundC.districts || []
if (this.subdistrict !== 3) { if (this.subdistrict !== 3) {
...@@ -415,10 +440,7 @@ export default { ...@@ -415,10 +440,7 @@ export default {
} }
if (foundT) { if (foundT) {
this.provinceForm.townName = foundT.name this.provinceForm.townName = foundT.name
this.provinceForm.townCode = this.provinceForm.townCode = this.districtNodeCode(foundT)
foundT.adcode != null && foundT.adcode !== ''
? String(foundT.adcode)
: ''
} else { } else {
this.provinceForm.townName = townName this.provinceForm.townName = townName
const tc = const tc =
...@@ -457,6 +479,8 @@ export default { ...@@ -457,6 +479,8 @@ export default {
? String(md.town_code) ? String(md.town_code)
: md.adcode != null && md.adcode !== '' : md.adcode != null && md.adcode !== ''
? String(md.adcode) ? String(md.adcode)
: md.code != null && md.code !== ''
? String(md.code)
: '' : ''
if (tcMerged) { if (tcMerged) {
this.provinceForm.townCode = tcMerged this.provinceForm.townCode = tcMerged
...@@ -500,6 +524,7 @@ export default { ...@@ -500,6 +524,7 @@ export default {
} }
.map-input { .map-input {
width: 350px !important;
// margin-top: 10px; // margin-top: 10px;
::v-deep .el-input__inner { ::v-deep .el-input__inner {
......
...@@ -264,7 +264,7 @@ export default { ...@@ -264,7 +264,7 @@ export default {
}], }],
PlatformLevelList: [ PlatformLevelList: [
{ {
merchantId: "-1", merchantId: -1,
showMerchantName: "嘀加智慧云", showMerchantName: "嘀加智慧云",
merchantName: "嘀加智慧云", merchantName: "嘀加智慧云",
userType: 1, userType: 1,
......
...@@ -263,7 +263,7 @@ export default { ...@@ -263,7 +263,7 @@ export default {
merchantLevelList: [], merchantLevelList: [],
PlatformLevelList: [ PlatformLevelList: [
{ {
merchantId: "-1", merchantId: -1,
showMerchantName: "嘀加智慧云", showMerchantName: "嘀加智慧云",
merchantName: "嘀加智慧云", merchantName: "嘀加智慧云",
// userType: res.userType // userType: res.userType
...@@ -442,10 +442,9 @@ export default { ...@@ -442,10 +442,9 @@ export default {
} }
}, },
"financialObj.realityShopMerchantId": { "financialObj.realityShopMerchantId": {
handler(val) { handler(newVal, oldVal) {
// this.financialObj.realityShopMerchantId
const obj = this.baseData.merchantLevelList.find( const obj = this.baseData.merchantLevelList.find(
(item) => item.merchantId == val (item) => item.merchantId == newVal
) )
if (obj) { if (obj) {
const shop = { const shop = {
...@@ -455,13 +454,13 @@ export default { ...@@ -455,13 +454,13 @@ export default {
} }
this.financialObj = Object.assign(this.financialObj, shop) this.financialObj = Object.assign(this.financialObj, shop)
} }
this._maybeInvalidateDivisionTabsForLedgerFieldChange(newVal, oldVal)
} }
}, },
"financialObj.realityPlatformMerchantId": { "financialObj.realityPlatformMerchantId": {
handler(val) { handler(newVal, oldVal) {
// this.financialObj.realityShopMerchantId
const obj = this.baseData.PlatformLevelList.find( const obj = this.baseData.PlatformLevelList.find(
(item) => item.merchantId == val (item) => item.merchantId == newVal
) )
if (obj) { if (obj) {
const Platform = { const Platform = {
...@@ -471,6 +470,7 @@ export default { ...@@ -471,6 +470,7 @@ export default {
} }
this.financialObj = Object.assign(this.financialObj, Platform) this.financialObj = Object.assign(this.financialObj, Platform)
} }
this._maybeInvalidateDivisionTabsForLedgerFieldChange(newVal, oldVal)
} }
}, },
"financialObj.multiPlatformMerchantFlag": { "financialObj.multiPlatformMerchantFlag": {
...@@ -493,12 +493,6 @@ export default { ...@@ -493,12 +493,6 @@ export default {
}, },
immediate: true immediate: true
}, },
"financialObj.realityShopMerchantId"(newVal, oldVal) {
this._maybeInvalidateDivisionTabsForLedgerFieldChange(newVal, oldVal)
},
"financialObj.realityPlatformMerchantId"(newVal, oldVal) {
this._maybeInvalidateDivisionTabsForLedgerFieldChange(newVal, oldVal)
},
"financialObj.djzhySubMerchantId"(newVal, oldVal) { "financialObj.djzhySubMerchantId"(newVal, oldVal) {
this._maybeInvalidateDivisionTabsForLedgerFieldChange(newVal, oldVal) this._maybeInvalidateDivisionTabsForLedgerFieldChange(newVal, oldVal)
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!