123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194 |
- import {
- ApiModel
- } from "../../../utils/api";
- const _Http = new ApiModel();
- const handleList = require("../../../utils/processingData");
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- productList: [], //供需列表
- //轮播图列表
- swiperBannerList: [],
- /* 宫格列表 */
- gridList: [{
- text: '供需广场',
- icon: '/static/home-grid/icon-02.png'
- }, {
- text: '私域直播',
- icon: '/static/home-grid/icon-01.png'
- }],
- /* 圆角按钮tabs列表 */
- roundedList: [
- "兴趣爱好", "关注板块", "最新发布"
- ],
- partnerList: [], //合作商家列表
- },
- /* tabs切换 */
- /* tabsSelectedIitem(text) {
- console.log(text.detail)
- }, */
- /* 宫格区跳转 */
- gridJumpPage(e) {
- const {
- name
- } = e.target.dataset;
- if (name == '供需广场') {
- wx.switchTab({
- url: '/pages/tabbar-pages/supplyAndDemand/index',
- })
- } else if (name == '私域直播') {
- wx.navigateTo({
- url: '/pages/liveStreaming/index',
- })
- } else {
- wx.showToast({
- title: '功能开发中',
- icon: "none"
- })
- }
- },
- /* 获得展示区标题 */
- getExhibitionTitle(title) {
- const {
- detail
- } = title;
- if (detail == '最新供需') {
- wx.switchTab({
- url: '/pages/tabbar-pages/supplyAndDemand/index',
- })
- } else if (detail == '合作商家') {
- wx.navigateTo({
- url: '/pages/businessPartner/index',
- })
- }
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- const that = this;
- /* 获取最新供需列表 */
- _Http.basic({
- "accesstoken": wx.getStorageSync('userData').token,
- "classname": "customer.supplyanddemand.supplyanddemand",
- "method": "query_supplyanddemandList",
- "content": {
- "getdatafromdbanyway": true,
- "pageNumber": 1,
- "pageSize": 8,
- "where": {
- "fissupply": "0",
- "fstatus": "待对接"
- }
- }
- }).then(res => {
- if (res.msg != '成功') return wx.showToast({
- title: res.data,
- icon: "none"
- });
- const data = handleList.getYTD(res.data)
- const productList = handleList.listOrdering(data);
- this.setData({
- productList
- })
- });
- /* 获取合作商家 */
- _Http.basic({
- "accesstoken": wx.getStorageSync('userData').token,
- "classname": "customer.tagents.tagents",
- "method": "query_cooperation",
- "content": {
- "getdatafromdbanyway": true,
- "pageNumber": 1,
- "pageSize": 9,
- "where": {
- "condition": "",
- "ftype": "",
- "fstatus": "合作"
- }
- }
- }).then(res => {
- if (res.msg != '成功') return wx.showToast({
- title: res.data,
- icon: "none"
- });
- let data = handleList.imageType(res.data, 'brandlogo')
- const partnerList = handleList.twoDimensionalArr(data, 3);
- this.setData({
- partnerList
- })
- })
- /* 获取轮播图 */
- const bannerList = getApp().globalData.bannerDataList.filter(value => value.flocation == 'home_head');
- this.setData({
- swiperBannerList: bannerList[0].banner
- });
- //获取信息数量
- this.selectComponent("#gxshuju").unReadMessageCount();
- setTimeout(() => {
- that.getTabBar().setData({
- 'tabbarList[3].fcount': getApp().globalData.msgFcount
- })
- }, 500)
- },
- /* 一键联系 */
- contact() {
- /* wx.showToast({
- title: '功能尚在开发',
- icon: "none"
- }) */
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- this.getTabBar().init();
- this.getTabBar().setData({
- 'tabbarList[3].fcount': getApp().globalData.msgFcount
- })
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- }
- })
|