shish 8 месяцев назад
Родитель
Сommit
9c03d9f635

+ 7 - 12
hdApp/src/admin/goods/categorySort.vue

@@ -11,7 +11,7 @@
               transition: isDragging ? 'none' : 'transform 0.3s ease',
               zIndex: draggedIndex === index ? 999 : 1
             }"
-            @click="navigateToGoodsSort(item.id)"
+            @click="navigateToGoodsSort(item)"
           >
             <view class="list-img">
               <image :src="item.img" mode="aspectFit"></image>
@@ -85,13 +85,13 @@ export default {
   },
   onPullDownRefresh() {
     this.resetList();
-    this._list().then(() => {
+    this.getCategoryList().then(() => {
       uni.stopPullDownRefresh();
     });
   },
   onReachBottom() {
     if (!this.list.finished) {
-      this._list().then(() => {
+      this.getCategoryList().then(() => {
         uni.stopPullDownRefresh();
       });
     } else {
@@ -100,23 +100,18 @@ export default {
   },
   methods: {
     // 跳转到商品排序页面
-    navigateToGoodsSort(categoryId) {
-      uni.navigateTo({
-        url: '/admin/goods/goodsSort?id=' + categoryId
-      });
+    navigateToGoodsSort(item) {
+      uni.navigateTo({ url: '/admin/goods/goodsSort?id=' + item.id+"&name="+item.categoryName })
     },
-
     async init() {
-      this._list();
+      this.getCategoryList();
     },
-
-    _list() {
+    getCategoryList() {
       return categoryListInfo().then((res) => {
         let data = { code: res.code, msg: res.msg, data: { list: res.data } };
         this.completes(data);
       });
     },
-
     // 拖拽相关方法
     transformStyle(index) {
       if (index === this.draggedIndex) {

+ 9 - 4
hdApp/src/admin/goods/goodsSort.vue

@@ -117,7 +117,7 @@ export default {
   },
   onPullDownRefresh() {
     this.resetList();
-    this._list()
+    this.getGoodsList()
       .then((res) => {
         uni.stopPullDownRefresh();
       })
@@ -128,7 +128,7 @@ export default {
   },
   onReachBottom() {
     if (!this.list.finished) {
-      this._list().then((res) => {
+      this.getGoodsList().then((res) => {
         uni.stopPullDownRefresh();
       });
     } else {
@@ -141,9 +141,14 @@ export default {
       if (!Array.isArray(this.list.data)) {
         this.list.data = [];
       }
-      this._list();
+      this.getGoodsList();
+
+      if(this.option.name){
+        uni.setNavigationBarTitle({ title: this.option.name+" 排序" })
+      }
+
     },
-    _list() {
+    getGoodsList() {
       // 传递分类ID参数和分页参数到API
       const params = {
         cId: this.option.id,

+ 14 - 5
hdApp/src/admin/goods/list.vue

@@ -23,14 +23,15 @@
 
 		<view class="input-wrap">
       <view>
-        <button class="admin-button-com middle " :class="[searchType == 0 ? 'blue' : 'default']" style="width:100upx;margin-right:8upx;" @click="changeSearchType(0)">名称</button>
-        <button class="admin-button-com middle " :class="[searchType == 1 ? 'blue' : 'default']" style="width:100upx;margin-right:8upx;" @click="changeSearchType(1)">编号</button>
+        <button class="admin-button-com middle " :class="[searchType == 0 ? 'blue' : 'default']" style="width:100upx;margin-right:7upx;" @click="changeSearchType(0)">名称</button>
+        <button class="admin-button-com middle " :class="[searchType == 1 ? 'blue' : 'default']" style="width:100upx;margin-right:7upx;" @click="changeSearchType(1)">编号</button>
       </view>
 			<view class="search-bar">
 				<app-search-module v-model="searchText" placeholder="输入内容" @input="searchFn" />
 			</view>
 			<view>
-        <button class="admin-button-com middle blue" style="margin-right:8upx;margin-left:8upx;width:100upx;" @click="openFilterPanel">筛选</button>
+        <button class="admin-button-com middle blue" style="margin-right:7upx;margin-left:7upx;width:100upx;" @click="openFilterPanel">筛选</button>
+        <button class="admin-button-com middle blue" style="margin-right:7upx;width:100upx;" @click="rank">排序</button>
         <button class="admin-button-com middle blue" style="width:100upx;" @click="addGoods()">新增</button>
 			</view>
 		</view>
@@ -200,6 +201,7 @@ export default {
       currentTab: 0,
       scrollTop: 0,
       catId: "",
+      catName:"",
       flowerNum:0,
       searchText:'',
       searchType:0,
@@ -261,7 +263,11 @@ export default {
     init(){
       this.getCategoryData()
     },
-    
+    rank(){
+      if(Number(this.catId)>0){
+        this.$util.pageTo({url: "/admin/goods/goodsSort?id="+this.catId+"&name="+this.catName})
+      }
+    },
     // 新的筛选相关方法
     openFilterPanel() {
       this.showFilterPanel = true;
@@ -367,10 +373,11 @@ export default {
         this.$util.pageTo({ url: "/admin/goods/detail", query: { id: id } })
     },
     getCategoryData() {
-      categoryListInfo({flower:1}).then(res => {
+      categoryListInfo().then(res => {
         this.tabbar = res.data;
         if(this.tabbar && this.tabbar[0] && this.tabbar[0].id){
           this.catId = this.tabbar[0].id
+          this.catName = this.tabbar[0].categoryName
           this.getGoodsList()
         }
       })
@@ -409,6 +416,7 @@ export default {
         this.searchTimer = setTimeout(() => {
           this.lastSearchText = this.searchText;
           this.catId = 0
+          this.catName = ""
           this.currentTab = 0
           this.resetList()
           this.getGoodsList()
@@ -427,6 +435,7 @@ export default {
       } else {
         this.currentTab = cur;
         this.catId = item.id;
+        this.catName = item.categoryName
         this.resetList();
         this.getGoodsList();
       }