me.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. var app = getApp();
  2. Page({
  3. data: {
  4. orderdistribution_info: {},
  5. can_tixian_money: 0
  6. },
  7. onLoad: function (options) {
  8. },
  9. onShow: function () {
  10. this.getData();
  11. },
  12. getData: function () {
  13. let token = wx.getStorageSync('token');
  14. app.util.ProReq('localtown.get_distribution_center_info', { token }).then(res => {
  15. let { orderdistribution_info, can_tixian_money } = res.data;
  16. this.setData({
  17. orderdistribution_info, can_tixian_money
  18. })
  19. }).catch(err => {
  20. console.log(err)
  21. app.util.message(err.msg || '请求出错', 'switchTo:/lionfish_comshop/pages/user/me', 'error');
  22. })
  23. },
  24. goLink: function(event) {
  25. let link = event.currentTarget.dataset.link;
  26. var pages_all = getCurrentPages();
  27. if (pages_all.length > 3) {
  28. wx.redirectTo({
  29. url: link
  30. })
  31. } else {
  32. wx.navigateTo({
  33. url: link
  34. })
  35. }
  36. },
  37. switchNotice: function(e){
  38. let token = wx.getStorageSync('token');
  39. let is_new_notice = e.detail.value?1:0;
  40. app.util.ProReq('localtown.change_distribution_notice', { token, is_new_notice }).then(res => {
  41. this.getData();
  42. }).catch(err => {
  43. this.getData();
  44. console.log(err)
  45. })
  46. }
  47. })