test 9 months ago
parent
commit
c2a59a3803

+ 148 - 9
build/cool/temp/eps.d.ts

@@ -603,6 +603,45 @@ declare namespace Eps {
 		 * 通道编码
 		 */
 		code?: string;
+		/**
+		 * 权重
+		 */
+		weight?: number;
+		/**
+		 * 状态 0-未启用 1 启用
+		 */
+		status?: boolean;
+		/**
+		 * 创建时间
+		 */
+		createTime?: Date;
+		/**
+		 * 更新时间
+		 */
+		updateTime?: Date;
+		/**
+		 * 任意键值
+		 */
+		[key: string]: any;
+	}
+
+	interface MchWithdrawChannelEntity {
+		/**
+		 * ID
+		 */
+		id?: number;
+		/**
+		 * 商户号
+		 */
+		mchId?: string;
+		/**
+		 * 货币
+		 */
+		currency?: string;
+		/**
+		 * 通道编码
+		 */
+		code?: string;
 		/**
 		 * 状态 0-未启用 1 启用
 		 */
@@ -658,10 +697,6 @@ declare namespace Eps {
 		 * secret
 		 */
 		secret?: string;
-		/**
-		 * 可用币种
-		 */
-		currency?: string;
 		/**
 		 * IP白名单
 		 */
@@ -701,6 +736,10 @@ declare namespace Eps {
 		 * 交易号
 		 */
 		traceNo?: string;
+		/**
+		 * 支付方式
+		 */
+		payType?: string;
 		/**
 		 * 通道码
 		 */
@@ -2349,6 +2388,10 @@ declare namespace Eps {
 	}
 
 	interface DjComm {
+		/**
+		 * 代付通道列表
+		 */
+		getWithdrawChannels(data?: any): Promise<any>;
 		/**
 		 * 商户列表
 		 */
@@ -2405,6 +2448,7 @@ declare namespace Eps {
 		 * 权限标识
 		 */
 		permission: {
+			getWithdrawChannels: string;
 			getMerchants: string;
 			getCurrency: string;
 			getPayTypes: string;
@@ -2422,6 +2466,7 @@ declare namespace Eps {
 		 * 权限状态
 		 */
 		_permission: {
+			getWithdrawChannels: boolean;
 			getMerchants: boolean;
 			getCurrency: boolean;
 			getPayTypes: boolean;
@@ -2612,6 +2657,63 @@ declare namespace Eps {
 		request: Service["request"];
 	}
 
+	interface DjMchWithdrawChannel {
+		/**
+		 * 删除
+		 */
+		delete(data?: any): Promise<any>;
+		/**
+		 * 修改
+		 */
+		update(data?: any): Promise<any>;
+		/**
+		 * 列表查询
+		 */
+		list(data?: any): Promise<MchWithdrawChannelEntity[]>;
+		/**
+		 * 单个信息
+		 */
+		info(data?: any): Promise<MchWithdrawChannelEntity>;
+		/**
+		 * 分页查询
+		 */
+		page(data?: any): Promise<{
+			pagination: { size: number; page: number; total: number };
+			list: MchWithdrawChannelEntity[];
+			[key: string]: any;
+		}>;
+		/**
+		 * 新增
+		 */
+		add(data?: any): Promise<any>;
+		/**
+		 * 权限标识
+		 */
+		permission: {
+			delete: string;
+			update: string;
+			list: string;
+			info: string;
+			page: string;
+			add: string;
+		};
+		/**
+		 * 权限状态
+		 */
+		_permission: {
+			delete: boolean;
+			update: boolean;
+			list: boolean;
+			info: boolean;
+			page: boolean;
+			add: boolean;
+		};
+		/**
+		 * 请求
+		 */
+		request: Service["request"];
+	}
+
 	interface DjMerchant {
 		/**
 		 * 生成谷歌验证码
@@ -2719,9 +2821,13 @@ declare namespace Eps {
 		 */
 		toPay(data?: any): Promise<any>;
 		/**
-		 * 代查询
+		 * 代查询
 		 */
 		withdrawQuery(data?: any): Promise<any>;
+		/**
+		 * 余额查询
+		 */
+		queryBalance(data?: any): Promise<any>;
 		/**
 		 * 回调通知
 		 */
@@ -2780,6 +2886,7 @@ declare namespace Eps {
 			basic: string;
 			toPay: string;
 			withdrawQuery: string;
+			queryBalance: string;
 			notifyTest: string;
 			withdraw: string;
 			order: string;
@@ -2805,6 +2912,7 @@ declare namespace Eps {
 			basic: boolean;
 			toPay: boolean;
 			withdrawQuery: boolean;
+			queryBalance: boolean;
 			notifyTest: boolean;
 			withdraw: boolean;
 			order: boolean;
@@ -2839,6 +2947,10 @@ declare namespace Eps {
 		 * 查单
 		 */
 		query(data?: any): Promise<any>;
+		/**
+		 * 获取订单通道编码
+		 */
+		code(data?: any): Promise<any>;
 		/**
 		 * 单个信息
 		 */
@@ -2851,6 +2963,10 @@ declare namespace Eps {
 			list: OrderEntity[];
 			[key: string]: any;
 		}>;
+		/**
+		 * 获取订单商户编码
+		 */
+		mch(data?: any): Promise<any>;
 		/**
 		 * list
 		 */
@@ -2871,8 +2987,10 @@ declare namespace Eps {
 			notify: string;
 			update: string;
 			query: string;
+			code: string;
 			info: string;
 			page: string;
+			mch: string;
 			list: string;
 			delete: string;
 			add: string;
@@ -2885,8 +3003,10 @@ declare namespace Eps {
 			notify: boolean;
 			update: boolean;
 			query: boolean;
+			code: boolean;
 			info: boolean;
 			page: boolean;
+			mch: boolean;
 			list: boolean;
 			delete: boolean;
 			add: boolean;
@@ -3070,9 +3190,13 @@ declare namespace Eps {
 
 	interface DjWithdraw {
 		/**
-		 * 发起代付
+		 * 统计
 		 */
-		withdraw(data?: any): Promise<any>;
+		summary(data?: any): Promise<any>;
+		/**
+		 * 通知
+		 */
+		notify(data?: any): Promise<any>;
 		/**
 		 * 修改
 		 */
@@ -3081,6 +3205,10 @@ declare namespace Eps {
 		 * 查单
 		 */
 		query(data?: any): Promise<any>;
+		/**
+		 * 获取订单通道编码
+		 */
+		code(data?: any): Promise<any>;
 		/**
 		 * 单个信息
 		 */
@@ -3093,6 +3221,10 @@ declare namespace Eps {
 			list: WithdrawEntity[];
 			[key: string]: any;
 		}>;
+		/**
+		 * 获取订单商户编码
+		 */
+		mch(data?: any): Promise<any>;
 		/**
 		 * 新增
 		 */
@@ -3109,11 +3241,14 @@ declare namespace Eps {
 		 * 权限标识
 		 */
 		permission: {
-			withdraw: string;
+			summary: string;
+			notify: string;
 			update: string;
 			query: string;
+			code: string;
 			info: string;
 			page: string;
+			mch: string;
 			add: string;
 			list: string;
 			delete: string;
@@ -3122,11 +3257,14 @@ declare namespace Eps {
 		 * 权限状态
 		 */
 		_permission: {
-			withdraw: boolean;
+			summary: boolean;
+			notify: boolean;
 			update: boolean;
 			query: boolean;
+			code: boolean;
 			info: boolean;
 			page: boolean;
+			mch: boolean;
 			add: boolean;
 			list: boolean;
 			delete: boolean;
@@ -3553,6 +3691,7 @@ declare namespace Eps {
 			currency: DjCurrency;
 			kyc: DjKyc;
 			mchChannel: DjMchChannel;
+			mchWithdrawChannel: DjMchWithdrawChannel;
 			merchant: DjMerchant;
 			open: DjOpen;
 			order: DjOrder;

File diff suppressed because it is too large
+ 0 - 0
build/cool/temp/eps.json


+ 1 - 0
src/modules/dj/views/currency.vue

@@ -49,6 +49,7 @@ const Upsert = useUpsert({
 
 // cl-table
 const Table = useTable({
+	autoHeight: false,
 	columns: [
 		{ type: "selection" },
 		{ prop: "currency", label: "货币" },

+ 1 - 0
src/modules/dj/views/kyc.vue

@@ -59,6 +59,7 @@ const Upsert = useUpsert({
 
 // cl-table
 const Table = useTable({
+	autoHeight: false,
 	columns: [
 		{ type: "selection" },
 		{ prop: "mchId", label: "商户号" },

+ 34 - 3
src/modules/dj/views/mchChannel.vue

@@ -45,12 +45,32 @@ const items = ref<ClForm.Item[]>([
 		}
 	},
 	{
-		label: "支付通道",
+		label: "通道编码",
 		prop: "code",
 		component: {
 			name: "el-input"
 		}
 	},
+	{
+		label: "状态",
+		prop: "status",
+		component: {
+			name: "el-select",
+			props: {
+				clearable: true
+			},
+			options: [
+				{
+					label: "启用",
+					value: 1
+				},
+				{
+					label: "停用",
+					value: 0
+				},
+			]
+		}
+	},
 ]);
 
 // cl-upsert
@@ -91,7 +111,7 @@ const Upsert = useUpsert({
 			required: true
 		},
 		{
-			label: "支付通道",
+			label: "通道编码",
 			prop: "code",
 			component: {
 				name: "el-select",
@@ -109,6 +129,16 @@ const Upsert = useUpsert({
 			},
 			required: true
 		},
+		{
+			prop: "weight",
+			label: "权重",
+			required: true,
+			component: {
+				name: "el-input-number",
+				props: { style: { width: "200px" }, precision: 0, min: 0 }
+			},
+			span: 12
+		},
 		{ prop: "status", label: "状态", component: { name: "cl-switch" }, required: true }
 	],
 	async onOpen(data) {
@@ -147,14 +177,15 @@ const Upsert = useUpsert({
 
 // cl-table
 const Table = useTable({
+	autoHeight: false,
 	columns: [
-		{ type: "selection" },
 		{ prop: "mchId", label: "商户号" },
 		{ prop: "payType", label: "支付方式" },
 		{
 			prop: "code",
 			label: "通道编码",
 		},
+		{ prop: "weight", label: "权重" },
 		{ prop: "status", label: "状态", component: { name: "cl-switch" } },
 		{ type: "op", buttons: ["edit", "delete"] }
 	]

+ 174 - 0
src/modules/dj/views/mchWithdrawChannel.vue

@@ -0,0 +1,174 @@
+<template>
+	<cl-crud ref="Crud">
+		<cl-row>
+			<cl-filter-group :items="items" :reset-btn="true" />
+			<cl-add-btn />
+		</cl-row>
+
+		<cl-row>
+			<!-- 数据表格 -->
+			<cl-table ref="Table" />
+		</cl-row>
+
+		<cl-row>
+			<cl-flex1 />
+			<!-- 分页控件 -->
+			<cl-pagination />
+		</cl-row>
+
+		<!-- 新增、编辑 -->
+		<cl-upsert ref="Upsert" />
+	</cl-crud>
+</template>
+
+<script lang="ts" name="dj-mchWithdrawChannel" setup>
+import { useCrud, useTable, useUpsert } from "@cool-vue/crud";
+import { useCool } from "/@/cool";
+import { ref } from "vue";
+
+const { service } = useCool();
+
+const items = ref<ClForm.Item[]>([
+	{
+		label: "商户号",
+		prop: "mchId",
+		component: {
+			name: "el-input"
+		}
+	},
+	{
+		label: "货币",
+		prop: "currency",
+		component: {
+			name: "el-input"
+		}
+	},
+	{
+		label: "通道编码",
+		prop: "code",
+		component: {
+			name: "el-input"
+		}
+	},
+	{
+		label: "状态",
+		prop: "status",
+		component: {
+			name: "el-select",
+			props: {
+				clearable: true
+			},
+			options: [
+				{
+					label: "启用",
+					value: 1
+				},
+				{
+					label: "停用",
+					value: 0
+				},
+			]
+		}
+	},
+]);
+
+// cl-upsert
+const Upsert = useUpsert({
+	items: [
+		{
+			prop: "mchId",
+			label: "商户号",
+			required: true,
+			component: {
+				name: "el-select",
+				options: [],
+				props: {
+					filterable: true,
+				}
+			}
+		},
+		{
+			prop: "currency",
+			label: "货币",
+			required: true,
+			component: {
+				name: "el-select",
+				options: [],
+				props: {
+					filterable: true,
+				}
+			}
+		},
+		{
+			label: "通道编码",
+			prop: "code",
+			component: {
+				name: "el-select",
+				options: [],
+				props: {
+					filterable: true,
+				}
+			},
+			required: true
+		},
+		{ prop: "status", label: "状态", component: { name: "cl-switch" }, required: true }
+	],
+	async onOpen(data) {
+		const merchantList = await service.dj.comm.getMerchants();
+		Upsert.value?.setOptions(
+			'mchId',
+			merchantList.map((item: any) => {
+				return {
+					label: item.name + '(' + item.mchId + ')',
+					value: item.mchId
+				}
+			})
+		);
+		const currencyList = await service.dj.comm.getCurrency();
+		Upsert.value?.setOptions(
+			'currency',
+			currencyList.map((item: string) => {
+				return {
+					label: item,
+					value: item
+				}
+			})
+		);
+		const withdrawChannels = await service.dj.comm.getWithdrawChannels();
+		Upsert.value?.setOptions(
+			'code',
+			withdrawChannels.map((item: any) => {
+				return {
+					label: item.code + ' ( ' + item.currency + ' ) ',
+					value: item.code
+				}
+			})
+		);
+	}
+});
+
+// cl-table
+const Table = useTable({
+	autoHeight: false,
+	columns: [
+		{ prop: "mchId", label: "商户号" },
+		{ prop: "currency", label: "货币" },
+		{
+			prop: "code",
+			label: "通道编码",
+		},
+		{ prop: "status", label: "状态", component: { name: "cl-switch" } },
+		{ type: "op", buttons: ["edit", "delete"] }
+	]
+});
+
+// cl-crud
+const Crud = useCrud(
+	{
+		service: service.dj.mchWithdrawChannel
+	},
+	(app) => {
+		app.refresh();
+	}
+);
+</script>

+ 30 - 12
src/modules/dj/views/order.vue

@@ -115,6 +115,14 @@ const items = ref<ClForm.Item[]>([
 	{
 		label: "商户号",
 		prop: "mchId",
+		component: {
+			name: "el-input"
+		},
+		hidden: !checkPerm(service.dj.order.permission.mch)
+	},
+	{
+		label: "支付方式",
+		prop: "payType",
 		component: {
 			name: "el-input"
 		}
@@ -124,7 +132,8 @@ const items = ref<ClForm.Item[]>([
 		prop: "code",
 		component: {
 			name: "el-input"
-		}
+		},
+		hidden: !checkPerm(service.dj.order.permission.code)
 	},
 	{
 		label: "支付状态",
@@ -304,17 +313,18 @@ const Table = useTable({
 				prop: "detail"
 			};
 		},
-		{ prop: "orderNo", label: "订单号", showOverflowTooltip: true },
-		{ prop: "outOrderNo", label: "商户订单号", showOverflowTooltip: true },
-		{ prop: "traceNo", label: "交易号", showOverflowTooltip: true },
-		{ prop: "mchId", label: "商户号" },
-		{ prop: "code", label: "通道编码" },
+		{ prop: "orderNo", label: "订单号", showOverflowTooltip: true, width: 120 },
+		{ prop: "outOrderNo", label: "商户订单号", showOverflowTooltip: true, width: 120 },
+		{ prop: "traceNo", label: "交易号", showOverflowTooltip: true, width: 120 },
+		{
+			prop: "mchId", label: "商户号", hidden: !checkPerm(service.dj.order.permission.mch), width: 90
+		},
 		{
 			prop: "amount",
 			label: "金额",
 			width: 90,
 			formatter(row) {
-				return (+row.amount).toFixed(2) + ' ' + row.currency;
+				return (+row.amount).toFixed(2);
 			}
 		},
 		{
@@ -322,10 +332,13 @@ const Table = useTable({
 			label: "手续费",
 			width: 90,
 			formatter(row) {
-				return (+row.amount).toFixed(2) + ' ' + row.currency;
+				return (+row.amount).toFixed(2);
 			}
 		},
-		{ prop: "createTime", label: "创建时间" },
+		{
+			prop: "currency",
+			label: "货币"
+		},
 		// { prop: "date", label: "付款时间" },
 		{
 			prop: "status",
@@ -334,7 +347,7 @@ const Table = useTable({
 				{ label: "待支付", value: 0, color: "#909399" },
 				{ label: "支付成功", value: 1, color: "#67C23A" },
 				{ label: "下单失败", value: 2, color: "#F56C6C" }
-			]
+			], width: 90
 		},
 		{
 			prop: "notifyStatus",
@@ -343,12 +356,17 @@ const Table = useTable({
 				{ label: "未通知", value: 0, color: "#909399" },
 				{ label: "已通知", value: 1, color: "#67C23A" },
 				{ label: "通知失败", value: 2, color: "#F56C6C" }
-			]
+			], width: 90
+		},
+		{ prop: "payType", label: "支付方式", showOverflowTooltip: true, width: 90 },
+		{
+			prop: "code", label: "通道编码", hidden: !checkPerm(service.dj.order.permission.code), width: 120
 		},
+		{ prop: "createTime", label: "创建时间", width: 155 },
 		// { prop: "remark", label: "备注", showOverflowTooltip: true },
 		{
 			type: "op",
-			width: 204,
+			width: checkPerm(service.dj.order.permission.update) ? 210 : 120,
 			buttons({ scope }) {
 				const btns = [];
 				if (checkPerm(service.dj.order.permission.update)) {

+ 1 - 0
src/modules/dj/views/payType.vue

@@ -95,6 +95,7 @@ const Upsert = useUpsert({
 
 // cl-table
 const Table = useTable({
+	autoHeight: false,
 	columns: [
 		{ type: "selection" },
 		{ prop: "payType", label: "支付方式" },

+ 1 - 1
src/modules/dj/views/rate.vue

@@ -135,7 +135,6 @@ const Upsert = useUpsert({
 				name: "el-select",
 				options: [],
 			},
-			required: true
 		},
 		{
 			prop: "rate",
@@ -203,6 +202,7 @@ const Upsert = useUpsert({
 
 // cl-table
 const Table = useTable({
+	autoHeight: false,
 	columns: [
 		{ prop: "mchId", label: "商户号" },
 		{ prop: "currency", label: "货币" },

+ 0 - 3
src/modules/dj/views/toWithdraw.vue

@@ -26,9 +26,6 @@
         <el-form-item label="货币单位(currency)" required>
           <el-input v-model="form.currency" />
         </el-form-item>
-        <el-form-item label="代付类型(payType)">
-          <el-input v-model="form.payType" />
-        </el-form-item>
         <el-form-item label="银行账号(accountNo)" required>
           <el-input v-model="form.accountNo" />
         </el-form-item>

+ 6 - 0
src/modules/dj/views/wallet.vue

@@ -137,11 +137,17 @@ const Upsert = useUpsert({
 
 // cl-table
 const Table = useTable({
+	autoHeight: false,
 	columns: [
 		{ prop: "mchId", label: "商户号", sortable: "custom", },
 		{ prop: "currency", label: "货币", sortable: "custom", },
 		{ prop: "balance", label: "余额", sortable: "custom", },
 		{ prop: "freeze", label: "冻结中余额", sortable: "custom", },
+		{
+			prop: "use", label: "可提现余额", sortable: "custom", formatter(row) {
+				return (+row.balance - +row.freeze).toFixed(2);
+			}
+		},
 		{ prop: "updateTime", label: "更新时间", sortable: "custom", width: 160 },
 		{ type: "op", buttons: ["slot-info", "edit", "delete"] }
 

+ 303 - 112
src/modules/dj/views/withdraw.vue

@@ -7,14 +7,13 @@
 
 		<cl-row>
 			<el-checkbox v-model="showSummary" label="统计数据" size="small" />
-			<el-tag v-if="showSummary" class="ml-2" effect="light">代付成功金额: {{ summary.num1 }}</el-tag>
-			<el-tag v-if="showSummary" class="ml-2" effect="light">成功订单数: {{ summary.num2 }}</el-tag>
-			<el-tag v-if="showSummary && checkPerm(service.dj.withdraw.permission.update)" class="ml-2"
-				effect="light">通道手续费: {{ summary.num5.toFixed(2) }}</el-tag>
-			<el-tag v-if="showSummary" class="ml-2" effect="light">成功手续费: {{ summary.num3 }}</el-tag>
+			<el-tag v-if="showSummary" class="ml-2" effect="light">成功金额: {{ summary.num1 }}</el-tag>
+			<el-tag v-if="showSummary" class="ml-2" effect="light">成功手续费: {{ summary.num2 }}</el-tag>
+			<el-tag v-if="showSummary" class="ml-2" effect="light">成功订单数: {{ summary.num3 }}</el-tag>
+			<el-tag v-if="showSummary && checkPerm(service.dj.withdraw.permission.mch)" class="ml-2"
+				effect="light">通道手续费: {{ summary.num4.toFixed(2) }}</el-tag>
 		</cl-row>
 
-
 		<cl-row>
 			<!-- 数据表格 -->
 			<cl-table ref="Table" :contextMenu="[]">
@@ -24,7 +23,7 @@
 							<el-descriptions-item :span="2" label="收款账号">
 								{{ scope.row.accountNo }}
 							</el-descriptions-item>
-							<el-descriptions-item :span="2" label="收款人姓名">
+							<el-descriptions-item :span="2" label="持卡人姓名">
 								{{ scope.row.accountName }}
 							</el-descriptions-item>
 							<el-descriptions-item :span="2" label="银行名称">
@@ -67,6 +66,7 @@ import { checkPerm } from "/$/base";
 
 const { service } = useCool();
 const showSummary = ref(false);
+
 const filterParam = ref({
 	createTime: [
 		dayjs().format("YYYY-MM-DD ") + "00:00:00",
@@ -108,14 +108,16 @@ const items = ref<ClForm.Item[]>([
 		prop: "mchId",
 		component: {
 			name: "el-input"
-		}
+		},
+		hidden: !checkPerm(service.dj.withdraw.permission.mch)
 	},
 	{
 		label: "通道编码",
 		prop: "code",
 		component: {
 			name: "el-input"
-		}
+		},
+		hidden: !checkPerm(service.dj.withdraw.permission.code)
 	},
 	{
 		label: "状态",
@@ -193,113 +195,228 @@ const items = ref<ClForm.Item[]>([
 	}
 ]);
 
+function onStatusChange(status: any) {
+	if (+status === 1 || +status === 3) {
+		Upsert.value?.hideItem('traceNo');
+		Upsert.value?.hideItem('code')
+	} else if (status === 2) {
+		Upsert.value?.hideItem('traceNo');
+		Upsert.value?.showItem('code')
+	} else {
+		Upsert.value?.showItem('traceNo')
+		Upsert.value?.showItem('code')
+	}
+}
+
+let currentStatus = 1;
+
 // cl-upsert
 const Upsert = useUpsert({
 	items: [
 		{
-			prop: "mchId",
-			label: "商户号",
-			required: true,
+			prop: "base",
+			props: {
+				labelWidth: "0px",
+			},
 			component: {
-				name: "el-input",
+				name: "cl-form-card", // 自定义组件包装组件
 				props: {
-					disabled: true
-				}
+					label: "基础信息", // 标签名
+					expand: true, // 默认展开
+					isExpand: true, // 是否可以展开、收起
+				},
 			},
-
+			children: [
+				{
+					prop: "mchId",
+					label: "商户号",
+					required: true,
+					component: {
+						name: "el-input",
+						props: {
+							readonly: true
+						}
+					}
+				},
+				{
+					label: "订单号",
+					prop: "orderNo",
+					required: true,
+					component: {
+						name: "el-input",
+						props: {
+							readonly: true
+						}
+					},
+					span: 12
+				},
+				{
+					label: "商户订单号",
+					prop: "outOrderNo",
+					required: true,
+					component: {
+						name: "el-input",
+						props: {
+							readonly: true
+						}
+					},
+					span: 12
+				},
+				{
+					prop: "amount",
+					label: "金额",
+					component: {
+						name: "el-input",
+						props: {
+							readonly: true
+						}
+					},
+					required: true,
+					span: 12
+				},
+				{
+					prop: "currency",
+					label: "货币",
+					component: {
+						name: "el-input",
+						props: {
+							readonly: true
+						}
+					},
+					required: true,
+					span: 12
+				},
+			]
 		},
 		{
-			label: "订单号",
-			prop: "orderNo",
-			required: true,
+			prop: "account",
+			props: {
+				labelWidth: "0px",
+			},
 			component: {
-				name: "el-input",
+				name: "cl-form-card", // 自定义组件包装组件
 				props: {
-					disabled: true
-				}
-			}
-		},
-		{
-			prop: "traceNo",
-			label: "交易号",
-			component: { name: "el-input" },
-			required: true
-		},
-		{
-			prop: "code",
-			label: "通道码",
-			component: { name: "el-input" },
-			required: true
-		},
-		{
-			prop: "amount",
-			label: "金额",
-			hook: { bind: ["number"] },
-			component: { name: "el-input-number", props: { min: 0 } },
-			required: true
-		},
-		{
-			prop: "accountNo",
-			label: "账户",
-			required: true,
-			component: { name: "el-input" }
-		},
-		{
-			prop: "bankCode",
-			label: "银行编码",
-			component: { name: "el-input" },
-			required: true
-		},
-		{
-			prop: "bankName",
-			label: "银行名称",
-			required: true,
-			component: { name: "el-input" }
-		},
-		{
-			prop: "accountName",
-			label: "账户名",
-			required: true,
-			component: { name: "el-input" }
+					label: "收款信息", // 标签名
+					expand: false, // 默认展开
+					isExpand: true, // 是否可以展开、收起
+				},
+			},
+			children: [
+				{
+					prop: "accountNo",
+					label: "收款账号",
+					required: true,
+					component: { name: "el-input", props: {} },
+					span: 12
+				},
+				{
+					prop: "accountName",
+					label: "持卡人姓名",
+					required: true,
+					component: { name: "el-input", props: {} },
+					span: 12
+				},
+				{
+					prop: "bankCode",
+					label: "银行编码",
+					component: { name: "el-input", props: {} },
+					span: 12
+				},
+				{
+					prop: "bankName",
+					label: "银行名称",
+					component: { name: "el-input", props: {} },
+					span: 12
+				},
+			]
 		},
 		{
-			prop: "status",
-			label: "订单状态",
+			prop: "states",
+			props: {
+				labelWidth: "0px",
+			},
 			component: {
-				name: "el-select",
+				name: "cl-form-card", // 自定义组件包装组件
 				props: {
-					disabled: true
+					label: "状态流转", // 标签名
+					expand: true, // 默认展开
+					isExpand: false, // 是否可以展开、收起
 				},
-				options: [
-					{
-						label: "已受理",
-						value: 1
-					},
-					{
-						label: "银行处理中",
-						value: 2
-					},
-					{
-						label: "代付失败",
-						value: 3
+			},
+			children: [
+				{
+					prop: "status",
+					label: "订单状态",
+					component: {
+						name: "el-radio-group",
+						props: {
+							onChange(data) {
+								onStatusChange(data);
+							}
+						},
+						options: [
+							{
+								label: "已受理",
+								value: 1
+							},
+							{
+								label: "银行处理中",
+								value: 2
+							},
+							{
+								label: "代付失败",
+								value: 3
+							},
+							{
+								label: "代付成功",
+								value: 8
+							},
+						]
 					},
-					{
-						label: "代付成功",
-						value: 8
+					required: true
+				},
+				{
+					prop: "traceNo",
+					label: "交易号",
+					component: { name: "el-input" },
+					required: true
+				},
+				{
+					prop: "code",
+					label: "通道码",
+					component: {
+						name: "el-select",
+						options: [],
 					},
-				]
-			},
-			required: true
-		},
-		{
-			prop: "remark",
-			label: "备注",
-			component: {
-				name: "el-input",
-				props: { type: "textarea", rows: 4 }
-			}
+					required: true
+				},
+				{
+					prop: "remark",
+					label: "备注",
+					component: {
+						name: "el-input",
+						props: { type: "textarea", rows: 4 }
+					}
+				}
+			]
 		}
-	]
+	],
+	async onOpen() {
+		const withdrawChannels = await service.dj.comm.getWithdrawChannels();
+		Upsert.value?.setOptions(
+			'code',
+			withdrawChannels.map((item: any) => {
+				return {
+					label: item.code + ' ( ' + item.currency + ' ) ',
+					value: item.code
+				}
+			})
+		);
+	},
+	onOpened(data: any) {
+		Upsert.value?.setForm('status', currentStatus)
+		onStatusChange(currentStatus)
+	}
 });
 
 // cl-table
@@ -313,17 +430,18 @@ const Table = useTable({
 				prop: "detail"
 			};
 		},
-		{ prop: "orderNo", label: "订单号", showOverflowTooltip: true },
-		{ prop: "outOrderNo", label: "商户订单号", showOverflowTooltip: true },
-		{ prop: "traceNo", label: "交易号", showOverflowTooltip: true },
-		{ prop: "mchId", label: "商户号" },
-		{ prop: "code", label: "通道码" },
+		{ prop: "orderNo", label: "订单号", showOverflowTooltip: true, width: 120 },
+		{ prop: "outOrderNo", label: "商户订单号", showOverflowTooltip: true, width: 120 },
+		{ prop: "traceNo", label: "交易号", showOverflowTooltip: true, width: 120 },
+		{
+			prop: "mchId", label: "商户号", hidden: !checkPerm(service.dj.withdraw.permission.mch), width: 90
+		},
 		{
 			prop: "amount",
 			label: "金额",
 			width: 90,
 			formatter(row) {
-				return (+row.amount).toFixed(2) + ' ' + row.currency;
+				return (+row.amount).toFixed(2)
 			}
 		},
 		{
@@ -331,12 +449,17 @@ const Table = useTable({
 			label: "手续费",
 			width: 90,
 			formatter(row) {
-				return (+row.amount).toFixed(2) + ' ' + row.currency;
+				return (+row.charge).toFixed(2)
 			}
 		},
+		{
+			prop: "currency",
+			label: "货币"
+		},
 		{
 			prop: "status",
 			label: "状态",
+			width: 110,
 			dict: [
 				{ label: "已受理", value: 1, color: "#909399" },
 				{ label: "银行处理中", value: 2, color: "#909399" },
@@ -344,25 +467,76 @@ const Table = useTable({
 				{ label: "代付成功", value: 8, color: "#67C23A" },
 			]
 		},
+		{
+			prop: "code", label: "通道编码", hidden: !checkPerm(service.dj.withdraw.permission.code), width: 120
+		},
 		{ prop: "createTime", label: "创建时间", sortable: "desc", width: 160 },
 		{
 			type: "op",
 			buttons({ scope }) {
 				const btns = [];
-				if (+scope.row.status === 0) {
+				if (checkPerm(service.dj.withdraw.permission.update)) {
+					btns.push({
+						label: "编辑",
+						type: "primary",
+						async onClick({ scope }: any) {
+							currentStatus = scope.row.status;
+							Upsert.value?.edit(scope.row);
+						}
+					});
+				}
+				if (+scope.row.status === 1 && checkPerm(service.dj.withdraw.permission.update)) {
+					btns.push({
+						label: "分配通道",
+						type: "warning",
+						async onClick({ scope }: any) {
+							currentStatus = 2;
+							Upsert.value?.edit(scope.row);
+							Upsert.value?.setProps('accountNo', {
+								readonly: true
+							})
+							Upsert.value?.setProps('bankName', {
+								readonly: true
+							})
+							Upsert.value?.setProps('bankCode', {
+								readonly: true
+							})
+							Upsert.value?.setProps('accountName', {
+								readonly: true
+							})
+							Upsert.value?.setProps('status', {
+								disabled: true
+							})
+						}
+					});
+				} else if (+scope.row.status === 2 && checkPerm(service.dj.withdraw.permission.query)) {
 					btns.push({
 						label: "API查单",
 						type: "primary",
 						async onClick({ scope }: any) {
 							const data = await service.dj.withdraw.query({ id: scope.row.id });
-							if (+data.status === 0) {
-								ElMessage.info("代付结果未知,接口返回: " + data.message);
-							} else if (+data.status === 2) {
+							if (+data.status === 3) {
 								ElMessage.error("代付失败,失败原因: " + data.message);
 								Crud.value?.refresh();
-							} else {
+							} else if (+data.status === 8) {
 								ElMessage.success("订单代付成功,已刷新状态!");
 								Crud.value?.refresh();
+							} else {
+								ElMessage.info("代付结果未知,接口返回: " + data.message);
+							}
+						}
+					});
+				} else if ((+scope.row.status === 8 || +scope.row.status === 3) && checkPerm(service.dj.withdraw.permission.notify)) {
+					btns.push({
+						label: "补发通知",
+						type: "success",
+						async onClick({ scope }: any) {
+							const { status, msg = "" } = await service.dj.withdraw.notify({ id: scope.row.id });
+							if (+status === 1) {
+								ElMessage.success("补发通知成功!");
+								Crud.value?.refresh();
+							} else {
+								ElMessage.error("通知失败,失败原因:" + JSON.stringify(msg));
 							}
 						}
 					});
@@ -370,16 +544,33 @@ const Table = useTable({
 				return btns;
 			}
 		}
-	]
+	],
 });
 
 // cl-crud
 const Crud = useCrud(
 	{
-		service: service.dj.withdraw
+		service: service.dj.withdraw,
+		async onRefresh(params, { next, render }) {
+			const { list, pagination } = await next({
+				order: "createTime",
+				sort: "desc",
+				...params
+			});
+			if (showSummary.value) {
+				const { num1, num2, num3, num4, num5 } = (
+					await service.dj.withdraw.summary(params)
+				)[0];
+				summary.value.num1 = +num1;
+				summary.value.num2 = +num2;
+				summary.value.num3 = +num3;
+				summary.value.num4 = +num4;
+			}
+			render(list, pagination);
+		}
 	},
 	(app) => {
-		app.refresh();
+		app.refresh(filterParam.value);
 	}
 );
 </script>

+ 1 - 0
src/modules/dj/views/withdrawChannel.vue

@@ -146,6 +146,7 @@ const Upsert = useUpsert({
 
 // cl-table
 const Table = useTable({
+	autoHeight: false,
 	columns: [
 		{ type: "selection" },
 		{ prop: "name", label: "通道名" },

Some files were not shown because too many files changed in this diff