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服务地址 // 定义api服务地址
const appUrl = 'https://www.aimzhu.com' // const appUrl = 'https://www.aimzhu.com'
// const appUrl = 'http://121.36.71.250:58038' const appUrl = 'http://121.36.71.250:58038'
const prewBaseUrl = '' const prewBaseUrl = ''
const operatorUrl = appUrl + '/operator' const operatorUrl = appUrl + '/operator'
const operatorPlug = appUrl + '/operator-plugin' const operatorPlug = appUrl + '/operator-plugin'

View File

@ -343,7 +343,7 @@ Page({
selArea: tempSelArea, selArea: tempSelArea,
'prevValue[0]': tempIndex 'prevValue[0]': tempIndex
}) })
_self.doGetArea(_self.data.selArea.areaId) _self.doGetArea(_self.data.selArea.areaId, false)
} else { } else {
//默认加载第一个area //默认加载第一个area
_self.setData({ _self.setData({
@ -351,7 +351,7 @@ Page({
selArea: _self.data.areaList[0], selArea: _self.data.areaList[0],
rightType: _self.data.rightType 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({ wx.showLoading({
title: '加载中...', title: '加载中...',
}) })
@ -404,18 +381,26 @@ Page({
cityList: res cityList: res
}) })
if (_self.data.goodsId != '') { if (_self.data.goodsId != '') {
var tempCity = null if (isChange) {
var tempIndex = 0 //手动滑动
_self.data.cityList.forEach(function (item, index) { _self.setData({
if (_self.data.goods.goodsLeaderCity2 == item.areaId) { selCity: res[0],
tempCity = item 'prevValue[1]': 0
tempIndex = index })
} } else {
}) var tempCity = null
_self.setData({ var tempIndex = 0
selCity: tempCity, _self.data.cityList.forEach(function (item, index) {
'prevValue[1]': tempIndex if (_self.data.goods.goodsLeaderCity2 == item.areaId) {
}) tempCity = item
tempIndex = index
}
})
_self.setData({
selCity: tempCity,
'prevValue[1]': tempIndex
})
}
} else { } else {
_self.setData({ _self.setData({
selCity: res[0] selCity: res[0]
@ -448,7 +433,7 @@ Page({
_self.setData({ _self.setData({
selArea: area selArea: area
}) })
_self.doGetArea(area.areaId) _self.doGetArea(area.areaId, true)
} else { } else {
var city = _self.data.cityList[currentValue[1]] var city = _self.data.cityList[currentValue[1]]
_self.setData({ _self.setData({