Commit f834c531 by 张立顺

fix bug

1 parent 747be494
......@@ -57,7 +57,7 @@ export function getAllGoodsList(data) {
}
export function getAllGoodsListPage(data) {
data.method = `${path}merchantGoodsInfo.rule.selectList`;
return request(data, "post");
return request(data, "post", [], { skipGlobalLoading: true });
}
// 批量下架
......@@ -82,7 +82,7 @@ export function checkGroundingLog(data) {
// 分页查询套餐管理记录
export function merchantPackageGoodsInfoPage(data) {
data.method = `${path}merchantPackageGoodsInfo.page`;
return request(data, "post");
return request(data, "post", [], { skipGlobalLoading: true });
}
// return request(data, 'post')
// }
......
......@@ -273,7 +273,7 @@ export function merchantSettleDistributeRuleTestRule(data) {
// 根据4s店获取服务商列表
export function scenemerchantrefQueryServiceRefByShop(data) {
data.method = `${path}scenemerchantref.queryServiceRefByShop`;
data.method = `${path}scenemerchantref.queryServiceRefByShop.new`;
return request(data, RequestMethods.POST);
}
......@@ -429,18 +429,16 @@ export function paymentChannelList(data = {}) {
* 获取对账配置所有品类列表
*/
export function getReconciliationGoodsTypeListApi(data = {}) {
data.method = "dj.api.create.business.approve.listReconciliationGoodsTypeGroup";
data.method =
"dj.api.create.business.approve.listReconciliationGoodsTypeGroup";
return request(data, RequestMethods.POST);
}
/**
* 获取轻改门店列表数据
*/
*/
export function getMerchantList(data) {
data.method = "dj.api.servicemerchantref.pageServiceMerchantRef";
return request(data, RequestMethods.POST);
}
......@@ -33,7 +33,8 @@
</div>
</div>
<div class="tree-box" v-show="brandTree">
<el-input class="tree-input" prefix-icon="el-icon-search" placeholder="输入关键字进行过滤" v-model="filterText"></el-input>
<el-input class="tree-input" prefix-icon="el-icon-search" placeholder="输入关键字进行过滤" v-model="filterText"
:validate-event="false"></el-input>
<el-tree class="filter-tree" @check="handleCheck" :data="brandListTree" :props="defaultProps" node-key="id" show-checkbox :filter-node-method="filterNode" ref="tree"></el-tree>
<div class="tree-footer">
<div class="tree-footer-checkbox">
......
......@@ -148,9 +148,12 @@ export default {
created() {
this.debouncedOnBrandFieldChange = util.debounce(() => {
this.syncMerchantBrandSlotPlaceholder();
this.$refs.editFormRef?.$refs[this.editChildRef]?.validateField(
"merchantBrandSlot"
);
// 避免 getCheckList 初始化等在未展开品牌区时就标红;展开后 isFirstBrand 为 true 再即时校验
if (this.isFirstBrand) {
this.$refs.editFormRef?.$refs[this.editChildRef]?.validateField(
"merchantBrandSlot"
);
}
}, 120);
},
beforeDestroy() {
......
......@@ -247,7 +247,7 @@ function buildEditFormData(vm) {
{
label: "主营品牌",
name: "merchantBrandSlot",
labelRequired: true,
labelRequired: false,
addHtml: "selectBrand",
style: DIALOG_FULL,
},
......@@ -258,6 +258,11 @@ function buildEditFormData(vm) {
maxlength: 15,
placeholder: "请输入",
style: DIALOG_HALF,
/** 降低浏览器/密码管理器把本弹窗当成站点登录表单而自动填充的概率 */
attrs: {
autocomplete: "merchant-verify-login",
"data-lpignore": "true",
},
},
{
label: "登录密码",
......@@ -267,6 +272,10 @@ function buildEditFormData(vm) {
showPass: true,
placeholder: "请输入",
style: DIALOG_HALF,
attrs: {
autocomplete: "new-password",
"data-lpignore": "true",
},
},
];
}
......@@ -345,8 +354,12 @@ export default {
{ required: true, message: "请输入联系电话" },
{
validator(rule, value, callback) {
if (!/^\d{11}$/.test(value || "")) {
callback(new Error("联系电话须为11位数字"));
if (!/^1[3-9]\d{9}$/.test(value || "")) {
callback(
new Error(
"请输入11位有效手机号(号段须为13-19开头)"
)
);
return;
}
callback();
......@@ -382,6 +395,11 @@ export default {
const latOk = coordOk(d.lat) || coordOk(d.latitude);
const lngOk =
coordOk(d.lng) || coordOk(d.longitude);
// 已通过地图选址(有详细文案与经纬度)时,不要求与省市区下拉逐项一致
if (latOk && lngOk && hasText) {
callback();
return;
}
if (
!hasProvince ||
!hasCity ||
......@@ -406,6 +424,11 @@ export default {
],
merchantBrandSlot: [
{
required: true,
message: "请选择主营品牌(需选择至子品牌)",
trigger: "change",
},
{
validator(_, __, callback) {
vm.$nextTick(() => {
const brand = vm.$refs.brandListTree;
......@@ -902,11 +925,9 @@ export default {
if (!this.isFirstBrand) {
this.isFirstBrand = true;
}
// 仅展开/收起主营品牌面板,勿在此触发 validateField,否则一打开就标红
this.$nextTick(() => {
this.syncMerchantBrandSlotPlaceholder();
this.$refs.editFormRef?.$refs[this.editChildRef]?.validateField(
"merchantBrandSlot"
);
});
},
initProvinceCity(provinceData) {
......
......@@ -312,85 +312,146 @@ export default {
})
},
/**
* 地图逆地理得到的省、市、区名称,同步到表单并刷新省市区下拉数据源(与下拉是否已选无关)。
*/
syncProvinceCityTownFromMapGeocoder(provincename, cityname, townName, mapData) {
const adStr =
mapData.adcode != null && mapData.adcode !== ''
? String(mapData.adcode)
: ''
const setCodesFromAdcode = () => {
if (adStr.length >= 3) {
this.provinceForm.provinceCode = String(
parseInt(adStr.slice(0, 3) + '000', 10)
)
} else {
this.provinceForm.provinceCode = ''
}
this.provinceForm.cityCode = adStr
const tcRaw =
mapData.town_code != null && mapData.town_code !== ''
? String(mapData.town_code)
: adStr
this.provinceForm.townCode = tcRaw || ''
}
if (!this.AllData || !this.AllData.length) {
this.provinceForm.provinceName = provincename
this.provinceForm.cityName = cityname
this.provinceForm.townName = this.subdistrict === 3 ? townName : ''
setCodesFromAdcode()
this.cityList = []
this.townList = []
return
}
let foundP = null
for (let i = 0; i < this.AllData.length; i++) {
const item = this.AllData[i]
if (item.name.indexOf(provincename) !== -1) {
foundP = item
break
}
}
if (!foundP) {
this.provinceForm.provinceName = provincename
this.provinceForm.cityName = cityname
this.provinceForm.townName = this.subdistrict === 3 ? townName : ''
setCodesFromAdcode()
this.cityList = []
this.townList = []
return
}
this.provinceForm.provinceName = foundP.name
this.cityList = foundP.districts || []
this.provinceForm.provinceCode =
foundP.adcode != null && foundP.adcode !== ''
? String(foundP.adcode)
: ''
let foundC = null
for (let j = 0; j < this.cityList.length; j++) {
const itm = this.cityList[j]
if (itm.name.indexOf(cityname) !== -1) {
foundC = itm
break
}
}
if (!foundC) {
this.provinceForm.cityName = cityname
this.provinceForm.townName = this.subdistrict === 3 ? townName : ''
this.provinceForm.cityCode = adStr
const tc =
mapData.town_code != null && mapData.town_code !== ''
? String(mapData.town_code)
: adStr
this.provinceForm.townCode = tc || ''
this.townList = []
return
}
this.provinceForm.cityName = foundC.name
this.provinceForm.cityCode =
foundC.adcode != null && foundC.adcode !== ''
? String(foundC.adcode)
: adStr
this.townList = foundC.districts || []
if (this.subdistrict !== 3) {
this.provinceForm.townName = ''
this.provinceForm.townCode = ''
return
}
let foundT = null
for (let k = 0; k < this.townList.length; k++) {
const itmx = this.townList[k]
if (itmx.name.indexOf(townName) !== -1) {
foundT = itmx
break
}
}
if (foundT) {
this.provinceForm.townName = foundT.name
this.provinceForm.townCode =
foundT.adcode != null && foundT.adcode !== ''
? String(foundT.adcode)
: ''
} else {
this.provinceForm.townName = townName
const tc =
mapData.town_code != null && mapData.town_code !== ''
? String(mapData.town_code)
: adStr
this.provinceForm.townCode = tc || ''
}
},
// 选择地图地址
getAddress() {
if (!this.$refs.mapForm.address) {
this.$message.success('请选择地址')
return
}
// this.provinceForm.fullAddress = this.$refs.mapForm.address
// 获取选择经纬度
let lnglat = this.$refs.mapForm.lnglat
this.provinceForm.lat = lnglat.lat.toFixed(4)
this.provinceForm.lng = lnglat.lng.toFixed(4)
var mapData = this.$refs.mapForm.geocoderAddress
// 赋值省市区名称和code
console.log(mapData, '\\\\\\')
const { city, adcode, province, district, town_code } = mapData
console.log(adcode, 'adcode')
if (!this.provinceForm.provinceName) {
this.provinceForm.provinceName = province
this.provinceForm.cityName = city
this.provinceForm.townName = district
this.provinceForm.provinceCode = +((adcode + '').slice(0, 3) + '000')
this.provinceForm.cityCode = adcode
const tcFallback =
town_code != null && town_code !== ''
? town_code
: adcode != null && adcode !== ''
? adcode
: ''
this.provinceForm.townCode =
tcFallback !== '' ? String(tcFallback) : ''
}
var fullAddress = ''
var provincecode = ''
// 为防止打开地图弹框不选择地址点确定按钮无法正确判断地址选择是否正确产生的报错,设置this.addressData.fullAddress来保存上次选择的地址
// if (mapData.addressComponent) {
// fullAddress = mapData.addressComponent
// provincecode = mapData.adcode
// this.addressData.fullAddress = fullAddress
// this.addressData.provincecode = provincecode
// } else {
// fullAddress = this.addressData.fullAddress
// provincecode = this.addressData.provincecode
// }
// 获取省市
var provincename = ''
var cityname = ''
var town = ''
provincename = mapData.province
cityname = mapData.city ? mapData.city : mapData.district
town = mapData.district
// 直辖市需额外判断
var mapData = this.$refs.mapForm.geocoderAddress || {}
var provincename = mapData.province || ''
var cityname = mapData.city ? mapData.city : mapData.district
var town = mapData.district || ''
const municipalities = ['北京市', '天津市', '上海市', '重庆市']
var municipality = municipalities.find(item => item == provincename)
if (municipality) {
if (municipality && cityname) {
cityname = cityname.slice(0, 2) + '市'
// if (municipality === '重庆市') {
// provincecode = provincecode.slice(0, 4)
// provincecode == 5001 ? (cityname = cityname.slice(0, 2) + '城区') : (cityname = cityname.slice(0, 2) + '郊县')
// // 重新赋值城市名
// this.provinceForm.cityName = cityname
// }
}
// 判断省市是否匹配
// 如果只展示省市
if (this.provinceForm.provinceName && !this.provinceForm.townName) {
if (this.provinceForm.provinceName !== provincename || this.provinceForm.cityName !== cityname) {
this.$message.error('您选择的地址错误,请重新选择')
return
}
}
// 如果展示省市区
if (this.provinceForm.provinceName && this.provinceForm.townName) {
if (this.provinceForm.provinceName !== provincename || this.provinceForm.cityName !== cityname || this.provinceForm.townName !== town) {
this.$message.error('您选择的地址错误,请重新选择')
return
}
}
// 地图确认后同步区级编码:逆地理常不带 town_code,用区级 adcode 兜底,避免外层表单校验缺少 districtCode 仍飘红
const md = mapData || {}
this.syncProvinceCityTownFromMapGeocoder(provincename, cityname, town, mapData)
const md = mapData
const tcMerged =
md.town_code != null && md.town_code !== ''
? String(md.town_code)
......@@ -405,9 +466,6 @@ export default {
}
this.provinceForm.fullAddress = this.$refs.mapForm.address
this.dialogMapVisible = false
// this.subdistrict == 2 ? this.init(province, city) : this.init(province, city, town)
console.log(this.provinceForm, 'provinceForm')
// 通过地图选择省市区
this.$emit('selectAddressByMap', this.provinceForm)
}
}
......
......@@ -53,7 +53,9 @@ const service = axios.create({
service.interceptors.request.use(
(config) => {
return new Promise(async (resolve) => {
await store.commit("d2admin/loading/set", true);
if (!config.skipGlobalLoading) {
await store.commit("d2admin/loading/set", true);
}
// const uuid = util.cookies.get('uuid')
// 如果请求链接不在排除列表 (排除列表: 登录 基础数据) 并且cookie 过期(判断是否长时间未操作)
// if (!LogExternals.some(u => u === url || (params && u === params.method)) && !uuid) {
......@@ -100,7 +102,9 @@ service.interceptors.request.use(
});
},
(error) => {
store.commit("d2admin/loading/set", false);
if (!error.config?.skipGlobalLoading) {
store.commit("d2admin/loading/set", false);
}
// 发送失败
console.log(error);
Promise.reject(error);
......@@ -110,7 +114,9 @@ service.interceptors.request.use(
service.interceptors.response.use(
(response) => {
// console.log(response)
store.commit("d2admin/loading/set", false);
if (!response.config.skipGlobalLoading) {
store.commit("d2admin/loading/set", false);
}
// dataAxios 是 axios 返回数据中的 data
// const dataAxios = {
// code: "20",
......@@ -215,7 +221,9 @@ service.interceptors.response.use(
// console.log('超时')
// console.log(error)
}
store.commit("d2admin/loading/set", false);
if (!error.config?.skipGlobalLoading) {
store.commit("d2admin/loading/set", false);
}
if (!error.__CANCEL__)
errorLog(error); // 取消请求 不做错误提示
return Promise.reject(error);
......
......@@ -942,7 +942,14 @@ export default {
init4sServiceList() {
return new Promise((resolve) => {
const { scene, merchantId } = this.routerInfo
scenemerchantrefQueryServiceRefByShop({ scene, merchantId })
const baseSceneCode = String(
resolveBaseSceneCodeFromRouter(this.routerInfo)
)
scenemerchantrefQueryServiceRefByShop({
scene,
merchantId,
baseSceneCode
})
.then((res) => {
// console.log(res)
this.serviceMerchantList = res
......
......@@ -43,7 +43,7 @@ function validateExpenseCategoryRulesArray(rules) {
}
/**
* 首条不通过项的中文人读提示与可选 el-form prop(供 validateField 单字段标红)。
* 首条不通过项的中文人读提示与可选 el-form prop(fieldProp 可为 null;父页失败时对当前 Tab 走整表 validateFormOnly 标红)。
* @typedef {{ ok: true, message: string, fieldProp: null }} ReconciliationRuleValidationOk
* @typedef {{ ok: false, message: string, fieldProp: (string|null) }} ReconciliationRuleValidationErr
* @param {object} rawRule
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!