ソースを参照

Merge branch 'dev' of http://git.izouma.com/panhui/card-wechat into dev

panhui 4 年 前
コミット
ae0c8b8919

+ 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': {

+ 17 - 14
src/pages/Apply.vue

@@ -9,18 +9,19 @@
         <van-cell-group :border="false">
             <van-field
                 label="退款原因"
-                :value="reason"
+                :value="form.reason"
                 placeholder="请选择退款原因"
                 is-link
                 readonly
                 @click="show = true"
             >
             </van-field>
-            <van-field label="退款金额" :value="price" @input="price = $event.detail" placeholder="¥970"> </van-field>
+            <van-field label="退款金额" :value="form.price" @input="form.price = $event.detail" placeholder="¥970">
+            </van-field>
             <van-field
                 label="补充说明"
-                :value="message"
-                @input="message = $event.detail"
+                :value="form.message"
+                @input="form.message = $event.detail"
                 rows="1"
                 autosize
                 type="textarea"
@@ -74,9 +75,11 @@ export default {
     name: 'apply',
     data() {
         return {
-            reason: '',
-            message: '',
-            price: '',
+            form: {
+                reason: '',
+                message: '',
+                price: ''
+            },
             show: false,
             max: 100,
             showdialog: false,
@@ -98,7 +101,7 @@ export default {
     },
     computed: {
         canSubmit() {
-            if (this.reason && this.price) {
+            if (this.form.reason && this.form.price) {
                 return true;
             } else {
                 return false;
@@ -108,27 +111,27 @@ export default {
     created() {},
     methods: {
         select(action) {
-            this.reason = action.detail.name;
+            this.form.reason = action.detail.name;
             this.show = false;
         },
         submit() {
-            if (!this.reason) {
+            if (!this.form.reason) {
                 wx.showToast({
                     icon: 'none',
                     title: '退货原因不能为空'
                 });
                 return;
             }
-            if (!this.price) {
+            if (!this.form.price) {
                 wx.showToast({
                     icon: 'none',
                     title: '退货价格不能为空'
                 });
                 return;
             }
-            console.log(this.reason);
-            console.log(this.price);
-            console.log(this.message);
+            console.log(this.form.reason);
+            console.log(this.form.price);
+            console.log(this.form.message);
             wx.showToast({
                 title: '提交成功'
             });

+ 20 - 2
src/pages/Applydetails.vue

@@ -29,7 +29,7 @@
             </div>
             <div class="box-con">
                 <div class="box-con-Cards">
-                    <img src="../native/imgs/marker.png" alt="" />
+                    <img src="https://ticket-exchange.oss-cn-hangzhou.aliyuncs.com/wechat/info_top_bg.png" alt="" />
                     <div class="box-con-right">
                         <p class="box-con-tit">1105皇权破晓</p>
                         <div class="box-con-today">
@@ -71,7 +71,25 @@
 </template>
 <script>
 export default {
-    data() {}
+    data() {
+        return {};
+    },
+    methods: {
+        // orderCopy() {
+        //     wx.setClipboardData({
+        //         data: this.status.transactionId + '',
+        //         success(res) {
+        //             wx.getClipboardData({
+        //                 success(res) {
+        //                     wx.showToast({
+        //                         title: '订单单号复制成功'
+        //                     });
+        //                 }
+        //             });
+        //         }
+        //     });
+        // }
+    }
 };
 </script>
 <style lang="less" scoped>

+ 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();

+ 54 - 16
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>
@@ -118,7 +117,6 @@
                 :max-date="maxDate"
             />
         </van-popup>
-        <slot></slot>
     </div>
 </template>
 <script>
@@ -136,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) {
@@ -225,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) {
@@ -278,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,
@@ -309,7 +347,7 @@ export default {
                 return;
             }
             wx.showToast({
-                title: '提交成功'
+                title: '商品上架成功'
             });
         }
     }

+ 111 - 45
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>
@@ -102,7 +99,7 @@
             description="卡牌名称"
             cancel-text="取消"
             :actions="actions"
-            @click-overlay="cancel"
+            @overlay="overlay = false"
             @select="select"
             @cancel="cancel"
         >
@@ -118,7 +115,6 @@
                 :max-date="maxDate"
             />
         </van-popup>
-        <slot></slot>
     </div>
 </template>
 <script>
@@ -136,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) {
@@ -160,9 +205,6 @@ export default {
             }
         }
     },
-    onLoad() {
-        this.cartBox();
-    },
     methods: {
         cardInit() {
             this.showLoading();
@@ -224,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;
@@ -273,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();
@@ -323,8 +366,11 @@ export default {
                 return;
             }
             wx.showToast({
-                title: '提交成功'
+                title: '商品上架成功'
             });
+        },
+        created(params) {
+            this.initApi(params.group, params.groupCount, params.special);
         }
     }
 };
@@ -333,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;