|
@@ -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>
|