BUG修复及代理列表

This commit is contained in:
Songsl 2026-04-27 17:57:38 +08:00
parent 12dd2268ac
commit bfe93f348d
10 changed files with 903 additions and 777 deletions

View File

@ -1,23 +0,0 @@
import { request } from '@/api';
import type { searchParams, pointDiffConfigParams } from '@/api/types/account/agent'
// 获取代理列表
export async function getAgentListApi(params: searchParams): Promise<any> {
return request.get<any>('/agent/getAgentList2', { ...params })
}
//获取代理点差配置
export async function getPointDiffConfigApi(params: pointDiffConfigParams): Promise<any> {
return request.get<any>('/agent/getSelfVarietyPointDiffConfig',{...params})
}
//获取风控模板选项
export async function getRiskTemplateOptionsApi(): Promise<any> {
return request.get<any>('/agent/getRiskControlOptions')
}
//获取手续费模板选项
export async function getFeeTemplateOptionsApi(): Promise<any> {
return request.get<any>('user/getFeeSettingOptions')
}
//编辑代理点差
export async function editPointDiffApi(params: pointDiffConfigParams): Promise<any> {
return request.post<any>('/agent/editAgent',{...params})
}

View File

@ -0,0 +1,7 @@
import { request } from '@/api';
import type { searchParams, pointDiffConfigParams } from '@/api/types/account/agent'
// 获取代理列表
export async function getAgentListApi(params: searchParams): Promise<any> {
return request.get<any>('/agent/getAgentList2', { ...params })
}

View File

