From 366de5b4636679392a1e3d2984fc23bd5eaa5ac3 Mon Sep 17 00:00:00 2001
From: litian <C21AF165>
Date: 星期二, 27 八月 2024 17:48:03 +0800
Subject: [PATCH] wenti

---
 packageBookService/pages/bookServices/list/index.js |  102 +++++++++++++++++++++++++++++++++-----------------
 1 files changed, 67 insertions(+), 35 deletions(-)

diff --git a/packageBookService/pages/bookServices/list/index.js b/packageBookService/pages/bookServices/list/index.js
index a870a7d..f5a8654 100644
--- a/packageBookService/pages/bookServices/list/index.js
+++ b/packageBookService/pages/bookServices/list/index.js
@@ -1,7 +1,4 @@
 const app = getApp();
-import {
-  loginInfo
-} from "../../../../assets/js/login";
 Page({
   /**
    * 椤甸潰鐨勫垵濮嬫暟鎹�
@@ -80,6 +77,7 @@
     disabledNewForms: false,
     triggered: false,
     backTop: "",
+    isshowLoading: true
   },
   /**
    * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇
@@ -166,6 +164,7 @@
       triggered: true,
     });
     this.setData({
+      isshowLoading: false,
       "pageCount.page": 1,
     });
     this.getBookList(this.data.path);
@@ -181,6 +180,7 @@
         this.setData({
           isMore: true,
           "pageCount.page": this.data.pageCount.page + 1,
+          isshowLoading: false
         });
         this.getBookList(this.data.path);
       }
@@ -245,7 +245,7 @@
     });
   },
   // 鑾峰彇涓�绾у垎绫讳笅浜岀骇鍒嗙被
-  getSecondList(path) {
+  async getSecondList(path) {
     const options = [];
     const query = {
       path,
@@ -260,16 +260,7 @@
         field: "LinkOrder",
       },
     };
-    app.MG.store.getStoreChannelList(query).then((res) => {
-      if (!res.datas.length) {
-        this.setData({
-          disabledSecondList: true,
-        });
-      } else {
-        this.setData({
-          disabledSecondList: false,
-        });
-      }
+    await app.MG.store.getStoreChannelList(query).then((res) => {
       for (let index = 0; index < res.datas.length; index++) {
         const item = res.datas[index];
         options.push({
@@ -281,6 +272,7 @@
         "secondList.options": options,
       });
       const second = [this.data.secondCode];
+      console.log(second);
       this.setData({
         "secondList.value": second,
       });
@@ -353,10 +345,15 @@
       return false;
     }
     this.setData({
-      loading: true,
       noData: false,
       isRequesting: true,
+      disabledSecondList: false
     });
+    if (this.data.isshowLoading) {
+      this.setData({
+        loading: true
+      })
+    }
     let sort;
     let pathObj = {};
     if (this.data.pathList.length) {
@@ -414,6 +411,7 @@
         "||author*": this.data.searchValue,
         "||isbn*": this.data.searchValue,
         "||seriesName*": this.data.searchValue,
+        "||projectLeader*": this.data.searchValue
       };
     }
     const query = {
@@ -423,6 +421,9 @@
         field: "state",
       }, ],
       sort,
+      coverSize: {
+        width: 180
+      },
       paging: {
         start: 0,
         size: this.data.pageCount.page * 8,
@@ -443,11 +444,24 @@
         "pageCount.total": res.total,
         loading: false,
         isRequesting: false,
+        isshowLoading: true
       });
       if (!res.datas.length) {
         this.setData({
           noData: true,
         });
+      }
+      // 浜岀骇绂佺敤閫昏緫
+      // 1.涓�绾у垎绫绘湭閫変腑锛屼簩绾у垎绫荤鐢�
+      if (!this.data.stairList.value) {
+        this.setData({
+          disabledSecondList: true
+        })
+      } else if (this.data.stairList.value && !this.data.secondList.options.length) {
+        // 2. 涓�绾у垎绫婚�変腑锛屾棤浜岀骇鍒嗙被
+        this.setData({
+          disabledSecondList: true
+        })
       }
       if (this.data.triggered) {
         this.setData({
@@ -460,12 +474,10 @@
     });
   },
   // 涓�绾у垎绫诲垏鎹�
-  onChangeStair(e) {
+  async onChangeStair(e) {
     const path = e.detail.value.length ?
       `${this.data.assortCheck.code}\\${e.detail.value}` :
       this.data.assortCheck.code;
-    console.log(this.data.path);
-
     this.setData({
       backTop: "#assort-title",
       pathList: [],
@@ -473,20 +485,45 @@
       secondCode: "",
       path: path,
       "stairList.value": e.detail.value,
+      // disabledSecondList: false
     });
-
-    if (e.detail.value == "") {
-      this.setData({
-        disabledSecondList: true,
-      });
-    } else {
-      this.getSecondList(path);
-    }
-    this.getBookList(path);
-    console.log(this.data.disabledSecondList);
+    // if (e.detail.value == "") {
+    //   this.setData({
+    //     disabledSecondList: true,
+    //   });
+    // } else {
+    await this.getSecondList(path);
+    // }
+    await this.getBookList(path);
   },
-  // 浜岀骇鍒嗙被鍒囨崲
-  onChangeSecond(e) {
+  // // 浜岀骇鍒嗙被鍒囨崲
+  // onChangeSecond(e) {
+  //   const pathList = [];
+  //   for (let index = 0; index < e.detail.value.length; index++) {
+  //     const element = e.detail.value[index];
+  //     pathList.push({
+  //       Path: element,
+  //       Type: "*",
+  //       StoreRefCode: app.config.goodsStore,
+  //     });
+  //   }
+  //   this.setData({
+  //     backTop: "#assort-title",
+  //     pathList: pathList,
+  //     "secondList.value": e.detail.value,
+  //   });
+  // },
+  // 浜岀骇鍒嗙被閲嶇疆
+  resetSecond() {
+    this.setData({
+      backTop: "#assort-title",
+      pathList: [],
+      "secondList.value": [],
+    });
+    this.getBookList(this.data.path);
+  },
+  // 浜岀骇鍒嗙被纭畾
+  onConfirmSecond(e) {
     const pathList = [];
     for (let index = 0; index < e.detail.value.length; index++) {
       const element = e.detail.value[index];
@@ -501,9 +538,6 @@
       pathList: pathList,
       "secondList.value": e.detail.value,
     });
-  },
-  //
-  onConfirmSecond() {
     this.getBookList(this.data.path);
   },
   // 閲嶇偣椤圭洰鏀瑰彉
@@ -607,13 +641,11 @@
     this.getBookList(this.data.path);
   },
   openDropdown() {
-    console.log("灞曞紑鍝�");
     this.setData({
       showDropdown: true,
     });
   },
   closeDropdown() {
-    console.log("鍏抽棴");
     this.setData({
       showDropdown: false,
     });

--
Gitblit v1.9.1