address.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // pages/my/address/address.js
  2. const app =getApp();
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. addressList:[]
  9. },
  10. onLoad:function(){
  11. this.address()
  12. },
  13. addSite(e){
  14. let {parmise} = e.currentTarget.dataset
  15. console.log(parmise);
  16. wx.navigateTo({
  17. url: './addSite/addSite?parmise='+parmise,
  18. })
  19. },
  20. editSite(e){
  21. let {parmise} = e.currentTarget.dataset
  22. console.log(parmise);
  23. wx.navigateTo({
  24. url: './addSite/addSite?parmise='+JSON.stringify(parmise),
  25. })
  26. },
  27. //获取地址列表
  28. address(){
  29. var that=this;
  30. app.api.useApi(app.globalData.baseAppUrl + "api/address/index", {
  31. network_id: 1,
  32. }, "get").then(function (res) {
  33. if (res.original.code != 200) {
  34. wx.showLoading({
  35. title:res.original.message.msg,
  36. })
  37. } else {
  38. that.setData({
  39. addressList: res.original.message.data.data
  40. })
  41. }
  42. setTimeout(function () {
  43. wx.hideLoading({
  44. success: (res) => {},
  45. })
  46. }, 2000);
  47. }).catch(function (err) {
  48. console.log(222);
  49. })
  50. }
  51. })