Ver código fonte

商户通道分配

test 10 meses atrás
pai
commit
fe32037bc9

+ 112 - 1
build/cool/temp/eps.d.ts

@@ -454,6 +454,10 @@ declare namespace Eps {
 		 * 通道编码
 		 */
 		code?: string;
+		/**
+		 * 支付方式
+		 */
+		payType?: string;
 		/**
 		 * 代码服务
 		 */
@@ -461,7 +465,15 @@ declare namespace Eps {
 		/**
 		 * 费率
 		 */
-		rate?: string;
+		rate?: number;
+		/**
+		 * 单笔固定费用
+		 */
+		basicFee?: number;
+		/**
+		 * 单笔最低费用
+		 */
+		feeMin?: number;
 		/**
 		 * 单笔最大
 		 */
@@ -574,6 +586,41 @@ declare namespace Eps {
 		[key: string]: any;
 	}
 
+	interface MchChannelEntity {
+		/**
+		 * ID
+		 */
+		id?: number;
+		/**
+		 * 商户号
+		 */
+		mchId?: string;
+		/**
+		 * 支付方式
+		 */
+		payType?: string;
+		/**
+		 * 通道编码
+		 */
+		code?: string;
+		/**
+		 * 状态 0-未启用 1 启用
+		 */
+		status?: boolean;
+		/**
+		 * 创建时间
+		 */
+		createTime?: Date;
+		/**
+		 * 更新时间
+		 */
+		updateTime?: Date;
+		/**
+		 * 任意键值
+		 */
+		[key: string]: any;
+	}
+
 	interface MerchantEntity {
 		/**
 		 * ID
@@ -2314,6 +2361,10 @@ declare namespace Eps {
 		 * 支付类型列表
 		 */
 		getPayTypes(data?: any): Promise<any>;
+		/**
+		 * 支付通道列表
+		 */
+		getChannels(data?: any): Promise<any>;
 		/**
 		 * 统计
 		 */
@@ -2357,6 +2408,7 @@ declare namespace Eps {
 			getMerchants: string;
 			getCurrency: string;
 			getPayTypes: string;
+			getChannels: string;
 			dashboard: string;
 			chartData: string;
 			list: string;
@@ -2373,6 +2425,7 @@ declare namespace Eps {
 			getMerchants: boolean;
 			getCurrency: boolean;
 			getPayTypes: boolean;
+			getChannels: boolean;
 			dashboard: boolean;
 			chartData: boolean;
 			list: boolean;
@@ -2502,6 +2555,63 @@ declare namespace Eps {
 		request: Service["request"];
 	}
 
+	interface DjMchChannel {
+		/**
+		 * 删除
+		 */
+		delete(data?: any): Promise<any>;
+		/**
+		 * 修改
+		 */
+		update(data?: any): Promise<any>;
+		/**
+		 * 列表查询
+		 */
+		list(data?: any): Promise<MchChannelEntity[]>;
+		/**
+		 * 单个信息
+		 */
+		info(data?: any): Promise<MchChannelEntity>;
+		/**
+		 * 分页查询
+		 */
+		page(data?: any): Promise<{
+			pagination: { size: number; page: number; total: number };
+			list: MchChannelEntity[];
+			[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 {
 		/**
 		 * 生成谷歌验证码
@@ -3442,6 +3552,7 @@ declare namespace Eps {
 			comm: DjComm;
 			currency: DjCurrency;
 			kyc: DjKyc;
+			mchChannel: DjMchChannel;
 			merchant: DjMerchant;
 			open: DjOpen;
 			order: DjOrder;

Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 0
build/cool/temp/eps.json


+ 50 - 4
src/modules/dj/views/channel.vue

@@ -63,14 +63,15 @@ const Upsert = useUpsert({
 		width: "800px"
 	},
 	props: {
-		labelWidth: "100px"
+		labelWidth: "110px"
 	},
 	items: [
 		{
 			prop: "name",
 			label: "通道名",
 			required: true,
-			component: { name: "el-input" }
+			component: { name: "el-input" },
+			span: 12
 		},
 		{
 			prop: "code",
@@ -79,6 +80,16 @@ const Upsert = useUpsert({
 			component: { name: "el-input" },
 			span: 12
 		},
+		{
+			prop: "payType",
+			label: "支付方式",
+			required: true,
+			component: {
+				name: "el-select",
+				options: [],
+			},
+			span: 12
+		},
 		{
 			prop: "service",
 			label: "代码服务",
@@ -88,13 +99,33 @@ const Upsert = useUpsert({
 		},
 		{
 			prop: "rate",
-			label: "手续费(%)",
+			label: "费(%)",
 			component: {
 				name: "el-input-number",
 				props: { style: { width: "200px" }, precision: 2, min: 0 }
 			},
 			required: true
 		},
+		{
+			prop: "basicFee",
+			label: "单笔固定费用",
+			required: true,
+			component: {
+				name: "el-input-number",
+				props: { style: { width: "200px" }, precision: 2, min: 0 }
+			},
+			span: 12
+		},
+		{
+			prop: "feeMin",
+			label: "单笔最低费用",
+			required: true,
+			component: {
+				name: "el-input-number",
+				props: { style: { width: "200px" }, precision: 2, min: 0 }
+			},
+			span: 12
+		},
 		{
 			prop: "min",
 			label: "单笔限额",
@@ -108,7 +139,19 @@ const Upsert = useUpsert({
 			label: "备注",
 			component: { name: "el-input", props: { type: "textarea", rows: 4 } }
 		}
-	]
+	],
+	async onOpen() {
+		const data = await service.dj.comm.getPayTypes({ type: 1 });
+		Upsert.value?.setOptions(
+			'payType',
+			data.map((item: any) => {
+				return {
+					label: item.payType + ' ( ' + item.currencies + ' ) ',
+					value: item.payType
+				}
+			})
+		);
+	}
 });
 
 // cl-table
@@ -118,6 +161,7 @@ const Table = useTable({
 		{ type: "selection" },
 		{ prop: "name", label: "通道名" },
 		{ prop: "code", label: "通道编码" },
+		{ prop: "payType", label: "支付方式" },
 		{ prop: "service", label: "代码服务" },
 		{
 			prop: "rate",
@@ -126,6 +170,8 @@ const Table = useTable({
 				return row.rate + "%";
 			}
 		},
+		{ prop: "basicFee", label: "单笔固定费用" },
+		{ prop: "feeMin", label: "单笔最低费用" },
 		{
 			prop: "min",
 			label: "单笔限额",

+ 172 - 0
src/modules/dj/views/mchChannel.vue

@@ -0,0 +1,172 @@
+<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-mchChannel" setup>
+import { useCrud, useTable, useUpsert } from "@cool-vue/crud";
+import { useCool } from "/@/cool";
+import { ref } from "vue";
+
+const { service } = useCool();
+
+const channels = ref([]);
+
+const items = ref<ClForm.Item[]>([
+	{
+		label: "商户号",
+		prop: "mchId",
+		component: {
+			name: "el-input"
+		}
+	},
+	{
+		label: "支付方式",
+		prop: "payType",
+		component: {
+			name: "el-input"
+		}
+	},
+	{
+		label: "支付通道",
+		prop: "code",
+		component: {
+			name: "el-input"
+		}
+	},
+]);
+
+// cl-upsert
+const Upsert = useUpsert({
+	items: [
+		{
+			prop: "mchId",
+			label: "商户号",
+			required: true,
+			component: {
+				name: "el-select",
+				options: [],
+				props: {
+					filterable: true,
+				}
+			}
+		},
+		{
+			prop: "payType",
+			label: "支付方式",
+			component: {
+				name: "el-select",
+				options: [],
+				props: {
+					onChange(data) {
+						Upsert.value?.setOptions(
+							'code',
+							channels.value.filter((item: any) => item.payType === data).map((item: any) => {
+								return {
+									label: item.code,
+									value: item.code
+								}
+							})
+						);
+					}
+				}
+			},
+			required: true
+		},
+		{
+			label: "支付通道",
+			prop: "code",
+			component: {
+				name: "el-select",
+				options: [],
+				props: {
+					onChange(data) {
+						const channel: any = channels.value.find((item: any) => {
+							return item.code === data
+						})
+						if (channel) {
+							Upsert.value?.setForm('payType', channel.payType)
+						}
+					}
+				}
+			},
+			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 payTypes = await service.dj.comm.getPayTypes({ type: 1 });
+		Upsert.value?.setOptions(
+			'payType',
+			payTypes.map((item: any) => {
+				return {
+					label: item.payType,
+					value: item.payType
+				}
+			})
+		);
+		channels.value = await service.dj.comm.getChannels();
+		Upsert.value?.setOptions(
+			'code',
+			channels.value.map((item: any) => {
+				return {
+					label: item.code,
+					value: item.code
+				}
+			})
+		);
+	}
+});
+
+// cl-table
+const Table = useTable({
+	columns: [
+		{ type: "selection" },
+		{ prop: "mchId", label: "商户号" },
+		{ prop: "payType", label: "支付方式" },
+		{
+			prop: "code",
+			label: "通道编码",
+		},
+		{ prop: "status", label: "状态", component: { name: "cl-switch" } },
+		{ type: "op", buttons: ["edit", "delete"] }
+	]
+});
+
+// cl-crud
+const Crud = useCrud(
+	{
+		service: service.dj.mchChannel
+	},
+	(app) => {
+		app.refresh();
+	}
+);
+</script>

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

@@ -81,7 +81,7 @@ const Upsert = useUpsert({
 				component: {
 					name: "el-select",
 					options: [],
-					props: { disabled: Upsert.value?.mode !== "add" }
+					props: { disabled: Upsert.value?.mode !== "add", filterable: true, }
 				}
 			}
 		},
@@ -93,7 +93,7 @@ const Upsert = useUpsert({
 				component: {
 					name: "el-select",
 					options: [],
-					props: { disabled: Upsert.value?.mode !== "add" }
+					props: { disabled: Upsert.value?.mode !== "add", filterable: true, }
 				}
 			}
 		},

Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff