index.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. import {
  2. ApiModel
  3. } from "../../../utils/api";
  4. const _Http = new ApiModel();
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. NavHeight: getApp().globalData.myNavBorHeight, //头部导航高度
  11. /* 宫格列表 */
  12. gridList: [{
  13. id: '001',
  14. text: '商户管理',
  15. icon: 'https://bwj.obs.cn-east-2.myhuaweicloud.com/resources/WeChat/userCenter/icon-04.png'
  16. }, {
  17. id: '002',
  18. text: '产品管理',
  19. icon: 'https://bwj.obs.cn-east-2.myhuaweicloud.com/resources/WeChat/userCenter/icon-03.png'
  20. }, {
  21. id: '003',
  22. text: '合作商家',
  23. icon: 'https://bwj.obs.cn-east-2.myhuaweicloud.com/resources/WeChat/userCenter/icon-02.png'
  24. }, {
  25. id: '004',
  26. text: '团队管理',
  27. icon: 'https://bwj.obs.cn-east-2.myhuaweicloud.com/resources/WeChat/userCenter/icon-01.png'
  28. }],
  29. userMessage: {}, //用户信息
  30. myShowModel: false, //显示弹出窗
  31. },
  32. /**
  33. * 生命周期函数--监听页面加载
  34. */
  35. onLoad: function (options) {},
  36. /* 宫格展示区跳转 */
  37. gridJumpPage(e) {
  38. const {
  39. name
  40. } = e.target.dataset;
  41. if (name == "团队管理") {
  42. wx.navigateTo({
  43. url: '/pages/teamManagement/index',
  44. })
  45. } else if (name == '产品管理') {
  46. wx.navigateTo({
  47. url: '/pages/productManagement/index'
  48. })
  49. } else if (name == '商户管理') {
  50. /* 查询商户信息,有跳转到商户信息 没有跳转商户入口选择 */
  51. _Http.basic({
  52. "accesstoken": wx.getStorageSync('userData').token,
  53. "classname": "customer.tagents.tagents",
  54. "method": "query_enterpriseAgentsMain",
  55. "content": {}
  56. }).then(res => {
  57. if (res.msg != '成功') return;
  58. const data = res.data[0];
  59. const fintroduction = encodeURIComponent(data.fintroduction);
  60. data.fintroduction = fintroduction;
  61. //商户
  62. if (data.ftype != '个人') return wx.navigateTo({
  63. url: '/pages/storeMessage/index?data=' + JSON.stringify(data),
  64. });
  65. if (data.fisauthenticating == 1) {
  66. //正在审核中
  67. return this.setData({
  68. myShowModel: true
  69. })
  70. } else {
  71. //无商户信息子账号
  72. if (wx.getStorageSync('userData').fisadministrator == 0) return wx.showToast({
  73. title: '暂无商户信息',
  74. icon: "none"
  75. })
  76. //未认证
  77. wx.navigateTo({
  78. url: '/pages/storeMessage/select',
  79. })
  80. }
  81. })
  82. } else if (name == '合作商家') {
  83. wx.navigateTo({
  84. url: '/pages/businessPartner/index'
  85. })
  86. }
  87. },
  88. /* 跳转用户信息 */
  89. toUserCenter() {
  90. const data = JSON.stringify(this.data.userMessage)
  91. wx.navigateTo({
  92. url: '/pages/userCenter/index?data=' + data,
  93. })
  94. },
  95. /* 退出登录 */
  96. userLogout() {
  97. _Http.logout({
  98. "accesstoken": wx.getStorageSync('userData').token
  99. }).then(res => {
  100. if (res.status == "ok") {
  101. wx.showToast({
  102. title: '退出成功',
  103. })
  104. setTimeout(() => {
  105. wx.reLaunch({
  106. url: '/pages/login/index',
  107. })
  108. }, 500)
  109. }
  110. })
  111. },
  112. /**
  113. * 生命周期函数--监听页面初次渲染完成
  114. */
  115. onReady: function () {
  116. },
  117. /**
  118. * 生命周期函数--监听页面显示
  119. */
  120. onShow: function () {
  121. this.getTabBar().init();
  122. // 获取用户信息
  123. _Http.basic({
  124. "accesstoken": wx.getStorageSync('userData').token,
  125. "classname": "customer.usercenter.usermsg.usermsg",
  126. "method": "query_usermsg",
  127. "content": {}
  128. }).then(res => {
  129. if (res.msg == '成功') return this.setData({
  130. userMessage: res.data[0]
  131. })
  132. });
  133. this.getTabBar().setData({
  134. 'tabbarList[3].fcount': getApp().globalData.msgFcount
  135. })
  136. },
  137. /**
  138. * 生命周期函数--监听页面隐藏
  139. */
  140. onHide: function () {
  141. },
  142. /**
  143. * 生命周期函数--监听页面卸载
  144. */
  145. onUnload: function () {
  146. },
  147. /**
  148. * 页面相关事件处理函数--监听用户下拉动作
  149. */
  150. onPullDownRefresh: function () {
  151. },
  152. /**
  153. * 页面上拉触底事件的处理函数
  154. */
  155. onReachBottom: function () {
  156. },
  157. /**
  158. * 用户点击右上角分享
  159. */
  160. onShareAppMessage: function () {
  161. }
  162. })