fix:1,优化

main
YuanJian 2025-08-26 11:18:24 +08:00
parent 53f7b58c05
commit 34110f120f
10 changed files with 1412 additions and 81 deletions

BIN
dist.rar

Binary file not shown.

View File

@ -10,12 +10,20 @@ export function superPlatformList(query) {
}
// 更新接口信息
export function createPlatformUpdate(data) {
return request({
url: '/super/platform/update',
method: 'post',
data: data
})
}
return request({
url: '/super/platform/update',
method: 'post',
data: data
})
}
//新增接口信息
export function createPlatformAdd(data) {
return request({
url: '/super/platform/add',
method: 'post',
data: data
})
}
// 游戏列表
export function superGameList(query) {
return request({

View File

@ -102,7 +102,7 @@
</div>
</template>
</el-dialog>
<el-dialog v-model="goodDialogShow" :title="t('谷歌验证')" width="500" :before-close="authenticatorClose">
<el-dialog v-model="goodDialogShow" :title="t('谷歌验证')" align-center width="500" :before-close="authenticatorClose">
<div style="width: 100%;margin-bottom: 20px;text-align: center;">
<img style="width: 70%;" :src="imgCods"/>
</div>
@ -245,12 +245,27 @@ function handleLogin() {
sessionStorage.setItem('TepdCode', 500);
loading.value = false;
}else{
if (res.data.bindStatus == true){
goodDialogVisible.value = true;
}else if (res.data.bindStatus == false){
goodDialogShow.value = true;
imgCods.value = res.data.bindQrCode;
authenticatorForm.value.randomSecretKey = res.data.randomSecretKey;
if(res.data.googleCodeSwitch == 0){
const query = route.query;
if (res.data.token){
setToken(res.data.token);
sessionStorage.removeItem('TepdCode');
const otherQueryParams = Object.keys(query).reduce((acc, cur) => {
if (cur !== "redirect") {
acc[cur] = query[cur];
}
return acc;
}, {});
router.push({ path: redirect.value || "/", query: otherQueryParams });
}
}else{
if (res.data.bindStatus == true){
goodDialogVisible.value = true;
}else if (res.data.bindStatus == false){
goodDialogShow.value = true;
imgCods.value = res.data.bindQrCode;
authenticatorForm.value.randomSecretKey = res.data.randomSecretKey;
}
}
}
}).catch(() => {
@ -320,7 +335,7 @@ const goolesubmit = async() => {
return acc;
}, {});
router.push({ path: redirect.value || "/", query: otherQueryParams });
}
}
}
})

View File

@ -51,24 +51,40 @@
<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-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-row>
<el-col :span="12">
<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-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="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-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>
<div>
@ -367,6 +383,7 @@ const formRef = ref(null);//获取表单验证
scoreRatio: formAll.scoreRatio,
tenantType: formAll.tenantType,
curType: formAll.curType,
googleCodeSwitch: formAll.googleCodeSwitch,
// proportion: formAll.proportion||numbers.value,
tenantPlatforms: formAll.tenantSystemPlatforms,
googleCode:formAll.googleCode,

View File

