Browse Source

费率调整1

max 7 months ago
parent
commit
8081c1b862
4 changed files with 157 additions and 51 deletions
  1. 17 12
      .vscode/settings.json
  2. 16 0
      .vscode/tasks.json
  3. 111 39
      src/modules/payment/views/rate.vue
  4. 13 0
      upload.sql

+ 17 - 12
.vscode/settings.json

@@ -1,14 +1,19 @@
 {
-  "editor.cursorSmoothCaretAnimation": "on",
-  "explorer.fileNesting.enabled": true,
-  "explorer.fileNesting.patterns": {
-    "tsconfig.json": "tsconfig.*.json, env.d.ts",
-    "vite.config.*": "jsconfig*, vitest.config.*, cypress.config.*, playwright.config.*",
-    "package.json": "package-lock.json, pnpm*, .yarnrc*, yarn*, .eslint*, eslint*, .prettier*, prettier*, .editorconfig"
-  },
-  "editor.codeActionsOnSave": {
-    "source.fixAll": "explicit"
-  },
-  "editor.formatOnSave": true,
-  "editor.defaultFormatter": "esbenp.prettier-vscode"
+	"editor.cursorSmoothCaretAnimation": "on",
+	"explorer.fileNesting.enabled": true,
+	"explorer.fileNesting.patterns": {
+		"tsconfig.json": "tsconfig.*.json, env.d.ts",
+		"vite.config.*": "jsconfig*, vitest.config.*, cypress.config.*, playwright.config.*",
+		"package.json": "package-lock.json, pnpm*, .yarnrc*, yarn*, .eslint*, eslint*, .prettier*, prettier*, .editorconfig"
+	},
+	"editor.codeActionsOnSave": {
+		"source.fixAll": true
+	},
+	"[vue]": {
+		"editor.formatOnSave": false
+	},
+	"editor.formatOnSave": true,
+	"editor.defaultFormatter": "esbenp.prettier-vscode",
+	"prettier.prettierPath": "./node_modules/prettier",
+	"editor.fontSize": 13
 }

+ 16 - 0
.vscode/tasks.json

@@ -0,0 +1,16 @@
+{
+	"version": "2.0.0",
+	"tasks": [
+		{
+			"label": "Run Prettier",
+			"type": "shell",
+			"command": "node",
+			"args": ["./node_modules/prettier/bin-prettier.js", "--write", "src/**/*.js"],
+			"options": {
+				"env": {
+					"PATH": "/Users/sysadmin/.volta/tools/image/node/22.12.0/bin"
+				}
+			}
+		}
+	]
+}

+ 111 - 39
src/modules/payment/views/rate.vue

@@ -28,11 +28,12 @@
 		<cl-upsert ref="Upsert">
 			<template #slot-currency="{ scope }">
 				<el-select v-model="scope.currency" clearable>
-					<el-option v-for="item in currencyList.filter(item =>
-				channelList
-					.find(v => v.code == scope.channelId)
-					?.supportedCurrencies.includes(item.id)
-			)" :key="item.id" :label="item.label" :value="item.value" />
+					<el-option
+						v-for="item in currencyList.filter(item =>
+							channelList
+								.find(v => v.code == scope.channelId)
+								?.supportedCurrencies.includes(item.id)
+						)" :key="item.id" :label="item.label" :value="item.value" />
 				</el-select>
 			</template>
 		</cl-upsert>
@@ -40,15 +41,19 @@
 </template>
 
 <script lang="ts" name="payment-rate" setup>
-import { useCrud, useTable, useUpsert } from '@cool-vue/crud';
-import { useCool } from '/@/cool';
-import { ref } from 'vue';
-const { service } = useCool();
+import { useConfig, useCrud, useTable, useUpsert, } from '@cool-vue/crud';
+import { useCool, } from '/@/cool';
+import { onMounted, onUnmounted, ref, toRaw } from 'vue';
+import { Key } from '@element-plus/icons-vue';
+
+const { service, mitt } = useCool();
 const currencyList = ref([] as any);
 service.payment.currency.list().then(res => {
 	currencyList.value = res.map(v => ({ label: v.name, value: v.code, id: v.id }));
 });
 const channelList = ref([] as any);
