jiuyiUniapp/jiuyi2/common/js/order.js

61 lines
1.0 KiB
JavaScript
Raw Normal View History

2025-01-19 22:56:45 +08:00
// 工具库
import util from '@/common/js/util.js'
// api
import api from '@/api/index.js'
const order = {
/**
2025-01-21 09:39:21 +08:00
* 订单取消
2025-01-19 22:56:45 +08:00
* @param {Object} event 事件对象
*/
2025-01-21 09:39:21 +08:00
orderCancel: (event) => {
2025-01-19 22:56:45 +08:00
return new Promise((resolve, reject) => {
2025-01-21 09:39:21 +08:00
util.alert({
content: '取消订单后不可恢复,确认取消订单?',
}).then(res => {
if (!res.confirm) return
//
return api.shop.orderCancel({
query: {
id: event.orderId,
},
})
}).then(res => {
2025-01-19 22:56:45 +08:00
if (res.code == 200) {
resolve(res.data)
return
}
util.alert({
content: res.msg,
showCancel: false,
})
})
})
2025-01-21 09:39:21 +08:00
},
/**
* 订单支付
* @param {Object} event 事件对象
*/
orderPay(event) {
uni.navigateTo({
url: util.setUrl('/pages/shop/commodity/payment', {
orderId: event.id,
})
})
2025-01-21 22:33:44 +08:00
},
/**
* 申请售后
* @param {Object} event 事件对象
*/
orderAfterSales(event) {
uni.navigateTo({
url: util.setUrl('/pages/shop/order/refundStar', {
orderId: event.id,
})
})
},
2025-01-19 22:56:45 +08:00
}
export default order