From 34dd2d10cf26c86ed170a59aa36718f7c27f24d0 Mon Sep 17 00:00:00 2001
From: 闫增涛 <1829501689@qq.com>
Date: 星期三, 03 四月 2024 15:30:29 +0800
Subject: [PATCH] 图书详情bug修改,云学习无销售方法check禁用

---
 packageBookService/pages/bookServices/list/index.js |  166 ++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 116 insertions(+), 50 deletions(-)

diff --git a/packageBookService/pages/bookServices/list/index.js b/packageBookService/pages/bookServices/list/index.js
index f8279a2..7903f4f 100644
--- a/packageBookService/pages/bookServices/list/index.js
+++ b/packageBookService/pages/bookServices/list/index.js
@@ -38,6 +38,29 @@
       value: [],
       options: [],
     },
+    sortList: {
+      value: 'default',
+      options: [{
+          value: 'default',
+          label: '榛樿鎺掑簭',
+        }, {
+          value: 'name-asc',
+          label: '鍚嶇О姝e簭'
+        },
+        {
+          value: 'name-desc',
+          label: '鍚嶇О鍊掑彊'
+        },
+        {
+          value: 'time-asc',
+          label: '鍑虹増鏃堕棿姝e簭'
+        },
+        {
+          value: 'time-desc',
+          label: '鍑虹増鏃堕棿鍊掑彊'
+        }
+      ],
+    },
     newTextBook: {
       value: [],
       options: [],
@@ -239,6 +262,15 @@
       },
     };
     app.MG.store.getStoreChannelList(query).then((res) => {
+      if (!res.datas.length) {
+        this.setData({
+          disabledSecondList: true
+        })
+      } else {
+        this.setData({
+          disabledSecondList: false
+        })
+      }
       for (let index = 0; index < res.datas.length; index++) {
         const item = res.datas[index];
         options.push({
@@ -336,17 +368,43 @@
         queryType: '*',
       };
     }
-    if (this.data.sort) {
+    if (this.data.sortList.value == 'name-asc') {
       sort = {
-        Name: this.data.sort,
-        BaseType: '',
-      };
-    } else {
+        Name: 'Asc',
+        BaseType: ''
+      }
+    } else if (this.data.sortList.value == 'name-desc') {
       sort = {
-        type: 'Desc',
-        field: 'ViewCount',
-      };
+        Name: 'Desc',
+        BaseType: ''
+      }
+    } else if (this.data.sortList.value == 'time-asc') {
+      sort = {
+        PublicationDate: 'Asc',
+        BaseType: 'DateTime'
+      }
+    } else if (this.data.sortList.value == 'time-desc') {
+      sort = {
+        PublicationDate: 'Desc',
+        BaseType: 'DateTime'
+      }
+    } else if (this.data.sortList.value == 'default') {
+      sort = {
+        field: 'order',
+        type: 'Desc'
+      }
     }
+    // if (this.data.sort) {
+    //   sort = {
+    //     Name: this.data.sort,
+    //     BaseType: '',
+    //   };
+    // } else {
+    //   sort = {
+    //     type: 'Desc',
+    //     field: 'ViewCount',
+    //   };
+    // }
     // 鎼滅储
     let searchObj = {};
     if (this.data.searchValue) {
@@ -388,16 +446,6 @@
         this.setData({
           noData: true,
         })
-        if (!this.data.pathList.length) {
-          // 鏈�夋嫨浜岀骇鍒嗙被锛屼笖鏃犲浘涔�
-          this.setData({
-            disabledSecondList: true
-          })
-        } else {
-          this.setData({
-            disabledSecondList: false
-          })
-        }
       }
       if (this.data.triggered) {
         this.setData({
@@ -415,6 +463,7 @@
       `${this.data.assortCheck.code}\\${e.detail.value}` :
       this.data.assortCheck.code;
     console.log(this.data.path);
+
     this.setData({
       pathList: [],
       stairCode: e.detail.value,
@@ -422,17 +471,15 @@
       path: path,
       'stairList.value': e.detail.value,
     });
-    this.getBookList(path);
-    this.getSecondList(path);
+
     if (e.detail.value == '') {
       this.setData({
         disabledSecondList: true
-      })
+      });
     } else {
-      this.setData({
-        disabledSecondList: false
-      })
+      this.getSecondList(path);
     }
+    this.getBookList(path);
     console.log(this.data.disabledSecondList);
   },
   // 浜岀骇鍒嗙被鍒囨崲
@@ -469,33 +516,12 @@
     });
     this.getBookList(this.data.path);
   },
-  changeNewText(e) {
+  // 鎺掑簭鍒囨崲
+  onSortChange(e) {
     this.setData({
-      'newTextBook.value': e.detail.value,
-    });
-    this.getBookList(this.data.path);
-  },
-  resetNewText() {
-    this.setData({
-      'newTextBook.value': [],
-    });
-    this.getBookList(this.data.path);
-  },
-  // 鎺掑簭鎸夐挳
-  sortClick() {
-    if (!this.data.sort.length) {
-      this.setData({
-        sort: 'Desc',
-      });
-    } else if (this.data.sort == 'Desc') {
-      this.setData({
-        sort: 'Asc',
-      });
-    } else if (this.data.sort == 'Asc') {
-      this.setData({
-        sort: '',
-      });
-    }
+      'sortList.value': e.detail.value
+    })
+
     let path;
     if (this.data.secondCode) {
       path = this.data.secondCode;
@@ -509,6 +535,46 @@
     });
     this.getBookList(path);
   },
+  changeNewText(e) {
+    this.setData({
+      'newTextBook.value': e.detail.value,
+    });
+    this.getBookList(this.data.path);
+  },
+  resetNewText() {
+    this.setData({
+      'newTextBook.value': [],
+    });
+    this.getBookList(this.data.path);
+  },
+  // 鎺掑簭鎸夐挳
+  // sortClick() {
+  //   if (!this.data.sort.length) {
+  //     this.setData({
+  //       sort: 'Desc',
+  //     });
+  //   } else if (this.data.sort == 'Desc') {
+  //     this.setData({
+  //       sort: 'Asc',
+  //     });
+  //   } else if (this.data.sort == 'Asc') {
+  //     this.setData({
+  //       sort: '',
+  //     });
+  //   }
+  //   let path;
+  //   if (this.data.secondCode) {
+  //     path = this.data.secondCode;
+  //   } else if (this.data.stairCode) {
+  //     path = `${this.data.assortCheck.code}\\${this.data.stairCode}`;
+  //   } else {
+  //     path = this.data.assortCheck.code;
+  //   }
+  //   this.setData({
+  //     path: path,
+  //   });
+  //   this.getBookList(path);
+  // },
   // 鎼滅储鍥句功
   searchBook(e) {
     console.log(e.detail.value);

--
Gitblit v1.9.1