From 76fd8e4615e03e68b15a214a399c22ef152454df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=93=E5=B9=B3=E8=89=BA?= <52643018@qq.com> Date: Fri, 25 Jun 2021 16:33:04 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E7=A1=AE=E8=AE=A4=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/login/index.vue | 27 +++++++++++------- pages/order/confirm-order.vue | 53 ++++++++++++++++++++++++++--------- pages/order/index.vue | 2 +- 3 files changed, 58 insertions(+), 24 deletions(-) diff --git a/pages/login/index.vue b/pages/login/index.vue index 7a143fa..2649f3d 100644 --- a/pages/login/index.vue +++ b/pages/login/index.vue @@ -23,17 +23,17 @@ - + - - 请认真阅读并同意 - 《时空网协议》 - ,在小程序下单购买即表示您已默认同意 - 《时空网协议》 - 的所有条款。 - + + 请认真阅读并同意 + 《{{ agreement.title }}》 + ,在小程序下单购买即表示您已默认同意 + 《{{ agreement.title }}》 + 的所有条款。 + @@ -46,19 +46,26 @@ isLogin: false, // 是否已登录 userInfo: {}, type: 'userinfo', // 页面授权类型 phone获取手机号 | userinfo获取用户信息 + agreement: {} // 协议 } }, onLoad(options){ this.type = options.type || this.type; + this.getAgree(); getApp().globalData.wxlogin().then(res => { this.userInfo = res; }); }, methods: { + // 获取协议 + getAgree(){ + this.$http(this.API.API_WXLOGIN_VIEW).then(res => { + this.agreement = res.data.agreement; + }) + }, // 进入查看协议 enterAgree(){ - console.log("查看协议"); - this.$url('/pages/agreement/agreement'); + this.$url('/pages/agreement/agreement?id='+ this.agreement.article_id); }, // 勾选协议发生变化 checkboxChange(event){ diff --git a/pages/order/confirm-order.vue b/pages/order/confirm-order.vue index 73c2c66..befb1cc 100644 --- a/pages/order/confirm-order.vue +++ b/pages/order/confirm-order.vue @@ -94,7 +94,9 @@ goods_specs_id: 1, orderDetails: {}, ifchoose: true, - ifCheck: true + ifCheck: true, + type: 0, + order_id: 0 } }, computed: { @@ -108,7 +110,9 @@ } }, onLoad(e) { - this.goods_id = e.goods_id + this.type = e.type; + this.goods_id = e.goods_id; + this.order_id = e.order_id; this.goods_specs_id = e.goods_specs_id }, methods: { @@ -117,16 +121,16 @@ if(res.code == 0) { this.orderDetails = res.data this.skeletonLoading = false - if( Object.keys(res.metal_data).length != 0 ) { - this.ifCheck = false - }else { - this.ifCheck = true - } + this.ifCheck = false }else { this.$msg(res.msg) } }).catch(err => { - // this.mescroll.endErr(); + if(res.code == 9999) { + this.ifCheck = true + }else { + this.ifCheck = false + } }); }, reduce() { @@ -151,7 +155,7 @@ }, submit(){ if(this.ifchoose == true) { - if(this.ifCheck == false) { + if(this.ifCheck == true) { uni.showModal({ title: '提示', content: '是否同意前往手机授权?', @@ -161,11 +165,14 @@ } }); }else { + if(this.type == 1){ + this.pay(); + return; + } this.$http(this.API.API_PRPAID, { goods_id: this.goods_id, goods_specs_id: this.goods_specs_id, number: this.num, - token: 'fdf12000e774e48bc60c6b6d42055602' }).then(res => { console.log(res) uni.requestPayment({ @@ -175,10 +182,10 @@ package: res.data.package, signType: res.data.signType, paySign: res.data.paySign, - success: function (res) { + success: (res) => { this.$routerGo('/pages/order/pay-success?ifSuccess='+1) }, - fail: function (err) { + fail: (err) => { this.$routerGo('/pages/order/pay-success?ifSuccess='+2) } }) @@ -191,12 +198,32 @@ return } }, + pay(){ + console.log("this.order_id", this.order_id) + this.$http(this.API.API_PAYMENT_DIRECT, {order_id: this.order_id}).then(res => { + console.log("res") + uni.requestPayment({ + orderInfo: res.data.order_num, + timeStamp: res.data.timeStamp, + nonceStr: res.data.nonceStr, + package: res.data.package, + signType: res.data.signType, + paySign: res.data.paySign, + success: (res) => { + this.$routerGo('/pages/order/pay-success?ifSuccess='+1) + }, + fail: (err) => { + this.$routerGo('/pages/order/pay-success?ifSuccess='+2) + } + }) + }) + }, //下拉刷新 downCallback() { this.getConfirmOrder() }, }, - created() { + onShow() { this.getConfirmOrder() } } diff --git a/pages/order/index.vue b/pages/order/index.vue index a5c8dd1..7647b34 100644 --- a/pages/order/index.vue +++ b/pages/order/index.vue @@ -23,7 +23,7 @@ {{item.selling_price}} - +