135 lines
3.1 KiB
JavaScript
135 lines
3.1 KiB
JavaScript
/**
|
|
* Web二雪
|
|
* 趁时光不老 努力活成自己想要成为的样子
|
|
*/
|
|
const app = getApp()
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
logisticsPop: false, //物流弹出框状态
|
|
orderData: '', //商品详情
|
|
orderId: ''
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad(options) {
|
|
this.setData({
|
|
orderId: options.orderId
|
|
})
|
|
this.orderData(options.orderId)
|
|
},
|
|
|
|
/**
|
|
* 订单详情
|
|
*/
|
|
orderData(orderId) {
|
|
wx.$api.companyModule.getOrderInfo(orderId).then(res => {
|
|
console.log(res)
|
|
this.setData({
|
|
orderData: res
|
|
})
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 物流弹出
|
|
*/
|
|
logisticsShow() {
|
|
this.setData({
|
|
logisticsPop: !this.data.logisticsPop
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 物流隐藏
|
|
*/
|
|
logisticsHide() {
|
|
this.setData({
|
|
logisticsPop: !this.data.logisticsPop
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 返回订单
|
|
*/
|
|
orderRun() {
|
|
wx.navigateBack({
|
|
delta: 1,
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 订单支付
|
|
*/
|
|
orderPay(e) {
|
|
let orderId = e.currentTarget.dataset.orderid
|
|
wx.navigateTo({
|
|
url: '../projectPay/projectPay?orderid=' + orderId,
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 取消订单
|
|
*/
|
|
orderDelete(e) {
|
|
let orderId = e.currentTarget.dataset.orderid
|
|
wx.showModal({
|
|
title: '提示',
|
|
content: '是否确认取消订单',
|
|
success: res => {
|
|
if (res.confirm) {
|
|
wx.showLoading({
|
|
title: '取消中',
|
|
})
|
|
wx.$api.order.cancel(orderId).then(res => {
|
|
console.log(res);
|
|
wx.showToast({
|
|
title: '取消成功',
|
|
icon:'none',
|
|
duration:1000
|
|
})
|
|
setTimeout(() => {
|
|
this.orderData(this.data.orderId)
|
|
}, 1000);
|
|
})
|
|
}
|
|
}
|
|
})
|
|
},
|
|
|
|
|
|
/**
|
|
* 签收订单
|
|
*/
|
|
orderSign(e) {
|
|
let orderId = e.currentTarget.dataset.orderid
|
|
wx.showModal({
|
|
title: '提示',
|
|
content: '是否确认签收订单',
|
|
success: res => {
|
|
if (res.confirm) {
|
|
wx.showLoading({
|
|
title: '签收中',
|
|
})
|
|
wx.$api.order.sign(orderId).then(res => {
|
|
console.log(res);
|
|
wx.showToast({
|
|
title: '签收成功',
|
|
icon:'none',
|
|
duration:1000
|
|
})
|
|
setTimeout(() => {
|
|
this.orderData(this.data.orderId)
|
|
}, 1000);
|
|
})
|
|
}
|
|
}
|
|
})
|
|
|
|
},
|
|
}) |