xuqiang 4 years ago
parent
commit
fb60f1c809
1 changed files with 55 additions and 43 deletions
  1. 55 43
      src/pages/store/productEdit.vue

+ 55 - 43
src/pages/store/productEdit.vue

@@ -225,12 +225,12 @@
                         <div class="bor"></div>
                         <div class="bor"></div>
                     </div>
                     </div>
                 </div>
                 </div>
-                <div class="add" @click="addCon">
+                <div class="add" @click="add">
                     <img src="../../native/tabbar/icon_shangchuan@3x.png" alt="" />
                     <img src="../../native/tabbar/icon_shangchuan@3x.png" alt="" />
                     <p>点击添加</p>
                     <p>点击添加</p>
                 </div>
                 </div>
                 <div class="bottom">
                 <div class="bottom">
-                    <van-button type="primary" block @click="flag = true">完成</van-button>
+                    <van-button type="primary" block @click="submitCon">完成</van-button>
                 </div>
                 </div>
             </div>
             </div>
             <div v-else>
             <div v-else>
@@ -306,7 +306,7 @@ export default {
             sotrId: [],
             sotrId: [],
             list: [],
             list: [],
             actions: [],
             actions: [],
-            cardCaseInputDTOs: [],
+            caseJackpots: [],
             time: 0,
             time: 0,
             times: 1,
             times: 1,
             typeOptions: [
             typeOptions: [
@@ -445,12 +445,22 @@ export default {
             this.form.limitOne = nameList.limitOne;
             this.form.limitOne = nameList.limitOne;
             // console.log(this.form.limitOne);
             // console.log(this.form.limitOne);
         },
         },
-        addCon() {
+        add() {
             this.flags = false;
             this.flags = false;
             this.forms.name = '';
             this.forms.name = '';
             this.forms.amount = '';
             this.forms.amount = '';
             this.forms.images = '';
             this.forms.images = '';
         },
         },
+        submitCon() {
+            // if (this.cardLists.length < 0) {
+            //     wx.showToast({
+            //         icon: 'none',
+            //         title: '福袋不能为空,请添加福袋'
+            //     });
+            //     return;
+            // }
+            this.flag = true;
+        },
         submitNum() {
         submitNum() {
             if (!this.forms.name) {
             if (!this.forms.name) {
                 wx.showToast({
                 wx.showToast({
@@ -734,6 +744,7 @@ export default {
                 newJackpot.name = item.name;
                 newJackpot.name = item.name;
                 newJackpot.images = item.images;
                 newJackpot.images = item.images;
                 newJackpot.amount = item.amount;
                 newJackpot.amount = item.amount;
+                this.caseJackpots.push(newJackpot);
             });
             });
             // this.$set(newJackpot, cardCaseInputDTO);
             // this.$set(newJackpot, cardCaseInputDTO);
             let caseStatus = 'UNDO';
             let caseStatus = 'UNDO';
@@ -745,48 +756,49 @@ export default {
             let images = this.imageUrls;
             let images = this.imageUrls;
             cardCaseInputDTO.images = images;
             cardCaseInputDTO.images = images;
             cardCaseInputDTO.caseStatus = caseStatus;
             cardCaseInputDTO.caseStatus = caseStatus;
+            cardCaseInputDTO.groupDTOS = this.caseJackpots;
             console.log(this.cardList);
             console.log(this.cardList);
             console.log(this.cardCaseInputDTOs);
             console.log(this.cardCaseInputDTOs);
             console.log(cardCaseInputDTO);
             console.log(cardCaseInputDTO);
-            // this.showLoading();
-            // this.$http
-            //     .post('/cardCase/save', cardCaseInputDTO, {
-            //         header: {
-            //             'Content-Type': 'application/json'
-            //         }
-            //     })
-            //     .then(res => {
-            //         // console.log(res);
-            //         this.id = res.id;
-            //         this.hideLoading();
-            //         this.form = {
-            //             id: res.id,
-            //             boxPrice: res.boxPrice,
-            //             special: res.special,
-            //             groupDTOS: res.groupDTOS,
-            //             startTime: res.startTime,
-            //             description: res.description,
-            //             collectionId: res.collectionId,
-            //             caseStatus: res.caseStatus,
-            //             limitOne: res.limitOne,
-            //             packagesCount: res.packagesCount,
-            //             postage: res.postage || 0
-            //             // images: res.images
-            //         };
-            //         wx.showToast({
-            //             title: '商品上架成功'
-            //         });
-            //         setTimeout(() => {
-            //             this.navigateBack();
-            //         }, 1000);
-            //     })
-            //     .catch(e => {
-            //         this.hideLoading();
-            //         wx.showToast({
-            //             icon: 'none',
-            //             title: e.error
-            //         });
-            //     });
+            this.showLoading();
+            this.$http
+                .post('/cardCase/save', cardCaseInputDTO, {
+                    header: {
+                        'Content-Type': 'application/json'
+                    }
+                })
+                .then(res => {
+                    // console.log(res);
+                    this.id = res.id;
+                    this.hideLoading();
+                    this.form = {
+                        id: res.id,
+                        boxPrice: res.boxPrice,
+                        special: res.special,
+                        groupDTOS: res.groupDTOS,
+                        startTime: res.startTime,
+                        description: res.description,
+                        collectionId: res.collectionId,
+                        caseStatus: res.caseStatus,
+                        limitOne: res.limitOne,
+                        packagesCount: res.packagesCount,
+                        postage: res.postage || 0
+                        // images: res.images
+                    };
+                    wx.showToast({
+                        title: '商品上架成功'
+                    });
+                    setTimeout(() => {
+                        this.navigateBack();
+                    }, 1000);
+                })
+                .catch(e => {
+                    this.hideLoading();
+                    wx.showToast({
+                        icon: 'none',
+                        title: e.error
+                    });
+                });
         },
         },
         pickerShow(key = 'show') {
         pickerShow(key = 'show') {
             this[key] = true;
             this[key] = true;