mineAddress.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. // pages/mineAddress/mineAddress.js
  2. var app = getApp();
  3. const request = require("../../utils/request.js");
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. ad_list: [],
  10. },
  11. /**
  12. * 生命周期函数--监听页面加载
  13. */
  14. onLoad(options) {
  15. },
  16. /**
  17. * 生命周期函数--监听页面初次渲染完成
  18. */
  19. onReady() {
  20. },
  21. /**
  22. * 生命周期函数--监听页面显示
  23. */
  24. onShow() {
  25. this.getAddressList();
  26. },
  27. /**
  28. * 生命周期函数--监听页面隐藏
  29. */
  30. onHide() {
  31. },
  32. /**
  33. * 生命周期函数--监听页面卸载
  34. */
  35. onUnload() {
  36. },
  37. /**
  38. * 页面相关事件处理函数--监听用户下拉动作
  39. */
  40. onPullDownRefresh() {
  41. },
  42. /**
  43. * 页面上拉触底事件的处理函数
  44. */
  45. onReachBottom() {
  46. },
  47. /**
  48. * 用户点击右上角分享
  49. */
  50. onShareAppMessage() {
  51. },
  52. selectFun(event) {
  53. // app.globalData.adress_select = event.currentTarget.dataset.ad;
  54. const eventChannel = this.getOpenerEventChannel()
  55. eventChannel.emit('getSelectAd', event.currentTarget.dataset.ad);
  56. wx.navigateBack({
  57. delta: 1
  58. })
  59. },
  60. editFun(event) {
  61. let userAddressId = event.currentTarget.dataset.adid;
  62. wx.navigateTo({
  63. url: '../editAddress/editAddress?userAddressId=' + userAddressId,
  64. })
  65. },
  66. getAddressList() {
  67. let that = this;
  68. request.getData(
  69. 'app/user/address/list',{},
  70. res => {
  71. that.setData({
  72. ad_list: res.data.data
  73. })
  74. }
  75. )
  76. },
  77. toNewEdit() {
  78. wx.navigateTo({
  79. url: '../editAddress/editAddress',
  80. })
  81. },
  82. })