2023-06-15 09:44:08 +08:00
|
|
|
|
import {
|
|
|
|
|
searchPendingOrderByObject,
|
|
|
|
|
searchPendingOrderByHash,
|
2023-06-29 13:59:59 +08:00
|
|
|
|
searchPendingOrderByKeys
|
|
|
|
|
} from "@/assets/api.js"
|
2023-07-06 09:42:12 +08:00
|
|
|
|
import { Sweetalert } from "zent"
|
2023-06-14 16:52:06 +08:00
|
|
|
|
// === 公用接口函数 ===
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* @param {
|
|
|
|
|
* type值: 1key批次 2兑换码批次 3优惠券批次 4key码
|
|
|
|
|
* object_value:兑换id
|
|
|
|
|
* } data
|
2023-06-15 09:44:08 +08:00
|
|
|
|
* @param {1批量作废--文件上传, 2批量作废--列表选中 3普通查询(默认)} apiType
|
2023-06-14 16:52:06 +08:00
|
|
|
|
* @returns 0用户取消作废。1订单下面没有待领取订单,直接作废。 2订单下面有待领取订单,弹窗告知用户是否继续。
|
|
|
|
|
*/
|
2023-06-15 09:44:08 +08:00
|
|
|
|
const commonSearchOrder = (data, apiType = 3) => {
|
|
|
|
|
return new Promise(async (res, rej) => {
|
2023-06-29 13:59:59 +08:00
|
|
|
|
let searchRes = null
|
2023-06-15 09:44:08 +08:00
|
|
|
|
if (apiType === 1) {
|
2023-06-29 13:59:59 +08:00
|
|
|
|
searchRes = await searchPendingOrderByHash(data)
|
2023-06-15 09:44:08 +08:00
|
|
|
|
} else if (apiType === 2) {
|
2023-06-29 13:59:59 +08:00
|
|
|
|
searchRes = await searchPendingOrderByKeys(data)
|
2023-06-15 09:44:08 +08:00
|
|
|
|
} else {
|
2023-06-29 13:59:59 +08:00
|
|
|
|
searchRes = await searchPendingOrderByObject(data)
|
2023-06-15 09:44:08 +08:00
|
|
|
|
}
|
|
|
|
|
if (searchRes.code === 200) {
|
|
|
|
|
if (searchRes.data.have === true) {
|
|
|
|
|
Sweetalert.confirm({
|
|
|
|
|
type: "warning",
|
|
|
|
|
closeBtn: true,
|
|
|
|
|
title: "确认操作",
|
|
|
|
|
content: (
|
2023-06-29 13:59:59 +08:00
|
|
|
|
<p>
|
|
|
|
|
该key批次(key、兑换码),下面有{searchRes.data.order.status_text}订单,是否继续作废 ?
|
|
|
|
|
</p>
|
2023-06-15 09:44:08 +08:00
|
|
|
|
),
|
|
|
|
|
onConfirm() {
|
2023-06-29 13:59:59 +08:00
|
|
|
|
res(2)
|
2023-06-15 09:44:08 +08:00
|
|
|
|
},
|
|
|
|
|
onCancel() {
|
2023-06-29 13:59:59 +08:00
|
|
|
|
res(0)
|
2023-06-15 09:44:08 +08:00
|
|
|
|
},
|
|
|
|
|
className: "questModal",
|
2023-06-29 13:59:59 +08:00
|
|
|
|
parentComponent: this
|
|
|
|
|
})
|
2023-06-14 16:52:06 +08:00
|
|
|
|
} else {
|
2023-06-29 13:59:59 +08:00
|
|
|
|
res(1)
|
2023-06-14 16:52:06 +08:00
|
|
|
|
}
|
2023-06-15 09:44:08 +08:00
|
|
|
|
} else {
|
2023-06-29 13:59:59 +08:00
|
|
|
|
rej(searchRes)
|
2023-06-15 09:44:08 +08:00
|
|
|
|
}
|
2023-06-29 13:59:59 +08:00
|
|
|
|
})
|
|
|
|
|
}
|
2023-06-14 16:52:06 +08:00
|
|
|
|
|
2023-06-29 13:59:59 +08:00
|
|
|
|
export { commonSearchOrder }
|