本地没有支付时,提供一个提交订单直接支付的模拟支付方法

补上一个图标
优化加入购物车连续点,提交订单多次点的问题
This commit is contained in:
shengliang 2020-04-26 14:57:44 +08:00
parent 6503e3c1cd
commit 7c853f90f4
6 changed files with 21 additions and 2 deletions

BIN
images/icon/success-w.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

View File

@ -136,6 +136,10 @@ Page({
},
updateCart: function(itemIndex, productId, number, id) {
let that = this;
wx.showLoading({
title: '',
mask:true
})
util.request(api.CartUpdate, {
productId: productId,
number: number,
@ -155,6 +159,8 @@ Page({
that.setData({
checkedAllStatus: that.isCheckedAll()
});
wx.hideLoading({
})
});
},

View File

@ -157,6 +157,10 @@ Page({
let postscript = this.data.postscript;
let freightPrice = this.data.freightPrice;
let actualPrice = this.data.actualPrice;
wx.showLoading({
title: '',
mask:true
})
util.request(api.OrderSubmit, {
addressId: addressId,
postscript: postscript,
@ -181,6 +185,7 @@ Page({
} else {
util.showErrorToast(res.errmsg);
}
wx.hideLoading()
});
},
offlineOrder: function (e) {

View File

@ -28,7 +28,7 @@
<view class="a-goods">
<view class="img-box">
<view class='image-wrap' wx:for="{{checkedGoodsList}}" wx:if="{{index<5}}" wx:key="id">
<image src="{{item.list_pic_url}}" class="goods-image"></image>
<image wx:if="{{item.number > 0 && item.is_on_sale == 1}}" src="{{item.list_pic_url}}" class="goods-image"></image>
</view>
</view>
<view class='goods-sum'>

View File

@ -320,6 +320,7 @@ page {
width: 338rpx;
height: 338rpx;
border-radius: 4rpx;
background-color: #f9f9f9;
}
.goods-box .navi-url .box {

View File

@ -10,7 +10,8 @@ function payOrder(orderId) {
}).then((res) => {
if (res.errno === 0) {
const payParam = res.data;
console.log(res.data);
// 如果没有支付想直接支付成功,下面注释。
// -----------------------------------
wx.requestPayment({
'timeStamp': payParam.timeStamp,
'nonceStr': payParam.nonceStr,
@ -36,6 +37,12 @@ function payOrder(orderId) {
reject(res);
}
});
// -----------------------------------
// =================================
// 直接支付成功,下面打开,上面注释
// resolve(res);
// =================================
} else {
reject(res);
}