Browse Source

小程序版初体验

ltx529596 4 years ago
parent
commit
eb1c8f313f
2 changed files with 42 additions and 22 deletions
  1. 4 1
      src/pages/shop/shop.vue
  2. 38 21
      src/pages/shop/shopdetail.vue

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

@@ -262,7 +262,10 @@ export default {
       this.getMoreByStatus();
     }
   },
-
+  onShow () {
+    this.getShopList();
+    this.getShopMessage();
+  },
   onLoad() {
     this.getShopList();
     this.getShopMessage();

+ 38 - 21
src/pages/shop/shopdetail.vue

@@ -243,6 +243,8 @@ export default {
       spaceId: 'db8671a1-69bd-470d-ad59-ba927c88f4a4',
       clientSecret: '8nOzV70edtpCd0El6qce3g==',
     });
+
+
     this.getShopList();
 
     // ---------------------------------------------------
@@ -262,17 +264,7 @@ export default {
             console.log(res);
             this.shopData = res.data;
 
-            // 所属店铺回显
-            this.storeList.forEach((item, index) => {
-              if (this.shopData.shopId === item.id) {
-                this.storeIndex = index;
-              }
-            });
-            this.storeId = this.storeList[this.storeIndex].id;
-
-            // 商品类型回显
-            this.getType();
-            this.getLine();
+            this.getShopList()
 
             // 限制购票回显
             if (this.shopData.saleRule === '1') {
@@ -287,9 +279,10 @@ export default {
             // 图标回显
             if (this.shopData.icon) {
               console.log('有图标');
-              this.iconurl = this.shopData.icon
+              this.iconurl = this.shopData.icon;
+            } else {
+              this.iconurl = ''
             }
-
           }
         });
     },
@@ -362,6 +355,19 @@ export default {
               arr.push({ name: element.name, id: element.id });
             });
             this.storeList = this.storeList.concat(arr);
+            console.log(this.storeList);
+             // 所属店铺回显
+            if (this.shopData.shopId) {
+              this.storeList.forEach((item, index) => {
+                if (this.shopData.shopId === item.id) {
+                  this.storeIndex = index;
+                }
+              });
+              this.storeId = this.storeList[this.storeIndex].id;
+              // 商品类型回显
+              this.getType();
+              this.getLine();
+            }
           }
         });
     },
@@ -400,14 +406,11 @@ export default {
           shopId: this.storeId,
         })
         .then(async (res) => {
-          console.log(res);
           let arr = [];
           res.data.forEach((element) => {
             arr.push({ name: element.ticket_name, id: element.ticket_no });
           });
           this.shopList = this.shopList.concat(arr);
-          console.log(1);
-          console.log(this.shopList);
         });
     },
     // 线路分配
@@ -568,7 +571,7 @@ export default {
       }
       // 判断是否可以自定义商品名称
       let name = '';
-      if ((this.shopList.length === 1)) {
+      if (this.shopList.length === 1) {
         name = this.shopname;
       } else {
         name = this.shopList[this.shopIndex].id;
@@ -588,9 +591,20 @@ export default {
         this.loading = false;
         return;
       }
-      
+
+      console.log(this.shopData.id);
+      console.log(this.scenicId);
+      console.log(this.storeId);
+      console.log(this.typeId);
+      console.log(name);
+      console.log(this.lineId);
+      console.log(this.showoperat);
+      console.log( JSON.stringify(astrictDate));
+      console.log(this.mastKnow);
+      console.log(this.Icon);
       this.$http
         .post('/goods/add', {
+          id: this.shopData.id || '',
           mid: this.scenicId,
           shopId: this.storeId,
           typeId: this.typeId,
@@ -603,15 +617,18 @@ export default {
         })
         .then((res) => {
           if (res.code === 200 && res.msg === 'OK') {
-            this.$mHelper.toast('添加成功');
+            if (this.shopData.id) {
+              this.$mHelper.toast('保存成功,请联系管理员进行审核');
+            } else {
+              this.$mHelper.toast('添加成功');
+            }
             this.loading = false;
             setTimeout(() => {
               this.$mRouter.back();
             }, 500);
           }
         });
-    }
-
+    },
   },
 };
 </script>