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.
47 lines
1.4 KiB
47 lines
1.4 KiB
import { getAddressList } from "../../../../api/ztb"
|
|
const event = require('../../../../utils/event.js')
|
|
const tdsdk = require('../../../../libs/tdweapp')
|
|
|
|
Page({
|
|
data: {
|
|
type: 0,
|
|
adressList:[]
|
|
},
|
|
onLoad: function (options) {
|
|
if(options.type){
|
|
this.data.type = Number(options.type)
|
|
}
|
|
},
|
|
onShow: function () {
|
|
tdsdk.Page.onShow()
|
|
wx.showLoading({ title: '加载中', mask: true })
|
|
getAddressList().then(res => {
|
|
this.setData({ adressList:res.data })
|
|
wx.hideLoading()
|
|
}).catch((e) => {
|
|
wx.hideLoading()
|
|
})
|
|
},
|
|
lookItem: function (e) {
|
|
var item = this.data.adressList[e.currentTarget.dataset.index]
|
|
if(this.data.type == 1){
|
|
event.emit('EventMessage', { what: 301, obj: item, desc: 'AddressChoose' })
|
|
wx.navigateBack({ delta: 1 })
|
|
} else {
|
|
wx.navigateTo({ url: '/submodel/pages/address/create/index?type=0&shippingAddressId='+ item.shippingAddressId })
|
|
}
|
|
},
|
|
toEdit: function (e) {
|
|
var item = this.data.adressList[e.currentTarget.dataset.index]
|
|
wx.navigateTo({ url: '/submodel/pages/address/create/index?type=0&shippingAddressId='+ item.shippingAddressId })
|
|
},
|
|
toCreate: function () {
|
|
wx.navigateTo({ url: '/submodel/pages/address/create/index?type=1' })
|
|
},
|
|
onHide: function(){
|
|
tdsdk.Page.onHide()
|
|
},
|
|
onUnload: function () {
|
|
tdsdk.Page.onUnload()
|
|
}
|
|
})
|