@ -1,21 +1,32 @@
<template> <template>
<div> <div>
<!-- 搜索 --> <!-- 搜索 -->
<TransferSearch :search-form="searchForm" :search-options="searchOptions" @search="handleSearch" <TransferSearch
@reset="handleReset"> :search-form="searchForm"
<template #button="{ form }"> :search-options="searchOptions"
<el-button type="primary" @click="handleExport()"> @search="handleSearch"
导出 @reset="handleReset"
</el-button> >
</template> <template #button="{ form }">
</TransferSearch> <el-button type="primary" @click="handleExport()"> 导出 </el-button>
<!-- 表格 --> </template>
<TransferTable :table-data="tableTree" :columns="tableColumnsOptions" row-key="id" ref="tableRef"> </TransferSearch>
</TransferTable> <!-- 表格 -->
<!-- 分页 --> <TransferTable
<TransferPagination v-model="currentPage" v-model:pageSizeValue="pageSize" :total="total" :table-data="tableTree"
@pagination-change="handlePaginationChange" /> :columns="tableColumnsOptions"
</div> row-key="id"
ref="tableRef"
>
</TransferTable>
<!-- 分页 -->
<TransferPagination
v-model="currentPage"
v-model:pageSizeValue="pageSize"
:total="total"
@pagination-change="handlePaginationChange"
/>
</div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -30,14 +41,14 @@ import { search, tableColumns } from './options'
import { getTransferDetailListApi } from '@/api/modules/funding/transferDetail' import { getTransferDetailListApi } from '@/api/modules/funding/transferDetail'
// //
import {exportToExcel} from '@/utils/exportToExcel' import { exportToExcel } from '@/utils/exportToExcel'
/** /**
* @description: 定义搜索数据 * @description: 定义搜索数据
*/ */
const searchForm = ref({ const searchForm = ref({
transferAccount: '', transferAccount: '',
level: '', type: '',
transferTime: '', transferTime: '',
}) })
const searchOptions = ref(search) const searchOptions = ref(search)
/** /**
@ -56,89 +67,88 @@ const total = ref(0)
* @description: 定义公共请求数据方法 * @description: 定义公共请求数据方法
*/ */
const getTransferDetailList = async () => { const getTransferDetailList = async () => {
const params = { const params = {
page: currentPage.value, page: currentPage.value,
page_size: pageSize.value, page_size: pageSize.value,
type: '', type: searchForm.value.type || '',
start_time: searchForm.value.transferTime?.[0] || '2026-02-20 0:00:00', start_time: searchForm.value.transferTime?.[0] || '2026-02-20 0:00:00',
end_time: searchForm.value.transferTime?.[1] || '2026-03-20 23:59:59', end_time: searchForm.value.transferTime?.[1] || '2026-03-20 23:59:59',
user_name: searchForm.value.transferAccount || '', user_name: searchForm.value.transferAccount || '',
order_id: '', order_id: '',
} }
const data: any = await getTransferDetailListApi(params) const data: any = await getTransferDetailListApi(params)
// //
tableTree.value = data.data.map((item: any) => ({ tableTree.value = data.data.map((item: any) => ({
// //
index: item.id, index: item.id,
//ID //ID
orderId: item.order_id, orderId: item.order_id,
// //
transferAccount: item.user.username, transferAccount: item.user.username,
// //
agentName: '', agentName: '',
// //
transferAccountName: item.to, transferAccountName: item.to,
// //
transferType: item.type === 1 ? '内部' : '三方', transferType: item.type === 1 ? '内部' : '三方',
// //
transferAmount: item.amount, transferAmount: item.amount,
// //
arrivalAmount: item.amount, arrivalAmount: item.amount,
}))
})) //
// total.value = data.total
total.value = data.total currentPage.value = data.current_page
currentPage.value = data.current_page pageSize.value = Number(data.per_page)
pageSize.value = Number(data.per_page)
} }
/** /**
* @description: 页面加载完成需要请求的数据 * @description: 页面加载完成需要请求的数据
*/ */
onMounted(() => { onMounted(() => {
getTransferDetailList() getTransferDetailList()
}) })
/** /**
* @description: 定义搜索方法 * @description: 定义搜索方法
*/ */
const handleSearch = async () => { const handleSearch = async () => {
getTransferDetailList() getTransferDetailList()
} }
const handleReset = async () => { const handleReset = async () => {
searchForm.value.transferAccount = '' searchForm.value.transferAccount = ''
searchForm.value.level = '' searchForm.value.level = ''
searchForm.value.transferTime = '' searchForm.value.transferTime = ''
getTransferDetailList() getTransferDetailList()
} }
/** /**
* @description: 导出表格带表头+自定义文件名 * @description: 导出表格带表头+自定义文件名
*/ */
const handleExport = async () => { const handleExport = async () => {
await exportToExcel({ await exportToExcel({
tableData: tableTree.value, tableData: tableTree.value,
columns: tableColumnsOptions.value, columns: tableColumnsOptions.value,
title: '导出转账详情', title: '导出转账详情',
defaultFileNamePrefix: '转账详情', defaultFileNamePrefix: '转账详情',
}) })
} }
/** /**
* @description: 定义分页方法 * @description: 定义分页方法
*/ */
const handlePaginationChange = async () => { const handlePaginationChange = async () => {
getTransferDetailList() getTransferDetailList()
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.search-container { .search-container {
:deep(.el-form) { :deep(.el-form) {
.el-form-item { .el-form-item {
flex: none; flex: none;
.el-select { .el-select {
width: 160px; width: 160px;
} }
}
} }
}
} }
</style> </style>

View File

@ -2,36 +2,36 @@
* @description: * @description:
*/ */
export const search = [ export const search = [
//存款账户 //存款账户
{ {
label: '转账账户', label: '转账账户',
prop: 'transferAccount', prop: 'transferAccount',
type: 'input' as const, type: 'input' as const,
placeholder: '请输入转账账户' placeholder: '请输入转账账户',
}, },
//级别 //级别
{ {
label: '转账类型', label: '转账类型',
prop: 'level', prop: 'type',
type: 'select' as const, type: 'select' as const,
placeholder: '请选择转账类型', placeholder: '请选择转账类型',
options: [ options: [
{ label: '客户', value: '1' }, { label: '客户', value: '1' },
{ label: '三方', value: '2' }, { label: '三方', value: '2' },
] ],
}, },
//选择时间 //选择时间
{ {
label: '时间', label: '时间',
prop: 'transferTime', prop: 'transferTime',
type: 'date' as const, type: 'date' as const,
dateType: 'datetimerange' as const, dateType: 'datetimerange' as const,
placeholder: '请选择转账时间', placeholder: '请选择转账时间',
format: 'YYYY-MM-DD HH:mm:ss', format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'YYYY-MM-DD HH:mm:ss',
startPlaceholder: '开始时间', startPlaceholder: '开始时间',
endPlaceholder: '结束时间', endPlaceholder: '结束时间',
}, },
] ]
// 表格配置 // 表格配置

View File

@ -1,52 +1,98 @@
<template> <template>
<div> <div>
<!-- 搜索 --> <!-- 搜索 -->
<CustomerListSearch :search-form="searchForm" :search-options="searchOptions" @search="handleSearch" <CustomerListSearch
@reset="handleReset"></CustomerListSearch> :search-form="searchForm"
<!-- 表格 --> :search-options="searchOptions"
<CustomerListTable :table-data="tableTree" :columns="tableColumnsOptions" row-key="userId" @search="handleSearch"
:tree-props="treeProps" :default-sort="{ prop: 'createTime', order: 'descending' }" @reset="handleReset"
@expand-change="handleGetSubList"> ></CustomerListSearch>
<template #marginRatio="{ row }"> <!-- 表格 -->
<el-button v-if="row.role_id === 5" type="primary" size="small" @click="handleMarginRatio(row)"> <CustomerListTable
修改 :table-data="tableTree"
</el-button> :columns="tableColumnsOptions"
</template> row-key="userId"
<template #commissionRatio="{ row }"> :default-sort="{ prop: 'createTime', order: 'descending' }"
{{ row.commissionRatio }} @expand-change="handleGetSubList"
<el-button v-if="row.role_id === 5" type="primary" size="small" @click="handleCommissionRatio(row)"> >
修改 <template #marginRatio="{ row }">
</el-button> <el-button
</template> v-if="row.role_id === 5"
<template #action="{ row }"> type="primary"
<el-button link type="primary" size="small" @click="handleDetail(row)" v-if="row.userId"> size="small"
查看详情 @click="handleMarginRatio(row)"
</el-button> >
</template> 修改
</CustomerListTable> </el-button>
<!-- 分页 --> </template>
<CustomerListPagination v-model="currentPage" v-model:pageSizeValue="pageSize" :total="total" <template #commissionRatio="{ row }">
@pagination-change="handlePaginationChange" /> {{ row.commissionRatio }}
<!-- dialog --> <el-button
<CustomerListDialog :visible="dialogVisible" :title="dialogTitle" :type="dialogType" v-if="row.role_id === 5"
:fullscreen="dialogFullscreen" :show-footer="dialogType !== 'view'" @confirm="handleSubmit" type="primary"
@cancel="handleCancel" @close="handleClose"> size="small"
<CustomerListTable :table-data="marginRatioTree" :columns="marginRatioTableColumnsOptions" row-key="id" @click="handleCommissionRatio(row)"
v-if="dialogType === 'editMarginRatio'"> >
<template #assignedPointDiff="{ row }"> 修改
<el-form :model="row" :rules="marginRatioRules(row)" :ref="el => setFormRef(el, row.id)"> </el-button>
<el-form-item prop="assignedPointDifference"> </template>
<el-input v-model="row.assignedPointDifference" size="small" placeholder="请输入点差" /> <template #action="{ row }">
</el-form-item> <el-button link type="primary" size="small" @click="handleDetail(row)" v-if="row.userId">
</el-form> 查看详情
</template> </el-button>
</CustomerListTable> </template>
<CustomerListForm :form-data="commissionRatioForm" :form-rules="commissionRatioFormRules" </CustomerListTable>
:form-items="commissionRatioFormItemOptions" ref="commissionRatioFormRef" <!-- 分页 -->
v-if="dialogType === 'editCommissionRatio'"></CustomerListForm> <CustomerListPagination
</CustomerListDialog> v-model="currentPage"
<!-- dialog表格 --> v-model:pageSizeValue="pageSize"
</div> :total="total"
@pagination-change="handlePaginationChange"
/>
<!-- dialog -->
<CustomerListDialog
:visible="dialogVisible"
:title="dialogTitle"
:type="dialogType"
:fullscreen="dialogFullscreen"
:show-footer="dialogType !== 'view'"
@confirm="handleSubmit"
@cancel="handleCancel"
@close="handleClose"
>
<CustomerListTable
:table-data="marginRatioTree"
:columns="marginRatioTableColumnsOptions"
row-key="id"
v-if="dialogType === 'editMarginRatio'"
style="height: 500px"
>
<template #assignedPointDiff="{ row }">
<el-form
:model="row"
:rules="marginRatioRules(row)"
:ref="(el) => setFormRef(el, row.id)"
>
<el-form-item prop="assignedPointDifference">
<el-input
v-model="row.assignedPointDifference"
size="small"
placeholder="请输入点差"
/>
</el-form-item>
</el-form>
</template>
</CustomerListTable>
<CustomerListForm
:form-data="commissionRatioForm"
:form-rules="commissionRatioFormRules"
:form-items="commissionRatioFormItemOptions"
ref="commissionRatioFormRef"
v-if="dialogType === 'editCommissionRatio'"
></CustomerListForm>
</CustomerListDialog>
<!-- dialog表格 -->
</div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -60,7 +106,8 @@ import CustomerListForm from '@/components/common/Form.vue'
import { search, tableColumns, marginRatioTableColumns, commissionRatioFormItem } from './options' import { search, tableColumns, marginRatioTableColumns, commissionRatioFormItem } from './options'
// //
import { getCustomerListApi, getSelfVarietyPointDiffConfigApi, editCustomerApi } from '@/api/modules/agent/customerList' import { getSelfVarietyPointDiffConfigApi, editCustomerApi } from '@/api/modules/agent/customerList'
import { getAgentListApi } from '@/api/modules/profile/agent.ts'
// //
import { getStorage } from '@/utils/storage' import { getStorage } from '@/utils/storage'
@ -71,15 +118,14 @@ const router = useRouter()
const userInfo: any = getStorage('userInfo') const userInfo: any = getStorage('userInfo')
const userId = ref(userInfo?.id || '') const userId = ref(userInfo?.id || '')
/** /**
* @description: 定义搜索数据 * @description: 定义搜索数据
*/ */
const searchForm = ref({ const searchForm = ref({
accountName: '', accountName: '',
startTime: '', startTime: '',
endTime: '', endTime: '',
status: '', status: '',
}) })
const searchOptions = ref(search) const searchOptions = ref(search)
const tableColumnsOptions = ref(tableColumns) const tableColumnsOptions = ref(tableColumns)
@ -115,46 +161,47 @@ const formRefs: any = ref({})
// //
const setFormRef = (el: any, id: any) => { const setFormRef = (el: any, id: any) => {
if (el) formRefs.value[id] = el if (el) formRefs.value[id] = el
} }
// //
const marginRatioRules = (row: any) => { const marginRatioRules = (row: any) => {
return { return {
assignedPointDifference: [ assignedPointDifference: [
{ required: true, message: '请输入数字', trigger: ['blur', 'change'] }, { required: true, message: '请输入数字', trigger: ['blur', 'change'] },
{ pattern: /^\d+(\.\d+)?$/, message: '只能输入数字(可带小数)', trigger: ['blur', 'change'] }, {
{ pattern: /^\d+(\.\d+)?$/,
validator: (rule: any, value: any, callback: any) => { message: '只能输入数字(可带小数)',
const inputVal = Number(value || 0) trigger: ['blur', 'change'],
const maxVal = Number(row.pointDifference || 0) },
{
validator: (rule: any, value: any, callback: any) => {
const inputVal = Number(value || 0)
const maxVal = Number(row.pointDifference || 0)
if (inputVal > maxVal) { if (inputVal > maxVal) {
callback(new Error('不能大于可分配点数')) callback(new Error('不能大于可分配点数'))
} else { } else {
callback() callback()
} }
}, },
trigger: ['blur', 'change'] trigger: ['blur', 'change'],
} },
] ],
} }
} }
/** /**
* @description: 定义手续费form数据 * @description: 定义手续费form数据
*/ */
const commissionRatioForm = ref({ const commissionRatioForm = ref({
commissionRatio: '', commissionRatio: '',
}) })
const commissionRatioFormRef = ref() const commissionRatioFormRef = ref()
const commissionRatioFormRules = { const commissionRatioFormRules = {
commissionRatio: [ commissionRatio: [
{ required: true, message: '请输入手续费分成比例', trigger: ['blur', 'change'] }, { required: true, message: '请输入手续费分成比例', trigger: ['blur', 'change'] },
{ pattern: /^\d+(\.\d+)?$/, message: '只能输入数字(可带小数)', trigger: ['blur', 'change'] }, { pattern: /^\d+(\.\d+)?$/, message: '只能输入数字(可带小数)', trigger: ['blur', 'change'] },
] ],
} }
const commissionRatioFormItemOptions = ref(commissionRatioFormItem) const commissionRatioFormItemOptions = ref(commissionRatioFormItem)
const selectId = ref('') const selectId = ref('')
@ -163,157 +210,158 @@ const selectId = ref('')
* @description: 角色映射方法 * @description: 角色映射方法
*/ */
const roleMap: any = { const roleMap: any = {
1: '平台', 1: '平台',
2: '承包商', 2: '承包商',
3: '特殊做市商', 3: '特殊做市商',
4: '普通做市商', 4: '普通做市商',
5: '代理', 5: '代理',
6: '用户' 6: '用户',
} }
/** /**
* @description: 定义公共请求数据方法 * @description: 定义公共请求数据方法
*/ */
// //
const getCustomerList = async (id: string) => { const getCustomerList = async () => {
const params = { const params = {
user_id: id, page: currentPage.value,
page: currentPage.value, page_size: pageSize.value,
page_size: pageSize.value, user_name: searchForm.value.accountName,
user_name: searchForm.value.accountName, reg_start_time: searchForm.value.startTime,
reg_start_time: searchForm.value.startTime.length > 0 ? `${searchForm.value.startTime} 0:00:00` : '2026-01-01 0:00:00', reg_end_time: searchForm.value.endTime,
reg_end_time: searchForm.value.endTime.length > 0 ? `${searchForm.value.endTime} 23:59:59` : '2026-03-01 23:59:59', status: searchForm.value.status,
status: searchForm.value.status, }
} const data: any = await getAgentListApi(params)
const data: any = await getCustomerListApi(params)
tableTree.value = data.data.map((item: any) => ({ tableTree.value = data.data.map((item: any) => ({
accountName: item.username, accountName: item.username,
userId: item.id, userId: item.id,
status: item.status === 1 ? '正常' : '禁用', status: item.status === 1 ? '正常' : '禁用',
role: roleMap[item.role_id] || '未知', role: item.role.title || '未知',
accountQty: item.account[0].account_count, accountQty: item.son_user[0].son_user_count,
commissionRatio: item.wallet_capital.fee_handling_percent, commissionRatio: item.wallet_capital.fee_handling_percent,
createTime: item.created_at, createTime: item.created_at,
role_id: item.role_id, role_id: item.role_id,
children: item.role_id === 5 ? [{ }))
hasChildren: true,
}] : undefined,
}))
// //
total.value = data.total total.value = data.total
currentPage.value = data.current_page currentPage.value = data.current_page
pageSize.value = Number(data.per_page) pageSize.value = Number(data.per_page)
} }
// //
const getSelfVarietyPointDiffConfig = async (id: string) => { const getSelfVarietyPointDiffConfig = async (id: string) => {
const params = { const params = {
user_id: id, user_id: id,
} }
const data: any = await getSelfVarietyPointDiffConfigApi(params) const data: any = await getSelfVarietyPointDiffConfigApi(params)
marginRatioTree.value = data.data.map((item: any) => ({ marginRatioTree.value = data.map((item: any) => ({
id: item.id, id: item.id,
varietyName: item.name, varietyName: item.name,
varietyCode: item.code, varietyCode: item.code,
pointDifference: item.point_diff, pointDifference: item.point_diff,
assignedPointDifference: item.target_point_diff assignedPointDifference: item.target_point_diff,
})) }))
} }
/** /**
* @description: 页面加载完成需要请求的数据 * @description: 页面加载完成需要请求的数据
*/ */
onMounted(() => { onMounted(() => {
getCustomerList(userId.value) getCustomerList()
}) })
/** /**
* @description: 定义搜索方法 * @description: 定义搜索方法
*/ */
const handleSearch = async () => { const handleSearch = async () => {
getCustomerList(userId.value) getCustomerList()
} }
const handleReset = () => { const handleReset = () => {
searchForm.value = { searchForm.value = {
accountName: '', accountName: '',
startTime: '', startTime: '',
endTime: '', endTime: '',
status: '', status: '',
} }
getCustomerList(userId.value) getCustomerList()
} }
/** /**
* @description: 定义表格方法 * @description: 定义表格方法
*/ */
const handleDetail = (row: any) => { const handleDetail = (row: any) => {
console.log('查看详情', row); console.log('查看详情', row)
router.push(`/agent/customerDetail/${row.userId}`) router.push(`/agent/customerDetail/${row.userId}`)
} }
// //
const handleMarginRatio = (row: any) => { const handleMarginRatio = (row: any) => {
getSelfVarietyPointDiffConfig(row.userId) getSelfVarietyPointDiffConfig(row.userId)
console.log('修改点差', row); console.log('修改点差', row)
dialogVisible.value = true dialogVisible.value = true
dialogTitle.value = '修改点差' dialogTitle.value = '修改点差'
dialogType.value = 'editMarginRatio' dialogType.value = 'editMarginRatio'
selectId.value = row.userId selectId.value = row.userId
} }
// //
const handleCommissionRatio = (row: any) => { const handleCommissionRatio = (row: any) => {
console.log('修改手续费比例', row); console.log('修改手续费比例', row)
dialogVisible.value = true dialogVisible.value = true
dialogTitle.value = '修改手续费' dialogTitle.value = '修改手续费'
dialogType.value = 'editCommissionRatio' dialogType.value = 'editCommissionRatio'
selectId.value = row.userId selectId.value = row.userId
commissionRatioForm.value.commissionRatio = row.commissionRatio
} }
// //
const handleGetSubList = async (row: any) => { const handleGetSubList = async (row: any) => {
const params = { const params = {
user_name: '', user_name: '',
user_id: row.userId, user_id: row.userId,
page: currentPage.value, page: currentPage.value,
page_size: pageSize.value, page_size: pageSize.value,
reg_start_time: '', reg_start_time: '',
reg_end_time: '', reg_end_time: '',
status: '', status: '',
} }
const data: any = await getCustomerListApi(params) const data: any = await getAgentListApi(params)
if (data.data.length === 0) { if (data.data.length === 0) {
ElMessage({ ElMessage({
message: '暂无数据', message: '暂无数据',
type: 'error', type: 'error',
}) })
row.children = [] row.children = []
return return
} }
row.children = data.data.map((item: any) => ({ row.children = data.data.map((item: any) => ({
accountName: item.username, accountName: item.username,
userId: item.id, userId: item.id,
status: item.status === 1 ? '正常' : '禁用', status: item.status === 1 ? '正常' : '禁用',
role: roleMap[item.role_id] || '未知', role: roleMap[item.role_id] || '未知',
accountQty: item.account[0].account_count, accountQty: item.account[0].account_count,
commissionRatio: item.wallet_capital.fee_handling_percent, commissionRatio: item.wallet_capital.fee_handling_percent,
createTime: item.created_at, createTime: item.created_at,
role_id: item.role_id, role_id: item.role_id,
children: item.role_id === 5 ? [{ children:
hasChildren: true, item.role_id === 5
}] : undefined, ? [
})) {
hasChildren: true,
},
]
: undefined,
}))
} }
/** /**
* @description: 定义分页方法 * @description: 定义分页方法
*/ */
const handlePaginationChange = (page: { currentPage: number, size: number }) => { const handlePaginationChange = (page: { currentPage: number; size: number }) => {
currentPage.value = page.currentPage currentPage.value = page.currentPage
getCustomerList(userId.value) getCustomerList()
} }
/** /**
@ -321,57 +369,61 @@ const handlePaginationChange = (page: { currentPage: number, size: number }) =>
*/ */
// //
const handleSubmit = async () => { const handleSubmit = async () => {
const params = { const params = {
user_id: selectId.value, user_id: selectId.value,
toucun_percent: '', toucun_percent: '',
point_diffs_json: '', point_diffs_json: '',
fee_handling_percent: '', fee_handling_percent: '',
fee_setting_id: '', fee_setting_id: '',
risk_control_id: '', risk_control_id: '',
}
if (dialogType.value === 'editMarginRatio') {
//
for (const row of marginRatioTree.value) {
const form = formRefs.value[(row as any).id]
if (!form) continue
try {
await form.validate()
} catch (err) {
console.error(`${(row as any).id} 行验证不通过,请检查`)
return
}
} }
if (dialogType.value === 'editMarginRatio') { // { id: assignedPointDifference }
// const marginRatioJSON = marginRatioTree.value.reduce((acc: any, cur: any) => {
for (const row of marginRatioTree.value) { acc[cur.id] = cur.assignedPointDifference
const form = formRefs.value[(row as any).id] return acc
if (!form) continue }, {})
try {
await form.validate()
} catch (err) {
console.error(`${(row as any).id} 行验证不通过,请检查`)
return
}
}
// { id: assignedPointDifference }
const marginRatioJSON = marginRatioTree.value.reduce((acc: any, cur: any) => {
acc[cur.id] = cur.assignedPointDifference
return acc
}, {})
// //
try { try {
await editCustomerApi({ ...params, point_diffs_json: JSON.stringify(marginRatioJSON) }) await editCustomerApi({ ...params, point_diffs_json: JSON.stringify(marginRatioJSON) })
dialogVisible.value = false dialogVisible.value = false
} catch (err) { } catch (err) {
console.log('提交失败:', err) console.log('提交失败:', err)
}
} }
if (dialogType.value === 'editCommissionRatio') { }
await commissionRatioFormRef.value.validate() if (dialogType.value === 'editCommissionRatio') {
try { await commissionRatioFormRef.value.validate()
await editCustomerApi({ ...params, fee_handling_percent: commissionRatioForm.value.commissionRatio }) try {
dialogVisible.value = false await editCustomerApi({
} catch (err) { ...params,
console.log('提交失败:', err) fee_handling_percent: commissionRatioForm.value.commissionRatio,
} })
dialogVisible.value = false
await getCustomerList()
} catch (err) {
console.log('提交失败:', err)
} }
}
} }
// //
const handleCancel = () => { const handleCancel = () => {
dialogVisible.value = false dialogVisible.value = false
} }
// //
const handleClose = () => { const handleClose = () => {
dialogVisible.value = false dialogVisible.value = false
} }
/** /**
* @description: 定义弹窗表格方法 * @description: 定义弹窗表格方法
@ -380,8 +432,8 @@ const handleClose = () => {
<style scoped lang="scss"> <style scoped lang="scss">
:deep(.placeholder-row) { :deep(.placeholder-row) {
text-align: center; text-align: center;
color: #909399; color: #909399;
/* 灰色和Element空状态颜色一致 */ /* 灰色和Element空状态颜色一致 */
} }
</style> </style>

