Pārlūkot izejas kodu

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

xuqiang-97 5 gadi atpakaļ
vecāks
revīzija
7467d6863a
2 mainītis faili ar 14 papildinājumiem un 7 dzēšanām
  1. 7 2
      src/components/CardCase.vue
  2. 7 5
      src/pages/details.vue

+ 7 - 2
src/components/CardCase.vue

@@ -102,13 +102,15 @@ export default {
     data() {
         return {
             show: false,
-            nowChoose: []
+            nowChoose: [],
+            buy: false
         };
     },
     methods: {
-        init() {
+        init(type) {
             this.nowChoose = [...this.chooseIds];
             this.show = true;
+            this.buy = type === 'buy';
         },
         choose(id, used = false) {
             if (used) {
@@ -128,6 +130,9 @@ export default {
         submit() {
             this.$emit('update:chooseIds', this.nowChoose);
             this.show = false;
+            if (this.buy) {
+                this.$emit('buy');
+            }
         },
         getChart(index) {
             const list = ['A', 'B', 'C', 'D', 'E', 'F'];

+ 7 - 5
src/pages/details.vue

@@ -68,6 +68,7 @@
                 :chooseIds.sync="chooseIds"
                 :detailsList="detailsList"
                 :cardCaseInfo="cardCaseInfo"
+                @buy="purchase"
             ></card-case>
             <div class="box-footer-con">
                 <div class="box-footer-left">
@@ -132,11 +133,12 @@ export default {
         },
         // 确认订单
         purchase() {
-            if (this.chooseIds == '') {
-                wx.showToast({
-                    icon: 'none',
-                    title: '请选择卡包'
-                });
+            if (this.chooseIds.length === 0) {
+                // wx.showToast({
+                //     icon: 'none',
+                //     title: '请选择卡包'
+                // });
+                this.$refs.cardCase.init('buy');
                 return;
             }
             this.navigateTo(