优化细节
This commit is contained in:
@ -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 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) {
|
export function cancelOrderHandle(orderId) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
@ -14,18 +23,21 @@ export function cancelOrderHandle(orderId) {
|
|||||||
cancelOrder(orderId)
|
cancelOrder(orderId)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '取消成功', icon: 'success', duration: 2000
|
title: '取消成功',
|
||||||
|
icon: 'success',
|
||||||
|
duration: 2000
|
||||||
});
|
});
|
||||||
resolve(res);
|
resolve(res);
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '取消失败', icon: 'none', duration: 2000
|
title: '取消失败',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
});
|
});
|
||||||
reject(err);
|
reject(err);
|
||||||
});
|
});
|
||||||
} else if (res.cancel) {
|
} else if (res.cancel) {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
@ -36,13 +48,17 @@ export function takeOrderHandle(orderId) {
|
|||||||
takeOrder(orderId)
|
takeOrder(orderId)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '收货成功', icon: 'success', duration: 2000
|
title: '收货成功',
|
||||||
|
icon: 'success',
|
||||||
|
duration: 2000
|
||||||
});
|
});
|
||||||
resolve(res);
|
resolve(res);
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '收货失败', icon: 'none', duration: 2000
|
title: '收货失败',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
});
|
});
|
||||||
reject(err);
|
reject(err);
|
||||||
});
|
});
|
||||||
@ -57,13 +73,17 @@ export function delOrderHandle(orderId) {
|
|||||||
delOrder(orderId)
|
delOrder(orderId)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '删除成功', icon: 'success', duration: 2000
|
title: '删除成功',
|
||||||
|
icon: 'success',
|
||||||
|
duration: 2000
|
||||||
});
|
});
|
||||||
resolve(res);
|
resolve(res);
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '删除失败', icon: 'none', duration: 2000
|
title: '删除失败',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
});
|
});
|
||||||
reject(err);
|
reject(err);
|
||||||
});
|
});
|
||||||
@ -81,6 +101,7 @@ export async function payOrderHandle(orderId, type, from) {
|
|||||||
});
|
});
|
||||||
payOrder(orderId, type, from)
|
payOrder(orderId, type, from)
|
||||||
.then(async res => {
|
.then(async res => {
|
||||||
|
console.log(res)
|
||||||
await handleOrderPayResults(res.data, type)
|
await handleOrderPayResults(res.data, type)
|
||||||
resolve()
|
resolve()
|
||||||
})
|
})
|
||||||
@ -99,9 +120,6 @@ export async function payOrderHandle(orderId, type, from) {
|
|||||||
// 处理调用支付接口的逻辑
|
// 处理调用支付接口的逻辑
|
||||||
// @type create(创建订单)||pay(支付订单)
|
// @type create(创建订单)||pay(支付订单)
|
||||||
export function handleOrderPayResults(data, type, payType) {
|
export function handleOrderPayResults(data, type, payType) {
|
||||||
console.log(data, type, payType)
|
|
||||||
|
|
||||||
console.log(data, type)
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
switch (data.status) {
|
switch (data.status) {
|
||||||
@ -179,11 +197,13 @@ export function subscribeMessage() {
|
|||||||
// 调用订阅
|
// 调用订阅
|
||||||
console.log('调用订阅')
|
console.log('调用订阅')
|
||||||
uni.requestSubscribeMessage({
|
uni.requestSubscribeMessage({
|
||||||
tmplIds: ['W5r2c2kzhbq8uxStkPAVx_sk-5aapMFCqe7b7KU5jXI', '2CB_1UyQrbnlyjJa5syraqJ3cfztPPDOAHe3DEXpMjg', 'vuztugw9VbKbKJDAAVePkjqPpT5mdoREpd4Aq7EGPRU'],
|
tmplIds: ['W5r2c2kzhbq8uxStkPAVx_sk-5aapMFCqe7b7KU5jXI', '2CB_1UyQrbnlyjJa5syraqJ3cfztPPDOAHe3DEXpMjg',
|
||||||
|
'vuztugw9VbKbKJDAAVePkjqPpT5mdoREpd4Aq7EGPRU'
|
||||||
|
],
|
||||||
success(res) {
|
success(res) {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
},
|
},
|
||||||
fail(error){
|
fail(error) {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -40,6 +40,8 @@
|
|||||||
if (!url) {
|
if (!url) {
|
||||||
url = handleUrlParam(getCurrentPageUrlWithArgs())
|
url = handleUrlParam(getCurrentPageUrlWithArgs())
|
||||||
}
|
}
|
||||||
|
console.log(url)
|
||||||
|
console.log('判断是否是分销')
|
||||||
// 判断是否是分销
|
// 判断是否是分销
|
||||||
if (url) {
|
if (url) {
|
||||||
let urlSpread = parseInt(url.spread);
|
let urlSpread = parseInt(url.spread);
|
||||||
|
Reference in New Issue
Block a user