BUG修复,及部分页面增加按钮权限

This commit is contained in:
Songsl 2026-04-28 14:31:56 +08:00
parent adcbbb6752
commit 2f54ebef78
17 changed files with 1284 additions and 980 deletions

View File

@ -416,6 +416,7 @@ const handleSubmit = async () => {
try {
await editCustomerApi({ ...params, point_diffs_json: JSON.stringify(marginRatioJSON) })
dialogVisible.value = false
await getCustomerList(userId.value)
} catch (err) {
console.log('提交失败:', err)
}
@ -428,6 +429,7 @@ const handleSubmit = async () => {
fee_handling_percent: commissionRatioForm.value.commissionRatio,
})
dialogVisible.value = false
await getCustomerList(userId.value)
} catch (err) {
console.log('提交失败:', err)
}

View File

@ -1,9 +1,9 @@
<template>
<div class="deposit-channel">
<div class="bar">
<el-button type="primary" @click="handleAdd">添加</el-button>
<el-button type="primary" @click="handleEdit">编辑</el-button>
<el-button type="danger" @click="handleDelete">删除</el-button>
<el-button type="primary" @click="handleAdd" v-auth="'channel_createChannel'">添加</el-button>
<el-button type="primary" @click="handleEdit" v-auth="'channel_editChannel'">编辑</el-button>
<el-button type="danger" @click="handleDelete" v-auth="'channel_delChannel'">删除</el-button>
</div>
<DepositChannelTable
ref="tableRef"

View File

@ -9,8 +9,12 @@
>
<template #button>
<!-- 审核动作先保留按钮交互后续可直接接接口 -->
<el-button type="danger" plain @click="handleReject">驳回</el-button>
<el-button type="success" @click="handleApprove">通过</el-button>
<el-button type="danger" plain @click="handleReject" v-auth="'user_reviewRechargeOrder'"
>驳回</el-button
>
<el-button type="success" @click="handleApprove" v-auth="'user_reviewRechargeOrder'"
>通过</el-button
>
<el-button type="primary" plain @click="handleExport">导出</el-button>
</template>
</RechangeSearch>

View File

