index.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. import {
  2. ApiModel
  3. } from "../../../utils/api";
  4. const _Http = new ApiModel();
  5. const handleList = require("../../../utils/processingData");
  6. Page({
  7. /**
  8. * 页面的初始数据
  9. */
  10. data: {
  11. productList: [], //供需列表
  12. //轮播图列表
  13. swiperBannerList: [],
  14. /* 宫格列表 */
  15. gridList: [{
  16. text: '供需广场',
  17. icon: '/static/home-grid/icon-02.png'
  18. }, {
  19. text: '私域直播',
  20. icon: '/static/home-grid/icon-01.png'
  21. }],
  22. /* 圆角按钮tabs列表 */
  23. roundedList: [
  24. "兴趣爱好", "关注板块", "最新发布"
  25. ],
  26. partnerList: [], //合作商家列表
  27. },
  28. /* tabs切换 */
  29. /* tabsSelectedIitem(text) {
  30. console.log(text.detail)
  31. }, */
  32. /* 宫格区跳转 */
  33. gridJumpPage(e) {
  34. const {
  35. name
  36. } = e.target.dataset;
  37. if (name == '供需广场') {
  38. wx.switchTab({
  39. url: '/pages/tabbar-pages/supplyAndDemand/index',
  40. })
  41. } else if (name == '私域直播') {
  42. wx.navigateTo({
  43. url: '/pages/liveStreaming/index',
  44. })
  45. } else {
  46. wx.showToast({
  47. title: '功能开发中',
  48. icon: "none"
  49. })
  50. }
  51. },
  52. /* 获得展示区标题 */
  53. getExhibitionTitle(title) {
  54. const {
  55. detail
  56. } = title;
  57. if (detail == '最新供需') {
  58. wx.switchTab({
  59. url: '/pages/tabbar-pages/supplyAndDemand/index',
  60. })
  61. } else if (detail == '合作商家') {
  62. wx.navigateTo({
  63. url: '/pages/businessPartner/index',
  64. })
  65. }
  66. },
  67. /**
  68. * 生命周期函数--监听页面加载
  69. */
  70. onLoad: function (options) {
  71. const that = this;
  72. /* 获取最新供需列表 */
  73. _Http.basic({
  74. "accesstoken": wx.getStorageSync('userData').token,
  75. "classname": "customer.supplyanddemand.supplyanddemand",
  76. "method": "query_supplyanddemandList",
  77. "content": {
  78. "getdatafromdbanyway": true,
  79. "pageNumber": 1,
  80. "pageSize": 8,
  81. "where": {
  82. "fissupply": "0",
  83. "fstatus": "待对接"
  84. }
  85. }
  86. }).then(res => {
  87. if (res.msg != '成功') return wx.showToast({
  88. title: res.data,
  89. icon: "none"
  90. });
  91. const data = handleList.getYTD(res.data)
  92. const productList = handleList.listOrdering(data);
  93. this.setData({
  94. productList
  95. })
  96. });
  97. /* 获取合作商家 */
  98. _Http.basic({
  99. "accesstoken": wx.getStorageSync('userData').token,
  100. "classname": "customer.tagents.tagents",
  101. "method": "query_cooperation",
  102. "content": {
  103. "getdatafromdbanyway": true,
  104. "pageNumber": 1,
  105. "pageSize": 9,
  106. "where": {
  107. "condition": "",
  108. "ftype": "",
  109. "fstatus": "合作"
  110. }
  111. }
  112. }).then(res => {
  113. if (res.msg != '成功') return wx.showToast({
  114. title: res.data,
  115. icon: "none"
  116. });
  117. let data = handleList.imageType(res.data, 'brandlogo')
  118. const partnerList = handleList.twoDimensionalArr(data, 3);
  119. this.setData({
  120. partnerList
  121. })
  122. })
  123. /* 获取轮播图 */
  124. const bannerList = getApp().globalData.bannerDataList.filter(value => value.flocation == 'home_head');
  125. this.setData({
  126. swiperBannerList: bannerList[0].banner
  127. });
  128. //获取信息数量
  129. this.selectComponent("#gxshuju").unReadMessageCount();
  130. setTimeout(() => {
  131. that.getTabBar().setData({
  132. 'tabbarList[3].fcount': getApp().globalData.msgFcount
  133. })
  134. }, 500)
  135. },
  136. /* 一键联系 */
  137. contact() {
  138. /* wx.showToast({
  139. title: '功能尚在开发',
  140. icon: "none"
  141. }) */
  142. },
  143. /**
  144. * 生命周期函数--监听页面初次渲染完成
  145. */
  146. onReady: function () {
  147. },
  148. /**
  149. * 生命周期函数--监听页面显示
  150. */
  151. onShow: function () {
  152. this.getTabBar().init();
  153. this.getTabBar().setData({
  154. 'tabbarList[3].fcount': getApp().globalData.msgFcount
  155. })
  156. },
  157. /**
  158. * 生命周期函数--监听页面隐藏
  159. */
  160. onHide: function () {
  161. },
  162. /**
  163. * 生命周期函数--监听页面卸载
  164. */
  165. onUnload: function () {
  166. },
  167. /**
  168. * 页面相关事件处理函数--监听用户下拉动作
  169. */
  170. onPullDownRefresh: function () {
  171. },
  172. /**
  173. * 页面上拉触底事件的处理函数
  174. */
  175. onReachBottom: function () {
  176. },
  177. /**
  178. * 用户点击右上角分享
  179. */
  180. onShareAppMessage: function () {
  181. }
  182. })