|
@@ -24,16 +24,17 @@
|
|
|
</cl-row>
|
|
|
<cl-upsert ref="Upsert">
|
|
|
<template #slot-secret="{ scope }">
|
|
|
- <div>{{ scope.apiSecret }}</div>
|
|
|
- <div><el-icon style="cursor: pointer" @click="copyToClipboard(scope.apiSecret)"><DocumentCopy /></el-icon></div>
|
|
|
-
|
|
|
-<!-- <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-select>-->
|
|
|
+ <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>
|
|
@@ -42,7 +43,7 @@
|
|
|
<script lang="ts" name="pay-merchant" setup>
|
|
|
import { useCrud, useTable, useUpsert, useForm } from '@cool-vue/crud';
|
|
|
import { useCool } from '/@/cool';
|
|
|
-import { DocumentCopy } from '@element-plus/icons-vue';
|
|
|
+import { DocumentCopy, RefreshRight } from '@element-plus/icons-vue';
|
|
|
import { ElMessage } from 'element-plus';
|
|
|
const { service } = useCool();
|
|
|
|
|
@@ -123,13 +124,16 @@ const Upsert = useUpsert({
|
|
|
prop: 'apiSecret',
|
|
|
label: 'secret',
|
|
|
required: true,
|
|
|
- component: { name: 'slot-secret', props: { disabled: Upsert.value?.mode !== 'add' } },
|
|
|
+ component: {
|
|
|
+ name: 'slot-secret',
|
|
|
+ props: { disabled: Upsert.value?.mode !== 'add' }
|
|
|
+ },
|
|
|
span: 24,
|
|
|
hidden(options) {
|
|
|
console.log(80, options);
|
|
|
- return Upsert.value?.mode === 'add'
|
|
|
+ return Upsert.value?.mode === 'add';
|
|
|
}
|
|
|
- }
|
|
|
+ };
|
|
|
},
|
|
|
{
|
|
|
prop: 'remark',
|
|
@@ -171,16 +175,20 @@ const Crud = useCrud(
|
|
|
}
|
|
|
);
|
|
|
|
|
|
-
|
|
|
-
|
|
|
const copyToClipboard = async (secret: string) => {
|
|
|
try {
|
|
|
// 使用 Clipboard API 复制内容
|
|
|
await navigator.clipboard.writeText(secret);
|
|
|
ElMessage.success('复制成功');
|
|
|
} catch (error) {
|
|
|
- console.error("复制失败", 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>
|