panhui 3 лет назад
Родитель
Сommit
ffaf2a3a2f
3 измененных файлов с 74 добавлено и 10 удалено
  1. 21 3
      src/views/Submit.vue
  2. 29 4
      src/views/activity/ChooseProduct.vue
  3. 24 3
      src/views/activity/Submit.vue

+ 21 - 3
src/views/Submit.vue

@@ -51,7 +51,25 @@
                 <!-- <wx-open-launch-weapp id="launch-btn" :username="launchName" :path="launchPath"> </wx-open-launch-weapp> -->
             </div>
         </div>
-        <pay-balance v-model:tradeCode="tradeCode" @pay="pay" ref="payBalance"></pay-balance>
+        <van-number-keyboard v-model="tradeCode" :show="showKeyboard" @blur="showKeyboard = false" />
+        <van-dialog
+            v-model:show="showPwdDialog"
+            title="请输入支付密码"
+            confirmButtonText="立即支付"
+            show-cancel-button
+            confirmButtonColor="#3ab200"
+            @cancel="(showPwdDialog = false), $toast.clear()"
+            @confirm="pay"
+        >
+            <div style="padding: 20px 0">
+                <van-password-input
+                    :value="tradeCode"
+                    :focused="showKeyboard"
+                    @focus="showKeyboard = true"
+                    gutter="4px"
+                />
+            </div>
+        </van-dialog>
     </div>
 </template>
 
@@ -428,7 +446,7 @@ export default {
             } else if (this.payType === 'BALANCE') {
                 if (!this.tradeCode) {
                     this.$toast.clear();
-                    this.$refs.payBalance.show();
+                    this.showPwdDialog = true;
                     return;
                 }
                 this.$toast.loading({
@@ -708,4 +726,4 @@ export default {
 :deep(.van-password-input__item) {
     background: @bg3;
 }
-</style>
+</style>

+ 29 - 4
src/views/activity/ChooseProduct.vue

@@ -61,15 +61,16 @@
                             <div class="text2" v-if="item.number">编号:{{ item.number }}</div>
                         </div>
                     </div>
-                    <div @click.stop="" v-if="item.collections">
+                    <div class="num-right" @click.stop="" v-if="item.collections">
                         <van-stepper
                             v-model="item.num"
                             :name="item.id"
                             :min="0"
-                            :max="getMax(item.collections.length)"
+                            :max="item.collections.length"
                             @change="changeStepper"
                             size="mini"
                         />
+                        <div class="num-text">共{{ item.collections.length }}个</div>
                     </div>
                 </div>
             </div>
@@ -158,6 +159,20 @@ export default {
             console.log(_map);
 
             return [..._map.values()];
+        },
+        numList() {
+            let chooseIds = [...this.chooseIds];
+            let collections = [...this.collections];
+            let nums = [];
+            chooseIds.forEach(item => {
+                let info = collections.find(coll => {
+                    return coll.id === item;
+                });
+                if (info) {
+                    nums.push(`${info.id}_${info.num || 1}`);
+                }
+            });
+            return nums;
         }
     },
     mounted() {
@@ -197,7 +212,7 @@ export default {
             });
             let chooseIds = [...this.chooseIds];
             let choose = chooseIds.filter(item => {
-                return _collections.includes(item);
+                return collections.includes(item);
             });
             let index = chooseIds.indexOf(detail.name);
             if (value > choose.length && this.chooseIds.length === this.needChoose && this.needChoose !== 0) {
@@ -296,7 +311,8 @@ export default {
                     path: '/activitySubmit',
                     query: {
                         assets: this.chooseIds.join(','),
-                        activityId: this.activityId
+                        activityId: this.activityId,
+                        numList: this.numList.join(',')
                     }
                 });
             });
@@ -427,4 +443,13 @@ export default {
     font-size: 12px;
     padding: 10px;
 }
+.num-right {
+    .flex-col();
+    align-items: center;
+    .num-text {
+        font-size: 10px;
+        color: @text3;
+        margin-top: 6px;
+    }
+}
 </style>

+ 24 - 3
src/views/activity/Submit.vue

@@ -30,6 +30,7 @@
                     <div class="text2" v-if="item.category">类型:{{ item.category }}</div>
                     <div class="text2" v-if="item.number">编号:{{ item.number }}</div>
                 </div>
+                <div class="assets-num" v-if="item.num > 1">x{{ item.num }}</div>
             </div>
         </div>
         <div style="padding: 0 16px">
@@ -130,7 +131,8 @@ export default {
             info: {},
             showPwdDialog: false,
             showKeyboard: false,
-            tradeCode: ''
+            tradeCode: '',
+            numList: []
         };
     },
     computed: {
@@ -157,7 +159,17 @@ export default {
         if (this.$route.query.assets) {
             this.assets = this.$route.query.assets;
             this.activityId = this.$route.query.activityId;
-            this.getProduct(this.$route.query.assets.split(','));
+            if (this.$route.query.numList) {
+                this.numList = this.$route.query.numList.split(',');
+                this.getProduct(
+                    [...this.numList].map(item => {
+                        return item.split('_')[0];
+                    })
+                );
+            } else {
+                this.getProduct(this.$route.query.assets.split(','));
+            }
+
             this.$http.get('/mintActivity/get/' + this.activityId).then(res => {
                 this.info = res;
                 this.gas = res.gasPrice;
@@ -220,7 +232,10 @@ export default {
                 return;
             }
             this.$http.get('/asset/get/' + list[index]).then(res => {
-                this.list.push(res);
+                let info = [...this.numList].find(item => {
+                    return item.split('_')[0] === res.id;
+                });
+                this.list.push({ ...res, num: Number(info.split('_')[1]) });
                 this.getProduct(list, index + 1);
             });
         },
@@ -533,6 +548,12 @@ export default {
     &:last-child {
         margin-bottom: 0;
     }
+
+    .assets-num {
+        font-size: 12px;
+        color: @text3;
+        .flex();
+    }
 }
 
 .pay-item {