panhui 4 سال پیش
والد
کامیت
da4ebfa095
2فایلهای تغییر یافته به همراه47 افزوده شده و 38 حذف شده
  1. 1 1
      src/main/nine-space/.env.development
  2. 46 37
      src/main/nine-space/src/views/Submit.vue

+ 1 - 1
src/main/nine-space/.env.development

@@ -1 +1 @@
-VUE_APP_BASE_URL=http://192.168.50.120:8080
+VUE_APP_BASE_URL=https://nfttest.9space.vip/

+ 46 - 37
src/main/nine-space/src/views/Submit.vue

@@ -212,14 +212,12 @@ export default {
                         this.$nextTick(() => {
                             if (this.payType === 'ALIPAY') {
                                 if (this.inWeixin) {
-                                    document.location.href = path.resolve(
-                                        this.$baseUrl,
-                                        '/payOrder/alipay_wx?id=' + res.id
-                                    );
+                                    window.open(path.resolve(this.$baseUrl, '/payOrder/alipay_wx?id=' + res.id));
                                 } else {
                                     this.$http
                                         .get(`/payOrder/${this.inApp ? 'alipay_app' : 'alipay_h5'}?id=${res.id}`)
                                         .then(res => {
+                                            this.$toast.clear();
                                             this.hrefUrl = 'alipays://platformapi/startapp?saId=10000007&qrcode=' + res;
                                             // window.open(
                                             //     'alipays://platformapi/startapp?saId=10000007&qrcode=' + res,
@@ -231,43 +229,54 @@ export default {
                                             if (!this.inApp) {
                                                 this.getOrder(true);
                                             }
+                                        })
+                                        .catch(e => {
+                                            if (e.error) {
+                                                this.$toast(e.error);
+                                            }
                                         });
                                 }
                             } else if (this.payType === 'WEIXIN') {
-                                if (this.inWeixin) {
-                                    this.$toast.loading('加载中');
-                                    this.$http
-                                        .post('/payOrder/weixin', {
-                                            id: res.id,
-                                            openId: localStorage.getItem('openId')
-                                        })
-                                        .then(res => {
-                                            console.log({
-                                                ...res,
-                                                package: res.package || res.packageValue
-                                            });
-                                            let _this = this;
-                                            wx.chooseWXPay({
-                                                ...res,
-                                                package: res.package || res.packageValue,
-                                                timestamp: res.timeStamp,
-                                                success(res) {
-                                                    _this.$toast.success('支付成功');
-                                                    setTimeout(() => {
-                                                        _this.$router.replace('/orders');
-                                                    }, 1000);
-                                                },
-                                                fail(e) {
-                                                    console.log(e);
-                                                    _this.$toast('支付失败,请稍后再试');
-                                                }
-                                            });
+                                this.$toast.loading('加载中');
+                                this.$http
+                                    .post('/payOrder/weixin', {
+                                        id: res.id
+                                    })
+                                    .then(res => {
+                                        this.$toast.clear();
+                                        this.hrefUrl = res.scheme_code;
+                                        this.$nextTick(() => {
+                                            document.getElementById('pay').click();
                                         });
-                                } else {
-                                    document.location.replace(
-                                        path.resolve(this.$baseUrl, 'payOrder/weixin_h5?id=' + res.id)
-                                    );
-                                }
+                                        if (this.inWeixin) {
+                                            this.getOrder(true);
+                                        }
+                                        // console.log({
+                                        //     ...res,
+                                        //     package: res.package || res.packageValue
+                                        // });
+                                        // let _this = this;
+                                        // wx.chooseWXPay({
+                                        //     ...res,
+                                        //     package: res.package || res.packageValue,
+                                        //     timestamp: res.timeStamp,
+                                        //     success(res) {
+                                        //         _this.$toast.success('支付成功');
+                                        //         setTimeout(() => {
+                                        //             _this.$router.replace('/orders');
+                                        //         }, 1000);
+                                        //     },
+                                        //     fail(e) {
+                                        //         console.log(e);
+                                        //         _this.$toast('支付失败,请稍后再试');
+                                        //     }
+                                        // });
+                                    })
+                                    .catch(e => {
+                                        if (e.error) {
+                                            this.$toast(e.error);
+                                        }
+                                    });
                             }
                         });
                     } else {