ltx529596 4 anos atrás
pai
commit
c94ec04a63
4 arquivos alterados com 176 adições e 83 exclusões
  1. 20 15
      src/pages.json
  2. 120 62
      src/pages/shop/classify.vue
  3. 6 1
      src/pages/shop/shop.vue
  4. 30 5
      src/pages/shop/shopdetail.vue

+ 20 - 15
src/pages.json

@@ -1,6 +1,13 @@
 {
   "pages": [
-   
+    {
+      "path": "pages/index/index",
+      "style": {
+        "navigationBarTitleText": "店铺首页",
+        "navigationBarTextStyle": "black",
+        "navigationBarBackgroundColor":"#ffcd00"
+      }
+    },
     {
       "path": "pages/public/login",
       "style":{
@@ -11,14 +18,6 @@
       }
     },
     {
-      "path": "pages/index/index",
-      "style": {
-        "navigationBarTitleText": "店铺首页",
-        "navigationBarTextStyle": "black",
-        "navigationBarBackgroundColor":"#ffcd00"
-      }
-    },
-    {
       "path": "pages/public/resetpassword",
       "style":{
         "navigationBarTitleText": "找回密码"
@@ -39,19 +38,22 @@
     {
       "path":"pages/index/setting/cellme",
       "style":{
-        "navigationBarTitleText": "联系我们"
+        "navigationBarTitleText": "联系我们",
+        "navigationBarBackgroundColor":"#ffffff"
       }
     },
     {
       "path":"pages/index/setting/notice",
       "style":{
-        "navigationBarTitleText": "公告管理"
+        "navigationBarTitleText": "公告管理",
+        "navigationBarBackgroundColor":"#ffffff"
       }
     },
     {
       "path": "pages/public/confirmpassword",
       "style":{
-        "navigationBarTitleText": "找回密码"
+        "navigationBarTitleText": "找回密码",
+        "navigationBarBackgroundColor":"#ffffff"
       }
     },
     {
@@ -66,13 +68,15 @@
 		{
 		  "path":"pages/order/orderdetail",
 		  "style":{
-		    "navigationBarTitleText": "订单详情"
+        "navigationBarTitleText": "订单详情",
+        "navigationBarBackgroundColor":"#ffffff"
 		  }
     },
     {
       "path": "pages/index/conversion",
       "style":{
-        "navigationBarTitleText": "订单兑换"
+        "navigationBarTitleText": "订单兑换",
+        "navigationBarBackgroundColor":"#ffffff"
       }
     },
     {
@@ -95,7 +99,8 @@
 		{
 			"path":"pages/shop/classify",
 			"style":{
-				"navigationBarTitleText": "管理自定义分类"
+        "navigationBarTitleText": "管理自定义分类",
+        "navigationBarBackgroundColor":"#ffffff"
 			}
 		}
   ],

+ 120 - 62
src/pages/shop/classify.vue

@@ -5,18 +5,24 @@
     <view class="addClass" @tap="addClass">
       <image src="../../static/images/addicon.png" class="addicon"></image>
     </view>
-    <view style="height:94upx"></view>
+    <view style="height: 94upx;"></view>
     <view class="content">
-      <view class="item-warp">
+      <view class="item-warp" v-for="item in lineList" :key="item.id">
         <view class="warp-top">
-          <view class="bar">分组名称:<text class="name">西线推荐</text></view>
-          <view class="bar">分组名称:<text class="name">西线推荐</text></view>
-          <view class="bar">分组名称:<text class="name">西线推荐</text></view>
-          <view class="bar">分组名称:<text class="name">西线推荐</text></view>
+          <view class="bar"
+            >分组名称:<text class="name">{{ item.name }}</text></view
+          >
+          <view class="bar"
+            >分组标识:<text class="name">{{ item.code }}</text></view
+          >
+          <view class="bar"
+            >一级分类:<text class="name">{{ item.typeId | grade }}</text></view
+          >
+          <view class="bar">所属店铺:<text class="name">西线推荐</text></view>
         </view>
         <view class="warp-bottom">
-          <view class="btn edtil">编辑</view>
-          <view class="btn delet">删除</view>
+          <view class="btn edtil" @tap="compile(item.id)">编辑</view>
+          <view class="btn delet" @tap="delet(item.id)">删除</view>
         </view>
       </view>
     </view>
@@ -24,6 +30,7 @@
 </template>
 
 <script>
+let gradeList;
 import Header from '../components/header';
 export default {
   name: 'classify',
@@ -31,77 +38,128 @@ export default {
   data() {
     //这里存放数据
     return {
-      title: '管理自定义分类'
+      title: '管理自定义分类',
+      storeId: uni.getStorageSync('shopid'),
+      lineList: [],
     };
   },
-  
+  filters: {
+    grade(val) {
+      console.log(val);
+      if (!val) {
+        return '无';
+      } 
+      gradeList.forEach(element => {
+        if (val === element.id) {
+          console.log(val === element.id);
+          console.log(element.name);
+          val = element.name
+          return  val
+        } 
+      });
+    },
+  },
+  onLoad() {
+    this.getCustomList();
+    this.getOneClassList();
+  },
   //方法集合
   methods: {
-    addClass () {
+    addClass() {
       console.log(1);
-    }
+    },
+    // 自定义分类列表
+    async getCustomList() {
+      await this.$http
+        .get('/goods/getCustomGroupList', {
+          shopId: this.storeId,
+        })
+        .then(async (res) => {
+          if (res.code === 200) {
+            this.lineList = res.data.customGroupList;
+          }
+        });
+    },
+    // 一级分类
+    async getOneClassList() {
+      await this.$http.get('/type/getParentList', {}).then(async (res) => {
+        if (res.code === 200 && res.msg === 'OK') {
+          gradeList = res.data;
+        }
+      });
+    },
+    // 处理分类
+
+
+    // 编辑
+    compile(id) {
+      console.log(id);
+    },
+    // 删除
+    delet(id) {
+      console.log(id);
+    },
   },
- 
 };
 </script>
 <style lang='scss' scoped>
-  .classify {
-    .addClass{
-      position: fixed;
-      top: 24.5upx;
-      right: 33upx;
+.classify {
+  .addClass {
+    position: fixed;
+    top: 24.5upx;
+    right: 33upx;
+    width: 48upx;
+    height: 48upx;
+    z-index: 100;
+    .addicon {
       width: 48upx;
       height: 48upx;
-      z-index: 100;
-      .addicon {
-        width: 48upx;
-        height: 48upx;
-      }
     }
-    .content {
+  }
+  .content {
+    width: 100%;
+    padding: 24upx 32upx 0;
+    .item-warp {
       width: 100%;
-      padding: 24upx 32upx 0;
-      .item-warp{
-        width: 100%;
-        padding: 28upx 31upx 0;
-        border-radius: 10upx;
-        background-color: #ffffff;
-        .warp-top{
-          padding-bottom: 30upx;
-          border-bottom: 1px solid #e7e7e7;
-          .bar{
-            color: #7a7c7c;
-            font-size: 28upx;
-            margin-top: 10upx;
-            &:first-child{
-              margin-top: 0;
-            }
-            .name{
-              color: #202020;
-              margin-left: 5upx;
-            }
-          }
-        }
-        .warp-bottom{
-          display: flex;
-          padding: 17upx 0;
-          .btn{
-            width: 158upx;
-            height: 58upx;
-            text-align: center;
-            line-height: 58upx;
-            border: 1px solid #e2e2e2;
-            color: #7a7c7c;
-            margin-left: 275upx;
+      padding: 28upx 31upx 0;
+      border-radius: 10upx;
+      background-color: #ffffff;
+      .warp-top {
+        padding-bottom: 30upx;
+        border-bottom: 1px solid #e7e7e7;
+        .bar {
+          color: #7a7c7c;
+          font-size: 28upx;
+          margin-top: 10upx;
+          &:first-child {
+            margin-top: 0;
           }
-          .delet {
-            color: #ffffff;
-            border: none;
-            margin-left: 23upx;
-            background-color: #ff6a5e;
+          .name {
+            color: #202020;
+            margin-left: 5upx;
           }
         }
       }
+      .warp-bottom {
+        display: flex;
+        padding: 17upx 0;
+        .btn {
+          width: 158upx;
+          height: 58upx;
+          text-align: center;
+          line-height: 58upx;
+          border: 1px solid #e2e2e2;
+          color: #7a7c7c;
+          margin-left: 275upx;
+        }
+        .delet {
+          color: #ffffff;
+          border: none;
+          margin-left: 23upx;
+          background-color: #ff6a5e;
+        }
+      }
     }
   }
+}
 </style>

+ 6 - 1
src/pages/shop/shop.vue

@@ -244,7 +244,12 @@ export default {
     // 删除商品
     async deleteshop (id) {
       await this.$http.delete('/goods/del/'+id).then(async (res)=>{
-        console.log(res);
+        if (res.code === 200 && res.msg === 'OK') {
+          this.$mHelper.toast('删除成功')
+          setTimeout(() => {
+            this.getTicketShopList()
+          }, 500);
+        }
       })
     },
     // 根据名字搜索

+ 30 - 5
src/pages/shop/shopdetail.vue

@@ -54,7 +54,7 @@
       </view>
       <!-- 商品名称 -->
       <view class="shopname detail-list">
-        <view class="menu" v-if="shopList.length > 1">
+        <view class="menu" v-if="hasNameList === 1">
           <view class="uni-list-cell">
             <view class="uni-list-cell-db">
               <picker
@@ -75,7 +75,7 @@
             </view>
           </view>
         </view>
-        <view class="menu" v-else>
+        <view class="menu" v-if="hasNameList === 0">
           <input class="input-shopname" type="text" v-model="shopname" placeholder-style="color:#a2a8a8;font-size:30upx" placeholder="请输入商品名称">
         </view>
       </view>
@@ -219,13 +219,18 @@ export default {
   methods: {
     // 跳转到管理分类页面
     toClassify() {
-      this.$mRouter.push({ route: '/pages/shop/classify' });
+      if (this.storeId) {
+        uni.setStorageSync('shopid',this.storeId)
+        this.$mRouter.push({ route: '/pages/shop/classify' });
+      } else {
+        this.$mHelper.toast('请选择所属店铺后再进行自定义分类管理')
+      }
     },
     // 选择店铺
     changeStore(e) {
       this.storeIndex = e.detail.value;
       this.storeId = this.storeList[this.storeIndex].id;
-
+      
       // 未选择商铺不能进行商铺类型选择
       if (this.storeId != '') {
         this.getType();
@@ -307,8 +312,9 @@ export default {
           shopId: this.storeId,
         })
         .then(async (res) => {
+          console.log(res);
           let arr = [];
-          this.hasNameList = res.data.shopFrom;
+          this.hasNameList = +res.data.shopFrom;
           res.data.customGroupList.forEach((element) => {
             arr.push({ name: element.name, id: element.id });
           });
@@ -440,6 +446,25 @@ export default {
       } else {
         name = this.shopList[this.shopIndex].id
       }
+
+      console.log(this.storeId);
+      console.log(this.typeId);
+      console.log(name);
+
+      if (!this.storeId) {
+        this.$mHelper.toast('请选择所属商铺')
+        return
+      }
+      if (!this.typeId) {
+        this.$mHelper.toast('请选择商品类型')
+        return
+      }
+      if (!name) {
+        this.$mHelper.toast('请选择商品名称或者输入商品名称')
+        return
+      }
+
+      return
       this.$http
         .post('/goods/add', {
           mid: this.scenicId,