Просмотр исходного кода

Merge branch 'dev' of xiongzhu/raex_front into master

panhui 4 лет назад
Родитель
Сommit
eda4c13641
3 измененных файлов с 111 добавлено и 83 удалено
  1. 104 83
      src/views/Givesubmit.vue
  2. 4 0
      src/views/Store.vue
  3. 3 0
      src/views/asset/Detail.vue

+ 104 - 83
src/views/Givesubmit.vue

@@ -140,7 +140,7 @@ export default {
         }
 
         Promise.all([
-            this.$http.get('/sysConfig/get/gas_fee').then(res => {
+            this.$http.get('/sysConfig/get/gift_gas_fee').then(res => {
                 this.gas = res.value;
                 return Promise.resolve();
             }),
@@ -219,94 +219,115 @@ export default {
                     tradeCode: this.password
                 })
                 .then(() => {
-                    this.$http
-                        .post('/asset/gift', {
-                            assetId: this.$route.query.id,
-                            toUserId: this.$route.query.toUserId
-                        })
-                        .then(res => {
-                            this.orderId = res.id;
-                            this.$nextTick(() => {
-                                if (this.payType === 'ALIPAY') {
-                                    // document.location.replace(
-                                    //     resolveUrl(this.$baseUrl, 'payOrder/gift/alipay?id=' + res.id)
-                                    // );
-                                    if (this.inWeixin) {
-                                        document.location.replace(
-                                            resolveUrl(this.$baseUrl, '/payOrder/gift/alipay_wx?id=' + res.id)
-                                        );
-                                    } else {
-                                        this.$http
-                                            .get(
-                                                `/payOrder/gift/${this.inApp ? 'alipay_app' : 'alipay_h5'}?id=${res.id}`
-                                            )
-                                            .then(res => {
-                                                this.hrefUrl =
-                                                    'alipays://platformapi/startapp?saId=10000007&qrcode=' + res;
-                                                // window.open(
-                                                //     'alipays://platformapi/startapp?saId=10000007&qrcode=' + res,
-                                                //     '_blank'
-                                                // );
-                                                this.$nextTick(() => {
-                                                    document.getElementById('pay').click();
-                                                });
+                    if (Number(this.gas)) {
+                        this.$http
+                            .post('/asset/gift', {
+                                assetId: this.$route.query.id,
+                                toUserId: this.$route.query.toUserId
+                            })
+                            .then(res => {
+                                this.orderId = res.id;
+                                this.$nextTick(() => {
+                                    if (this.payType === 'ALIPAY') {
+                                        // document.location.replace(
+                                        //     resolveUrl(this.$baseUrl, 'payOrder/gift/alipay?id=' + res.id)
+                                        // );
+                                        if (this.inWeixin) {
+                                            document.location.replace(
+                                                resolveUrl(this.$baseUrl, '/payOrder/gift/alipay_wx?id=' + res.id)
+                                            );
+                                        } else {
+                                            this.$http
+                                                .get(
+                                                    `/payOrder/gift/${this.inApp ? 'alipay_app' : 'alipay_h5'}?id=${
+                                                        res.id
+                                                    }`
+                                                )
+                                                .then(res => {
+                                                    this.hrefUrl =
+                                                        'alipays://platformapi/startapp?saId=10000007&qrcode=' + res;
+                                                    // window.open(
+                                                    //     'alipays://platformapi/startapp?saId=10000007&qrcode=' + res,
+                                                    //     '_blank'
+                                                    // );
+                                                    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 if (this.payType === 'WEIXIN') {
-                                    if (this.inWeixin) {
-                                        this.$toast.loading('加载中');
-                                        this.$http
-                                            .post('/payOrder/gift/weixin', {
-                                                id: res.id,
-                                                openId: localStorage.getItem('openId')
-                                            })
-                                            .then(res => {
-                                                console.log({
-                                                    ...res,
-                                                    package: res.package || res.packageValue,
-                                                    timestamp: res.timestamp || res.timeStamp
-                                                });
-                                                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({
+                                                        message: '加载中...',
+                                                        forbidClick: true
+                                                    });
+                                                    this.getOrder(true);
+                                                })
+                                                .catch(e => {
+                                                    if (e.error) {
+                                                        this.$toast(e.error);
                                                     }
                                                 });
-                                            });
-                                    } else {
-                                        document.location.replace(
-                                            resolveUrl(this.$baseUrl, 'payOrder/gift/weixin_h5?id=' + res.id)
-                                        );
+                                        }
+                                    } else if (this.payType === 'WEIXIN') {
+                                        if (this.inWeixin) {
+                                            this.$toast.loading('加载中');
+                                            this.$http
+                                                .post('/payOrder/gift/weixin', {
+                                                    id: res.id,
+                                                    openId: localStorage.getItem('openId')
+                                                })
+                                                .then(res => {
+                                                    console.log({
+                                                        ...res,
+                                                        package: res.package || res.packageValue,
+                                                        timestamp: res.timestamp || res.timeStamp
+                                                    });
+                                                    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('支付失败,请稍后再试');
+                                                        }
+                                                    });
+                                                });
+                                        } else {
+                                            document.location.replace(
+                                                resolveUrl(this.$baseUrl, 'payOrder/gift/weixin_h5?id=' + res.id)
+                                            );
+                                        }
                                     }
+                                });
+                            })
+                            .catch(e => {
+                                if (e) {
+                                    this.$toast(e.error);
                                 }
                             });
-                        })
-                        .catch(e => {
-                            if (e) {
-                                this.$toast(e.error);
-                            }
-                        });
+                    } else {
+                        this.$http
+                            .post('/asset/giftWithoutGasFee', {
+                                assetId: this.$route.query.id,
+                                toUserId: this.$route.query.toUserId
+                            })
+                            .then(res => {
+                                this.$toast.success('转赠成功');
+                                setTimeout(() => {
+                                    this.$router.go(-2);
+                                }, 1500);
+                            })
+                            .catch(e => {
+                                if (e) {
+                                    this.$toast(e.error);
+                                }
+                            });
+                    }
                 })
                 .catch(e => {
                     if (e) {

+ 4 - 0
src/views/Store.vue

@@ -278,6 +278,10 @@ export default {
             this.list = list;
             this.$toast.clear();
         });
+        this.emitter.on('refreash', () => {
+            this.page = 0;
+            this.getList();
+        });
         if (this.isLogin) {
             this.$http
                 .post(

+ 3 - 0
src/views/asset/Detail.vue

@@ -589,6 +589,9 @@ export default {
                 forbidClick: true
             });
             this.$http.get('/asset/get/' + this.$route.query.id).then(res => {
+                if (res.status == 'GIFTED' || res.status === 'TRANSFERRED') {
+                    this.emitter.emit('refreash');
+                }
                 this.info = res;
 
                 if (res.orderId) {