145 lines
3.0 KiB
JavaScript
145 lines
3.0 KiB
JavaScript
// pages/my/after_sales/after_sales.js
|
|
const app = getApp();
|
|
const IP = app.globalData.ip;
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
phone: ''
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
this.setData({
|
|
phone: app.globalData.customerPhone,
|
|
id: options.id,
|
|
num: options.num,
|
|
})
|
|
},
|
|
|
|
next() {
|
|
wx.navigateTo({
|
|
url: '/pages/my/after_sales_next/after_sales_next?id=' + this.data.id + '&&num=' + this.data.num,
|
|
})
|
|
},
|
|
// 撤销退换货申请
|
|
cancel() {
|
|
wx.showModal({
|
|
title: '确定要撤销申请吗?',
|
|
// content: '',
|
|
complete: (res) => {
|
|
if (res.cancel) {
|
|
|
|
}
|
|
|
|
if (res.confirm) {
|
|
wx.request({
|
|
url: app.globalData.ip + '/wisdommining/api/order/cancelRefund',
|
|
method: 'GET',
|
|
header: {
|
|
"content-type": "application/x-www-form-urlencoded",
|
|
},
|
|
data: {
|
|
orderId: this.data.id
|
|
},
|
|
success(res) {
|
|
if (res.data.code == 1) {
|
|
wx.showToast({
|
|
title: res.data.message,
|
|
})
|
|
wx.navigateTo({
|
|
url: '/pages/my/my_order/my_order?state=' + 3,
|
|
})
|
|
} else {
|
|
wx.showModal({
|
|
title: '提示!',
|
|
content: res.data.message,
|
|
showCancel: false,
|
|
})
|
|
}
|
|
}
|
|
})
|
|
}
|
|
}
|
|
})
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function () {
|
|
wx.showLoading({
|
|
title: '加载中..',
|
|
})
|
|
wx.request({
|
|
url: app.globalData.ip + '/wisdommining/api/order/getOrderDetail',
|
|
method: 'GET',
|
|
header: {
|
|
"content-type": "application/x-www-form-urlencoded",
|
|
},
|
|
data: {
|
|
userId: app.globalData.userId,
|
|
orderNumber: this.data.num,
|
|
},
|
|
success: res => {
|
|
console.log(res)
|
|
wx.hideLoading()
|
|
if (res.data.code == 1) {
|
|
let goods = res.data.value;
|
|
if (goods.orderRefundImage) {
|
|
goods.orderRefundImage = goods.orderRefundImage.split(',');
|
|
}
|
|
this.setData({
|
|
goods: goods,
|
|
})
|
|
} else {
|
|
wx.showModal({
|
|
title: '提示!',
|
|
content: res.data.message,
|
|
showCancel: false,
|
|
})
|
|
}
|
|
}
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function () {
|
|
|
|
},
|
|
}) |