From 3f513f121a7a61502d0d3a15f5f6176fdbda4995 Mon Sep 17 00:00:00 2001 From: pplokijuhyg <1162963624@qq.com> Date: Sat, 28 Dec 2019 14:27:57 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/order/tab/index.js | 1 + components/order/tab/index.wxml | 2 +- pages/order/order.js | 6 ++++-- pages/order/order.wxml | 2 +- pages/orderconfirm/orderconfirm.js | 24 ++++++++++++++++-------- 5 files changed, 23 insertions(+), 12 deletions(-) diff --git a/components/order/tab/index.js b/components/order/tab/index.js index 0b5f890..1875cde 100644 --- a/components/order/tab/index.js +++ b/components/order/tab/index.js @@ -1,6 +1,7 @@ import bin from "../../../utils/bin" Component({ properties: { + index:Number }, data: { }, diff --git a/components/order/tab/index.wxml b/components/order/tab/index.wxml index 6a893ba..5063df2 100644 --- a/components/order/tab/index.wxml +++ b/components/order/tab/index.wxml @@ -1,4 +1,4 @@ - + diff --git a/pages/order/order.js b/pages/order/order.js index 33cc5c7..ea7739b 100644 --- a/pages/order/order.js +++ b/pages/order/order.js @@ -5,14 +5,16 @@ Page({ * 页面的初始数据 */ data: { - + index:0 }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + this.setData({ + index: options.index == undefined ? 0:options.index + }) }, /** diff --git a/pages/order/order.wxml b/pages/order/order.wxml index e96e475..f6d75d0 100644 --- a/pages/order/order.wxml +++ b/pages/order/order.wxml @@ -1,3 +1,3 @@ - + \ No newline at end of file diff --git a/pages/orderconfirm/orderconfirm.js b/pages/orderconfirm/orderconfirm.js index 7317034..1349fcf 100644 --- a/pages/orderconfirm/orderconfirm.js +++ b/pages/orderconfirm/orderconfirm.js @@ -77,13 +77,13 @@ Page({ }, sub() { - if(this.data.list.addressList == null){ + if (this.data.list.addressList == null) { wx.showToast({ - title:"请先添加地址", - icon:"none" + title: "请先添加地址", + icon: "none" }) console.log(123) - return ; + return; } bin.getuserid().then((res) => { bin.request({ @@ -104,12 +104,20 @@ Page({ console.log(r) let { timeStamp, nonceStr, signType, sign } = r.data.data.wdata // timeStamp = timeStamp - timeStamp = timeStamp.toString() + timeStamp = timeStamp.toString() console.log(timeStamp) wx.requestPayment({ - timeStamp, nonceStr, package:r.data.data.wdata.package, signType, paySign:sign, - success(res) {console.log("成功")}, - fail(res) {console.log(res)} + timeStamp, nonceStr, package: r.data.data.wdata.package, signType, paySign: sign, + success(res) { + console.log("成功") + wx.redirectTo({ + url: "/pages/order/order?index=1" + }) + }, + fail(res) { console.log(res) + wx.redirectTo({ + url: "/pages/order/order?index=0" + })} }) }) })