|
|
|
@ -1,8 +1,17 @@
|
|
|
|
|
import { cancelOrder, takeOrder, delOrder, payOrder } from "@/api/order"; |
|
|
|
|
import { |
|
|
|
|
cancelOrder, |
|
|
|
|
takeOrder, |
|
|
|
|
delOrder, |
|
|
|
|
payOrder |
|
|
|
|
} from "@/api/order"; |
|
|
|
|
import dialog from "@/utils/dialog"; |
|
|
|
|
import { weappPay } from "@/libs/wechat"; |
|
|
|
|
import { |
|
|
|
|
weappPay |
|
|
|
|
} from "@/libs/wechat"; |
|
|
|
|
|
|
|
|
|
import { _router } from '@/utils' |
|
|
|
|
import { |
|
|
|
|
_router |
|
|
|
|
} from '@/utils' |
|
|
|
|
|
|
|
|
|
export function cancelOrderHandle(orderId) { |
|
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
@ -14,18 +23,21 @@ export function cancelOrderHandle(orderId) {
|
|
|
|
|
cancelOrder(orderId) |
|
|
|
|
.then(res => { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: '取消成功', icon: 'success', duration: 2000 |
|
|
|
|
title: '取消成功', |
|
|
|
|
icon: 'success', |
|
|
|
|
duration: 2000 |
|
|
|
|
}); |
|
|
|
|
resolve(res); |
|
|
|
|
}) |
|
|
|
|
.catch(err => { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: '取消失败', icon: 'none', duration: 2000 |
|
|
|
|
title: '取消失败', |
|
|
|
|
icon: 'none', |
|
|
|
|
duration: 2000 |
|
|
|
|
}); |
|
|
|
|
reject(err); |
|
|
|
|
}); |
|
|
|
|
} else if (res.cancel) { |
|
|
|
|
} |
|
|
|
|
} else if (res.cancel) {} |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}); |
|
|
|
@ -36,13 +48,17 @@ export function takeOrderHandle(orderId) {
|
|
|
|
|
takeOrder(orderId) |
|
|
|
|
.then(res => { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: '收货成功', icon: 'success', duration: 2000 |
|
|
|
|
title: '收货成功', |
|
|
|
|
icon: 'success', |
|
|
|
|
duration: 2000 |
|
|
|
|
}); |
|
|
|
|
resolve(res); |
|
|
|
|
}) |
|
|
|
|
.catch(err => { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: '收货失败', icon: 'none', duration: 2000 |
|
|
|
|
title: '收货失败', |
|
|
|
|
icon: 'none', |
|
|
|
|
duration: 2000 |
|
|
|
|
}); |
|
|
|
|
reject(err); |
|
|
|
|
}); |
|
|
|
@ -57,13 +73,17 @@ export function delOrderHandle(orderId) {
|
|
|
|
|
delOrder(orderId) |
|
|
|
|
.then(res => { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: '删除成功', icon: 'success', duration: 2000 |
|
|
|
|
title: '删除成功', |
|
|
|
|
icon: 'success', |
|
|
|
|
duration: 2000 |
|
|
|
|
}); |
|
|
|
|
resolve(res); |
|
|
|
|
}) |
|
|
|
|
.catch(err => { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: '删除失败', icon: 'none', duration: 2000 |
|
|
|
|
title: '删除失败', |
|
|
|
|
icon: 'none', |
|
|
|
|
duration: 2000 |
|
|
|
|
}); |
|
|
|
|
reject(err); |
|
|
|
|
}); |
|
|
|
@ -81,6 +101,7 @@ export async function payOrderHandle(orderId, type, from) {
|
|
|
|
|
}); |
|
|
|
|
payOrder(orderId, type, from) |
|
|
|
|
.then(async res => { |
|
|
|
|
console.log(res) |
|
|
|
|
await handleOrderPayResults(res.data, type) |
|
|
|
|
resolve() |
|
|
|
|
}) |
|
|
|
@ -99,9 +120,6 @@ export async function payOrderHandle(orderId, type, from) {
|
|
|
|
|
// 处理调用支付接口的逻辑
|
|
|
|
|
// @type create(创建订单)||pay(支付订单)
|
|
|
|
|
export function handleOrderPayResults(data, type, payType) { |
|
|
|
|
console.log(data, type, payType) |
|
|
|
|
|
|
|
|
|
console.log(data, type) |
|
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
|
uni.hideLoading() |
|
|
|
|
switch (data.status) { |
|
|
|
@ -179,7 +197,9 @@ export function subscribeMessage() {
|
|
|
|
|
// 调用订阅
|
|
|
|
|
console.log('调用订阅') |
|
|
|
|
uni.requestSubscribeMessage({ |
|
|
|
|
tmplIds: ['W5r2c2kzhbq8uxStkPAVx_sk-5aapMFCqe7b7KU5jXI', '2CB_1UyQrbnlyjJa5syraqJ3cfztPPDOAHe3DEXpMjg', 'vuztugw9VbKbKJDAAVePkjqPpT5mdoREpd4Aq7EGPRU'], |
|
|
|
|
tmplIds: ['W5r2c2kzhbq8uxStkPAVx_sk-5aapMFCqe7b7KU5jXI', '2CB_1UyQrbnlyjJa5syraqJ3cfztPPDOAHe3DEXpMjg', |
|
|
|
|
'vuztugw9VbKbKJDAAVePkjqPpT5mdoREpd4Aq7EGPRU' |
|
|
|
|
], |
|
|
|
|
success(res) { |
|
|
|
|
console.log(res) |
|
|
|
|
}, |
|
|
|
|