处理loading
This commit is contained in:
parent
3f1ad80a8f
commit
cfd68bf3c9
|
|
@ -16,7 +16,7 @@
|
||||||
<template #footer v-if="showFooter">
|
<template #footer v-if="showFooter">
|
||||||
<slot name="footer">
|
<slot name="footer">
|
||||||
<el-button @click="handleCancel">取消</el-button>
|
<el-button @click="handleCancel">取消</el-button>
|
||||||
<el-button type="primary" @click="handleConfirm">确定</el-button>
|
<el-button type="primary" :loading="buttonLoading" @click="handleConfirm">确定</el-button>
|
||||||
</slot>
|
</slot>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
@ -31,6 +31,7 @@ interface Props {
|
||||||
type?: string
|
type?: string
|
||||||
showFooter?: boolean
|
showFooter?: boolean
|
||||||
fullscreen?: boolean
|
fullscreen?: boolean
|
||||||
|
buttonLoading?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Emits {
|
interface Emits {
|
||||||
|
|
@ -45,6 +46,7 @@ const props = withDefaults(defineProps<Props>(), {
|
||||||
destroyOnClose: true,
|
destroyOnClose: true,
|
||||||
showFooter: true,
|
showFooter: true,
|
||||||
fullscreen: false,
|
fullscreen: false,
|
||||||
|
buttonLoading: false,
|
||||||
})
|
})
|
||||||
|
|
||||||
const emit = defineEmits<Emits>()
|
const emit = defineEmits<Emits>()
|
||||||
|
|
|
||||||
|
|
@ -44,10 +44,10 @@
|
||||||
|
|
||||||
<!-- 操作按钮 -->
|
<!-- 操作按钮 -->
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="$emit('search')">
|
<el-button type="primary" :loading="buttonLoading" @click="$emit('search')">
|
||||||
{{ buttonConfig.searchText || '搜索' }}
|
{{ buttonConfig.searchText || '搜索' }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button @click="$emit('reset')">
|
<el-button :loading="buttonLoading" @click="$emit('reset')">
|
||||||
{{ buttonConfig.resetText || '重置' }}
|
{{ buttonConfig.resetText || '重置' }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<!-- 按钮区插槽 -->
|
<!-- 按钮区插槽 -->
|
||||||
|
|
@ -99,6 +99,10 @@ const props = defineProps({
|
||||||
type: Object as () => ButtonConfig,
|
type: Object as () => ButtonConfig,
|
||||||
default: () => ({}),
|
default: () => ({}),
|
||||||
},
|
},
|
||||||
|
buttonLoading: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
// 暴露事件
|
// 暴露事件
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="table_form-container">
|
<div class="table_form-container">
|
||||||
<!-- 搜索 -->
|
<!-- 搜索 -->
|
||||||
<CustomerListSearch :search-form="searchForm" :search-options="searchOptions" @search="handleSearch"
|
<CustomerListSearch :search-form="searchForm" :search-options="searchOptions" :button-loading="searchLoading" @search="handleSearch"
|
||||||
@reset="handleReset"></CustomerListSearch>
|
@reset="handleReset"></CustomerListSearch>
|
||||||
|
|
||||||
<!-- 表格 -->
|
<!-- 表格 -->
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
|
|
||||||
<!-- dialog -->
|
<!-- dialog -->
|
||||||
<CustomerListDialog :visible="dialogVisible" :title="dialogTitle" :type="dialogType" :fullscreen="dialogFullscreen"
|
<CustomerListDialog :visible="dialogVisible" :title="dialogTitle" :type="dialogType" :fullscreen="dialogFullscreen"
|
||||||
:show-footer="dialogType !== 'view'" @confirm="handleSubmit" @cancel="handleCancel" @close="handleClose">
|
:show-footer="dialogType !== 'view'" :button-loading="submitLoading" @confirm="handleSubmit" @cancel="handleCancel" @close="handleClose">
|
||||||
<CustomerListTable :table-data="marginRatioTree" :columns="marginRatioTableColumnsOptions" row-key="id"
|
<CustomerListTable :table-data="marginRatioTree" :columns="marginRatioTableColumnsOptions" row-key="id"
|
||||||
v-if="dialogType === 'editMarginRatio'" style="height: 600px">
|
v-if="dialogType === 'editMarginRatio'" style="height: 600px">
|
||||||
<template #assignedPointDiff="{ row }">
|
<template #assignedPointDiff="{ row }">
|
||||||
|
|
@ -57,7 +57,7 @@
|
||||||
</CustomerListDialog>
|
</CustomerListDialog>
|
||||||
|
|
||||||
<!-- 调整金额弹窗 -->
|
<!-- 调整金额弹窗 -->
|
||||||
<CustomerListDialog :visible="adjustAmountVisible" title="调整金额" type="adjust" @confirm="handleAdjustAmountSubmit"
|
<CustomerListDialog :visible="adjustAmountVisible" title="调整金额" type="adjust" :button-loading="adjustAmountLoading" @confirm="handleAdjustAmountSubmit"
|
||||||
@cancel="handleAdjustAmountCancel" @close="handleAdjustAmountClose">
|
@cancel="handleAdjustAmountCancel" @close="handleAdjustAmountClose">
|
||||||
<el-form :model="adjustAmountForm" :rules="adjustAmountRules" ref="adjustAmountFormRef" label-width="120px">
|
<el-form :model="adjustAmountForm" :rules="adjustAmountRules" ref="adjustAmountFormRef" label-width="120px">
|
||||||
<el-form-item label="账号名" prop="username">
|
<el-form-item label="账号名" prop="username">
|
||||||
|
|
@ -81,7 +81,7 @@
|
||||||
|
|
||||||
<!-- 修改客户弹窗 -->
|
<!-- 修改客户弹窗 -->
|
||||||
<CustomerListDialog :visible="editCustomerVisible" title="" type="editCustomer"
|
<CustomerListDialog :visible="editCustomerVisible" title="" type="editCustomer"
|
||||||
@confirm="handleEditCustomerSubmit" @cancel="handleEditCustomerCancel" @close="handleEditCustomerClose">
|
:button-loading="editCustomerLoading" @confirm="handleEditCustomerSubmit" @cancel="handleEditCustomerCancel" @close="handleEditCustomerClose">
|
||||||
<el-form :model="editCustomerForm" :rules="editCustomerRules" ref="editCustomerFormRef" label-width="140px">
|
<el-form :model="editCustomerForm" :rules="editCustomerRules" ref="editCustomerFormRef" label-width="140px">
|
||||||
<!-- <el-form-item label="手续费模板" prop="feeSettingId">
|
<!-- <el-form-item label="手续费模板" prop="feeSettingId">
|
||||||
<el-select v-model="editCustomerForm.feeSettingId" placeholder="请选择手续费模板" style="width: 100%">
|
<el-select v-model="editCustomerForm.feeSettingId" placeholder="请选择手续费模板" style="width: 100%">
|
||||||
|
|
@ -126,7 +126,7 @@ defineOptions({
|
||||||
// 组件
|
// 组件
|
||||||
import CustomerListSearch from '@/components/common/Search.vue'
|
import CustomerListSearch from '@/components/common/Search.vue'
|
||||||
import CustomerListTable from '@/components/common/Table.vue'
|
import CustomerListTable from '@/components/common/Table.vue'
|
||||||
import { usePageLoading } from '@/composables/useLoading'
|
import { usePageLoading, useButtonLoading } from '@/composables/useLoading'
|
||||||
import CustomerListPagination from '@/components/common/Pagination.vue'
|
import CustomerListPagination from '@/components/common/Pagination.vue'
|
||||||
import CustomerListDialog from '@/components/common/Dialog.vue'
|
import CustomerListDialog from '@/components/common/Dialog.vue'
|
||||||
import CustomerListForm from '@/components/common/Form.vue'
|
import CustomerListForm from '@/components/common/Form.vue'
|
||||||
|
|
@ -172,6 +172,10 @@ const searchOptions = ref(search)
|
||||||
const tableColumnsOptions = ref(tableColumns)
|
const tableColumnsOptions = ref(tableColumns)
|
||||||
|
|
||||||
const { loading, startLoading, stopLoading } = usePageLoading()
|
const { loading, startLoading, stopLoading } = usePageLoading()
|
||||||
|
const { buttonLoading: searchLoading, startButtonLoading: startSearchLoading, stopButtonLoading: stopSearchLoading } = useButtonLoading()
|
||||||
|
const { buttonLoading: submitLoading, startButtonLoading: startSubmitLoading, stopButtonLoading: stopSubmitLoading } = useButtonLoading()
|
||||||
|
const { buttonLoading: adjustAmountLoading, startButtonLoading: startAdjustAmountLoading, stopButtonLoading: stopAdjustAmountLoading } = useButtonLoading()
|
||||||
|
const { buttonLoading: editCustomerLoading, startButtonLoading: startEditCustomerLoading, stopButtonLoading: stopEditCustomerLoading } = useButtonLoading()
|
||||||
/**
|
/**
|
||||||
* @description: 定义表格数据
|
* @description: 定义表格数据
|
||||||
*/
|
*/
|
||||||
|
|
@ -326,65 +330,74 @@ const roleMap: any = {
|
||||||
// 获取客户列表
|
// 获取客户列表
|
||||||
const getCustomerList = async (id: string) => {
|
const getCustomerList = async (id: string) => {
|
||||||
startLoading()
|
startLoading()
|
||||||
const params = {
|
try {
|
||||||
user_id: id,
|
const params = {
|
||||||
page: currentPage.value,
|
user_id: id,
|
||||||
page_size: pageSize.value,
|
page: currentPage.value,
|
||||||
user_name: searchForm.value.accountName,
|
page_size: pageSize.value,
|
||||||
reg_start_time:
|
user_name: searchForm.value.accountName,
|
||||||
searchForm.value.startTime.length > 0
|
reg_start_time:
|
||||||
? `${searchForm.value.startTime} 0:00:00`
|
searchForm.value.startTime.length > 0
|
||||||
: '2026-01-01 0:00:00',
|
? `${searchForm.value.startTime} 0:00:00`
|
||||||
reg_end_time:
|
: '2026-01-01 0:00:00',
|
||||||
searchForm.value.endTime.length > 0
|
reg_end_time:
|
||||||
? `${searchForm.value.endTime} 23:59:59`
|
searchForm.value.endTime.length > 0
|
||||||
: '2026-03-01 23:59:59',
|
? `${searchForm.value.endTime} 23:59:59`
|
||||||
status: searchForm.value.status,
|
: '2026-03-01 23:59:59',
|
||||||
}
|
status: searchForm.value.status,
|
||||||
const data: any = await getCustomerListApi(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: 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:
|
children:
|
||||||
item.role_id === 5
|
item.role_id === 5
|
||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
hasChildren: true,
|
hasChildren: true,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
: undefined,
|
: undefined,
|
||||||
}))
|
}))
|
||||||
console.log('tableTree', tableTree.value)
|
console.log('tableTree', tableTree.value)
|
||||||
//分页数据
|
//分页数据
|
||||||
stopLoading()
|
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)
|
} catch (err) {
|
||||||
|
console.error('获取客户列表失败:', err)
|
||||||
|
} finally {
|
||||||
|
stopLoading()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取代理点差数据
|
//获取代理点差数据
|
||||||
const getSelfVarietyPointDiffConfig = async (id: string) => {
|
const getSelfVarietyPointDiffConfig = async (id: string) => {
|
||||||
const params = {
|
try {
|
||||||
user_id: id,
|
const params = {
|
||||||
}
|
user_id: id,
|
||||||
const data: any = await getSelfVarietyPointDiffConfigApi(params)
|
|
||||||
marginRatioTree.value = data.map((item: any) => {
|
|
||||||
return {
|
|
||||||
id: item.id,
|
|
||||||
varietyName: item.name,
|
|
||||||
varietyCode: item.code,
|
|
||||||
pointDifference: item.point_diff,
|
|
||||||
assignedPointDifference: item.target_point_diff,
|
|
||||||
}
|
}
|
||||||
})
|
const data: any = await getSelfVarietyPointDiffConfigApi(params)
|
||||||
console.log('marginRatioTree', marginRatioTree.value)
|
marginRatioTree.value = data.map((item: any) => {
|
||||||
|
return {
|
||||||
|
id: item.id,
|
||||||
|
varietyName: item.name,
|
||||||
|
varietyCode: item.code,
|
||||||
|
pointDifference: item.point_diff,
|
||||||
|
assignedPointDifference: item.target_point_diff,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
console.log('marginRatioTree', marginRatioTree.value)
|
||||||
|
} catch (err) {
|
||||||
|
console.error('获取代理点差数据失败:', err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -398,7 +411,15 @@ onMounted(() => {
|
||||||
* @description: 定义搜索方法
|
* @description: 定义搜索方法
|
||||||
*/
|
*/
|
||||||
const handleSearch = async () => {
|
const handleSearch = async () => {
|
||||||
getCustomerList(userId.value)
|
currentPage.value = 1
|
||||||
|
startSearchLoading()
|
||||||
|
try {
|
||||||
|
await getCustomerList(userId.value)
|
||||||
|
} catch (err) {
|
||||||
|
console.error('搜索失败:', err)
|
||||||
|
} finally {
|
||||||
|
stopSearchLoading()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const handleReset = () => {
|
const handleReset = () => {
|
||||||
searchForm.value = {
|
searchForm.value = {
|
||||||
|
|
@ -407,7 +428,7 @@ const handleReset = () => {
|
||||||
endTime: '',
|
endTime: '',
|
||||||
status: '',
|
status: '',
|
||||||
}
|
}
|
||||||
getCustomerList(userId.value)
|
handleSearch()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -448,42 +469,46 @@ const handleCommissionRatio = (row: any) => {
|
||||||
|
|
||||||
// 获取子列表
|
// 获取子列表
|
||||||
const handleGetSubList = async (row: any) => {
|
const handleGetSubList = async (row: any) => {
|
||||||
const params = {
|
try {
|
||||||
user_name: '',
|
const params = {
|
||||||
user_id: row.userId,
|
user_name: '',
|
||||||
page: currentPage.value,
|
user_id: row.userId,
|
||||||
page_size: pageSize.value,
|
page: currentPage.value,
|
||||||
reg_start_time: '',
|
page_size: pageSize.value,
|
||||||
reg_end_time: '',
|
reg_start_time: '',
|
||||||
status: '',
|
reg_end_time: '',
|
||||||
|
status: '',
|
||||||
|
}
|
||||||
|
const data: any = await getCustomerListApi(params)
|
||||||
|
if (data.data.length === 0) {
|
||||||
|
ElMessage({
|
||||||
|
message: '暂无数据',
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
row.children = []
|
||||||
|
return
|
||||||
|
}
|
||||||
|
row.children = data.data.map((item: any) => ({
|
||||||
|
accountName: item.username,
|
||||||
|
userId: item.id,
|
||||||
|
status: item.status === 1 ? '正常' : '禁用',
|
||||||
|
role: roleMap[item.role_id] || '未知',
|
||||||
|
accountQty: item.account[0].account_count,
|
||||||
|
commissionRatio: item.wallet_capital.fee_handling_percent,
|
||||||
|
createTime: item.created_at,
|
||||||
|
role_id: item.role_id,
|
||||||
|
children:
|
||||||
|
item.role_id === 5
|
||||||
|
? [
|
||||||
|
{
|
||||||
|
hasChildren: true,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
: undefined,
|
||||||
|
}))
|
||||||
|
} catch (err) {
|
||||||
|
console.error('获取子列表失败:', err)
|
||||||
}
|
}
|
||||||
const data: any = await getCustomerListApi(params)
|
|
||||||
if (data.data.length === 0) {
|
|
||||||
ElMessage({
|
|
||||||
message: '暂无数据',
|
|
||||||
type: 'error',
|
|
||||||
})
|
|
||||||
row.children = []
|
|
||||||
return
|
|
||||||
}
|
|
||||||
row.children = data.data.map((item: any) => ({
|
|
||||||
accountName: item.username,
|
|
||||||
userId: item.id,
|
|
||||||
status: item.status === 1 ? '正常' : '禁用',
|
|
||||||
role: roleMap[item.role_id] || '未知',
|
|
||||||
accountQty: item.account[0].account_count,
|
|
||||||
commissionRatio: item.wallet_capital.fee_handling_percent,
|
|
||||||
createTime: item.created_at,
|
|
||||||
role_id: item.role_id,
|
|
||||||
children:
|
|
||||||
item.role_id === 5
|
|
||||||
? [
|
|
||||||
{
|
|
||||||
hasChildren: true,
|
|
||||||
},
|
|
||||||
]
|
|
||||||
: undefined,
|
|
||||||
}))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -500,53 +525,58 @@ const handlePaginationChange = (page: { currentPage: number; pageSize: number })
|
||||||
*/
|
*/
|
||||||
//提交
|
//提交
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
const params = {
|
startSubmitLoading()
|
||||||
user_id: selectId.value,
|
try {
|
||||||
toucun_percent: '',
|
const params = {
|
||||||
point_diffs_json: '',
|
user_id: selectId.value,
|
||||||
fee_handling_percent: '',
|
toucun_percent: '',
|
||||||
fee_setting_id: '',
|
point_diffs_json: '',
|
||||||
risk_control_id: '',
|
fee_handling_percent: '',
|
||||||
}
|
fee_setting_id: '',
|
||||||
if (dialogType.value === 'editMarginRatio') {
|
risk_control_id: '',
|
||||||
// 逐行验证
|
}
|
||||||
for (const row of marginRatioTree.value) {
|
if (dialogType.value === 'editMarginRatio') {
|
||||||
const form = formRefs.value[(row as any).id]
|
// 逐行验证
|
||||||
if (!form) continue
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//转换为接口需要的格式 { id: assignedPointDifference }
|
||||||
|
const marginRatioJSON = marginRatioTree.value.reduce((acc: any, cur: any) => {
|
||||||
|
acc[cur.id] = cur.assignedPointDifference
|
||||||
|
return acc
|
||||||
|
}, {})
|
||||||
|
|
||||||
|
// 调用接口
|
||||||
try {
|
try {
|
||||||
await form.validate()
|
await editCustomerApi({ ...params, point_diffs_json: JSON.stringify(marginRatioJSON) })
|
||||||
|
dialogVisible.value = false
|
||||||
|
await getCustomerList(userId.value)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(`第 ${(row as any).id} 行验证不通过,请检查`)
|
console.error('提交失败:', err)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//转换为接口需要的格式 { id: assignedPointDifference }
|
if (dialogType.value === 'editCommissionRatio') {
|
||||||
const marginRatioJSON = marginRatioTree.value.reduce((acc: any, cur: any) => {
|
await commissionRatioFormRef.value.validate()
|
||||||
acc[cur.id] = cur.assignedPointDifference
|
try {
|
||||||
return acc
|
await editCustomerApi({
|
||||||
}, {})
|
...params,
|
||||||
|
fee_handling_percent: commissionRatioForm.value.commissionRatio,
|
||||||
// 调用接口
|
})
|
||||||
try {
|
dialogVisible.value = false
|
||||||
await editCustomerApi({ ...params, point_diffs_json: JSON.stringify(marginRatioJSON) })
|
await getCustomerList(userId.value)
|
||||||
dialogVisible.value = false
|
} catch (err) {
|
||||||
await getCustomerList(userId.value)
|
console.error('提交失败:', err)
|
||||||
} catch (err) {
|
}
|
||||||
console.log('提交失败:', err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (dialogType.value === 'editCommissionRatio') {
|
|
||||||
await commissionRatioFormRef.value.validate()
|
|
||||||
try {
|
|
||||||
await editCustomerApi({
|
|
||||||
...params,
|
|
||||||
fee_handling_percent: commissionRatioForm.value.commissionRatio,
|
|
||||||
})
|
|
||||||
dialogVisible.value = false
|
|
||||||
await getCustomerList(userId.value)
|
|
||||||
} catch (err) {
|
|
||||||
console.log('提交失败:', err)
|
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
stopSubmitLoading()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 取消
|
// 取消
|
||||||
|
|
@ -587,6 +617,7 @@ const handleAdjustAmountInput = () => {
|
||||||
|
|
||||||
// 提交调整金额
|
// 提交调整金额
|
||||||
const handleAdjustAmountSubmit = async () => {
|
const handleAdjustAmountSubmit = async () => {
|
||||||
|
startAdjustAmountLoading()
|
||||||
try {
|
try {
|
||||||
await adjustAmountFormRef.value?.validate()
|
await adjustAmountFormRef.value?.validate()
|
||||||
await updateCapitalApi({
|
await updateCapitalApi({
|
||||||
|
|
@ -597,6 +628,8 @@ const handleAdjustAmountSubmit = async () => {
|
||||||
adjustAmountVisible.value = false
|
adjustAmountVisible.value = false
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('调整金额表单验证失败', err)
|
console.error('调整金额表单验证失败', err)
|
||||||
|
} finally {
|
||||||
|
stopAdjustAmountLoading()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -659,6 +692,7 @@ const handleEditCustomer = async (row: any) => {
|
||||||
|
|
||||||
// 提交修改客户
|
// 提交修改客户
|
||||||
const handleEditCustomerSubmit = async () => {
|
const handleEditCustomerSubmit = async () => {
|
||||||
|
startEditCustomerLoading()
|
||||||
try {
|
try {
|
||||||
await editCustomerFormRef.value?.validate()
|
await editCustomerFormRef.value?.validate()
|
||||||
await editUserApi({
|
await editUserApi({
|
||||||
|
|
@ -673,6 +707,8 @@ const handleEditCustomerSubmit = async () => {
|
||||||
editCustomerVisible.value = false
|
editCustomerVisible.value = false
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('修改客户表单验证失败', err)
|
console.error('修改客户表单验证失败', err)
|
||||||
|
} finally {
|
||||||
|
stopEditCustomerLoading()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,12 @@
|
||||||
<FundDetailHeader title="入金货币" :buttons="buttonsOptions" @button-click="handleButtonClick">
|
<FundDetailHeader title="入金货币" :buttons="buttonsOptions" @button-click="handleButtonClick">
|
||||||
</FundDetailHeader>
|
</FundDetailHeader>
|
||||||
<!-- 表格 -->
|
<!-- 表格 -->
|
||||||
<FundDetailTable :table-data="tableData" :columns="tableColumnsOptions" @row-click="handleRowClick" row-key="id" :loading="loading" />
|
<FundDetailTable :table-data="tableData" :columns="tableColumnsOptions" @row-click="handleRowClick" row-key="id"
|
||||||
<FundDetailDialog :visible="visible" :title="dialogTitle" @close="visible = false" @cancel="visible = false"
|
:loading="loading" />
|
||||||
@confirm="handleConfirm">
|
<FundDetailDialog :visible="visible" :title="dialogTitle" :button-loading="buttonLoading" @close="visible = false"
|
||||||
<FundDetailForm :formData="formData" :formItems="formItems" :formRules="formRules" :optionsMap="optionsMap">
|
@cancel="visible = false" @confirm="handleConfirm">
|
||||||
|
<FundDetailForm :formData="formData" ref="commissionRatioFormRef" :formItems="formItems" :formRules="formRules"
|
||||||
|
:optionsMap="optionsMap">
|
||||||
</FundDetailForm>
|
</FundDetailForm>
|
||||||
</FundDetailDialog>
|
</FundDetailDialog>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -20,7 +22,7 @@ defineOptions({
|
||||||
})
|
})
|
||||||
import FundDetailHeader from '@/components/common/header.vue'
|
import FundDetailHeader from '@/components/common/header.vue'
|
||||||
import FundDetailTable from '@/components/common/Table.vue'
|
import FundDetailTable from '@/components/common/Table.vue'
|
||||||
import { usePageLoading } from '@/composables/useLoading'
|
import { usePageLoading, useButtonLoading } from '@/composables/useLoading'
|
||||||
import FundDetailDialog from '@/components/common/Dialog.vue'
|
import FundDetailDialog from '@/components/common/Dialog.vue'
|
||||||
import FundDetailForm from '@/components/common/Form.vue'
|
import FundDetailForm from '@/components/common/Form.vue'
|
||||||
import type { ButtonProps } from 'element-plus'
|
import type { ButtonProps } from 'element-plus'
|
||||||
|
|
@ -43,11 +45,13 @@ interface HeaderButton {
|
||||||
}
|
}
|
||||||
|
|
||||||
const { loading, startLoading, stopLoading } = usePageLoading()
|
const { loading, startLoading, stopLoading } = usePageLoading()
|
||||||
|
const { buttonLoading, startButtonLoading, stopButtonLoading } = useButtonLoading()
|
||||||
const buttonsOptions = ref(buttons)
|
const buttonsOptions = ref(buttons)
|
||||||
const formItems = ref(form)
|
const formItems = ref(form)
|
||||||
const tableData = ref([])
|
const tableData = ref([])
|
||||||
const tableColumnsOptions = ref(tableColumns)
|
const tableColumnsOptions = ref(tableColumns)
|
||||||
const dialogTitle = ref('')
|
const dialogTitle = ref('')
|
||||||
|
const commissionRatioFormRef = ref()
|
||||||
const formRules = ref(rules)
|
const formRules = ref(rules)
|
||||||
const formData = ref({
|
const formData = ref({
|
||||||
name: '',
|
name: '',
|
||||||
|
|
@ -72,17 +76,22 @@ let rowData: any = {}
|
||||||
const visible = ref<boolean>(false)
|
const visible = ref<boolean>(false)
|
||||||
|
|
||||||
const getTableList = async () => {
|
const getTableList = async () => {
|
||||||
startLoading()
|
try {
|
||||||
const data = await getCurrencyList()
|
|
||||||
stopLoading()
|
startLoading()
|
||||||
tableData.value = (data || []).map((item: any) => {
|
const data = await getCurrencyList()
|
||||||
return {
|
|
||||||
...item,
|
tableData.value = (data || []).map((item: any) => {
|
||||||
typeStr: ['', '法币', '数字货币'][item.type],
|
return {
|
||||||
statusStr: ['', '正常', '禁用'][item.status],
|
...item,
|
||||||
}
|
typeStr: ['', '法币', '数字货币'][item.type],
|
||||||
})
|
statusStr: ['', '正常', '禁用'][item.status],
|
||||||
console.log('tableData.value', tableData.value)
|
}
|
||||||
|
})
|
||||||
|
console.log('tableData.value', tableData.value)
|
||||||
|
} finally {
|
||||||
|
stopLoading()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleRowClick = (row: any) => {
|
const handleRowClick = (row: any) => {
|
||||||
|
|
@ -140,14 +149,20 @@ const handleEdit = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleConfirm = async () => {
|
const handleConfirm = async () => {
|
||||||
if (dialogTitle.value === '添加') {
|
await commissionRatioFormRef.value.validate()
|
||||||
await createCurrency(formData.value)
|
startButtonLoading()
|
||||||
} else {
|
try {
|
||||||
await editCurrency({ ...formData.value, id: rowData.id })
|
if (dialogTitle.value === '添加') {
|
||||||
|
await createCurrency(formData.value)
|
||||||
|
} else {
|
||||||
|
await editCurrency({ ...formData.value, id: rowData.id })
|
||||||
|
}
|
||||||
|
visible.value = false
|
||||||
|
resetForm()
|
||||||
|
await getTableList()
|
||||||
|
} finally {
|
||||||
|
stopButtonLoading()
|
||||||
}
|
}
|
||||||
visible.value = false
|
|
||||||
resetForm()
|
|
||||||
await getTableList()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|
|
||||||
|
|
@ -5,29 +5,14 @@
|
||||||
<el-button type="primary" @click="handleEdit" v-auth="'channel_editChannel'">编辑</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>
|
<el-button type="danger" @click="handleDelete" v-auth="'channel_delChannel'">删除</el-button>
|
||||||
</div>
|
</div>
|
||||||
<DepositChannelTable
|
<DepositChannelTable ref="tableRef" :table-data="tableData" :columns="tableColumnsOptions" row-key="id"
|
||||||
ref="tableRef"
|
:loading="loading" @rowClick="handleRowClick" />
|
||||||
:table-data="tableData"
|
<el-dialog v-model="dialogVisible" :title="dialogTitleType === 1 ? '添加充值渠道' : '编辑充值渠道'" width="700">
|
||||||
:columns="tableColumnsOptions"
|
<Form :formItems="formItems" ref="formRef" :formRules="formRules" :formData="formData" :optionsMap="optionsMap" />
|
||||||
row-key="id"
|
|
||||||
:loading="loading"
|
|
||||||
@rowClick="handleRowClick"
|
|
||||||
/>
|
|
||||||
<el-dialog
|
|
||||||
v-model="dialogVisible"
|
|
||||||
:title="dialogTitleType === 1 ? '添加充值渠道' : '编辑充值渠道'"
|
|
||||||
width="700"
|
|
||||||
>
|
|
||||||
<Form
|
|
||||||
:formItems="formItems"
|
|
||||||
:formRules="formRules"
|
|
||||||
:formData="formData"
|
|
||||||
:optionsMap="optionsMap"
|
|
||||||
/>
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
<el-button @click="dialogVisible = false">取消</el-button>
|
<el-button @click="dialogVisible = false">取消</el-button>
|
||||||
<el-button type="primary" @click="submitDetail">确认</el-button>
|
<el-button type="primary" :loading="submitLoading" @click="submitDetail">确认</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
@ -41,7 +26,7 @@ defineOptions({
|
||||||
//组件
|
//组件
|
||||||
import DepositChannelTable from '@/components/common/Table.vue'
|
import DepositChannelTable from '@/components/common/Table.vue'
|
||||||
import Form from '@/components/common/Form.vue'
|
import Form from '@/components/common/Form.vue'
|
||||||
import { usePageLoading } from '@/composables/useLoading'
|
import { usePageLoading, useButtonLoading } from '@/composables/useLoading'
|
||||||
import { tableColumns, formItemsData, formRulesData, optionsMapData } from './options'
|
import { tableColumns, formItemsData, formRulesData, optionsMapData } from './options'
|
||||||
import {
|
import {
|
||||||
getChannelList,
|
getChannelList,
|
||||||
|
|
@ -67,17 +52,22 @@ const getStatusText = (status: number | string) => {
|
||||||
return ['', '正常', '禁用'][status]
|
return ['', '正常', '禁用'][status]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const formRef = ref()
|
||||||
const { loading, startLoading, stopLoading } = usePageLoading()
|
const { loading, startLoading, stopLoading } = usePageLoading()
|
||||||
|
const { buttonLoading: submitLoading, startButtonLoading: startSubmitLoading, stopButtonLoading: stopSubmitLoading } = useButtonLoading()
|
||||||
const initData = async () => {
|
const initData = async () => {
|
||||||
startLoading()
|
try {
|
||||||
const res = await getChannelList()
|
startLoading()
|
||||||
stopLoading()
|
const res = await getChannelList()
|
||||||
console.log(res)
|
console.log(res)
|
||||||
tableData.value = res.map((item: ChannelType) => ({
|
tableData.value = res.map((item: ChannelType) => ({
|
||||||
...item,
|
...item,
|
||||||
statusStr: getStatusText(item.status),
|
statusStr: getStatusText(item.status),
|
||||||
})) as ChannelType[]
|
})) as ChannelType[]
|
||||||
clearSelection()
|
clearSelection()
|
||||||
|
} finally {
|
||||||
|
stopLoading()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//表格数据
|
//表格数据
|
||||||
|
|
@ -107,11 +97,17 @@ const formItems = ref(formItemsData)
|
||||||
const formRules = ref(formRulesData)
|
const formRules = ref(formRulesData)
|
||||||
const optionsMap = ref(optionsMapData)
|
const optionsMap = ref(optionsMapData)
|
||||||
const submitDetail = async () => {
|
const submitDetail = async () => {
|
||||||
dialogVisible.value = false
|
await formRef.value.validate()
|
||||||
if (dialogTitleType.value === 1) {
|
startSubmitLoading();
|
||||||
await createChannel(formData.value)
|
try {
|
||||||
} else {
|
if (dialogTitleType.value === 1) {
|
||||||
await editChannel(formData.value)
|
await createChannel(formData.value)
|
||||||
|
} else {
|
||||||
|
await editChannel(formData.value)
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
dialogVisible.value = false
|
||||||
|
stopSubmitLoading();
|
||||||
}
|
}
|
||||||
await initData()
|
await initData()
|
||||||
}
|
}
|
||||||
|
|
@ -204,4 +200,3 @@ onMounted(() => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ defineOptions({
|
||||||
name: 'RechangeCheck',
|
name: 'RechangeCheck',
|
||||||
})
|
})
|
||||||
|
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
import { onMounted, ref } from 'vue'
|
import { onMounted, ref } from 'vue'
|
||||||
import RechangeSearch from '@/components/common/Search.vue'
|
import RechangeSearch from '@/components/common/Search.vue'
|
||||||
import Table from '@/components/common/Table.vue'
|
import Table from '@/components/common/Table.vue'
|
||||||
|
|
@ -202,10 +202,23 @@ const handleApprove = async () => {
|
||||||
ElMessage.warning('请先选择要通过的记录')
|
ElMessage.warning('请先选择要通过的记录')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
console.log(selectedRows.value)
|
try {
|
||||||
await reviewRechargeOrder({ id: selectedRows.value[0].id, status: '3' })
|
await ElMessageBox.confirm(`是否确认通过该审核?订单号:${selectedRows.value[0].orderNo}`, '审核确认', {
|
||||||
ElMessage.success('审核通过')
|
confirmButtonText: '确认',
|
||||||
await getList()
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
})
|
||||||
|
} catch {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
startLoading()
|
||||||
|
try {
|
||||||
|
await reviewRechargeOrder({ id: selectedRows.value[0].id, status: '3' })
|
||||||
|
await getList()
|
||||||
|
} finally {
|
||||||
|
stopLoading()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 审核驳回:当前保留前端提示,等待后续接接口。
|
// 审核驳回:当前保留前端提示,等待后续接接口。
|
||||||
|
|
@ -214,10 +227,24 @@ const handleReject = async () => {
|
||||||
ElMessage.warning('请先选择要驳回的记录')
|
ElMessage.warning('请先选择要驳回的记录')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
await ElMessageBox.confirm(`是否确认驳回该审核?订单号:${selectedRows.value[0].orderNo}`, '审核确认', {
|
||||||
|
confirmButtonText: '确认',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
})
|
||||||
|
} catch {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
//充值状态:1未审核,2未付款,3已付款,4驳回
|
//充值状态:1未审核,2未付款,3已付款,4驳回
|
||||||
await reviewRechargeOrder({ id: selectedRows.value[0].id, status: '4' })
|
startLoading()
|
||||||
ElMessage.success('审核驳回')
|
try {
|
||||||
await getList()
|
await reviewRechargeOrder({ id: selectedRows.value[0].id, status: '4' })
|
||||||
|
await getList()
|
||||||
|
} finally {
|
||||||
|
stopLoading()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导出:先导出当前页接口数据,后续如需全量导出可切成独立导出接口。
|
// 导出:先导出当前页接口数据,后续如需全量导出可切成独立导出接口。
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
width="700"
|
width="700"
|
||||||
>
|
>
|
||||||
<Form
|
<Form
|
||||||
|
ref="formRef"
|
||||||
:formItems="formItems"
|
:formItems="formItems"
|
||||||
:formRules="formRules"
|
:formRules="formRules"
|
||||||
:formData="formData"
|
:formData="formData"
|
||||||
|
|
@ -27,7 +28,7 @@
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
<el-button @click="dialogVisible = false">取消</el-button>
|
<el-button @click="dialogVisible = false">取消</el-button>
|
||||||
<el-button type="primary" @click="submitDetail">确认</el-button>
|
<el-button type="primary" :loading="submitLoading" @click="submitDetail">确认</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
@ -40,7 +41,7 @@ defineOptions({
|
||||||
//组件
|
//组件
|
||||||
import Table from '@/components/common/Table.vue'
|
import Table from '@/components/common/Table.vue'
|
||||||
import Form from '@/components/common/Form.vue'
|
import Form from '@/components/common/Form.vue'
|
||||||
import { usePageLoading } from '@/composables/useLoading'
|
import { usePageLoading, useButtonLoading } from '@/composables/useLoading'
|
||||||
import { tableColumns, formItemsData, formRulesData, optionsMapData } from './options'
|
import { tableColumns, formItemsData, formRulesData, optionsMapData } from './options'
|
||||||
import {
|
import {
|
||||||
getChannelWithdrawList,
|
getChannelWithdrawList,
|
||||||
|
|
@ -67,7 +68,9 @@ const getStatusText = (status: number | string) => {
|
||||||
return ['', '正常', '禁用'][status]
|
return ['', '正常', '禁用'][status]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const formRef = ref()
|
||||||
const { loading, startLoading, stopLoading } = usePageLoading()
|
const { loading, startLoading, stopLoading } = usePageLoading()
|
||||||
|
const { buttonLoading: submitLoading, startButtonLoading: startSubmitLoading, stopButtonLoading: stopSubmitLoading } = useButtonLoading()
|
||||||
const initData = async () => {
|
const initData = async () => {
|
||||||
startLoading()
|
startLoading()
|
||||||
const res = await getChannelWithdrawList()
|
const res = await getChannelWithdrawList()
|
||||||
|
|
@ -101,13 +104,19 @@ const formItems = ref(formItemsData)
|
||||||
const formRules = ref(formRulesData)
|
const formRules = ref(formRulesData)
|
||||||
const optionsMap = ref(optionsMapData)
|
const optionsMap = ref(optionsMapData)
|
||||||
const submitDetail = async () => {
|
const submitDetail = async () => {
|
||||||
dialogVisible.value = false
|
await formRef.value.validate()
|
||||||
if (dialogTitleType.value === 1) {
|
startSubmitLoading();
|
||||||
await createChannelWithdraw(formData.value)
|
try {
|
||||||
} else {
|
dialogVisible.value = false
|
||||||
await editChannelWithdraw(formData.value)
|
if (dialogTitleType.value === 1) {
|
||||||
|
await createChannelWithdraw(formData.value)
|
||||||
|
} else {
|
||||||
|
await editChannelWithdraw(formData.value)
|
||||||
|
}
|
||||||
|
await initData()
|
||||||
|
} finally {
|
||||||
|
stopSubmitLoading();
|
||||||
}
|
}
|
||||||
await initData()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let currentRow: any = {}
|
let currentRow: any = {}
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
<el-button @click="dialogVisible = false">取消</el-button>
|
<el-button @click="dialogVisible = false">取消</el-button>
|
||||||
<el-button type="primary" @click="submit">确认</el-button>
|
<el-button type="primary" :loading="submitLoading" @click="submit">确认</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
@ -41,7 +41,7 @@
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
<el-button @click="detaildialogVisible = false">取消</el-button>
|
<el-button @click="detaildialogVisible = false">取消</el-button>
|
||||||
<el-button type="primary" @click="submitDetail">确认</el-button>
|
<el-button type="primary" :loading="submitDetailLoading" @click="submitDetail">确认</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
@ -55,7 +55,7 @@ defineOptions({
|
||||||
})
|
})
|
||||||
|
|
||||||
import { ref, onMounted } from 'vue'
|
import { ref, onMounted } from 'vue'
|
||||||
import { usePageLoading } from '@/composables/useLoading'
|
import { usePageLoading, useButtonLoading } from '@/composables/useLoading'
|
||||||
import {
|
import {
|
||||||
getFeeSettingList,
|
getFeeSettingList,
|
||||||
getFeeSettingDetail,
|
getFeeSettingDetail,
|
||||||
|
|
@ -86,7 +86,9 @@ const detaildialogVisible = ref(false)
|
||||||
|
|
||||||
// 加载状态
|
// 加载状态
|
||||||
const { loading, startLoading, stopLoading } = usePageLoading()
|
const { loading, startLoading, stopLoading } = usePageLoading()
|
||||||
const detailLoading = ref(false)
|
const { buttonLoading: detailLoading, startButtonLoading: startDetailLoading, stopButtonLoading: stopDetailLoading } = useButtonLoading()
|
||||||
|
const { buttonLoading: submitLoading, startButtonLoading: startSubmitLoading, stopButtonLoading: stopSubmitLoading } = useButtonLoading()
|
||||||
|
const { buttonLoading: submitDetailLoading, startButtonLoading: startSubmitDetailLoading, stopButtonLoading: stopSubmitDetailLoading } = useButtonLoading()
|
||||||
|
|
||||||
// 主表格相关
|
// 主表格相关
|
||||||
const tableData = ref<any[]>([])
|
const tableData = ref<any[]>([])
|
||||||
|
|
@ -156,12 +158,12 @@ const handleTableDataAfterLoad = () => {
|
||||||
|
|
||||||
// 获取详情数据
|
// 获取详情数据
|
||||||
const fetchItemDetail = async (id: number) => {
|
const fetchItemDetail = async (id: number) => {
|
||||||
detailLoading.value = true
|
startDetailLoading();
|
||||||
try {
|
try {
|
||||||
const res = await getFeeSettingDetail({ id })
|
const res = await getFeeSettingDetail({ id })
|
||||||
tableDataDetail.value = res || []
|
tableDataDetail.value = res || []
|
||||||
} finally {
|
} finally {
|
||||||
detailLoading.value = false
|
stopDetailLoading();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -199,14 +201,19 @@ const changeStatus = (status: number) => {
|
||||||
|
|
||||||
// 提交主表单
|
// 提交主表单
|
||||||
const submit = async () => {
|
const submit = async () => {
|
||||||
if (dialogTitleType.value === 1) {
|
startSubmitLoading();
|
||||||
await createFeeSetting(formData.value)
|
try {
|
||||||
} else {
|
if (dialogTitleType.value === 1) {
|
||||||
await editFeeSetting(formData.value)
|
await createFeeSetting(formData.value)
|
||||||
|
} else {
|
||||||
|
await editFeeSetting(formData.value)
|
||||||
|
}
|
||||||
|
resetFormData()
|
||||||
|
dialogVisible.value = false
|
||||||
|
getTableData()
|
||||||
|
} finally {
|
||||||
|
stopSubmitLoading();
|
||||||
}
|
}
|
||||||
resetFormData()
|
|
||||||
dialogVisible.value = false
|
|
||||||
getTableData()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 打开编辑详情弹窗
|
// 打开编辑详情弹窗
|
||||||
|
|
@ -216,19 +223,24 @@ const editFeeDetail = () => {
|
||||||
|
|
||||||
// 提交详情表单
|
// 提交详情表单
|
||||||
const submitDetail = async () => {
|
const submitDetail = async () => {
|
||||||
const contentsJson: Record<string, any> = {}
|
startSubmitDetailLoading();
|
||||||
|
try {
|
||||||
|
const contentsJson: Record<string, any> = {}
|
||||||
|
|
||||||
tableDataDetail.value.forEach((item) => {
|
tableDataDetail.value.forEach((item) => {
|
||||||
contentsJson[item.variety_id] = item.fee
|
contentsJson[item.variety_id] = item.fee
|
||||||
})
|
})
|
||||||
|
|
||||||
await setFeeSettingDetail({
|
await setFeeSettingDetail({
|
||||||
id: currentRow.value.id,
|
id: currentRow.value.id,
|
||||||
contents_json: JSON.stringify(contentsJson),
|
contents_json: JSON.stringify(contentsJson),
|
||||||
})
|
})
|
||||||
|
|
||||||
detaildialogVisible.value = false
|
detaildialogVisible.value = false
|
||||||
getTableData()
|
getTableData()
|
||||||
|
} finally {
|
||||||
|
stopSubmitDetailLoading();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
</RiskTableContent>
|
</RiskTableContent>
|
||||||
</div>
|
</div>
|
||||||
<!-- dialog -->
|
<!-- dialog -->
|
||||||
<RiskDialog :visible="dialogVisible" :title="dialogTitle" :type="dialogType" @confirm="handleSubmit"
|
<RiskDialog :visible="dialogVisible" :title="dialogTitle" :type="dialogType" :button-loading="submitLoading" @confirm="handleSubmit"
|
||||||
@cancel="handleCancel" @close="handleClose">
|
@cancel="handleCancel" @close="handleClose">
|
||||||
<RiskForm :form-data="dialogForm" :form-rules="riskRules" :form-items="RiskFormItems"
|
<RiskForm :form-data="dialogForm" :form-rules="riskRules" :form-items="RiskFormItems"
|
||||||
:options-map="riskFormOptionsMap" :row-gutter="rowGutter" :col-span="colSpan" ref="riskFormRef" />
|
:options-map="riskFormOptionsMap" :row-gutter="rowGutter" :col-span="colSpan" ref="riskFormRef" />
|
||||||
|
|
@ -37,8 +37,9 @@ defineOptions({
|
||||||
name: 'Risk'
|
name: 'Risk'
|
||||||
})
|
})
|
||||||
// 组件
|
// 组件
|
||||||
import { usePageLoading } from '@/composables/useLoading'
|
import { usePageLoading, useButtonLoading } from '@/composables/useLoading'
|
||||||
const { loading, startLoading, stopLoading } = usePageLoading()
|
const { loading, startLoading, stopLoading } = usePageLoading()
|
||||||
|
const { buttonLoading: submitLoading, startButtonLoading: startSubmitLoading, stopButtonLoading: stopSubmitLoading } = useButtonLoading()
|
||||||
|
|
||||||
import RiskTableSwitch from '@/components/common/Table.vue'
|
import RiskTableSwitch from '@/components/common/Table.vue'
|
||||||
import RiskTableContent from '@/components/common/Table.vue'
|
import RiskTableContent from '@/components/common/Table.vue'
|
||||||
|
|
@ -283,52 +284,57 @@ const handleRowClick = (row: any) => {
|
||||||
* @description: 定义弹窗方法
|
* @description: 定义弹窗方法
|
||||||
*/
|
*/
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
await riskFormRef.value?.validate()
|
startSubmitLoading()
|
||||||
const params = {
|
try {
|
||||||
name: dialogForm.value.name,
|
await riskFormRef.value?.validate()
|
||||||
status: dialogForm.value.status,
|
const params = {
|
||||||
// 是否默认
|
name: dialogForm.value.name,
|
||||||
is_default: dialogForm.value.isDefault,
|
status: dialogForm.value.status,
|
||||||
// 单笔开仓最大数量
|
// 是否默认
|
||||||
max_opening_quantity_per_transaction: dialogForm.value.maxOpenPosition,
|
is_default: dialogForm.value.isDefault,
|
||||||
// 单品种最大持仓数量
|
// 单笔开仓最大数量
|
||||||
max_holding_quantity_per_variety: dialogForm.value.maxPositionPerSymbol,
|
max_opening_quantity_per_transaction: dialogForm.value.maxOpenPosition,
|
||||||
// 总品种最大持仓数量
|
// 单品种最大持仓数量
|
||||||
max_holding_quantity_per_transaction: dialogForm.value.maxTotalPosition,
|
max_holding_quantity_per_variety: dialogForm.value.maxPositionPerSymbol,
|
||||||
// 强平比例
|
// 总品种最大持仓数量
|
||||||
strong_to_average_ratio: dialogForm.value.strongCloseRatio,
|
max_holding_quantity_per_transaction: dialogForm.value.maxTotalPosition,
|
||||||
// 每次出金最大金额
|
// 强平比例
|
||||||
max_withdrawal_amount_per_transaction: dialogForm.value.maxWithdrawalAmount,
|
strong_to_average_ratio: dialogForm.value.strongCloseRatio,
|
||||||
// 是否允许出金
|
// 每次出金最大金额
|
||||||
withdraw_status: dialogForm.value.isWithdrawalAllowed,
|
max_withdrawal_amount_per_transaction: dialogForm.value.maxWithdrawalAmount,
|
||||||
// 出金时间设置
|
// 是否允许出金
|
||||||
withdraw_time: Array.from(dialogForm.value.withdrawalTimeSetting || []).join('-'),
|
withdraw_status: dialogForm.value.isWithdrawalAllowed,
|
||||||
// 是否需要出金审核
|
// 出金时间设置
|
||||||
withdraw_is_check: dialogForm.value.isWithdrawalAuditRequired,
|
withdraw_time: Array.from(dialogForm.value.withdrawalTimeSetting || []).join('-'),
|
||||||
// 建仓多少秒不能平仓
|
// 是否需要出金审核
|
||||||
open_close_time: dialogForm.value.buildCloseTime,
|
withdraw_is_check: dialogForm.value.isWithdrawalAuditRequired,
|
||||||
// 每次出金最小金额
|
// 建仓多少秒不能平仓
|
||||||
min_withdrawal_amount_per_transaction: dialogForm.value.minWithdrawalAmount,
|
open_close_time: dialogForm.value.buildCloseTime,
|
||||||
// 滑点
|
// 每次出金最小金额
|
||||||
slippage: dialogForm.value.slippage,
|
min_withdrawal_amount_per_transaction: dialogForm.value.minWithdrawalAmount,
|
||||||
// 每次入金最小金额
|
// 滑点
|
||||||
min_recharge_amount_per_transaction: dialogForm.value.minDepositAmount,
|
slippage: dialogForm.value.slippage,
|
||||||
}
|
// 每次入金最小金额
|
||||||
// 添加风险控制
|
min_recharge_amount_per_transaction: dialogForm.value.minDepositAmount,
|
||||||
if (dialogType.value === 'add') {
|
}
|
||||||
// 添加风险控制
|
// 添加风险控制
|
||||||
await addRiskApi(params)
|
if (dialogType.value === 'add') {
|
||||||
getRiskList()
|
// 添加风险控制
|
||||||
dialogVisible.value = false
|
await addRiskApi(params)
|
||||||
dialogTitle.value = '添加'
|
getRiskList()
|
||||||
dialogType.value = 'add'
|
dialogVisible.value = false
|
||||||
} else {
|
dialogTitle.value = '添加'
|
||||||
// 编辑风险控制
|
dialogType.value = 'add'
|
||||||
await editRiskApi({ ...params, id: selectedRow.value.id })
|
} else {
|
||||||
getRiskList()
|
// 编辑风险控制
|
||||||
dialogVisible.value = false
|
await editRiskApi({ ...params, id: selectedRow.value.id })
|
||||||
dialogTitle.value = '编辑'
|
getRiskList()
|
||||||
dialogType.value = 'edit'
|
dialogVisible.value = false
|
||||||
|
dialogTitle.value = '编辑'
|
||||||
|
dialogType.value = 'edit'
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
stopSubmitLoading()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const handleCancel = () => {
|
const handleCancel = () => {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="table_form-container">
|
<div class="table_form-container">
|
||||||
<!-- 搜索 -->
|
<!-- 搜索 -->
|
||||||
<CustomerListSearch :search-form="searchForm" :search-options="searchOptions" @search="handleSearch"
|
<CustomerListSearch :buttonLoading="loading" :search-form="searchForm" :search-options="searchOptions" @search="handleSearch"
|
||||||
@reset="handleReset"></CustomerListSearch>
|
@reset="handleReset"></CustomerListSearch>
|
||||||
<!-- 表格 -->
|
<!-- 表格 -->
|
||||||
<CustomerListTable :table-data="tableTree" :columns="tableColumnsOptions" row-key="userId"
|
<CustomerListTable :table-data="tableTree" :columns="tableColumnsOptions" row-key="userId"
|
||||||
|
|
@ -37,7 +37,7 @@
|
||||||
@pagination-change="handlePaginationChange" />
|
@pagination-change="handlePaginationChange" />
|
||||||
<!-- dialog -->
|
<!-- dialog -->
|
||||||
<CustomerListDialog :visible="dialogVisible" :title="dialogTitle" :type="dialogType" :fullscreen="dialogFullscreen"
|
<CustomerListDialog :visible="dialogVisible" :title="dialogTitle" :type="dialogType" :fullscreen="dialogFullscreen"
|
||||||
:show-footer="dialogType !== 'view'" @confirm="handleSubmit" @cancel="handleCancel" @close="handleClose">
|
:show-footer="dialogType !== 'view'" :button-loading="submitLoading" @confirm="handleSubmit" @cancel="handleCancel" @close="handleClose">
|
||||||
<CustomerListTable :table-data="marginRatioTree" :columns="marginRatioTableColumnsOptions" row-key="id"
|
<CustomerListTable :table-data="marginRatioTree" :columns="marginRatioTableColumnsOptions" row-key="id"
|
||||||
v-if="dialogType === 'editMarginRatio'" style="height: 500px">
|
v-if="dialogType === 'editMarginRatio'" style="height: 500px">
|
||||||
<template #assignedPointDiff="{ row }">
|
<template #assignedPointDiff="{ row }">
|
||||||
|
|
@ -54,7 +54,7 @@
|
||||||
</CustomerListDialog>
|
</CustomerListDialog>
|
||||||
|
|
||||||
<!-- 调整金额弹窗 -->
|
<!-- 调整金额弹窗 -->
|
||||||
<CustomerListDialog :visible="adjustAmountVisible" title="调整金额" type="adjust" @confirm="handleAdjustAmountSubmit"
|
<CustomerListDialog :visible="adjustAmountVisible" title="调整金额" type="adjust" :button-loading="adjustAmountLoading" @confirm="handleAdjustAmountSubmit"
|
||||||
@cancel="handleAdjustAmountCancel" @close="handleAdjustAmountClose">
|
@cancel="handleAdjustAmountCancel" @close="handleAdjustAmountClose">
|
||||||
<el-form :model="adjustAmountForm" :rules="adjustAmountRules" ref="adjustAmountFormRef" label-width="120px">
|
<el-form :model="adjustAmountForm" :rules="adjustAmountRules" ref="adjustAmountFormRef" label-width="120px">
|
||||||
<el-form-item label="账号名" prop="username">
|
<el-form-item label="账号名" prop="username">
|
||||||
|
|
@ -78,7 +78,7 @@
|
||||||
|
|
||||||
<!-- 修改客户弹窗 -->
|
<!-- 修改客户弹窗 -->
|
||||||
<CustomerListDialog :visible="editCustomerVisible" title="修改客户" type="editCustomer"
|
<CustomerListDialog :visible="editCustomerVisible" title="修改客户" type="editCustomer"
|
||||||
@confirm="handleEditCustomerSubmit" @cancel="handleEditCustomerCancel" @close="handleEditCustomerClose">
|
:button-loading="editCustomerLoading" @confirm="handleEditCustomerSubmit" @cancel="handleEditCustomerCancel" @close="handleEditCustomerClose">
|
||||||
<el-form :model="editCustomerForm" :rules="editCustomerRules" ref="editCustomerFormRef" label-width="140px">
|
<el-form :model="editCustomerForm" :rules="editCustomerRules" ref="editCustomerFormRef" label-width="140px">
|
||||||
<el-form-item label="手续费模板" prop="feeSettingId">
|
<el-form-item label="手续费模板" prop="feeSettingId">
|
||||||
<el-select v-model="editCustomerForm.feeSettingId" placeholder="请选择手续费模板" style="width: 100%">
|
<el-select v-model="editCustomerForm.feeSettingId" placeholder="请选择手续费模板" style="width: 100%">
|
||||||
|
|
@ -112,7 +112,7 @@ defineOptions({
|
||||||
// 组件
|
// 组件
|
||||||
import CustomerListSearch from '@/components/common/Search.vue'
|
import CustomerListSearch from '@/components/common/Search.vue'
|
||||||
import CustomerListTable from '@/components/common/Table.vue'
|
import CustomerListTable from '@/components/common/Table.vue'
|
||||||
import { usePageLoading } from '@/composables/useLoading'
|
import { usePageLoading, useButtonLoading } from '@/composables/useLoading'
|
||||||
import CustomerListPagination from '@/components/common/Pagination.vue'
|
import CustomerListPagination from '@/components/common/Pagination.vue'
|
||||||
import CustomerListDialog from '@/components/common/Dialog.vue'
|
import CustomerListDialog from '@/components/common/Dialog.vue'
|
||||||
import CustomerListForm from '@/components/common/Form.vue'
|
import CustomerListForm from '@/components/common/Form.vue'
|
||||||
|
|
@ -147,6 +147,9 @@ const searchOptions = ref(search)
|
||||||
const tableColumnsOptions = ref(tableColumns)
|
const tableColumnsOptions = ref(tableColumns)
|
||||||
|
|
||||||
const { loading, startLoading, stopLoading } = usePageLoading()
|
const { loading, startLoading, stopLoading } = usePageLoading()
|
||||||
|
const { buttonLoading: submitLoading, startButtonLoading: startSubmitLoading, stopButtonLoading: stopSubmitLoading } = useButtonLoading()
|
||||||
|
const { buttonLoading: adjustAmountLoading, startButtonLoading: startAdjustAmountLoading, stopButtonLoading: stopAdjustAmountLoading } = useButtonLoading()
|
||||||
|
const { buttonLoading: editCustomerLoading, startButtonLoading: startEditCustomerLoading, stopButtonLoading: stopEditCustomerLoading } = useButtonLoading()
|
||||||
/**
|
/**
|
||||||
* @description: 定义表格数据
|
* @description: 定义表格数据
|
||||||
*/
|
*/
|
||||||
|
|
@ -442,54 +445,58 @@ const handlePaginationChange = (page: { currentPage: number; pageSize: number })
|
||||||
/**
|
/**
|
||||||
* @description: 定义弹窗方法
|
* @description: 定义弹窗方法
|
||||||
*/
|
*/
|
||||||
//提交
|
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
const params = {
|
startSubmitLoading()
|
||||||
user_id: selectId.value,
|
try {
|
||||||
toucun_percent: '',
|
const params = {
|
||||||
point_diffs_json: '',
|
user_id: selectId.value,
|
||||||
fee_handling_percent: '',
|
toucun_percent: '',
|
||||||
fee_setting_id: '',
|
point_diffs_json: '',
|
||||||
risk_control_id: '',
|
fee_handling_percent: '',
|
||||||
}
|
fee_setting_id: '',
|
||||||
if (dialogType.value === 'editMarginRatio') {
|
risk_control_id: '',
|
||||||
// 逐行验证
|
}
|
||||||
for (const row of marginRatioTree.value) {
|
if (dialogType.value === 'editMarginRatio') {
|
||||||
const form = formRefs.value[(row as any).id]
|
// 逐行验证
|
||||||
if (!form) continue
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//转换为接口需要的格式 { id: assignedPointDifference }
|
||||||
|
const marginRatioJSON = marginRatioTree.value.reduce((acc: any, cur: any) => {
|
||||||
|
acc[cur.id] = cur.assignedPointDifference * 1
|
||||||
|
return acc
|
||||||
|
}, {})
|
||||||
|
|
||||||
|
// 调用接口
|
||||||
try {
|
try {
|
||||||
await form.validate()
|
await editCustomerApi({ ...params, point_diffs_json: JSON.stringify(marginRatioJSON) })
|
||||||
|
dialogVisible.value = false
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(`第 ${(row as any).id} 行验证不通过,请检查`)
|
console.log('提交失败:', err)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//转换为接口需要的格式 { id: assignedPointDifference }
|
if (dialogType.value === 'editCommissionRatio') {
|
||||||
const marginRatioJSON = marginRatioTree.value.reduce((acc: any, cur: any) => {
|
await commissionRatioFormRef.value.validate()
|
||||||
acc[cur.id] = cur.assignedPointDifference * 1
|
try {
|
||||||
return acc
|
await editCustomerApi({
|
||||||
}, {})
|
...params,
|
||||||
|
fee_handling_percent: commissionRatioForm.value.commissionRatio,
|
||||||
// 调用接口
|
})
|
||||||
try {
|
dialogVisible.value = false
|
||||||
await editCustomerApi({ ...params, point_diffs_json: JSON.stringify(marginRatioJSON) })
|
await getCustomerList()
|
||||||
dialogVisible.value = false
|
} catch (err) {
|
||||||
} catch (err) {
|
console.log('提交失败:', err)
|
||||||
console.log('提交失败:', err)
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
if (dialogType.value === 'editCommissionRatio') {
|
|
||||||
await commissionRatioFormRef.value.validate()
|
|
||||||
try {
|
|
||||||
await editCustomerApi({
|
|
||||||
...params,
|
|
||||||
fee_handling_percent: commissionRatioForm.value.commissionRatio,
|
|
||||||
})
|
|
||||||
dialogVisible.value = false
|
|
||||||
await getCustomerList()
|
|
||||||
} catch (err) {
|
|
||||||
console.log('提交失败:', err)
|
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
stopSubmitLoading()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 取消
|
// 取消
|
||||||
|
|
@ -531,6 +538,7 @@ const handleAdjustAmountInput = () => {
|
||||||
|
|
||||||
// 提交调整金额
|
// 提交调整金额
|
||||||
const handleAdjustAmountSubmit = async () => {
|
const handleAdjustAmountSubmit = async () => {
|
||||||
|
startAdjustAmountLoading()
|
||||||
try {
|
try {
|
||||||
await adjustAmountFormRef.value?.validate()
|
await adjustAmountFormRef.value?.validate()
|
||||||
await updateCapitalApi({
|
await updateCapitalApi({
|
||||||
|
|
@ -541,6 +549,8 @@ const handleAdjustAmountSubmit = async () => {
|
||||||
adjustAmountVisible.value = false
|
adjustAmountVisible.value = false
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('调整金额表单验证失败', err)
|
console.error('调整金额表单验证失败', err)
|
||||||
|
} finally {
|
||||||
|
stopAdjustAmountLoading()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -602,6 +612,7 @@ const handleEditCustomer = async (row: any) => {
|
||||||
|
|
||||||
// 提交修改客户
|
// 提交修改客户
|
||||||
const handleEditCustomerSubmit = async () => {
|
const handleEditCustomerSubmit = async () => {
|
||||||
|
startEditCustomerLoading()
|
||||||
try {
|
try {
|
||||||
await editCustomerFormRef.value?.validate()
|
await editCustomerFormRef.value?.validate()
|
||||||
await editUserApi({
|
await editUserApi({
|
||||||
|
|
@ -616,6 +627,8 @@ const handleEditCustomerSubmit = async () => {
|
||||||
editCustomerVisible.value = false
|
editCustomerVisible.value = false
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('修改客户表单验证失败', err)
|
console.error('修改客户表单验证失败', err)
|
||||||
|
} finally {
|
||||||
|
stopEditCustomerLoading()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
<!-- 搜索 -->
|
<!-- 搜索 -->
|
||||||
<MarketSearch
|
<MarketSearch
|
||||||
:search-form="marketSearchForm"
|
:search-form="marketSearchForm"
|
||||||
|
:buttonLoading="loading"
|
||||||
:search-options="marketSearchOptions"
|
:search-options="marketSearchOptions"
|
||||||
@search="handleSearch"
|
@search="handleSearch"
|
||||||
@reset="handleReset"
|
@reset="handleReset"
|
||||||
|
|
@ -196,7 +197,7 @@ defineOptions({
|
||||||
// 组件
|
// 组件
|
||||||
import MarketSearch from '@/components/common/Search.vue'
|
import MarketSearch from '@/components/common/Search.vue'
|
||||||
import MarketTable from '@/components/common/Table.vue'
|
import MarketTable from '@/components/common/Table.vue'
|
||||||
import { usePageLoading } from '@/composables/useLoading'
|
import { usePageLoading, useButtonLoading } from '@/composables/useLoading'
|
||||||
import MarketPagination from '@/components/common/Pagination.vue'
|
import MarketPagination from '@/components/common/Pagination.vue'
|
||||||
import MarketDialog from '@/components/common/Dialog.vue'
|
import MarketDialog from '@/components/common/Dialog.vue'
|
||||||
import MarketForm from '@/components/common/Form.vue'
|
import MarketForm from '@/components/common/Form.vue'
|
||||||
|
|
@ -242,6 +243,7 @@ const marketSearchForm = ref({
|
||||||
const marketSearchOptions = ref(marketSearch)
|
const marketSearchOptions = ref(marketSearch)
|
||||||
|
|
||||||
const { loading, startLoading, stopLoading } = usePageLoading()
|
const { loading, startLoading, stopLoading } = usePageLoading()
|
||||||
|
const { buttonLoading: submitLoading, startButtonLoading: startSubmitLoading, stopButtonLoading: stopSubmitLoading } = useButtonLoading()
|
||||||
/**
|
/**
|
||||||
* @description 定义表格数据
|
* @description 定义表格数据
|
||||||
*/
|
*/
|
||||||
|
|
@ -801,55 +803,60 @@ const formatPointDiffToObject = () => {
|
||||||
|
|
||||||
//提交
|
//提交
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
// console.log('提交', marketPointTree.value);
|
startSubmitLoading()
|
||||||
await marketFormRef.value?.validate()
|
try {
|
||||||
const pointDiffObj = formatPointDiffToObject()
|
// console.log('提交', marketPointTree.value);
|
||||||
console.log('pointDiffObj', pointDiffObj)
|
await marketFormRef.value?.validate()
|
||||||
if (!pointDiffObj) return
|
const pointDiffObj = formatPointDiffToObject()
|
||||||
if (dialogType.value === 'add') {
|
console.log('pointDiffObj', pointDiffObj)
|
||||||
const params: Record<string, any> = {
|
if (!pointDiffObj) return
|
||||||
role_id: marketForm.value.level,
|
if (dialogType.value === 'add') {
|
||||||
reg_type: activeTab.value === 'email' ? '1' : '2',
|
const params: Record<string, any> = {
|
||||||
username: marketForm.value.accountName,
|
role_id: marketForm.value.level,
|
||||||
par_user_id: marketForm.value.parentAccountName,
|
reg_type: activeTab.value === 'email' ? '1' : '2',
|
||||||
mobile: activeTab.value === 'phone' ? marketForm.value.phone : '',
|
username: marketForm.value.accountName,
|
||||||
email: activeTab.value === 'email' ? marketForm.value.email : '',
|
par_user_id: marketForm.value.parentAccountName,
|
||||||
password: '888888',
|
mobile: activeTab.value === 'phone' ? marketForm.value.phone : '',
|
||||||
toucun_percent: marketForm.value.positionRatio,
|
email: activeTab.value === 'email' ? marketForm.value.email : '',
|
||||||
fee_handling_percent: marketForm.value.commissionRatio,
|
password: '888888',
|
||||||
point_diffs_json: JSON.stringify(pointDiffObj),
|
toucun_percent: marketForm.value.positionRatio,
|
||||||
risk_control_id: marketForm.value.riskControlTemplate,
|
fee_handling_percent: marketForm.value.commissionRatio,
|
||||||
fee_setting_id: '',
|
point_diffs_json: JSON.stringify(pointDiffObj),
|
||||||
|
risk_control_id: marketForm.value.riskControlTemplate,
|
||||||
|
fee_setting_id: '',
|
||||||
|
}
|
||||||
|
if (marketForm.value.level === '5') params.flag = 1
|
||||||
|
if (marketForm.value.level === '6') {
|
||||||
|
params.flag = 2
|
||||||
|
params.role_id = '5'
|
||||||
|
}
|
||||||
|
await addMarketApi(params)
|
||||||
|
// 5. 刷新表格数据
|
||||||
|
await getMarketList()
|
||||||
|
dialogVisible.value = false
|
||||||
|
marketForm.value = { ...initMarketForm }
|
||||||
|
} else if (dialogType.value === 'edit') {
|
||||||
|
let flag = null
|
||||||
|
if (selectedRow.value.role_id * 1 === 5 && selectedRow.value.type * 1 === 1) flag = 1
|
||||||
|
if (selectedRow.value.role_id * 1 === 6 && selectedRow.value.type * 1 === 2) flag = 2
|
||||||
|
const params = {
|
||||||
|
user_id: selectedRow.value.id,
|
||||||
|
toucun_percent: marketForm.value.positionRatio,
|
||||||
|
point_diffs_json: JSON.stringify(pointDiffObj),
|
||||||
|
risk_control_id: marketForm.value.riskControlTemplate,
|
||||||
|
fee_handling_percent: marketForm.value.commissionRatio,
|
||||||
|
flag: flag,
|
||||||
|
fee_setting_id: '',
|
||||||
|
}
|
||||||
|
// 4. 调用编辑接口
|
||||||
|
await editMarketApi(params)
|
||||||
|
// 5. 刷新表格数据
|
||||||
|
await getMarketList()
|
||||||
|
dialogVisible.value = false
|
||||||
|
marketForm.value = { ...initMarketForm }
|
||||||
}
|
}
|
||||||
if (marketForm.value.level === '5') params.flag = 1
|
} finally {
|
||||||
if (marketForm.value.level === '6') {
|
stopSubmitLoading()
|
||||||
params.flag = 2
|
|
||||||
params.role_id = '5'
|
|
||||||
}
|
|
||||||
await addMarketApi(params)
|
|
||||||
// 5. 刷新表格数据
|
|
||||||
await getMarketList()
|
|
||||||
dialogVisible.value = false
|
|
||||||
marketForm.value = { ...initMarketForm }
|
|
||||||
} else if (dialogType.value === 'edit') {
|
|
||||||
let flag = null
|
|
||||||
if (selectedRow.value.role_id * 1 === 5 && selectedRow.value.type * 1 === 1) flag = 1
|
|
||||||
if (selectedRow.value.role_id * 1 === 6 && selectedRow.value.type * 1 === 2) flag = 2
|
|
||||||
const params = {
|
|
||||||
user_id: selectedRow.value.id,
|
|
||||||
toucun_percent: marketForm.value.positionRatio,
|
|
||||||
point_diffs_json: JSON.stringify(pointDiffObj),
|
|
||||||
risk_control_id: marketForm.value.riskControlTemplate,
|
|
||||||
fee_handling_percent: marketForm.value.commissionRatio,
|
|
||||||
flag: flag,
|
|
||||||
fee_setting_id: '',
|
|
||||||
}
|
|
||||||
// 4. 调用编辑接口
|
|
||||||
await editMarketApi(params)
|
|
||||||
// 5. 刷新表格数据
|
|
||||||
await getMarketList()
|
|
||||||
dialogVisible.value = false
|
|
||||||
marketForm.value = { ...initMarketForm }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 编辑弹窗 -->
|
<!-- 编辑弹窗 -->
|
||||||
<Dialog :visible="dialogVisible" :title="dialogTitle" width="500px" @confirm="handleEditConfirm"
|
<Dialog :visible="dialogVisible" :title="dialogTitle" width="500px" :button-loading="editLoading" @confirm="handleEditConfirm"
|
||||||
@cancel="handleEditDialogReset" @close="handleEditDialogReset">
|
@cancel="handleEditDialogReset" @close="handleEditDialogReset">
|
||||||
<el-form ref="editFormRef" :model="editForm" :rules="getEditRules()" label-width="80px" label-position="top">
|
<el-form ref="editFormRef" :model="editForm" :rules="getEditRules()" label-width="80px" label-position="top">
|
||||||
<el-form-item v-if="editField === 'mobile'" :label="editForm.label" prop="value" class="phone-item">
|
<el-form-item v-if="editField === 'mobile'" :label="editForm.label" prop="value" class="phone-item">
|
||||||
|
|
@ -96,7 +96,7 @@
|
||||||
|
|
||||||
<!-- 密码修改弹窗 → 验证码模式 -->
|
<!-- 密码修改弹窗 → 验证码模式 -->
|
||||||
<Dialog :visible="passwordDialogVisible" :title="t('personalCenter.modifyPassword')" width="500px"
|
<Dialog :visible="passwordDialogVisible" :title="t('personalCenter.modifyPassword')" width="500px"
|
||||||
@confirm="handlePasswordConfirm" @cancel="handlePasswordDialogReset" @close="handlePasswordDialogReset">
|
:button-loading="passwordLoading" @confirm="handlePasswordConfirm" @cancel="handlePasswordDialogReset" @close="handlePasswordDialogReset">
|
||||||
<el-form ref="passwordFormRef" :model="passwordForm" :rules="passwordFormRules" label-width="100px"
|
<el-form ref="passwordFormRef" :model="passwordForm" :rules="passwordFormRules" label-width="100px"
|
||||||
label-position="top">
|
label-position="top">
|
||||||
<!-- 选择验证方式 -->
|
<!-- 选择验证方式 -->
|
||||||
|
|
@ -174,6 +174,8 @@ import {
|
||||||
updatePwdByCaptchaApi
|
updatePwdByCaptchaApi
|
||||||
} from '@/api/modules/profile/personalCenter';
|
} from '@/api/modules/profile/personalCenter';
|
||||||
|
|
||||||
|
import { useButtonLoading } from '@/composables/useLoading';
|
||||||
|
|
||||||
const userInfo = reactive<UserInfo>({
|
const userInfo = reactive<UserInfo>({
|
||||||
id: 0,
|
id: 0,
|
||||||
username: '',
|
username: '',
|
||||||
|
|
@ -186,6 +188,8 @@ const userInfo = reactive<UserInfo>({
|
||||||
|
|
||||||
const dialogVisible = ref(false);
|
const dialogVisible = ref(false);
|
||||||
const passwordDialogVisible = ref(false);
|
const passwordDialogVisible = ref(false);
|
||||||
|
const { buttonLoading: editLoading, startButtonLoading: startEditLoading, stopButtonLoading: stopEditLoading } = useButtonLoading();
|
||||||
|
const { buttonLoading: passwordLoading, startButtonLoading: startPasswordLoading, stopButtonLoading: stopPasswordLoading } = useButtonLoading();
|
||||||
const editFormRef = ref<FormInstance>();
|
const editFormRef = ref<FormInstance>();
|
||||||
const passwordFormRef = ref<FormInstance>();
|
const passwordFormRef = ref<FormInstance>();
|
||||||
const editField = ref<string>('');
|
const editField = ref<string>('');
|
||||||
|
|
@ -399,6 +403,7 @@ const handleLanguageChange = async (val: number) => {
|
||||||
// 提交修改
|
// 提交修改
|
||||||
const handleEditConfirm = async () => {
|
const handleEditConfirm = async () => {
|
||||||
if (!editFormRef.value) return;
|
if (!editFormRef.value) return;
|
||||||
|
startEditLoading();
|
||||||
try {
|
try {
|
||||||
await editFormRef.value.validate();
|
await editFormRef.value.validate();
|
||||||
|
|
||||||
|
|
@ -425,6 +430,8 @@ const handleEditConfirm = async () => {
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// 表单验证失败或API调用失败时,不显示错误消息,因为ElMessage已经在其他地方处理
|
// 表单验证失败或API调用失败时,不显示错误消息,因为ElMessage已经在其他地方处理
|
||||||
console.error('操作失败:', err);
|
console.error('操作失败:', err);
|
||||||
|
} finally {
|
||||||
|
stopEditLoading();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -512,6 +519,7 @@ watch(
|
||||||
// 提交修改密码
|
// 提交修改密码
|
||||||
const handlePasswordConfirm = async () => {
|
const handlePasswordConfirm = async () => {
|
||||||
if (!passwordFormRef.value) return;
|
if (!passwordFormRef.value) return;
|
||||||
|
startPasswordLoading();
|
||||||
try {
|
try {
|
||||||
await passwordFormRef.value.validate();
|
await passwordFormRef.value.validate();
|
||||||
|
|
||||||
|
|
@ -536,6 +544,8 @@ const handlePasswordConfirm = async () => {
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// 表单验证失败或API调用失败时,不显示错误消息,因为ElMessage已经在其他地方处理
|
// 表单验证失败或API调用失败时,不显示错误消息,因为ElMessage已经在其他地方处理
|
||||||
console.error('密码修改失败:', err);
|
console.error('密码修改失败:', err);
|
||||||
|
} finally {
|
||||||
|
stopPasswordLoading();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,8 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="client table_form-container">
|
<div class="client table_form-container">
|
||||||
<!-- 搜索组件 -->
|
<!-- 搜索组件 -->
|
||||||
<ClientSearch
|
<ClientSearch :search-form="clientSearchForm" :search-options="clientSearchOptions" :buttonLoading="loading"
|
||||||
:search-form="clientSearchForm"
|
@search="handleSearch" @reset="handleReset">
|
||||||
:search-options="clientSearchOptions"
|
|
||||||
@search="handleSearch"
|
|
||||||
@reset="handleReset"
|
|
||||||
>
|
|
||||||
<template #button="{ form }">
|
<template #button="{ form }">
|
||||||
<el-button type="primary" @click="handleAdd()" v-auth="'user_createUser'">
|
<el-button type="primary" @click="handleAdd()" v-auth="'user_createUser'">
|
||||||
添加客户
|
添加客户
|
||||||
|
|
@ -29,44 +25,21 @@
|
||||||
</template>
|
</template>
|
||||||
</ClientTable>
|
</ClientTable>
|
||||||
<!-- 分页组件 -->
|
<!-- 分页组件 -->
|
||||||
<ClientPagination
|
<ClientPagination v-model="currentPage" v-model:pageSizeValue="pageSize" :total="total"
|
||||||
v-model="currentPage"
|
@pagination-change="handlePaginationChange" />
|
||||||
v-model:pageSizeValue="pageSize"
|
|
||||||
:total="total"
|
|
||||||
@pagination-change="handlePaginationChange"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
<!-- 客户弹窗 -->
|
<!-- 客户弹窗 -->
|
||||||
<ClientDialog
|
<ClientDialog :visible="dialogVisible" :title="dialogTitle" :type="dialogType" :button-loading="submitLoading"
|
||||||
:visible="dialogVisible"
|
@confirm="handleSubmit" @cancel="handleCancel" @close="handleClose">
|
||||||
:title="dialogTitle"
|
<ClientForm :form-data="clientForm" :form-rules="clientFormRules" :form-items="clientFormOptions"
|
||||||
:type="dialogType"
|
:options-map="clientFormOptionsMap" ref="clientFormRef">
|
||||||
@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">
|
<template #phoneOrEmail="{ formData }" style="margin-left: 0">
|
||||||
<div class="phone-email">
|
<div class="phone-email">
|
||||||
<div class="tab-btn">
|
<div class="tab-btn">
|
||||||
<el-button
|
<el-button :type="activeTab === 'email' ? 'primary' : 'default'" size="small" @click="activeTab = 'email'">
|
||||||
:type="activeTab === 'email' ? 'primary' : 'default'"
|
|
||||||
size="small"
|
|
||||||
@click="activeTab = 'email'"
|
|
||||||
>
|
|
||||||
邮箱
|
邮箱
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button :type="activeTab === 'phone' ? 'primary' : 'default'" size="small" @click="activeTab = 'phone'">
|
||||||
:type="activeTab === 'phone' ? 'primary' : 'default'"
|
|
||||||
size="small"
|
|
||||||
@click="activeTab = 'phone'"
|
|
||||||
>
|
|
||||||
手机号
|
手机号
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -76,12 +49,7 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item prop="phone" class="phone-item" v-if="activeTab === 'phone'">
|
<el-form-item prop="phone" class="phone-item" v-if="activeTab === 'phone'">
|
||||||
<el-select v-model="clientForm.countryCode" placeholder="请选择国家区号">
|
<el-select v-model="clientForm.countryCode" placeholder="请选择国家区号">
|
||||||
<el-option
|
<el-option v-for="item in countryOptions" :key="item.code" :label="item.code" :value="item.code">
|
||||||
v-for="item in countryOptions"
|
|
||||||
:key="item.code"
|
|
||||||
:label="item.code"
|
|
||||||
:value="item.code"
|
|
||||||
>
|
|
||||||
<div class="country-option">
|
<div class="country-option">
|
||||||
<span class="country-name">{{ item.name }}</span>
|
<span class="country-name">{{ item.name }}</span>
|
||||||
<span class="country-code">{{ item.code }}</span>
|
<span class="country-code">{{ item.code }}</span>
|
||||||
|
|
@ -97,14 +65,8 @@
|
||||||
</ClientDialog>
|
</ClientDialog>
|
||||||
|
|
||||||
<!-- 调整金额弹窗 -->
|
<!-- 调整金额弹窗 -->
|
||||||
<ClientDialog
|
<ClientDialog :visible="adjustAmountVisible" title="调整金额" type="adjust" :button-loading="adjustAmountLoading"
|
||||||
:visible="adjustAmountVisible"
|
@confirm="handleAdjustAmountSubmit" @cancel="handleAdjustAmountCancel" @close="handleAdjustAmountClose">
|
||||||
title="调整金额"
|
|
||||||
type="adjust"
|
|
||||||
@confirm="handleAdjustAmountSubmit"
|
|
||||||
@cancel="handleAdjustAmountCancel"
|
|
||||||
@close="handleAdjustAmountClose"
|
|
||||||
>
|
|
||||||
<el-form :model="adjustAmountForm" :rules="adjustAmountRules" ref="adjustAmountFormRef" label-width="120px">
|
<el-form :model="adjustAmountForm" :rules="adjustAmountRules" ref="adjustAmountFormRef" label-width="120px">
|
||||||
<el-form-item label="账号名" prop="username">
|
<el-form-item label="账号名" prop="username">
|
||||||
<el-input v-model="adjustAmountForm.username" disabled />
|
<el-input v-model="adjustAmountForm.username" disabled />
|
||||||
|
|
@ -116,11 +78,8 @@
|
||||||
<el-input v-model="adjustAmountForm.currentBalance" disabled />
|
<el-input v-model="adjustAmountForm.currentBalance" disabled />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="调整金额" prop="adjustAmount">
|
<el-form-item label="调整金额" prop="adjustAmount">
|
||||||
<el-input
|
<el-input v-model="adjustAmountForm.adjustAmount" placeholder="请输入调整金额(可为负数)"
|
||||||
v-model="adjustAmountForm.adjustAmount"
|
@input="handleAdjustAmountInput" />
|
||||||
placeholder="请输入调整金额(可为负数)"
|
|
||||||
@input="handleAdjustAmountInput"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="调整后余额" prop="afterBalance">
|
<el-form-item label="调整后余额" prop="afterBalance">
|
||||||
<el-input v-model="adjustAmountForm.afterBalance" disabled />
|
<el-input v-model="adjustAmountForm.afterBalance" disabled />
|
||||||
|
|
@ -137,7 +96,7 @@ defineOptions({
|
||||||
// 组件
|
// 组件
|
||||||
import ClientSearch from '@/components/common/Search.vue'
|
import ClientSearch from '@/components/common/Search.vue'
|
||||||
import ClientTable from '@/components/common/Table.vue'
|
import ClientTable from '@/components/common/Table.vue'
|
||||||
import { usePageLoading } from '@/composables/useLoading'
|
import { usePageLoading, useButtonLoading } from '@/composables/useLoading'
|
||||||
import ClientPagination from '@/components/common/Pagination.vue'
|
import ClientPagination from '@/components/common/Pagination.vue'
|
||||||
import ClientDialog from '@/components/common/Dialog.vue'
|
import ClientDialog from '@/components/common/Dialog.vue'
|
||||||
import ClientForm from '@/components/common/Form.vue'
|
import ClientForm from '@/components/common/Form.vue'
|
||||||
|
|
@ -174,6 +133,8 @@ const clientSearchForm = ref({
|
||||||
})
|
})
|
||||||
|
|
||||||
const { loading, startLoading, stopLoading } = usePageLoading()
|
const { loading, startLoading, stopLoading } = usePageLoading()
|
||||||
|
const { buttonLoading: submitLoading, startButtonLoading: startSubmitLoading, stopButtonLoading: stopSubmitLoading } = useButtonLoading()
|
||||||
|
const { buttonLoading: adjustAmountLoading, startButtonLoading: startAdjustAmountLoading, stopButtonLoading: stopAdjustAmountLoading } = useButtonLoading()
|
||||||
/**
|
/**
|
||||||
* @description 定义表格数据
|
* @description 定义表格数据
|
||||||
*/
|
*/
|
||||||
|
|
@ -283,35 +244,38 @@ const mapObjectToOptions = (obj: Record<string, string>) => {
|
||||||
* @description 统一获取数据方法
|
* @description 统一获取数据方法
|
||||||
*/
|
*/
|
||||||
const getClientList = async () => {
|
const getClientList = async () => {
|
||||||
startLoading()
|
try {
|
||||||
const params = {
|
startLoading()
|
||||||
page: currentPage.value,
|
const params = {
|
||||||
page_size: pageSize.value,
|
page: currentPage.value,
|
||||||
username: clientSearchForm.value.username,
|
page_size: pageSize.value,
|
||||||
status: clientSearchForm.value.status || '',
|
username: clientSearchForm.value.username,
|
||||||
reg_start_time:
|
status: clientSearchForm.value.status || '',
|
||||||
clientSearchForm.value.startDateTime.length > 0
|
reg_start_time:
|
||||||
? `${clientSearchForm.value.startDateTime} 0:00:00`
|
clientSearchForm.value.startDateTime.length > 0
|
||||||
: '',
|
? `${clientSearchForm.value.startDateTime} 0:00:00`
|
||||||
reg_end_time:
|
: '',
|
||||||
clientSearchForm.value.endDateTime.length > 0
|
reg_end_time:
|
||||||
? `${clientSearchForm.value.endDateTime} 23:59:59`
|
clientSearchForm.value.endDateTime.length > 0
|
||||||
: '',
|
? `${clientSearchForm.value.endDateTime} 23:59:59`
|
||||||
|
: '',
|
||||||
|
}
|
||||||
|
const data = await getClientListApi(params)
|
||||||
|
// 处理表格数据
|
||||||
|
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)
|
||||||
|
pageSize.value = Number(data.per_page)
|
||||||
|
} finally {
|
||||||
|
stopLoading()
|
||||||
}
|
}
|
||||||
const data = await getClientListApi(params)
|
|
||||||
// 处理表格数据
|
|
||||||
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)
|
|
||||||
//分页数据
|
|
||||||
stopLoading()
|
|
||||||
currentPage.value = Number(data.current_page)
|
|
||||||
pageSize.value = Number(data.per_page)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取客户表单选项
|
// 获取客户表单选项
|
||||||
|
|
@ -356,11 +320,8 @@ onMounted(async () => {
|
||||||
* @description 搜索方法
|
* @description 搜索方法
|
||||||
*/
|
*/
|
||||||
const handleSearch = async () => {
|
const handleSearch = async () => {
|
||||||
try {
|
|
||||||
await getClientList()
|
await getClientList()
|
||||||
} catch (err) {
|
|
||||||
console.error('获取客户列表失败', err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
const handleReset = async () => {
|
const handleReset = async () => {
|
||||||
// 重置搜索表单
|
// 重置搜索表单
|
||||||
|
|
@ -370,11 +331,7 @@ const handleReset = async () => {
|
||||||
startDateTime: '',
|
startDateTime: '',
|
||||||
endDateTime: '',
|
endDateTime: '',
|
||||||
}
|
}
|
||||||
try {
|
await getClientList()
|
||||||
await getClientList()
|
|
||||||
} catch (err) {
|
|
||||||
console.error('获取客户列表失败', err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// 添加客户
|
// 添加客户
|
||||||
const handleAdd = () => {
|
const handleAdd = () => {
|
||||||
|
|
@ -435,8 +392,9 @@ const handlePaginationChange = (page: { currentPage: number; pageSize: number })
|
||||||
* @description 客户弹窗方法
|
* @description 客户弹窗方法
|
||||||
*/
|
*/
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
|
await clientFormRef.value?.validate()
|
||||||
|
startSubmitLoading()
|
||||||
try {
|
try {
|
||||||
await clientFormRef.value?.validate()
|
|
||||||
if (dialogType.value === 'add') {
|
if (dialogType.value === 'add') {
|
||||||
const params = {
|
const params = {
|
||||||
reg_type: activeTab.value === 'email' ? 1 : 2,
|
reg_type: activeTab.value === 'email' ? 1 : 2,
|
||||||
|
|
@ -464,6 +422,8 @@ const handleSubmit = async () => {
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('客户表单验证失败', err)
|
console.error('客户表单验证失败', err)
|
||||||
|
} finally {
|
||||||
|
stopSubmitLoading()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const handleCancel = () => {
|
const handleCancel = () => {
|
||||||
|
|
@ -501,16 +461,19 @@ const handleAdjustAmountInput = () => {
|
||||||
|
|
||||||
// 提交调整金额
|
// 提交调整金额
|
||||||
const handleAdjustAmountSubmit = async () => {
|
const handleAdjustAmountSubmit = async () => {
|
||||||
|
await adjustAmountFormRef.value?.validate()
|
||||||
|
startAdjustAmountLoading()
|
||||||
try {
|
try {
|
||||||
await adjustAmountFormRef.value?.validate()
|
|
||||||
await updateCapitalApi({
|
await updateCapitalApi({
|
||||||
target_user_id: adjustUserId.value,
|
target_user_id: adjustUserId.value,
|
||||||
amount: adjustAmountForm.value.adjustAmount,
|
amount: adjustAmountForm.value.adjustAmount,
|
||||||
})
|
})
|
||||||
await getClientList()
|
await getClientList()
|
||||||
adjustAmountVisible.value = false
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('调整金额表单验证失败', err)
|
console.error('调整金额表单验证失败', err)
|
||||||
|
} finally {
|
||||||
|
adjustAmountVisible.value = false
|
||||||
|
stopAdjustAmountLoading()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -526,8 +489,8 @@ const handleAdjustAmountClose = () => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.client{
|
.client {}
|
||||||
}
|
|
||||||
:deep(.el-form-item__content) {
|
:deep(.el-form-item__content) {
|
||||||
margin-left: 0 !important;
|
margin-left: 0 !important;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
<!-- 搜索 -->
|
<!-- 搜索 -->
|
||||||
<NoticeSearch
|
<NoticeSearch
|
||||||
:search-form="searchForm"
|
:search-form="searchForm"
|
||||||
|
:buttonLoading="loading"
|
||||||
:search-options="searchOptions"
|
:search-options="searchOptions"
|
||||||
@search="handleSearch"
|
@search="handleSearch"
|
||||||
@reset="handleReset"
|
@reset="handleReset"
|
||||||
|
|
@ -55,6 +56,7 @@
|
||||||
:title="dialogTitle"
|
:title="dialogTitle"
|
||||||
:type="dialogType"
|
:type="dialogType"
|
||||||
:show-footer="dialogType !== 'view'"
|
:show-footer="dialogType !== 'view'"
|
||||||
|
:button-loading="submitLoading"
|
||||||
@confirm="handleSubmit"
|
@confirm="handleSubmit"
|
||||||
@cancel="handleCancel"
|
@cancel="handleCancel"
|
||||||
@close="handleClose"
|
@close="handleClose"
|
||||||
|
|
@ -99,8 +101,9 @@
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'Notice'
|
name: 'Notice'
|
||||||
})
|
})
|
||||||
import { usePageLoading } from '@/composables/useLoading'
|
import { usePageLoading, useButtonLoading } from '@/composables/useLoading'
|
||||||
const { loading, startLoading, stopLoading } = usePageLoading()
|
const { loading, startLoading, stopLoading } = usePageLoading()
|
||||||
|
const { buttonLoading: submitLoading, startButtonLoading: startSubmitLoading, stopButtonLoading: stopSubmitLoading } = useButtonLoading()
|
||||||
|
|
||||||
// 组件
|
// 组件
|
||||||
import NoticeSearch from '@/components/common/Search.vue'
|
import NoticeSearch from '@/components/common/Search.vue'
|
||||||
|
|
@ -345,28 +348,33 @@ const handlePaginationChange = async (page: { currentPage: number; pageSize: num
|
||||||
* @description: 定义弹窗方法
|
* @description: 定义弹窗方法
|
||||||
*/
|
*/
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
await noticeFormRef.value.validate()
|
startSubmitLoading()
|
||||||
if (dialogType.value === 'create') {
|
try {
|
||||||
noticeForm.value.noticeContent = valueHtml.value
|
await noticeFormRef.value.validate()
|
||||||
const params = {
|
if (dialogType.value === 'create') {
|
||||||
name: noticeForm.value.noticeName,
|
noticeForm.value.noticeContent = valueHtml.value
|
||||||
content: noticeForm.value.noticeContent,
|
const params = {
|
||||||
status: noticeForm.value.status,
|
name: noticeForm.value.noticeName,
|
||||||
|
content: noticeForm.value.noticeContent,
|
||||||
|
status: noticeForm.value.status,
|
||||||
|
}
|
||||||
|
await createNoticeApi(params)
|
||||||
|
dialogVisible.value = false
|
||||||
|
getNoticeList()
|
||||||
|
} else {
|
||||||
|
noticeForm.value.noticeContent = valueHtml.value
|
||||||
|
const params = {
|
||||||
|
id: noticeForm.value.id,
|
||||||
|
name: noticeForm.value.noticeName,
|
||||||
|
content: noticeForm.value.noticeContent,
|
||||||
|
status: noticeForm.value.status,
|
||||||
|
}
|
||||||
|
await editNoticeApi(params)
|
||||||
|
dialogVisible.value = false
|
||||||
|
getNoticeList()
|
||||||
}
|
}
|
||||||
await createNoticeApi(params)
|
} finally {
|
||||||
dialogVisible.value = false
|
stopSubmitLoading()
|
||||||
getNoticeList()
|
|
||||||
} else {
|
|
||||||
noticeForm.value.noticeContent = valueHtml.value
|
|
||||||
const params = {
|
|
||||||
id: noticeForm.value.id,
|
|
||||||
name: noticeForm.value.noticeName,
|
|
||||||
content: noticeForm.value.noticeContent,
|
|
||||||
status: noticeForm.value.status,
|
|
||||||
}
|
|
||||||
await editNoticeApi(params)
|
|
||||||
dialogVisible.value = false
|
|
||||||
getNoticeList()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
<!-- 搜索 -->
|
<!-- 搜索 -->
|
||||||
<VarietySearch
|
<VarietySearch
|
||||||
:search-form="searchForm"
|
:search-form="searchForm"
|
||||||
|
:buttonLoading="loading"
|
||||||
:search-options="searchOptions"
|
:search-options="searchOptions"
|
||||||
@search="handleSearch"
|
@search="handleSearch"
|
||||||
@reset="handleReset"
|
@reset="handleReset"
|
||||||
|
|
@ -43,6 +44,7 @@
|
||||||
:visible="dialogVisible"
|
:visible="dialogVisible"
|
||||||
:title="dialogTitle"
|
:title="dialogTitle"
|
||||||
:type="dialogType"
|
:type="dialogType"
|
||||||
|
:button-loading="submitLoading"
|
||||||
@confirm="handleSubmit"
|
@confirm="handleSubmit"
|
||||||
@cancel="handleCancel"
|
@cancel="handleCancel"
|
||||||
@close="handleClose"
|
@close="handleClose"
|
||||||
|
|
@ -95,8 +97,9 @@ defineOptions({
|
||||||
name: 'Variety'
|
name: 'Variety'
|
||||||
})
|
})
|
||||||
// 组件
|
// 组件
|
||||||
import { usePageLoading } from '@/composables/useLoading'
|
import { usePageLoading, useButtonLoading } from '@/composables/useLoading'
|
||||||
const { loading, startLoading, stopLoading } = usePageLoading()
|
const { loading, startLoading, stopLoading } = usePageLoading()
|
||||||
|
const { buttonLoading: submitLoading, startButtonLoading: startSubmitLoading, stopButtonLoading: stopSubmitLoading } = useButtonLoading()
|
||||||
|
|
||||||
import VarietySearch from '@/components/common/Search.vue'
|
import VarietySearch from '@/components/common/Search.vue'
|
||||||
import VarietyTable from '@/components/common/Table.vue'
|
import VarietyTable from '@/components/common/Table.vue'
|
||||||
|
|
@ -443,47 +446,52 @@ const beforeUpload = (file: File) => {
|
||||||
* @description: 定义弹窗方法
|
* @description: 定义弹窗方法
|
||||||
*/
|
*/
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
await varietyFormRef.value?.validate()
|
startSubmitLoading()
|
||||||
console.log(varietyForm.value)
|
try {
|
||||||
const params = {
|
await varietyFormRef.value?.validate()
|
||||||
id: varietyForm.value.id,
|
console.log(varietyForm.value)
|
||||||
code: varietyForm.value.varietyCode,
|
const params = {
|
||||||
name: varietyForm.value.varietyName,
|
id: varietyForm.value.id,
|
||||||
point_diff: varietyForm.value.minPoint,
|
code: varietyForm.value.varietyCode,
|
||||||
fee_inventory_short: varietyForm.value.shortStockFee,
|
name: varietyForm.value.varietyName,
|
||||||
status: varietyForm.value.tradeStatus,
|
point_diff: varietyForm.value.minPoint,
|
||||||
bail_hedge: varietyForm.value.prepaymentHedge,
|
fee_inventory_short: varietyForm.value.shortStockFee,
|
||||||
bail_percent: varietyForm.value.prepaymentPercent,
|
status: varietyForm.value.tradeStatus,
|
||||||
decimal_place: varietyForm.value.decimalPlaces,
|
bail_hedge: varietyForm.value.prepaymentHedge,
|
||||||
stop_loss_level: varietyForm.value.profitLevel,
|
bail_percent: varietyForm.value.prepaymentPercent,
|
||||||
point_diff_max: varietyForm.value.maxPoint,
|
decimal_place: varietyForm.value.decimalPlaces,
|
||||||
fee_inventory_long: varietyForm.value.longStockFee,
|
stop_loss_level: varietyForm.value.profitLevel,
|
||||||
point_diff_decimal_place: varietyForm.value.pointDecimalPlaces,
|
point_diff_max: varietyForm.value.maxPoint,
|
||||||
unit: varietyForm.value.unit,
|
fee_inventory_long: varietyForm.value.longStockFee,
|
||||||
multiplier: varietyForm.value.contractSize,
|
point_diff_decimal_place: varietyForm.value.pointDecimalPlaces,
|
||||||
undulate_min: varietyForm.value.minFlux,
|
unit: varietyForm.value.unit,
|
||||||
online_status: varietyForm.value.onlineStatus,
|
multiplier: varietyForm.value.contractSize,
|
||||||
type: Number(varietyForm.value.type),
|
undulate_min: varietyForm.value.minFlux,
|
||||||
image: varietyForm.value.imageUrl,
|
online_status: varietyForm.value.onlineStatus,
|
||||||
fee_inventory_time: varietyForm.value.feeInventoryTime,
|
type: Number(varietyForm.value.type),
|
||||||
group_id: varietyForm.value.group_id,
|
image: varietyForm.value.imageUrl,
|
||||||
}
|
fee_inventory_time: varietyForm.value.feeInventoryTime,
|
||||||
console.log(params)
|
group_id: varietyForm.value.group_id,
|
||||||
|
}
|
||||||
if (dialogType.value === 'edit') {
|
|
||||||
console.log(params)
|
console.log(params)
|
||||||
if (params.point_diff_max < params.point_diff)
|
|
||||||
return ElMessage.warning('最大点差不能小于最小点差')
|
if (dialogType.value === 'edit') {
|
||||||
await editVarietyApi({
|
console.log(params)
|
||||||
...params,
|
if (params.point_diff_max < params.point_diff)
|
||||||
is_default: varietyForm.value.isDefault,
|
return ElMessage.warning('最大点差不能小于最小点差')
|
||||||
})
|
await editVarietyApi({
|
||||||
await getVarietyList()
|
...params,
|
||||||
} else {
|
is_default: varietyForm.value.isDefault,
|
||||||
await createVarietyApi({ ...params })
|
})
|
||||||
await getVarietyList()
|
await getVarietyList()
|
||||||
|
} else {
|
||||||
|
await createVarietyApi({ ...params })
|
||||||
|
await getVarietyList()
|
||||||
|
}
|
||||||
|
dialogVisible.value = false
|
||||||
|
} finally {
|
||||||
|
stopSubmitLoading()
|
||||||
}
|
}
|
||||||
dialogVisible.value = false
|
|
||||||
}
|
}
|
||||||
const handleCancel = () => {
|
const handleCancel = () => {
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue