123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- 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多个城市,专业团队操作'
- }
- }
- })
|