View File

@ -1,18 +1,28 @@
export const search = [ export const search = [
// 账号名称 // 账号名称
{ prop: 'accountName', label: '账号名称', type: 'input' as const, placeholder: '请输入账号名称', width: '150px' }, {
// 开始时间 prop: 'accountName',
{ label: '账号名称',
prop: "startTime", label: '注册开始时间', type: 'date' as const, dateType: 'date' as const, // 时间范围选择器 type: 'input' as const,
valueFormat: 'YYYY-MM-DD', placeholder: '请输入账号名称',
}, width: '150px',
// 结束时间 },
{ // 开始时间
prop: "endTime", label: '注册结束时间', type: 'date' as const, dateType: 'date' as const, // 时间范围选择器 {
valueFormat: 'YYYY-MM-DD', prop: 'startTime',
}, label: '注册开始时间',
// 状态 type: 'date' as const,
{ prop: 'status', label: '状态', type: 'select' as const, placeholder: '请选择状态' }, dateType: 'date' as const, // 时间范围选择器
valueFormat: 'YYYY-MM-DD',
},
// 结束时间
{
prop: 'endTime',
label: '注册结束时间',
type: 'date' as const,
dateType: 'date' as const, // 时间范围选择器
valueFormat: 'YYYY-MM-DD',
},
] ]
export const tableColumns = [ export const tableColumns = [
@ -33,7 +43,7 @@ export const tableColumns = [
// 注册时间 // 注册时间
{ prop: 'createTime', label: '注册时间', sortable: true }, { prop: 'createTime', label: '注册时间', sortable: true },
// 操作 // 操作
{ label: '操作', slotName: 'action' } // { label: '操作', slotName: 'action' }
] ]
// 点差表格配置 // 点差表格配置

File diff suppressed because it is too large Load Diff

View File

@ -75,12 +75,17 @@ export const countryOptions = ref<CountryItem[]>([
]) ])
//编辑点差表格列配置 //编辑点差表格列配置
export const marketPointTableColumns = ([ export const marketPointTableColumns = [
{ prop: 'varietyName', label: '名称', align: 'center' as const }, { prop: 'varietyName', label: '名称', align: 'center' as const },
{ prop: 'varietyCode', label: '编号', align: 'center' as const }, { prop: 'varietyCode', label: '编号', align: 'center' as const },
{ prop: 'pointDifference', label: '可分配点差', align: 'center' as const }, { prop: 'point_diff', label: '可分配点差', align: 'center' as const },
{ prop: 'assignedPointDifference', label: '已分配点差', align: 'center' as const, slotName: 'assignedPointDiff' }, {
]) prop: 'pointDifference',
label: '已分配点差',
align: 'center' as const,
slotName: 'assignedPointDiff',
},
]
// 查看点差表格列配置 // 查看点差表格列配置
export const viewMarketPointTableColumns = ([ export const viewMarketPointTableColumns = ([

View File

@ -85,7 +85,7 @@ import { rules } from './rules'
const clientSearchOptions = ref(clientSearch) const clientSearchOptions = ref(clientSearch)
const clientSearchForm = ref({ const clientSearchForm = ref({
username: '', username: '',
status: '正常', status: 1,
startDateTime: '', startDateTime: '',
endDateTime: '', endDateTime: '',
}) })
@ -172,7 +172,7 @@ const getClientList = async () => {
page: currentPage.value, page: currentPage.value,
page_size: pageSize.value, page_size: pageSize.value,
username: clientSearchForm.value.username, username: clientSearchForm.value.username,
status: clientSearchForm.value.status === '正常' ? 1 : 2, status: clientSearchForm.value.status || '',
reg_start_time: clientSearchForm.value.startDateTime.length > 0 ? `${clientSearchForm.value.startDateTime} 0:00:00` : '', 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_end_time: clientSearchForm.value.endDateTime.length > 0 ? `${clientSearchForm.value.endDateTime} 23:59:59` : '',
} }

View File

@ -306,12 +306,14 @@ const handleEdit = () => {
dialogVisible.value = true dialogVisible.value = true
dialogTitle.value = '编辑合约品种' dialogTitle.value = '编辑合约品种'
dialogType.value = 'edit' dialogType.value = 'edit'
dialogFormItemOptions.value[4]!.disabled = true
} }
const handleAdd = () => { const handleAdd = () => {
dialogVisible.value = true dialogVisible.value = true
dialogTitle.value = '添加合约品种' dialogTitle.value = '添加合约品种'
dialogType.value = 'add' dialogType.value = 'add'
dialogFormItemOptions.value[4]!.disabled = false
varietyForm.value = { varietyForm.value = {
varietyName: '', varietyName: '',
varietyCode: '', varietyCode: '',
@ -420,6 +422,8 @@ const handleSubmit = async () => {
if (dialogType.value === 'edit') { if (dialogType.value === 'edit') {
console.log(params) console.log(params)
if (params.point_diff_max < params.point_diff)
return ElMessage.warning('最大点差不能小于最小点差')
await editVarietyApi({ await editVarietyApi({
...params, ...params,
is_default: varietyForm.value.isDefault, is_default: varietyForm.value.isDefault,