Browse Source

[支付][修改]:支付的失败的消息返回

tags/2.2.4
meo 6 years ago
parent
commit
dcd1974c57
8 changed files with 54 additions and 36 deletions
  1. BIN
      assets/img/fail.png
  2. +48
    -28
      pages/coupon/detail/index.js
  3. +0
    -3
      pages/order/detail/index.js
  4. +2
    -1
      pages/order/detail/index.wxss
  5. +1
    -1
      pages/order/index/index.wxss
  6. +0
    -1
      pages/rushToBuy/index.wxml
  7. +2
    -2
      pages/user/index.wxss
  8. +1
    -0
      utils/util.js

BIN
assets/img/fail.png View File

Before After
Width: 200  |  Height: 200  |  Size: 6.7 KiB

+ 48
- 28
pages/coupon/detail/index.js View File

@@ -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;
}


+ 0
- 3
pages/order/detail/index.js View File

@@ -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),
})
});
},


+ 2
- 1
pages/order/detail/index.wxss View File

@@ -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;


+ 1
- 1
pages/order/index/index.wxss View File

@@ -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) {


+ 0
- 1
pages/rushToBuy/index.wxml View File

@@ -24,7 +24,6 @@
<view class="view1"><text class="remainingNumber">剩余件数:</text><text class='realnumber'>{{item.remainInventory}}件</text></view>
<view class='buy'>购买</view>
</view>

</view>
</view>
</view>


+ 2
- 2
pages/user/index.wxss View File

@@ -1,10 +1,10 @@
.margin {
background: #f5f5f5;
background: #f8f8f8;
height: 20rpx;
}

.user {
background: #f5f5f5;
background: #f8f8f8;
min-height: 100vh;
}



+ 1
- 0
utils/util.js View File

@@ -77,6 +77,7 @@ function fmtDate(obj) {
);
}

//计算下单的时间与现在的时间的
function timechuo(startTime) {
var s1 = new Date(startTime.replace(/-/g, "/"));
var s2 = new Date();


Loading…
Cancel
Save