Browse Source

支付按钮禁用

xuqiang 4 years ago
parent
commit
441d353345
1 changed files with 25 additions and 23 deletions
  1. 25 23
      src/main/pc-space/src/views/Submit.vue

+ 25 - 23
src/main/pc-space/src/views/Submit.vue

@@ -52,7 +52,13 @@
                     <div class="pay-list">
                         <div class="pay-info">
                             <el-radio-group v-model="payMethods">
-                                <el-radio v-for="item in payList" border :label="item.type" :key="item.type">
+                                <el-radio
+                                    :disabled="flag"
+                                    v-for="item in payList"
+                                    border
+                                    :label="item.type"
+                                    :key="item.type"
+                                >
                                     <img :src="item.icon" alt="" />
                                     <span> {{ item.name }}</span>
                                 </el-radio>
@@ -154,6 +160,7 @@ export default {
             org: '',
             empty: false,
             payMethods: 'WEIXIN',
+            flag: false,
             minters: 0,
             seconds: 0,
             allTime: 5 * 60 - 1,
@@ -293,9 +300,6 @@ export default {
         },
         all() {
             this.show2 = true;
-            // if (this.listAll.length === 0) {
-            //     this.empty = true;
-            // }
         },
         choose(info) {
             console.log(info);
@@ -304,6 +308,7 @@ export default {
         },
         handleClose() {
             this.show = false;
+            this.flag = false;
             if (this.payTimeout) {
                 clearInterval(this.payTimeout);
             }
@@ -312,10 +317,11 @@ export default {
             //监控支付状态
             this.payTimeout = setInterval(() => {
                 this.$http.get('/order/get/' + this.id).then(res => {
-                    console.log(res);
+                    // console.log(res);
                     if (res.status === 'FINISH') {
                         clearInterval(this.payTimeout);
                         this.show = false;
+                        this.flag = false;
                         setTimeout(() => {
                             this.init2();
                         }, 1000);
@@ -332,10 +338,12 @@ export default {
             }).then(() => {});
         },
         submit() {
+            // clearInterval(this.payTimeout);
             // console.log(this.$baseUrl);
             // if (this.payMethods === 'DCEP') {
             //     this.wait();
             // }
+            this.flag = true;
             let url = '/order/create?collectionId=' + this.$route.query.id + '&qty=1';
             if (this.couponInfo) {
                 url += '&couponId=' + this.couponInfo.id;
@@ -343,29 +351,20 @@ export default {
             this.$http
                 .post(url)
                 .then(res => {
-                    // 代金券
-                    if (!this.money) {
+                    if (this.money) {
+                        // 没有兑换券
+                        this.initTime(res.id, res.createdAt);
+                        this.status = res.status;
+                        this.id = res.id;
+                        this.payWatch();
+                    } else {
+                        // 兑换券
                         this.$message.success('支付成功');
                         setTimeout(() => {
                             this.$router.replace('/collectionorder');
                         }, 1000);
                     }
-                    if (this.payMethods === 'WEIXIN') {
-                        if (this.money) {
-                            // 没有代金券
-                            this.initTime(res.id, res.createdAt);
-                            this.status = res.status;
-                            this.id = res.id;
-                            this.payWatch();
-                        }
-                    } else {
-                        if (this.money) {
-                            // 没有代金券
-                            this.initTime(res.id, res.createdAt);
-                            this.status = res.status;
-                            this.id = res.id;
-                            this.payWatch();
-                        }
+                    if (this.payMethods === 'ALIPAY') {
                         this.$http
                             .get('/payOrder/alipay_qr', {
                                 id: res.id
@@ -437,6 +436,9 @@ export default {
 /deep/ .el-dialog__body {
     padding: 4px 20px 0;
 }
+/deep/ .el-radio__inner {
+    background-color: #fff !important;
+}
 .border {
     height: 1px;
     background: #f2f3f5;