yuany 3 лет назад
Родитель
Сommit
985d85e56e
1 измененных файлов с 36 добавлено и 16 удалено
  1. 36 16
      src/views/Submit.vue

+ 36 - 16
src/views/Submit.vue

@@ -37,7 +37,7 @@
                         <van-image :src="item.icon" width="24px" height="24px" fit="cover" class="payment_method_img" />
                         <div class="payment_method_title">{{ item.name }}</div>
                     </div>
-                    <img class="choose-icon" :src="icons[1]" alt="" />
+                    <img class="choose-icon" :src="payType === item.type ? icons[1] : icons[0]" alt="" />
                 </div>
             </div>
             <div class="bottom van-safe-area-bottom" ref="bottom">
@@ -161,6 +161,22 @@ export default {
                 }
                 return Promise.resolve();
             }),
+            this.$http.get('/sysConfig/get/enable_H5').then(res => {
+                if (res.name === 'enable_H5') {
+                    this.payInfos = [
+                        {
+                            icon: require('@assets/svgs/zhifubao.svg'),
+                            name: '支付宝',
+                            type: 'ALIPAY'
+                        },
+                        {
+                            icon: require('@assets/icon_yinlian.png'),
+                            name: '银联快捷付',
+                            type: 'H5PAY'
+                        }
+                    ];
+                }
+            }),
             inWeixin
                 ? this.$http.get('/sysConfig/get/enable_wx_pub').then(res => {
                       this.enable_wx_pub = res.value.split(',').findIndex(i => i === this.$route.query.id) > -1;
@@ -175,7 +191,7 @@ export default {
             })
         ]).then(() => {
             if (!(this.enable_wx_lite || this.enable_wx_pub)) {
-                this.payInfos.splice(1, 1);
+                // this.payInfos.splice(1, 1);
                 this.payType = 'ALIPAY';
             } else if (this.enable_wx_pub) {
                 this.payChannel = 'wx_pub';
@@ -316,7 +332,7 @@ export default {
                             .get('/order/createResult', { id: res.id })
                             .then(res => {
                                 if (res) {
-                                    console.log('1212212是个顺丰到付');
+                                    console.log('1212212是个顺丰到付', res);
                                     clearInterval(this.createOrderTimer);
                                     this.createOrderTimer = null;
                                     if (res.success) {
@@ -342,7 +358,6 @@ export default {
                 this.$toast('请选择支付方式');
                 return;
             }
-
             if (this.couponPayment && !this.couponInfo) {
                 this.$dialog
                     .alert({
@@ -374,6 +389,7 @@ export default {
         pay(saveOrder = true) {
             this.paySubmit(saveOrder).then(() => {
                 if (this.money) {
+                    console.log("1321221",this.payType)
                     this.$nextTick(() => {
                         if (this.$store.state.review) {
                             window.store.order('358');
@@ -422,10 +438,14 @@ export default {
                                 });
                                 this.getOrder(true);
                             }
+                        } else if (this.payType === 'H5PAY') {
+                            console.log('12sssgsgfa');
+                            document.location.href = resolveUrl(
+                                this.$baseUrl,
+                                '/payOrder/v2/sandQuick?id=' + this.orderId
+                            );
                         }
                     });
-                } else if (this.payType === 'H5PAY') {
-                    document.location.href = resolveUrl(this.$baseUrl, '/payOrder/v2/sandQuick?id=' + this.orderId);
                 } else {
                     this.$toast.success('支付成功');
                     setTimeout(() => {
@@ -436,7 +456,8 @@ export default {
         },
         paySubmit(saveOrder = true) {
             return new Promise((resolve, reject) => {
-                if (this.money && saveOrder && this.payType != 'H5PAY') {
+                if (this.money && saveOrder) {
+                    console.log("778888888",this.payType)
                     this.$toast.clear();
                     this.$router.replace({ query: { ...this.$route.query, orderId: this.orderId } });
                     this.$nextTick(() => {
@@ -518,17 +539,16 @@ export default {
                                         });
                                     reject();
                                 });
+                        } else if (this.payType === 'H5PAY') {
+                            this.$router.replace({
+                                path: '/submit',
+                                query: {
+                                    orderId: this.orderId
+                                }
+                            });
+                            resolve();
                         }
                     });
-                } else if (this.payType === 'H5PAY') {
-                    console.log('支付支付');
-                    this.$router.replace({
-                        path: '/submit',
-                        query: {
-                            orderId: this.orderId
-                        }
-                    });
-                    resolve();
                 } else {
                     resolve();
                 }