perf: 商业版提现增加收款二维码上传

This commit is contained in:
xiaojunnuo
2026-05-19 23:37:03 +08:00
parent 85c633fddf
commit 83a5a21f95
8 changed files with 108 additions and 17 deletions
@@ -1,4 +1,4 @@
import { CreateCrudOptionsRet, dict, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
import { CreateCrudOptionsRet, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
import * as api from "./api";
import PriceInput from "/@/views/sys/suite/product/price-input.vue";
@@ -14,14 +14,6 @@ export default function (): CreateCrudOptionsRet {
toolbar: { show: false },
rowHandle: { show: false },
columns: {
type: {
title: "类型",
type: "dict-select",
dict: dict({
data: [{ label: "佣金入账", value: "commission", color: "success" }],
}),
column: { width: 130 },
},
amount: {
title: "金额",
type: "number",
@@ -30,10 +22,25 @@ export default function (): CreateCrudOptionsRet {
component: { name: PriceInput, vModel: "modelValue", edit: false },
},
},
inviteeUserDisplay: {
simpleUser: {
title: "被邀请用户",
type: "text",
column: { width: 150 },
column: {
width: 170,
cellRender({ row }) {
const simpleUser = row.simpleUser;
if (!simpleUser) {
return "-";
}
return (
<div class="leading-5">
<div>
{simpleUser.username || "-"} ({simpleUser.id})
</div>
</div>
);
},
},
},
consumeAmount: {
title: "消费金额",
@@ -48,6 +48,19 @@ export default function (): CreateCrudOptionsRet {
realName: { title: "真实姓名", type: "text", column: { width: 120 } },
account: { title: "收款账号", type: "text", column: { width: 180 } },
bankName: { title: "开户银行", type: "text", column: { width: 160 } },
qrCode: {
title: "收款二维码",
type: "text",
column: {
width: 120,
cellRender({ value }) {
if (!value) {
return "-";
}
return <a-image src={`/api/basic/file/download?key=${value}`} width={48} />;
},
},
},
auditRemark: { title: "审核备注", type: "text", column: { minWidth: 180 } },
createTime: { title: "申请时间", type: "datetime", column: { width: 180 } },
},
@@ -40,6 +40,7 @@ import * as api from "./api";
import createWithdrawCrudOptions from "./crud-withdraw";
import { util } from "/@/utils";
import { useFormDialog } from "/@/use/use-dialog";
import { useUserStore } from "/@/store/user";
defineOptions({ name: "MyWallet" });
@@ -47,6 +48,7 @@ const summary = reactive<any>({ availableAmount: 0, frozenAmount: 0, totalIncome
const withdrawAmountYuan = ref(0);
const loaded = ref(false);
const { openFormDialog } = useFormDialog();
const userStore = useUserStore();
const { crudBinding: withdrawCrudBinding, crudExpose: withdrawCrudExpose, crudRef: withdrawCrudRef } = useFs({ createCrudOptions: createWithdrawCrudOptions });
function amountToYuan(amount: number) {
@@ -98,6 +100,37 @@ async function openWithdrawSetting() {
rules: [{ required: true, message: "请输入收款账号" }],
},
},
qrCode: {
title: "收款二维码",
type: "cropper-uploader",
form: {
col: { span: 24 },
component: {
vModel: "modelValue",
valueType: "key",
cropper: {
aspectRatio: 1,
autoCropArea: 1,
viewMode: 0,
},
onReady: null,
uploader: {
type: "form",
action: "/basic/file/upload?token=" + userStore.getToken,
name: "file",
headers: {
Authorization: "Bearer " + userStore.getToken,
},
successHandle(res: any) {
return res;
},
},
buildUrl(key: string) {
return `/api/basic/file/download?key=` + key;
},
},
},
},
bankName: {
title: "开户银行",
type: "text",
@@ -1,5 +1,5 @@
import { compute, CreateCrudOptionsProps, CreateCrudOptionsRet, dict, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
import { Modal, notification } from "ant-design-vue";
import { notification } from "ant-design-vue";
import * as api from "./api";
import PriceInput from "/@/views/sys/suite/product/price-input.vue";
import { useFormDialog } from "/@/use/use-dialog";
@@ -11,10 +11,29 @@ export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOpti
return await api.GetWithdraws(query);
};
function renderWithdrawDetail(row: any) {
return (
<a-descriptions class={"w-full"} bordered column={2} size={"small"}>
<a-descriptions-item label="渠道类型">{row.channel === "bank" ? "银行卡" : "支付宝"}</a-descriptions-item>
<a-descriptions-item label="用户名">{row.userDisplay || row.userId}</a-descriptions-item>
<a-descriptions-item label="账号">{row.account || "-"}</a-descriptions-item>
<a-descriptions-item label="开户行名称">{row.bankName || "-"}</a-descriptions-item>
<a-descriptions-item label="收款二维码" span={2}>
{row.qrCode ? <a-image src={`/api/basic/file/download?key=${row.qrCode}`} width={160} /> : <span>-</span>}
</a-descriptions-item>
<a-descriptions-item label="提现金额">{row.amount / 100} </a-descriptions-item>
</a-descriptions>
);
}
async function approve(row: any) {
Modal.confirm({
title: "确认提现已线下打款?",
async onOk() {
await openFormDialog({
title: "提现审核",
wrapper: {
width: 760,
},
body: () => renderWithdrawDetail(row),
onSubmit: async () => {
await api.ApproveWithdraw(row.id);
await crudExpose.doRefresh();
notification.success({ message: "已审核通过" });
@@ -24,13 +43,14 @@ export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOpti
async function reject(row: any) {
await openFormDialog({
title: "拒绝提现申请",
title: "提现审核",
wrapper: {
width: 520,
width: 760,
},
initialForm: {
remark: "",
},
body: () => renderWithdrawDetail(row),
columns: {
remark: {
title: "拒绝理由",
@@ -99,6 +119,7 @@ export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOpti
component: { name: PriceInput, vModel: "modelValue", edit: false },
},
},
userDisplay: { title: "用户名", type: "text", search: { show: true }, column: { width: 140 } },
status: {
title: "状态",
type: "dict-select",
@@ -127,6 +148,19 @@ export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOpti
realName: { title: "真实姓名", type: "text", search: { show: true }, column: { width: 120 } },
account: { title: "收款账号", type: "text", column: { width: 180 } },
bankName: { title: "开户银行", type: "text", column: { width: 160 } },
qrCode: {
title: "收款二维码",
type: "text",
column: {
width: 120,
cellRender({ value }) {
if (!value) {
return "-";
}
return <a-image src={`/api/basic/file/download?key=${value}`} width={48} />;
},
},
},
auditRemark: { title: "审核备注", type: "text", column: { minWidth: 180 } },
createTime: { title: "申请时间", type: "datetime", column: { width: 180 } },
},
@@ -78,6 +78,7 @@ CREATE TABLE `cd_user_wallet_withdraw`
`real_name` varchar(100),
`account` varchar(200),
`bank_name` varchar(200),
`qr_code` varchar(512),
`audit_user_id` bigint,
`audit_remark` varchar(2048),
`audit_time` bigint,
@@ -78,6 +78,7 @@ CREATE TABLE "cd_user_wallet_withdraw"
"real_name" varchar(100),
"account" varchar(200),
"bank_name" varchar(200),
"qr_code" varchar(512),
"audit_user_id" bigint,
"audit_remark" varchar(2048),
"audit_time" bigint,
@@ -78,6 +78,7 @@ CREATE TABLE "cd_user_wallet_withdraw"
"real_name" varchar(100),
"account" varchar(200),
"bank_name" varchar(200),
"qr_code" varchar(512),
"audit_user_id" integer,
"audit_remark" varchar(2048),
"audit_time" integer,
@@ -136,5 +136,6 @@ export class MainConfiguration {
logger.info('当前环境:', this.app.getEnv()); // prod
// throw new Error("address family not supported")
}
}