|
|
|
// pages/aftersales/aftersales.js
|
|
|
|
var app = getApp()
|
|
|
|
var WXAPI = require('../../utils/server.js');
|
|
|
|
Page({
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 页面的初始数据
|
|
|
|
*/
|
|
|
|
data: {
|
|
|
|
refund_only_status:false,
|
|
|
|
return_refund_status:false,
|
|
|
|
exchange_goods_status:false,
|
|
|
|
isbatch: false,
|
|
|
|
orderType:'',
|
|
|
|
orderId: '',
|
|
|
|
},
|
|
|
|
actionSheetTap: function () {
|
|
|
|
var that = this;
|
|
|
|
wx.showActionSheet({
|
|
|
|
itemList: that.data.itemList,
|
|
|
|
success: function (e) {
|
|
|
|
|
|
|
|
var arrayType = that.data.arrayType, itemList = that.data.itemList;
|
|
|
|
|
|
|
|
for (var i = 0; i < arrayType.length; i++) {
|
|
|
|
if (itemList[e.tapIndex] == arrayType[i].text){
|
|
|
|
that.setData({
|
|
|
|
tapIndex: arrayType[i].id,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
that.setData({
|
|
|
|
itemList_text: itemList[e.tapIndex]
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
*/
|
|
|
|
onLoad: function (options) {
|
|
|
|
// var otype = options.type ? options.type:false;
|
|
|
|
console.log(options)
|
|
|
|
// this.setData({
|
|
|
|
// id: options.id,
|
|
|
|
// oid:options.oid,
|
|
|
|
// otype: otype
|
|
|
|
// });
|
|
|
|
this.loadData(options.orderId);
|
|
|
|
},
|
|
|
|
loadData: function (orderId) {
|
|
|
|
var that = this;
|
|
|
|
WXAPI.returnMethod({
|
|
|
|
accessId: app.globalData.accessId,
|
|
|
|
storeId: 239,
|
|
|
|
storeType: 1,
|
|
|
|
order_details_id: orderId,
|
|
|
|
}).then(res => {
|
|
|
|
if (res.code == 200) {
|
|
|
|
var data = res.data
|
|
|
|
that.setData({
|
|
|
|
orderId: orderId,
|
|
|
|
order: data.list,
|
|
|
|
status: data.status,
|
|
|
|
refund_only_status: data.refund_only_status,
|
|
|
|
return_refund_status: data.return_refund_status,
|
|
|
|
exchange_goods_status: data.exchange_goods_status,
|
|
|
|
orderType: data.orderType
|
|
|
|
});
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
remarkInput: function (e) {
|
|
|
|
this.setData({
|
|
|
|
remark: e.detail.value,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
submitReturnData: function(e){
|
|
|
|
var remark = e.detail.value.remark;
|
|
|
|
var that = this;
|
|
|
|
var formId = e.detail.formId;
|
|
|
|
|
|
|
|
if (remark.length < 1) {
|
|
|
|
wx.showToast({
|
|
|
|
title: '退款原因不能为空!',
|
|
|
|
icon: 'none',
|
|
|
|
duration: 2000
|
|
|
|
});
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (formId != 'the formId is a mock one') {
|
|
|
|
app.request.wxRequest({
|
|
|
|
url: '&action=product&m=save_formid',
|
|
|
|
data: { from_id: formId, userid: app.globalData.userInfo.openid },
|
|
|
|
method: 'post',
|
|
|
|
success: function (res) {
|
|
|
|
console.log(res)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
navToApply: function(e){
|
|
|
|
console.log(e)
|
|
|
|
var type = e.currentTarget.dataset.type;
|
|
|
|
var that = this
|
|
|
|
wx.navigateTo({
|
|
|
|
url:"/pages/aftersales/apply?refund_type=" + type + "&orderId=" + that.data.orderId
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|