You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
135 lines
3.2 KiB
135 lines
3.2 KiB
2 years ago
|
// pages/aftersales/aftersales.js
|
||
2 years ago
|
var app = getApp()
|
||
2 years ago
|
var WXAPI = require('../../utils/server.js');
|
||
2 years ago
|
Page({
|
||
|
|
||
|
/**
|
||
|
* 页面的初始数据
|
||
|
*/
|
||
|
data: {
|
||
2 years ago
|
refund_only_status:false,
|
||
|
return_refund_status:false,
|
||
|
exchange_goods_status:false,
|
||
|
isbatch: false,
|
||
|
orderType:'',
|
||
2 years ago
|
},
|
||
|
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) {
|
||
2 years ago
|
// var otype = options.type ? options.type:false;
|
||
2 years ago
|
console.log(options)
|
||
2 years ago
|
// this.setData({
|
||
|
// id: options.id,
|
||
|
// oid:options.oid,
|
||
|
// otype: otype
|
||
|
// });
|
||
|
this.loadData(options.orderId);
|
||
2 years ago
|
},
|
||
2 years ago
|
loadData: function (orderId) {
|
||
2 years ago
|
var that = this;
|
||
2 years ago
|
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({
|
||
|
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
|
||
|
});
|
||
|
}
|
||
|
})
|
||
2 years ago
|
},
|
||
|
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)
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
|
||
|
wx.request({
|
||
|
url: app.d.ceshiUrl + '&action=order&m=ReturnData',
|
||
|
method: 'post',
|
||
|
data: {
|
||
|
id: that.data.id,
|
||
|
oid: that.data.oid,
|
||
|
otype: that.data.otype,
|
||
|
re_type: that.data.tapIndex,
|
||
|
back_remark: remark,
|
||
|
},
|
||
|
header: {
|
||
|
'Content-Type': 'application/x-www-form-urlencoded'
|
||
|
},
|
||
|
success: function (res) {
|
||
|
var status = res.data.status;
|
||
|
if (status == 1) {
|
||
|
wx.showToast({
|
||
|
title: res.data.succ,
|
||
|
success: 2000
|
||
|
});
|
||
|
wx.redirectTo({
|
||
2 years ago
|
url: '/pages/aftersales/index?currentTab=0&otype=whole',
|
||
2 years ago
|
});
|
||
|
} else {
|
||
|
wx.showToast({
|
||
|
title: res.data.err,
|
||
|
duration: 2000
|
||
|
});
|
||
|
}
|
||
|
},
|
||
|
});
|
||
|
}
|
||
|
})
|