|
|
@@ -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 {
|