yuanyuan 3 роки тому
батько
коміт
18530ee73c

+ 26 - 10
src/components/order/DomainInfo.vue

@@ -43,11 +43,23 @@ export default {
             default: () => {
                 return {};
             }
+        },
+        domainName: {
+            type: String,
+            default: () => {
+                return "";
+            }
+        },
+        id: {
+            type: String,
+            default: () => {
+                return "";
+            }
         }
     },
     data() {
         return {
-            orderStatus: 'NOT_PAID'
+            orderStatus: 'NOT_PAID',
         };
     },
     // setup() {
@@ -60,15 +72,19 @@ export default {
     mixins: [order, product],
     methods: {
         pay(orderStatus) {
-            // let domainName = info.domainName
-            // if (orderStatus == this.orderStatus) {
-            //     this.$router.push({
-            //         path: '/domainSubmit',
-            //         query: {
-            //             domain: domainName
-            //         }
-            //     });
-            // }
+            let domainName = this.domainName
+            let pay = "1"
+            let id = this.id
+            if (orderStatus == this.orderStatus) {
+                this.$router.push({
+                    path: '/domainSubmit',
+                    query: {
+                        domain: domainName,
+                        pay: pay,
+                        id: id
+                    }
+                });
+            }
         },
         delInit() {
             this.$emit('delFn');

+ 60 - 32
src/views/DomainSubmit.vue

@@ -76,12 +76,14 @@ export default {
             tradeCode: '',
             domain: '',
             price: 40,
+            payName: "",
+            id: '',
             payInfos: [
                 {
                     icon: require('@assets/icon-balance@3x.png'),
                     name: '余额',
                     type: 'BALANCE'
-                },
+                }
                 // {
                 //     icon: require('@assets/bianzu@3x.png'),
                 //     name: '支付宝',
@@ -106,40 +108,66 @@ export default {
     },
     mounted() {
         this.domain = this.$route.query.domain;
+        this.payName = this.$route.query.pay;
+        this.id = this.$route.query.id;
     },
     methods: {
         pay() {
-            this.$http
-                .post('/domainOrder/create', {
-                    userId: this.userInfo.id,
-                    domain: this.domain,
-                    price: this.price
-                })
-                .then(res => {
-                    if (this.tradeCode == "") {
-                        this.showPwdDialog = true;
-                        this.$toast('请输入交易密码');
-                        return;
-                    }
-                    this.$http
-                        .post('/payOrder/v2/domain/balance', {
-                            id: res.id,
-                            tradeCode: this.tradeCode
-                        })
-                        .then(res => {
-                            this.$toast.success('支付成功');
-                            setTimeout(() => {
-                                this.$router.replace('/home');
-                            }, 1000);
-                        })
-                        .catch(e => {
-                            this.tradeCode = '';
-                            this.$toast(e.error || '支付失败');
-                        });
-                })
-                .catch(e => {
-                    this.$toast(e.error);
-                });
+            console.log("thsksk",this.payName)
+            if (this.payName == '1') {
+                if (this.tradeCode == '') {
+                    this.showPwdDialog = true;
+                    this.$toast('请输入交易密码');
+                    return;
+                }
+                this.$http
+                    .post('/payOrder/v2/domain/balance', {
+                        id: this.id,
+                        tradeCode: this.tradeCode
+                    })
+                    .then(res => {
+                        this.$toast.success('支付成功');
+                        setTimeout(() => {
+                            this.$router.replace('/home');
+                        }, 1000);
+                    })
+                    .catch(e => {
+                        this.tradeCode = '';
+                        this.$toast(e.error || '支付失败');
+                    });
+            } else {
+                this.$http
+                    .post('/domainOrder/create', {
+                        userId: this.userInfo.id,
+                        domain: this.domain,
+                        price: this.price
+                    })
+                    .then(res => {
+                        if (this.tradeCode == '') {
+                            this.showPwdDialog = true;
+                            this.$toast('请输入交易密码');
+                            return;
+                        }
+                        this.$http
+                            .post('/payOrder/v2/domain/balance', {
+                                id: res.id,
+                                tradeCode: this.tradeCode
+                            })
+                            .then(res => {
+                                this.$toast.success('支付成功');
+                                setTimeout(() => {
+                                    this.$router.replace('/home');
+                                }, 1000);
+                            })
+                            .catch(e => {
+                                this.tradeCode = '';
+                                this.$toast(e.error || '支付失败');
+                            });
+                    })
+                    .catch(e => {
+                        this.$toast(e.error);
+                    });
+            }
         }
     }
 };

+ 1 - 1
src/views/order/Orders.vue

@@ -97,7 +97,7 @@
             @load="getData"
             v-if="type == 'METANAME'"
         >
-            <domain-info @delFn="delFn" v-for="item in list" :key="item.id" :info="item"></domain-info>
+            <domain-info @delFn="delFn" v-for="item in list" :key="item.id" :info="item" :domainName="item.domainName" :id="item.id"></domain-info>
             <van-empty v-if="list.length == 0" description="你还没有订单哦~" :image="require('@assets/kong_png_wudingdan.png')" />
         </van-list>
     </van-pull-refresh>