fix:1,修改

main
YuanJian 2025-09-01 08:59:56 +08:00
parent 05598451be
commit f962d2af4a
15 changed files with 1413 additions and 460 deletions

BIN
dist.rar

Binary file not shown.

View File

@ -88,6 +88,16 @@ export function createGameuUpdateStatus(data) {
params: query
})
}
//一键同步
export function getSuperGameSync(query) {
return request({
url: '/super/game/sync',
method: 'get',
params: query
})
}
//货币修改
export function updatePlatformCurrency(data) {
return request({

View File

@ -31,6 +31,13 @@ export function createTenantCreate(data) {
data: data
})
}
//重置密钥
export function updateSuperResetSecret(id) {
return request({
url: `/super/tenant/resetSecret?id=${id}`,
method: 'get',
})
}
//谷歌验证解除
export function updateSuperResetGoogleCode(data) {
return request({

View File

@ -2,6 +2,7 @@
<div class="app-container">
<table-search-card :model="queryParams" @getList="getList" @handleQuery="handleQuery" @resetQuery="resetQuery">
<template #left>
<table-search-date ref="searchDateRef" v-model:dateRange="dateRange" @dateChange="handleQuery" v-model:operateTimeType="operateTimeType"></table-search-date>
<el-form-item :label="t('商户账号')" prop="tenantKey">
<el-input
v-model="queryParams.tenantKey"
@ -20,11 +21,6 @@
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item :label="t('时间')" prop="dateRange">
<el-date-picker v-model="dateRange"
:editable="false" type="datetimerange" :start-placeholder="t('开始时间')"
:end-placeholder="t('结束时间')" format="YYYY-MM-DD" value-format="YYYY-MM-DD HH:mm:ss" />
</el-form-item>
</template>
<template #right>
</template>
@ -136,8 +132,10 @@
<script setup name="Commission">
import { listCommission,getCommissionInfo,updateAgentCommission } from "@/api/commission";
import { superAgentCommissionList,superAgentCommissionSum } from "@/api/super/commissionList";
import TableSearchDate from '@/components/TableSearchDate'
import Crontab from '@/components/Crontab'
import { parseTime } from '@/utils/ruoyi'; //
import { onMounted } from "vue";
const router = useRouter();
const { proxy } = getCurrentInstance();
const { ff_tenant_type, ff_tenant_status,ff_tenant_agent_approval_status,ff_tenant_agent_commission_type } = proxy.useDict("ff_tenant_type", "ff_tenant_status","ff_tenant_agent_approval_status","ff_tenant_agent_commission_type");
@ -162,7 +160,6 @@ const withdrawn = ref(0);
const total = ref(0);
const invite = ref(0);
const take = ref(0);
const dateRange = ref([]);
const data = reactive({
form: {},
queryParams: {
@ -182,7 +179,7 @@ const data = reactive({
});
const { queryParams, form, rules } = toRefs(data);
const dateRange = ref([]),operateTimeType = ref("day");
/** 查询列表 */
function getList() {
loading.value = true;
@ -246,10 +243,13 @@ function handleApply() {
});
}).catch(() => { });
}
const searchDateRef = ref(null);
/** 重置按钮操作 */
function resetQuery() {
dateRange.value = [];
handleQuery();
operateTimeType.value = "day";
proxy.resetForm("queryRef");
searchDateRef.value.timeTypeChange(operateTimeType.value)
}
function queryCode(type) {
form.value.tenantAgentPlatforms = form.value.tenantAgentPlatforms.map((item, index) => {
@ -279,7 +279,10 @@ function submitForm() {
});
}
getList();
//
onMounted(() => {
getList();
});
// superAgentCommissionSums();
</script>

View File

@ -2,6 +2,7 @@
<div class="app-container">
<table-search-card :model="queryParams" @getList="getList" @handleQuery="handleQuery" @resetQuery="resetQuery">
<template #left>
<table-search-date ref="searchDateRef" v-model:dateRange="dateRange" @dateChange="handleQuery" v-model:operateTimeType="operateTimeType"></table-search-date>
<el-form-item :label="t('状态')" prop="approvalStatus">
<el-select v-model="queryParams.approvalStatus" clearable style="width:220px;" :placeholder="t('请选择')">
<el-option
@ -22,11 +23,6 @@
></el-option>
</el-select>
</el-form-item> -->
<el-form-item :label="t('时间')" prop="dateRange">
<el-date-picker v-model="dateRange"
:editable="false" type="datetimerange" :start-placeholder="t('开始时间')"
:end-placeholder="t('结束时间')" format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss" />
</el-form-item>
</template>
<template #right>
</template>
@ -152,6 +148,7 @@
import { listCommission,getCommissionInfo,updateAgentCommission } from "@/api/commission";
import { superAgentWithdrawalList,updateSuperAgentWithdrawalApprove } from "@/api/super/commissionList";
import Crontab from '@/components/Crontab'
import TableSearchDate from '@/components/TableSearchDate'
import CustomSelect from '@/components/CustomSelect'
import { parseTime } from '@/utils/ruoyi'; //
import { id } from "element-plus/es/locales.mjs";
@ -180,10 +177,6 @@ const withdrawn = ref(0);
const total = ref(0);
const invite = ref(0);
const take = ref(0);
const dateRange = ref([
dayjs().startOf('day').format('YYYY-MM-DD HH:mm:ss'),
dayjs().endOf('day').format('YYYY-MM-DD HH:mm:ss')
]);
const data = reactive({
form: {},
queryParams: {
@ -203,7 +196,7 @@ const data = reactive({
});
const { queryParams, form, rules } = toRefs(data);
const dateRange = ref([]),operateTimeType = ref("day");
/** 查询列表 */
function getList() {
loading.value = true;
@ -254,10 +247,13 @@ function handleApply() {
});
}).catch(() => { });
}
const searchDateRef = ref(null);
/** 重置按钮操作 */
function resetQuery() {
dateRange.value = [];
handleQuery();
operateTimeType.value = "day";
proxy.resetForm("queryRef");
searchDateRef.value.timeTypeChange(operateTimeType.value)
}
function queryCode(type) {
form.value.tenantAgentPlatforms = form.value.tenantAgentPlatforms.map((item, index) => {
@ -357,7 +353,11 @@ function submitForm() {
});
}
getList();
//
onMounted(() => {
getList();
})
</script>
<style scoped lang="scss">

View File

@ -237,7 +237,7 @@ import { el } from 'element-plus/es/locales.mjs';
let obj = {
operationType:tabPosition.value,
timeZone:timeZones,
currencyCode:props.currencyType,
currencyCodes:props.currencyType,
startTime:finalTimestamp(dateRange.value[0]),
endTime:finalTimestamp(dateRange.value[1]),
}

View File

@ -85,7 +85,7 @@ const startOfDay = new Date(now.getFullYear(), now.getMonth(), now.getDate()).ge
// 23:59:59.999
const endOfDay = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59, 999).getTime();
let obj = {
currencyCode:currencyCodes.value,
currencyCodes:currencyCodes.value,
platformCodes:platformCodes.value.join(","),
tenantKeys:tenantKeys.value.join(","),
startTime:startOfDay,
@ -110,7 +110,7 @@ const startOfDay = new Date(now.getFullYear(), now.getMonth(), now.getDate()).ge
// 23:59:59.999
const endOfDay = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59, 999).getTime();
let obj = {
currencyCode:currencyCodes.value,
currencyCodes:currencyCodes.value,
platformCodes:platformCodes.value.join(","),
startTime:startOfDay,
endTime:endOfDay,

View File

@ -2,6 +2,7 @@
<div class="app-container">
<table-search-card :model="queryParams" @getList="getList" @handleQuery="handleQuery" @resetQuery="resetQuery">
<template #left>
<table-search-date ref="searchDateRef" v-model:dateRange="dateRange" @dateChange="handleQuery" v-model:operateTimeType="operateTimeType"></table-search-date>
<el-form-item :label="t('商户账号')" prop="tenantKey">
<el-input
v-model="queryParams.tenantKey"
@ -167,7 +168,7 @@
import { listAgent, createAgent, selectPlatform } from "@/api/agent";
import { getSuperMemberList } from "@/api/super/tenant";
import {superQueryBalance} from "@/api/super/platform";
import TableSearchDate from '@/components/TableSearchDate'
import { getLocalStorage } from "@/utils/auth";
import CustomSelect from '@/components/CustomSelect'
import Crontab from '@/components/Crontab'
@ -212,11 +213,11 @@ import { nextTick } from "vue";
});
const { queryParams, form, rules } = toRefs(data);
const dateRange = ref([]),operateTimeType = ref("day");
/** 查询列表 */
function getList() {
loading.value = true;
getSuperMemberList(queryParams.value).then(response => {
getSuperMemberList(proxy.addDateRange(queryParams.value, dateRange.value)).then(response => {
agentList.value = response.rows;
total.value = response.total;
loading.value = false;
@ -251,11 +252,14 @@ import { nextTick } from "vue";
queryParams.value.pageNum = 1;
getList();
}
const searchDateRef = ref(null);
/** 重置按钮操作 */
function resetQuery() {
dateRange.value = [];
operateTimeType.value = "day";
proxy.resetForm("queryRef");
handleQuery();
searchDateRef.value.timeTypeChange(operateTimeType.value)
}
//
@ -336,9 +340,13 @@ import { nextTick } from "vue";
}
});
}
//
onMounted(() => {
getList();
getsuperCommonCurrencySelect();
})
getList();
getsuperCommonCurrencySelect();
</script>
<style scoped lang="scss">

View File

@ -1,6 +1,6 @@
<template>
<!-- 添加或修改定时任务对话框 -->
<el-dialog :title="t('添加商户')" align-center v-model="showDialog" width="880px" append-to-body>
<!-- <el-dialog :title="t('添加商户')" align-center v-model="showDialog" width="880px" append-to-body>
<el-scrollbar max-height="600px">
<el-form ref="agentRef" :model="formAll" :rules="rules" label-width="120px">
<el-row>
@ -28,29 +28,9 @@
<CustomSelect v-if="showLoding1" placement="bottom" v-model="formAll.timeZone" :options="sys_job_group" placeholder="请选择时区" style="width: 100%" />
</el-form-item>
</el-col>
<!-- <el-col :span="12">
<el-form-item :label="t('信誉额度')" prop="realBalanceNum">
<NumberInput v-model="formAll.realBalanceNum" :min="0" :max="9999999999999999" @input="updateValue" />
</el-form-item>
</el-col> -->
</el-row>
<!-- <el-collapse >
<el-collapse-item :title="t('信誉额度列表')" name="1">
<el-table v-loading="loading1" :data="formAll.realBalance" class="scoreRatioTable">
<el-table-column :label="t('国家')" align="center" prop="country" />
<el-table-column :label="t('币种')" align="center" prop="currencyCode" />
<el-table-column :label="t('游戏额度')" align="center" prop="balance">
<template #default="{row}">
<NumberInput v-model="row.balance" :min="0" :max="9999999999999999" />
</template>
</el-table-column>
</el-table>
</el-collapse-item>
</el-collapse> -->
<!--
<el-form-item :label="t('透支比例')" prop="depositRatio">
<el-input-number v-model="formAll.depositRatio" :precision="1" :min="0.9" :step="0.1" :max="2"></el-input-number>
</el-form-item> -->
<el-row>
<el-col :span="12">
<el-form-item :label="t('买分比例')" prop="scoreRatio">
@ -72,9 +52,7 @@
</el-form-item>
</el-col>
</el-row>
<!-- <el-form-item :label="t('谷歌验证码')" prop="googleCode">
<el-input v-model="formAll.googleCode" style="width: 260px;" :placeholder="t('请输入谷歌验证码')" />
</el-form-item> -->
<el-form-item :label="t('币种模式')" prop="curType">
<el-radio-group v-model="formAll.curType">
<el-radio-button :value="1" @click="changeCurrency('VND')">{{ t('') }}</el-radio-button>
@ -124,13 +102,7 @@
</template>
</el-table-column>
</el-table>
<!-- <pagination
v-show="totalPlatform > 0"
:total="totalPlatform"
v-model:page="platformSystem.pageNum"
v-model:limit="platformSystem.pageSize"
@pagination="getSelectPlatform"
/> -->
</el-form>
</el-scrollbar>
<template #footer>
@ -139,7 +111,54 @@
<el-button @click="closeDialog">{{ t(' ') }}</el-button>
</div>
</template>
</el-dialog>
</el-dialog> -->
<el-drawer v-model="showDialog" size="40%" >
<template #header>
<div class="dialog-header">
<span style="color: #000;">{{ t('添加商户') }}</span>
</div>
</template>
<el-form ref="agentRef" :model="formAll" :rules="rules" label-width="120px">
<el-form-item :label="t('商户账号')" prop="account">
<el-input v-model="formAll.account" :placeholder="t('请输入商户账号')" />
</el-form-item>
<el-form-item :label="t('密码')" prop="password">
<el-input v-model="formAll.password" auto-complete="off" type="password" :placeholder="t('请输入秘密')" />
</el-form-item>
<el-form-item :label="t('时区')" prop="timeZone">
<CustomSelect v-if="showLoding1" placement="bottom" v-model="formAll.timeZone" :options="sys_job_group" placeholder="请选择时区" style="width: 100%" />
</el-form-item>
<el-form-item :label="t('币种')" prop="currencyCode">
<CustomSelect v-model="formAll.currencyCode" :options="currencySelectArr" placeholder="请选择币种"/>
</el-form-item>
<el-form-item :label="t('买分比例')" prop="scoreRatio">
<el-input-number v-model="formAll.scoreRatio" :precision="1" :min="0.9" :step="0.1" :max="2"></el-input-number>
&nbsp;
{{ t(' (万法定货币=1万通用额度)') }}
</el-form-item>
<el-form-item :label="t('商户模式')" prop="tenantType">
<el-radio-group v-model="formAll.tenantType">
<el-radio-button v-for="item in ff_tenant_type" :key="item.value" :value="item.value">{{ item.label }}</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item :label="t('谷歌验证')" prop="curType">
<el-switch
v-model="formAll.googleCodeSwitch"
inline-prompt
:active-value="1"
:inactive-value="0"
active-text="启用"
inactive-text="禁用"
/>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitForm" :loading="loadingButton">{{ t('确 定') }}</el-button>
<el-button @click="closeDialog">{{ t(' ') }}</el-button>
</div>
</template>
</el-drawer>
</template>
<script setup>
import { superTenantList, createTenantCreate,updateSuperTenantResetPwd,getSuperTenant,superTenantQuotaList,updateSuperTenantQuotaUpdate,superCommonTimeZone } from "@/api/super/tenant.js";
@ -218,6 +237,8 @@ const rules = ref({
realBalanceNum: [{ required: true, message: proxy.t('信誉额度不能为空'), trigger: "change" }],
timeZone: [{ required: true, message: proxy.t('时区不能为空'), trigger: "change" }],
googleCode: [{ required: true, message: proxy.t('谷歌验证码不能为空'), trigger: "change" }],
currencyCode: [{ required: true, message: proxy.t('币种不能为空'), trigger: "change" }],
})
const totalPlatform = ref(0);
@ -441,10 +462,11 @@ const formRef = ref(null);//获取表单验证
password: formAll.password,
scoreRatio: formAll.scoreRatio,
tenantType: formAll.tenantType,
curType: formAll.curType,
curType: 1,
googleCodeSwitch: formAll.googleCodeSwitch,
currencyCode:formAll.currencyCode,
// proportion: formAll.proportion||numbers.value,
tenantPlatforms: formAll.tenantSystemPlatforms,
// tenantPlatforms: formAll.tenantSystemPlatforms,
googleCode:formAll.googleCode,
timeZone:formAll.timeZone||'',
}

View File

@ -0,0 +1,551 @@
<template>
<!-- 添加或修改定时任务对话框 -->
<el-dialog v-model="showDialog" align-center width="1500px" style="height: 700px;" append-to-body>
<template #header>
<div style="width: 100%;text-align: center;">{{ t('调额') }}</div>
</template>
<el-scrollbar max-height="700px">
<div style="width: 100%;display: flex;justify-content: space-between;">
<el-form ref="form" :model="form" label-width="120px">
<!-- <el-form-item :label="t('商户账号')" prop="tenantKey">
<el-input v-model="form.tenantKey" style="width: 240px;" placeholder="请输入商户账号" />
</el-form-item> -->
<el-form-item :label="t('币种类型')" prop="currencyCode">
<CustomSelect v-model="platAdjustment.currencyCode" :options="currencyCodesOptions" filterable @change="handleAdjustment(modifyDate);" placeholder="请选择类型" style="width: 200px" />
</el-form-item>
</el-form>
<div>
<el-button @click="handleAddType" type="primary" v-hasPermi="['super:tenant:quota:add']" plain icon="Plus"></el-button>
</div>
</div>
<el-table :data="platAdjustmentList" class="" border>
<el-table-column :label="t('商户账号')" align="center" prop="tenantKey" />
<el-table-column :label="t('币种')" align="center" prop="currencyCode">
<template #default="{ row }">
{{ row.currencyCode ? row.currencyCode : '--' }}
</template>
</el-table-column>
<el-table-column :label="t('可用额度')" align="center" prop="cost">
<template #default="{ row }">
{{ row.realBalance }}
</template>
</el-table-column>
<el-table-column :label="t('信誉额度')" align="center" prop="cost">
<template #default="{ row }">
{{ row.creditBalance }}
</template>
</el-table-column>
<el-table-column :label="t('平台额度')" align="center" prop="balance">
<template #default="{ row }">
<span>{{sumPlatformBalance(row.platformBalanceJson)}}</span>
</template>
</el-table-column>
<el-table-column :label="t('操作')" align="center" prop="balance" width="130px">
<template #default="{ row }">
<div style="display: flex;justify-content: space-between;align-items: center;">
<el-button @click="handleAdd($event,row)"></el-button>
</div>
</template>
</el-table-column>
</el-table>
</el-scrollbar>
<pagination v-show="totalAdjustment > 0" :total="totalAdjustment" v-model:page="platAdjustment.pageNum"
v-model:limit="platAdjustment.pageSize" @pagination="handleAdjustment(modifyDate)" />
<el-dialog :title="t('新增')" align-center v-model="openCreditType" width="520px" append-to-body>
<el-form ref="formCreditTypes" v-if="openCreditType" :model="formCreditType" :rules="rulesCreditType" label-width="120px">
<el-form-item :label="t('额度类型')" prop="quotaType">
<CustomSelect v-if="loding1" v-model="formCreditType.quotaType" :disabledOptions="modifyDate.tenantType == 1?['REPUTATION']:['BALANCE']" :options="quotaTypeArr" placeholder="请选择类型" style="width: 200px" />
</el-form-item>
<el-form-item :label="t('币种')" prop="currencyCode">
<CustomSelect v-model="formCreditType.currencyCode" :options="currencyCodeArr" placeholder="请选择币种" style="width: 200px" />
</el-form-item>
<el-form-item :label="t('平台')" v-if="formCreditType.quotaType == '_FALSE'" prop="platformCode">
<CustomSelect v-model="formCreditType.platformCode" :options="platformCodeArr" placeholder="请选择平台" style="width: 200px" />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitForm" :loading="loadingButton">{{ t('确 定') }}</el-button>
<el-button @click="closeDialog">{{ t(' ') }}</el-button>
</div>
</template>
</el-dialog>
<el-dialog v-if="visible" v-model="visible" align-center :title="t('调额')" width="920px">
<el-descriptions :column="1" border>
<el-descriptions-item label="商户名称">{{formAdjustment.tenantKey}}</el-descriptions-item>
<el-descriptions-item label="币种">{{formAdjustment.currencyCode}}</el-descriptions-item>
</el-descriptions>
<el-divider />
<el-form :model="formAdjustment" :rules="rulesAdjustment" ref="formAdjustmentRef" label-width="120px">
<el-form-item label="可用额度" prop="balanceReal">
<div style="width: 100%;">
<NumberInput style="width: 100%;" v-model="formAdjustment.balanceReal" :disabled="modifyDate.tenantType == 2" :minus="true" digit="4" :placeholder="t('请输入额度')">
<template #prepend>{{ getcurrencySign(formAdjustment.currencyCode) }} {{ formAdjustment.realBalance }}</template>
</NumberInput>
</div>
</el-form-item>
<el-form-item label="信誉额度" prop="balanceCredit">
<div style="width: 100%;">
<NumberInput style="width: 100%;" v-model="formAdjustment.balanceCredit" :disabled="modifyDate.tenantType == 1" :minus="true" digit="4" :placeholder="t('请输入额度')">
<template #prepend>{{ getcurrencySign(formAdjustment.currencyCode) }} {{ formAdjustment.creditBalance }}</template>
</NumberInput>
</div>
</el-form-item>
<el-form-item label="平台额度" prop="platformBalanceJson">
<div style="width: 100%;">
{{sumPlatformBalance(formAdjustment.platformBalanceJson)}}
</div>
</el-form-item>
<el-form-item label="平台额度" prop="platformBalanceJson">
<el-table :data="parsePlatformBalance(formAdjustment.platformBalanceJson)" height="200" ref="myTable" >
<el-table-column :label="t('平台')" align="center" prop="name" />
<el-table-column :label="t('余额')" align="center" prop="balance" />
</el-table>
</el-form-item>
<div style="margin-left: 120px;margin-bottom: 10px;">
{{ t('如需扣余额,则输入负数,例如:-10.50') }}
</div>
<el-form-item :label="t('谷歌验证码')" prop="googleCode">
<el-input v-model="formAdjustment.googleCode" :placeholder="t('请输入谷歌验证码')" />
</el-form-item>
<el-form-item :label="t('备注')" prop="remark">
<el-input type="textarea" rows="4" v-model="formAdjustment.remark" :placeholder="t('请输入备注')" />
</el-form-item>
</el-form>
<template #footer>
<el-button @click="visible = false">{{ t('取消') }}</el-button>
<el-button type="primary" @click="onSubmit">{{ t('') }}</el-button>
</template>
</el-dialog>
</el-dialog>
</template>
<script setup>
import { superTenantList, createTenantCreate, updateSuperTenantResetPwd, addSuperTenantQuota,superCommonPlatformSelect, superTenantQuotaList, updateSuperTenantQuotaUpdate,superCommonQuotaTypeSelect } from "@/api/super/tenant.js";
import { superPlatformSystem } from "@/api/agent";
import { nextTick, ref } from "vue";
import { getLocalStorage } from "@/utils/auth";
import { ElMessage, ElMessageBox } from 'element-plus'
import CustomSelect from '@/components/CustomSelect'
import NumberInput from '@/components/NumberInput'
import { reactify } from "@vueuse/core";
import { number } from "echarts";
const { proxy } = getCurrentInstance()
const { ff_tenant_type, ff_tenant_status } = proxy.useDict("ff_tenant_type", "ff_tenant_status");
const emits = defineEmits(['submit', 'update:show']) //
const props = defineProps({ //
show: {
type: Boolean,
default: false
},
modifyDate: {
type: Object,
default: {}
},
addEditStatus: {
type: String,
default: 'add'
}
})
let resData = getLocalStorage('currencySelect');
const currencyCodesOptions = ref([]);
currencyCodesOptions.value = [
{ label: '全部', value: '0' },
...resData.map(item => ({
label: `${item.currencyName}(${item.currencyCode})`,
value: item.currencyCode
}))
];
const currencySelectAll = getLocalStorage('currencySelect').map(item => {
return {...item, label: item.currencyCode, value: item.currencyCode }
});
const quotaTypeArr = ref([
{ label: proxy.t('可用额度'), value: "BALANCE" },
{ label: proxy.t('平台额度'), value: "_FALSE" },
{ label: proxy.t('信誉额度'), value: "REPUTATION" },
]);
const disabledIS = ref(props.addEditStatus == 'detail' ? true : false); //
const loadingButton = ref(false);
const langDefaultClass = ref(null), langDefaultClassList = ref([]);//
const tenantSystemPlatforms = ref([]);
const realBalance = ref([]);
const showDialog = computed({//
get() {
return props.show
},
set(value) {
emits('update:show', value)
}
})
const formAll = reactive({ //
account: "",
password: "",
scoreRatio: 1,
tenantType: 1,
tenantSystemPlatforms: [],
realBalance: [],
})
const form = ref({
})
const formAdjustment = ref({
})
const formCreditType = ref({
})
const getcurrencySign = (val) => {
let currencySignItem = currencySelectAll.find(item => item.value == val);
return currencySignItem.currencySign
}
const rulesCreditType = ref({
quotaType: [{ required: true, message: proxy.t('额度类型不能为空'), trigger: "change" }],
currencyCode: [{ required: true, message: proxy.t('币种不能为空'), trigger: "change" }],
platformCode: [{ required: true, message: proxy.t('平台不能为空'), trigger: "change" }],
})
//
const rules = ref({
account: [{ required: true, message: proxy.t('商户账号不能为空'), trigger: "blur" }],
password: [{ required: true, message: proxy.t('密码不能为空'), trigger: "blur" }],
scoreRatio: [{ required: true, message: proxy.t('买分比例不能为空'), trigger: "blur" }],
tenantType: [{ required: true, message: proxy.t('商户模式不能为空'), trigger: "change" }],
realBalanceNum: [{ required: true, message: proxy.t('信誉额度不能为空'), trigger: "change" }],
})
const rulesAdjustment = ref({
balanceReal: [
{
validator: (rule, value, callback) => {
// 1.
if (props.modifyDate.tenantType == 2) {
return callback();
}
// 2.
if (value === '' || value === null || value === undefined) {
return callback(new Error("请输入可用额度"));
}
const num = Number(value);
const realBalance = Number(formAdjustment.value.realBalance);
// 3. realBalance
if (num < 0) {
if (Math.abs(num) > realBalance) {
return callback(
new Error(`要减的额度绝对值不能超过可用余额 ${realBalance}`)
);
}
}
// 4.
return callback();
},
trigger: "change"
}
],
balanceCredit: [
{
validator: (rule, value, callback) => {
// 1.
if (props.modifyDate.tenantType == 1) {
return callback();
}
// 2.
if (value === '' || value === null || value === undefined) {
return callback(new Error("请输入额度"));
}
const num = Number(value);
const creditBalance = Number(formAdjustment.value.creditBalance);
// 3. creditBalance
if (num < 0) {
if (Math.abs(num) > creditBalance) {
return callback(
new Error(`要减的额度绝对值不能超过信誉余额 ${creditBalance}`)
);
}
}
// 4.
return callback();
},
trigger: "change"
}
],
googleCode: [{ required: true, message: proxy.t('谷歌验证码不能为空'), trigger: "change" }],
})
const platAdjustment = ref({
pageNum: 1,
pageSize: 100,
orderByColumn: 'currencyCode',
isAsc: 'asc',
tenantKey: '',
currencyCode:'0',
});
const totalAdjustment = ref(0);
const platAdjustmentList = ref([]);
const handleAdjustment = (row) => {
platAdjustment.value.tenantKey = row.tenantKey;
let obj = {
...platAdjustment.value,
currencyCode: platAdjustment.value.currencyCode == 0 ? '' : platAdjustment.value.currencyCode,
}
superTenantQuotaList(obj).then(response => {
platAdjustmentList.value = response.rows;
totalAdjustment.value = response.total;
})
}
//
const sumPlatformBalance = (jsonStr) => {
try {
//
const obj = JSON.parse(jsonStr);
// value
return Object.values(obj).reduce((sum, val) => sum + Number(val), 0).toFixed(4);
} catch (e) {
// console.error("JSON :", e);
return 0;
}
}
//
const parsePlatformBalance = (jsonStr) => {
try {
const obj = JSON.parse(jsonStr);
//
const result = Object.entries(obj).map(([key, value]) => {
// "_" "AG_VND_FALSE" "AG"
const name = key.split("_")[0];
return {
name,
balance: Number(value)
};
});
return result;
} catch (e) {
// console.error("JSON :", e);
return [];
}
}
//
nextTick(() => {
handleAdjustment(props.modifyDate);
})
// DEMO
nextTick(() => {
//
watch(() => [langDefaultClass?.value?.getLangContentList()], ([newContentList], [oldContentList]) => {
if (newContentList?.length > 0) {
formAll.name = newContentList[0].content;
}
}, {
deep: true
})
})
//
const closeDialog = () => {
// showDialog.value = false
openCreditType.value = false;
}
const loding1 = ref(true);
const superCommonQuotaTypeSelects = () =>{
loding1.value = false;
superCommonQuotaTypeSelect({}).then(response => {
quotaTypeArr.value = response.data.map(item => {
return { label: item.name, value: item.code }
});
loding1.value = true;
})
}
const currencyCodeArr = ref([]);
const superCommonCurrencySelects = () =>{
let res = getLocalStorage('currencySelect');
currencyCodeArr.value = res.map(item => {
return { label: item.currencyCode, value: item.currencyCode }
});
}
const platformCodeArr = ref([]);
const superCommonPlatformSelects = () =>{
superCommonPlatformSelect({}).then(response => {
platformCodeArr.value = response.data.map(item => {
return { label: item.platformName, value: item.platformCode }
});
})
}
superCommonPlatformSelects();
superCommonCurrencySelects();
superCommonQuotaTypeSelects();
const openCreditType = ref(false);
const handleAddType = (value) => {
if (!platAdjustment.value.currencyCode || platAdjustment.value.currencyCode == 0){
ElMessage.warning('请选择币种!');
return
}
// openCreditType.value = true;
formAdjustment.value.id = '';
if ( platAdjustmentList.value.length == 0 ){
formAdjustment.value.realBalance = 0;
formAdjustment.value.creditBalance = 0;
formAdjustment.value.platformBalanceJson = '{}';
}else{
formAdjustment.value.id = platAdjustmentList.value[0]?.id;
formAdjustment.value.realBalance = platAdjustmentList.value[0]?.realBalance;
formAdjustment.value.platformBalanceJson = platAdjustmentList.value[0]?.platformBalanceJson;
formAdjustment.value.creditBalance = platAdjustmentList.value[0]?.creditBalance;
}
formAdjustment.value.balanceReal = 0;
formAdjustment.value.balanceCredit = 0;
formAdjustment.value.tenantKey = props.modifyDate.tenantKey;
formAdjustment.value.currencyCode = platAdjustment.value.currencyCode;
visible.value = false;
setTimeout(() => {
visible.value = true;
}, 50);
}
const visible = ref(false);
const handleAdd = (value,row) => {
let rowOpen = JSON.parse(JSON.stringify(row));
formAdjustment.value.id = rowOpen.id;
formAdjustment.value = rowOpen;
formAdjustment.value.balanceReal = 0;
formAdjustment.value.balanceCredit = 0;
visible.value = false;
nextTick(()=>{
visible.value = true;
})
}
const onSubmit = () => {
proxy.$refs["formAdjustmentRef"].validate(valid => {
if (valid) {
let numBalance = 0;
if(Number(formAdjustment.value.balanceReal) < 0 || Number(formAdjustment.value.balanceCredit) < 0){
formAdjustment.value.isOut = false;
if (formAdjustment.value.balanceReal !=0){
numBalance = Math.abs(formAdjustment.value.balanceReal);
}else if (formAdjustment.value.balanceCredit !=0){
numBalance = Math.abs(formAdjustment.value.balanceCredit);
}
}else{
formAdjustment.value.isOut = true;
if (formAdjustment.value.balanceReal !=0){
numBalance = formAdjustment.value.balanceReal
}else if (formAdjustment.value.balanceCredit ==0){
numBalance = formAdjustment.value.balanceCredit;
}
}
let obj = {
id: formAdjustment.value.id,
balance:numBalance,
googleCode: formAdjustment.value.googleCode,
tenantKey: formAdjustment.value.tenantKey,
currencyCode: formAdjustment.value.currencyCode,
quotaType: props.modifyDate.tenantType == 1?'BALANCE':'REPUTATION',
isOut: formAdjustment.value.isOut,
remark: formAdjustment.value.remark
}
updateSuperTenantQuotaUpdate(obj).then(response => {
ElMessage({
type: 'success',
message: proxy.t('调额成功')
})
visible.value = false;
handleAdjustment(props.modifyDate);
})
}
})
}
const numbers = ref(0);
function queryCode(type) {
formAll.tenantSystemPlatforms = formAll.tenantSystemPlatforms.map((item, index) => {
if (type === 'del' && item.cost > tenantSystemPlatforms.value[index].cost) {
item.cost -= 0.5;
item.useCost -= 0.5
} else if (type === 'add') {
item.cost += 0.5;
item.useCost += 0.5;
}
return item
})
if (type === 'del' && numbers.value > 0) {
numbers.value -= 0.5;
} else if (type === 'add') {
numbers.value += 0.5;
}
formAll.proportion = numbers.value;
}
const formRef = ref(null);//
const formCreditTypes = ref(null);//
//
/** 提交按钮 */
function submitForm() {
proxy.$refs["formCreditTypes"].validate(valid => {
if (valid) {
loadingButton.value = true;
let dataObj = {
tenantKey: props.modifyDate.tenantKey,
currencyCode: formCreditType.value.currencyCode,
platformCode: formCreditType.value.platformCode,
quotaType: formCreditType.value.quotaType,
}
addSuperTenantQuota(dataObj).then(response => {
loadingButton.value = false;
proxy.$modal.msgSuccess(proxy.t('新增成功'));
openCreditType.value = false;
formCreditTypes.value?.resetFields()
handleAdjustment(props.modifyDate);
}).catch(() => {
loadingButton.value = false;
});
}
});
}
</script>
<style scope lang="scss">
.icon-box {
display: flex;
align-items: center;
gap: 20px;
}
.disable-click {
pointer-events: none;
}
.label-scoreRatio {
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10px;
span {
width: 120px;
text-align: right;
font-weight: 700;
padding-right: 12px;
}
}
.scoreRatioTable {
width: calc(100% - 120px);
margin-left: 120px;
}
</style>

View File

@ -1,116 +1,32 @@
<template>
<!-- 添加或修改定时任务对话框 -->
<el-dialog v-model="showDialog" align-center width="1500px" style="height: 700px;" append-to-body>
<template #header>
<div style="width: 100%;text-align: center;">{{ t('调额') }}</div>
</template>
<el-scrollbar max-height="700px">
<div style="width: 100%;display: flex;justify-content: space-between;">
<el-form ref="form" :model="form" label-width="120px">
<!-- <el-form-item :label="t('商户账号')" prop="tenantKey">
<el-input v-model="form.tenantKey" style="width: 240px;" placeholder="请输入商户账号" />
</el-form-item> -->
<el-form-item :label="t('币种类型')" prop="currencyCode">
<CustomSelect v-model="platAdjustment.currencyCode" :options="currencyCodesOptions" filterable @change="handleAdjustment(modifyDate);" placeholder="请选择类型" style="width: 200px" />
</el-form-item>
</el-form>
<div>
<el-button @click="handleAddType" type="primary" v-hasPermi="['super:tenant:quota:add']" plain icon="Plus"></el-button>
</div>
</div>
<el-table :data="platAdjustmentList" class="" border>
<el-table-column :label="t('商户账号')" align="center" prop="tenantKey" />
<el-table-column :label="t('币种')" align="center" prop="currencyCode">
<template #default="{ row }">
{{ row.currencyCode ? row.currencyCode : '--' }}
</template>
</el-table-column>
<el-table-column :label="t('可用额度')" align="center" prop="cost">
<template #default="{ row }">
{{ row.realBalance }}
</template>
</el-table-column>
<el-table-column :label="t('信誉额度')" align="center" prop="cost">
<template #default="{ row }">
{{ row.creditBalance }}
</template>
</el-table-column>
<el-table-column :label="t('平台额度')" align="center" prop="balance">
<template #default="{ row }">
<span>{{sumPlatformBalance(row.platformBalanceJson)}}</span>
</template>
</el-table-column>
<el-table-column :label="t('操作')" align="center" prop="balance" width="130px">
<template #default="{ row }">
<div style="display: flex;justify-content: space-between;align-items: center;">
<el-button @click="handleAdd($event,row)"></el-button>
</div>
</template>
</el-table-column>
</el-table>
</el-scrollbar>
<pagination v-show="totalAdjustment > 0" :total="totalAdjustment" v-model:page="platAdjustment.pageNum"
v-model:limit="platAdjustment.pageSize" @pagination="handleAdjustment(modifyDate)" />
<el-dialog :title="t('新增')" align-center v-model="openCreditType" width="520px" append-to-body>
<el-form ref="formCreditTypes" v-if="openCreditType" :model="formCreditType" :rules="rulesCreditType" label-width="120px">
<el-form-item :label="t('额度类型')" prop="quotaType">
<CustomSelect v-if="loding1" v-model="formCreditType.quotaType" :disabledOptions="modifyDate.tenantType == 1?['REPUTATION']:['BALANCE']" :options="quotaTypeArr" placeholder="请选择类型" style="width: 200px" />
</el-form-item>
<el-form-item :label="t('币种')" prop="currencyCode">
<CustomSelect v-model="formCreditType.currencyCode" :options="currencyCodeArr" placeholder="请选择币种" style="width: 200px" />
</el-form-item>
<el-form-item :label="t('平台')" v-if="formCreditType.quotaType == '_FALSE'" prop="platformCode">
<CustomSelect v-model="formCreditType.platformCode" :options="platformCodeArr" placeholder="请选择平台" style="width: 200px" />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitForm" :loading="loadingButton">{{ t('确 定') }}</el-button>
<el-button @click="closeDialog">{{ t(' ') }}</el-button>
</div>
</template>
</el-dialog>
<el-dialog v-if="visible" v-model="visible" align-center :title="t('调额')" width="920px">
<el-dialog v-model="showDialog" align-center :title="t('调额')" width="720px">
<el-descriptions :column="1" border>
<!-- <el-descriptions-item label="商户ID">kooriookami</el-descriptions-item> -->
<el-descriptions-item label="商户名称">{{formAdjustment.tenantKey}}</el-descriptions-item>
<el-descriptions-item label="币种">{{formAdjustment.currencyCode}}</el-descriptions-item>
</el-descriptions>
<el-divider />
<el-form :model="formAdjustment" :rules="rulesAdjustment" ref="formAdjustmentRef" label-width="120px">
<el-form-item label="可用额度" prop="balanceReal">
<div style="width: 100%;display: flex;align-items: center;height: 50px;">
<div style="width: 120px;text-align: right;font-size: 18px;">
余额
</div>
<div style="color: #fa8c16;font-size: 16px;">
<span v-if="modifyDate.tenantType == 1"> {{ formAdjustment.tenantBalance?.realBalance }}</span>
<span v-if="modifyDate.tenantType == 2"> {{ formAdjustment.tenantBalance?.creditBalance }}</span>
</div>
</div>
<el-form-item label="调额" prop="balance">
<div style="width: 100%;">
<NumberInput style="width: 100%;" v-model="formAdjustment.balanceReal" :disabled="modifyDate.tenantType == 2" :minus="true" digit="4" :placeholder="t('请输入额度')">
<template #prepend>{{ getcurrencySign(formAdjustment.currencyCode) }} {{ formAdjustment.realBalance }}</template>
<NumberInput style="width: 100%;" v-model="formAdjustment.balance" :minus="true" digit="4" :placeholder="t('请输入额度')">
<template #prepend>{{ getcurrencySign(formAdjustment.currencyCode) }}</template>
</NumberInput>
</div>
</el-form-item>
<el-form-item label="信誉额度" prop="balanceCredit">
<div style="width: 100%;">
<NumberInput style="width: 100%;" v-model="formAdjustment.balanceCredit" :disabled="modifyDate.tenantType == 1" :minus="true" digit="4" :placeholder="t('请输入额度')">
<template #prepend>{{ getcurrencySign(formAdjustment.currencyCode) }} {{ formAdjustment.creditBalance }}</template>
</NumberInput>
<div style="margin-bottom: 10px;">
{{ t('如需扣余额,则输入负数,例如:-10.50') }}
</div>
</el-form-item>
<el-form-item label="平台额度" prop="platformBalanceJson">
<div style="width: 100%;">
{{sumPlatformBalance(formAdjustment.platformBalanceJson)}}
</div>
</el-form-item>
<el-form-item label="平台额度" prop="platformBalanceJson">
<el-table :data="parsePlatformBalance(formAdjustment.platformBalanceJson)" height="200" ref="myTable" >
<el-table-column :label="t('平台')" align="center" prop="name" />
<el-table-column :label="t('余额')" align="center" prop="balance" />
</el-table>
</el-form-item>
<div style="margin-left: 120px;margin-bottom: 10px;">
{{ t('如需扣余额,则输入负数,例如:-10.50') }}
</div>
<el-form-item :label="t('谷歌验证码')" prop="googleCode">
<el-input v-model="formAdjustment.googleCode" :placeholder="t('请输入谷歌验证码')" />
</el-form-item>
@ -119,14 +35,13 @@
</el-form-item>
</el-form>
<template #footer>
<el-button @click="visible = false">{{ t('取消') }}</el-button>
<el-button @click="showDialog = false">{{ t('取消') }}</el-button>
<el-button type="primary" @click="onSubmit">{{ t('') }}</el-button>
</template>
</el-dialog>
</el-dialog>
</template>
<script setup>
import { superTenantList, createTenantCreate, updateSuperTenantResetPwd, addSuperTenantQuota,superCommonPlatformSelect, superTenantQuotaList, updateSuperTenantQuotaUpdate,superCommonQuotaTypeSelect } from "@/api/super/tenant.js";
import { addSuperTenantQuota,superCommonPlatformSelect, superTenantQuotaList, updateSuperTenantQuotaUpdate,superCommonQuotaTypeSelect } from "@/api/super/tenant.js";
import { superPlatformSystem } from "@/api/agent";
import { nextTick, ref } from "vue";
import { getLocalStorage } from "@/utils/auth";
@ -202,8 +117,8 @@ const formCreditType = ref({
})
const getcurrencySign = (val) => {
let currencySignItem = currencySelectAll.find(item => item.value == val);
return currencySignItem.currencySign
let currencySignItem = currencySelectAll?.find(item => item.value == val);
return currencySignItem?.currencySign
}
const rulesCreditType = ref({
quotaType: [{ required: true, message: proxy.t('额度类型不能为空'), trigger: "change" }],
@ -219,7 +134,7 @@ const rules = ref({
realBalanceNum: [{ required: true, message: proxy.t('信誉额度不能为空'), trigger: "change" }],
})
const rulesAdjustment = ref({
balanceReal: [
balance: [
{
validator: (rule, value, callback) => {
// 1.
@ -231,49 +146,32 @@ const rulesAdjustment = ref({
if (value === '' || value === null || value === undefined) {
return callback(new Error("请输入可用额度"));
}
const num = Number(value);
const realBalance = Number(formAdjustment.value.realBalance);
// 3. realBalance
if (num < 0) {
if (Math.abs(num) > realBalance) {
return callback(
new Error(`要减的额度绝对值不能超过可用余额 ${realBalance}`)
);
}
}
// 4.
return callback();
},
trigger: "change"
}
],
balanceCredit: [
{
validator: (rule, value, callback) => {
// 1.
if (props.modifyDate.tenantType == 1) {
return callback();
}
const num = Number(value);
const realBalance = Number(formAdjustment.value.realBalance);
// 2.
if (value === '' || value === null || value === undefined) {
return callback(new Error("请输入额度"));
}
const num = Number(value);
const creditBalance = Number(formAdjustment.value.creditBalance);
// 3. creditBalance
if (num < 0) {
if (Math.abs(num) > creditBalance) {
return callback(
new Error(`要减的额度绝对值不能超过信誉余额 ${creditBalance}`)
);
// 3. realBalance
if (num < 0) {
if (Math.abs(num) > realBalance) {
return callback(
new Error(`要减的额度绝对值不能超过可用余额 ${realBalance}`)
);
}
}
}
if (props.modifyDate.tenantType == 2) {
const num = Number(value);
const creditBalance = Number(formAdjustment.value.creditBalance);
// 3. creditBalance
if (num < 0) {
if (Math.abs(num) > creditBalance) {
return callback(
new Error(`要减的额度绝对值不能超过可用余额 ${creditBalance}`)
);
}
}
}
}
// 4.
return callback();
@ -281,7 +179,7 @@ balanceCredit: [
trigger: "change"
}
],
googleCode: [{ required: true, message: proxy.t('谷歌验证码不能为空'), trigger: "change" }],
googleCode: [{ required: true, message: proxy.t('谷歌验证码不能为空'), trigger: "change" }],
})
const platAdjustment = ref({
pageNum: 1,
@ -343,7 +241,9 @@ const parsePlatformBalance = (jsonStr) => {
}
//
nextTick(() => {
handleAdjustment(props.modifyDate);
// handleAdjustment(props.modifyDate);
formAdjustment.value = props.modifyDate;
formAdjustment.value.googleCode = "";
})
// DEMO
@ -361,7 +261,7 @@ nextTick(() => {
//
const closeDialog = () => {
// showDialog.value = false
openCreditType.value = false;
showDialog.value = false;
}
@ -390,9 +290,9 @@ const superCommonPlatformSelects = () =>{
});
})
}
superCommonPlatformSelects();
superCommonCurrencySelects();
superCommonQuotaTypeSelects();
// superCommonPlatformSelects();
// superCommonCurrencySelects();
// superCommonQuotaTypeSelects();
const openCreditType = ref(false);
const handleAddType = (value) => {
if (!platAdjustment.value.currencyCode || platAdjustment.value.currencyCode == 0){
@ -421,35 +321,17 @@ const handleAddType = (value) => {
}, 50);
}
const visible = ref(false);
const handleAdd = (value,row) => {
let rowOpen = JSON.parse(JSON.stringify(row));
formAdjustment.value.id = rowOpen.id;
formAdjustment.value = rowOpen;
formAdjustment.value.balanceReal = 0;
formAdjustment.value.balanceCredit = 0;
visible.value = false;
nextTick(()=>{
visible.value = true;
})
}
const onSubmit = () => {
proxy.$refs["formAdjustmentRef"].validate(valid => {
if (valid) {
let numBalance = 0;
if(Number(formAdjustment.value.balanceReal) < 0 || Number(formAdjustment.value.balanceCredit) < 0){
if(Number(formAdjustment.value.balance) < 0){
formAdjustment.value.isOut = false;
if (formAdjustment.value.balanceReal !=0){
numBalance = Math.abs(formAdjustment.value.balanceReal);
}else if (formAdjustment.value.balanceCredit !=0){
numBalance = Math.abs(formAdjustment.value.balanceCredit);
}
numBalance = Math.abs(formAdjustment.value.balance);
}else{
formAdjustment.value.isOut = true;
if (formAdjustment.value.balanceReal !=0){
numBalance = formAdjustment.value.balanceReal
}else if (formAdjustment.value.balanceCredit ==0){
numBalance = formAdjustment.value.balanceCredit;
}
numBalance = formAdjustment.value.balance
}
let obj = {
id: formAdjustment.value.id,
@ -466,8 +348,8 @@ const onSubmit = () => {
type: 'success',
message: proxy.t('调额成功')
})
visible.value = false;
handleAdjustment(props.modifyDate);
closeDialog();
emits('submit');
})
}
})
@ -510,7 +392,7 @@ function submitForm() {
proxy.$modal.msgSuccess(proxy.t('新增成功'));
openCreditType.value = false;
formCreditTypes.value?.resetFields()
handleAdjustment(props.modifyDate);
// handleAdjustment(props.modifyDate);
}).catch(() => {
loadingButton.value = false;
});

View File

@ -2,108 +2,111 @@
<!-- 添加或修改定时任务对话框 -->
<el-dialog :title="t('修改')" align-center v-model="showDialog" width="880px" append-to-body @opened="forceUpdateTable">
<el-scrollbar max-height="600px">
<el-form ref="agentRef" :model="formAll" :rules="rules" label-width="120px">
<el-row>
<el-col :span="12">
<el-form-item :label="t('商户账号')" prop="account">
<el-input v-model="formAll.account" disabled :placeholder="t('请输入商户账号')" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="t('密码')" prop="password">
<el-input v-model="formAll.password" disabled auto-complete="off" type="password"
:placeholder="t('请输入密码')" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item :label="t('商户模式')" prop="tenantType">
<el-radio-group v-model="formAll.tenantType" style="pointer-events: none;">
<el-radio-button v-for="item in ff_tenant_type" :key="item.value" :value="item.value">{{
item.label }}</el-radio-button>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="t('谷歌验证')" prop="curType">
<el-switch
v-model="formAll.googleCodeSwitch"
inline-prompt
:active-value="1"
:inactive-value="0"
active-text="启用"
inactive-text="禁用"
/>
</el-form-item>
</el-col>
</el-row>
<el-form-item :label="t('买分比例')" prop="scoreRatio">
<el-input-number v-model="formAll.scoreRatio" :precision="1" :min="0.9" :step="0.1"
:max="2"></el-input-number>
&nbsp;
{{ t(' (万法定货币=1万通用额度)') }}
</el-form-item>
<!-- <el-form-item :label="t('谷歌验证码')" prop="googleCode">
<el-input v-model="formAll.googleCode" style="width: 260px;" :placeholder="t('请输入谷歌验证码')" />
</el-form-item> -->
<el-form-item :label="t('币种模式')" prop="curType">
<el-radio-group v-model="formAll.curType">
<el-radio-button value="1" @click="changeCurrency('VND')">{{ t('') }}</el-radio-button>
<el-radio-button value="2" @click="changeCurrency('')">{{ t('') }}</el-radio-button>
<el-tabs v-model="activeName" class="demo-tabs" >
<el-tab-pane :label="t('常规')" name="first"></el-tab-pane>
<el-tab-pane :label="t('接入')" name="second"></el-tab-pane>
</el-tabs>
<div v-if="activeName == 'first'">
<el-form ref="agentRef" :model="formAll" :rules="rules" label-width="120px">
<el-form-item :label="t('商户账号')" prop="account">
<el-input v-model="formAll.account" disabled :placeholder="t('请输入商户账号')" />
</el-form-item>
<el-form-item :label="t('密码')" prop="password">
<el-input v-model="formAll.password" disabled auto-complete="off" type="password"
:placeholder="t('请输入密码')" />
</el-form-item>
<el-form-item :label="t('币种')" prop="currencyCode">
<CustomSelect v-model="formAll.currencyCode" disabled :options="currencySelectArr" placeholder="请选择币种"/>
</el-form-item>
<el-form-item :label="t('商户模式')" prop="tenantType">
<el-radio-group v-model="formAll.tenantType" disabled>
<el-radio-button v-for="item in ff_tenant_type" :key="item.value" :value="item.value">{{
item.label }}</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item v-if="formAll.curType == 1">
<CustomSelect v-model="formAll.currencyCode" @change="changeCurrency" :options="currencySelectArr" placeholder="请选择币种"/>
</el-form-item>
<div class="label-scoreRatio">
<span>{{ t('平台比例') }}</span>
</el-form-item>
<el-form-item :label="t('谷歌验证')" prop="curType">
<el-switch
v-model="formAll.googleCodeSwitch"
inline-prompt
:active-value="1"
:inactive-value="0"
active-text="启用"
inactive-text="禁用"
/>
</el-form-item>
<el-form-item :label="t('买分比例')" prop="scoreRatio">
<el-input-number v-model="formAll.scoreRatio" :precision="1" :min="0.9" :step="0.1"
:max="2"></el-input-number>
&nbsp;
{{ t(' (万法定货币=1万通用额度)') }}
</el-form-item>
<!-- <el-form-item :label="t('谷歌验证码')" prop="googleCode">
<el-input v-model="formAll.googleCode" style="width: 260px;" :placeholder="t('请输入谷歌验证码')" />
</el-form-item> -->
<!-- <div class="label-scoreRatio">
<span>{{ t('平台比例') }}</span>
<div>
<el-button type="danger" @click="queryCode('del')"
:disabled="!formAll.tenantSystemPlatforms.length">-0.5</el-button>
<el-button type="primary" @click="queryCode('add')"
:disabled="!formAll.tenantSystemPlatforms.length">+0.5</el-button>
</div>
</div> -->
<!-- <div style="display: flex;margin-left: 120px;justify-content: space-between;margin-bottom: 10px;">
<div>
<CustomSelect v-if="showLoding2" v-model="searchPlatformCode" clearable :options="sys_job_status" filterable placeholder="请选择游戏平台" style="width: 200px" />
<CustomSelect v-model="searchCurrencyCode" :options="currencySelectArr" clearable placeholder="请选择币种" style="width: 200px"/>
</div>
<div>
<el-button type="primary" @click="searchSystemPlatforms">{{ t('') }}</el-button>
</div>
</div> -->
<!-- <el-table :data="formAll.tenantSystemPlatforms" ref="myTable" class="scoreRatioTable" >
<el-table-column :label="t('平台')" align="center" prop="platformCode" />
<el-table-column :label="t('币种')" align="center" prop="currencyCode" />
<el-table-column :label="t('成本比例(%')" align="center" min-width="120" prop="cost">
<template #default="scope">
{{ scope.row.cost }}%
</template>
</el-table-column>
<el-table-column :label="t('商户通用比例(%')" align="center" prop="useCost" min-width="130">
<template #default="scope">
<div style="display: flex;align-items: center;">
<el-input v-model="scope.row.useCost" @input="handleInput(scope.row)"
@blur="handleBlur(scope.row)" :placeholder="t('请输入')" />&nbsp;%
</div>
</template>
</el-table-column>
<el-table-column prop="maxAmount" label="带入金额" min-width="180">
<template #default="scope">
<div style="display:flex;align-items: center;"><NumberInput v-model="scope.row.minAmount"></NumberInput> ~ <NumberInput v-model="scope.row.maxAmount"></NumberInput></div>
</template>
</el-table-column>
</el-table> -->
<!-- <pagination v-show="totalPlatform > 0" :total="totalPlatform" v-model:page="platformSystem.pageNum"
v-model:limit="platformSystem.pageSize" @pagination="getSelectPlatform" /> -->
</el-form>
</div>
<div v-if="activeName == 'second'">
<div style="display: flex;width: 100%;margin-bottom: 25px;">
<div style="width: 120px;text-align: right;">商户ID</div>
<div>{{ formAll.id }} <CopyIcon :colors="'#409EFF'" v-if="formAll.id" :text="String(formAll.id)"></CopyIcon></div>
</div>
<div style="display: flex;width: 100%;margin-bottom: 25px;">
<div style="width: 120px;text-align: right;">商户KEY</div>
<div>{{ formAll.tenantKey }} <CopyIcon :colors="'#409EFF'" v-if="formAll.tenantKey" :text="String(formAll.tenantKey)"></CopyIcon></div>
</div>
<div style="display: flex;width: 100%;margin-bottom: 25px;">
<div style="width: 120px;text-align: right;">商户密钥</div>
<div>
<el-button type="danger" @click="queryCode('del')"
:disabled="!formAll.tenantSystemPlatforms.length">-0.5</el-button>
<el-button type="primary" @click="queryCode('add')"
:disabled="!formAll.tenantSystemPlatforms.length">+0.5</el-button>
{{ formAll.tenantSecret }}
<CopyIcon :colors="'#409EFF'" v-if="formAll.tenantSecret" :text="String(formAll.tenantSecret)"></CopyIcon>
<el-button type="primary" link @click="handleReset" v-hasPermi="['super:tenant:edit']"></el-button>
</div>
</div>
<div style="display: flex;margin-left: 120px;justify-content: space-between;margin-bottom: 10px;">
<div>
<CustomSelect v-if="showLoding2" v-model="searchPlatformCode" clearable :options="sys_job_status" filterable placeholder="请选择游戏平台" style="width: 200px" />
<CustomSelect v-model="searchCurrencyCode" :options="currencySelectArr" clearable placeholder="请选择币种" style="width: 200px"/>
</div>
<div>
<el-button type="primary" @click="searchSystemPlatforms">{{ t('') }}</el-button>
</div>
</div>
<el-table :data="formAll.tenantSystemPlatforms" ref="myTable" class="scoreRatioTable" >
<!-- <el-table-column :label="t('id')" align="center" >
<template #default="{row,$index}">
{{$index}}
</template>
</el-table-column> -->
<el-table-column :label="t('平台')" align="center" prop="platformCode" />
<el-table-column :label="t('币种')" align="center" prop="currencyCode" />
<el-table-column :label="t('成本比例(%')" align="center" min-width="120" prop="cost">
<template #default="scope">
{{ scope.row.cost }}%
</template>
</el-table-column>
<el-table-column :label="t('商户通用比例(%')" align="center" prop="useCost" min-width="130">
<template #default="scope">
<div style="display: flex;align-items: center;">
<el-input v-model="scope.row.useCost" @input="handleInput(scope.row)"
@blur="handleBlur(scope.row)" :placeholder="t('请输入')" />&nbsp;%
</div>
</template>
</el-table-column>
<el-table-column prop="maxAmount" label="带入金额" min-width="180">
<template #default="scope">
<div style="display:flex;align-items: center;"><NumberInput v-model="scope.row.minAmount"></NumberInput> ~ <NumberInput v-model="scope.row.maxAmount"></NumberInput></div>
</template>
</el-table-column>
</el-table>
<!-- <pagination v-show="totalPlatform > 0" :total="totalPlatform" v-model:page="platformSystem.pageNum"
v-model:limit="platformSystem.pageSize" @pagination="getSelectPlatform" /> -->
</el-form>
</div>
</el-scrollbar>
<template #footer>
<div class="dialog-footer">
@ -114,13 +117,15 @@
</el-dialog>
</template>
<script setup>
import { updateSuperTenantEdit } from "@/api/super/tenant.js";
import { updateSuperTenantEdit,updateSuperResetSecret } from "@/api/super/tenant.js";
import { getPlatformShowSelect } from "@/api/super/platform.js";
import { superPlatformSystem } from "@/api/agent";
import { getLocalStorage } from "@/utils/auth";
import { nextTick, ref } from "vue";
import CustomSelect from '@/components/CustomSelect'
import CopyIcon from '@/components/CopyIcon'
import NumberInput from '@/components/NumberInput'
import { el } from "element-plus/es/locales.mjs";
const { proxy } = getCurrentInstance()
const { ff_tenant_type, ff_tenant_status } = proxy.useDict("ff_tenant_type", "ff_tenant_status");
const emits = defineEmits(['submit', 'update:show']) //
@ -141,6 +146,8 @@ const props = defineProps({ // 父组件向子组件传值
})
const disabledIS = ref(props.addEditStatus == 'detail' ? true : false); //
const langDefaultClass = ref(null), langDefaultClassList = ref([]);//
const activeName = ref('first');
const tenantSystemPlatforms = ref([]);
const loadingButton = ref(false);
const oldForm = shallowRef({ });
@ -197,11 +204,21 @@ currencySelectArr.value = res.map(item => {
})
//
const rules = ref({
account: [{ required: true, message: proxy.t('商户账号不能为空'), trigger: "blur" }],
scoreRatio: [{ required: true, message: proxy.t('买分比例不能为空'), trigger: "blur" }],
password: [
{
required: true,
validator: (rule, value, callback) => {
callback(); //
},
trigger: 'change'
}
],
account: [{ required: true, message: proxy.t('商户账号不能为空'), trigger: "change" }],
scoreRatio: [{ required: true, message: proxy.t('买分比例不能为空'), trigger: "change" }],
googleCode: [{ required: true, message: proxy.t('谷歌验证码不能为空'), trigger: "change" }],
tenantType: [{ required: true, message: proxy.t('商户模式不能为空'), trigger: "change" }],
realBalanceNum: [{ required: true, message: proxy.t('信誉额度不能为空'), trigger: "change" }],
currencyCode: [{ required: true, message: proxy.t('币种不能为空'), trigger: "change" }],
})
const totalPlatform = ref(0);
@ -298,6 +315,23 @@ const getsuperCommonPlatformTypeSelect = async () => {
showLoding2.value = true;
});
}
//
const handleReset = () => {
proxy.$confirm('确定重置吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
updateSuperResetSecret(formAll.id).then(res => {
proxy.$modal.msgSuccess(proxy.t('重置成功'));
formAll.tenantSecret = res.msg;
})
}).catch(() => {});
}
//
nextTick(() => {
getSelectPlatform();
@ -309,11 +343,13 @@ nextTick(() => {
nextTick(() => {
//
// formAll.tenantSystemPlatforms = props.modifyDate.tenantSystemPlatforms;
Object.assign(formAll, props.modifyDate);
PlatformRatioAll.value = props.modifyDate.tenantSystemPlatforms;
formAll.account = props.modifyDate.account;
formAll.tenantType = props.modifyDate.tenantType;
formAll.scoreRatio = props.modifyDate.scoreRatio;
formAll.curType = props.modifyDate.curType;
formAll.currencyCode = props.modifyDate.currencyCode;
formAll.googleCodeSwitch = props.modifyDate.googleCodeSwitch;
})
@ -399,11 +435,12 @@ function submitForm() {
let dataObj = {
id: props.modifyDate.id,
scoreRatio: formAll.scoreRatio,
curType: formAll.curType,
curType: 1,
googleCodeSwitch: formAll.googleCodeSwitch,
currencyCode: formAll.currencyCode,
// tenantType: formAll.tenantType,
// googleCode:formAll.googleCode,
tenantPlatforms: formAll.tenantSystemPlatforms,
// tenantPlatforms: formAll.tenantSystemPlatforms,
}
if (JSON.stringify(formAll) != oldForm.value) {

View File

@ -23,26 +23,30 @@
</table-search-card>
<el-table v-loading="loading" :data="agentList" class="c-table-main" border>
<!-- <el-table-column type="selection" width="55" align="center" /> -->
<el-table-column :label="t('商户标识')" width="100" align="center" prop="tenantSn" >
<el-table-column :label="t('商户标识')" min-width="100" align="center" prop="tenantSn" >
<template #default="{row}">
{{ row.tenantSn }}<br/>
<span v-if="row.agentAccount">{{ t('') }}: {{ row.agentAccount }}</span>
</template>
</el-table-column>
<el-table-column :label="t('商户账号')" align="center" prop="tenantKey" width="170px" >
<el-table-column :label="t('商户账号')" align="center" prop="tenantKey" min-width="170px" >
<template #default="{row}">
<div style="width: 100%;text-align: left;">{{ t('账号') }} {{ row.tenantKey }}</div>
<div style="width: 100%;text-align: left;">{{ t('谷歌') }}
<span v-if="row.googleCode == null || row.googleCode == ''" style="color: #909399;">{{ t('') }}</span>
<span v-else style="color: #1ab394;">{{ t('已绑定') }} <el-button link type="primary" @click="handleUnbindGoogle(row)" v-hasPermi="['super:tenant:resetGoogleCode']">{{ t('') }}</el-button></span>
</div>
</template>
</el-table-column>
<el-table-column :label="t('商户额度')" width="100" align="center" >
<el-table-column :label="t('余额')" min-width="160" align="center" >
<template #default="{row}">
<el-button link type="primary" @click="handleAdjustment(row)" v-hasPermi="['super:tenant:quota:update']">{{ t('') }}</el-button>
<div style="display: flex;justify-content: space-between;">
<div>
{{ getcurrencySign(row.currencyCode) }} {{ (row.realBalance ?? 0) + (row.creditBalance ?? 0) }}
</div>
<el-button link type="primary" @click="handleAdjustment(row)" v-hasPermi="['super:tenant:quota:update']">{{ t('') }}</el-button>
</div>
</template>
</el-table-column>
<!-- <el-table-column :label="t('商户Api平台配置')" width="100" align="center" >
@ -50,11 +54,11 @@
<el-button link type="primary" @click="handleView(scope.row)" v-hasPermi="['agent:tenant:view']">{{ t('') }}</el-button>
</template>
</el-table-column> -->
<el-table-column :label="t('注册时间')" align="center" prop="createTime" :show-overflow-tooltip="true">
<el-table-column :label="t('注册时间')" align="center" prop="createTime" min-width="120">
<template #default="scope">{{ parseTime(scope.row.createTime)|| '--' }}</template>
</el-table-column>
<el-table-column :label="t('最后登录时间')" align="center" prop="loginData" :show-overflow-tooltip="true">
<el-table-column :label="t('最后登录时间')" align="center" prop="loginData" min-width="120">
<template #default="scope">{{ parseTime(scope.row.loginData) || '--' }}</template>
</el-table-column>
@ -65,6 +69,12 @@
:before-change="() => beforeSwitchChange(row, 'tenantStatus')" v-hasPermi="['super:tenant:switch']" />
</template>
</el-table-column>
<el-table-column :label="t('商户平台费率')" min-width="130" align="center">
<template #default="{row}">
<el-button type="primary" plain @click="handleView(row)">{{ t('') }}</el-button>
</template>
</el-table-column>
<el-table-column :label="t('操作')" align="center" width="260" class-name="small-padding fixed-width">
<template #default="scope">
<el-popconfirm
@ -93,47 +103,62 @@
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
<!-- 详情 -->
<el-dialog :title="t('成本比例')" v-model="openView" width="820px" append-to-body>
<el-form :model="form" :rules="rules" label-width="120px">
<el-form-item :label="t('商户账号')" prop="account">
<el-input :disabled="openView" v-model="form.account" :placeholder="t('请输入商户账号')" />
</el-form-item>
<el-form-item :label="t('商户模式')" prop="tenantType">
<el-radio-group v-model="form.tenantType" :disabled="openView">
<el-radio-button v-for="item in ff_tenant_type" :key="item.value" :value="item.value">{{ item.label }}</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item :label="t('买分比例')" >
<el-input :disabled="openView" v-model="form.scoreRatio" placeholder="" />
</el-form-item>
<div class="label-scoreRatio">
<span>{{ t('平台比例') }}</span>
<div>
<el-button type="danger" :disabled="openView">-0.5</el-button>
<el-button type="primary" :disabled="openView">+0.5</el-button>
</div>
</div>
<el-table :data="form.tenantSystemPlatforms" class="scoreRatioTable">
<!-- 商户平台费率 -->
<el-dialog v-if="openView" :title="t('商户平台费率')" v-model="openView" align-center width="820px" append-to-body>
<el-descriptions :column="2" border>
<el-descriptions-item label="商户标识">{{form.tenantSn}}</el-descriptions-item>
<el-descriptions-item label="商户账号">{{form.tenantKey}}</el-descriptions-item>
</el-descriptions>
<div style="height: 30px;"></div>
<el-form :model="form" ref="openViewRef" :rules="rules" label-width="120px">
<div class="label-scoreRatio">
<span>{{ t('平台比例') }}</span>
<div>
<el-button type="danger" @click="queryCode('del')" :disabled="!form.tenantSystemPlatforms.length">-0.5</el-button>
<el-button type="primary" @click="queryCode('add')" :disabled="!form.tenantSystemPlatforms.length">+0.5</el-button>
</div>
</div>
<div style="display: flex;margin-left: 120px;justify-content: space-between;margin-bottom: 10px;">
<el-input
v-model="searchPlatformCode"
style="width: 100%"
:placeholder="t('请输入游戏平台')"
:suffix-icon="Search"
@input="searchSystemPlatforms"
/>
</div>
<el-table :data="form.tenantSystemPlatforms" height="500" width="700px" class="scoreRatioTable">
<el-table-column :label="t('平台')" align="center" prop="platformCode" />
<el-table-column :label="t('币种')" align="center" prop="currencyCode" />
<el-table-column :label="t('成本比例(%')" align="center" prop="cost">
<template #default="scope">
{{ scope.row.cost }}%
</template>
</el-table-column>
<el-table-column :label="t('商户通用比例(%')" align="center" prop="useCost">
<template #default="scope">
{{ scope.row.useCost }}%
</template>
</el-table-column>
<el-table-column :label="t('成本比例(%')" align="center" min-width="120" prop="cost">
<template #default="scope">
{{ scope.row.cost }}%
</template>
</el-table-column>
<el-table-column :label="t('商户通用比例(%')" align="center" min-width="130" prop="useCost">
<template #default="scope">
<div style="display: flex;align-items: center;">
<el-input v-model="scope.row.useCost" @input="handleInput(scope.row)"
@blur="handleBlur(scope.row)" :placeholder="t('请输入')" >
<template #append>%</template>
</el-input>
</div>
</template>
</el-table-column>
<el-table-column prop="maxAmount" label="带入金额" min-width="180">
<template #default="scope">
<div style="display:flex;align-items: center;"><NumberInput v-model="scope.row.minAmount" @input="handleInput1(scope.row)"></NumberInput> ~ <NumberInput v-model="scope.row.maxAmount" @input="handleInput2(scope.row)"></NumberInput></div>
</template>
</el-table-column>
</el-table>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="openView = false">{{ t('关 闭') }}</el-button>
</div>
</template>
<div class="dialog-footer">
<el-button type="primary" @click="submitForm" :loading="loadingButton" v-hasPermi="['super:tenant:edit']">{{ t(' ') }}</el-button>
<el-button @click="closeDialog">{{ t(' ') }}</el-button>
</div>
</template>
</el-dialog>
<el-dialog :title="t('对接信息')" align-center v-model="openReset" width="620px" append-to-body>
@ -193,8 +218,9 @@
</template>
<script setup name="Agent">
import { superTenantList, createTenantCreate,updateSuperTenantResetPwd,updateSuperResetGoogleCode,getSuperTenant,superTenantQuotaList,updateSuperTenantQuotaUpdate,updateSuperTenantSwitch } from "@/api/super/tenant.js";
import { superTenantList, updateSuperTenantEdit,updateSuperTenantResetPwd,updateSuperResetGoogleCode,getSuperTenant,superTenantQuotaList,updateSuperTenantQuotaUpdate,updateSuperTenantSwitch } from "@/api/super/tenant.js";
import { superPlatformSystem } from "@/api/agent";
import { getPlatformShowSelect } from "@/api/super/platform.js";
import { getLocalStorage } from "@/utils/auth";
import AddMerchantsDialog from './components/AddMerchantsDialog'
import AdjustmentDialog from './components/AdjustmentDialog';
@ -203,8 +229,11 @@
import BaseSwitch from '@/components/BaseSwitch'
import CustomSelect from '@/components/CustomSelect'
import CopyIcon from '@/components/CopyIcon'
import NumberInput from '@/components/NumberInput';
import Crontab from '@/components/Crontab'
import { Search } from '@element-plus/icons-vue'
import { parseTime } from '@/utils/ruoyi'; //
import { get } from "@vueuse/core";
const router = useRouter();
const { proxy } = getCurrentInstance();
const { ff_tenant_type, ff_tenant_status } = proxy.useDict("ff_tenant_type", "ff_tenant_status");
@ -221,10 +250,18 @@
const tenantSystemPlatforms = ref([]);
const realBalance = ref([]);
const openResetTiele = ref("");
const loadingButton = ref(false);
const oldForm = shallowRef({ });
const tenantStatusArr = ref([
{ label: '正常', value: '1' },
{ label: '停用', value: '0' },
]);
const currencySelectArr = ref([]);
const PlatformRatioAll = ref([]);
let res = getLocalStorage('currencySelect');
currencySelectArr.value = res.map(item => {
return { label:`${item.currencyName}(${item.currencyCode})`, value: item.currencyCode }
})
const data = reactive({
form: {
proportion:0,
@ -296,7 +333,17 @@ const beforeSwitchChange = async (row, undateKeys) => {
openReset.value = false;
reset();
}
//
const getcurrencySign = (val) => {
let resData = getLocalStorage('currencySelect');
let currencySelectAlls = resData.map(item => ({
...item,
label: `${item.currencyName}(${item.currencyCode})`,
value: item.currencyCode
}));
let currencySignItem = currencySelectAlls?.find(item => item.value == val);
return currencySignItem?.currencySign
}
/** 表单重置 */
function reset() {
form.value = {
@ -334,7 +381,6 @@ const beforeSwitchChange = async (row, undateKeys) => {
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
console.log(row)
updateSuperResetGoogleCode({
id: row.id,
@ -344,7 +390,37 @@ const beforeSwitchChange = async (row, undateKeys) => {
})
}).catch(() => {});
}
const numbers = ref(0);
function queryCode(type) {
form.value.tenantSystemPlatforms = form.value.tenantSystemPlatforms.map((item, index) => {
if (type === 'del' && item.useCost > item.cost) {
item.useCost = Number(item.useCost);
item.useCost -= 0.5
} else if (type === 'add') {
item.useCost = Number(item.useCost);
item.useCost += 0.5;
}
return item
})
PlatformRatioAll.value = PlatformRatioAll.value.map((item, index) => {
if (type === 'del' && item.useCost > item.cost) {
item.useCost = Number(item.useCost);
item.useCost -= 0.5
} else if (type === 'add') {
item.useCost = Number(item.useCost);
item.useCost += 0.5;
}
return item
})
if (type === 'del' && numbers.value > 0) {
numbers.value= Number(numbers.value);
numbers.value -= 0.5;
} else if (type === 'add') {
numbers.value= Number(numbers.value);
numbers.value += 0.5;
}
}
const handleCopy = async(text) => {
// API HTTPS localhost
if (navigator.clipboard && window.isSecureContext) {
@ -421,21 +497,43 @@ const beforeSwitchChange = async (row, undateKeys) => {
}
/** 详细信息 */
/** 费率 */
function handleView(row) {
form.value = {
account: row.tenantKey,
tenantType: 1,
scoreRatio: proxy.t('1万法定货币=1万通用额度'),
tenantSystemPlatforms: row.tenantSystemPlatforms,
realBalance: row.realBalance,
}
getSuperTenant(row.id).then(response => {
openView.value = true;
let fromItem = {
...row,
...response.data,
curType: response.data.curType,
account: response.data.tenantKey,
tenantType: response.data.tenantType,
googleCodeSwitch: response.data.googleCodeSwitch,
scoreRatio:response.data.scoreRatio,
tenantSystemPlatforms:response.data.tenantPlatforms
};
PlatformRatioAll.value = response.data.tenantPlatforms;
form.value = JSON.parse(JSON.stringify(fromItem));
oldForm.value = JSON.stringify(PlatformRatioAll.value);
})
}
const openAdjustment = ref(false);
const handleAdjustment = (row) => {
openAdjustment.value = true;
modifyDate.value = row;
getSuperTenant(row.id).then(response => {
openAdjustment.value = true;
modifyDate.value = {
...row,
...response.data,
curType: response.data.curType,
account: response.data.tenantKey,
tenantType: response.data.tenantType,
googleCodeSwitch: response.data.googleCodeSwitch,
scoreRatio:response.data.scoreRatio,
tenantSystemPlatforms:row.tenantPlatforms
};
})
}
const handleAdjustmentUpdate = (row) => {
@ -459,15 +557,9 @@ const handleAdjustment = (row) => {
getSuperTenant(row.id).then(response => {
renewShow.value = true;
title.value = proxy.t('修改商户');
// form.value = {
// account: row.tenantKey,
// tenantType: 1,
// scoreRatio: proxy.t('1=1'),
// tenantSystemPlatforms: row.tenantSystemPlatforms,
// realBalance: row.realBalance,
// }
modifyDate.value = {
...row,
...response.data,
curType: response.data.curType,
account: response.data.tenantKey,
tenantType: response.data.tenantType,
@ -543,7 +635,133 @@ const handleAdjustment = (row) => {
}
});
}
const closeDialog = () => {
openView.value = false;
form.value = {};
}
const sys_job_status = ref([]);
const getsuperCommonPlatformTypeSelect = async () => {
getPlatformShowSelect().then(response => {
sys_job_status.value = response.data.map(item => {
return { label: item.platformName, value: item.platformCode }
});
});
}
getsuperCommonPlatformTypeSelect();
const handleInput = (row) => {
let input = row.useCost.toString();
//
input = input.replace(/[^\d.]/g, '');
//
const parts = input.split('.');
if (parts.length > 2) {
input = parts[0] + '.' + parts[1];
}
//
if (parts[1]) {
input = parts[0] + '.' + parts[1].substring(0, 2);
}
row.useCost = input;
// PlatformRatioAll.value
const target = PlatformRatioAll.value.find(item => item.id == row.id);
if (target) {
target.useCost = input;
}
};
const handleInput1 = (row) => {
let input = row.minAmount.toString();
// PlatformRatioAll.value
const target = PlatformRatioAll.value.find(item => item.id == row.id);
if (target) {
target.minAmount = input;
}
}
const handleInput2 = (row) => {
let input = row.maxAmount.toString();
// PlatformRatioAll.value
const target = PlatformRatioAll.value.find(item => item.id == row.id);
if (target) {
target.maxAmount = input;
}
}
const handleBlur = (row) => {
const cost = parseFloat(row.cost);
const useCost = parseFloat(row.useCost);
if (isNaN(useCost)) {
row.useCost = '';
return;
}
if (useCost < cost) {
row.useCost = Number(cost); //
//
// this.$message.warning(`${cost}`);
}
}
const searchPlatformCode = ref('');
const searchCurrencyCode = ref('');
//
const searchSystemPlatforms = (platformCode) => {
const keyword = platformCode?.trim();
if (!keyword) {
form.value.tenantSystemPlatforms = PlatformRatioAll.value;
return;
}
// platformCode
const matchedCodes = PlatformRatioAll.value
.filter(item => item.platformCode?.includes(keyword))
.map(item => item.platformCode);
// platformCode
const result = PlatformRatioAll.value.filter(item =>
matchedCodes.includes(item.platformCode)
);
form.value.tenantSystemPlatforms = result; // 退 PlatformRatioAll
};
const openViewRef = ref(null);
//
/** 提交按钮 */
function submitForm() {
proxy.$refs["openViewRef"].validate(valid => {
if (valid) {
loadingButton.value = true;
let dataObj = {
id: form.value.id,
scoreRatio: form.value.scoreRatio,
curType: 1,
googleCodeSwitch: form.value.googleCodeSwitch,
currencyCode: form.value.currencyCode,
// tenantType: formAll.tenantType,
// googleCode:formAll.googleCode,
tenantPlatforms: PlatformRatioAll.value,
}
if (JSON.stringify(PlatformRatioAll.value) != oldForm.value) {
updateSuperTenantEdit(dataObj).then(response => {
loadingButton.value = false;
proxy.$modal.msgSuccess(proxy.t('更新成功'));
closeDialog();
getList();
}).catch(() => {
loadingButton.value = false;
});
}else{
loadingButton.value = false;
closeDialog();
}
}
});
}
getList();
</script>

View File

@ -14,6 +14,8 @@
<template #right>
<el-form-item>
<el-button type="primary" icon="Plus" @click="handleAdd" v-hasPermi="['super:platform:add']">{{ t('') }}</el-button>
<el-button type="primary" @click="syncGame" v-hasPermi="['super:game:sync']">{{ t('') }}</el-button>
</el-form-item>
<!-- v-hasPermi="['super:platform:add']" -->
</template>
@ -225,7 +227,7 @@
</template>
<script setup name="Agent">
import { superPlatformList, createPlatformUpdate,createPlatformAdd,superGameList,createGameuUpdate,createGameuUpdateStatus,createGameuAdd,getSuperPlatformInf,createPlatformSwitch,getPlatformShowSelect,updatePlatformCurrency } from "@/api/super/platform.js";
import { getSuperGameSync,superGameList,createGameuUpdate,createGameuUpdateStatus,createGameuAdd,getSuperPlatformInf,createPlatformSwitch,getPlatformShowSelect,updatePlatformCurrency } from "@/api/super/platform.js";
// import { superGameList} from "@/api/super/gameManagement.js";
import Crontab from '@/components/Crontab'
import { getLocalStorage } from '@/utils/auth'
@ -481,6 +483,25 @@ const switchBeforeChange = () => {
handleQuery();
}
const syncGame = () => {
if (!queryParams.value.platformCode){
ElMessage.warning('请选择游戏平台!');
return
}
proxy.$confirm('确定同步游戏吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
getSuperGameSync({
platformCode: queryParams.value.platformCode,
}).then(res => {
proxy.$modal.msgSuccess(proxy.t('同步成功'));
getList();
})
}).catch(() => {});
};
//
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.jobId);

View File

@ -20,23 +20,28 @@
</template>
</table-search-card>
<el-table v-loading="loading" class="c-table-main" :data="agentList" border>
<el-table-column :label="t('平台编码')" align="center" prop="platformShowCode" />
<el-table-column :label="t('厂商名称')" align="center" prop="platformManufacturerName" />
<el-table-column :label="t('接口点位')" align="center" prop="platformManufacturerName" >
<el-table-column :label="t('平台编码')" align="center" prop="platformShowCode" min-width="120" />
<el-table-column :label="t('厂商名称')" align="center" prop="platformManufacturerName" min-width="150"/>
<el-table-column :label="t('接口点位')" align="center" prop="platformManufacturerName" min-width="100">
<template #default="{row}">
<el-button link type="primary" @click="handleView(row)" v-hasPermi="['super:platform:detail']">{{ t('') }}</el-button>
</template>
</el-table-column>
<el-table-column :label="t('状态')" align="center" prop="stopStatus" >
<el-table-column :label="t('商户配置')" min-width="100" align="center" prop="platformManufacturerName" >
<template #default="{row}">
<el-button type="primary" @click="handleRevise(row)" v-hasPermi="['super:platform:detail']" plain>{{ t('一键费率') }}</el-button>
</template>
</el-table-column>
<el-table-column :label="t('状态')" min-width="100" align="center" prop="stopStatus" >
<template #default="{row}">
<base-switch v-model="row.stopStatus" v-hasPermi="['super:platform:switch']" active-text=""
inactive-text="关闭" :active-value="false" :inactive-value="true"
:before-change="() => beforeSwitchChange(row, 'stopStatus')" />
</template>
</el-table-column>
<el-table-column :label="t('操作')" align="center" width="200" class-name="small-padding fixed-width">
<el-table-column :label="t('操作')" align="center" min-width="130" class-name="small-padding fixed-width">
<template #default="{row}">
<el-button link type="primary" @click="handleRevise(row)" v-hasPermi="['super:platform:currency:update']">{{ t('') }}</el-button>
<!-- <el-button link type="primary" @click="handleRevise(row)" v-hasPermi="['super:platform:currency:update']">{{ t('') }}</el-button> -->
<el-button link type="primary" @click="handleInterface(row)" v-hasPermi="['super:platform:detail']">{{ t('') }}</el-button>
<el-button link type="primary" @click="handleOpenRevise(row)" v-hasPermi="['super:platform:update']">{{ t('') }}</el-button>
@ -239,46 +244,106 @@
<!-- 详情/修改对话框 -->
<el-dialog v-if="openView" v-model="openView" align-center width="1300px" append-to-body>
<template #header>
<div style="width: 100%;text-align: center;">{{ titlePlatForm }}</div>
<div style="width: 100%;text-align: left;">{{ titlePlatForm }}</div>
</template>
<el-scrollbar max-height="600px">
<div class="label-scoreRatio" v-if="titlePlatForm == '修改'">
<!-- <span>{{ t('平台比例') }}</span> -->
<div style="margin-right: 320px;">
<el-button style="width: 80px;" type="danger" @click="queryCode('del')" :disabled="tenantSystemPlatformDTOSRow.length == 0">-0.5</el-button>
<el-button style="width: 80px;" type="primary" @click="queryCode('add')" :disabled="tenantSystemPlatformDTOSRow.length == 0">+0.5</el-button>
</div>
</div>
<el-table :data="tenantSystemPlatformDTOSRow" row-key="id" border>
<el-table-column prop="platformCode" label="平台编码" />
<el-table-column prop="currencyCode" label="币种" />
<el-table-column prop="openStatus" label="开启状态" >
<template #default="scope">
<span>{{ scope.row.openStatus ? '关闭' : '开启' }}</span>
</template>
</el-table-column>
<el-table-column prop="cost" label="原始费率" >
<template #default="scope">
<div v-if="titlePlatForm == '修改'" style="display: flex;align-items: center;">
<el-input v-model="scope.row.cost" style="width: 240px" type="number" >
<template #append>%</template>
</el-input>
</div>
<span v-else>{{ scope.row.cost }}%</span>
</template>
</el-table-column>
<el-table-column prop="maxAmount" label="带入金额" >
<template #default="scope">
<div v-if="titlePlatForm == '修改'" style="display:flex;align-items: center;"><NumberInput v-model="scope.row.minAmount"></NumberInput> ~ <NumberInput v-model="scope.row.maxAmount"></NumberInput></div>
<span v-else>{{ scope.row.minAmount }}~{{ scope.row.maxAmount }}</span>
</template>
</el-table-column>
</el-table>
<el-row>
<el-col :span="12">
<div class="label-scoreRatio" v-if="titlePlatForm == '一键费率'">
<!-- <span>{{ t('平台比例') }}</span> -->
<div style="margin-right: 20px;">
<el-button style="width: 80px;" type="danger" @click="queryCode('del')" :disabled="tenantSystemPlatformDTOSRow.length == 0">-0.5</el-button>
<el-button style="width: 80px;" type="primary" @click="queryCode('add')" :disabled="tenantSystemPlatformDTOSRow.length == 0">+0.5</el-button>
</div>
</div>
<div v-if="titlePlatForm == '一键费率'" style="display: flex;justify-content: space-between;margin-bottom: 10px;">
<el-input
v-model="searchPlatformCode"
style="width: 100%"
:placeholder="t('请输入游戏币种')"
:suffix-icon="Search"
@input="searchSystemPlatforms"
/>
</div>
<el-table :data="tenantSystemPlatformDTOSRow" height="500px" row-key="id" border>
<el-table-column prop="platformCode" label="平台编码" min-width="100px" />
<el-table-column prop="currencyCode" label="币种" min-width="100px" />
<el-table-column prop="cost" label="成本费率" min-width="120px">
<template #default="scope">
<div v-if="titlePlatForm == '一键费率'" style="display: flex;align-items: center;">
<el-input v-model="scope.row.cost" @input="handleInput1(scope.row)" style="width: 240px" type="number" >
<template #append>%</template>
</el-input>
</div>
<span v-else>{{ scope.row.cost }}%</span>
</template>
</el-table-column>
<el-table-column prop="maxAmount" label="带入金额" min-width="180px">
<template #default="scope">
<div v-if="titlePlatForm == '一键费率'" style="display:flex;align-items: center;"><NumberInput v-model="scope.row.minAmount" @input="handleInput2(scope.row)"></NumberInput> ~ <NumberInput v-model="scope.row.maxAmount" @input="handleInput3(scope.row)"></NumberInput></div>
<span v-else>{{ scope.row.minAmount }}~{{ scope.row.maxAmount }}</span>
</template>
</el-table-column>
</el-table>
</el-col>
<el-col :span="1"></el-col>
<el-col :span="11">
<div style="display: flex;justify-content: space-between;margin-bottom: 10px;" v-if="titlePlatForm == '一键费率'">
<div style="margin-right: 20px;">
默认费率:
<el-input v-model="defaultCost" style="width: 240px" type="number" >
<template #append>%</template>
</el-input>
</div>
<div><el-button type="primary" @click="OneclickFill" >{{ t('一键填入') }}</el-button></div>
</div>
<div v-if="titlePlatForm == '一键费率'" style="display: flex;justify-content: space-between;margin-bottom: 10px;">
<el-input
v-model="searchTenantKey"
style="width: 100%"
:placeholder="t('请输入商户账号')"
:suffix-icon="Search"
@input="searchSystemPlatforms1"
/>
</div>
<el-table :data="defaultCostSelect" height="500px" row-key="id" @select="tableSelect"
@select-all="tableSelect" border>
<el-table-column align="center" type="selection" width="55" />
<el-table-column prop="tenantSn" label="商户标识" />
<el-table-column prop="tenantKey" label="商户账号" />
<el-table-column prop="platformCode" label="平台编码" >
<template v-slot="{ row }">
{{ row.platformCode }}
</template>
</el-table-column>
<el-table-column prop="cost" label="使用费率" min-width="160px">
<template #default="scope">
<div v-if="titlePlatForm == '一键费率'" style="display: flex;align-items: center;">
<el-input v-model="scope.row.useCost" @input="handleInput1(scope.row)" style="width: 240px" type="number" >
<template #append>%</template>
</el-input>
</div>
<span v-else>{{ scope.row.useCost }}%</span>
</template>
</el-table-column>
<!-- <el-table-column prop="maxAmount" label="带入金额" >
<template #default="scope">
<div v-if="titlePlatForm == '一键费率'" style="display:flex;align-items: center;"><NumberInput v-model="scope.row.minAmount" @input="handleInput2(scope.row)"></NumberInput> ~ <NumberInput v-model="scope.row.maxAmount" @input="handleInput3(scope.row)"></NumberInput></div>
<span v-else>{{ scope.row.minAmount }}~{{ scope.row.maxAmount }}</span>
</template>
</el-table-column> -->
</el-table>
</el-col>
</el-row>
</el-scrollbar>
<template #footer>
<div class="dialog-footer">
<el-button @click="openView = false">{{ t('关 闭') }}</el-button>
<el-button type="primary" v-if="titlePlatForm == '修改'" @click="submitForm" :loading="loadingButton" v-hasPermi="['super:platform:currency:update']">{{ t(' ') }}</el-button>
<el-button type="primary" v-if="titlePlatForm == '一键费率'" @click="submitForm" :loading="loadingButton" v-hasPermi="['super:platform:currency:update']">{{ t(' ') }}</el-button>
</div>
</template>
@ -288,7 +353,7 @@
<script setup name="Agent">
import { superPlatformList, createPlatformUpdate,createPlatformAdd,superGameList,createGameuUpdate,getSuperPlatformInf,createPlatformSwitch,getPlatformShowSelect,updatePlatformCurrency } from "@/api/super/platform.js";
import { superCommonPlatformTypeSelect } from "@/api/super/tenant";
import { superCommonPlatformTypeSelect,superTenantList } from "@/api/super/tenant";
import { getSuperPlatformSelectList } from "@/api/home";
import Crontab from '@/components/Crontab'
import { getLocalStorage } from '@/utils/auth'
@ -296,6 +361,7 @@
import NumberInput from '@/components/NumberInput'
import CustomSelect from '@/components/CustomSelect'
import BaseSwitch from '@/components/BaseSwitch'
import { Search } from '@element-plus/icons-vue'
import { id } from "element-plus/es/locales.mjs";
import { ref } from "vue";
const router = useRouter();
@ -323,7 +389,7 @@ import { ref } from "vue";
const formInterface = reactive({
});
const oldForm = shallowRef({ });
const PlatformRatioAll = ref([]);
const rulesInterface = reactive({
})
@ -485,7 +551,37 @@ import { ref } from "vue";
})
const { queryParams, form, rules } = toRefs(data);
const defaultCost = ref(0);
//
const tableRef = ref(),
isAllSelection = ref(false), //
selectionData = ref([]), //
batchOpType = ref(''); //
//
const tableSelect = (val) => {
selectionData.value = val;
//
if (val.length == defaultCostSelect.value.length) {
isAllSelection.value = true;
} else {
isAllSelection.value = false;
}
}
//
const OneclickFill = () => {
if (selectionData.value.length == 0){
proxy.$modal.msgError('请先勾选商户');
return;
}
selectionData.value.forEach(item => {
item.useCost = defaultCost.value;
item.tenantPlatforms.forEach(item => {
item.useCost = defaultCost.value;
})
})
}
/** 查询列表 */
function getList() {
loading.value = true;
@ -649,20 +745,82 @@ const switchBeforeChange = () => {
}
const tenantSystemPlatformDTOSRow = ref([]);
const titlePlatForm = ref('');
const defaultCostSelect = ref([]);
const defaultCostSelectAll = ref([]);
const platformCodeDeff = ref('');
const handleRevise = (row) => {
titlePlatForm.value = proxy.t('修改');
titlePlatForm.value = proxy.t('一键费率');
let objForm = JSON.parse(JSON.stringify(row.tenantSystemPlatformDTOS));
tenantSystemPlatformDTOSRow.value = objForm;
oldForm.value = JSON.stringify(tenantSystemPlatformDTOSRow.value);
PlatformRatioAll.value = objForm;
platformCodeDeff.value = objForm[0]?.platformCode;
openView.value = false;
selectionData.value = [];
defaultCost.value = 0;
superTenantList({
pageNum: 1,
pageSize: 9999,
platformCode: objForm[0]?.platformCode,
}).then(response => {
defaultCostSelect.value = response.rows.map(item => {
return {
...item,
platformCode: objForm[0]?.platformCode,
useCost:item.tenantPlatforms[0]?.useCost||0
};
});
defaultCostSelectAll.value = defaultCostSelect.value;
let arrform = [...defaultCostSelectAll.value,...PlatformRatioAll.value]
oldForm.value = JSON.stringify(arrform);
})
setTimeout(() => {
openView.value = true;
}, 100);
}
const openInterface = ref(false);
const rowInterface = ref({});
const searchPlatformCode = ref('');
const searchTenantKey = ref('');
//
const searchSystemPlatforms = (currencyCode) => {
const keyword = currencyCode?.trim();
if (!keyword) {
tenantSystemPlatformDTOSRow.value = PlatformRatioAll.value;
return;
}
// platformCode
const matchedCodes = PlatformRatioAll.value
.filter(item => item.currencyCode?.includes(keyword))
.map(item => item.currencyCode);
// platformCode
const result = PlatformRatioAll.value.filter(item =>
matchedCodes.includes(item.currencyCode)
);
tenantSystemPlatformDTOSRow.value = result; // 退 PlatformRatioAll
};
const searchSystemPlatforms1 = (tenantKey) => {
const keyword = tenantKey?.trim();
if (!keyword) {
defaultCostSelect.value = defaultCostSelectAll.value;
return;
}
// platformCode
const matchedCodes = defaultCostSelectAll.value
.filter(item => item.tenantKey?.includes(keyword))
.map(item => item.tenantKey);
// platformCode
const result = defaultCostSelectAll.value.filter(item =>
matchedCodes.includes(item.tenantKey)
);
defaultCostSelect.value = result; // 退 PlatformRatioAll
};
//
const handleInterface = (row) => {
@ -676,7 +834,7 @@ const switchBeforeChange = () => {
}
const openRevise = ref(false);
const versionValue = ref('');
const versionValue = ref(0);
const formInterfaceVersion = ref({});
const platformHistoryList = ref([]);
const rowOpenRevise = reactive({});
@ -714,6 +872,12 @@ const switchBeforeChange = () => {
const switchingVersions = (value) =>{
if (value == 0){
Object.assign(formInterface, formInterfaceVersion.value);
rowOpenRevise.platformInfo = JSON.stringify(formInterfaceVersion.value.platformInfo);
rowOpenRevise.keyInfo = JSON.stringify(formInterfaceVersion.value.keyInfo);
rowOpenRevise.langInfo = JSON.stringify(formInterfaceVersion.value.langInfo);
rowOpenRevise.currencyInfo = JSON.stringify(formInterfaceVersion.value.currencyInfo);
rowOpenRevise.extInfo = JSON.stringify(formInterfaceVersion.value.extInfo);
rowOpenRevise.urlInfo = JSON.stringify(formInterfaceVersion.value.urlInfo);
}else{
platformHistoryList.value.map(item => {
if (item.versionCode == value){
@ -798,13 +962,43 @@ const switchBeforeChange = () => {
return item
})
}
const handleInput1 = (row) => {
let input = row.cost.toString();
row.cost = input;
const target = PlatformRatioAll.value.find(item => item.id == row.id);
if (target) {
target.cost = input;
}
}
const handleInput2 = (row) => {
let input = row.minAmount.toString();
row.minAmount = input;
const target = PlatformRatioAll.value.find(item => item.id == row.id);
if (target) {
target.minAmount = input;
}
}
const handleInput3 = (row) => {
let input = row.maxAmount.toString();
row.maxAmount = input;
const target = PlatformRatioAll.value.find(item => item.id == row.id);
if (target) {
target.maxAmount = input;
}
}
/** 提交按钮 */
function submitForm() {
let obj = {
tenantSystemPlatforms: tenantSystemPlatformDTOSRow.value
tenantSystemPlatforms: PlatformRatioAll.value,
tenantSecretKeyDTOS:selectionData.value||[],
platformCode: platformCodeDeff.value
}
loadingButton.value = true;
if (JSON.stringify(tenantSystemPlatformDTOSRow.value) != oldForm.value) {
let arrform = [...defaultCostSelectAll.value,...PlatformRatioAll.value]
if (JSON.stringify(arrform) != oldForm.value) {
console.log(obj);
updatePlatformCurrency(obj).then(response => {
loadingButton.value = false;
proxy.$modal.msgSuccess(proxy.t('更新成功'));