bug修复,编辑时省市选择

This commit is contained in:
itgaojian163 2025-06-20 18:06:24 +08:00
parent 4cb053df89
commit 8e60f59b19
2 changed files with 26 additions and 41 deletions

View File

@ -1,6 +1,6 @@
// 定义api服务地址
const appUrl = 'https://www.aimzhu.com'
// const appUrl = 'http://121.36.71.250:58038'
// const appUrl = 'https://www.aimzhu.com'
const appUrl = 'http://121.36.71.250:58038'
const prewBaseUrl = ''
const operatorUrl = appUrl + '/operator'
const operatorPlug = appUrl + '/operator-plugin'

View File

@ -343,7 +343,7 @@ Page({
selArea: tempSelArea,
'prevValue[0]': tempIndex
})
_self.doGetArea(_self.data.selArea.areaId)
_self.doGetArea(_self.data.selArea.areaId, false)
} else {
//默认加载第一个area
_self.setData({
@ -351,7 +351,7 @@ Page({
selArea: _self.data.areaList[0],
rightType: _self.data.rightType
})
_self.doGetArea(_self.data.selArea.areaId)
_self.doGetArea(_self.data.selArea.areaId, false)
}
}
})
@ -367,31 +367,8 @@ Page({
})
},
//获取省
doGetProvince: function (id) {
wx.showLoading({
title: '加载中...',
})
var _self = this
Shop.doGetAreaDetail(id)
.then(function (res) {
wx.hideLoading()
_self.setData({
selArea: res
})
_self.doGetArea(_self.data.selArea.areaId)
})
.catch(function (err) {
wx.hideLoading()
//重置selArea selCity
_self.setData({
selArea: null,
selCity: null
})
})
},
//获取区域
doGetArea: function (pId) {
doGetArea: function (pId, isChange) {
wx.showLoading({
title: '加载中...',
})
@ -404,18 +381,26 @@ Page({
cityList: res
})
if (_self.data.goodsId != '') {
var tempCity = null
var tempIndex = 0
_self.data.cityList.forEach(function (item, index) {
if (_self.data.goods.goodsLeaderCity2 == item.areaId) {
tempCity = item
tempIndex = index
}
})
_self.setData({
selCity: tempCity,
'prevValue[1]': tempIndex
})
if (isChange) {
//手动滑动
_self.setData({
selCity: res[0],
'prevValue[1]': 0
})
} else {
var tempCity = null
var tempIndex = 0
_self.data.cityList.forEach(function (item, index) {
if (_self.data.goods.goodsLeaderCity2 == item.areaId) {
tempCity = item
tempIndex = index
}
})
_self.setData({
selCity: tempCity,
'prevValue[1]': tempIndex
})
}
} else {
_self.setData({
selCity: res[0]
@ -448,7 +433,7 @@ Page({
_self.setData({
selArea: area
})
_self.doGetArea(area.areaId)
_self.doGetArea(area.areaId, true)
} else {
var city = _self.data.cityList[currentValue[1]]
_self.setData({