取消工单功能
This commit is contained in:
@@ -12,7 +12,7 @@
|
|||||||
"0": "状态",
|
"0": "状态",
|
||||||
"1": "待跟进",
|
"1": "待跟进",
|
||||||
"2": "待回复",
|
"2": "待回复",
|
||||||
"3": "已解决",
|
"3": "已取消",
|
||||||
"4": "已关闭"
|
"4": "已关闭"
|
||||||
},
|
},
|
||||||
"ticketList": "工单列表",
|
"ticketList": "工单列表",
|
||||||
|
|||||||
@@ -79,8 +79,45 @@ export default function Page() {
|
|||||||
action={ref}
|
action={ref}
|
||||||
actions={{
|
actions={{
|
||||||
render(row) {
|
render(row) {
|
||||||
if (row.status !== 4) {
|
if (row.status === 1) {
|
||||||
return [
|
return [
|
||||||
|
<ConfirmButton
|
||||||
|
cancelText={t("cancel", "Cancel")}
|
||||||
|
confirmText={t("confirm", "Confirm")}
|
||||||
|
description="您确定要取消此次打款吗?取消后系统将记录此操作并关闭工单。"
|
||||||
|
key="cancel-payout"
|
||||||
|
onConfirm={async () => {
|
||||||
|
setLoadingId(row.id);
|
||||||
|
try {
|
||||||
|
await updateTicketStatus({
|
||||||
|
id: row.id,
|
||||||
|
status: 3,
|
||||||
|
});
|
||||||
|
toast.success("已取消打款并关闭工单");
|
||||||
|
ref.current?.refresh();
|
||||||
|
} catch (e) {
|
||||||
|
console.error("Cancel payout failed", e);
|
||||||
|
toast.error("取消打款失败");
|
||||||
|
}
|
||||||
|
setLoadingId(null);
|
||||||
|
}}
|
||||||
|
title="确认取消打款?"
|
||||||
|
trigger={
|
||||||
|
<Button
|
||||||
|
className="mr-2"
|
||||||
|
disabled={loadingId === row.id}
|
||||||
|
variant="outline"
|
||||||
|
>
|
||||||
|
{loadingId === row.id && (
|
||||||
|
<Icon
|
||||||
|
className="mr-2 animate-spin"
|
||||||
|
icon="lucide:loader-2"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
取消打款
|
||||||
|
</Button>
|
||||||
|
}
|
||||||
|
/>,
|
||||||
<ConfirmButton
|
<ConfirmButton
|
||||||
cancelText={t("cancel", "Cancel")}
|
cancelText={t("cancel", "Cancel")}
|
||||||
confirmText={t("confirm", "Confirm")}
|
confirmText={t("confirm", "Confirm")}
|
||||||
@@ -104,8 +141,10 @@ export default function Page() {
|
|||||||
const titleStr = row.title || "";
|
const titleStr = row.title || "";
|
||||||
const parts = titleStr.split("-");
|
const parts = titleStr.split("-");
|
||||||
if (parts.length > 1) {
|
if (parts.length > 1) {
|
||||||
const deductAmount = Number.parseFloat(parts[1]);
|
const deductAmount = Number.parseFloat(
|
||||||
if (!isNaN(deductAmount)) {
|
parts?.[1] ?? "0"
|
||||||
|
);
|
||||||
|
if (!Number.isNaN(deductAmount)) {
|
||||||
const res = await getUserDetail({ id: row.user_id });
|
const res = await getUserDetail({ id: row.user_id });
|
||||||
const user = res?.data?.data;
|
const user = res?.data?.data;
|
||||||
if (user && typeof user.commission !== "undefined") {
|
if (user && typeof user.commission !== "undefined") {
|
||||||
@@ -194,11 +233,13 @@ export default function Page() {
|
|||||||
const parts = desc.split("-");
|
const parts = desc.split("-");
|
||||||
if (parts.length < 2) return "";
|
if (parts.length < 2) return "";
|
||||||
const content = parts[1];
|
const content = parts[1];
|
||||||
if (content.startsWith("data:image/")) {
|
if (content?.startsWith("data:image/")) {
|
||||||
return (
|
return (
|
||||||
<img
|
<img
|
||||||
alt="withdrawal"
|
alt="withdrawal"
|
||||||
className="h-10 w-10 cursor-zoom-in rounded border object-cover"
|
className="h-10 w-10 cursor-zoom-in rounded border object-cover"
|
||||||
|
width={40} // 这里的数值根据你的 UI 设计调整
|
||||||
|
height={40}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
const win = window.open();
|
const win = window.open();
|
||||||
win?.document.write(`<img src="${content}" />`);
|
win?.document.write(`<img src="${content}" />`);
|
||||||
|
|||||||
Reference in New Issue
Block a user