litian
2024-09-12 bbba5d26e9e26c910ed337dcb65f462752ee6dce
pages/bookServices/assort/index.js
@@ -1,5 +1,7 @@
// pages/bookServices/assort/index.js
import { getPublicImage } from "../../../assets/js/middleGround/tool";
import {
  getPublicImage
} from "../../../assets/js/middleGround/tool";
const app = getApp();
Page({
  /**
@@ -23,6 +25,37 @@
    bookList: [],
    loading: false,
    listLoding: false,
    stairListLoading: false,
    rowCol: [{
        width: '50%',
      },
      {
        width: '100%'
      },
      {
        width: '80%'
      },
      {
        width: '100%'
      }, {
        width: '100%'
      },
      {
        width: '100%'
      },
      {
        width: '50%'
      },
      {
        width: '100%'
      },
      {
        width: '80%'
      },
      {
        width: '100%'
      },
    ],
  },
  /**
@@ -80,26 +113,28 @@
   * 用户点击右上角分享
   */
  onShareAppMessage() {},
  onShareTimeline() {},
  // 获取侧边栏列表
  getAssortList() {
    this.setData({
      loading: true,
      listLoding: true,
    });
    const query = {
      path: "*",
      filterList: [
        {
          value: "Normal",
          field: "state",
        },
      ],
      filterList: [{
        value: "Normal",
        field: "state",
      }, ],
      queryType: "\\",
      searchList: [],
      size: "30",
      start: "0",
      storeRefCode: app.config.goodsStore,
      sort: { type: "Asc", field: "LinkOrder" },
      sort: {
        type: "Asc",
        field: "LinkOrder"
      },
    };
    app.MG.store.getStoreChannelList(query).then((res) => {
      const list = res.datas.filter(
@@ -131,37 +166,40 @@
  // 获取一级分类
  getStairList(path) {
    this.setData({
      listLoding: true,
      stairListLoading: true,
      startList: []
    });
    const query = {
      path,
      filterList: [
        {
          value: "Normal",
          field: "state",
        },
      ],
      filterList: [{
        value: "Normal",
        field: "state",
      }, ],
      queryType: "\\",
      searchList: [],
      size: "30",
      start: "0",
      storeRefCode: app.config.goodsStore,
      sort: { type: "Asc", field: "LinkOrder" },
      sort: {
        type: "Asc",
        field: "LinkOrder"
      },
    };
    app.MG.store.getStoreChannelList(query).then(async (res) => {
      // 获取二级分类
      for (let index = 0; index < res.datas.length; index++) {
        const item = res.datas[index];
        item.icon
          ? (item.icon = getPublicImage(item.icon, 500))
          : (item.icon = item.icon);
        item.icon ?
          (item.icon = getPublicImage(item.icon, 150)) :
          (item.icon = item.icon);
        item.children = await this.getSecondList(item);
      }
      console.log(res.datas);
      // 一级分类赋值
      this.setData({
        startList: res.datas,
        listLoding: false,
        stairListLoading: false,
        "startCheck.id": res.datas[0].id,
        "startCheck..code": "",
      });
@@ -174,12 +212,10 @@
    let datas;
    const query = {
      path,
      filterList: [
        {
          value: "Normal",
          field: "state",
        },
      ],
      filterList: [{
        value: "Normal",
        field: "state",
      }, ],
      coverSize: {
        width: 500,
      },
@@ -188,12 +224,15 @@
      size: "30",
      start: "0",
      storeRefCode: app.config.goodsStore,
      sort: { type: "Asc", field: "LinkOrder" },
      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, 500);
        if (element.icon) element.icon = getPublicImage(element.icon, 150);
      }
      datas = res.datas;
    });
@@ -205,7 +244,6 @@
      "startCheck.id": data.id,
      "startCheck.code": data.refCode,
    });
    console.log(data);
  },
  // 跳转列表页
  goPageList(e) {
@@ -231,4 +269,4 @@
      url: `/packageBookService/pages/bookServices/list/index?assorName=${this.data.assortCheck.name}&assortCode=${this.data.assortCheck.code}&stairCode=${this.data.startCheck.code}&searchValue=${e.detail.value}`,
    });
  },
});
});