mine.js 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. // index.js
  2. var app = getApp()
  3. Page({
  4. data: {
  5. userId : '',
  6. userInfo: {},
  7. phone:'',
  8. hidden : 'hidden',
  9. userListInfo1: [{
  10. icon: '/images/mine_order.png',
  11. text: '我的订单',
  12. url:"/pages/orderList/orderList?isSelect=1"
  13. }, {
  14. icon: '/images/mine_collect.png',
  15. text: '我的收藏',
  16. addclass:"no_border",
  17. url: "/pages/mineCollect/mineCollect"
  18. }],
  19. userListInfo2: [
  20. {
  21. icon: '/images/mine_coupon.png',
  22. text: '优惠券',
  23. addclass: "no_border",
  24. url: "/pages/mineCoupon/coupon"
  25. }],
  26. userListInfo3: [{
  27. icon: '/images/mine_address.png',
  28. text: '我的地址',
  29. url: "/pages/mineAddress/mineAddress"
  30. }, {
  31. icon: '/images/mine_help.png',
  32. text: '帮助及意见反馈',
  33. addclass: "no_border",
  34. url: "/pages/problemList/problemList"
  35. }],
  36. userRole : 0, //用户身份【普通用户 / 商务用户】
  37. hiddenmodal: true, //提示弹窗
  38. modalCont: '', //提示内容
  39. },
  40. onLoad: function () {
  41. var that = this;
  42. var openid = getApp().globalData.openid;
  43. var un_id = getApp().globalData.un_id;
  44. var host = getApp().globalData.servsers;
  45. wx.showNavigationBarLoading();
  46. wx.request({
  47. url: host + "phoneapi/phoneall",
  48. data: {},
  49. method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
  50. header: {
  51. 'Accept': 'application/json'
  52. },
  53. success: function (res) {
  54. that.setData({
  55. phone: res.data.rows[0].phone,
  56. });
  57. if (res == null || res.data == null) {
  58. console.error('网络请求失败');
  59. return;
  60. }
  61. wx:wx.hideNavigationBarLoading(
  62. that.setData({
  63. hidden : ''
  64. })
  65. )
  66. }
  67. });
  68. that.setData({
  69. userInfo: getApp().globalData.userInfo,
  70. userId: getApp().globalData.un_id
  71. })
  72. },
  73. //重新加载
  74. onShow: function () {
  75. var that = this;
  76. var host = getApp().globalData.servsers;
  77. var un_id = getApp().globalData.un_id;
  78. var openid = getApp().globalData.openid;
  79. var userInfo = getApp().globalData.userInfo;
  80. var userRole = getApp().globalData.userRole;
  81. // if ((un_id == undefined || un_id == '' || un_id == null) || (openid == undefined || openid == '' || openid == null)) {
  82. // wx.navigateTo({
  83. // url: '/pages/authorize/authorize?link=mine',
  84. // })
  85. // } else {
  86. userInfo = getApp().globalData.userInfo;
  87. //查询用户身份
  88. // getApp().getUserRole(un_id);//获取用户角色
  89. // userRole = getApp().globalData.userRole;
  90. // }
  91. that.setData({
  92. userInfo: userInfo,
  93. userId: un_id,
  94. userRole: userRole
  95. })
  96. },
  97. //我的订单
  98. linkOrder: function () {
  99. var that = this;
  100. var un_id = getApp().globalData.un_id;
  101. var openid = getApp().globalData.openid;
  102. if ((un_id == undefined || un_id == '' || un_id == null) || (openid == undefined || openid == '' || openid == null)){
  103. wx.navigateTo({
  104. url: '/pages/authorize/authorize?link=orderList',
  105. })
  106. }else{
  107. wx.navigateTo({
  108. url: '/pages/orderList/orderList?isSelect=0'
  109. })
  110. }
  111. },
  112. //我的礼物
  113. linkGift: function () {
  114. var that = this;
  115. var un_id = getApp().globalData.un_id;
  116. var openid = getApp().globalData.openid;
  117. if ((un_id == undefined || un_id == '' || un_id == null) || (openid == undefined || openid == '' || openid == null)) {
  118. wx.navigateTo({
  119. url: '/pages/authorize/authorize?link=mineGiftList',
  120. })
  121. } else {
  122. wx.navigateTo({
  123. url: '/pages/mineGiftList/mineGiftList'
  124. })
  125. }
  126. },
  127. //我的地址
  128. linkAddress: function () {
  129. var that = this;
  130. var un_id = getApp().globalData.un_id;
  131. var openid = getApp().globalData.openid;
  132. if ((un_id == undefined || un_id == '' || un_id == null) || (openid == undefined || openid == '' || openid == null)) {
  133. wx.navigateTo({
  134. url: '/pages/authorize/authorize?link=mineAddress',
  135. })
  136. } else {
  137. wx.navigateTo({
  138. url: '/pages/mineAddress/mineAddress'
  139. })
  140. }
  141. },
  142. //我的收藏
  143. linkCollect: function () {
  144. var that = this;
  145. var un_id = getApp().globalData.un_id;
  146. var openid = getApp().globalData.openid;
  147. if ((un_id == undefined || un_id == '' || un_id == null) || (openid == undefined || openid == '' || openid == null)) {
  148. wx.navigateTo({
  149. url: '/pages/authorize/authorize?link=mineCollect',
  150. })
  151. } else {
  152. wx.navigateTo({
  153. url: '/pages/mineCollect/mineCollect'
  154. })
  155. }
  156. },
  157. //下拉刷新
  158. onPullDownRefresh: function (e) {
  159. var that = this;
  160. that.onLoad();
  161. wx.stopPullDownRefresh();
  162. },
  163. //我的收益
  164. mineEarnings:function(e){
  165. var that = this;
  166. var userRole = that.data.userRole;
  167. wx.navigateTo({
  168. url: '/pages/jianshe/jianshe',
  169. })
  170. // if (userRole == 0){//普通用户
  171. // wx.navigateTo({
  172. // url: '/pages/partnerMineEarnings/partnerMineEarnings',
  173. // })
  174. // }else{
  175. // wx.navigateTo({
  176. // url: '/pages/partnerBusinessEarnings/partnerBusinessEarnings',
  177. // })
  178. // }
  179. }
  180. })
  181. var that;
  182. var Util = require('../../utils/util.js');