index.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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/login/Phone.png'
  18. }, {
  19. text: '产品资料',
  20. icon: '/static/login/username.png'
  21. }, {
  22. text: '私域直播',
  23. icon: '/static/login/verificationcode.png'
  24. }, {
  25. text: '供需广场',
  26. icon: '/static/login/verificationcode.png'
  27. }],
  28. /* 圆角按钮tabs列表 */
  29. roundedList: [
  30. "兴趣爱好", "关注板块", "最新发布"
  31. ]
  32. },
  33. /* tabs切换 */
  34. /* tabsSelectedIitem(text) {
  35. console.log(text.detail)
  36. }, */
  37. /* 宫格区跳转 */
  38. gridJumpPage(e) {
  39. const {
  40. name
  41. } = e.target.dataset;
  42. if (name == '供需广场') {
  43. wx.switchTab({
  44. url: '/pages/tabbar-pages/supplyAndDemand/index',
  45. })
  46. } else if (name == '私域直播') {
  47. wx.navigateTo({
  48. url: '/pages/liveStreaming/index',
  49. })
  50. } else {
  51. wx.showToast({
  52. title: '功能开发中',
  53. icon: "none"
  54. })
  55. }
  56. },
  57. /* 获得展示区标题 */
  58. getExhibitionTitle(title) {
  59. console.log(title.detail)
  60. if (title.detail == '最新供需') {
  61. wx.switchTab({
  62. url: '/pages/tabbar-pages/supplyAndDemand/index',
  63. })
  64. }
  65. },
  66. /**
  67. * 生命周期函数--监听页面加载
  68. */
  69. onLoad: function (options) {
  70. /* 获取最新供需列表 */
  71. _Http.basic({
  72. "accesstoken": wx.getStorageSync('userData').token,
  73. "classname": "customer.supplyanddemand.supplyanddemand",
  74. "method": "query_supplyanddemandList",
  75. "content": {
  76. "getdatafromdbanyway": true,
  77. "pageNumber": 1,
  78. "pageSize": 8,
  79. "where": {
  80. "fissupply": "0",
  81. "fstatus": "待对接"
  82. }
  83. }
  84. }).then(res => {
  85. if (res.msg != '成功') return wx.showToast({
  86. title: res.data,
  87. icon: "none"
  88. });
  89. const data = handleList.getYTD(res.data)
  90. const productList = handleList.listOrdering(data);
  91. this.setData({
  92. productList
  93. })
  94. });
  95. /* 获取轮播图 */
  96. const bannerList = getApp().globalData.bannerDataList.filter(value => value.flocation == 'home_head');
  97. this.setData({
  98. swiperBannerList: bannerList[0].banner
  99. })
  100. },
  101. /* 一键联系 */
  102. contact() {
  103. console.log('一键联系')
  104. },
  105. /**
  106. * 生命周期函数--监听页面初次渲染完成
  107. */
  108. onReady: function () {
  109. },
  110. /**
  111. * 生命周期函数--监听页面显示
  112. */
  113. onShow: function () {
  114. this.getTabBar().init();
  115. },
  116. /**
  117. * 生命周期函数--监听页面隐藏
  118. */
  119. onHide: function () {
  120. },
  121. /**
  122. * 生命周期函数--监听页面卸载
  123. */
  124. onUnload: function () {
  125. },
  126. /**
  127. * 页面相关事件处理函数--监听用户下拉动作
  128. */
  129. onPullDownRefresh: function () {
  130. },
  131. /**
  132. * 页面上拉触底事件的处理函数
  133. */
  134. onReachBottom: function () {
  135. },
  136. /**
  137. * 用户点击右上角分享
  138. */
  139. onShareAppMessage: function () {
  140. }
  141. })