[水感应客户端最新]
This commit is contained in:
76
pages/site/index.js
Normal file
76
pages/site/index.js
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* 手太欠
|
||||
* 愿这世界都如故事里一样 美好而动人~
|
||||
*/
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
type : '', //类型
|
||||
listArr : [] //收货地址
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
if(options) {
|
||||
this.setData({
|
||||
type: options.type
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
// 获取地址列表
|
||||
this.listInfo();
|
||||
},
|
||||
|
||||
/**
|
||||
* 地址列表
|
||||
*/
|
||||
listInfo (){
|
||||
wx.$api.site.siteList().then(res => {
|
||||
this.setData({
|
||||
listArr: res.data
|
||||
})
|
||||
}).catch(err => { })
|
||||
},
|
||||
|
||||
/**
|
||||
* 选择地址
|
||||
*/
|
||||
selectAddress(e){
|
||||
let atAdds = this.data.listArr[e.currentTarget.dataset.index]
|
||||
let pages = getCurrentPages(),
|
||||
prepage = pages[pages.length-2]
|
||||
|
||||
if(this.data.type == 'goodsAddress') {
|
||||
prepage.setData({
|
||||
address: atAdds,
|
||||
addressId: atAdds.address_id
|
||||
})
|
||||
wx.navigateBack()
|
||||
return
|
||||
}
|
||||
prepage.setData({
|
||||
address: atAdds
|
||||
})
|
||||
wx.navigateBack()
|
||||
},
|
||||
|
||||
/**
|
||||
* 编辑地址
|
||||
*/
|
||||
addressEdit(e) {
|
||||
wx.navigateTo({
|
||||
url: './edit/edit?addressid=' + e.currentTarget.dataset.id,
|
||||
})
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user