xuqiang há 5 anos atrás
pai
commit
857e282509

+ 1 - 1
.env.development

@@ -1 +1 @@
-VUE_APP_BASE_URL=http://192.168.50.120:8080
+VUE_APP_BASE_URL=https://zhuoka.izouma.com

+ 6 - 0
project.private.config.json

@@ -167,6 +167,12 @@
                     "pathName": "pages/store/productEdit",
                     "query": "null",
                     "scene": null
+                },
+                {
+                    "name": "管理商品",
+                    "pathName": "pages/store/administration",
+                    "query": "null",
+                    "scene": null
                 }
             ]
         }

+ 3 - 1
src/main.js

@@ -124,7 +124,9 @@ export default {
             'van-goods-action': 'vant/goods-action/index',
             'van-goods-action-icon': 'vant/goods-action-icon/index',
             'van-goods-action-button': 'vant/goods-action-button/index',
-            'van-calendar': 'vant/calendar/index'
+            'van-calendar': 'vant/calendar/index',
+            'van-dropdown-menu': 'vant/dropdown-menu/index',
+            'van-dropdown-item': 'vant/dropdown-item/index'
         },
         plugins: {
             'live-player-plugin': {

+ 2 - 0
src/pages/Home.vue

@@ -182,7 +182,9 @@ export default {
                 )
                 .then(res => {
                     this.hideLoading();
+                    console.log(res);
                     this.columns = res.content;
+                    console.log(this.columns);
                 })
                 .catch(e => {
                     this.hideLoading();

+ 53 - 14
src/pages/store/administration.vue

@@ -62,7 +62,6 @@
                         </div>
                     </div>
                 </div>
-
                 <div class="content">
                     <div class="card" v-for="(card, index) in cardList" :key="index">
                         <div class="card-title">第{{ index + 1 }}组</div>
@@ -72,10 +71,10 @@
                                 :key="item.id"
                                 class="card-item"
                                 :class="{
-                                    used: !canChoose(item),
-                                    active: nowChoose.includes(item.id)
+                                    used: canChoose(item.caseStatus),
+                                    active: nowChooseId.includes(item.id)
                                 }"
-                                @click="choose(item.id, !canChoose(item))"
+                                @click="choose(item.id, canChoose(item.caseStatus))"
                             >
                                 {{ itemIndex }}
                             </div>
@@ -135,19 +134,54 @@ export default {
             },
             show: false,
             newShow: false,
-            cardCaseInfo: {},
-            chooseIds: [],
             nowChoose: [],
             closeFlag: false,
             detailsList: [],
-            cardList: [{ A: 'A' }, { B: 'B' }, { C: 'C' }],
+            nowChooseId: [],
+            list: [],
+            cardList: [
+                // [
+                //     { id: '106', title: '数组', caseStatus: 'WAIT' },
+                //     { id: '11', title: '数组' },
+                //     { id: '201', title: '数组' },
+                //     { id: '31', title: '数组', caseStatus: 'WAIT' },
+                //     { id: '41', title: '数组' },
+                //     { id: '51', title: '数组' }
+                // ],
+                // [
+                //     { id: '100', title: '数组' },
+                //     { id: '212', title: '数组' },
+                //     { id: '22', title: '数组' },
+                //     { id: '32', title: '数组' },
+                //     { id: '47', title: '数组' },
+                //     { id: '58', title: '数组', caseStatus: 'WAIT' }
+                // ],
+                // [
+                //     { id: '90', title: '数组' },
+                //     { id: '19', title: '数组' },
+                //     { id: '29', title: '数组', caseStatus: 'WAIT' },
+                //     { id: '39', title: '数组' },
+                //     { id: '49', title: '数组' },
+                //     { id: '59', title: '数组' }
+                // ]
+            ],
             actions: [],
             minDate: new Date(new Date().getFullYear() - 1, 10, 1).getTime(),
             maxDate: new Date(new Date().getFullYear() + 2, 10, 1).getTime(),
             currentDate: new Date().getTime()
         };
     },
-    computed: {},
+    computed: {
+        cardLists() {
+            let boxMap = { ...this.cardList };
+            return Object.keys(boxMap).map(item => {
+                return boxMap[item];
+            });
+        },
+        allCards() {
+            return [...this.cardLists].flat();
+        }
+    },
     watch: {
         show: {
             handler: function(newVal) {
@@ -224,19 +258,18 @@ export default {
         },
         canChoose(info) {
             let status = ['WAIT', 'PROGRESS'];
-            return status.includes(info.caseStatus) && !this.sold;
+            return status.includes(info) && !info.sold;
         },
         choose(id, used = false) {
             if (used) {
                 return;
             }
-            let list = [...this.nowChoose];
-            if (list.includes(id)) {
-                list.splice(list.indexOf(id), 1);
+            if (this.list.includes(id)) {
+                this.list.splice(this.list.indexOf(id), 1);
             } else {
-                list.push(id);
+                this.list.push(id);
             }
-            this.nowChoose = list;
+            this.nowChooseId = [...this.list].join(',');
         },
         select(e) {
             if (this.closeFlag) {
@@ -277,6 +310,12 @@ export default {
             // });
             this.$http.get('cardCase/getCardCase', { id: 2767 }).then(res => {
                 console.log(res);
+                // console.log(res.groupDTOS);
+                // this.cardList = res.groupDTOS;
+                // console.log(this.cardLists);
+                // console.log(this.allCards);
+                // this.cardList = this.cardLists[0].dynamicTags;
+                // console.log(this.cardList);
                 this.form = {
                     price: res.boxPrice,
                     dates: res.startTime,

+ 109 - 42
src/pages/store/productEdit.vue

@@ -49,7 +49,14 @@
         <div class="box-con">
             <div class="label">卡牌细节图</div>
             <van-uploader :file-list="fileList" :after-read="afterRead" @delete="deleteImg" />
-            <div></div>
+            <van-sticky :offset-top="0">
+                <div class="time-box">
+                    <van-dropdown-menu>
+                        <van-dropdown-item @change="change" :value="time" :options="option1" />
+                    </van-dropdown-menu>
+                </div>
+            </van-sticky>
+
             <div class="box">
                 <div class="top">
                     <span>选择卡包</span>
@@ -62,21 +69,11 @@
                         </div>
                     </div>
                 </div>
-
                 <div class="content">
-                    <div class="card" v-for="(card, index) in cardList" :key="index">
-                        <div class="card-title">第{{ index + 1 }}组</div>
+                    <div class="card" v-for="(card, index) in cardLists" :key="index">
+                        <div class="card-title">第{{ index }}组</div>
                         <div class="card-list">
-                            <div
-                                v-for="(item, itemIndex) in card"
-                                :key="item.id"
-                                class="card-item"
-                                :class="{
-                                    used: !canChoose(item),
-                                    active: nowChoose.includes(item.id)
-                                }"
-                                @click="choose(item.id, !canChoose(item))"
-                            >
+                            <div v-for="(item, itemIndex) in card" :key="item" class="card-item">
                                 {{ itemIndex }}
                             </div>
                         </div>
@@ -135,20 +132,69 @@ export default {
             },
             show: false,
             newShow: false,
-            cardCaseInfo: {},
             fileList: [],
-            chooseIds: [],
-            nowChoose: [],
+            nowChooseId: [],
+            list: [],
             closeFlag: false,
-            detailsList: [],
-            cardList: [{ A: 'A' }, { B: 'B' }, { C: 'C' }],
+            cardList: [
+                // [
+                //     { id: '106', title: '数组' },
+                //     { id: '11', title: '数组' },
+                //     { id: '201', title: '数组' },
+                //     { id: '31', title: '数组' },
+                //     { id: '41', title: '数组' },
+                //     { id: '51', title: '数组' }
+                // ],
+                // [
+                //     { id: '100', title: '数组' },
+                //     { id: '212', title: '数组' },
+                //     { id: '22', title: '数组' },
+                //     { id: '32', title: '数组' },
+                //     { id: '47', title: '数组' },
+                //     { id: '58', title: '数组' }
+                // ],
+                // [
+                //     { id: '90', title: '数组' },
+                //     { id: '19', title: '数组' },
+                //     { id: '29', title: '数组' },
+                //     { id: '39', title: '数组' },
+                //     { id: '49', title: '数组' },
+                //     { id: '59', title: '数组' }
+                // ]
+            ],
+            time: 0,
+            typeOptions: [
+                { id: 0, name: '组队模板(24组6包)', group: 24, groupCount: 6, special: false },
+                { id: 1, name: '端盒模板(AB组)', group: 2, groupCount: 24, special: true },
+                { id: 2, name: '组队模板(单组24包)', group: 1, groupCount: 24, special: false },
+                { id: 3, name: '组队模板(单组20包)', group: 1, groupCount: 20, special: false }
+            ],
             actions: [],
             minDate: new Date(new Date().getFullYear() - 1, 10, 1).getTime(),
             maxDate: new Date(new Date().getFullYear() + 2, 10, 1).getTime(),
             currentDate: new Date().getTime()
         };
     },
-    computed: {},
+    computed: {
+        option1() {
+            let list = [...this.typeOptions];
+            return list.map(item => {
+                return {
+                    text: item.name,
+                    value: item.id
+                };
+            });
+        },
+        cardLists() {
+            let boxMap = { ...this.cardList };
+            return Object.keys(boxMap).map(item => {
+                return boxMap[item];
+            });
+        },
+        allCards() {
+            return [...this.cardLists].flat();
+        }
+    },
     watch: {
         show: {
             handler: function(newVal) {
@@ -159,9 +205,6 @@ export default {
             }
         }
     },
-    onLoad() {
-        this.cartBox();
-    },
     methods: {
         cardInit() {
             this.showLoading();
@@ -223,22 +266,6 @@ export default {
         cancel() {
             this.show = false;
         },
-        canChoose(info) {
-            let status = ['WAIT', 'PROGRESS'];
-            return status.includes(info.caseStatus) && !this.sold;
-        },
-        choose(id, used = false) {
-            if (used) {
-                return;
-            }
-            let list = [...this.nowChoose];
-            if (list.includes(id)) {
-                list.splice(list.indexOf(id), 1);
-            } else {
-                list.push(id);
-            }
-            this.nowChoose = list;
-        },
         select(e) {
             if (this.closeFlag) {
                 this.form.name = e.detail.name;
@@ -272,10 +299,27 @@ export default {
                     });
                 });
         },
-        cartBox() {
-            this.$http.post('/cardCase/genNew').then(res => {
-                console.log(res);
+        change(e) {
+            this.time = e.detail;
+            let cardBos = this.typeOptions.find(item => {
+                return item.id == this.time;
             });
+            this.initApi(cardBos);
+        },
+        initApi(params) {
+            this.showLoading();
+            this.$http
+                .post('/cardCase/genNew', {
+                    group: params.group,
+                    groupCount: params.groupCount,
+                    special: params.special
+                })
+                .then(res => {
+                    this.hideLoading();
+                    console.log(res);
+                    this.cardList = { ...res };
+                    console.log(this.cardList);
+                });
         },
         afterRead(file) {
             this.showLoading();
@@ -324,6 +368,9 @@ export default {
             wx.showToast({
                 title: '商品上架成功'
             });
+        },
+        created(params) {
+            this.initApi(params.group, params.groupCount, params.special);
         }
     }
 };
@@ -332,6 +379,26 @@ export default {
 /deep/ .van-uploader {
     margin-top: 20px;
 }
+// /deep/ .van-dropdown-menu {
+//     width: 110px;
+//     border-radius: 4px;
+//     overflow: hidden;
+//     background: aquamarine;
+
+//     .van-cell__value {
+//         &::after {
+//             content: '';
+//         }
+//         &::before {
+//             content: '';
+//         }
+//     }
+// }
+.time-box {
+    background-color: @bg;
+    padding: 20px;
+    margin-right: 20px;
+}
 /deep/ .van-cell {
     --cell-vertical-padding: 23px;
     --cell-horizontal-padding: 20px;