user.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. Page({
  2. data: {
  3. contact_tel: "",
  4. show_customer_service: 0
  5. },
  6. onLoad: function(e) {
  7. getApp().page.onLoad(this, e)
  8. },
  9. dis: function () {
  10. wx.redirectTo({
  11. url: '/pages/index/index?go='+'nd',
  12. })
  13. },
  14. loadData: function(e) {
  15. var t = this;
  16. t.setData({
  17. store: getApp().core.getStorageSync(getApp().const.STORE)
  18. }), getApp().request({
  19. url: getApp().api.user.index,
  20. success: function(o) {
  21. if (0 == o.code) {
  22. if ("my" == t.data.__platform) o.data.menus.forEach(function(e, t, a) {
  23. "bangding" === e.id && o.data.menus.splice(t, 1, 0)
  24. });
  25. t.setData(o.data), getApp().core.setStorageSync(getApp().const.PAGES_USER_USER, o.data), getApp().core.setStorageSync(getApp().const.SHARE_SETTING, o.data.share_setting), getApp().core.setStorageSync(getApp().const.USER_INFO, o.data.user_info)
  26. }
  27. }
  28. })
  29. },
  30. onReady: function(e) {
  31. getApp().page.onReady(this)
  32. },
  33. onShow: function(e) {
  34. getApp().page.onShow(this);
  35. this.loadData()
  36. },
  37. callTel: function(e) {
  38. var t = e.currentTarget.dataset.tel;
  39. getApp().core.makePhoneCall({
  40. phoneNumber: t
  41. })
  42. },
  43. apply: function(t) {
  44. var a = getApp().core.getStorageSync(getApp().const.SHARE_SETTING),
  45. o = getApp().getUser();
  46. 1 == a.share_condition ? getApp().core.navigateTo({
  47. url: "/pages/add-share/index"
  48. }) : 0 != a.share_condition && 2 != a.share_condition || (0 == o.is_distributor ? getApp().core.showModal({
  49. title: "申请成为" + this.data.store.share_custom_data.words.share_name.name,
  50. content: "是否申请?",
  51. success: function(e) {
  52. e.confirm && (getApp().core.showLoading({
  53. title: "正在加载",
  54. mask: !0
  55. }), getApp().request({
  56. url: getApp().api.share.join,
  57. method: "POST",
  58. data: {
  59. form_id: t.detail.formId
  60. },
  61. success: function(e) {
  62. 0 == e.code && (0 == a.share_condition ? (o.is_distributor = 2, getApp().core.navigateTo({
  63. url: "/pages/add-share/index"
  64. })) : (o.is_distributor = 1, getApp().core.navigateTo({
  65. url: "/pages/share/index"
  66. })), getApp().core.setStorageSync(getApp().const.USER_INFO, o))
  67. },
  68. complete: function() {
  69. getApp().core.hideLoading()
  70. }
  71. }))
  72. }
  73. }) : getApp().core.navigateTo({
  74. url: "/pages/add-share/index"
  75. }))
  76. },
  77. verify: function(e) {
  78. getApp().core.scanCode({
  79. onlyFromCamera: !1,
  80. success: function(e) {
  81. getApp().core.navigateTo({
  82. url: "/" + e.path
  83. })
  84. },
  85. fail: function(e) {
  86. getApp().core.showToast({
  87. title: "失败"
  88. })
  89. }
  90. })
  91. },
  92. member: function() {
  93. getApp().core.navigateTo({
  94. url: "/pages/member/member"
  95. })
  96. },
  97. integral_mall: function(e) {
  98. var t, a;
  99. getApp().permission_list && getApp().permission_list.length && (t = getApp().permission_list, a = "integralmall", -1 != ("," + t.join(",") + ",").indexOf("," + a + ",")) && getApp().core.navigateTo({
  100. url: "/pages/integral-mall/index/index"
  101. })
  102. },
  103. clearCache: function() {
  104. wx.showActionSheet({
  105. itemList: ["清除缓存"],
  106. success: function(e) {
  107. if (0 === e.tapIndex) {
  108. wx.showLoading({
  109. title: "清除中..."
  110. });
  111. getApp().getStoreData();
  112. setInterval(function() {
  113. wx.hideLoading()
  114. }, 1e3)
  115. }
  116. }
  117. })
  118. },
  119. completemessage: function(e) {
  120. var t = this.data.__wxapp_img.cell,
  121. a = [t.cell_1.url, t.cell_2.url, t.cell_3.url, t.cell_4.url, t.cell_5.url];
  122. getApp().core.previewImage({
  123. current: a[0],
  124. urls: a
  125. })
  126. }
  127. });