You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
1.7 KiB
80 lines
1.7 KiB
//获取应用实例
|
|
const app = getApp()
|
|
var cityId
|
|
Page({
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
let that = this;
|
|
// wx.getStorage({
|
|
// key: 'merchantNo',
|
|
// success: function (res) {
|
|
// that.setData({
|
|
// merchantNo: res.data
|
|
// })
|
|
// console.log(222);
|
|
|
|
// }
|
|
// });
|
|
wx.getStorage({
|
|
key: 'districtName',
|
|
success: function (res) {
|
|
that.setData({
|
|
districtName: res.data
|
|
})
|
|
}
|
|
});
|
|
cityId = options.cityId;
|
|
|
|
console.log(cityId);
|
|
wx.request({
|
|
url: app.gw.hostUrl + '/mall/wxa/index/opendistictlist',
|
|
method: 'get',
|
|
data: {
|
|
cityId: cityId,
|
|
},
|
|
header: {
|
|
'Content-Type': 'application/x-www-form-urlencoded'
|
|
},
|
|
success: function (res) {
|
|
var districts = res.data;
|
|
console.log(districts)
|
|
that.setData({
|
|
districts
|
|
});
|
|
},
|
|
fail: function (res) {
|
|
wx.showToast({
|
|
title: '加载数据失败',
|
|
});
|
|
},
|
|
})
|
|
},
|
|
openGroup: function (e) {
|
|
wx.setStorage({
|
|
key: 'cityId',
|
|
data: e.currentTarget.dataset.item.cityId,
|
|
});
|
|
wx.setStorage({
|
|
key: 'cityName',
|
|
data: e.currentTarget.dataset.item.cityName,
|
|
});
|
|
wx.setStorage({
|
|
key: 'districtId',
|
|
data: e.currentTarget.dataset.item.districtId,
|
|
});
|
|
wx.setStorage({
|
|
key: 'districtName',
|
|
data: e.currentTarget.dataset.item.districtName,
|
|
});
|
|
wx.setStorage({
|
|
key: 'merchantNo',
|
|
data: e.currentTarget.dataset.item.merchantNo,
|
|
});
|
|
wx.switchTab({
|
|
url: '../index/index'
|
|
})
|
|
},
|
|
onShow: function () { }
|
|
})
|