@ -2,18 +2,32 @@
<div class="transfer">
<div class="title">转账</div>
<el-card class="transfer-card">
<div class="transfer-item">1.佣金钱包转出时,需要管理员审核通过后才能转账成功其余内部转账操作无需通过管理员审核如发现对应账号没有收到转账资金请于客服人员联系</div>
<div class="transfer-item">2.如转出账号与转入账号的货币单位不同系统将按照当日汇率进行换算</div>
<div class="transfer-item">3.若有在途订单时进行了MT账号的转出操作因浮动盈亏影响可能会导致转出失败</div>
<div class="transfer-item">4.第三方转账只支持钱包之间转账且会转到对方主钱包(佣金钱包不允许转入)需要管理员审核通过后才能转账成功</div>
<div class="transfer-item">
1.佣金钱包转出时,需要管理员审核通过后才能转账成功其余内部转账操作无需通过管理员审核如发现对应账号没有收到转账资金请于客服人员联系
</div>
<div class="transfer-item">
2.如转出账号与转入账号的货币单位不同系统将按照当日汇率进行换算
</div>
<div class="transfer-item">
3.若有在途订单时进行了MT账号的转出操作因浮动盈亏影响可能会导致转出失败
</div>
<div class="transfer-item">
4.第三方转账只支持钱包之间转账且会转到对方主钱包(佣金钱包不允许转入)需要管理员审核通过后才能转账成功
</div>
</el-card>
<div class="transfer-type">
<div class="type-title">转账类型</div>
<div class="tab">
<el-button :type="transferType === 'internal' ? 'primary' : 'default'"
@click="handleTransferTabClick('internal')">内部转账</el-button>
<el-button :type="transferType === 'external' ? 'primary' : 'default'"
@click="handleTransferTabClick('external')">第三方转账</el-button>
<el-button
:type="transferType === 'internal' ? 'primary' : 'default'"
@click="handleTransferTabClick('internal')"
>内部转账</el-button
>
<el-button
:type="transferType === 'external' ? 'primary' : 'default'"
@click="handleTransferTabClick('external')"
>第三方转账</el-button
>
</div>
</div>
<div class="transfer-form">
@ -21,22 +35,36 @@
<div class="externa-title">转出账号: 主钱包</div>
<el-card class="external-card">
<el-icon>
<svg t="1774503695687" class="icon" viewBox="0 0 1024 1024" version="1.1"
xmlns="http://www.w3.org/2000/svg" p-id="2732" width="200" height="200">
<svg
t="1774503695687"
class="icon"
viewBox="0 0 1024 1024"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
p-id="2732"
width="200"
height="200"
>
<path
d="M512.54 156.23a353.21 353.21 0 1 1-138 27.83 352.25 352.25 0 0 1 138-27.83m0-60C283.61 96.23 98 281.81 98 510.74s185.61 414.51 414.54 414.51 414.51-185.58 414.51-414.51S741.47 96.23 512.54 96.23z"
p-id="2733"></path>
p-id="2733"
></path>
<path
d="M512 478a29.89 29.89 0 0 1-21.13-8.71l-133-132a30 30 0 1 1 42.26-42.58l133 132A30 30 0 0 1 512 478z"
p-id="2734"></path>
p-id="2734"
></path>
<path
d="M512 478a30 30 0 0 1-21.21-51.21l128-128a30 30 0 0 1 42.42 42.42l-128 128A29.88 29.88 0 0 1 512 478z"
p-id="2735"></path>
p-id="2735"
></path>
<path
d="M660 529H366a30 30 0 0 1 0-60h294a30 30 0 0 1 0 60z m0 95H366a30 30 0 0 1 0-60h294a30 30 0 0 1 0 60z"
p-id="2736"></path>
<path d="M512 776a30 30 0 0 1-30-30V448a30 30 0 0 1 60 0v298a30 30 0 0 1-30 30z"
p-id="2737"></path>
p-id="2736"
></path>
<path
d="M512 776a30 30 0 0 1-30-30V448a30 30 0 0 1 60 0v298a30 30 0 0 1-30 30z"
p-id="2737"
></path>
</svg>
</el-icon>
<div class="money">
@ -45,32 +73,52 @@
</div>
</el-card>
</div>
<TransferForm :key="transferType" class="transfer-main-form" :form-data="transferForm" :form-rules="transferFormRules"
:form-items="transferFormItemOptions" :options-map="transferFormOptionsMap" ref="mainTransferFormRef">
<TransferForm
:key="transferType"
class="transfer-main-form"
:form-data="transferForm"
:form-rules="transferFormRules"
:form-items="transferFormItemOptions"
:options-map="transferFormOptionsMap"
ref="mainTransferFormRef"
>
</TransferForm>
<div class="transfer-type verify" v-if="transferType === 'external'">
<div class="type-title">验证方式</div>
<div class="tab">
<el-button :type="verifyType === 'email' ? 'primary' : 'default'"
@click="handleVerifyTabClick('email')">邮箱验证</el-button>
<el-button :type="verifyType === 'phone' ? 'primary' : 'default'"
@click="handleVerifyTabClick('phone')">手机号验证</el-button>
<el-button
:type="verifyType === 'email' ? 'primary' : 'default'"
@click="handleVerifyTabClick('email')"
>邮箱验证</el-button
>
<el-button
:type="verifyType === 'phone' ? 'primary' : 'default'"
@click="handleVerifyTabClick('phone')"
>手机号验证</el-button
>
</div>
<div class="username">{{ verifyType === "email" ? userInfo.email : userInfo.phone }}</div>
<el-form class="verify-form" :model="transferForm" :rules="transferFormRules" ref="verifyFormRef">
<div class="username">{{ verifyType === 'email' ? userInfo.email : userInfo.phone }}</div>
<el-form
class="verify-form"
:model="transferForm"
:rules="transferFormRules"
ref="verifyFormRef"
>
<el-form-item prop="code">
<el-input v-model="transferForm.code" style="max-width: 300px" placeholder="请输入验证码">
<el-input
v-model="transferForm.code"
style="max-width: 300px"
placeholder="请输入验证码"
>
</el-input>
<el-button type="primary" @click="handleSendCode" :disabled="sendState.isCounting">{{
sendState.isCounting ? `${sendState.countdown}s后重新获取` : '发送验证码' }}</el-button>
sendState.isCounting ? `${sendState.countdown}s后重新获取` : '发送验证码'
}}</el-button>
</el-form-item>
</el-form>
</div>
<el-button type="primary" @click="handleSubmit">提交转账</el-button>
<el-button type="primary" @click="handleSubmit" v-auth="'user_transfer'">提交转账</el-button>
</div>
</div>
</template>
<script setup lang="ts">
@ -87,7 +135,6 @@ import { getTransferWalletOptionsApi, transferApi } from '@/api/modules/funding/
//
import { getStorage } from '@/utils/storage'
import { useUserStore } from '@/stores/modules/user'
const userStore = useUserStore()
import { sendCaptcha, initCaptchaState, clearCaptchaTimer } from '@/utils/sendCaptcha'
@ -108,7 +155,7 @@ const createDefaultTransferForm = () => ({
//
MaxOutAmount: '',
type: '',
code: ''
code: '',
})
/**
@ -120,7 +167,25 @@ const transferForm = ref(createDefaultTransferForm())
*/
const mainTransferFormRef = ref()
const verifyFormRef = ref()
const transferFormItemOptions = computed(() => transferType.value === 'internal' ? internalFormItem : externalFormItem)
const transferFormItemOptions = computed(() =>
transferType.value === 'internal' ? internalFormItem : externalFormItem,
)
watch(
() => transferForm.value.transferOutAccount,
(val) => {
console.log(
'transferForm.value.transferOutAccount',
val,
transferFormOptionsMap.value.transferOutAccount,
)
transferForm.value.transferInAccount = null
transferFormOptionsMap.value.transferInAccount =
transferFormOptionsMap.value.transferOutAccount.filter((item: any) => item.value !== val)
},
{ inmediate: true, deep: true },
)
const transferFormRules = ref(rules(transferForm.value))
const transferFormOptionsMap = ref({
transferOutAccount: [],
@ -141,8 +206,8 @@ const sendState = ref<any>({
})
//
const emailCaptchaState = initCaptchaState('email'); //
const phoneCaptchaState = initCaptchaState('phone'); //
const emailCaptchaState = initCaptchaState('email') //
const phoneCaptchaState = initCaptchaState('phone') //
//
const { isCounting: emailIsCounting, countdown: emailCountdown } = emailCaptchaState
@ -150,18 +215,17 @@ const { isCounting: emailIsCounting, countdown: emailCountdown } = emailCaptchaS
//
const { isCounting: phoneIsCounting, countdown: phoneCountdown } = phoneCaptchaState
// sendState
const updateSendState = (type: string) => {
if (type === 'email') {
sendState.value = {
isCounting: emailIsCounting,
countdown: emailCountdown
countdown: emailCountdown,
}
} else {
sendState.value = {
isCounting: phoneIsCounting,
countdown: phoneCountdown
countdown: phoneCountdown,
}
}
}
@ -178,8 +242,8 @@ onMounted(() => {
watch(
verifyType,
(newTab, oldTab) => {
verifyType.value = newTab;
console.log('verifyType.value', verifyType.value);
verifyType.value = newTab
console.log('verifyType.value', verifyType.value)
// taboldTaboldTabundefined
if (oldTab === undefined) return
@ -192,7 +256,7 @@ watch(
updateSendState(currentType)
}
},
{ immediate: false } //
{ immediate: false }, //
)
//
@ -202,73 +266,62 @@ const sendCodeApi = async () => {
email: userInfo.email,
mobile: userInfo.mobile,
reg_type: verifyType.value === 'email' ? 1 : 2,
type: 'resetPass_code'
type: 'resetPass_code',
}
return userStore.sendCode(sendParams)
}
//
const handleSendCode = async () => {
const currentType = verifyType.value;
const currentType = verifyType.value
// /
const type: string = currentType || 'email';
const type: string = currentType || 'email'
if (type === 'phone') {
// 1
if (!userInfo.phone) {
ElMessage.error('请先绑定手机号');
return;
ElMessage.error('请先绑定手机号')
return
}
//
await sendCaptcha(
type,
userInfo.phone,
phoneCaptchaState,
() => sendCodeApi()
);
updateSendState(type);
await sendCaptcha(type, userInfo.phone, phoneCaptchaState, () => sendCodeApi())
updateSendState(type)
} else {
// 2
if (!userInfo.email) {
ElMessage.error('请先绑定邮箱');
return;
ElMessage.error('请先绑定邮箱')
return
}
//
await sendCaptcha(
type,
userInfo.email,
emailCaptchaState,
() => sendCodeApi()
);
updateSendState(type);
await sendCaptcha(type, userInfo.email, emailCaptchaState, () => sendCodeApi())
updateSendState(type)
}
}
};
//
onUnmounted(() => {
clearCaptchaTimer(emailCaptchaState);
clearCaptchaTimer(phoneCaptchaState);
});
clearCaptchaTimer(emailCaptchaState)
clearCaptchaTimer(phoneCaptchaState)
})
/**
* @description 监听transferOutAccount变化,获取对应的MaxAmount
*/
watch(
[
() => transferForm.value.transferOutAccount,
() => transferFormOptionsMap.value.transferOutAccount
() => transferFormOptionsMap.value.transferOutAccount,
],
([newVal]) => {
if (!newVal || !transferFormOptionsMap.value.transferOutAccount.length) return
const item = transferFormOptionsMap.value.transferOutAccount.find(
(item: any) => item.value === newVal
(item: any) => item.value === newVal,
)
transferForm.value.MaxOutAmount = item?.amount || 0
},
{ immediate: true }
{ immediate: true },
)
/**
* @description 统一获取数据
@ -276,7 +329,7 @@ watch(
const getTransferWalletOptions = async () => {
const data: any = await getTransferWalletOptionsApi()
transferFormOptionsMap.value.transferOutAccount = data
transferFormOptionsMap.value.transferInAccount = data
transferFormOptionsMap.value.transferInAccount = data.filter((item: any) => item.value !== -1)
}
/**
* @description 页面加载完成需要渲染的数据
@ -287,7 +340,10 @@ onMounted(() => {
//
const getDefaultMaxOutAmount = () => {
return transferFormOptionsMap.value.transferOutAccount.find((item: any) => item.value === -1)?.amount || ''
return (
transferFormOptionsMap.value.transferOutAccount.find((item: any) => item.value === -1)
?.amount || ''
)
}
// /
@ -327,7 +383,7 @@ const handleVerifyParams = (type: string) => {
return userInfo.phone
}
} else {
return '1'
return transferForm.value.transferInAccount
}
}
@ -343,8 +399,8 @@ const handleSubmit = async () => {
const params = {
type: transferType.value === 'internal' ? '1' : '2',
from: String(transferForm.value.transferOutAccount),
to: handleVerifyParams(transferType.value),
from: String(transferForm.value.transferOutAccount) + '',
to: handleVerifyParams(transferType.value) + '',
amount: transferForm.value.transferAmount,
verify_type: '',
verify_code: '',
@ -355,7 +411,11 @@ const handleSubmit = async () => {
if (transferType.value === 'internal') {
await transferApi(params)
} else {
await transferApi({ ...params, verify_type: verifyType.value === 'email' ? '1' : '2', verify_code: transferForm.value.code })
await transferApi({
...params,
verify_type: verifyType.value === 'email' ? '1' : '2',
verify_code: transferForm.value.code,
})
}
await resetTransferForm()
@ -438,12 +498,10 @@ const handleSubmit = async () => {
}
.verify {
.tab,
.username {
margin-bottom: 10px;
}
}
.verify-form {

View File

@ -97,7 +97,13 @@
<el-card class="account">
<h3 class="account-title">
个人账户
<el-button type="primary" size="small" @click="handleAddSubAccount">添加子账户</el-button>
<el-button
type="primary"
size="small"
@click="handleAddSubAccount"
v-auth="'user_createAccount'"
>添加子账户</el-button
>
</h3>
<div class="account-list">
<div class="list" v-for="item in accountList" :key="item.id">

View File

@ -2,11 +2,21 @@
<div class="mould-fee">
<header>
<div class="header-actions">
<el-button type="primary" @click="addFee">添加模板</el-button>
<el-button type="primary" @click="editFee">编辑模板</el-button>
<el-button type="primary" @click="changeStatus(1)">启用模板</el-button>
<el-button type="danger" @click="changeStatus(2)">禁用模板</el-button>
<el-button type="primary" @click="editFeeDetail">编辑模板详情</el-button>
<el-button type="primary" @click="addFee" v-auth="'feeHandl_createFeeSetting'"
>添加模板</el-button
>
<el-button type="primary" @click="editFee" v-auth="'feeHandl_editFeeSetting'"
>编辑模板</el-button
>
<el-button type="primary" @click="changeStatus(1)" v-auth="'feeHandl_editFeeSetting'"
>启用模板</el-button
>
<el-button type="danger" @click="changeStatus(2)" v-auth="'feeHandl_editFeeSetting'"
>禁用模板</el-button
>
<el-button type="primary" @click="editFeeDetail" v-auth="'feeHandl_setFeeSettingDetail'"
>编辑模板详情</el-button
>
</div>
</header>
<div class="table-container">
@ -90,7 +100,6 @@ import {
import Form from '@/components/common/Form.vue'
import { formDataList, formRulesList } from './option.ts'
const dialogVisible = ref(false)
const dialogTitleType = ref(1)
const formData = ref({

View File

@ -2,9 +2,27 @@
<div class="risk">
<div class="bar">
<span>风控管理</span>
<el-button type="primary" @click="handleAddRisk">添加</el-button>
<el-button type="primary" @click="handleModifyRisk">修改</el-button>
<el-button type="danger" @click="handleRiskStatus">停用</el-button>
<el-button type="primary" @click="handleAddRisk" v-auth="'riskControl_createRiskControl'"
>添加</el-button
>
<el-button
type="primary"
@click="handleModifyRisk"
v-auth="'riskControl_editRiskControlSetting'"
>修改</el-button
>
<el-button
type="danger"
@click="handleChangeStatus(2)"
v-auth="'riskControl_editRiskControlSetting'"
>停用</el-button
>
<el-button
type="primary"
@click="handleChangeStatus(1)"
v-auth="'riskControl_editRiskControlSetting'"
>启用</el-button
>
</div>
<!-- 表格 -->
<div class="risk-table-content">
@ -243,10 +261,10 @@ const handleModifyRisk = () => {
} as any
}
const handleRiskStatus = async () => {
const handleChangeStatus = async (status) => {
dialogTitle.value = '停用'
dialogType.value = 'status'
await editRiskApi({ ...selectedRow.value, status: 2 })
await editRiskApi({ ...selectedRow.value, status: status })
getRiskList()
}

View File

@ -42,13 +42,18 @@ import { getTransferDetailListApi } from '@/api/modules/funding/transferDetail'
//
import { exportToExcel } from '@/utils/exportToExcel'
import { getRecentSevenDays } from '@/utils/handleTime.ts'
const initTime = getRecentSevenDays()
/**
* @description: 定义搜索数据
*/
const searchForm = ref({
transferAccount: '',
type: '',
transferTime: '',
transferTime: [initTime.start, initTime.end],
})
const searchOptions = ref(search)
/**
@ -66,6 +71,7 @@ const total = ref(0)
/**
* @description: 定义公共请求数据方法
*/
const getTransferDetailList = async () => {
const params = {
page: currentPage.value,

View File

@ -20,6 +20,7 @@
v-if="row.role_id === 5"
type="primary"
size="small"
v-auth="'agent_getSelfVarietyPointDiffConfig'"
@click="handleMarginRatio(row)"
>
修改
@ -32,6 +33,7 @@
type="primary"
size="small"
@click="handleCommissionRatio(row)"
v-auth="'agent_editAgent'"
>
修改
</el-button>

View File

@ -8,8 +8,15 @@
@reset="handleReset"
>
<template #button="{ form }">
<el-button type="primary" @click="handleAddMarket()"> 添加 </el-button>
<el-button type="primary" :disabled="!selectedRow" @click="handleEditMarket()">
<el-button type="primary" @click="handleAddMarket()" v-auth="'agent_createAgen'">
添加
</el-button>
<el-button
type="primary"
:disabled="!selectedRow"
v-auth="'agent_editAgent'"
@click="handleEditMarket()"
>
编辑
</el-button>
</template>

View File

@ -1,10 +1,14 @@
<template>
<div class="client">
<!-- 搜索组件 -->
<ClientSearch :search-form="clientSearchForm" :search-options="clientSearchOptions" @search="handleSearch"
@reset="handleReset">
<ClientSearch
:search-form="clientSearchForm"
:search-options="clientSearchOptions"
@search="handleSearch"
@reset="handleReset"
>
<template #button="{ form }">
<el-button type="primary" @click="handleAdd()">
<el-button type="primary" @click="handleAdd()" v-auth="'user_createUser'">
添加客户
</el-button>
</template>
@ -16,29 +20,50 @@
{{ row.status === 1 ? '正常' : '禁用' }}
</template>
<template #action="{ row }">
<el-button type="primary" size="small" @click="handleChange(row)">
<el-button type="primary" size="small" @click="handleChange(row)" v-anth="'user_editUser'">
修改
</el-button>
</template>
</ClientTable>
<!-- 分页组件 -->
<ClientPagination v-model="currentPage" v-model:pageSizeValue="pageSize" :total="total"
@pagination-change="handlePaginationChange" />
<ClientPagination
v-model="currentPage"
v-model:pageSizeValue="pageSize"
:total="total"
@pagination-change="handlePaginationChange"
/>
</div>
<!-- 客户弹窗 -->
<ClientDialog :visible="dialogVisible" :title="dialogTitle" :type="dialogType" @confirm="handleSubmit"
@cancel="handleCancel" @close="handleClose">
<ClientForm :form-data="clientForm" :form-rules="clientFormRules" :form-items="clientFormOptions"
:options-map="clientFormOptionsMap" ref="clientFormRef">
<template #phoneOrEmail="{ formData }" style="margin-left: 0;">
<ClientDialog
:visible="dialogVisible"
:title="dialogTitle"
:type="dialogType"
@confirm="handleSubmit"
@cancel="handleCancel"
@close="handleClose"
>
<ClientForm
:form-data="clientForm"
:form-rules="clientFormRules"
:form-items="clientFormOptions"
:options-map="clientFormOptionsMap"
ref="clientFormRef"
>
<template #phoneOrEmail="{ formData }" style="margin-left: 0">
<div class="phone-email">
<div class="tab-btn">
<el-button :type="activeTab === 'email' ? 'primary' : 'default'" size="small"
@click="activeTab = 'email'">
<el-button
:type="activeTab === 'email' ? 'primary' : 'default'"
size="small"
@click="activeTab = 'email'"
>
邮箱
</el-button>
<el-button :type="activeTab === 'phone' ? 'primary' : 'default'" size="small"
@click="activeTab = 'phone'">
<el-button
:type="activeTab === 'phone' ? 'primary' : 'default'"
size="small"
@click="activeTab = 'phone'"
>
手机号
</el-button>
</div>
@ -48,8 +73,12 @@
</el-form-item>
<el-form-item prop="phone" class="phone-item" v-if="activeTab === 'phone'">
<el-select v-model="clientForm.countryCode" placeholder="请选择国家区号">
<el-option v-for="item in countryOptions" :key="item.code" :label="item.code"
:value="item.code">
<el-option
v-for="item in countryOptions"
:key="item.code"
:label="item.code"
:value="item.code"
>
<div class="country-option">
<span class="country-name">{{ item.name }}</span>
<span class="country-code">{{ item.code }}</span>
@ -73,10 +102,23 @@ import ClientPagination from '@/components/common/Pagination.vue'
import ClientDialog from '@/components/common/Dialog.vue'
import ClientForm from '@/components/common/Form.vue'
//
import { getClientListApi, getFeeTemplateOptionsApi, getRiskTemplateOptionsApi, getAgentOptionsApi, createClientApi, editClientApi } from '@/api/modules/account/client'
import {
getClientListApi,
getFeeTemplateOptionsApi,
getRiskTemplateOptionsApi,
getAgentOptionsApi,
createClientApi,
editClientApi,
} from '@/api/modules/account/client'
//
import { clientSearch, clientAddFormItem, clientChangeFormItem, countryOptions, clientTableColumns } from './options'
import {
clientSearch,
clientAddFormItem,
clientChangeFormItem,
countryOptions,
clientTableColumns,
} from './options'
import { rules } from './rules'
/**
@ -135,7 +177,7 @@ const clientFormRules = ref(rules())
const optionsFetched = ref(false)
const useId = ref('')
const clientFormOptions = computed(() => {
return dialogType.value === 'add' ? clientAddFormItem : clientChangeFormItem;
return dialogType.value === 'add' ? clientAddFormItem : clientChangeFormItem
})
const clientFormOptionsMap = ref<any>({
feeTemplate: [],
@ -143,11 +185,11 @@ const clientFormOptionsMap = ref<any>({
agentUsername: [],
isUpgrade: [
{ label: '是', value: 1 },
{ label: '否', value: 2 }
{ label: '否', value: 2 },
],
status: [
{ label: '正常', value: 1 },
{ label: '禁用', value: 2 }
{ label: '禁用', value: 2 },
],
})
//
@ -160,7 +202,7 @@ const activeTab = ref('email')
const mapObjectToOptions = (obj: Record<string, string>) => {
return Object.entries(obj).map(([label, value]) => ({
label, // /
value // /ID
value, // /ID
}))
}
@ -173,18 +215,24 @@ const getClientList = async () => {
page_size: pageSize.value,
username: clientSearchForm.value.username,
status: clientSearchForm.value.status || '',
reg_start_time: clientSearchForm.value.startDateTime.length > 0 ? `${clientSearchForm.value.startDateTime} 0:00:00` : '',
reg_end_time: clientSearchForm.value.endDateTime.length > 0 ? `${clientSearchForm.value.endDateTime} 23:59:59` : '',
reg_start_time:
clientSearchForm.value.startDateTime.length > 0
? `${clientSearchForm.value.startDateTime} 0:00:00`
: '',
reg_end_time:
clientSearchForm.value.endDateTime.length > 0
? `${clientSearchForm.value.endDateTime} 23:59:59`
: '',
}
const data = await getClientListApi(params)
//
clientTree.value = data.data.map(item => ({
clientTree.value = data.data.map((item) => ({
...item,
//
createdTime: item.created_at,
//
agentUsername: item.par_uid === item.parent?.id ? item.parent?.username : '',
}));
}))
//
total.value = Number(data.total)
currentPage.value = Number(data.current_page)
@ -200,13 +248,19 @@ const getOptions = async () => {
const [agentRes, feeTemplateRes, riskTemplateRes] = await Promise.all([
getAgentOptionsApi(),
getFeeTemplateOptionsApi(),
getRiskTemplateOptionsApi()
getRiskTemplateOptionsApi(),
])
// label=value=ID
clientFormOptionsMap.value.agentUsername = mapObjectToOptions(agentRes as Record<string, string>)
clientFormOptionsMap.value.feeTemplate = mapObjectToOptions(feeTemplateRes as Record<string, string>)
clientFormOptionsMap.value.riskTemplate = mapObjectToOptions(riskTemplateRes as Record<string, string>)
clientFormOptionsMap.value.agentUsername = mapObjectToOptions(
agentRes as Record<string, string>,
)
clientFormOptionsMap.value.feeTemplate = mapObjectToOptions(
feeTemplateRes as Record<string, string>,
)
clientFormOptionsMap.value.riskTemplate = mapObjectToOptions(
riskTemplateRes as Record<string, string>,
)
optionsFetched.value = true //
} catch (error) {
@ -296,7 +350,7 @@ const handleChange = (row: any) => {
/**
* @description 分页方法
*/
const handlePaginationChange = (page: { currentPage: number, pageSize: number }) => {
const handlePaginationChange = (page: { currentPage: number; pageSize: number }) => {
currentPage.value = page.currentPage
pageSize.value = page.pageSize
handleSearch()

View File

@ -3,10 +3,15 @@
<!-- 菜单列表头 -->
<div class="header">
<h4>菜单列表</h4>
<el-button type="primary" @click="handleAddMenu">新增菜单</el-button>
<el-button type="primary" @click="handleAddMenu" v-auth="'menus_create'">新增菜单</el-button>
</div>
<!-- 菜单列表表格 -->
<MenuTable :table-data="menuTree" :columns="menuTableColumns" row-key="id" :tree-props="treeProps">
<MenuTable
:table-data="menuTree"
:columns="menuTableColumns"
row-key="id"
:tree-props="treeProps"
>
<template #icon="{ row }">
<el-icon v-if="row.icon && menuiconMap[row.icon]">
<component :is="menuiconMap[row.icon]" />
@ -17,24 +22,46 @@
{{ row.type === 1 ? '目录' : '按钮' }}
</template>
<template #status="{ row }">
<el-switch :model-value="row.status === 1" :active-value="true" :inactive-value="false" active-text="启用"
inactive-text="禁用"/>
{{ row.status === 1 ? '启用' : '禁用' }}
</template>
<template #action="{ row }">
<el-button link type="primary" size="small" @click="handleEditMenu(row)">
<el-button
link
type="primary"
size="small"
@click="handleEditMenu(row)"
v-auth="'menus_edit'"
>
编辑
</el-button>
<el-button link type="danger" size="small" @click="handleDeleteMenu(row)">
<el-button
link
type="danger"
size="small"
@click="handleDeleteMenu(row)"
v-auth="'menus_del'"
>
删除
</el-button>
</template>
</MenuTable>
</div>
<!-- 菜单新增/编辑弹窗 -->
<MenuDialog :visible="dialogVisible" :title="dialogTitle" :type="dialogType" @confirm="handleSubmit"
@cancel="handleCancel" @close="handleClose">
<MenuForm :form-data="menuForm" :form-rules="menuFormRules" :form-items="menuFormItemOptions"
:options-map="menuFormOptionsMap" ref="menuFormRef" />
<MenuDialog
:visible="dialogVisible"
:title="dialogTitle"
:type="dialogType"
@confirm="handleSubmit"
@cancel="handleCancel"
@close="handleClose"
>
<MenuForm
:form-data="menuForm"
:form-rules="menuFormRules"
:form-items="menuFormItemOptions"
:options-map="menuFormOptionsMap"
ref="menuFormRef"
/>
</MenuDialog>
</template>
<script lang="ts" setup>
@ -80,16 +107,16 @@ const menuFormRef = ref<FormInstance>()
const menuFormRules = rules(menuForm.value, menuiconOptions)
// icon
const menuFormOptionsMap = ref({
'parentName': [] as any[],
'icon': menuiconOptions,
'type': [
parentName: [] as any[],
icon: menuiconOptions,
type: [
{ label: '菜单', value: 1 },
{ label: '按钮', value: 2 }
{ label: '按钮', value: 2 },
],
'status': [
status: [
{ label: '启用', value: 1 },
{ label: '禁用', value: 2 }
]
{ label: '禁用', value: 2 },
],
})
/**
@ -111,14 +138,11 @@ const fetchMenuList = async () => {
const data = await getMenuApi()
menuTree.value = data
// parentName
const parentNameOptions = data.map(item => ({
const parentNameOptions = data.map((item) => ({
label: item.name,
value: item.id ?? ''
value: item.id ?? '',
}))
menuFormOptionsMap.value.parentName = [
{ label: '一级菜单', value: "0" },
...parentNameOptions
]
menuFormOptionsMap.value.parentName = [{ label: '一级菜单', value: '0' }, ...parentNameOptions]
} catch (err) {
console.error('获取菜单列表失败', err)
}

View File

@ -1,16 +1,18 @@
<template>
<div>
<!-- 搜索 -->
<NoticeSearch :search-form="searchForm" :search-options="searchOptions" @search="handleSearch"
@reset="handleReset">
<NoticeSearch
:search-form="searchForm"
:search-options="searchOptions"
@search="handleSearch"
@reset="handleReset"
>
<template #button>
<el-button type="primary" @click="handleCreate">新建</el-button>
<el-button type="primary" @click="handleCreate" v-auth="'notice_createNotice'"
>新建</el-button
>
</template>
</NoticeSearch>
<div class="tab">
<el-button :type="activeTab === 2 ? 'primary' : 'default'" @click="handleTabChange(2)">已发布</el-button>
<el-button :type="activeTab === 1 ? 'primary' : 'default'" @click="handleTabChange(1)">草稿</el-button>
</div>
<!-- 表格 -->
<NoticeTable :table-data="noticeTree" :columns="noticeTableColumnsOptions" row-key="id">
<template #status="{ row }">
@ -18,28 +20,68 @@
{{ row.status === 1 ? '草稿' : '已发布' }}
</template>
<template #action="{ row }">
<el-button type="primary" size="small" v-if="row.status === 2" @click="handleView(row)">查看</el-button>
<el-button type="primary" size="small" v-if="row.status === 2" @click="handleView(row)"
>查看</el-button
>
<!-- 草稿才显示编辑/删除已发布仅查看 -->
<template v-if="row.status === 1">
<el-button type="primary" size="small" @click="handleEdit(row)">编辑</el-button>
<el-button type="danger" size="small" @click="handleDelete(row)">删除</el-button>
<el-button
type="primary"
size="small"
@click="handleEdit(row)"
v-auth="'notice_editNotice'"
>编辑</el-button
>
<el-button
type="danger"
size="small"
@click="handleDelete(row)"
v-auth="'notice_delNotice'"
>删除</el-button
>
</template>
</template>
</NoticeTable>
<!-- 分页 -->
<NoticePagination v-model="currentPage" v-model:pageSizeValue="pageSize" :total="total"
@pagination-change="handlePaginationChange" />
<NoticePagination
v-model="currentPage"
v-model:pageSizeValue="pageSize"
:total="total"
@pagination-change="handlePaginationChange"
/>
<!-- dialog -->
<NoticeDialog :visible="dialogVisible" :title="dialogTitle" :type="dialogType"
:show-footer="dialogType !== 'view'" @confirm="handleSubmit" @cancel="handleCancel" @close="handleClose">
<NoticeForm :form-data="noticeForm" :form-rules="noticeRules" :form-items="noticeFormItem"
:options-map="noticeFormOptionsMap" ref="noticeFormRef" v-if="dialogType !== 'view'">
<NoticeDialog
:visible="dialogVisible"
:title="dialogTitle"
:type="dialogType"
:show-footer="dialogType !== 'view'"
@confirm="handleSubmit"
@cancel="handleCancel"
@close="handleClose"
>
<NoticeForm
:form-data="noticeForm"
:form-rules="noticeRules"
:form-items="noticeFormItem"
:options-map="noticeFormOptionsMap"
ref="noticeFormRef"
v-if="dialogType !== 'view'"
>
<template #noticeContent="{ formData }">
<div style="border: 1px solid #e6e6e6; margin: 10px 0;">
<Toolbar :editor="editorRef" :defaultConfig="toolbarConfig" mode="default"
style="border-bottom: 1px solid #ccc;" />
<Editor v-model="valueHtml" :defaultConfig="editorConfig" mode="default"
@onCreated="handleCreated" style="height: 300px; overflow-y: auto;" />
<div style="border: 1px solid #e6e6e6; margin: 10px 0">
<Toolbar
:editor="editorRef"
:defaultConfig="toolbarConfig"
mode="default"
style="border-bottom: 1px solid #ccc"
/>
<Editor
v-model="valueHtml"
:defaultConfig="editorConfig"
mode="default"
@onCreated="handleCreated"
style="height: 300px; overflow-y: auto"
/>
</div>
</template>
</NoticeForm>
@ -64,11 +106,14 @@ import { search, tableColumns, formItem } from './options'
import { rules } from './rules'
//
import { getNoticeListApi, createNoticeApi, editNoticeApi, deleteNoticeApi } from '@/api/modules/notice'
import {
getNoticeListApi,
createNoticeApi,
editNoticeApi,
deleteNoticeApi,
} from '@/api/modules/notice'
import { uploadImageApi } from '@/api/modules/upload'
import { DomEditor } from '@wangeditor/editor'
import { Editor, Toolbar } from '@wangeditor/editor-for-vue'
import '@wangeditor/editor/dist/css/style.css'
@ -81,7 +126,7 @@ const toolbarRef = shallowRef()
const valueHtml = ref('')
//
const toolbarConfig = {
excludeKeys: ["group-video", "fullScreen"]
excludeKeys: ['group-video', 'fullScreen'],
}
//
const editorConfig = {
@ -91,18 +136,18 @@ const editorConfig = {
customUpload: async (file: any, insertFn: any) => {
try {
// API
const res = await uploadImageApi(file);
const res = await uploadImageApi(file)
//
insertFn(res.url);
insertFn(res.url)
} catch (error: any) {
// ElNotification
const errMsg = error?.message || error?.data?.msg || '图片上传失败';
alert(`图片${file.name}上传失败:${errMsg}`);
const errMsg = error?.message || error?.data?.msg || '图片上传失败'
alert(`图片${file.name}上传失败:${errMsg}`)
ElNotification({
message: errMsg || '未知的错误!',
type: 'error',
duration: 2000,
customClass: 'global-notification'
customClass: 'global-notification',
})
}
},
@ -111,8 +156,8 @@ const editorConfig = {
timeout: 30 * 1000,
maxFileSize: 5 * 1024 * 1024,
allowedFileTypes: ['image/jpeg', 'image/png', 'image/gif', 'image/webp'],
}
}
},
},
}
/**
@ -256,7 +301,6 @@ const handleView = (row: any) => {
} as any
}
const handleEdit = (row: any) => {
dialogVisible.value = true
dialogTitle.value = '编辑公告'
@ -280,7 +324,7 @@ const handleDelete = async (row: any) => {
/**
* @description: 定义分页方法
*/
const handlePaginationChange = async (page: { currentPage: number, pageSize: number }) => {
const handlePaginationChange = async (page: { currentPage: number; pageSize: number }) => {
currentPage.value = page.currentPage
pageSize.value = page.pageSize
await getNoticeList()
@ -312,7 +356,6 @@ const handleSubmit = async () => {
dialogVisible.value = false
getNoticeList()
}
}
const handleCancel = () => {

View File

@ -2,17 +2,39 @@
* @description:
*/
export const search = [
{ prop: 'noticeName', label: '公告名称', type: 'input' as const, placeholder: '请输入公告名称', width: '120px' },
{
prop: "startDateTime", label: '发布时间', type: 'date' as const, dateType: 'date' as const, // 时间范围选择器
prop: 'noticeName',
label: '公告名称',
type: 'input' as const,
placeholder: '请输入公告名称',
width: '120px',
},
{
prop: 'startDateTime',
label: '发布时间',
type: 'date' as const,
dateType: 'date' as const, // 时间范围选择器
valueFormat: 'YYYY-MM-DD',
width: '180px',
},
{
prop: "endDateTime", label: '结束时间', type: 'date' as const, dateType: 'date' as const, // 时间范围选择器
prop: 'endDateTime',
label: '结束时间',
type: 'date' as const,
dateType: 'date' as const, // 时间范围选择器
valueFormat: 'YYYY-MM-DD',
width: '180px',
},
{
prop: 'status',
label: '状态',
type: 'select' as const,
placeholder: '请选择状态',
options: [
{ label: '草稿', value: 1 },
{ label: '已发布', value: 2 },
],
},
]
/**

View File

@ -3,7 +3,7 @@
<!-- 角色列表头 -->
<div class="header">
<h4>角色列表</h4>
<el-button type="primary" @click="handleAddRole">新增角色</el-button>
<el-button type="primary" @click="handleAddRole" v-auth="'roles_create'">新增角色</el-button>
</div>
<!-- 角色列表表格 -->
<RoleTable :table-data="roleTree" :columns="roleTableColumns" row-key="id">
@ -20,11 +20,33 @@
{{ row.created_at }}
</template>
<template #action="{ row }">
<el-button link type="primary" size="small" @click="handleEditRole(row)"> 编辑 </el-button>
<el-button link type="primary" size="small" @click="handlePermission(row)">
<el-button
link
type="primary"
size="small"
@click="handleEditRole(row)"
v-auth="'roles_edit'"
>
编辑
</el-button>
<el-button
link
type="primary"
size="small"
@click="handlePermission(row)"
v-auth="'roles_setPermission'"
>
设置权限
</el-button>
<el-button link type="danger" size="small" @click="handleDeleteRole(row)"> 删除 </el-button>
<el-button
link
type="danger"
size="small"
@click="handleDeleteRole(row)"
v-auth="'roles_del'"
>
删除
</el-button>
</template>
</RoleTable>
</div>

View File

@ -1,7 +1,9 @@
<template>
<div class="trade-group">
<el-form-item label="交易组时间设置">
<el-button type="primary" @click="addTableItem">添加</el-button>
<el-button type="primary" @click="addTableItem" v-auth="'contractVariety_createGroup'"
>添加</el-button
>
</el-form-item>
<!-- 表格 -->
<div class="table-box">
@ -60,16 +62,32 @@
</template>
</td>
<td rowspan="2" style="width: 140px">
<el-button type="primary" v-if="!item.editStatus" @click="item.editStatus = true"
<el-button
type="primary"
v-if="!item.editStatus"
@click="item.editStatus = true"
v-auth="'contractVariety_editGroup'"
>编辑</el-button
>
<el-button type="danger" v-if="!item.editStatus" @click="deleteGroup(item.id, index)"
<el-button
type="danger"
v-if="!item.editStatus"
@click="deleteGroup(item.id, index)"
v-auth="'contractVariety_delGroup'"
>删除</el-button
>
<el-button type="primary" v-if="item.editStatus" @click="submitItem(index)"
<el-button
type="primary"
v-if="item.editStatus"
@click="submitItem(index)"
v-auth="'contractVariety_editGroup'"
>确认</el-button
>
<el-button type="danger" v-if="item.editStatus" @click="item.editStatus = false"
<el-button
type="danger"
v-if="item.editStatus"
@click="item.editStatus = false"
v-auth="'contractVariety_editGroup'"
>取消</el-button
>
</td>

View File

@ -8,8 +8,17 @@
@reset="handleReset"
>
<template #button="{ form }">
<el-button type="primary" :disabled="!selectedRow" @click="handleEdit()"> 编辑 </el-button>
<el-button type="primary" @click="handleAdd()"> 添加 </el-button>
<el-button
type="primary"
:disabled="!selectedRow"
@click="handleEdit()"
v-auth="'contracVarietediariety'"
>
编辑
</el-button>
<el-button type="primary" @click="handleAdd()" v-auth="'contractVariety_createVariety'">
添加
</el-button>
</template>
</VarietySearch>