From 0597bdbcb0c81f5f0aa3583ce825e6509b7c0095 Mon Sep 17 00:00:00 2001 From: "jqtmviyu@gmail.com" Date: Sat, 6 Mar 2021 23:52:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E4=BB=98=E6=88=90=E5=8A=9F=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E8=AE=A2=E5=8D=95=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages.json | 14 +++++++++++++- src/pages/order/order.vue | 15 +++++++++++++++ src/pages/pay/pay.vue | 24 +++++++++++++++++++----- 3 files changed, 47 insertions(+), 6 deletions(-) create mode 100644 src/pages/order/order.vue diff --git a/src/pages.json b/src/pages.json index d85a3d3..005faea 100644 --- a/src/pages.json +++ b/src/pages.json @@ -45,6 +45,12 @@ "style": { "navigationBarTitleText": "结算" } + }, + { + "path": "pages/order/order", + "style": { + "navigationBarTitleText": "订单" + } } ], "globalStyle": { @@ -110,7 +116,13 @@ "name": "个人页面", "path": "pages/my/my", "query": "" - } + }, + { + "name": "订单页", + "path": "pages/order/order", + "query": "" + } + ] } } diff --git a/src/pages/order/order.vue b/src/pages/order/order.vue new file mode 100644 index 0000000..69dcf7d --- /dev/null +++ b/src/pages/order/order.vue @@ -0,0 +1,15 @@ + + + + + \ No newline at end of file diff --git a/src/pages/pay/pay.vue b/src/pages/pay/pay.vue index fbbe6e1..13e7823 100644 --- a/src/pages/pay/pay.vue +++ b/src/pages/pay/pay.vue @@ -80,7 +80,7 @@ export default { // 去付款 async payHandle(){ if (!this.address.userName) { - return uni.showToast({ title: "请选择收货地址", icon: "none" }); + return uni.showToast({ title: "请选择收货地址", icon: "none" }); } else { // console.log("走支付逻辑"); // 创建订单 @@ -103,11 +103,25 @@ export default { const {message: {pay}} = await this.$u.api.orderPayParams({order_number}) console.log(pay); // 调用支付接口 - const res1 = await wx.requestPayment(pay) - console.log(res1) + // const res1 = await wx.requestPayment(pay) + // console.log(res1) // 更新支付状态 - const res2 = await this.$u.api.checkOrder(order_number) - console.log(res2); + // const {message} = await this.$u.api.checkOrder(order_number) + // console.log(message); + // 支付成功 + await uni.showToast({ + title: "支付成功", + icon: "none" + }) + setTimeout(() => { + // 保留未支付的商品 + const cartList = this.cartList.filter(item=>!item.goods_select) + uni.setStorageSync("cartList", cartList) + // 替换到订单页 + uni.redirectTo({ + url: "/pages/order/order" + }) + }, 1500); } }, },