+// 全局配置
+const { dict, permission } = useConfig();
 // cl-upsert
 const Upsert = useUpsert({
 	items: [
@@ -78,27 +83,35 @@ const Upsert = useUpsert({
 			required: true
 		},
 		{
-			label: '类型',
-			prop: 'type',
+			label: '入金费率',
+			prop: 'DEPOSIT_rate',
+			hook: 'number',
+			component: { name: 'el-input-number' },
+			required: true
+		},
+		{
+			label: '入金方法',
+			prop: 'DEPOSIT_method',
 			component: {
 				name: 'el-select',
-				options: [
-					{ label: '入金', value: 'DEPOSIT' },
-					{ label: '出金', value: 'WITHDRAWAL' }
-				],
+				options: [],
 				props: { clearable: true }
 			},
 			required: true
 		},
 		{
-			label: '状态',
-			prop: 'status',
+			label: '出金费率',
+			prop: 'WITHDRAWAL_rate',
+			hook: 'number',
+			component: { name: 'el-input-number' },
+			required: true
+		},
+		{
+			label: '出金方法',
+			prop: 'WITHDRAWAL_method',
 			component: {
 				name: 'el-select',
-				options: [
-					{ label: '启用', value: 1 },
-					{ label: '禁用', value: 0 }
-				],
+				options: [],
 				props: { clearable: true }
 			},
 			required: true
@@ -106,31 +119,27 @@ const Upsert = useUpsert({
 		{
 			label: '方法',
 			prop: 'method',
+			component: {
+				name: 'el-select',
+				options: [],
+				props: { clearable: true }
+			},
+			required: true
+		},
+		{
+			label: '状态',
+			prop: 'status',
 			component: {
 				name: 'el-select',
 				options: [
-					{ label: 'MOMO', value: 'MOMO' },
-					{ label: 'BANK', value: 'BANK' },
-					{ label: 'TED', value: 'TED' },
-					{ label: 'SPEI', value: 'SPEI' },
-					{ label: 'OVO', value: 'OVO' },
-					{ label: 'DANA', value: 'DANA' },
-					{ label: 'QRIS', value: 'QRIS' },
-					{ label: 'CREDITCARD', value: 'CREDITCARD' },
-					{ label: 'SURED', value: 'SURED' },
-					{ label: 'EFECTY', value: 'EFECTY' },
-					{ label: 'PSE', value: 'PSE' },
-					{ label: 'KHIPU', value: 'KHIPU' },
-					{ label: 'CASH', value: 'CASH' },
-					{ label: 'CHAPS', value: 'CHAPS' },
-					{ label: 'FASTERPAYMENTS', value: 'FASTERPAYMENTS' },
-					{ label: 'SEPA', value: 'SEPA' },
-					{ label: 'SEPAINSTANT', value: 'SEPAINSTANT' }
+					{ label: '启用', value: 1 },
+					{ label: '禁用', value: 0 }
 				],
 				props: { clearable: true }
 			},
 			required: true
 		},
+
 		{
 			label: '备注',
 			prop: 'remark',
@@ -149,9 +158,60 @@ const Upsert = useUpsert({
 			'channelId',
 			channelList.value.map(v => ({ label: v.name, value: v.code }))
 		);
-	}
+	},
+	async onOpened(data) {
+		const payment_type_list = await service.dict.info.list({
+			"type": "payment_type","sort":"desc","order":"orderNum"
+		})
+		Upsert.value?.setOptions(
+			'roleIdList',
+			payment_type_list.map(e => {
+				return {
+					label: e.name || '',
+					value: e.id
+				};
+			})
+		);
+		if(!data.currency) {
+
+			
+			// 新增
+			console.log('新增');		
+			Upsert.value?.hideItem(['rate'])
+			Upsert.value?.hideItem(['method'])
+			Upsert.value?.setOptions(
+				'DEPOSIT_method',
+				payment_type_list.map(e => ({
+					label: e.name || '',
+					value: e.id
+				}))
+			);
+			Upsert.value?.setOptions(
+				'WITHDRAWAL_method',
+				payment_type_list.map(e => ({
+					label: e.name || '',
+					value: e.id
+				}))
+			);
+			return
+		}
+		// 编辑
+		console.log('编辑');
+		['DEPOSIT_rate', 'DEPOSIT_method', 'WITHDRAWAL_rate', 'WITHDRAWAL_method'].forEach(key => {
+			Upsert.value?.hideItem([key])
+		})
+		Upsert.value?.setOptions(
+			'method',
+			payment_type_list.map(e => ({
+				label: e.name || '',
+				value: e.id
+			}))
+		);
+	},
 });
 
+
+
 // cl-table
 const Table = useTable({
 	columns: [
@@ -193,4 +253,16 @@ const Crud = useCrud(
 function refresh(params?: any) {
 	Crud.value?.refresh(params);
 }
+
+onMounted(() => {
+	console.log(239, mitt);
+	// mitt.on("crud.proxy");
+	// mitt.on('crud.proxyh', (data) => {
+	// 	console.log(241, data);
+	// });
+})
+
+onUnmounted(() => {
+	mitt.off('crud.proxyh');
+});
 </script>

+ 13 - 0
upload.sql

@@ -0,0 +1,13 @@
+INSERT INTO va.dict_info (typeId, name, value, orderNum, remark) VALUES(25, 'OVO', 'OVO', 1, '电子钱包');
+INSERT INTO va.dict_info (typeId, name, value, orderNum, remark) VALUES(25, 'DANA', 'DANA', 1, '电子钱包');
+INSERT INTO va.dict_info (typeId, name, value, orderNum, remark) VALUES(25, 'QRIS', 'QRIS', 1, '电子钱包,扫码支付');
+INSERT INTO va.dict_info (typeId, name, value, orderNum, remark) VALUES(25, 'CREDITCARD', 'CREDITCARD', 1, '信用卡支付,包含Visa、MasterCard等');
+INSERT INTO va.dict_info (typeId, name, value, orderNum, remark) VALUES(25, 'SURED', 'SURED', 1, 'SuRed 是一种支付网络,提供便捷的支付服务。通过 SuRed,用户可以在参与的商家和机构之间进行电子支付、转账和账单支付。');
+INSERT INTO va.dict_info (typeId, name, value, orderNum, remark) VALUES(25, 'EFECTY', 'EFECTY', 1, '哥伦比亚的一种支付方式,类似于便利店支付');
+INSERT INTO va.dict_info (typeId, name, value, orderNum, remark) VALUES(25, 'PSE', 'PSE', 1, '哥伦比亚的一种安全在线支付方式。');
+INSERT INTO va.dict_info (typeId, name, value, orderNum, remark) VALUES(25, 'KHIPU', 'KHIPU', 1, 'KHIPU 作为连接用户与银行平台的接口,简化了银行转账流程,因此,用户在 KHIPU 上输入的用户文件 ID、Clave(密码/PIN)和用户名应与输入电子银行时使用的用户 ID、Clave(密码/PIN)和用户名相同。');
+INSERT INTO va.dict_info (typeId, name, value, orderNum, remark) VALUES(25, 'CASH', 'CASH', 1, '现金支付');
+INSERT INTO va.dict_info (typeId, name, value, orderNum, remark) VALUES(25, 'CHAPS', 'CHAPS', 1, 'CHAPS(Clearing House Automated Payment System)是英国的一种即时支付系统,可执行时间为格林尼治标准时间下午 5:30(仅限工作日)');
+INSERT INTO va.dict_info (typeId, name, value, orderNum, remark) VALUES(25, 'FASTERPAYMENTS', 'FASTERPAYMENTS', 1, 'FASTERPAYMENTS(快速支付)是一种英国境内的即时支付系统,允许银行客户以英镑进行实时清算,可执行时间为24/7/365');
+INSERT INTO va.dict_info (typeId, name, value, orderNum, remark) VALUES(25, 'SEPA', 'SEPA', 1, 'SEPA(Single Euro Payments Area)是一个涵盖欧洲国家和地区的统一支付市场,可执行时间为格林尼治标准时间下午 5:30(仅限工作日)');
+INSERT INTO va.dict_info (typeId, name, value, orderNum, remark) VALUES(25, 'SEPAINSTANT', 'SEPAINSTANT', 1, 'SEPAINSTANT是SEPA即时支付系统的简称,它是一种用于欧洲国家和地区的即时支付解决方案,可执行时间为24/7/365');