diff --git a/assets/img/fail.png b/assets/img/fail.png new file mode 100644 index 0000000..406cda1 Binary files /dev/null and b/assets/img/fail.png differ diff --git a/pages/coupon/detail/index.js b/pages/coupon/detail/index.js index 9a68a5e..51b6882 100644 --- a/pages/coupon/detail/index.js +++ b/pages/coupon/detail/index.js @@ -82,15 +82,18 @@ Page({ }) .then(res => { console.log("payOrderUpdate then", res); - wx.showToast({ - title: "购买成功", - duration: 2500 - }); + // wx.showToast({ + // title: "购买成功", + // duration: 2500 + // }); }) .catch(err => { console.log("payOrderUpdate catch", err); }); }, + /** + * 发起支付 + */ orderFunc() { var that = this; wx.showLoading({ @@ -105,6 +108,10 @@ Page({ data: {} }) .then(res => { + console.log(res); + /** + * orderSave 下单 + */ return Http.post({ url: config.api.orderSave, data: { @@ -136,6 +143,9 @@ Page({ }); if (res.data.payment > 0) { // 支付金额不为0 + /** + * 支付订单创建 + */ Http.post({ url: config.api.payOrderCreate, data: { @@ -154,49 +164,59 @@ Page({ signType: "MD5", paySign: res.data.paySign, success: res => { + console.log(res); + console.log("姐在检查付款异常"); + that.payOrderUpdate(that.data.orderId, payOrderId, 1); // 支付成功 + console.log(res); - console.log("支付成功"); - wx.showToast({ - title: "购买成功", - duration: 2500 - }); + if(res.errMsg=='requestPayment:ok'){ + wx.showToast({ + title: "购买成功", + duration: 2500 + }); + } + wx.navigateBack({ delta: 2 }); }, + fail: res => { that.payOrderUpdate(that.data.orderId, payOrderId, 2); // 支付失败 console.log(res); - console.log("支付失败"); return; }, complete: res => { console.log(res); console.log("支付完成"); - var url = res.data.url; - console.log("get url", url); + // var url = res.data.url; + // console.log("get url", url); if (res.errMsg == "requestPayment:ok") { wx.showModal({ title: "提示", content: "支付成功" }); - if (url) { - setTimeout(function () { - wx.redirectTo({ - url: "/pages" + url - }); - }, 2000); - } else { - setTimeout(() => { - wx.navigateBack(); - }, 2000); - } - } else { - wx.showModal({ - title: "错误提示", - content: res.errMsg - }); + // if (url) { + // setTimeout(function () { + // wx.redirectTo({ + // url: "/pages" + url + // }); + // }, 2000); + // } else { + // setTimeout(() => { + // wx.navigateBack(); + // }, 2000); + // } + } + + else { + wx.showToast({ + title:'支付失败', + image:'./../../../assets/img/fail.png', + duration: 1500, + mask:false + }) } return; } diff --git a/pages/order/detail/index.js b/pages/order/detail/index.js index 16c7576..ba79212 100644 --- a/pages/order/detail/index.js +++ b/pages/order/detail/index.js @@ -84,14 +84,11 @@ Page({ }); //createDate 创建时间 - //paymentTime 支付时间 var createDate = util.fmtDate(res.data.createDate); - // var paymentTime = util.fmtDate(res.data.paymentTime); console.log(createDate); that.setData({ createDate:createDate, - // paymentTime:util.timechuo(paymentTime), }) }); }, diff --git a/pages/order/detail/index.wxss b/pages/order/detail/index.wxss index 6208d9a..5c70f34 100644 --- a/pages/order/detail/index.wxss +++ b/pages/order/detail/index.wxss @@ -133,13 +133,14 @@ } .classif > view:nth-child(1) { display: block; + border-top:20rpx solid #f8f8f8; } .classif > view:nth-child(1) text:nth-child(2) { padding-left: 15rpx; } .classif > view:nth-child(3), .classif > view:nth-child(4) { - border-top: 20rpx solid #ededed; + border-top: 20rpx solid #f8f8f8; } .classif > view:nth-child(3) view text:nth-child(2) { padding-left: 15rpx; diff --git a/pages/order/index/index.wxss b/pages/order/index/index.wxss index e7c0039..1d8fd52 100644 --- a/pages/order/index/index.wxss +++ b/pages/order/index/index.wxss @@ -88,7 +88,7 @@ padding: 0 4%; display: flex; justify-content: space-between; - border-bottom: 20rpx solid #ededed; + border-bottom: 20rpx solid #f8f8f8; } .payment view:nth-child(1) text:nth-child(1) { diff --git a/pages/rushToBuy/index.wxml b/pages/rushToBuy/index.wxml index 57fc25e..0077ffd 100644 --- a/pages/rushToBuy/index.wxml +++ b/pages/rushToBuy/index.wxml @@ -24,7 +24,6 @@ 剩余件数:{{item.remainInventory}}件 购买 - diff --git a/pages/user/index.wxss b/pages/user/index.wxss index ed27b4a..0f9db78 100644 --- a/pages/user/index.wxss +++ b/pages/user/index.wxss @@ -1,10 +1,10 @@ .margin { - background: #f5f5f5; + background: #f8f8f8; height: 20rpx; } .user { - background: #f5f5f5; + background: #f8f8f8; min-height: 100vh; } diff --git a/utils/util.js b/utils/util.js index 0fe687f..85b263a 100644 --- a/utils/util.js +++ b/utils/util.js @@ -77,6 +77,7 @@ function fmtDate(obj) { ); } +//计算下单的时间与现在的时间的 function timechuo(startTime) { var s1 = new Date(startTime.replace(/-/g, "/")); var s2 = new Date();