f
This commit is contained in:
@@ -16,6 +16,7 @@ export namespace AgentApi {
|
||||
frozen_balance: number;
|
||||
withdrawn_amount: number;
|
||||
is_real_name: boolean;
|
||||
real_name?: string; // 姓名(实名认证的姓名)
|
||||
id_card_plain?: string; // 身份证号(解密后的明文)
|
||||
create_time: string;
|
||||
}
|
||||
@@ -39,6 +40,16 @@ export namespace AgentApi {
|
||||
order_type?: 'asc' | 'desc';
|
||||
}
|
||||
|
||||
/** 代理手机号修改参数 */
|
||||
export interface UpdateAgentMobileParams {
|
||||
agent_id: string;
|
||||
mobile: string;
|
||||
}
|
||||
|
||||
export interface UpdateAgentMobileResp {
|
||||
success: boolean;
|
||||
}
|
||||
|
||||
export interface AgentLinkListItem {
|
||||
agent_id: number;
|
||||
product_id: number;
|
||||
@@ -576,6 +587,16 @@ async function getAgentRewardList(
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改代理手机号
|
||||
*/
|
||||
async function updateAgentMobile(params: AgentApi.UpdateAgentMobileParams) {
|
||||
return requestClient.post<AgentApi.UpdateAgentMobileResp>(
|
||||
'/agent/mobile/update',
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
export {
|
||||
auditWithdrawal,
|
||||
generateDiamondInviteCode,
|
||||
@@ -592,5 +613,6 @@ export {
|
||||
getAgentWithdrawalList,
|
||||
getInviteCodeList,
|
||||
updateAgentConfig,
|
||||
updateAgentMobile,
|
||||
updateAgentProductionConfig,
|
||||
};
|
||||
|
||||
@@ -129,6 +129,11 @@ export function useColumns(): VxeTableGridOptions['columns'] {
|
||||
title: '实名认证状态',
|
||||
width: 120,
|
||||
},
|
||||
{
|
||||
field: 'real_name',
|
||||
title: '姓名',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
field: 'id_card_plain',
|
||||
title: '身份证号',
|
||||
|
||||
@@ -20,6 +20,7 @@ import { useColumns, useGridFormSchema } from './data';
|
||||
import CommissionModal from './modules/commission-modal.vue';
|
||||
import Form from './modules/form.vue';
|
||||
import LinkModal from './modules/link-modal.vue';
|
||||
import MobileEditModal from './modules/mobile-edit-modal.vue';
|
||||
import OrderModal from './modules/order-modal.vue';
|
||||
import RebateModal from './modules/rebate-modal.vue';
|
||||
import UpgradeModal from './modules/upgrade-modal.vue';
|
||||
@@ -70,6 +71,12 @@ const [WithdrawalModalComponent, withdrawalModalApi] = useVbenModal({
|
||||
destroyOnClose: true,
|
||||
});
|
||||
|
||||
// 修改手机号弹窗
|
||||
const [MobileEditModalComponent, mobileEditModalApi] = useVbenModal({
|
||||
connectedComponent: MobileEditModal,
|
||||
destroyOnClose: true,
|
||||
});
|
||||
|
||||
// 表格配置
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
formOptions: {
|
||||
@@ -142,6 +149,10 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
||||
// 更多操作菜单项
|
||||
const moreMenuItems = [
|
||||
{
|
||||
key: 'edit-mobile',
|
||||
label: '修改手机号',
|
||||
},
|
||||
{
|
||||
key: 'links',
|
||||
label: '推广链接',
|
||||
@@ -188,6 +199,10 @@ function onActionClick(
|
||||
onViewCommission(e.row);
|
||||
break;
|
||||
}
|
||||
case 'edit-mobile': {
|
||||
onEditMobile(e.row);
|
||||
break;
|
||||
}
|
||||
case 'edit': {
|
||||
onEdit(e.row);
|
||||
break;
|
||||
@@ -229,6 +244,11 @@ function onEdit(row: AgentApi.AgentListItem) {
|
||||
formDrawerApi.setData(row).open();
|
||||
}
|
||||
|
||||
// 修改手机号
|
||||
function onEditMobile(row: AgentApi.AgentListItem) {
|
||||
mobileEditModalApi.setData(row).open();
|
||||
}
|
||||
|
||||
// 查看推广链接
|
||||
function onViewLinks(row: AgentApi.AgentListItem) {
|
||||
linkModalApi.setData({ agentId: row.id }).open();
|
||||
@@ -269,6 +289,7 @@ function onRefresh() {
|
||||
<Page auto-content-height>
|
||||
<FormDrawer @success="onRefresh" />
|
||||
<LinkModalComponent />
|
||||
<MobileEditModalComponent @success="onRefresh" />
|
||||
<CommissionModalComponent />
|
||||
<RebateModalComponent />
|
||||
<UpgradeModalComponent />
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
<script lang="ts" setup>
|
||||
import type { AgentApi } from '#/api/agent';
|
||||
|
||||
import { computed, ref, watch } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
import { updateAgentMobile } from '#/api/agent';
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
title: '修改手机号',
|
||||
destroyOnClose: true,
|
||||
});
|
||||
|
||||
const emit = defineEmits<{
|
||||
success: [];
|
||||
}>();
|
||||
|
||||
const rowData = computed(() => modalApi.getData<AgentApi.AgentListItem>());
|
||||
|
||||
const newMobile = ref('');
|
||||
|
||||
const loading = ref(false);
|
||||
|
||||
// 打开时回填当前手机号
|
||||
watch(
|
||||
rowData,
|
||||
(row) => {
|
||||
if (row?.mobile) {
|
||||
newMobile.value = row.mobile;
|
||||
} else {
|
||||
newMobile.value = '';
|
||||
}
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
async function handleSubmit() {
|
||||
const row = rowData.value;
|
||||
if (!row) return;
|
||||
|
||||
const mobile = newMobile.value?.trim();
|
||||
if (!mobile) {
|
||||
message.warning('请输入新手机号');
|
||||
return;
|
||||
}
|
||||
if (!/^1[3-9]\d{9}$/.test(mobile)) {
|
||||
message.warning('请输入正确的11位手机号');
|
||||
return;
|
||||
}
|
||||
|
||||
loading.value = true;
|
||||
try {
|
||||
await updateAgentMobile({
|
||||
agent_id: String(row.id),
|
||||
mobile,
|
||||
});
|
||||
message.success('手机号修改成功');
|
||||
emit('success');
|
||||
modalApi.close();
|
||||
} catch {
|
||||
message.error('手机号修改失败');
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Modal width="420px">
|
||||
<div class="py-2">
|
||||
<a-form layout="vertical">
|
||||
<a-form-item label="当前手机号">
|
||||
<a-input :value="rowData?.mobile" disabled />
|
||||
</a-form-item>
|
||||
<a-form-item label="新手机号" required>
|
||||
<a-input
|
||||
v-model:value="newMobile"
|
||||
placeholder="请输入11位手机号"
|
||||
maxlength="11"
|
||||
allow-clear
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</div>
|
||||
<template #footer>
|
||||
<a-button @click="modalApi.close()">取消</a-button>
|
||||
<a-button type="primary" :loading="loading" @click="handleSubmit">
|
||||
确定
|
||||
</a-button>
|
||||
</template>
|
||||
</Modal>
|
||||
</template>
|
||||
Reference in New Issue
Block a user