|
@@ -17,7 +17,7 @@ Page({
|
|
|
orderSn: '',
|
|
|
hidden: true,
|
|
|
reason: '',
|
|
|
- inputValue: null,
|
|
|
+ inputValue: '',
|
|
|
},
|
|
|
|
|
|
/**
|
|
@@ -93,7 +93,7 @@ Page({
|
|
|
icon: 'none',
|
|
|
duration: 1500
|
|
|
});
|
|
|
- this.onLoad(this.options);
|
|
|
+ this.changeOrder(this.data.orderSn,4,'已取消');
|
|
|
}
|
|
|
this.data.lock = false
|
|
|
}).catch(_ => {
|
|
@@ -113,9 +113,8 @@ Page({
|
|
|
* 获取订单参数
|
|
|
*/
|
|
|
async goPay() {
|
|
|
- console.log(wx.getStorageSync('loginInfo').openId)
|
|
|
- let result = await WelfareMall.getOrderParams(this.data.orderSn,wx.getStorageSync('loginInfo').openId);
|
|
|
- console.log(res);
|
|
|
+ var that = this;
|
|
|
+ let result = await WelfareMall.getOrderParams(that.data.orderSn,wx.getStorageSync('loginInfo').openId);
|
|
|
let res = result.data
|
|
|
wx.requestPayment({
|
|
|
timeStamp: res.wxPrePayVo.timeStamp,
|
|
@@ -126,7 +125,7 @@ Page({
|
|
|
success: function (res) {
|
|
|
//支付成功
|
|
|
console.log(res);
|
|
|
- this.onLoad(this.options);
|
|
|
+ that.changeOrder(that.data.orderSn,2,'已支付');
|
|
|
},
|
|
|
fail: function (res) {
|
|
|
console.log(res);
|
|
@@ -142,6 +141,7 @@ Page({
|
|
|
this.setData({
|
|
|
hidden: false,
|
|
|
inputValue: '',
|
|
|
+ reason: '',
|
|
|
});
|
|
|
},
|
|
|
|
|
@@ -150,7 +150,9 @@ Page({
|
|
|
*/
|
|
|
cancel: function(){
|
|
|
this.setData({
|
|
|
- hidden: true,
|
|
|
+ hidden: true,
|
|
|
+ inputValue: '',
|
|
|
+ reason: '',
|
|
|
});
|
|
|
},
|
|
|
/**
|
|
@@ -187,26 +189,52 @@ Page({
|
|
|
* 申请退款
|
|
|
*/
|
|
|
goRefund: function(reason) {
|
|
|
+ var that = this;
|
|
|
WelfareMall.orderRefund({
|
|
|
mobile: getMobileCache(),
|
|
|
- orderSn: this.data.orderSn,
|
|
|
+ orderSn: that.data.orderSn,
|
|
|
reason: reason,
|
|
|
}).then(res => {
|
|
|
if (res.code == 200) {
|
|
|
- this.cancel();
|
|
|
- this.onLoad(this.options);
|
|
|
- const url = "../refund/refund?orderSn=" + this.data.orderSn
|
|
|
+ that.cancel();
|
|
|
+ that.onLoad(that.options);
|
|
|
+ that.changeOrder(that.data.orderSn,3,'已退款');
|
|
|
+ const url = "../refund/refund?orderSn=" + that.data.orderSn
|
|
|
wx.navigateTo({
|
|
|
url
|
|
|
})
|
|
|
}
|
|
|
}).catch(_ => {
|
|
|
console.log(_)
|
|
|
- this.cancel();
|
|
|
+ that.cancel();
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
+ changeOrder: function(orderSn,status,showText){
|
|
|
+ var page = getCurrentPages();
|
|
|
+ //获取上一个页面的页面栈
|
|
|
+ var lastPage = page[page.length-2];
|
|
|
+ console.log(lastPage.data)
|
|
|
+ let oldOrderList = lastPage.data.orderList;
|
|
|
+ for(var i = 0;i<oldOrderList.length;i++){
|
|
|
+ if(orderSn == oldOrderList[i].orderSn){
|
|
|
+ oldOrderList[i].status.value = status
|
|
|
+ oldOrderList[i].status.showText = showText
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ wx.navigateBack({
|
|
|
+ delta: 1,
|
|
|
+ success:function(){
|
|
|
+ lastPage.setData({
|
|
|
+ orderList:oldOrderList
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return;
|
|
|
+ },
|
|
|
+
|
|
|
/**
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
*/
|