Files
CompanyProject/衣莎项目/源码/YiShaXiYi/mall/laundryList/laundryList.js
2024-09-27 01:32:49 +08:00

147 lines
3.2 KiB
JavaScript

// mall/laundryList/laundryList.js
const app = getApp();
const regeneratorRuntime = app.loadAsync()
const model = app.loadModel("index")
const http = app.loadHttp()
Page({
/**
* 页面的初始数据
*/
data: {
system: app.globalData.system, //设备相关信息
pageTitle: "商城订单", //头部标题
isBack: true,//显示返回,
isLoading: true,//加载显示关闭
current: "0",//选择订单状态
orderList: [],//订单列表
},
// tab选中事件
handleChange({ detail }) {
this.setData({
current: detail.key
});
this.getOrderList()
},
// 查看详情
openInfo(e) {
let id = e.currentTarget.dataset.id
wx.navigateTo({
url: "/mall/laundryList/laundryInfo/laundryInfo?id=" + id
})
},
// 获取订单列表
async getOrderList() {
let res = await http.http.request2({ url: `${http.api.userStoreOrder}`, method: "POST", data: { status: this.data.current } })
this.setData({
orderList: res.data.data,
isLoading: false
})
},
// 申请退款
async applyReturn(e) {
let that = this;
let id = e.currentTarget.dataset.id;
wx.showModal({
title: '确定退款',
content: '退款成功后,将不可取消退款!',
success(res) {
if (res.confirm) {
http.http.request2({ url: `${http.api.applyReturn}`, method: "POST", data: { order_id: id } })
.then(res => {
if (res.data.status == 1) {
wx.showToast({
title: '请等待后台人员审核!!!',
icon: 'none',
duration: 2000
})
that.getOrderList()
}
})
}
}
})
},
// 确认收货
async recGoods(e) {
let that = this;
let id = e.currentTarget.dataset.id;
wx.showModal({
content: '确定收货',
success(res) {
if (res.confirm) {
wx.showLoading({
title: '加载中',
})
http.http.request2({ url: `${http.api.confirmReceipt}`, method: "POST", data: { order_id: id } })
.then(res => {
if (res.data.status == 1) {
wx.hideLoading()
wx.showToast({
title: '确认成功!',
icon: 'none',
duration: 2000
})
that.getOrderList()
}
})
}
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getOrderList()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})