index.js 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. // lionfish_comshop/pages/groupCenter/index.js
  2. var app = getApp();
  3. var status = require('../../utils/index.js');
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. waitSendNum: 0,
  10. waitSignNum: 0,
  11. waitPickNum: 0,
  12. completeNum: 0,
  13. disUserId: "",
  14. communityName: "",
  15. communityId: "",
  16. distribution: "",
  17. estimate: "",
  18. lastMonth: "",
  19. isShow: true,
  20. currentTab: 0,
  21. show_on_one:0,
  22. dialogShow: 0,
  23. effectValidOrderNum: 0,
  24. groupInfo: {
  25. group_name: '社区',
  26. owner_name: '团长'
  27. }
  28. },
  29. /**
  30. * 生命周期函数--监听页面加载
  31. */
  32. onLoad: function (options) {
  33. let that = this;
  34. status.setGroupInfo().then((groupInfo) => {
  35. let owner_name = groupInfo && groupInfo.owner_name || '团长';
  36. wx.setNavigationBarTitle({
  37. title: `${owner_name}中心`,
  38. })
  39. that.setData({ groupInfo })
  40. });
  41. this.loadPage();
  42. },
  43. loadPage: function () {
  44. let that = this;
  45. status.loadStatus().then(function () {
  46. let appLoadStatus = app.globalData.appLoadStatus;
  47. if (appLoadStatus == 0) {
  48. wx.redirectTo({
  49. url: "/lionfish_comshop/pages/auth/index"
  50. })
  51. } else if (appLoadStatus == 2) {
  52. // wx.redirectTo({
  53. // url: "/lionfish_comshop/pages/position/community"
  54. // })
  55. }
  56. that.setData({
  57. appLoadStatus: appLoadStatus,
  58. community: app.globalData.community
  59. })
  60. });
  61. this.load_community_data();
  62. },
  63. load_community_data:function(){
  64. var token = wx.getStorageSync('token');
  65. var that = this;
  66. app.util.request({
  67. 'url': 'entry/wxapp/user',
  68. 'data': {
  69. controller: 'community.get_community_info',
  70. 'token': token
  71. },
  72. dataType: 'json',
  73. success: function (res) {
  74. if (res.data.code == 0) {
  75. let communityData = res.data;
  76. that.setData({
  77. member_info: communityData.member_info,
  78. community_info: communityData.community_info,
  79. commission_info: communityData.commission_info,
  80. total_order_count: communityData.total_order_count || 0,
  81. total_member_count: communityData.total_member_count || 0,
  82. today_order_count: communityData.today_order_count || 0,
  83. today_effect_order_count: communityData.today_effect_order_count || 0,
  84. today_pay_order_count: communityData.today_pay_order_count || 0,
  85. today_pre_total_money: communityData.today_pre_total_money || 0,
  86. waitSendNum: communityData.wait_send_count || 0,
  87. waitSignNum: communityData.wait_qianshou_count || 0,
  88. waitPickNum: communityData.wait_tihuo_count || 0,
  89. completeNum: communityData.has_success_count || 0,
  90. open_community_addhexiaomember: communityData.open_community_addhexiaomember,
  91. open_community_head_leve: communityData.open_community_head_leve
  92. });
  93. } else {
  94. //is_login
  95. wx.reLaunch({
  96. url: '/lionfish_comshop/pages/user/me',
  97. })
  98. }
  99. }
  100. })
  101. },
  102. /**
  103. * 扫描
  104. */
  105. goScan: function(){
  106. wx.scanCode({
  107. success(res) {
  108. console.log(res)
  109. if (res.scanType == 'WX_CODE' && res.path != '')
  110. {
  111. //path: "lionfish_comshop/pages/groupCenter/pendingDeliveryOrders?scene=36"
  112. wx.navigateTo({
  113. url: "/" + res.path
  114. });
  115. }
  116. }
  117. })
  118. },
  119. /**
  120. * 生命周期函数--监听页面初次渲染完成
  121. */
  122. onReady: function () {
  123. },
  124. /**
  125. * 生命周期函数--监听页面显示
  126. */
  127. onShow: function () {
  128. var that = this;
  129. // wx.showLoading({
  130. // title: "加载中...",
  131. // mask: true
  132. // });
  133. console.log(app.globalData.userInfo)
  134. this.setData({
  135. avatarUrl: app.globalData.userInfo.avatarUrl
  136. });
  137. var show_on_one = this.data.show_on_one;
  138. if (show_on_one > 0)
  139. {
  140. this.load_community_data();
  141. }
  142. this.setData({
  143. show_on_one: 1
  144. })
  145. },
  146. /**
  147. * 获取数据
  148. */
  149. getData: function(){
  150. // todo
  151. },
  152. /**
  153. * 生命周期函数--监听页面隐藏
  154. */
  155. onHide: function () {
  156. },
  157. /**
  158. * 跳转订单
  159. */
  160. goOrder: function (e) {
  161. let status = e.currentTarget.dataset.status;
  162. wx.navigateTo({
  163. url: "/lionfish_comshop/pages/groupCenter/groupList?tab=" + status
  164. });
  165. },
  166. /**
  167. * 跳转编辑
  168. */
  169. goEdit: function () {
  170. wx.navigateTo({
  171. url: "/lionfish_comshop/pages/groupCenter/setting?id=" + this.data.community_info.id
  172. });
  173. },
  174. /**
  175. * 导航切换
  176. */
  177. switchNav: function (e) {
  178. if (this.data.currentTab === 1 * e.target.dataset.current) return false;
  179. this.setData({
  180. currentTab: 1 * e.target.dataset.current
  181. });
  182. },
  183. /**
  184. * 导航切换监控
  185. */
  186. bindChange: function (e) {
  187. this.setData({
  188. currentTab: 1 * e.detail.current
  189. });
  190. for (var i = 0; i < 4; i++) {
  191. if (this.data.currentTab === i) {
  192. this.setData({
  193. effectEstimate: this.data.effectList[i].estimate,
  194. effectSettle: this.data.effectList[i].settle,
  195. effectValidOrderNum: this.data.effectList[i].validOrderNum
  196. });
  197. }
  198. }
  199. },
  200. /**
  201. * 数据说明
  202. */
  203. showExplain: function (t) {
  204. var e = t.currentTarget.dataset.type;
  205. this.setData({
  206. dialogShow: e
  207. }), "1" === e && this.setData({
  208. explainContent: "佣金收入指已经结算并完成打款的佣金,您可在结算记录模块查看具体的结算明细。",
  209. explainTitle: "佣金收入说明"
  210. }), "2" === e && this.setData({
  211. explainContent: "预估佣金指当前即将产生的分销收益,包含待确定、已确定的分销佣金,您可在分销记录模块查看具体的分销明细。",
  212. explainTitle: "预估佣金说明"
  213. }), "3" === e && this.setData({
  214. explainContent: "有效订单数指您负责社区的用户发生实际购买的订单数量,不包含取消付款的订单。",
  215. explainTitle: "有效订单数说明"
  216. });
  217. },
  218. /**
  219. * 数据说明确认按钮
  220. */
  221. confirmMessage: function () {
  222. this.setData({
  223. dialogShow: null
  224. });
  225. },
  226. goLink: function(t){
  227. // var a = t.currentTarget.dataset.url;
  228. // wx.navigateTo({
  229. // url: a
  230. // });
  231. },
  232. /**
  233. * 生命周期函数--监听页面卸载
  234. */
  235. onUnload: function () {
  236. },
  237. /**
  238. * 页面相关事件处理函数--监听用户下拉动作
  239. */
  240. onPullDownRefresh: function () {
  241. },
  242. /**
  243. * 页面上拉触底事件的处理函数
  244. */
  245. onReachBottom: function () {
  246. }
  247. })