xuqiang 4 лет назад
Родитель
Сommit
d5c52897a4
2 измененных файлов с 73 добавлено и 80 удалено
  1. 3 3
      src/pages/details.vue
  2. 70 77
      src/pages/store/productEdit.vue

+ 3 - 3
src/pages/details.vue

@@ -81,7 +81,7 @@
                         @click="preview(item.image, getImgs(cardList))"
                         alt=""
                     />
-                    <p class="swiper-itemText">×{{ index }}</p>
+                    <p class="swiper-itemText">×{{ item.count }}</p>
                 </swiper-item>
             </template>
         </swiper>
@@ -99,7 +99,7 @@
                         @click="preview(item.image, getImgs(defaultCards))"
                         alt=""
                     />
-                    <p class="swiper-itemTexts">×{{ index }}</p>
+                    <p class="swiper-itemTexts">×{{ item.count }}</p>
                 </div>
             </div>
             <div v-if="collectFlag" class="btn" @click="add">查看全部</div>
@@ -224,7 +224,7 @@ export default {
                     this.detailsList = res.groupBoxMap;
                     this.cardCaseInfo = res.cardCaseInfo || {};
                     this.cards = res.cardCaseInfo.cardDTOs;
-                    console.log(this.cardList);
+                    console.log(this.cards);
                     if (this.cards == '') {
                         this.label = '暂无卡片展示';
                     }

+ 70 - 77
src/pages/store/productEdit.vue

@@ -134,7 +134,6 @@
                     </div>
                 </div> -->
                 </div>
-
                 <div class="box" v-else>
                     <div class="top2">
                         <span>已售/总数</span>
@@ -181,8 +180,8 @@
             </div>
 
             <div class="btn-list">
-                <div v-if="time != 4" @click="submit">确认上架</div>
-                <div v-else @click="submits">确认上架</div>
+                <div v-if="time != 4" @click="submit">确认上架1</div>
+                <div v-else @click="submits">确认上架2</div>
             </div>
             <van-action-sheet
                 :show="show"
@@ -230,7 +229,7 @@
                     <p>点击添加</p>
                 </div>
                 <div class="bottom">
-                    <van-button type="primary" block @click="submitCon">完成</van-button>
+                    <van-button type="primary" block @click="flag = true">完成</van-button>
                 </div>
             </div>
             <div v-else>
@@ -256,11 +255,11 @@
                 <van-uploader
                     style="margin-left:20px"
                     :file-list="forms.image"
-                    :after-read="aaa"
+                    :after-read="afterReads"
                     @delete="deleteImgs"
                 />
                 <div class="bottom">
-                    <van-button type="primary" block @click="submitNum">完成2</van-button>
+                    <van-button type="primary" block @click="submitNum">完成</van-button>
                 </div>
             </div>
         </div>
@@ -453,16 +452,6 @@ export default {
             this.forms.amount = '';
             this.forms.image = [];
         },
-        submitCon() {
-            // if (this.cardLists.length < 0) {
-            //     wx.showToast({
-            //         icon: 'none',
-            //         title: '福袋不能为空,请添加福袋'
-            //     });
-            //     return;
-            // }
-            this.flag = true;
-        },
         submitNum() {
             if (!this.forms.name) {
                 wx.showToast({
@@ -523,6 +512,13 @@ export default {
                 // console.log(res);
                 this.soldStatus = res.soldStatus;
                 this.showId = res.id;
+                this.cardList = res.caseJackpots;
+                if (res.collectionId == 16507) {
+                    this.change({
+                        detail: 4
+                    });
+                    this.cardList = res.caseJackpots;
+                }
                 if (res.limitOne == true) {
                     this.times = 0;
                 }
@@ -535,13 +531,14 @@ export default {
                     description: res.description,
                     limitOne: res.limitOne,
                     special: res.special,
+                    images: res.images,
                     collectionId: res.collectionId,
                     caseStatus: res.caseStatus,
                     packagesCount: res.packagesCount,
                     postage: res.postage || 0
-                    // images: res.images
                     // amount: res.boxesCount || null
                 };
+
                 this.images = res.images.split(',').map(item => {
                     return {
                         url: item
@@ -586,14 +583,10 @@ export default {
                 });
         },
         change(e) {
-            console.log(e);
-            this.chooseType = e.detail;
             this.time = e.detail;
             let cardBos = [...this.typeOptions].find(item => {
                 return item.id == this.time;
             });
-
-            console.log(this.chooseType);
             if (this.time != 4) {
                 this.initApi(cardBos);
             }
@@ -612,7 +605,7 @@ export default {
                     this.hideLoading();
                     this.form.special = params.special;
                     this.form.groupDTOS = res;
-                    // console.log(this.form.groupDTOS);
+                    console.log(this.form.groupDTOS);
                 })
                 .catch(e => {
                     this.hideLoading();
@@ -653,7 +646,7 @@ export default {
                 return item.url;
             });
         },
-        aaa(file) {
+        afterReads(file) {
             console.log(file);
             this.showLoading();
             this.$http
@@ -770,11 +763,11 @@ export default {
                 });
                 return;
             }
-
-            let newJackpot = {};
             var count = new Number('0');
             this.cardList.map(item => {
+                let newJackpot = {};
                 newJackpot.name = item.name;
+                newJackpot.id = item.id;
                 newJackpot.image = item.image[0];
                 newJackpot.amount = item.amount;
                 newJackpot.jackpotId = item.jackpotId;
@@ -782,67 +775,67 @@ export default {
                 count = count + amount;
                 this.caseJackpots.push(newJackpot);
             });
-            console.log(count);
+            console.log('=====');
+            console.log(this.caseJackpots);
+            console.log('=====');
             if (!this.$mp.query.id) {
                 let box = {
                     group: 1,
                     groupCount: count,
                     special: false
                 };
-
                 this.initApi(box);
             }
-            let caseStatus = 'UNDO';
-            delete this.form.collectionId;
-            delete this.form.seriesId;
-            // delete this.form.groupDTOS;
-            let cardCaseInputDTO = { ...this.form };
-            let images = this.imageUrls.join(',');
-            // let images = this.imageUrls;
-            cardCaseInputDTO.images = images;
-            cardCaseInputDTO.caseStatus = caseStatus;
-            cardCaseInputDTO.caseJackpots = this.caseJackpots;
-            console.log(this.cardList);
-            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
+            setTimeout(() => {
+                let caseStatus = 'UNDO';
+                delete this.form.collectionId;
+                delete this.form.seriesId;
+                console.log(this.form.groupDTOS);
+                let cardCaseInputDTO = { ...this.form };
+                let images = this.imageUrls.join(',');
+                cardCaseInputDTO.images = images;
+                cardCaseInputDTO.caseStatus = caseStatus;
+                cardCaseInputDTO.caseJackpots = this.caseJackpots;
+                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.navigateTo('/pages/store/homePage');
+                        }, 1000);
+                    })
+                    .catch(e => {
+                        this.hideLoading();
+                        wx.showToast({
+                            icon: 'none',
+                            title: e.error
+                        });
                     });
-                });
+            }, 1000);
         },
         pickerShow(key = 'show') {
             this[key] = true;