litian
2024-03-12 b125d3ea74d61fb8e4d7238c83906aeea52c6b4c
pages/bookServices/assort/index.js
@@ -1,4 +1,5 @@
// pages/bookServices/assort/index.js
import { getPublicImage } from '../../../assets/js/middleGround/tool'
const app = getApp();
Page({
  /**
@@ -79,9 +80,7 @@
      sort: { type: 'Asc', field: 'LinkOrder' },
    };
    app.MG.store.getStoreChannelList(query).then((res) => {
      const list = res.datas.filter((item) => item.refCode != 'jsek_homepageBookService');
      this.setData({
        assortList: list,
      });
@@ -120,15 +119,14 @@
      sort: { type: 'Asc', field: 'LinkOrder' },
    };
    app.MG.store.getStoreChannelList(query).then(async (res) => {
      console.log(res, 'res');
      // 一级分类选中
      this.setData({
        startCheck: res.datas[0].refCode,
      });
      // this.setData({
      //   startCheck: res.datas[0].refCode,
      // });
      // 获取二级分类
      for (let index = 0; index < res.datas.length; index++) {
        const item = res.datas[index];
        item.icon ? item.icon = getPublicImage(item.icon, 58, 72) : item.icon = item.icon
        item.children = await this.getSecondList(item);
      }
      // 一级分类赋值
@@ -156,22 +154,41 @@
      sort: { type: 'Asc', field: 'LinkOrder' },
    };
    await app.MG.store.getStoreChannelList(query).then((res) => {
      for (let index = 0; index < res.datas.length; index++) {
        const element = res.datas[index];
        if (element.icon)
          element.icon = getPublicImage(element.icon, 58, 72)
      }
      datas = res.datas;
    });
    return datas;
  },
  tabClick(tabData) {
    const data = tabData.currentTarget.dataset.tabdata;
  tabClick(e) {
    const data = e.currentTarget.dataset.tabdata;
    this.setData({
      startCheck: data.refCode,
    });
    console.log(data);
  },
  // 跳转列表页
  goPageList(item) {
    const secondCode = `${item.currentTarget.dataset.staircode.pathLinks[0].linkPath}\\${item.currentTarget.dataset.staircode.id}`;
  goPageList(e) {
    const tab = e.currentTarget.dataset.tabdata
    const stair = e.currentTarget.dataset.stair
    this.setData({
      startCheck: tab.refCode
    })
    if (stair) {
      const secondCode = `${stair.pathLinks[0].linkPath}\\${stair.id}`;
    wx.navigateTo({
      url: `/pages/bookServices/list/index?assorName=${this.data.assortCheck.name}&assortCode=${this.data.assortCheck.code}&stairCode=${this.data.startCheck}&secondCode=${secondCode}`,
    });
    } else {
      wx.navigateTo({
        url: `/pages/bookServices/list/index?assorName=${this.data.assortCheck.name}&assortCode=${this.data.assortCheck.code}`,
      });
    }
  },
  navToSearchPage(e) {
    console.log(e.detail.value);