168 lines
4.0 KiB
JavaScript
168 lines
4.0 KiB
JavaScript
// mall/laundryList/laundryInfo/laundryInfo.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,//显示返回
|
|
shopNum: 2,//显示的商品数量
|
|
orderId: "",//订单id
|
|
orderInof: {},//订单详情
|
|
},
|
|
// 点击查看更多商品
|
|
more() {
|
|
this.setData({
|
|
shopNum: 999999
|
|
})
|
|
},
|
|
// 获取详情信息
|
|
async storeOrderDetail() {
|
|
let res = await http.http.request2({ url: `${http.api.storeOrderDetail}`, method: "POST", data: { order_id: this.data.orderId } })
|
|
let rel = res.data.data
|
|
if (rel.status == 1) {
|
|
rel.status_name = "待付款"
|
|
rel.status_img = "/static/img/icon/shop_dfk.png"
|
|
} else if (rel.status == 2) {
|
|
rel.status_name = "待发货"
|
|
rel.status_img = "/static/img/icon/shop_yfk.png"
|
|
} else if (rel.status == 3) {
|
|
rel.status_name = "待收货"
|
|
rel.status_img = "/static/img/icon/shop_dsh.png"
|
|
} else if (rel.status == 4) {
|
|
rel.status_name = "已完成"
|
|
rel.status_img = "/static/img/icon/shop_wc.png"
|
|
} else if (rel.status == 5) {
|
|
rel.status_name = "已取消"
|
|
rel.status_img = "/static/img/icon/shop_x.png"
|
|
}else if (rel.status == 6){
|
|
rel.status_name = "待退款"
|
|
rel.status_img = "/static/img/icon/shop_tui.png"
|
|
}else if (rel.status == 7){
|
|
rel.status_name = "已退款"
|
|
rel.status_img = "/static/img/icon/shop_tui.png"
|
|
}
|
|
// 去除地址中的,
|
|
rel.user_address = rel.user_address.replace(/,/g, "");
|
|
this.setData({
|
|
orderInof: rel
|
|
})
|
|
},
|
|
// 待付款订单支付
|
|
async orderPay(e) {
|
|
// let id = e.currentTarget.dataset.id
|
|
// let data = {
|
|
// orderID: id,
|
|
// payType: 2,
|
|
// userCouponID: 0,
|
|
// userCardID: 0
|
|
// }
|
|
// let res = await model.payment.pay(http.api.pre_order, data)
|
|
// if (res == 1) {
|
|
// this.storeOrderDetail()
|
|
// }
|
|
|
|
let orderInfo = this.data.orderInof
|
|
let data = {
|
|
orederId: orderInfo.id,
|
|
order_num: orderInfo.order_no,
|
|
realPrice: orderInfo.order_total_price,
|
|
fjPrice: 0,//附加金额商城订单为0
|
|
type: 1,//1是商城订单
|
|
}
|
|
wx.navigateTo({
|
|
url: `/user/payment/payment?data=${JSON.stringify(data)}`
|
|
})
|
|
},
|
|
// 取消订单
|
|
async orderCancel(e) {
|
|
let id = e.currentTarget.dataset.id
|
|
wx.showModal({
|
|
title: '取消订单',
|
|
content: '是否取消订单',
|
|
success(res) {
|
|
if (res.confirm) {
|
|
http.http.request2({ url: `${http.api.cancelOrderStatus}`, method: "GET", data: { order_id: id } })
|
|
.then(res => {
|
|
if (res.data.status == 1) {
|
|
wx.showToast({
|
|
title: '取消成功',
|
|
icon: 'none',
|
|
duration: 800
|
|
})
|
|
setTimeout(() => {
|
|
wx.navigateBack({
|
|
|
|
})
|
|
}, 800)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
})
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
this.setData({
|
|
orderId: options.id
|
|
})
|
|
this.storeOrderDetail()
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function () {
|
|
|
|
}
|
|
}) |