panhui 4 лет назад
Родитель
Сommit
19ccf5eb8d
1 измененных файлов с 28 добавлено и 16 удалено
  1. 28 16
      src/views/Givesubmit.vue

+ 28 - 16
src/views/Givesubmit.vue

@@ -219,14 +219,14 @@ 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;
-                            if (Number(this.gas)) {
+                    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(
@@ -304,18 +304,30 @@ export default {
                                         }
                                     }
                                 });
-                            } else {
+                            })
+                            .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) {
+                                    this.$toast(e.error);
+                                }
+                            });
+                    }
                 })
                 .catch(e => {
                     if (e) {