index.js 5.5 KB

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