var businessT = require('../../../../tool/business-tool.js') var url = require('../../../../constant/url.js') import Net from '../../../../tool/net.js' var net = new Net() Page({ /** * 页面的初始数据 */ data: { isLoading: true, data: null }, reloadData: function (data) { this.data.data = data this.setData({ data: this.data.data }) }, addAction: businessT.action(function (sender) { wx.navigateTo({ url: '../edit-address/edit-address?type=add' }) }), editAction: businessT.action(function (sender) { wx.navigateTo({ url: '../edit-address/edit-address?type=edit' }) }), deleteAction: businessT.action(function (sender) { var that = this wx.showModal({ title: '删除后将无法恢复', content: '是否删除该信息', confirmText: '删除', cancelText: '取消', confirmColor: '#3296FB', cancelColor: '#3296FB', success: function (res) { if (res.confirm) { that.deleteAddress() } } }) }), deleteAddress: function() { net.connectNeedLogin({ url: url.app_host + url.deleteMailingAddress, data: {}, success: (err, res) => { this.data.data = null this.setData({ data: this.data.data }) }, fail: (err, res) => { businessT.showFailTips(err, '加载失败') } }) }, getData: function () { wx.showLoading({ title: '加载中', mask: true }) net.connectNeedLogin({ url: url.app_host + url.getMailingAddress, data: {}, success: (err, res) => { if (res.data) { this.data.data = res.data } else { } this.data.isLoading = false this.setData({ isLoading: this.data.isLoading, data: this.data.data }) wx.hideLoading() }, fail: (err, res) => { wx.hideLoading() businessT.showFailTips(err, '加载失败') setTimeout(function () { wx.navigateBack({ }) }.bind(this), 1000) } }) }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { this.getData() }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { return { path: '/page/home/index', imageUrl: '../../../../icon/public/share_img.png', title: '自助缴社保公积金,覆盖200多个城市,专业团队操作' } } })