待确认
build / task (16.x, npm, macOS-latest) (push) Canceled after 0s
build / task (16.x, npm, ubuntu-latest) (push) Canceled after 0s
build / task (16.x, npm, windows-latest) (push) Canceled after 0s
build / task (16.x, pnpm, macOS-latest) (push) Canceled after 0s
build / task (16.x, pnpm, ubuntu-latest) (push) Canceled after 0s
build / task (16.x, pnpm, windows-latest) (push) Canceled after 0s
build / task (16.x, yarn, macOS-latest) (push) Canceled after 0s
build / task (16.x, yarn, ubuntu-latest) (push) Canceled after 0s
build / task (16.x, yarn, windows-latest) (push) Canceled after 0s
build / task (18.x, npm, macOS-latest) (push) Canceled after 0s
build / task (18.x, npm, ubuntu-latest) (push) Canceled after 0s
build / task (18.x, npm, windows-latest) (push) Canceled after 0s
build / task (18.x, pnpm, macOS-latest) (push) Canceled after 0s
build / task (18.x, pnpm, ubuntu-latest) (push) Canceled after 0s
build / task (18.x, pnpm, windows-latest) (push) Canceled after 0s
build / task (18.x, yarn, macOS-latest) (push) Canceled after 0s
build / task (18.x, yarn, ubuntu-latest) (push) Canceled after 0s
build / task (18.x, yarn, windows-latest) (push) Canceled after 0s
build / task (20.x, npm, macOS-latest) (push) Canceled after 0s
build / task (20.x, npm, ubuntu-latest) (push) Canceled after 0s
build / task (20.x, npm, windows-latest) (push) Canceled after 0s
build / task (20.x, pnpm, macOS-latest) (push) Canceled after 0s
build / task (20.x, pnpm, ubuntu-latest) (push) Canceled after 0s
build / task (20.x, pnpm, windows-latest) (push) Canceled after 0s
build / task (20.x, yarn, macOS-latest) (push) Canceled after 0s
build / task (20.x, yarn, ubuntu-latest) (push) Canceled after 0s
build / task (20.x, yarn, windows-latest) (push) Canceled after 0s
build / task (16.x, npm, macOS-latest) (push) Canceled after 0s
build / task (16.x, npm, ubuntu-latest) (push) Canceled after 0s
build / task (16.x, npm, windows-latest) (push) Canceled after 0s
build / task (16.x, pnpm, macOS-latest) (push) Canceled after 0s
build / task (16.x, pnpm, ubuntu-latest) (push) Canceled after 0s
build / task (16.x, pnpm, windows-latest) (push) Canceled after 0s
build / task (16.x, yarn, macOS-latest) (push) Canceled after 0s
build / task (16.x, yarn, ubuntu-latest) (push) Canceled after 0s
build / task (16.x, yarn, windows-latest) (push) Canceled after 0s
build / task (18.x, npm, macOS-latest) (push) Canceled after 0s
build / task (18.x, npm, ubuntu-latest) (push) Canceled after 0s
build / task (18.x, npm, windows-latest) (push) Canceled after 0s
build / task (18.x, pnpm, macOS-latest) (push) Canceled after 0s
build / task (18.x, pnpm, ubuntu-latest) (push) Canceled after 0s
build / task (18.x, pnpm, windows-latest) (push) Canceled after 0s
build / task (18.x, yarn, macOS-latest) (push) Canceled after 0s
build / task (18.x, yarn, ubuntu-latest) (push) Canceled after 0s
build / task (18.x, yarn, windows-latest) (push) Canceled after 0s
build / task (20.x, npm, macOS-latest) (push) Canceled after 0s
build / task (20.x, npm, ubuntu-latest) (push) Canceled after 0s
build / task (20.x, npm, windows-latest) (push) Canceled after 0s
build / task (20.x, pnpm, macOS-latest) (push) Canceled after 0s
build / task (20.x, pnpm, ubuntu-latest) (push) Canceled after 0s
build / task (20.x, pnpm, windows-latest) (push) Canceled after 0s
build / task (20.x, yarn, macOS-latest) (push) Canceled after 0s
build / task (20.x, yarn, ubuntu-latest) (push) Canceled after 0s
build / task (20.x, yarn, windows-latest) (push) Canceled after 0s
This commit is contained in:
1 parent
96b9be1907
commit
e84e7c64a6
2 files changed
+140
-9
No files matched your search
@@ -23,6 +23,25 @@ export function cancelOrder(id: string | number, reason?: string) {
|
||||
})
|
||||
}
|
||||
|
||||
/** 本地数据源订单人工确认接单 */
|
||||
export function confirmOrder(id: string | number, reason?: string) {
|
||||
return request({
|
||||
url: `/supermarket/smHotelOrder/confirm/${id}`,
|
||||
method: "post",
|
||||
data: { reason: reason || "人工确认接单" },
|
||||
})
|
||||
}
|
||||
|
||||
/** 本地数据源订单人工拒绝(已支付则退款) */
|
||||
export function rejectOrder(id: string | number, reason?: string) {
|
||||
return request({
|
||||
url: `/supermarket/smHotelOrder/reject/${id}`,
|
||||
method: "post",
|
||||
data: { reason: reason || "人工拒绝接单" },
|
||||
timeout: 120000,
|
||||
})
|
||||
}
|
||||
|
||||
/** 已支付订单原路退款并关闭预订 */
|
||||
export function refundOrder(id: string | number, reason?: string) {
|
||||
return request({
|
||||
|
||||
@@ -176,11 +176,29 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createTime" label="创建时间" min-width="160" />
|
||||
<el-table-column label="操作" width="200" fixed="right">
|
||||
<el-table-column label="操作" width="280" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button text type="primary" v-auth="'supermarket_smHotelOrder_view'" @click="openDetail(scope.row)">
|
||||
详情
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="canConfirmLocal(scope.row)"
|
||||
text
|
||||
type="success"
|
||||
v-auth="'supermarket_smHotelOrder_cancel'"
|
||||
@click="handleConfirmLocal(scope.row)"
|
||||
>
|
||||
确认接单
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="canConfirmLocal(scope.row)"
|
||||
text
|
||||
type="danger"
|
||||
v-auth="'supermarket_smHotelOrder_cancel'"
|
||||
@click="handleRejectLocal(scope.row)"
|
||||
>
|
||||
拒绝
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="canRefund(scope.row)"
|
||||
text
|
||||
@@ -401,6 +419,25 @@
|
||||
</el-collapse>
|
||||
|
||||
<div class="mt-4 flex gap-2 flex-wrap">
|
||||
<el-button
|
||||
v-if="canConfirmLocal(detailOrder)"
|
||||
type="success"
|
||||
v-auth="'supermarket_smHotelOrder_cancel'"
|
||||
:loading="detailActing"
|
||||
@click="handleConfirmLocal(detailOrder)"
|
||||
>
|
||||
确认接单
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="canConfirmLocal(detailOrder)"
|
||||
type="danger"
|
||||
plain
|
||||
v-auth="'supermarket_smHotelOrder_cancel'"
|
||||
:loading="detailActing"
|
||||
@click="handleRejectLocal(detailOrder)"
|
||||
>
|
||||
拒绝
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="canRefund(detailOrder)"
|
||||
type="danger"
|
||||
@@ -473,6 +510,8 @@ import {
|
||||
fetchList,
|
||||
getObj,
|
||||
cancelOrder,
|
||||
confirmOrder,
|
||||
rejectOrder,
|
||||
compensateOrder,
|
||||
refundOrder,
|
||||
listOrderSourceOptions,
|
||||
@@ -770,23 +809,55 @@ const confirmPull = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
const canRefund = (row: any) => row?.payStatus === "PAID"
|
||||
const canRefund = (row: any) => row?.payStatus === "PAID" && row?.orderStatus !== "PENDING_CONFIRM"
|
||||
|
||||
const canCancel = (row: any) =>
|
||||
row?.orderStatus !== "CANCELLED" && row?.payStatus !== "PAID" && row?.payStatus !== "REFUNDED"
|
||||
row?.orderStatus !== "CANCELLED" &&
|
||||
row?.orderStatus !== "PENDING_CONFIRM" &&
|
||||
row?.payStatus !== "PAID" &&
|
||||
row?.payStatus !== "REFUNDED"
|
||||
|
||||
const canCompensate = (row: any) =>
|
||||
row?.compensateStatus === "WAITING" ||
|
||||
row?.compensateStatus === "NEED_MANUAL" ||
|
||||
row?.orderStatus === "PENDING_CONFIRM"
|
||||
(row?.compensateStatus === "WAITING" || row?.compensateStatus === "NEED_MANUAL") &&
|
||||
row?.orderStatus !== "PENDING_CONFIRM"
|
||||
|
||||
/** 本地数据源且待确认:可人工确认/拒绝 */
|
||||
const canConfirmLocal = (row: any) => {
|
||||
if (!row || row.orderStatus !== "PENDING_CONFIRM") return false
|
||||
const ds = String(row.hotelDataSource || detailHotel.value?.dataSource || detailHotel.value?.sheetName || "")
|
||||
.trim()
|
||||
.toLowerCase()
|
||||
// 列表已带回 hotelDataSource;详情里可从酒店实体兜底
|
||||
if (ds) return ds === "local"
|
||||
// 无来源字段时仍允许操作(后端再校验本地源)
|
||||
return String(row.platformNo || "").startsWith("LOCAL-")
|
||||
}
|
||||
|
||||
const quickFilter = (type: string) => {
|
||||
if (type === "APP") {
|
||||
state.queryForm = { ...state.queryForm, channelNo: "APP", platformNo: "" }
|
||||
state.queryForm = {
|
||||
...state.queryForm,
|
||||
channelNo: "APP",
|
||||
platformNo: "",
|
||||
orderStatus: "",
|
||||
hotelDataSource: "",
|
||||
}
|
||||
} else if (type === "LOCAL") {
|
||||
state.queryForm = { ...state.queryForm, channelNo: "", platformNo: "LOCAL-" }
|
||||
state.queryForm = {
|
||||
...state.queryForm,
|
||||
channelNo: "",
|
||||
platformNo: "",
|
||||
orderStatus: "PENDING_CONFIRM",
|
||||
hotelDataSource: "local",
|
||||
}
|
||||
} else {
|
||||
state.queryForm = { ...state.queryForm, channelNo: "", platformNo: "" }
|
||||
state.queryForm = {
|
||||
...state.queryForm,
|
||||
channelNo: "",
|
||||
platformNo: "",
|
||||
orderStatus: "",
|
||||
hotelDataSource: "",
|
||||
}
|
||||
}
|
||||
getDataList()
|
||||
}
|
||||
@@ -851,6 +922,47 @@ const handleCancel = async (row: any) => {
|
||||
}
|
||||
}
|
||||
|
||||
const handleConfirmLocal = async (row: any) => {
|
||||
try {
|
||||
await useMessageBox().confirm(`确认接单 ${row.channelNo}?接单后订单将变为预订成功。`)
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
detailActing.value = true
|
||||
try {
|
||||
await confirmOrder(row.id)
|
||||
useMessage().success("已确认接单")
|
||||
await refreshAfterAction()
|
||||
} catch (err: any) {
|
||||
useMessage().error(err?.msg || err?.message || "确认失败")
|
||||
} finally {
|
||||
detailActing.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleRejectLocal = async (row: any) => {
|
||||
const paid = row?.payStatus === "PAID"
|
||||
try {
|
||||
await useMessageBox().confirm(
|
||||
paid
|
||||
? `拒绝订单 ${row.channelNo}?将取消预订、释放库存并原路退款 ${formatAmount(row.sellAmount)}。`
|
||||
: `拒绝订单 ${row.channelNo}?将取消预订并释放库存。`,
|
||||
)
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
detailActing.value = true
|
||||
try {
|
||||
await rejectOrder(row.id)
|
||||
useMessage().success(paid ? "已拒绝并退款" : "已拒绝")
|
||||
await refreshAfterAction()
|
||||
} catch (err: any) {
|
||||
useMessage().error(err?.msg || err?.message || "拒绝失败")
|
||||
} finally {
|
||||
detailActing.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleRefund = async (row: any) => {
|
||||
try {
|
||||
await useMessageBox().confirm(
|
||||
|
||||
Reference in new issue
Block a user