@ -38,10 +38,12 @@
</el-table-column>
<el-table-column :label="t('游戏额度')" align="center" prop="balance" width="230px">
<template #default="{ row }">
<div style="display: flex;">
<el-button @click="handleReduce($event,row)">-</el-button>
<div style="display: flex;justify-content: space-between;align-items: center;">
<span>{{ getcurrencySign(row.currencyCode) }}{{ row.balance }}</span>
<!-- <el-button @click="handleReduce($event,row)">-</el-button>
<el-input v-model="row.balance" disabled :min="0" @change="handleChange($event,row)" :max="9999999999999999" />
<el-button @click="handleAdd($event,row)">+</el-button>
<el-button @click="handleAdd($event,row)">+</el-button> -->
<el-button @click="handleAdd($event,row)"></el-button>
</div>
</template>
@ -70,14 +72,36 @@
</div>
</template>
</el-dialog>
<el-dialog v-model="visible" align-center :title="t('调额')" width="500px">
<el-dialog v-if="visible" v-model="visible" align-center :title="t('调额')" width="500px">
<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>
<el-divider />
<div style="width: 100%;display: flex;margin-bottom: 8px;align-items: center;">
<div style="width: 120px;text-align: right;padding-right: 12px;">
<span style="font-size: 16px;">{{ t('余额') }}</span>
</div>
<div><span style="color: #FF4D4F;">{{getcurrencySign(formAdjustment.currencyCode)}} {{ formAdjustment.balance||'00' }}</span></div>
</div>
<el-form :model="formAdjustment" :rules="rulesAdjustment" ref="formAdjustmentRef" label-width="120px">
<el-form-item label="额度" prop="balance">
<el-input v-model="formAdjustment.balance" :placeholder="t('请输入额度')" />
<div>
<NumberInput v-model="formAdjustment.balance" :minus="true" digit="4" :placeholder="t('请输入额度')">
<template #prepend>{{ getcurrencySign(formAdjustment.currencyCode) }}</template>
</NumberInput>
</div>
<div>
{{ t('如需扣余额,则输入负数,例如:-10.50') }}
</div>
</el-form-item>
<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>
@ -95,6 +119,7 @@ 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']) //
@ -113,6 +138,9 @@ const props = defineProps({ // 父组件向子组件传值
}
})
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" },
@ -149,6 +177,11 @@ const formAdjustment = ref({
const formCreditType = ref({
})
const getcurrencySign = (val) => {
let currencySignItem = currencySelectAll.find(item => item.value == val);
console.log(currencySignItem)
return currencySignItem.currencySign
}
const rulesCreditType = ref({
quotaType: [{ required: true, message: proxy.t('额度类型不能为空'), trigger: "change" }],
currencyCode: [{ required: true, message: proxy.t('币种不能为空'), trigger: "change" }],
@ -243,9 +276,12 @@ const visible = ref(false);
const handleAdd = (value,row) => {
visible.value = true;
formAdjustment.value.id = row.id;
formAdjustment.value.isOut = true;
formAdjustment.value.googleCode = '';
formAdjustment.value.balance = ''
formAdjustment.value.balance = row.balance
formAdjustment.value.currencyCode = row.currencyCode;
formAdjustment.value.tenantKey = row.tenantKey;
}
//
const handleReduce = (value,row) => {
@ -258,12 +294,22 @@ const handleReduce = (value,row) => {
const onSubmit = () => {
proxy.$refs["formAdjustmentRef"].validate(valid => {
if (valid) {
updateSuperTenantQuotaUpdate({
let numBalance = 0;
if(Number(formAdjustment.value.balance) <= 0){
formAdjustment.value.isOut = false;
numBalance = Math.abs(formAdjustment.value.balance)
}else{
formAdjustment.value.isOut = true;
numBalance = formAdjustment.value.balance
}
let obj = {
id: formAdjustment.value.id,
balance: formAdjustment.value.balance,
balance:numBalance,
googleCode: formAdjustment.value.googleCode,
isOut: formAdjustment.value.isOut
}).then(response => {
isOut: formAdjustment.value.isOut,
remark: formAdjustment.value.remark
}
updateSuperTenantQuotaUpdate(obj).then(response => {
ElMessage({
type: 'success',
message: proxy.t('调额成功')

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 @opened="forceUpdateTable">
<el-scrollbar max-height="600px">
<el-form ref="agentRef" :model="formAll" :rules="rules" label-width="120px">
<el-row>
@ -25,6 +25,18 @@
</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"
@ -53,7 +65,12 @@
:disabled="!formAll.tenantSystemPlatforms.length">+0.5</el-button>
</div>
</div>
<el-table :data="formAll.tenantSystemPlatforms" class="scoreRatioTable">
<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">
@ -117,6 +134,32 @@ const langDefaultClass = ref(null), langDefaultClassList = ref([]);// 分类名
const tenantSystemPlatforms = ref([]);
const loadingButton = ref(false);
const realBalance = ref([]);
const myTable = ref()
const loading5 = ref(false)
const forceUpdateTable = async () => {
//
formAll.tenantSystemPlatforms = []
// allData 1000
// 10
let index = 0
const batchSize = 20
const loadBatch = () => {
if (index < props.modifyDate.tenantSystemPlatforms.length) {
formAll.tenantSystemPlatforms.push(
...props.modifyDate.tenantSystemPlatforms.slice(index, index + batchSize)
)
index += batchSize
// UI
requestAnimationFrame(loadBatch)
}
}
loadBatch()
}
const showDialog = computed({//
get() {
return props.show
@ -207,11 +250,13 @@ nextTick(() => {
// DEMO
nextTick(() => {
//
formAll.tenantSystemPlatforms = props.modifyDate.tenantSystemPlatforms;
// formAll.tenantSystemPlatforms = props.modifyDate.tenantSystemPlatforms;
formAll.account = props.modifyDate.account;
formAll.tenantType = props.modifyDate.tenantType;
formAll.scoreRatio = props.modifyDate.scoreRatio;
formAll.curType = props.modifyDate.curType
formAll.curType = props.modifyDate.curType;
formAll.googleCodeSwitch = props.modifyDate.googleCodeSwitch;
})
//
@ -297,6 +342,9 @@ function submitForm() {
id: props.modifyDate.id,
scoreRatio: formAll.scoreRatio,
curType: formAll.curType,
googleCodeSwitch: formAll.googleCodeSwitch,
// tenantType: formAll.tenantType,
// googleCode:formAll.googleCode,
tenantPlatforms: formAll.tenantSystemPlatforms,

View File

@ -428,7 +428,7 @@ const handleAdjustment = (row) => {
getSelectPlatform();
getSuperCommonCurrencySelect();
getSuperTenant(row.id).then(response => {
renewShow.value = true;
title.value = proxy.t('修改商户');
// form.value = {
// account: row.tenantKey,
@ -441,11 +441,12 @@ const handleAdjustment = (row) => {
...row,
curType: response.data.curType,
account: response.data.tenantKey,
tenantType: 1,
tenantType: response.data.tenantType,
googleCodeSwitch: response.data.googleCodeSwitch,
scoreRatio:response.data.scoreRatio,
tenantSystemPlatforms:row.tenantPlatforms
};
renewShow.value = true;
})
}

View File

@ -88,7 +88,7 @@
{{ row.platformName? row.platformName : '--' }}
</template>
</el-table-column>
<el-table-column align="center" prop="exchangeMoney" min-width="110px">
<template #header>
{{ t('转账金额') }}
@ -109,17 +109,14 @@
{{ row.useCost? row.useCost+'%' : '--' }}
</template>
</el-table-column>
<el-table-column :label="t('操作类型')" align="center" prop="isOut" width="120">
<el-table-column :label="t('转账类型')" align="center" prop="isOut" width="130">
<template #default="{row}">
<span v-if="row.operationType == 1">{{ t('') }}</span>
<span v-if="row.operationType == 2">{{ t('') }}</span>
<span v-if="row.operationType == 3">{{ t('') }}</span>
<span v-if="row.operationType == 4">{{ t('') }}</span>
<span v-if="row.operationType == 5">{{ t('') }}</span>
<span v-if="row.isOut == 0">{{ t('') }}</span>
<span v-if="row.isOut == 1">{{ t('') }}</span>
</template>
</el-table-column>
<el-table-column align="center" prop="balance" min-width="80px">
<template #header>
{{ t('操作额度') }}
@ -127,8 +124,8 @@
</IconTips> -->
</template>
<template #default="{row}">
<span v-if="row.isOut == 0" style="color: red;">-{{ row.balance? row.balance : '--' }}</span>
<span v-if="row.isOut == 1" >{{ row.balance? row.balance : '--' }}</span>
<span v-if="row.isOut == 0" style="color: red;">-{{ row.balance ==null ? '--' :row.balance}}</span>
<span v-if="row.isOut == 1" >{{ row.balance ==null ? '--' :row.balance}}</span>
</template>
</el-table-column>
<el-table-column align="center" prop="balanceAfter" width="130px">
@ -138,7 +135,7 @@
</IconTips>
</template>
<template #default="{row}">
{{ row.balanceAfter? row.balanceAfter : '--' }}
{{ row.balanceAfter==null? '--' : row.balanceAfter }}
</template>
</el-table-column>
<el-table-column :label="t('额度类型')" align="center" prop="quotaType" width="85">
@ -146,6 +143,36 @@
{{ row.quotaTypeName? row.quotaTypeName : '--' }}
</template>
</el-table-column>
<el-table-column :label="t('额度明细')" align="center" prop="platformName" min-width="130">
<template #default="{row}">
<el-popover :width="320" trigger="hover">
<ul class="al-list">
<li>
<span>{{ t('币种') }}</span>
<span>{{ t('可用额度') }}</span>
<span>{{ t('信誉额度') }}</span>
<span>{{ t('平台额度') }}</span>
</li>
<li >
<span>{{ row.currencyCode }}</span>
<span>{{ getQuota(row,'可用额度', 'available') }}</span>
<span>{{ getQuota(row,'信誉额度', 'credit') }}</span>
<span>{{ getQuota(row,'平台额度', 'platform') }}</span>
</li>
<!-- <li v-for="item in curAgentLevelInfo" :key="item.id">
<span>{{ item.currencyType }}</span>
<span>{{ item.levelName || '-' }}</span>
</li> -->
<!-- <li v-if="curAgentLevelInfo.length === 0">
{{ t('暂无信息...') }}
</li> -->
</ul>
<template #reference>
<el-button link type="primary">{{ t('查看') }}</el-button>
</template>
</el-popover>
</template>
</el-table-column>
<el-table-column :label="t('API订单号')" align="center" prop="transactionId" width="120">
<template #default="{row}">
{{ row.transactionId? row.transactionId : '--' }}
@ -156,6 +183,17 @@
{{ row.orderId? row.orderId : '--' }}
</template>
</el-table-column>
<el-table-column :label="t('操作类型')" align="center" prop="isOut" width="120">
<template #default="{row}">
<span v-if="row.operationType == 1">{{ t('') }}</span>
<span v-if="row.operationType == 2">{{ t('') }}</span>
<span v-if="row.operationType == 3">{{ t('') }}</span>
<span v-if="row.operationType == 4">{{ t('') }}</span>
<span v-if="row.operationType == 5">{{ t('') }}</span>
<span v-if="row.operationType == 6">{{ t('') }}</span>
<span v-if="row.operationType == 7">{{ t('') }}</span>
</template>
</el-table-column>
<el-table-column :label="t('创建时间')" align="center" prop="createTime" width="200" :show-overflow-tooltip="true">
<template #default="scope">{{ parseTime(scope.row.createTime) }}</template>
</el-table-column>
@ -185,6 +223,7 @@
import IconTips from '@/components/IconTips'
import { parseTime } from '@/utils/ruoyi'; //
import { nextTick } from "vue";
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");
@ -294,7 +333,17 @@ const getsuperCommonPlatformTypeSelect = async () => {
open.value = false;
reset();
}
const getQuota = (row, type) => {
if (!row || !row.quotaTypeName || !row.balanceStr) return 0;
const names = row.quotaTypeName.split(','); //
const balances = row.balanceStr.split(','); //
const index = names.indexOf(type); //
if (index === -1) return 0; // 0
return balances[index] || 0; // 0
}
/** 表单重置 */
function reset() {
form.value = {
@ -402,5 +451,37 @@ const getsuperCommonPlatformTypeSelect = async () => {
width: calc(100% - 120px);
margin-left: 120px;
}
.al-list {
padding: 5px 0;
margin: 0;
width: 100%;
list-style: none;
li {
list-style: none;
width: 100%;
text-align: center;
padding: 10px 0;
border-bottom: #eeeeee solid 1px;
&:first-child {
span {
font-weight: bold;
}
}
span {
display: inline-block;
width: 25%;
}
&:last-child {
border: none
}
}
}
// .al-list li span {
// width: 50% !important;
// }
</style>

View File

@ -0,0 +1,805 @@
<template>
<div class="app-container">
<table-search-card :model="queryParams" @getList="getList" @handleQuery="handleQuery" @resetQuery="resetQuery">
<template #left>
<el-form-item :label="t('平台类型')" prop="platformShowCode">
<CustomSelect v-if="showLoding2" v-model="queryParams.platformShowCode" :options="sys_job_status" placeholder="请选择平台类型" style="width: 200px" />
</el-form-item>
</template>
<template #right>
<el-form-item>
<el-button type="primary" icon="Plus" @click="handleAdd" v-hasPermi="['super:platform:add']">{{ t('') }}</el-button>
</el-form-item>
<!-- v-hasPermi="['super:platform:add']" -->
</template>
</table-search-card>
<el-table v-loading="loading" :span-method="objectSpanMethod" 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" >
<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" >
<template #default="{row}">
<base-switch v-model="row.stopStatus" v-hasPermi="['super:platform:switch']" :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">
<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="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>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
<!-- 接口信息 -->
<el-dialog :title="t('接口信息')" align-center v-model="openInterface" width="1300px" append-to-body>
<el-form ref="interfaceRef" :model="formInterface" :rules="rulesInterface" label-width="120px">
<el-descriptions border :column="2" class="c-descriptions" >
<el-descriptions-item label-width="150" label-align="right" :label="t('平台代码')">
{{ formInterface.platformCode }}
</el-descriptions-item>
<el-descriptions-item label-width="150" label-align="right" :label="t('平台名称')">
{{ formInterface.platformName }}
</el-descriptions-item>
<el-descriptions-item label-width="150" label-align="right" :label="t('协议')">
<el-input v-model="formInterface.urlInfo.https" style="width: 400px;" disabled :placeholder="t('')"> </el-input>
</el-descriptions-item>
<el-descriptions-item label-width="150" label-align="right" :label="t('端口')">
<el-input v-model="formInterface.urlInfo.port" style="width: 400px;" disabled :placeholder="t('')"> </el-input>
</el-descriptions-item>
<el-descriptions-item label-width="150" label-align="right" :label="t('请求地址')">
<el-input v-model="formInterface.urlInfo.url" style="width: 400px;" disabled :placeholder="t('')"> </el-input>
</el-descriptions-item>
<el-descriptions-item label-width="150" label-align="right" :label="t('拉取投注记录地址')">
<el-input v-model="formInterface.urlInfo.betUrl" style="width: 400px;" disabled :placeholder="t('')"> </el-input>
</el-descriptions-item>
<el-descriptions-item label-width="150" label-align="right" :label="t('代理类型')">
<span v-if="formInterface.type == 0">{{ t('') }}</span>
<span v-if="formInterface.type == 1">{{ t('') }}</span>
</el-descriptions-item>
<el-descriptions-item label-width="150" label-align="right" :label="t('语言')">
<div style="width: 100%;display: flex;flex-wrap: wrap;">
<span v-for="(item,index) in mapLangNames(formInterface.langInfo)">
{{ item }}<span v-if="index != mapLangNames(formInterface.langInfo).length - 1">,</span>
</span>
</div>
</el-descriptions-item>
<el-descriptions-item label-width="150" label-align="right" :label="t('币种')">
<div style="width: 100%;display: flex;flex-wrap: wrap;">
<span v-for="(item,index) in Object.keys(formInterface.currencyInfo)">
{{ item }}<span v-if="index != Object.keys(formInterface.currencyInfo).length - 1">,</span>
</span>
<!-- {{ formInterface.currencyInfo }} -->
</div>
</el-descriptions-item>
</el-descriptions>
<div style="height: 20px;"></div>
<el-table :data="formInterface.keyInfo" class="" border>
<el-table-column :label="t('编码')" align="center" prop="code" />
<el-table-column :label="t('币种')" align="center" prop="currency" />
<el-table-column :label="t('KEY')" align="center" prop="key" width="350">
<template #default="scope">
<el-input v-model="scope.row.key" :type="passwordVisible == scope.row.currency ? 'text' : 'password'" type="password" disabled>
<template #suffix>
<el-icon @click="togglePassword(scope.row)" style="cursor: pointer;">
<el-icon v-if="passwordVisible == scope.row.currency" :size="18">
<View />
</el-icon>
<el-icon v-else :size="18">
<Hide />
</el-icon>
</el-icon>
</template>
</el-input>
</template>
</el-table-column>
</el-table>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="openInterface = false">{{ t('关 闭') }}</el-button>
</div>
</template>
</el-dialog>
<!-- 修改平台 -->
<el-dialog :title="rowOpenRevise.id == '' ? t('新增平台') : t('修改平台')" align-center v-model="openRevise" width="1300px" append-to-body>
<el-form ref="openReviseRef" :model="rowOpenRevise" :rules="ruleForm" label-width="120px">
<el-descriptions border :column="2" class="c-descriptions" >
<el-descriptions-item label-width="150" label-align="right" :label="t('平台代码')">
<el-form-item label-width="0" style="width: 100%;" prop="platformCode">
<el-input v-model="rowOpenRevise.platformCode" style="width: 400px;" :placeholder="t('请输入平台代码')"> </el-input>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label-width="150" label-align="right" :label="t('平台展示代码')">
<el-form-item label-width="0" style="width: 100%;" prop="platformShowCode">
<el-input v-model="rowOpenRevise.platformShowCode" style="width: 400px;" :placeholder="t('请输入平台展示代码')"> </el-input>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label-width="150" label-align="right" :label="t('平台名称')">
<el-form-item label-width="0" style="width: 100%;" prop="platformName">
<el-input v-model="rowOpenRevise.platformName" style="width: 400px;" :placeholder="t('请输入平台名称')"> </el-input>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label-width="150" label-align="right" :label="t('拉取模式')">
<el-radio-group v-model="rowOpenRevise.type">
<el-radio-button :value="1">{{ t('普通') }}</el-radio-button>
<el-radio-button :value="0" >{{ t('多币种') }}</el-radio-button>
</el-radio-group>
</el-descriptions-item>
<el-descriptions-item label-width="150" label-align="right" :label="t('平台信息')">
<div style="width: 100%;display: flex;flex-wrap: wrap;">
<el-form-item label-width="0" style="width: 100%;" prop="platformInfo">
<el-input type="textarea" rows="4" v-model="rowOpenRevise.platformInfo" style="width: 400px;" :placeholder="t('请输入平台信息')"> </el-input>
</el-form-item>
</div>
</el-descriptions-item>
<el-descriptions-item label-width="150" label-align="right" :label="t('地址信息')">
<div style="width: 100%;display: flex;flex-wrap: wrap;">
<el-form-item label-width="0" style="width: 100%;" prop="urlInfo">
<el-input type="textarea" rows="4" v-model="rowOpenRevise.urlInfo" style="width: 400px;" :placeholder="t('请输入语言信息')"> </el-input>
</el-form-item>
</div>
</el-descriptions-item>
<el-descriptions-item label-width="150" label-align="right" :label="t('语言信息')">
<div style="width: 100%;display: flex;flex-wrap: wrap;">
<el-form-item label-width="0" style="width: 100%;" prop="langInfo">
<el-input type="textarea" rows="4" v-model="rowOpenRevise.langInfo" style="width: 400px;" :placeholder="t('请输入语言信息')"> </el-input>
</el-form-item>
</div>
</el-descriptions-item>
<el-descriptions-item label-width="150" label-align="right" :label="t('币种信息')">
<div style="width: 100%;display: flex;flex-wrap: wrap;">
<el-form-item label-width="0" style="width: 100%;" prop="currencyInfo">
<el-input type="textarea" rows="4" v-model="rowOpenRevise.currencyInfo" style="width: 400px;" :placeholder="t('请输入币种信息')"> </el-input>
</el-form-item>
<!-- {{ rowOpenRevise.currencyInfo }} -->
</div>
</el-descriptions-item>
<el-descriptions-item label-width="150" label-align="right" :label="t('扩展信息')">
<div style="width: 100%;display: flex;flex-wrap: wrap;">
<el-form-item label-width="0" style="width: 100%;" prop="extInfo">
<el-input type="textarea" rows="4" v-model="rowOpenRevise.extInfo" style="width: 400px;" :placeholder="t('请输入币种信息')"> </el-input>
</el-form-item>
<!-- {{ rowOpenRevise.currencyInfo }} -->
</div>
</el-descriptions-item>
<el-descriptions-item label-width="150" label-align="right" :label="t('密钥信息')">
<div style="width: 100%;display: flex;flex-wrap: wrap;">
<el-form-item label-width="0" style="width: 100%;" prop="keyInfo">
<el-input type="textarea" rows="8" v-model="rowOpenRevise.keyInfo" style="width: 100%;" :placeholder="t('请输入密钥信息')"> </el-input>
</el-form-item>
</div>
</el-descriptions-item>
</el-descriptions>
<div style="height: 20px;"></div>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitInterface" :loading="loadingButton" v-hasPermi="['super:platform:update']">{{ t(' ') }}</el-button>
<el-button @click="openRevise = false">{{ t('取消') }}</el-button>
</div>
</template>
</el-dialog>
<!-- 详情/修改对话框 -->
<el-dialog v-model="openView" align-center width="1300px" append-to-body>
<template #header>
<div style="width: 100%;text-align: center;">{{ 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-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>
</div>
</template>
</el-dialog>
</div>
</template>
<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 Crontab from '@/components/Crontab'
import { getLocalStorage } from '@/utils/auth'
import { parseTime } from '@/utils/ruoyi'; //
import NumberInput from '@/components/NumberInput'
import CustomSelect from '@/components/CustomSelect'
import BaseSwitch from '@/components/BaseSwitch'
import { id } from "element-plus/es/locales.mjs";
import { ref } from "vue";
const router = useRouter();
const { proxy } = getCurrentInstance();
const { ff_tenant_type, ff_tenant_status } = proxy.useDict("ff_tenant_type", "ff_tenant_status");
const loadingButton = ref(false);
const agentList = ref([]);
const open = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const title = ref("");
const openView = ref(false);
const openCron = ref(false);
const expression = ref("");
const tenantAgentPlatforms = ref([]);
const formInterface = reactive({
});
const oldForm = shallowRef({ });
const rulesInterface = reactive({
})
const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 10,
tenantKey: "",
platformShowCode: "",
},
rules: {
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" }],
}
});
const ruleForm = reactive({
platformCode: [
{ required: true, message: proxy.t('平台编码不能为空'), trigger: "change" }
],
platformShowCode:[
{ required: true, message: proxy.t('平台展示代码不能为空'), trigger: "change" }
],
platformName: [
{ required: true, message: proxy.t('平台名称不能为空'), trigger: "change" }
],
platformInfo: [
{
validator: (rule, value, callback) => {
if (!value) {
return callback(new Error('请输入平台信息'))
}
try {
const parsed = JSON.parse(value)
//
if (typeof parsed === 'object' && parsed !== null) {
callback() //
} else {
callback(new Error('请输入合法的 JSON对象或数组'))
}
} catch (e) {
callback(new Error('请输入合法的 JSON对象或数组'))
}
},
trigger: 'change'
}
],
urlInfo: [
{
validator: (rule, value, callback) => {
if (!value) {
return callback(new Error('请输入地址信息'))
}
try {
const parsed = JSON.parse(value)
//
if (typeof parsed === 'object' && parsed !== null) {
callback() //
} else {
callback(new Error('请输入合法的 JSON对象或数组'))
}
} catch (e) {
callback(new Error('请输入合法的 JSON对象或数组'))
}
},
trigger: 'change'
}
],
langInfo: [
{
validator: (rule, value, callback) => {
if (!value) {
return callback(new Error('请输入语言信息'))
}
try {
const parsed = JSON.parse(value)
//
if (typeof parsed === 'object' && parsed !== null) {
callback() //
} else {
callback(new Error('请输入合法的 JSON对象或数组'))
}
} catch (e) {
callback(new Error('请输入合法的 JSON对象或数组'))
}
},
trigger: 'change'
}
],
currencyInfo: [
{
validator: (rule, value, callback) => {
if (!value) {
return callback(new Error('请输入币种信息'))
}
try {
const parsed = JSON.parse(value)
//
if (typeof parsed === 'object' && parsed !== null) {
callback() //
} else {
callback(new Error('请输入合法的 JSON对象或数组'))
}
} catch (e) {
callback(new Error('请输入合法的 JSON对象或数组'))
}
},
trigger: 'change'
}
],
extInfo: [
{
validator: (rule, value, callback) => {
if (!value) {
return callback(new Error('请输入展示信息'))
}
try {
const parsed = JSON.parse(value)
//
if (typeof parsed === 'object' && parsed !== null) {
callback() //
} else {
callback(new Error('请输入合法的 JSON对象或数组'))
}
} catch (e) {
callback(new Error('请输入合法的 JSON对象或数组'))
}
},
trigger: 'change'
}
],
keyInfo: [
{
validator: (rule, value, callback) => {
if (!value) {
return callback(new Error('请输入密钥信息'))
}
try {
const parsed = JSON.parse(value)
//
if (typeof parsed === 'object' && parsed !== null) {
callback() //
} else {
callback(new Error('请输入合法的 JSON对象或数组'))
}
} catch (e) {
callback(new Error('请输入合法的 JSON对象或数组'))
}
},
trigger: 'change'
}
],
})
const { queryParams, form, rules } = toRefs(data);
/** 查询列表 */
function getList() {
loading.value = true;
superPlatformList(queryParams.value).then(response => {
const _data = response.rows;
//
const mergedData = _data.flatMap(mainData => {
return mainData.superPlatformManufacturers.map(child => ({
platformShowCode:mainData.platformShowCode, //
id: child.id, //
platformManufacturerName:child.platformManufacturerName, //
platformShowCode:child.platformShowCode, //
stopStatus:child.stopStatus,
tenantSystemPlatformDTOS:child.tenantSystemPlatformDTOS,
}));
});
agentList.value = mergedData;
total.value = response.total;
loading.value = false;
});
}
//
const objectSpanMethod = ({ row, column, rowIndex, columnIndex }) => {
if (columnIndex === 0) {
//
if (rowIndex === 0) {
// rowspan 1
let rowspan = 1;
// rowspan
for (let i = rowIndex + 1; i < agentList.value.length; i++) {
if (agentList.value[i].platformShowCode === row.platformShowCode) {
rowspan++;
} else {
break;
}
}
//
return { rowspan, colspan: 1 };
} else {
//
let rowspan = 0; // 0
// classId
if (rowIndex > 0 && agentList.value[rowIndex - 1].platformShowCode === row.platformShowCode) {
// rowspan 0
rowspan = 0;
} else {
//
rowspan = 1;
for (let i = rowIndex + 1; i < agentList.value.length; i++) {
if (agentList.value[i].platformShowCode === row.platformShowCode) {
rowspan++;
} else {
break;
}
}
}
// colspan 1
return { rowspan, colspan: 1 };
}
} else {
//
return { rowspan: 1, colspan: 1 };
}
};
const sys_job_status = ref([]);
const showLoding2 = ref(true);
const getsuperCommonPlatformTypeSelect = async () => {
showLoding2.value = false;
getPlatformShowSelect().then(response => {
sys_job_status.value = response.data.map(item => {
return { label: item.platformName, value: item.platformCode }
});
showLoding2.value = true;
});
}
function mapLangNames(langMap) {
const result = [];
const languageList = getLocalStorage('langSelect');
Object.entries(langMap).forEach(([fullCode]) => {
const match = languageList.find(item => item.langMerge === fullCode);
if (match && match.name) {
result.push(match.name+"("+match.langMerge+")");
}
});
return result;
}
const passwordVisible = ref('');
const togglePassword = (row) => {
if (row.currency == passwordVisible.value){
passwordVisible.value = '';
}else{
passwordVisible.value = row.currency
}
}
//
const beforeSwitchChange = async (row, undateKeys) => {
const _status = row[undateKeys] == false ? true : false;
console.log(_status);
const _data = {
id: row.id,
}
_data[undateKeys] = _status
try {
await createPlatformSwitch(_data).then(() => {
proxy.$modal.msgSuccess(_status ? proxy.t('关闭成功') : proxy.t('开启成功'))
getList()
})
return true;
} catch (error) {
console.error(proxy.t('接口调用失败'), error);
return false; //
}
}
/** 任务组名字典翻译 */
function jobGroupFormat(row, column) {
return proxy.selectDictLabel(sys_job_group.value, row.jobGroup);
}
const switchBeforeChange = () => {
return false
}
/** 取消按钮 */
function cancel() {
open.value = false;
reset();
}
/** 表单重置 */
function reset() {
form.value = {
account: "",
password: "",
scoreRatio: 1,
tenantType: 1,
tenantAgentPlatforms: [],
};
proxy.resetForm("agentRef");
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
getList();
}
/** 重置按钮操作 */
function resetQuery() {
proxy.resetForm("queryRef");
handleQuery();
}
//
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.jobId);
single.value = selection.length != 1;
multiple.value = !selection.length;
}
const tenantSystemPlatformDTOSRow = ref([]);
const titlePlatForm = ref('');
const handleRevise = (row) => {
titlePlatForm.value = proxy.t('修改');
tenantSystemPlatformDTOSRow.value = row.tenantSystemPlatformDTOS;
oldForm.value = JSON.stringify(tenantSystemPlatformDTOSRow.value);
openView.value = true;
}
const openInterface = ref(false);
const rowInterface = ref({});
//
const handleInterface = (row) => {
getSuperPlatformInf(row.id).then(response => {
Object.assign(formInterface, response.data);
oldForm.value = JSON.stringify(formInterface);
openInterface.value = true;
})
}
const openRevise = ref(false);
const rowOpenRevise = reactive({});
const handleOpenRevise = (row) => {
getSuperPlatformInf(row.id).then(response => {
Object.assign(rowOpenRevise, response.data);
rowOpenRevise.platformInfo = JSON.stringify(rowOpenRevise.platformInfo);
rowOpenRevise.keyInfo = JSON.stringify(rowOpenRevise.keyInfo);
rowOpenRevise.langInfo = JSON.stringify(rowOpenRevise.langInfo);
rowOpenRevise.currencyInfo = JSON.stringify(rowOpenRevise.currencyInfo);
rowOpenRevise.extInfo = JSON.stringify(rowOpenRevise.extInfo);
rowOpenRevise.urlInfo = JSON.stringify(rowOpenRevise.urlInfo);
oldForm.value = JSON.stringify(rowOpenRevise);
openRevise.value = true;
})
}
/** 详细信息 */
function handleView(row) {
titlePlatForm.value = proxy.t('详情');
tenantSystemPlatformDTOSRow.value = row.tenantSystemPlatformDTOS;
openView.value = true;
}
const gameList = ref([]),platformCode = ref(''),currencyCode = ref(''),gameName = ref('');
const gameLists = () => {
let obj = {
gameName:'',
platformCode:platformCode.value,
currencyCode:currencyCode.value,
}
superGameList(obj).then(response => {
console.log(response, "游戏列表");
gameList.value = response.rows;
openView.value = true;
});
}
const handleGame = (row) => {
platformCode.value = row.platformCode;
currencyCode.value = row.currencyCode;
gameLists();
}
const switchChange = (row) => {
let obj = {
gameId:row.gameId,
stopStatus:row.stopStatus==true?false:true,
currencyCode:row.currencyCode,
}
createGameuUpdate(obj).then(response => {
console.log(response, "游戏列表");
openView.value = true;
gameLists();
});
}
/** 获取平台利润 */
function getSelectPlatform() {
// selectPlatform().then(response => {
// form.value.tenantAgentPlatforms = response.data;
// tenantAgentPlatforms.value = JSON.parse(JSON.stringify(response.data));
// });
}
/** 新增按钮操作 */
function handleAdd() {
rowOpenRevise.id = '';
rowOpenRevise.type = 1;
openRevise.value = true;
}
function queryCode(type) {
tenantSystemPlatformDTOSRow.value = tenantSystemPlatformDTOSRow.value.map((item, index) => {
if (type === 'del' && item.cost > 0) {
item.cost -= 0.5;
} else if (type === 'add') {
console.log('333333333');
item.cost += 0.5;
}
return item
})
}
/** 提交按钮 */
function submitForm() {
let obj = {
tenantSystemPlatforms: tenantSystemPlatformDTOSRow.value
}
loadingButton.value = true;
if (JSON.stringify(tenantSystemPlatformDTOSRow.value) != oldForm.value) {
updatePlatformCurrency(obj).then(response => {
loadingButton.value = false;
proxy.$modal.msgSuccess(proxy.t('更新成功'));
openView.value = false;
getList();
});
}else{
loadingButton.value = false;
openView.value = false;
}
}
const openReviseRef = ref(null);
const submitInterface = () => {
proxy.$refs["openReviseRef"].validate(valid => {
if (valid) {
loadingButton.value = true;
if (JSON.stringify(rowOpenRevise) != oldForm.value) {
let obj = {
id:rowOpenRevise.id,
platformCode:rowOpenRevise.platformCode,
platformShowCode:rowOpenRevise.platformShowCode,
platformName:rowOpenRevise.platformName,
type: rowOpenRevise.type,
platformInfo: JSON.parse(rowOpenRevise.platformInfo),
keyInfo: JSON.parse(rowOpenRevise.keyInfo),
currencyInfo:JSON.parse(rowOpenRevise.currencyInfo),
langInfo:JSON.parse(rowOpenRevise.langInfo),
extInfo:JSON.parse(rowOpenRevise.extInfo)
}
if (rowOpenRevise.id == ''){
createPlatformAdd(obj).then(response => {
loadingButton.value = false;
proxy.$modal.msgSuccess(proxy.t('新增成功'));
openRevise.value = false;
getList();
}).catch(() => {
loadingButton.value = false;
});
}else{
createPlatformUpdate(obj).then(response => {
loadingButton.value = false;
proxy.$modal.msgSuccess(proxy.t('更新成功'));
openRevise.value = false;
getList();
}).catch(() => {
loadingButton.value = false;
});
}
} else {
loadingButton.value = false;
openRevise.value = false;
}
}
});
}
getList();
getsuperCommonPlatformTypeSelect();
</script>
<style scoped lang="scss">
.label-scoreRatio{
width: 100%;
display: flex;
justify-content: right;
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;
}
.fixed-label-width {
width: 200px; /* 设置您想要的固定宽度 */
}
:deep(.el-descriptions__label.el-descriptions__cell.is-bordered-label){
width: 180px!important;
}
</style>

View File

@ -2,14 +2,24 @@
<div class="app-container">
<table-search-card :model="queryParams" @getList="getList" @handleQuery="handleQuery" @resetQuery="resetQuery">
<template #left>
<el-form-item :label="t('接口名称')" prop="platformName">
<el-input v-model="queryParams.platformName" style="width: 200px" placeholder="请输入接口名称" clearable />
</el-form-item>
<el-form-item :label="t('平台类型')" prop="platformShowCode">
<CustomSelect v-if="showLoding2" v-model="queryParams.platformShowCode" :options="sys_job_status" placeholder="请选择平台类型" style="width: 200px" />
</el-form-item>
<el-form-item :label="t('开启状态')" prop="stopStatus">
<CustomSelect v-if="showLoding2" v-model="queryParams.stopStatus" :options="stopStatusOptions" placeholder="请选择开启状态" style="width: 200px" />
</el-form-item>
</template>
<template #right>
<el-form-item>
<el-button type="primary" icon="Plus" @click="handleAdd" v-hasPermi="['super:platform:add']">{{ t('') }}</el-button>
</el-form-item>
<!-- v-hasPermi="['super:platform:add']" -->
</template>
</table-search-card>
<el-table v-loading="loading" :span-method="objectSpanMethod" class="c-table-main" :data="agentList" border>
<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" >
@ -25,8 +35,10 @@
</el-table-column>
<el-table-column :label="t('操作')" align="center" width="200" class-name="small-padding fixed-width">
<template #default="{row}">
<el-button link type="primary" @click="handleRevise(row)" v-hasPermi="['super:platform:detail']">{{ 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>
</template>
</el-table-column>
</el-table>
@ -87,16 +99,109 @@
<el-table-column :label="t('币种')" align="center" prop="currency" />
<el-table-column :label="t('KEY')" align="center" prop="key" width="350">
<template #default="scope">
<el-input v-model="scope.row.key" disabled> </el-input>
<el-input v-model="scope.row.key" :type="passwordVisible == scope.row.currency ? 'text' : 'password'" type="password" disabled>
<template #suffix>
<el-icon @click="togglePassword(scope.row)" style="cursor: pointer;">
<el-icon v-if="passwordVisible == scope.row.currency" :size="18">
<View />
</el-icon>
<el-icon v-else :size="18">
<Hide />
</el-icon>
</el-icon>
</template>
</el-input>
</template>
</el-table-column>
</el-table>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="openInterface = false">{{ t('关 闭') }}</el-button>
</div>
</template>
</el-dialog>
<!-- 修改平台 -->
<el-dialog :title="rowOpenRevise.id == '' ? t('新增平台') : t('修改平台')" align-center v-model="openRevise" width="1300px" append-to-body>
<el-form ref="openReviseRef" :model="rowOpenRevise" :rules="ruleForm" label-width="120px">
<el-descriptions border :column="2" class="c-descriptions" >
<el-descriptions-item label-width="150" label-align="right" :label="t('平台代码')">
<el-form-item label-width="0" style="width: 100%;" prop="platformCode">
<el-input v-model="rowOpenRevise.platformCode" style="width: 400px;" :placeholder="t('请输入平台代码')"> </el-input>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label-width="150" label-align="right" :label="t('平台展示代码')">
<el-form-item label-width="0" style="width: 100%;" prop="platformShowCode">
<el-input v-model="rowOpenRevise.platformShowCode" style="width: 400px;" :placeholder="t('请输入平台展示代码')"> </el-input>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label-width="150" label-align="right" :label="t('平台名称')">
<el-form-item label-width="0" style="width: 100%;" prop="platformName">
<el-input v-model="rowOpenRevise.platformName" style="width: 400px;" :placeholder="t('请输入平台名称')"> </el-input>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label-width="150" label-align="right" :label="t('拉取模式')">
<el-radio-group v-model="rowOpenRevise.type">
<el-radio-button :value="1">{{ t('普通') }}</el-radio-button>
<el-radio-button :value="0" >{{ t('多币种') }}</el-radio-button>
</el-radio-group>
</el-descriptions-item>
<el-descriptions-item label-width="150" label-align="right" :label="t('平台信息')">
<div style="width: 100%;display: flex;flex-wrap: wrap;">
<el-form-item label-width="0" style="width: 100%;" prop="platformInfo">
<el-input type="textarea" rows="4" v-model="rowOpenRevise.platformInfo" style="width: 400px;" :placeholder="t('请输入平台信息')"> </el-input>
</el-form-item>
</div>
</el-descriptions-item>
<el-descriptions-item label-width="150" label-align="right" :label="t('地址信息')">
<div style="width: 100%;display: flex;flex-wrap: wrap;">
<el-form-item label-width="0" style="width: 100%;" prop="urlInfo">
<el-input type="textarea" rows="4" v-model="rowOpenRevise.urlInfo" style="width: 400px;" :placeholder="t('请输入语言信息')"> </el-input>
</el-form-item>
</div>
</el-descriptions-item>
<el-descriptions-item label-width="150" label-align="right" :label="t('语言信息')">
<div style="width: 100%;display: flex;flex-wrap: wrap;">
<el-form-item label-width="0" style="width: 100%;" prop="langInfo">
<el-input type="textarea" rows="4" v-model="rowOpenRevise.langInfo" style="width: 400px;" :placeholder="t('请输入语言信息')"> </el-input>
</el-form-item>
</div>
</el-descriptions-item>
<el-descriptions-item label-width="150" label-align="right" :label="t('币种信息')">
<div style="width: 100%;display: flex;flex-wrap: wrap;">
<el-form-item label-width="0" style="width: 100%;" prop="currencyInfo">
<el-input type="textarea" rows="4" v-model="rowOpenRevise.currencyInfo" style="width: 400px;" :placeholder="t('请输入币种信息')"> </el-input>
</el-form-item>
<!-- {{ rowOpenRevise.currencyInfo }} -->
</div>
</el-descriptions-item>
<el-descriptions-item label-width="150" label-align="right" :label="t('扩展信息')">
<div style="width: 100%;display: flex;flex-wrap: wrap;">
<el-form-item label-width="0" style="width: 100%;" prop="extInfo">
<el-input type="textarea" rows="4" v-model="rowOpenRevise.extInfo" style="width: 400px;" :placeholder="t('请输入币种信息')"> </el-input>
</el-form-item>
<!-- {{ rowOpenRevise.currencyInfo }} -->
</div>
</el-descriptions-item>
<el-descriptions-item label-width="150" label-align="right" :label="t('密钥信息')">
<div style="width: 100%;display: flex;flex-wrap: wrap;">
<el-form-item label-width="0" style="width: 100%;" prop="keyInfo">
<el-input type="textarea" rows="8" v-model="rowOpenRevise.keyInfo" style="width: 100%;" :placeholder="t('请输入密钥信息')"> </el-input>
</el-form-item>
</div>
</el-descriptions-item>
</el-descriptions>
<div style="height: 20px;"></div>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitInterface" :loading="loadingButton" v-hasPermi="['super:platform:update']">{{ t(' ') }}</el-button>
<el-button @click="openInterface = false">{{ t('取 消') }}</el-button>
<el-button @click="openRevise = false">{{ t('取消') }}</el-button>
</div>
</template>
</el-dialog>
@ -152,7 +257,7 @@
</template>
<script setup name="Agent">
import { superPlatformList, createPlatformUpdate,superGameList,createGameuUpdate,getSuperPlatformInf,createPlatformSwitch,getPlatformShowSelect,updatePlatformCurrency } from "@/api/super/platform.js";
import { superPlatformList, createPlatformUpdate,createPlatformAdd,superGameList,createGameuUpdate,getSuperPlatformInf,createPlatformSwitch,getPlatformShowSelect,updatePlatformCurrency } from "@/api/super/platform.js";
import { superCommonPlatformTypeSelect } from "@/api/super/tenant";
import Crontab from '@/components/Crontab'
import { getLocalStorage } from '@/utils/auth'
@ -161,6 +266,7 @@
import CustomSelect from '@/components/CustomSelect'
import BaseSwitch from '@/components/BaseSwitch'
import { id } from "element-plus/es/locales.mjs";
import { ref } from "vue";
const router = useRouter();
const { proxy } = getCurrentInstance();
const { ff_tenant_type, ff_tenant_status } = proxy.useDict("ff_tenant_type", "ff_tenant_status");
@ -178,6 +284,11 @@ import { id } from "element-plus/es/locales.mjs";
const openCron = ref(false);
const expression = ref("");
const tenantAgentPlatforms = ref([]);
const stopStatusOptions = ref([
{ label: "开启", value: false },
{ label: "关闭", value: true },
])
const formInterface = reactive({
});
@ -201,7 +312,148 @@ import { id } from "element-plus/es/locales.mjs";
tenantType: [{ required: true, message: proxy.t('商户模式不能为空'), trigger: "change" }],
}
});
const ruleForm = reactive({
platformCode: [
{ required: true, message: proxy.t('平台编码不能为空'), trigger: "change" }
],
platformShowCode:[
{ required: true, message: proxy.t('平台展示代码不能为空'), trigger: "change" }
],
platformName: [
{ required: true, message: proxy.t('平台名称不能为空'), trigger: "change" }
],
platformInfo: [
{
validator: (rule, value, callback) => {
if (!value) {
return callback(new Error('请输入平台信息'))
}
try {
const parsed = JSON.parse(value)
//
if (typeof parsed === 'object' && parsed !== null) {
callback() //
} else {
callback(new Error('请输入合法的 JSON对象或数组'))
}
} catch (e) {
callback(new Error('请输入合法的 JSON对象或数组'))
}
},
trigger: 'change'
}
],
urlInfo: [
{
validator: (rule, value, callback) => {
if (!value) {
return callback(new Error('请输入地址信息'))
}
try {
const parsed = JSON.parse(value)
//
if (typeof parsed === 'object' && parsed !== null) {
callback() //
} else {
callback(new Error('请输入合法的 JSON对象或数组'))
}
} catch (e) {
callback(new Error('请输入合法的 JSON对象或数组'))
}
},
trigger: 'change'
}
],
langInfo: [
{
validator: (rule, value, callback) => {
if (!value) {
return callback(new Error('请输入语言信息'))
}
try {
const parsed = JSON.parse(value)
//
if (typeof parsed === 'object' && parsed !== null) {
callback() //
} else {
callback(new Error('请输入合法的 JSON对象或数组'))
}
} catch (e) {
callback(new Error('请输入合法的 JSON对象或数组'))
}
},
trigger: 'change'
}
],
currencyInfo: [
{
validator: (rule, value, callback) => {
if (!value) {
return callback(new Error('请输入币种信息'))
}
try {
const parsed = JSON.parse(value)
//
if (typeof parsed === 'object' && parsed !== null) {
callback() //
} else {
callback(new Error('请输入合法的 JSON对象或数组'))
}
} catch (e) {
callback(new Error('请输入合法的 JSON对象或数组'))
}
},
trigger: 'change'
}
],
extInfo: [
{
validator: (rule, value, callback) => {
if (!value) {
return callback(new Error('请输入展示信息'))
}
try {
const parsed = JSON.parse(value)
//
if (typeof parsed === 'object' && parsed !== null) {
callback() //
} else {
callback(new Error('请输入合法的 JSON对象或数组'))
}
} catch (e) {
callback(new Error('请输入合法的 JSON对象或数组'))
}
},
trigger: 'change'
}
],
keyInfo: [
{
validator: (rule, value, callback) => {
if (!value) {
return callback(new Error('请输入密钥信息'))
}
try {
const parsed = JSON.parse(value)
//
if (typeof parsed === 'object' && parsed !== null) {
callback() //
} else {
callback(new Error('请输入合法的 JSON对象或数组'))
}
} catch (e) {
callback(new Error('请输入合法的 JSON对象或数组'))
}
},
trigger: 'change'
}
],
})
const { queryParams, form, rules } = toRefs(data);
/** 查询列表 */
@ -210,17 +462,17 @@ import { id } from "element-plus/es/locales.mjs";
superPlatformList(queryParams.value).then(response => {
const _data = response.rows;
//
const mergedData = _data.flatMap(mainData => {
return mainData.superPlatformManufacturers.map(child => ({
platformShowCode:mainData.platformShowCode, //
id: child.id, //
platformManufacturerName:child.platformManufacturerName, //
platformShowCode:child.platformShowCode, //
stopStatus:child.stopStatus,
tenantSystemPlatformDTOS:child.tenantSystemPlatformDTOS,
}));
});
agentList.value = mergedData;
// const mergedData = _data.flatMap(mainData => {
// return mainData.superPlatformManufacturers.map(child => ({
// platformShowCode:mainData.platformShowCode, //
// id: child.id, //
// platformManufacturerName:child.platformManufacturerName, //
// platformShowCode:child.platformShowCode, //
// stopStatus:child.stopStatus,
// tenantSystemPlatformDTOS:child.tenantSystemPlatformDTOS,
// }));
// });
agentList.value = _data;
total.value = response.total;
loading.value = false;
});
@ -293,17 +545,27 @@ function mapLangNames(langMap) {
return result;
}
const passwordVisible = ref('');
const togglePassword = (row) => {
if (row.currency == passwordVisible.value){
passwordVisible.value = '';
}else{
passwordVisible.value = row.currency
}
}
//
const beforeSwitchChange = async (row, undateKeys) => {
console.log(row[undateKeys]);
const _status = row[undateKeys] == false ? true : false
const _status = row[undateKeys] == false ? true : false;
console.log(_status);
const _data = {
id: row.id,
}
_data[undateKeys] = _status
try {
await createPlatformSwitch(_data).then(() => {
proxy.$modal.msgSuccess(_status === true ? proxy.t('开启成功') : proxy.t('关闭成功'))
proxy.$modal.msgSuccess(_status ? proxy.t('关闭成功') : proxy.t('开启成功'))
getList()
})
return true;
@ -375,6 +637,23 @@ const switchBeforeChange = () => {
})
}
const openRevise = ref(false);
const rowOpenRevise = reactive({});
const handleOpenRevise = (row) => {
getSuperPlatformInf(row.id).then(response => {
Object.assign(rowOpenRevise, response.data);
rowOpenRevise.platformInfo = JSON.stringify(rowOpenRevise.platformInfo);
rowOpenRevise.keyInfo = JSON.stringify(rowOpenRevise.keyInfo);
rowOpenRevise.langInfo = JSON.stringify(rowOpenRevise.langInfo);
rowOpenRevise.currencyInfo = JSON.stringify(rowOpenRevise.currencyInfo);
rowOpenRevise.extInfo = JSON.stringify(rowOpenRevise.extInfo);
rowOpenRevise.urlInfo = JSON.stringify(rowOpenRevise.urlInfo);
oldForm.value = JSON.stringify(rowOpenRevise);
openRevise.value = true;
})
}
/** 详细信息 */
function handleView(row) {
titlePlatForm.value = proxy.t('详情');
@ -422,10 +701,9 @@ const switchBeforeChange = () => {
/** 新增按钮操作 */
function handleAdd() {
reset();
getSelectPlatform();
open.value = true;
title.value = proxy.t('添加商户');
rowOpenRevise.id = '';
rowOpenRevise.type = 1;
openRevise.value = true;
}
function queryCode(type) {
@ -458,20 +736,52 @@ const switchBeforeChange = () => {
}
}
const openReviseRef = ref(null);
const submitInterface = () => {
proxy.$refs["interfaceRef"].validate(valid => {
proxy.$refs["openReviseRef"].validate(valid => {
if (valid) {
loadingButton.value = true;
if (JSON.stringify(formInterface) != oldForm.value) {
createPlatformUpdate(formInterface).then(response => {
loadingButton.value = false;
proxy.$modal.msgSuccess(proxy.t('更新成功'));
openInterface.value = false;
if (JSON.stringify(rowOpenRevise) != oldForm.value) {
let obj = {
id:rowOpenRevise.id,
platformCode:rowOpenRevise.platformCode,
platformShowCode:rowOpenRevise.platformShowCode,
platformName:rowOpenRevise.platformName,
type: rowOpenRevise.type,
platformInfo: JSON.parse(rowOpenRevise.platformInfo),
keyInfo: JSON.parse(rowOpenRevise.keyInfo),
currencyInfo:JSON.parse(rowOpenRevise.currencyInfo),
langInfo:JSON.parse(rowOpenRevise.langInfo),
extInfo:JSON.parse(rowOpenRevise.extInfo),
stopStatus:rowOpenRevise.stopStatus,
urlInfo:JSON.parse(rowOpenRevise.urlInfo),
}
if (rowOpenRevise.id == ''){
createPlatformAdd(obj).then(response => {
loadingButton.value = false;
proxy.$modal.msgSuccess(proxy.t('新增成功'));
openRevise.value = false;
getList();
}).catch(() => {
loadingButton.value = false;
});
}else{
createPlatformUpdate(obj).then(response => {
loadingButton.value = false;
proxy.$modal.msgSuccess(proxy.t('更新成功'));
openRevise.value = false;
getList();
}).catch(() => {
loadingButton.value = false;
});
}
} else {
loadingButton.value = false;
openInterface.value = false;
openRevise.value = false;
}
}
});