Browse Source

支付宝

xiongzhu 3 years ago
parent
commit
9c001300f2
4 changed files with 96 additions and 0 deletions
  1. 23 0
      src/views/Givesubmit.vue
  2. 31 0
      src/views/Submit.vue
  3. 21 0
      src/views/activity/Submit.vue
  4. 21 0
      src/views/auction/Submit.vue

+ 23 - 0
src/views/Givesubmit.vue

@@ -381,6 +381,29 @@ export default {
                         .catch(e => {
                             this.$toast(e.error || '支付失败');
                         });
+                } else if (this.payType === 'ALI') {
+                    // document.location.replace(
+                    //     resolveUrl(this.$baseUrl, 'payOrder/v2/gift/alipay?id=' + res.id)
+                    // );
+                    this.$http
+                        .get('/payOrder/v2/gift/ali', { id: this.orderId })
+                        .then(res => {
+                            this.hrefUrl = res;
+                            this.$nextTick(() => {
+                                document.getElementById('pay').click();
+                            });
+
+                            this.$toast.loading({
+                                message: '加载中...',
+                                forbidClick: true
+                            });
+                            this.getOrder(true);
+                        })
+                        .catch(e => {
+                            if (e.error) {
+                                this.$toast(e.error);
+                            }
+                        });
                 }
             });
         }

+ 31 - 0
src/views/Submit.vue

@@ -461,6 +461,37 @@ export default {
                         this.tradeCode = '';
                         this.$toast(e.error || '支付失败');
                     });
+            } else if (this.payType === 'ALI') {
+                this.$toast.loading({
+                    message: '支付中',
+                    forbidClick: true
+                });
+                (this.payUrlScheme
+                    ? Promise.resolve()
+                    : this.$http.get('/payOrder/v2/ali', { id: this.orderId }).then(res => {
+                          this.payUrlScheme = res;
+                      })
+                )
+                    .then(() => {
+                        this.$nextTick(() => {
+                            document.getElementById('pay').click();
+                        });
+
+                        this.getOrder(true);
+                    })
+                    .catch(e => {
+                        this.$toast.clear();
+                        e = e || {};
+                        e.error = e.error || '支付失败';
+                        this.$dialog
+                            .alert({
+                                title: '提示',
+                                message: this.backReson(e.error)
+                            })
+                            .then(res => {
+                                this.$router.back();
+                            });
+                    });
             }
         },
         goCoupon() {

+ 21 - 0
src/views/activity/Submit.vue

@@ -413,6 +413,27 @@ export default {
                                 this.tradeCode = '';
                                 this.$toast(e.error || '支付失败');
                             });
+                    } else if (this.payType === 'ALI') {
+                        this.$http
+                            .get('/payOrder/v2/mint/ali', { id: this.orderId })
+                            .then(res => {
+                                this.$toast.clear();
+                                this.hrefUrl = res;
+                                this.$nextTick(() => {
+                                    document.getElementById('pay').click();
+                                });
+
+                                this.$toast.loading({
+                                    message: '加载中...',
+                                    forbidClick: true
+                                });
+                                this.getOrder(true);
+                            })
+                            .catch(e => {
+                                if (e.error) {
+                                    this.$toast(e.error);
+                                }
+                            });
                     }
                 });
             } else {

+ 21 - 0
src/views/auction/Submit.vue

@@ -479,6 +479,27 @@ export default {
                                 this.tradeCode = '';
                                 this.$toast(e.error || '支付失败');
                             });
+                    } else if (this.payType === 'ALI') {
+                        this.$http
+                            .get('/payOrder/v2/auction/ali', { id: this.orderId })
+                            .then(res => {
+                                this.$toast.clear();
+                                this.hrefUrl = res;
+                                this.$nextTick(() => {
+                                    document.getElementById('pay').click();
+                                });
+
+                                this.$toast.loading({
+                                    message: '加载中...',
+                                    forbidClick: true
+                                });
+                                this.getOrder(true);
+                            })
+                            .catch(e => {
+                                if (e.error) {
+                                    this.$toast(e.error);
+                                }
+                            });
                     }
                 });
             } else {