// pages/refund/refund.js
|
var util = require('../../utils/util.js');
|
Page({
|
|
/**
|
* 页面的初始数据
|
*/
|
data: {
|
productList:[],
|
shippingMethod:0, // 1 物流 2 自提
|
orderStatus: 0,
|
getBack:''
|
},
|
|
/**
|
* 生命周期函数--监听页面加载
|
*/
|
onLoad: function (options) {
|
// 根据订单id查询商品
|
this.getGoodsList(options.id)
|
// console.log(options.status)
|
if (options.getBack != undefined){
|
this.setData({
|
getBack: options.getBack
|
})
|
}
|
},
|
|
/**
|
* 生命周期函数--监听页面初次渲染完成
|
*/
|
onReady: function () {
|
|
},
|
|
/**
|
* 生命周期函数--监听页面显示
|
*/
|
onShow: function () {
|
|
},
|
|
/**
|
* 生命周期函数--监听页面隐藏
|
*/
|
onHide: function () {
|
|
},
|
|
/**
|
* 生命周期函数--监听页面卸载
|
*/
|
onUnload: function () {
|
|
},
|
|
/**
|
* 页面相关事件处理函数--监听用户下拉动作
|
*/
|
onPullDownRefresh: function () {
|
|
},
|
|
/**
|
* 页面上拉触底事件的处理函数
|
*/
|
onReachBottom: function () {
|
|
},
|
|
/**
|
* 用户点击右上角分享
|
*/
|
onShareAppMessage: function () {
|
|
},
|
|
//根据订单id获取产品信息
|
getGoodsList: function (id) {
|
var _this = this;
|
util.request({
|
method:"GET",
|
api: "/wxapi/shopOrder/getOrderInfoById/" + id,
|
callback: function (data) {
|
if (data.status == '200') {
|
console.log(data.rows[0]);
|
var productList = _this.data.productList;
|
for (var i = 0; i < data.rows[0].details.length; i++) {
|
var product = {
|
productId: data.rows[0].details[i].shopProduct.id,
|
orderNum: data.rows[0].orderNo,
|
orderId: data.rows[0].id,
|
imgMobile: data.rows[0].details[i].shopProduct.imgMobile,
|
name: data.rows[0].details[i].shopProduct.title,
|
sku: data.rows[0].details[i].shopSku.name,
|
price: data.rows[0].orderMoney,
|
status: data.rows[0].details[i].shopProduct.status,
|
delflag: data.rows[0].details[i].shopProduct.delFlag
|
}
|
productList.push(product);
|
}
|
// console.log(data.rows[0].orderStatus)
|
_this.setData({
|
productList: productList,
|
shippingMethod: data.rows[0].shippingMethod,
|
orderStatus: data.rows[0].orderStatus
|
})
|
|
}
|
}});
|
},
|
|
// 我要退款
|
wantRefund(e){
|
var _this = this
|
var status = e.currentTarget.dataset.status
|
// console.log(status)
|
var orderStatus = this.data.orderStatus;
|
console.log(orderStatus)
|
|
var productList = _this.data.productList
|
|
wx.setStorageSync("model", productList)
|
|
|
var getBack = _this.data.getBack;
|
wx.redirectTo({
|
url: '../applyRefund/applyRefund?status=' + status + '&&getBack=' + getBack + '&&orderStatus=' + orderStatus
|
})
|
},
|
|
// 进入商品页面
|
intoGoods(e){
|
var id = e.currentTarget.dataset.id
|
var status = e.currentTarget.dataset.status;
|
var delflag = e.currentTarget.dataset.delflag;
|
if (status == 2 || delflag == 1) {
|
wx.showToast({
|
title: "商品已失效",
|
icon: "none"
|
});
|
} else {
|
wx.navigateTo({
|
url: '../details/details?id=' + id
|
})
|
}
|
}
|
})
|