131 lines
2.4 KiB
JavaScript
131 lines
2.4 KiB
JavaScript
// pages/my/apply_after_sales/apply_after_sales.js
|
||
const app = getApp();
|
||
Page({
|
||
|
||
/**
|
||
* 页面的初始数据
|
||
*/
|
||
data: {
|
||
order: null,
|
||
orderId: null,
|
||
goodsNames: [],
|
||
packages: [{
|
||
id: 1,
|
||
goods: [],
|
||
logisticsNumber: "YT7460149632645"
|
||
}]
|
||
},
|
||
addPackage() {
|
||
const _packages = this.data.packages
|
||
_packages.push({
|
||
id: Date.now(),
|
||
goods: [],
|
||
logisticsNumber: ""
|
||
})
|
||
this.setData({
|
||
packages: _packages
|
||
})
|
||
},
|
||
deletePackage(e) {
|
||
const { id } = e.currentTarget.dataset
|
||
console.log(id);
|
||
this.setData({
|
||
packages: this.data.packages.filter(el => el.id !== id)
|
||
})
|
||
},
|
||
/**
|
||
* 生命周期函数--监听页面加载
|
||
*/
|
||
onLoad(options) {
|
||
const { id, sq, num } = options
|
||
console.log(options);
|
||
this.setData({
|
||
orderId: id
|
||
})
|
||
|
||
wx.setNavigationBarTitle({
|
||
title: sq == 1 ? '退货申请' : '换货申请'
|
||
})
|
||
|
||
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: num,
|
||
},
|
||
success: res => {
|
||
wx.hideLoading()
|
||
if (res.data.code == 1) {
|
||
let order = res.data.value;
|
||
this.setData({
|
||
order,
|
||
goodsNames: order.goodsList.map(el => `${el.goodsName} - ${el.wisdGoodsSpec.specName} × ${el.goodsNum}`)
|
||
// package: goods.logistics ? JSON.parse(goods.logistics).find(el => el.id == this.data.packageId) : null
|
||
})
|
||
} else {
|
||
wx.showModal({
|
||
title: '提示!',
|
||
content: res.data.message,
|
||
showCancel: false,
|
||
})
|
||
}
|
||
}
|
||
})
|
||
},
|
||
|
||
/**
|
||
* 生命周期函数--监听页面初次渲染完成
|
||
*/
|
||
onReady() {
|
||
|
||
},
|
||
|
||
/**
|
||
* 生命周期函数--监听页面显示
|
||
*/
|
||
onShow() {
|
||
|
||
},
|
||
|
||
/**
|
||
* 生命周期函数--监听页面隐藏
|
||
*/
|
||
onHide() {
|
||
|
||
},
|
||
|
||
/**
|
||
* 生命周期函数--监听页面卸载
|
||
*/
|
||
onUnload() {
|
||
|
||
},
|
||
|
||
/**
|
||
* 页面相关事件处理函数--监听用户下拉动作
|
||
*/
|
||
onPullDownRefresh() {
|
||
|
||
},
|
||
|
||
/**
|
||
* 页面上拉触底事件的处理函数
|
||
*/
|
||
onReachBottom() {
|
||
|
||
},
|
||
|
||
/**
|
||
* 用户点击右上角分享
|
||
*/
|
||
onShareAppMessage() {
|
||
|
||
}
|
||
}) |