Przeglądaj źródła

Merge pull request #1 from maxVaJp/merchant

feat(): 商户体系梳理
OY_0414_XT6 7 miesięcy temu
rodzic
commit
ab86bb2c0b

BIN
dist.zip


+ 16 - 2
src/modules/payment/views/business.vue

@@ -76,6 +76,12 @@ const Upsert = useUpsert({
 			component: { name: 'el-input', props: { clearable: true } },
 			required: true
 		},
+		{
+			label: '城市',
+			prop: 'city',
+			component: { name: 'el-input', props: { clearable: true } },
+			required: true
+		},
 		{
 			label: '地址',
 			prop: 'address_line',
@@ -184,7 +190,15 @@ const Upsert = useUpsert({
 			component: { name: 'el-input', props: { clearable: true } },
 			required: true
 		},
-		{ label: 'ID', prop: 'merchant', hook: 'number', component: { name: 'el-input-number' } }
+		() => ({
+			label: 'ID',
+			prop: 'merchant',
+			hook: 'number',
+			component: { name: 'el-input-number' },
+			hidden(options) {
+				return Upsert.value?.mode === 'add';
+			}
+		})
 	]
 });
 
@@ -192,7 +206,7 @@ const Upsert = useUpsert({
 const Table = useTable({
 	columns: [
 		{ type: 'selection' },
-		{ label: '商户ID', prop: 'mchId', minWidth: 140 },
+		{ label: '商户ID', prop: 'merchantId', minWidth: 140 },
 		{ label: '企业名称', prop: 'name', minWidth: 140 },
 		{ label: '类型', prop: 'type', dict: [], minWidth: 120 },
 		{ label: '国家代码', prop: 'country_code', minWidth: 140 },

+ 36 - 5
src/modules/payment/views/individual.vue

@@ -62,6 +62,12 @@ const Upsert = useUpsert({
 			component: { name: 'el-input', props: { clearable: true } },
 			required: true
 		},
+		{
+			label: '城市',
+			prop: 'city',
+			component: { name: 'el-input', props: { clearable: true } },
+			required: true
+		},
 		{
 			label: '地址',
 			prop: 'address_line',
@@ -89,8 +95,11 @@ const Upsert = useUpsert({
 		{
 			label: '证书类型',
 			prop: 'certificate_type',
-			component: { name: 'el-checkbox-group', options: [], props: {} },
-			value: [],
+			component: {
+				name: 'el-select',
+				options: [],
+				props: { clearable: true }
+			},
 			required: true
 		},
 		{
@@ -126,15 +135,37 @@ const Upsert = useUpsert({
 			},
 			required: true
 		},
-		{ label: 'ID', prop: 'merchant', hook: 'number', component: { name: 'el-input-number' } }
-	]
+		() => ({
+			label: 'ID',
+			prop: 'merchant',
+			hook: 'number',
+			component: { name: 'el-input-number' },
+			hidden(options) {
+				return Upsert.value?.mode === 'add';
+			}
+		})
+	],
+	async onOpen() {
+		const typesObj = await service.dict.info.data({
+			types: ['certificate_type']
+		});
+		Upsert.value?.setOptions(
+			'certificate_type',
+			typesObj['certificate_type'].map(e => {
+				return {
+					label: e.name || '',
+					value: e.value
+				};
+			})
+		);
+	}
 });
 
 // cl-table
 const Table = useTable({
 	columns: [
 		{ type: 'selection' },
-		{ label: '商户ID', prop: 'mch_id', minWidth: 140 },
+		{ label: '商户ID', prop: 'merchantId', minWidth: 140 },
 		{ label: '名字', prop: 'first_name', minWidth: 140 },
 		{ label: '姓氏', prop: 'last_name', minWidth: 140 },
 		{

+ 50 - 4
src/modules/payment/views/merchant.vue

@@ -22,15 +22,29 @@
 			<!-- 分页控件 -->
 			<cl-pagination />
 		</cl-row>
-		<cl-upsert ref="Upsert"> </cl-upsert>
+		<cl-upsert ref="Upsert">
+			<template #slot-secret="{ scope }">
+				<div v-if="scope.apiSecret">
+					{{ scope.apiSecret
+					}}<el-icon style="cursor: pointer" @click="copyToClipboard(scope.apiSecret)"
+						><DocumentCopy
+					/></el-icon>
+				</div>
+				<div v-else>
+					<el-button size="small" :icon="RefreshRight" @click="createSecret(scope)"
+						>重新生成</el-button
+					>
+				</div>
+			</template>
+		</cl-upsert>
 	</cl-crud>
 </template>
 
 <script lang="ts" name="pay-merchant" setup>
 import { useCrud, useTable, useUpsert, useForm } from '@cool-vue/crud';
 import { useCool } from '/@/cool';
-import md5 from 'md5';
-import { ref } from 'vue';
+import { DocumentCopy, RefreshRight } from '@element-plus/icons-vue';
+import { ElMessage } from 'element-plus';
 const { service } = useCool();
 
 // cl-upsert
@@ -105,7 +119,22 @@ const Upsert = useUpsert({
 				]
 			}
 		},
-
+		() => {
+			return {
+				prop: 'apiSecret',
+				label: 'secret',
+				required: true,
+				component: {
+					name: 'slot-secret',
+					props: { disabled: Upsert.value?.mode !== 'add' }
+				},
+				span: 24,
+				hidden(options) {
+					console.log(80, options);
+					return Upsert.value?.mode === 'add';
+				}
+			};
+		},
 		{
 			prop: 'remark',
 			label: '备注',
@@ -145,4 +174,21 @@ const Crud = useCrud(
 		app.refresh();
 	}
 );
+
+const copyToClipboard = async (secret: string) => {
+	try {
+		// 使用 Clipboard API 复制内容
+		await navigator.clipboard.writeText(secret);
+		ElMessage.success('复制成功');
+	} catch (error) {
+		console.error('复制失败', error);
+		ElMessage.error('复制失败');
+	}
+};
+
+const createSecret = async (row: any) => {
+	const params = await service.payment.merchant.secret(row);
+	console.log(191, params);
+	row.apiSecret = params.apiSecret;
+};
 </script>

Plik diff jest za duży
+ 0 - 151
stats.html


Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików