Commit 0896af59 authored by Junling Bu's avatar Junling Bu
Browse files

fix[litemall-wx, litemall-wx-api]: 调整订单操作。

1. 添加订单则商品货品数量减少
2. 取消订单和退款取消则商品货品数量增加
3. 小程序下单时点击确定模拟支付成功,点击取消模拟支付失败。
parent 5e670ae1
......@@ -28,7 +28,7 @@ public class OrderUtil {
public static final Short STATUS_PAY = 201;
public static final Short STATUS_SHIP= 301;
public static final Short STATUS_CONFIRM = 401;
public static final Short STATUS_CANCEL= 201;
public static final Short STATUS_CANCEL= 102;
public static final Short STATUS_REFUND = 202;
public static final Short STATUS_AUTO_CONFIRM= 402;
......
......@@ -12,7 +12,7 @@ Page({
// 页面初始化 options为页面跳转所带来的参数
this.setData({
orderId: options.orderId,
status: options.status
status: options.status === '1' ? true : false
})
},
onReady: function () {
......
......@@ -109,27 +109,43 @@ Page({
// 目前不能支持微信支付,这里仅仅是模拟支付成功,同理,后台也仅仅是返回一个成功的消息而已
wx.showModal({
title: '目前不能微信支付',
content: '点击确定模拟支付成功',
showCancel: false,
success: function(res) {
wx.redirectTo({
url: '/pages/payResult/payResult?status=true&orderId=' + orderId
});
content: '点击确定模拟支付成功,点击取消模拟未支付成功',
success: function(res) {
if (res.confirm) {
util.request(api.OrderPay, { orderId: orderId }, 'POST').then(res => {
if (res.errno === 0) {
wx.redirectTo({
url: '/pages/payResult/payResult?status=1&orderId=' + orderId
});
}
else{
wx.redirectTo({
url: '/pages/payResult/payResult?status=0&orderId=' + orderId
});
}
});
}
else if (res.cancel) {
wx.redirectTo({
url: '/pages/payResult/payResult?status=0&orderId=' + orderId
});
}
}
});
// pay.payOrder(orderId).then(res => {
// wx.redirectTo({
// url: '/pages/payResult/payResult?status=true&orderId=' + orderId
// url: '/pages/payResult/payResult?status=1&orderId=' + orderId
// });
// }).catch(res => {
// wx.redirectTo({
// url: '/pages/payResult/payResult?status=false&orderId=' + orderId
// url: '/pages/payResult/payResult?status=0&orderId=' + orderId
// });
// });
// } else {
// wx.redirectTo({
// url: '/pages/payResult/payResult?status=false&orderId=' + orderId
// url: '/pages/payResult/payResult?status=0&orderId=' + orderId
// });
}
});
......
......@@ -35,7 +35,7 @@ Page({
let that = this;
util.request(api.PayPrepayId, {
orderId: that.data.orderId
}).then(function (res) {
}, 'POST').then(function (res) {
if (res.errno === 0) {
const payParam = res.data;
wx.requestPayment({
......@@ -67,7 +67,7 @@ Page({
if (res.confirm) {
util.request(api.OrderCancel, {
orderId: orderInfo.id
}).then(function (res) {
}, 'POST').then(function (res) {
if (res.errno === 0) {
wx.showToast({
title: '取消订单成功'
......@@ -94,7 +94,7 @@ Page({
if (res.confirm) {
util.request(api.OrderRefund, {
orderId: orderInfo.id
}).then(function (res) {
}, 'POST').then(function (res) {
if (res.errno === 0) {
wx.showToast({
title: '取消订单成功'
......@@ -109,7 +109,7 @@ Page({
}
});
},
// “取消订单并退款”点击效果
// “删除”点击效果
deleteOrder: function () {
let that = this;
let orderInfo = that.data.orderInfo;
......@@ -121,7 +121,7 @@ Page({
if (res.confirm) {
util.request(api.OrderDelete, {
orderId: orderInfo.id
}).then(function (res) {
}, 'POST').then(function (res) {
if (res.errno === 0) {
wx.showToast({
title: '删除订单成功'
......@@ -148,7 +148,7 @@ Page({
if (res.confirm) {
util.request(api.OrderConfirm, {
orderId: orderInfo.id
}).then(function (res) {
}, 'POST').then(function (res) {
if (res.errno === 0) {
wx.showToast({
title: '确认收货成功!'
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment