feat(shop): 更新经销商模块页面结构和功能
- 重构经销商资金页面表格列配置,调整用户ID列为用户昵称显示 - 移除经销商订单页面的批量结算、导出、删除等功能入口和相关API调用 - 将经销商用户页面从申请管理改为用户管理,更新数据模型和表格配置 - 调整经销商订单导出功能的数据结构和字段映射逻辑 - 简化经销商用户搜索组件,移除审核相关功能按钮和搜索条件 - 删除不再使用的经销商申请编辑组件和相关API接口调用
This commit is contained in:
@@ -23,6 +23,9 @@
|
|||||||
<template v-if="column.key === 'image'">
|
<template v-if="column.key === 'image'">
|
||||||
<a-image :src="record.image" :width="50" />
|
<a-image :src="record.image" :width="50" />
|
||||||
</template>
|
</template>
|
||||||
|
<template v-if="column.key === 'userId'">
|
||||||
|
<div>{{ record.nickName }}</div>
|
||||||
|
</template>
|
||||||
<template v-if="column.key === 'status'">
|
<template v-if="column.key === 'status'">
|
||||||
<a-tag v-if="record.status === 0" color="green">显示</a-tag>
|
<a-tag v-if="record.status === 0" color="green">显示</a-tag>
|
||||||
<a-tag v-if="record.status === 1" color="red">隐藏</a-tag>
|
<a-tag v-if="record.status === 1" color="red">隐藏</a-tag>
|
||||||
@@ -110,22 +113,29 @@
|
|||||||
// 表格列配置
|
// 表格列配置
|
||||||
const columns = ref<ColumnItem[]>([
|
const columns = ref<ColumnItem[]>([
|
||||||
{
|
{
|
||||||
title: 'ID',
|
key: 'index',
|
||||||
dataIndex: 'id',
|
width: 48,
|
||||||
key: 'id',
|
|
||||||
align: 'center',
|
align: 'center',
|
||||||
width: 80,
|
fixed: 'left',
|
||||||
fixed: 'left'
|
hideInSetting: true,
|
||||||
|
customRender: ({ index }) => index + (tableRef.value?.tableIndex ?? 0)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '用户ID',
|
title: '订单号',
|
||||||
|
dataIndex: 'orderNo',
|
||||||
|
key: 'orderNo',
|
||||||
|
align: 'center',
|
||||||
|
customRender: ({ text }) => text || '-'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '用户',
|
||||||
dataIndex: 'userId',
|
dataIndex: 'userId',
|
||||||
key: 'userId',
|
key: 'userId',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
fixed: 'left'
|
fixed: 'left'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '流动类型',
|
title: '收益',
|
||||||
dataIndex: 'flowType',
|
dataIndex: 'flowType',
|
||||||
key: 'flowType',
|
key: 'flowType',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
@@ -167,13 +177,6 @@
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: '关联订单',
|
|
||||||
dataIndex: 'orderNo',
|
|
||||||
key: 'orderNo',
|
|
||||||
align: 'center',
|
|
||||||
customRender: ({ text }) => text || '-'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title: '对方用户',
|
title: '对方用户',
|
||||||
dataIndex: 'toUserId',
|
dataIndex: 'toUserId',
|
||||||
@@ -183,8 +186,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '描述',
|
title: '描述',
|
||||||
dataIndex: 'describe',
|
dataIndex: 'comments',
|
||||||
key: 'describe',
|
key: 'comments',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
customRender: ({ text }) => text || '-'
|
customRender: ({ text }) => text || '-'
|
||||||
|
|||||||
@@ -13,14 +13,12 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { GradeParam } from '@/api/user/grade/model';
|
import { ref } from 'vue';
|
||||||
import { ref, watch } from 'vue';
|
|
||||||
import { utils, writeFile } from 'xlsx';
|
import { utils, writeFile } from 'xlsx';
|
||||||
import { message } from 'ant-design-vue';
|
import { message } from 'ant-design-vue';
|
||||||
import { ShopDealerCapital } from '@/api/shop/shopDealerCapital/model';
|
|
||||||
import { getTenantId } from '@/utils/domain';
|
import { getTenantId } from '@/utils/domain';
|
||||||
import useSearch from '@/utils/use-search';
|
import useSearch from '@/utils/use-search';
|
||||||
import {
|
import type {
|
||||||
ShopDealerOrder,
|
ShopDealerOrder,
|
||||||
ShopDealerOrderParam
|
ShopDealerOrderParam
|
||||||
} from '@/api/shop/shopDealerOrder/model';
|
} from '@/api/shop/shopDealerOrder/model';
|
||||||
@@ -35,10 +33,7 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'search', where?: GradeParam): void;
|
(e: 'search', where?: ShopDealerOrderParam): void;
|
||||||
(e: 'add'): void;
|
|
||||||
(e: 'remove'): void;
|
|
||||||
(e: 'batchMove'): void;
|
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const reload = () => {
|
const reload = () => {
|
||||||
@@ -50,34 +45,38 @@
|
|||||||
keywords: '',
|
keywords: '',
|
||||||
userId: undefined,
|
userId: undefined,
|
||||||
orderNo: undefined,
|
orderNo: undefined,
|
||||||
|
isSettled: 1, // 与列表页一致:只展示/导出已结算订单
|
||||||
|
page: 1,
|
||||||
limit: 5000
|
limit: 5000
|
||||||
});
|
});
|
||||||
|
|
||||||
const list = ref<ShopDealerCapital[]>([]);
|
const list = ref<ShopDealerOrder[]>([]);
|
||||||
|
|
||||||
|
const toMoney = (val: unknown) => {
|
||||||
|
const n = Number.parseFloat(String(val ?? '0'));
|
||||||
|
return Number.isFinite(n) ? n.toFixed(2) : '0.00';
|
||||||
|
};
|
||||||
|
|
||||||
|
const toDateTime = (val: unknown) => {
|
||||||
|
if (val === null || val === undefined || val === '') return '';
|
||||||
|
if (typeof val === 'number') return new Date(val).toLocaleString();
|
||||||
|
return String(val);
|
||||||
|
};
|
||||||
|
|
||||||
// 导出
|
// 导出
|
||||||
const handleExport = async () => {
|
const handleExport = async () => {
|
||||||
const array: (string | number)[][] = [
|
const array: (string | number)[][] = [
|
||||||
[
|
[
|
||||||
'客户名称',
|
// 与 `src/views/shop/shopDealerOrder/index.vue` 表头保持一致
|
||||||
'业务员',
|
|
||||||
'订单编号',
|
'订单编号',
|
||||||
'结算电量',
|
'买家',
|
||||||
'换算成度',
|
'订单金额',
|
||||||
'结算单价',
|
'一级佣金(10%)',
|
||||||
'结算金额',
|
'二级佣金(5%)',
|
||||||
'税费',
|
'一级门店分红(2%/3%)',
|
||||||
'实发金额',
|
'二级门店分红(1%)',
|
||||||
'一级佣金30%',
|
'结算状态',
|
||||||
'一级佣金收益',
|
'创建时间'
|
||||||
'二级佣金10%',
|
|
||||||
'二级佣金收益',
|
|
||||||
'三级佣金60%',
|
|
||||||
'三级佣金收益',
|
|
||||||
'月份',
|
|
||||||
'创建时间',
|
|
||||||
'结算时间',
|
|
||||||
'租户ID'
|
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -86,26 +85,30 @@
|
|||||||
.then((data) => {
|
.then((data) => {
|
||||||
list.value = data?.list || [];
|
list.value = data?.list || [];
|
||||||
list.value?.forEach((d: ShopDealerOrder) => {
|
list.value?.forEach((d: ShopDealerOrder) => {
|
||||||
|
const buyer =
|
||||||
|
(d.title ? String(d.title) : '') +
|
||||||
|
(d.nickname || d.userId
|
||||||
|
? `\n${d.nickname ?? '-'}(${d.userId ?? '-'})`
|
||||||
|
: '');
|
||||||
|
|
||||||
|
const firstDividendUserName = (d as any)?.firstDividendUserName ?? '-';
|
||||||
|
const firstDividend = (d as any)?.firstDividend ?? 0;
|
||||||
|
const secondDividendUserName =
|
||||||
|
(d as any)?.secondDividendUserName ?? '-';
|
||||||
|
const secondDividend = (d as any)?.secondDividend ?? 0;
|
||||||
|
|
||||||
array.push([
|
array.push([
|
||||||
`${d.title}`,
|
d.orderNo ?? '',
|
||||||
`${d.nickname}(${d.userId})`,
|
buyer,
|
||||||
`${d.orderNo}`,
|
toMoney(d.orderPrice),
|
||||||
`${d.orderPrice}`,
|
`${toMoney(d.firstMoney)}\n${d.firstNickname ?? '-'}`,
|
||||||
`${d.degreePrice}`,
|
`${toMoney(d.secondMoney)}\n${d.secondNickname ?? '-'}`,
|
||||||
`${d.price}`,
|
`${toMoney(firstDividend)}\n${firstDividendUserName}`,
|
||||||
`${d.settledPrice}`,
|
`${toMoney(secondDividend)}\n${secondDividendUserName}`,
|
||||||
`${d.rate}`,
|
d.isSettled === 1 ? '已结算' : '未结算',
|
||||||
`${d.payPrice}`,
|
`${d.createTime ?? ''}${
|
||||||
`${d.firstNickname}(${d.firstUserId})`,
|
d.settleTime ? `\n${toDateTime(d.settleTime)}` : ''
|
||||||
`${d.firstMoney}`,
|
}`
|
||||||
`${d.secondNickname}(${d.secondUserId})`,
|
|
||||||
`${d.secondMoney}`,
|
|
||||||
`${d.thirdNickname}(${d.thirdUserId})`,
|
|
||||||
`${d.thirdMoney}`,
|
|
||||||
`${d.month}`,
|
|
||||||
`${d.createTime}`,
|
|
||||||
`${d.settleTime}`,
|
|
||||||
`${d.tenantId}`
|
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
const sheetName = `bak_shop_dealer_order_${getTenantId()}`;
|
const sheetName = `bak_shop_dealer_order_${getTenantId()}`;
|
||||||
@@ -117,27 +120,28 @@
|
|||||||
workbook.Sheets[sheetName] = sheet;
|
workbook.Sheets[sheetName] = sheet;
|
||||||
// 设置列宽
|
// 设置列宽
|
||||||
sheet['!cols'] = [
|
sheet['!cols'] = [
|
||||||
{ wch: 10 },
|
|
||||||
{ wch: 20 },
|
{ wch: 20 },
|
||||||
{ wch: 20 },
|
{ wch: 20 },
|
||||||
{ wch: 15 },
|
{ wch: 12 },
|
||||||
{ wch: 10 },
|
{ wch: 16 },
|
||||||
|
{ wch: 16 },
|
||||||
|
{ wch: 18 },
|
||||||
|
{ wch: 16 },
|
||||||
{ wch: 10 },
|
{ wch: 10 },
|
||||||
{ wch: 20 }
|
{ wch: 20 }
|
||||||
];
|
];
|
||||||
message.loading('正在导出...');
|
message.loading('正在导出...', 0);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
writeFile(workbook, `${sheetName}.xlsx`);
|
writeFile(workbook, `${sheetName}.xlsx`);
|
||||||
|
message.destroy();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
})
|
})
|
||||||
.catch((msg) => {
|
.catch((msg) => {
|
||||||
|
message.destroy();
|
||||||
message.error(msg);
|
message.error(msg);
|
||||||
})
|
})
|
||||||
.finally(() => {});
|
.finally(() => {});
|
||||||
};
|
};
|
||||||
|
|
||||||
watch(
|
void props;
|
||||||
() => props.selection,
|
|
||||||
() => {}
|
|
||||||
);
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -13,11 +13,6 @@
|
|||||||
<template #toolbar>
|
<template #toolbar>
|
||||||
<search
|
<search
|
||||||
@search="reload"
|
@search="reload"
|
||||||
:selection="selection"
|
|
||||||
@batchSettle="batchSettle"
|
|
||||||
@export="handleExport"
|
|
||||||
@remove="removeBatch"
|
|
||||||
@importDone="reload"
|
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template #bodyCell="{ column, record }">
|
<template #bodyCell="{ column, record }">
|
||||||
@@ -181,7 +176,6 @@
|
|||||||
ShopDealerOrderParam
|
ShopDealerOrderParam
|
||||||
} from '@/api/shop/shopDealerOrder/model';
|
} from '@/api/shop/shopDealerOrder/model';
|
||||||
import {
|
import {
|
||||||
exportShopDealerOrder,
|
|
||||||
updateShopDealerOrder
|
updateShopDealerOrder
|
||||||
} from '@/api/shop/shopDealerOrder';
|
} from '@/api/shop/shopDealerOrder';
|
||||||
|
|
||||||
@@ -197,9 +191,6 @@
|
|||||||
// 加载状态
|
// 加载状态
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
|
|
||||||
// 当前搜索条件
|
|
||||||
const currentWhere = ref<ShopDealerOrderParam>({});
|
|
||||||
|
|
||||||
// 表格数据源
|
// 表格数据源
|
||||||
const datasource: DatasourceFunction = ({
|
const datasource: DatasourceFunction = ({
|
||||||
page,
|
page,
|
||||||
@@ -211,8 +202,6 @@
|
|||||||
if (filters) {
|
if (filters) {
|
||||||
where.status = filters.status;
|
where.status = filters.status;
|
||||||
}
|
}
|
||||||
// 保存当前搜索条件用于导出
|
|
||||||
currentWhere.value = { ...where };
|
|
||||||
// 已结算订单
|
// 已结算订单
|
||||||
where.isSettled = 1;
|
where.isSettled = 1;
|
||||||
return pageShopDealerOrder({
|
return pageShopDealerOrder({
|
||||||
@@ -381,12 +370,6 @@
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/* 导出数据 */
|
|
||||||
const handleExport = () => {
|
|
||||||
// 调用导出API,传入当前搜索条件
|
|
||||||
exportShopDealerOrder(currentWhere.value);
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 打开编辑弹窗 */
|
/* 打开编辑弹窗 */
|
||||||
const openEdit = (row?: ShopDealerOrder) => {
|
const openEdit = (row?: ShopDealerOrder) => {
|
||||||
current.value = row ?? null;
|
current.value = row ?? null;
|
||||||
|
|||||||
@@ -1,221 +1,42 @@
|
|||||||
<!-- 搜索表单 -->
|
<!-- 搜索表单 -->
|
||||||
<template>
|
<template>
|
||||||
<div class="search-container">
|
<a-space :size="10" style="flex-wrap: wrap">
|
||||||
<!-- 搜索表单 -->
|
<a-button type="primary" class="ele-btn-icon" @click="add">
|
||||||
<a-form
|
<template #icon>
|
||||||
:model="searchForm"
|
<PlusOutlined />
|
||||||
layout="inline"
|
</template>
|
||||||
class="search-form"
|
<span>添加</span>
|
||||||
@finish="handleSearch"
|
</a-button>
|
||||||
>
|
</a-space>
|
||||||
<a-form-item label="申请人姓名">
|
|
||||||
<a-input
|
|
||||||
v-model:value="searchForm.realName"
|
|
||||||
placeholder="请输入申请人姓名"
|
|
||||||
allow-clear
|
|
||||||
style="width: 160px"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<a-form-item label="手机号码">
|
|
||||||
<a-input
|
|
||||||
v-model:value="searchForm.mobile"
|
|
||||||
placeholder="请输入手机号码"
|
|
||||||
allow-clear
|
|
||||||
style="width: 160px"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<a-form-item label="申请方式">
|
|
||||||
<a-select
|
|
||||||
v-model:value="searchForm.applyType"
|
|
||||||
placeholder="全部方式"
|
|
||||||
allow-clear
|
|
||||||
style="width: 120px"
|
|
||||||
>
|
|
||||||
<a-select-option :value="10">需要审核</a-select-option>
|
|
||||||
<a-select-option :value="20">免审核</a-select-option>
|
|
||||||
</a-select>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<a-form-item label="审核状态">
|
|
||||||
<a-select
|
|
||||||
v-model:value="searchForm.applyStatus"
|
|
||||||
placeholder="全部状态"
|
|
||||||
allow-clear
|
|
||||||
style="width: 120px"
|
|
||||||
>
|
|
||||||
<a-select-option :value="10">待审核</a-select-option>
|
|
||||||
<a-select-option :value="20">审核通过</a-select-option>
|
|
||||||
<a-select-option :value="30">审核驳回</a-select-option>
|
|
||||||
</a-select>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<a-form-item label="申请时间">
|
|
||||||
<a-range-picker
|
|
||||||
v-model:value="searchForm.dateRange"
|
|
||||||
style="width: 240px"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<a-form-item>
|
|
||||||
<a-space>
|
|
||||||
<a-button type="primary" html-type="submit" class="ele-btn-icon">
|
|
||||||
<template #icon>
|
|
||||||
<SearchOutlined />
|
|
||||||
</template>
|
|
||||||
搜索
|
|
||||||
</a-button>
|
|
||||||
<a-button @click="resetSearch"> 重置 </a-button>
|
|
||||||
</a-space>
|
|
||||||
</a-form-item>
|
|
||||||
</a-form>
|
|
||||||
|
|
||||||
<!-- 操作按钮 -->
|
|
||||||
<div class="action-buttons">
|
|
||||||
<a-space>
|
|
||||||
<!-- <a-button type="primary" @click="add" class="ele-btn-icon">-->
|
|
||||||
<!-- <template #icon>-->
|
|
||||||
<!-- <PlusOutlined />-->
|
|
||||||
<!-- </template>-->
|
|
||||||
<!-- 新增申请-->
|
|
||||||
<!-- </a-button>-->
|
|
||||||
<a-button
|
|
||||||
type="primary"
|
|
||||||
ghost
|
|
||||||
:disabled="!selection?.length"
|
|
||||||
@click="batchApprove"
|
|
||||||
class="ele-btn-icon"
|
|
||||||
>
|
|
||||||
<template #icon>
|
|
||||||
<CheckOutlined />
|
|
||||||
</template>
|
|
||||||
批量通过
|
|
||||||
</a-button>
|
|
||||||
<a-button
|
|
||||||
:disabled="!selection?.length"
|
|
||||||
@click="exportData"
|
|
||||||
class="ele-btn-icon"
|
|
||||||
>
|
|
||||||
<template #icon>
|
|
||||||
<ExportOutlined />
|
|
||||||
</template>
|
|
||||||
导出数据
|
|
||||||
</a-button>
|
|
||||||
</a-space>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { reactive } from 'vue';
|
import { PlusOutlined } from '@ant-design/icons-vue';
|
||||||
import {
|
import type { GradeParam } from '@/api/user/grade/model';
|
||||||
PlusOutlined,
|
import { watch } from 'vue';
|
||||||
SearchOutlined,
|
|
||||||
CheckOutlined,
|
|
||||||
ExportOutlined
|
|
||||||
} from '@ant-design/icons-vue';
|
|
||||||
import type { ShopDealerApplyParam } from '@/api/shop/shopDealerApply/model';
|
|
||||||
import dayjs from 'dayjs';
|
|
||||||
|
|
||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
// 选中的数据
|
// 选中的角色
|
||||||
selection?: any[];
|
selection?: [];
|
||||||
}>(),
|
}>(),
|
||||||
{
|
{}
|
||||||
selection: () => []
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'search', where?: ShopDealerApplyParam): void;
|
(e: 'search', where?: GradeParam): void;
|
||||||
(e: 'add'): void;
|
(e: 'add'): void;
|
||||||
(e: 'batchApprove'): void;
|
(e: 'remove'): void;
|
||||||
(e: 'export'): void;
|
(e: 'batchMove'): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
// 搜索表单
|
|
||||||
const searchForm = reactive<any>({
|
|
||||||
realName: '',
|
|
||||||
mobile: '',
|
|
||||||
applyType: undefined,
|
|
||||||
applyStatus: undefined,
|
|
||||||
dateRange: undefined
|
|
||||||
});
|
|
||||||
|
|
||||||
// 搜索
|
|
||||||
const handleSearch = () => {
|
|
||||||
const searchParams: ShopDealerApplyParam = {};
|
|
||||||
|
|
||||||
if (searchForm.realName) {
|
|
||||||
searchParams.realName = searchForm.realName;
|
|
||||||
}
|
|
||||||
if (searchForm.mobile) {
|
|
||||||
searchParams.mobile = searchForm.mobile;
|
|
||||||
}
|
|
||||||
if (searchForm.applyType) {
|
|
||||||
searchParams.applyType = searchForm.applyType;
|
|
||||||
}
|
|
||||||
if (searchForm.applyStatus) {
|
|
||||||
searchParams.applyStatus = searchForm.applyStatus;
|
|
||||||
}
|
|
||||||
if (searchForm.dateRange && searchForm.dateRange.length === 2) {
|
|
||||||
searchParams.startTime = dayjs(searchForm.dateRange[0]).format(
|
|
||||||
'YYYY-MM-DD'
|
|
||||||
);
|
|
||||||
searchParams.endTime = dayjs(searchForm.dateRange[1]).format(
|
|
||||||
'YYYY-MM-DD'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
emit('search', searchParams);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 重置搜索
|
|
||||||
const resetSearch = () => {
|
|
||||||
searchForm.realName = '';
|
|
||||||
searchForm.mobile = '';
|
|
||||||
searchForm.applyType = undefined;
|
|
||||||
searchForm.applyStatus = undefined;
|
|
||||||
searchForm.dateRange = undefined;
|
|
||||||
emit('search', {});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 新增
|
// 新增
|
||||||
const add = () => {
|
const add = () => {
|
||||||
emit('add');
|
emit('add');
|
||||||
};
|
};
|
||||||
|
|
||||||
// 批量通过
|
watch(
|
||||||
const batchApprove = () => {
|
() => props.selection,
|
||||||
emit('batchApprove');
|
() => {}
|
||||||
};
|
);
|
||||||
|
|
||||||
// 导出数据
|
|
||||||
const exportData = () => {
|
|
||||||
emit('export');
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
|
||||||
.search-container {
|
|
||||||
background: #fff;
|
|
||||||
padding: 16px;
|
|
||||||
border-radius: 6px;
|
|
||||||
margin-bottom: 16px;
|
|
||||||
|
|
||||||
.search-form {
|
|
||||||
margin-bottom: 16px;
|
|
||||||
|
|
||||||
:deep(.ant-form-item) {
|
|
||||||
margin-bottom: 8px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.action-buttons {
|
|
||||||
border-top: 1px solid #f0f0f0;
|
|
||||||
padding-top: 16px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
@@ -1,430 +0,0 @@
|
|||||||
<!-- 编辑弹窗 -->
|
|
||||||
<template>
|
|
||||||
<ele-modal
|
|
||||||
:width="900"
|
|
||||||
:visible="visible"
|
|
||||||
:maskClosable="false"
|
|
||||||
:maxable="maxable"
|
|
||||||
:title="isUpdate ? '编辑分销商申请' : '新增分销商申请'"
|
|
||||||
:body-style="{ paddingBottom: '28px' }"
|
|
||||||
@update:visible="updateVisible"
|
|
||||||
@ok="save"
|
|
||||||
>
|
|
||||||
<a-form
|
|
||||||
ref="formRef"
|
|
||||||
:model="form"
|
|
||||||
:rules="rules"
|
|
||||||
:label-col="{ span: 6 }"
|
|
||||||
:wrapper-col="{ span: 18 }"
|
|
||||||
>
|
|
||||||
<!-- 申请人信息 -->
|
|
||||||
<a-divider orientation="left">
|
|
||||||
<span style="color: #1890ff; font-weight: 600">申请人信息</span>
|
|
||||||
</a-divider>
|
|
||||||
|
|
||||||
<a-row :gutter="16">
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="用户ID" name="userId">
|
|
||||||
<a-input-number
|
|
||||||
:min="1"
|
|
||||||
placeholder="请输入用户ID"
|
|
||||||
:disabled="isUpdate"
|
|
||||||
v-model:value="form.userId"
|
|
||||||
style="width: 100%"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="真实姓名" name="realName">
|
|
||||||
<a-input
|
|
||||||
placeholder="请输入真实姓名"
|
|
||||||
v-model:value="form.realName"
|
|
||||||
:disabled="isUpdate"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
</a-row>
|
|
||||||
|
|
||||||
<a-row :gutter="16">
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="手机号码" name="mobile">
|
|
||||||
<a-input
|
|
||||||
placeholder="请输入手机号码"
|
|
||||||
:disabled="isUpdate"
|
|
||||||
v-model:value="form.mobile"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="推荐人ID" name="refereeId">
|
|
||||||
<a-input-number
|
|
||||||
:min="1"
|
|
||||||
placeholder="请输入推荐人用户ID"
|
|
||||||
:disabled="isUpdate"
|
|
||||||
v-model:value="form.refereeId"
|
|
||||||
style="width: 100%"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
</a-row>
|
|
||||||
|
|
||||||
<!-- 审核信息 -->
|
|
||||||
<a-divider orientation="left">
|
|
||||||
<span style="color: #1890ff; font-weight: 600">审核信息</span>
|
|
||||||
</a-divider>
|
|
||||||
|
|
||||||
<a-row :gutter="16">
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="审核状态" name="applyStatus">
|
|
||||||
<a-select
|
|
||||||
v-model:value="form.applyStatus"
|
|
||||||
placeholder="请选择审核状态"
|
|
||||||
@change="handleStatusChange"
|
|
||||||
>
|
|
||||||
<a-select-option :value="10">
|
|
||||||
<a-tag color="processing">待审核</a-tag>
|
|
||||||
<span style="margin-left: 8px">等待审核</span>
|
|
||||||
</a-select-option>
|
|
||||||
<a-select-option :value="20">
|
|
||||||
<a-tag color="success">审核通过</a-tag>
|
|
||||||
<span style="margin-left: 8px">申请通过</span>
|
|
||||||
</a-select-option>
|
|
||||||
<a-select-option :value="30">
|
|
||||||
<a-tag color="error">审核驳回</a-tag>
|
|
||||||
<span style="margin-left: 8px">申请驳回</span>
|
|
||||||
</a-select-option>
|
|
||||||
</a-select>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<!-- <a-col :span="12">-->
|
|
||||||
<!-- <a-form-item label="审核时间" name="auditTime" v-if="form.applyStatus === 20 || form.applyStatus === 30">-->
|
|
||||||
<!-- <a-date-picker-->
|
|
||||||
<!-- v-model:value="form.auditTime"-->
|
|
||||||
<!-- show-time-->
|
|
||||||
<!-- format="YYYY-MM-DD HH:mm:ss"-->
|
|
||||||
<!-- placeholder="请选择审核时间"-->
|
|
||||||
<!-- style="width: 100%"-->
|
|
||||||
<!-- />-->
|
|
||||||
<!-- </a-form-item>-->
|
|
||||||
<!-- </a-col>-->
|
|
||||||
</a-row>
|
|
||||||
|
|
||||||
<a-row :gutter="16" v-if="form.applyStatus === 30">
|
|
||||||
<a-col :span="24">
|
|
||||||
<a-form-item label="驳回原因" name="rejectReason">
|
|
||||||
<a-textarea
|
|
||||||
v-model:value="form.rejectReason"
|
|
||||||
placeholder="请输入驳回原因"
|
|
||||||
style="width: 100%"
|
|
||||||
:rows="3"
|
|
||||||
:maxlength="200"
|
|
||||||
show-count
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
</a-row>
|
|
||||||
</a-form>
|
|
||||||
</ele-modal>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { ref, reactive, watch } from 'vue';
|
|
||||||
import { Form, message } from 'ant-design-vue';
|
|
||||||
import dayjs from 'dayjs';
|
|
||||||
import { assignObject, uuid } from 'ele-admin-pro';
|
|
||||||
import {
|
|
||||||
addShopDealerApply,
|
|
||||||
updateShopDealerApply
|
|
||||||
} from '@/api/shop/shopDealerApply';
|
|
||||||
import { ShopDealerApply } from '@/api/shop/shopDealerApply/model';
|
|
||||||
import { useThemeStore } from '@/store/modules/theme';
|
|
||||||
import { storeToRefs } from 'pinia';
|
|
||||||
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
|
|
||||||
import { FormInstance } from 'ant-design-vue/es/form';
|
|
||||||
import { FileRecord } from '@/api/system/file/model';
|
|
||||||
|
|
||||||
// 是否是修改
|
|
||||||
const isUpdate = ref(false);
|
|
||||||
const useForm = Form.useForm;
|
|
||||||
// 是否开启响应式布局
|
|
||||||
const themeStore = useThemeStore();
|
|
||||||
const { styleResponsive } = storeToRefs(themeStore);
|
|
||||||
|
|
||||||
const props = defineProps<{
|
|
||||||
// 弹窗是否打开
|
|
||||||
visible: boolean;
|
|
||||||
// 修改回显的数据
|
|
||||||
data?: ShopDealerApply | null;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
(e: 'done'): void;
|
|
||||||
(e: 'update:visible', visible: boolean): void;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
// 提交状态
|
|
||||||
const loading = ref(false);
|
|
||||||
// 是否显示最大化切换按钮
|
|
||||||
const maxable = ref(true);
|
|
||||||
// 表格选中数据
|
|
||||||
const formRef = ref<FormInstance | null>(null);
|
|
||||||
const images = ref<ItemType[]>([]);
|
|
||||||
|
|
||||||
// 表单数据
|
|
||||||
const form = reactive<ShopDealerApply>({
|
|
||||||
applyId: undefined,
|
|
||||||
userId: undefined,
|
|
||||||
realName: '',
|
|
||||||
mobile: '',
|
|
||||||
refereeId: undefined,
|
|
||||||
applyType: 10,
|
|
||||||
applyTime: undefined,
|
|
||||||
applyStatus: 10,
|
|
||||||
auditTime: undefined,
|
|
||||||
rejectReason: '',
|
|
||||||
tenantId: undefined,
|
|
||||||
createTime: undefined,
|
|
||||||
updateTime: undefined
|
|
||||||
});
|
|
||||||
|
|
||||||
/* 更新visible */
|
|
||||||
const updateVisible = (value: boolean) => {
|
|
||||||
emit('update:visible', value);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 表单验证规则
|
|
||||||
const rules = reactive({
|
|
||||||
userId: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请输入用户ID',
|
|
||||||
trigger: 'blur'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
realName: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请输入真实姓名',
|
|
||||||
trigger: 'blur'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
min: 2,
|
|
||||||
max: 20,
|
|
||||||
message: '姓名长度应在2-20个字符之间',
|
|
||||||
trigger: 'blur'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
mobile: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请输入手机号码',
|
|
||||||
trigger: 'blur'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
pattern: /^1[3-9]\d{9}$/,
|
|
||||||
message: '请输入正确的手机号码',
|
|
||||||
trigger: 'blur'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
applyType: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请选择申请方式',
|
|
||||||
trigger: 'change'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
applyStatus: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请选择审核状态',
|
|
||||||
trigger: 'change'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
rejectReason: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '驳回时必须填写驳回原因',
|
|
||||||
trigger: 'blur'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
auditTime: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '审核时请选择审核时间',
|
|
||||||
trigger: 'change'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
const { resetFields } = useForm(form, rules);
|
|
||||||
|
|
||||||
/* 处理审核状态变化 */
|
|
||||||
const handleStatusChange = (value: number) => {
|
|
||||||
// 当状态改为审核通过或驳回时,自动设置审核时间为当前时间
|
|
||||||
if ((value === 20 || value === 30) && !form.auditTime) {
|
|
||||||
form.auditTime = dayjs();
|
|
||||||
}
|
|
||||||
// 当状态改为待审核时,清空审核时间和驳回原因
|
|
||||||
if (value === 10) {
|
|
||||||
form.auditTime = undefined;
|
|
||||||
form.rejectReason = '';
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 保存编辑 */
|
|
||||||
const save = () => {
|
|
||||||
if (!formRef.value) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 动态验证规则
|
|
||||||
const validateFields: string[] = [
|
|
||||||
'userId',
|
|
||||||
'realName',
|
|
||||||
'mobile',
|
|
||||||
'applyStatus'
|
|
||||||
];
|
|
||||||
|
|
||||||
// 如果是驳回状态,需要验证驳回原因
|
|
||||||
if (form.applyStatus === 30) {
|
|
||||||
validateFields.push('rejectReason');
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果是审核通过或驳回状态,需要验证审核时间
|
|
||||||
if (form.applyStatus === 20 || form.applyStatus === 30) {
|
|
||||||
validateFields.push('auditTime');
|
|
||||||
}
|
|
||||||
|
|
||||||
formRef.value
|
|
||||||
.validate(validateFields)
|
|
||||||
.then(() => {
|
|
||||||
loading.value = true;
|
|
||||||
const formData = {
|
|
||||||
...form
|
|
||||||
};
|
|
||||||
|
|
||||||
// 处理时间字段转换 - 转换为ISO字符串格式
|
|
||||||
if (formData.applyTime) {
|
|
||||||
if (dayjs.isDayjs(formData.applyTime)) {
|
|
||||||
formData.applyTime = formData.applyTime.format(
|
|
||||||
'YYYY-MM-DD HH:mm:ss'
|
|
||||||
);
|
|
||||||
} else if (typeof formData.applyTime === 'number') {
|
|
||||||
formData.applyTime = dayjs(formData.applyTime).format(
|
|
||||||
'YYYY-MM-DD HH:mm:ss'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (formData.auditTime) {
|
|
||||||
if (dayjs.isDayjs(formData.auditTime)) {
|
|
||||||
formData.auditTime = formData.auditTime.format(
|
|
||||||
'YYYY-MM-DD HH:mm:ss'
|
|
||||||
);
|
|
||||||
} else if (typeof formData.auditTime === 'number') {
|
|
||||||
formData.auditTime = dayjs(formData.auditTime).format(
|
|
||||||
'YYYY-MM-DD HH:mm:ss'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 当审核状态为通过或驳回时,确保有审核时间
|
|
||||||
if (
|
|
||||||
(formData.applyStatus === 20 || formData.applyStatus === 30) &&
|
|
||||||
!formData.auditTime
|
|
||||||
) {
|
|
||||||
formData.auditTime = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
||||||
}
|
|
||||||
|
|
||||||
// 当状态为待审核时,清空审核时间
|
|
||||||
if (formData.applyStatus === 10) {
|
|
||||||
formData.auditTime = undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
const saveOrUpdate = isUpdate.value
|
|
||||||
? updateShopDealerApply
|
|
||||||
: addShopDealerApply;
|
|
||||||
saveOrUpdate(formData)
|
|
||||||
.then((msg) => {
|
|
||||||
loading.value = false;
|
|
||||||
message.success(msg);
|
|
||||||
updateVisible(false);
|
|
||||||
emit('done');
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
loading.value = false;
|
|
||||||
message.error(e.message);
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.catch(() => {});
|
|
||||||
};
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => props.visible,
|
|
||||||
(visible) => {
|
|
||||||
if (visible) {
|
|
||||||
if (props.data) {
|
|
||||||
assignObject(form, props.data);
|
|
||||||
// 处理时间字段 - 确保转换为dayjs对象
|
|
||||||
if (props.data.applyTime) {
|
|
||||||
form.applyTime = dayjs(props.data.applyTime);
|
|
||||||
}
|
|
||||||
if (props.data.auditTime) {
|
|
||||||
form.auditTime = dayjs(props.data.auditTime);
|
|
||||||
}
|
|
||||||
isUpdate.value = true;
|
|
||||||
} else {
|
|
||||||
// 重置为默认值
|
|
||||||
Object.assign(form, {
|
|
||||||
applyId: undefined,
|
|
||||||
userId: undefined,
|
|
||||||
realName: '',
|
|
||||||
mobile: '',
|
|
||||||
refereeId: undefined,
|
|
||||||
applyType: 10,
|
|
||||||
applyTime: dayjs(),
|
|
||||||
applyStatus: 10,
|
|
||||||
auditTime: undefined,
|
|
||||||
rejectReason: '',
|
|
||||||
tenantId: undefined,
|
|
||||||
createTime: undefined,
|
|
||||||
updateTime: undefined
|
|
||||||
});
|
|
||||||
isUpdate.value = false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
resetFields();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ immediate: true }
|
|
||||||
);
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="less" scoped>
|
|
||||||
:deep(.ant-divider-horizontal.ant-divider-with-text-left) {
|
|
||||||
margin: 24px 0 16px 0;
|
|
||||||
|
|
||||||
.ant-divider-inner-text {
|
|
||||||
padding: 0 16px 0 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.ant-form-item) {
|
|
||||||
margin-bottom: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.ant-radio) {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
margin-bottom: 8px;
|
|
||||||
|
|
||||||
.ant-radio-inner {
|
|
||||||
margin-right: 8px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.ant-select-selection-item) {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
317
src/views/shop/shopDealerUser/components/shopDealerUserEdit.vue
Normal file
317
src/views/shop/shopDealerUser/components/shopDealerUserEdit.vue
Normal file
@@ -0,0 +1,317 @@
|
|||||||
|
<!-- 编辑弹窗 -->
|
||||||
|
<template>
|
||||||
|
<ele-modal
|
||||||
|
:width="800"
|
||||||
|
:visible="visible"
|
||||||
|
:maskClosable="false"
|
||||||
|
:maxable="maxable"
|
||||||
|
:title="isUpdate ? '编辑分销商用户记录表' : '添加分销商用户记录表'"
|
||||||
|
:body-style="{ paddingBottom: '28px' }"
|
||||||
|
@update:visible="updateVisible"
|
||||||
|
@ok="save"
|
||||||
|
>
|
||||||
|
<a-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="form"
|
||||||
|
:rules="rules"
|
||||||
|
:label-col="styleResponsive ? { md: 4, sm: 5, xs: 24 } : { flex: '90px' }"
|
||||||
|
:wrapper-col="
|
||||||
|
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<a-form-item label="类型 0经销商 1企业 2集团" name="type">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入类型 0经销商 1企业 2集团"
|
||||||
|
v-model:value="form.type"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="自增ID" name="userId">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入自增ID"
|
||||||
|
v-model:value="form.userId"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="姓名" name="realName">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入姓名"
|
||||||
|
v-model:value="form.realName"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="手机号" name="mobile">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入手机号"
|
||||||
|
v-model:value="form.mobile"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="支付密码" name="payPassword">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入支付密码"
|
||||||
|
v-model:value="form.payPassword"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="当前可提现佣金" name="money">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入当前可提现佣金"
|
||||||
|
v-model:value="form.money"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="已冻结佣金" name="freezeMoney">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入已冻结佣金"
|
||||||
|
v-model:value="form.freezeMoney"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="累积提现佣金" name="totalMoney">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入累积提现佣金"
|
||||||
|
v-model:value="form.totalMoney"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="收益基数" name="rate">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入收益基数"
|
||||||
|
v-model:value="form.rate"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="单价" name="price">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入单价"
|
||||||
|
v-model:value="form.price"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="推荐人用户ID" name="refereeId">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入推荐人用户ID"
|
||||||
|
v-model:value="form.refereeId"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="成员数量(一级)" name="firstNum">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入成员数量(一级)"
|
||||||
|
v-model:value="form.firstNum"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="成员数量(二级)" name="secondNum">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入成员数量(二级)"
|
||||||
|
v-model:value="form.secondNum"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="成员数量(三级)" name="thirdNum">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入成员数量(三级)"
|
||||||
|
v-model:value="form.thirdNum"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="专属二维码" name="qrcode">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入专属二维码"
|
||||||
|
v-model:value="form.qrcode"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="备注" name="comments">
|
||||||
|
<a-textarea
|
||||||
|
:rows="4"
|
||||||
|
:maxlength="200"
|
||||||
|
placeholder="请输入描述"
|
||||||
|
v-model:value="form.comments"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="排序号" name="sortNumber">
|
||||||
|
<a-input-number
|
||||||
|
:min="0"
|
||||||
|
:max="9999"
|
||||||
|
class="ele-fluid"
|
||||||
|
placeholder="请输入排序号"
|
||||||
|
v-model:value="form.sortNumber"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="是否删除" name="isDelete">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入是否删除"
|
||||||
|
v-model:value="form.isDelete"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="修改时间" name="updateTime">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入修改时间"
|
||||||
|
v-model:value="form.updateTime"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
</ele-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, reactive, watch } from 'vue';
|
||||||
|
import { Form, message } from 'ant-design-vue';
|
||||||
|
import { assignObject, uuid } from 'ele-admin-pro';
|
||||||
|
import { addShopDealerUser, updateShopDealerUser } from '@/api/shop/shopDealerUser';
|
||||||
|
import { ShopDealerUser } from '@/api/shop/shopDealerUser/model';
|
||||||
|
import { useThemeStore } from '@/store/modules/theme';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
|
||||||
|
import { FormInstance } from 'ant-design-vue/es/form';
|
||||||
|
import { FileRecord } from '@/api/system/file/model';
|
||||||
|
|
||||||
|
// 是否是修改
|
||||||
|
const isUpdate = ref(false);
|
||||||
|
const useForm = Form.useForm;
|
||||||
|
// 是否开启响应式布局
|
||||||
|
const themeStore = useThemeStore();
|
||||||
|
const { styleResponsive } = storeToRefs(themeStore);
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
// 弹窗是否打开
|
||||||
|
visible: boolean;
|
||||||
|
// 修改回显的数据
|
||||||
|
data?: ShopDealerUser | null;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'done'): void;
|
||||||
|
(e: 'update:visible', visible: boolean): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
// 提交状态
|
||||||
|
const loading = ref(false);
|
||||||
|
// 是否显示最大化切换按钮
|
||||||
|
const maxable = ref(true);
|
||||||
|
// 表格选中数据
|
||||||
|
const formRef = ref<FormInstance | null>(null);
|
||||||
|
const images = ref<ItemType[]>([]);
|
||||||
|
|
||||||
|
// 用户信息
|
||||||
|
const form = reactive<ShopDealerUser>({
|
||||||
|
id: undefined,
|
||||||
|
type: undefined,
|
||||||
|
userId: undefined,
|
||||||
|
realName: undefined,
|
||||||
|
mobile: undefined,
|
||||||
|
payPassword: undefined,
|
||||||
|
money: undefined,
|
||||||
|
freezeMoney: undefined,
|
||||||
|
totalMoney: undefined,
|
||||||
|
rate: undefined,
|
||||||
|
price: undefined,
|
||||||
|
refereeId: undefined,
|
||||||
|
firstNum: undefined,
|
||||||
|
secondNum: undefined,
|
||||||
|
thirdNum: undefined,
|
||||||
|
qrcode: undefined,
|
||||||
|
comments: undefined,
|
||||||
|
sortNumber: undefined,
|
||||||
|
isDelete: undefined,
|
||||||
|
tenantId: undefined,
|
||||||
|
createTime: undefined,
|
||||||
|
updateTime: undefined,
|
||||||
|
shopDealerUserId: undefined,
|
||||||
|
shopDealerUserName: '',
|
||||||
|
status: 0,
|
||||||
|
comments: '',
|
||||||
|
sortNumber: 100
|
||||||
|
});
|
||||||
|
|
||||||
|
/* 更新visible */
|
||||||
|
const updateVisible = (value: boolean) => {
|
||||||
|
emit('update:visible', value);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 表单验证规则
|
||||||
|
const rules = reactive({
|
||||||
|
shopDealerUserName: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
type: 'string',
|
||||||
|
message: '请填写分销商用户记录表名称',
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
const chooseImage = (data: FileRecord) => {
|
||||||
|
images.value.push({
|
||||||
|
uid: data.id,
|
||||||
|
url: data.path,
|
||||||
|
status: 'done'
|
||||||
|
});
|
||||||
|
form.image = data.path;
|
||||||
|
};
|
||||||
|
|
||||||
|
const onDeleteItem = (index: number) => {
|
||||||
|
images.value.splice(index, 1);
|
||||||
|
form.image = '';
|
||||||
|
};
|
||||||
|
|
||||||
|
const { resetFields } = useForm(form, rules);
|
||||||
|
|
||||||
|
/* 保存编辑 */
|
||||||
|
const save = () => {
|
||||||
|
if (!formRef.value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
formRef.value
|
||||||
|
.validate()
|
||||||
|
.then(() => {
|
||||||
|
loading.value = true;
|
||||||
|
const formData = {
|
||||||
|
...form
|
||||||
|
};
|
||||||
|
const saveOrUpdate = isUpdate.value ? updateShopDealerUser : addShopDealerUser;
|
||||||
|
saveOrUpdate(formData)
|
||||||
|
.then((msg) => {
|
||||||
|
loading.value = false;
|
||||||
|
message.success(msg);
|
||||||
|
updateVisible(false);
|
||||||
|
emit('done');
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
loading.value = false;
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.visible,
|
||||||
|
(visible) => {
|
||||||
|
if (visible) {
|
||||||
|
images.value = [];
|
||||||
|
if (props.data) {
|
||||||
|
assignObject(form, props.data);
|
||||||
|
if(props.data.image){
|
||||||
|
images.value.push({
|
||||||
|
uid: uuid(),
|
||||||
|
url: props.data.image,
|
||||||
|
status: 'done'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
isUpdate.value = true;
|
||||||
|
} else {
|
||||||
|
isUpdate.value = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
resetFields();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
);
|
||||||
|
</script>
|
||||||
@@ -1,115 +1,85 @@
|
|||||||
<template>
|
<template>
|
||||||
<a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
|
<a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
|
||||||
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
||||||
<ele-pro-table
|
<ele-pro-table
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
row-key="applyId"
|
row-key="id"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:datasource="datasource"
|
:datasource="datasource"
|
||||||
:customRow="customRow"
|
:customRow="customRow"
|
||||||
tool-class="ele-toolbar-form"
|
tool-class="ele-toolbar-form"
|
||||||
class="sys-org-table"
|
class="sys-org-table"
|
||||||
v-model:selection="selection"
|
>
|
||||||
>
|
<template #toolbar>
|
||||||
<template #toolbar>
|
<search
|
||||||
<search
|
@search="reload"
|
||||||
@search="reload"
|
:selection="selection"
|
||||||
:selection="selection"
|
@add="openEdit"
|
||||||
@add="openEdit"
|
@remove="removeBatch"
|
||||||
@batchApprove="batchApprove"
|
@batchMove="openMove"
|
||||||
@export="exportData"
|
/>
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
<template #bodyCell="{ column, record }">
|
|
||||||
<template v-if="column.key === 'applyStatus'">
|
|
||||||
<a-tag v-if="record.applyStatus === 10" color="orange"
|
|
||||||
>待审核</a-tag
|
|
||||||
>
|
|
||||||
<a-tag v-if="record.applyStatus === 20" color="green">已通过</a-tag>
|
|
||||||
<a-tag v-if="record.applyStatus === 30" color="red">已驳回</a-tag>
|
|
||||||
</template>
|
</template>
|
||||||
<template v-if="column.key === 'action'">
|
<template #bodyCell="{ column, record }">
|
||||||
<a @click="openEdit(record)" class="ele-text-primary">
|
<template v-if="column.key === 'image'">
|
||||||
<EditOutlined />
|
<a-image :src="record.image" :width="50" />
|
||||||
编辑
|
</template>
|
||||||
</a>
|
<template v-if="column.key === 'type'">
|
||||||
<template v-if="record.applyStatus !== 20">
|
<a-tag v-if="record.type === 0">经销商</a-tag>
|
||||||
<a-divider type="vertical" />
|
<a-tag v-if="record.type === 1" color="orange">门店</a-tag>
|
||||||
<a @click="approveApply(record)" class="ele-text-success">
|
<a-tag v-if="record.type === 2" color="purple">集团</a-tag>
|
||||||
<CheckOutlined />
|
</template>
|
||||||
通过
|
<template v-if="column.key === 'status'">
|
||||||
</a>
|
<a-tag v-if="record.status === 0" color="green">显示</a-tag>
|
||||||
<a-divider type="vertical" />
|
<a-tag v-if="record.status === 1" color="red">隐藏</a-tag>
|
||||||
<a @click="rejectApply(record)" class="ele-text-warning">
|
</template>
|
||||||
<CloseOutlined />
|
<template v-if="column.key === 'action'">
|
||||||
驳回
|
<a-space>
|
||||||
</a>
|
<a @click="openEdit(record)">修改</a>
|
||||||
<a-divider type="vertical" />
|
<a-divider type="vertical" />
|
||||||
<a-popconfirm
|
<a-popconfirm
|
||||||
v-if="record.applyStatus != 20"
|
title="确定要删除此记录吗?"
|
||||||
title="确定要删除此申请记录吗?"
|
@confirm="remove(record)"
|
||||||
@confirm="remove(record)"
|
>
|
||||||
placement="topRight"
|
<a class="ele-text-danger">删除</a>
|
||||||
>
|
</a-popconfirm>
|
||||||
<a class="ele-text-danger">
|
</a-space>
|
||||||
<DeleteOutlined />
|
|
||||||
删除
|
|
||||||
</a>
|
|
||||||
</a-popconfirm>
|
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</ele-pro-table>
|
||||||
</ele-pro-table>
|
</a-card>
|
||||||
</a-card>
|
|
||||||
|
|
||||||
<!-- 编辑弹窗 -->
|
<!-- 编辑弹窗 -->
|
||||||
<ShopDealerApplyEdit
|
<ShopDealerUserEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||||
v-model:visible="showEdit"
|
|
||||||
:data="current"
|
|
||||||
@done="reload"
|
|
||||||
/>
|
|
||||||
</a-page-header>
|
</a-page-header>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { createVNode, ref } from 'vue';
|
import { createVNode, ref, computed } from 'vue';
|
||||||
import { message, Modal } from 'ant-design-vue';
|
import { message, Modal } from 'ant-design-vue';
|
||||||
import {
|
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||||
ExclamationCircleOutlined,
|
|
||||||
CheckOutlined,
|
|
||||||
CloseOutlined,
|
|
||||||
EditOutlined,
|
|
||||||
DeleteOutlined
|
|
||||||
} from '@ant-design/icons-vue';
|
|
||||||
import type { EleProTable } from 'ele-admin-pro';
|
import type { EleProTable } from 'ele-admin-pro';
|
||||||
|
import { toDateString } from 'ele-admin-pro';
|
||||||
import type {
|
import type {
|
||||||
DatasourceFunction,
|
DatasourceFunction,
|
||||||
ColumnItem
|
ColumnItem
|
||||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||||
import Search from './components/search.vue';
|
import Search from './components/search.vue';
|
||||||
import { getPageTitle } from '@/utils/common';
|
import {getPageTitle} from '@/utils/common';
|
||||||
import ShopDealerApplyEdit from './components/shopDealerApplyEdit.vue';
|
import ShopDealerUserEdit from './components/shopDealerUserEdit.vue';
|
||||||
import {
|
import { pageShopDealerUser, removeShopDealerUser, removeBatchShopDealerUser } from '@/api/shop/shopDealerUser';
|
||||||
pageShopDealerApply,
|
import type { ShopDealerUser, ShopDealerUserParam } from '@/api/shop/shopDealerUser/model';
|
||||||
removeShopDealerApply,
|
|
||||||
removeBatchShopDealerApply,
|
|
||||||
batchApproveShopDealerApply,
|
|
||||||
updateShopDealerApply
|
|
||||||
} from '@/api/shop/shopDealerApply';
|
|
||||||
import type {
|
|
||||||
ShopDealerApply,
|
|
||||||
ShopDealerApplyParam
|
|
||||||
} from '@/api/shop/shopDealerApply/model';
|
|
||||||
|
|
||||||
// 表格实例
|
// 表格实例
|
||||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||||
|
|
||||||
// 表格选中数据
|
// 表格选中数据
|
||||||
const selection = ref<ShopDealerApply[]>([]);
|
const selection = ref<ShopDealerUser[]>([]);
|
||||||
// 当前编辑数据
|
// 当前编辑数据
|
||||||
const current = ref<ShopDealerApply | null>(null);
|
const current = ref<ShopDealerUser | null>(null);
|
||||||
// 是否显示编辑弹窗
|
// 是否显示编辑弹窗
|
||||||
const showEdit = ref(false);
|
const showEdit = ref(false);
|
||||||
|
// 是否显示批量移动弹窗
|
||||||
|
const showMove = ref(false);
|
||||||
// 加载状态
|
// 加载状态
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
|
|
||||||
@@ -124,9 +94,7 @@
|
|||||||
if (filters) {
|
if (filters) {
|
||||||
where.status = filters.status;
|
where.status = filters.status;
|
||||||
}
|
}
|
||||||
where.type = 4;
|
return pageShopDealerUser({
|
||||||
where.applyStatus = 20;
|
|
||||||
return pageShopDealerApply({
|
|
||||||
...where,
|
...where,
|
||||||
...orders,
|
...orders,
|
||||||
page,
|
page,
|
||||||
@@ -134,201 +102,139 @@
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// 表格列配置
|
// 完整的列配置(包含所有字段)
|
||||||
const columns = ref<ColumnItem[]>([
|
const columns = ref<ColumnItem[]>([
|
||||||
{
|
{
|
||||||
title: 'ID',
|
title: '用户ID',
|
||||||
dataIndex: 'applyId',
|
dataIndex: 'userId',
|
||||||
key: 'applyId',
|
key: 'userId',
|
||||||
align: 'center',
|
width: 90,
|
||||||
width: 80,
|
|
||||||
fixed: 'left'
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '申请人信息',
|
title: '类型',
|
||||||
key: 'applicantInfo',
|
dataIndex: 'type',
|
||||||
align: 'left',
|
key: 'type',
|
||||||
fixed: 'left',
|
|
||||||
customRender: ({ record }) => {
|
|
||||||
return `${record.realName || '-'} (${record.mobile || '-'})`;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '申请方式',
|
|
||||||
dataIndex: 'applyType',
|
|
||||||
key: 'applyType',
|
|
||||||
align: 'center',
|
|
||||||
width: 120,
|
|
||||||
customRender: ({ text }) => {
|
|
||||||
const typeMap = {
|
|
||||||
10: { text: '需审核', color: 'orange' },
|
|
||||||
20: { text: '免审核', color: 'green' }
|
|
||||||
};
|
|
||||||
const type = typeMap[text] || { text: '未知', color: 'default' };
|
|
||||||
return {
|
|
||||||
type: 'tag',
|
|
||||||
props: { color: type.color },
|
|
||||||
children: type.text
|
|
||||||
};
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '审核状态',
|
|
||||||
dataIndex: 'applyStatus',
|
|
||||||
key: 'applyStatus',
|
|
||||||
align: 'center',
|
|
||||||
width: 120
|
width: 120
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '推荐人',
|
title: '真实姓名',
|
||||||
dataIndex: 'refereeId',
|
dataIndex: 'realName',
|
||||||
key: 'refereeId',
|
key: 'realName'
|
||||||
align: 'center',
|
},
|
||||||
width: 100,
|
{
|
||||||
customRender: ({ text }) => (text ? `ID: ${text}` : '无')
|
title: '手机号',
|
||||||
|
dataIndex: 'mobile',
|
||||||
|
key: 'mobile'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '可提现',
|
||||||
|
dataIndex: 'money',
|
||||||
|
key: 'money',
|
||||||
|
width: 120
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '已冻结',
|
||||||
|
dataIndex: 'freezeMoney',
|
||||||
|
key: 'freezeMoney',
|
||||||
|
width: 120
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '累积提现',
|
||||||
|
dataIndex: 'totalMoney',
|
||||||
|
key: 'totalMoney',
|
||||||
|
width: 120
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
// title: '申请时间',
|
// title: '推荐人用户ID',
|
||||||
// dataIndex: 'applyTime',
|
// dataIndex: 'refereeId',
|
||||||
// key: 'applyTime',
|
// key: 'refereeId',
|
||||||
// align: 'center',
|
// width: 120
|
||||||
// width: 120,
|
|
||||||
// customRender: ({ text }) => text ? toDateString(new Date(text), 'yyyy-MM-dd HH:mm') : '-'
|
|
||||||
// },
|
// },
|
||||||
// {
|
// {
|
||||||
// title: '审核时间',
|
// title: '成员数量(一级)',
|
||||||
// dataIndex: 'auditTime',
|
// dataIndex: 'firstNum',
|
||||||
// key: 'auditTime',
|
// key: 'firstNum',
|
||||||
// align: 'center',
|
// width: 120
|
||||||
// customRender: ({ text }) => text ? toDateString(new Date(text), 'yyyy-MM-dd HH:mm') : '-'
|
// },
|
||||||
|
// {
|
||||||
|
// title: '成员数量(二级)',
|
||||||
|
// dataIndex: 'secondNum',
|
||||||
|
// key: 'secondNum',
|
||||||
|
// width: 120
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// title: '成员数量(三级)',
|
||||||
|
// dataIndex: 'thirdNum',
|
||||||
|
// key: 'thirdNum',
|
||||||
|
// width: 120
|
||||||
// },
|
// },
|
||||||
{
|
{
|
||||||
title: '驳回原因',
|
title: '专属二维码',
|
||||||
dataIndex: 'rejectReason',
|
dataIndex: 'qrcode',
|
||||||
key: 'rejectReason',
|
key: 'qrcode',
|
||||||
align: 'left',
|
align: 'center'
|
||||||
ellipsis: true,
|
|
||||||
customRender: ({ text }) => text || '-'
|
|
||||||
},
|
},
|
||||||
|
// {
|
||||||
|
// title: '备注',
|
||||||
|
// dataIndex: 'comments',
|
||||||
|
// key: 'comments',
|
||||||
|
// ellipsis: true
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// title: '排序号',
|
||||||
|
// dataIndex: 'sortNumber',
|
||||||
|
// key: 'sortNumber',
|
||||||
|
// width: 120
|
||||||
|
// },
|
||||||
{
|
{
|
||||||
title: '创建时间',
|
title: '创建时间',
|
||||||
dataIndex: 'createTime',
|
dataIndex: 'createTime',
|
||||||
key: 'createTime',
|
key: 'createTime',
|
||||||
|
width: 200,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
sorter: true,
|
sorter: true,
|
||||||
ellipsis: true
|
ellipsis: true,
|
||||||
|
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
key: 'action',
|
key: 'action',
|
||||||
|
width: 180,
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
width: 380,
|
|
||||||
hideInSetting: true
|
hideInSetting: true
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
/* 搜索 */
|
/* 搜索 */
|
||||||
const reload = (where?: ShopDealerApplyParam) => {
|
const reload = (where?: ShopDealerUserParam) => {
|
||||||
selection.value = [];
|
selection.value = [];
|
||||||
tableRef?.value?.reload({ where: where });
|
tableRef?.value?.reload({ where: where });
|
||||||
};
|
};
|
||||||
|
|
||||||
/* 审核通过 */
|
|
||||||
const approveApply = (row: ShopDealerApply) => {
|
|
||||||
Modal.confirm({
|
|
||||||
title: '审核通过确认',
|
|
||||||
content: `确定要通过 ${row.realName} 的经销商申请吗?`,
|
|
||||||
icon: createVNode(CheckOutlined),
|
|
||||||
okText: '确认通过',
|
|
||||||
okType: 'primary',
|
|
||||||
cancelText: '取消',
|
|
||||||
onOk: async () => {
|
|
||||||
const hide = message.loading('正在处理审核...', 0);
|
|
||||||
try {
|
|
||||||
await updateShopDealerApply({
|
|
||||||
...row,
|
|
||||||
applyId: row.applyId,
|
|
||||||
applyStatus: 20
|
|
||||||
});
|
|
||||||
hide();
|
|
||||||
message.success('审核通过成功');
|
|
||||||
reload();
|
|
||||||
} catch (error: any) {
|
|
||||||
hide();
|
|
||||||
message.error(error.message || '审核失败,请重试');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 审核驳回 */
|
|
||||||
const rejectApply = (row: ShopDealerApply) => {
|
|
||||||
let rejectReason = '';
|
|
||||||
Modal.confirm({
|
|
||||||
title: '审核驳回',
|
|
||||||
content: createVNode('div', null, [
|
|
||||||
createVNode('p', null, `申请人: ${row.realName} (${row.mobile})`),
|
|
||||||
createVNode('p', { style: 'margin-top: 12px;' }, '请输入驳回原因:'),
|
|
||||||
createVNode('textarea', {
|
|
||||||
placeholder: '请输入驳回原因...',
|
|
||||||
style:
|
|
||||||
'width: 100%; height: 80px; margin-top: 8px; padding: 8px; border: 1px solid #d9d9d9; border-radius: 4px;',
|
|
||||||
onInput: (e: any) => {
|
|
||||||
rejectReason = e.target.value;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
]),
|
|
||||||
icon: createVNode(CloseOutlined),
|
|
||||||
okText: '确认驳回',
|
|
||||||
okType: 'danger',
|
|
||||||
cancelText: '取消',
|
|
||||||
onOk: async () => {
|
|
||||||
if (!rejectReason.trim()) {
|
|
||||||
message.error('请输入驳回原因');
|
|
||||||
return Promise.reject();
|
|
||||||
}
|
|
||||||
const hide = message.loading('正在处理审核...', 0);
|
|
||||||
try {
|
|
||||||
await updateShopDealerApply({
|
|
||||||
...row,
|
|
||||||
applyStatus: 30,
|
|
||||||
rejectReason: rejectReason.trim()
|
|
||||||
});
|
|
||||||
hide();
|
|
||||||
message.success('审核驳回成功');
|
|
||||||
reload();
|
|
||||||
} catch (error: any) {
|
|
||||||
hide();
|
|
||||||
message.error(error.message || '审核失败,请重试');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 打开编辑弹窗 */
|
/* 打开编辑弹窗 */
|
||||||
const openEdit = (row?: ShopDealerApply) => {
|
const openEdit = (row?: ShopDealerUser) => {
|
||||||
current.value = row ?? null;
|
current.value = row ?? null;
|
||||||
showEdit.value = true;
|
showEdit.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* 删除单个 */
|
/* 打开批量移动弹窗 */
|
||||||
const remove = (row: ShopDealerApply) => {
|
const openMove = () => {
|
||||||
if (!row.applyId) {
|
showMove.value = true;
|
||||||
message.error('删除失败:缺少必要参数');
|
};
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const hide = message.loading('正在删除申请记录...', 0);
|
/* 删除单个 */
|
||||||
removeShopDealerApply(row.applyId)
|
const remove = (row: ShopDealerUser) => {
|
||||||
|
const hide = message.loading('请求中..', 0);
|
||||||
|
removeShopDealerUser(row.id)
|
||||||
.then((msg) => {
|
.then((msg) => {
|
||||||
hide();
|
hide();
|
||||||
message.success(msg || '删除成功');
|
message.success(msg);
|
||||||
reload();
|
reload();
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
hide();
|
hide();
|
||||||
message.error(e.message || '删除失败');
|
message.error(e.message);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -338,99 +244,34 @@
|
|||||||
message.error('请至少选择一条数据');
|
message.error('请至少选择一条数据');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const validIds = selection.value
|
|
||||||
.filter((d) => d.applyId)
|
|
||||||
.map((d) => d.applyId);
|
|
||||||
if (!validIds.length) {
|
|
||||||
message.error('选中的数据中没有有效的ID');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Modal.confirm({
|
Modal.confirm({
|
||||||
title: '批量删除确认',
|
title: '提示',
|
||||||
content: `确定要删除选中的 ${validIds.length} 条申请记录吗?此操作不可恢复。`,
|
content: '确定要删除选中的记录吗?',
|
||||||
icon: createVNode(ExclamationCircleOutlined),
|
icon: createVNode(ExclamationCircleOutlined),
|
||||||
maskClosable: true,
|
maskClosable: true,
|
||||||
okText: '确认删除',
|
|
||||||
okType: 'danger',
|
|
||||||
cancelText: '取消',
|
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
const hide = message.loading(
|
const hide = message.loading('请求中..', 0);
|
||||||
`正在删除 ${validIds.length} 条记录...`,
|
removeBatchShopDealerUser(selection.value.map((d) => d.id))
|
||||||
0
|
|
||||||
);
|
|
||||||
removeBatchShopDealerApply(validIds)
|
|
||||||
.then((msg) => {
|
.then((msg) => {
|
||||||
hide();
|
hide();
|
||||||
message.success(msg || `成功删除 ${validIds.length} 条记录`);
|
message.success(msg);
|
||||||
selection.value = [];
|
|
||||||
reload();
|
reload();
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
hide();
|
hide();
|
||||||
message.error(e.message || '批量删除失败');
|
message.error(e.message);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/* 批量通过 */
|
|
||||||
const batchApprove = () => {
|
|
||||||
if (!selection.value.length) {
|
|
||||||
message.error('请至少选择一条数据');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const pendingApplies = selection.value.filter(
|
|
||||||
(item) => item.applyStatus === 10
|
|
||||||
);
|
|
||||||
if (!pendingApplies.length) {
|
|
||||||
message.error('所选申请中没有待审核的记录');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Modal.confirm({
|
|
||||||
title: '批量通过确认',
|
|
||||||
content: `确定要通过选中的 ${pendingApplies.length} 个申请吗?`,
|
|
||||||
icon: createVNode(ExclamationCircleOutlined),
|
|
||||||
okText: '确认通过',
|
|
||||||
okType: 'primary',
|
|
||||||
cancelText: '取消',
|
|
||||||
onOk: async () => {
|
|
||||||
const hide = message.loading('正在批量通过...', 0);
|
|
||||||
try {
|
|
||||||
const ids = pendingApplies.map((item) => item.applyId);
|
|
||||||
await batchApproveShopDealerApply(ids);
|
|
||||||
hide();
|
|
||||||
message.success(`成功通过 ${pendingApplies.length} 个申请`);
|
|
||||||
selection.value = [];
|
|
||||||
reload();
|
|
||||||
} catch (error: any) {
|
|
||||||
hide();
|
|
||||||
message.error(error.message || '批量审核失败,请重试');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 导出数据 */
|
|
||||||
const exportData = () => {
|
|
||||||
const hide = message.loading('正在导出申请数据...', 0);
|
|
||||||
// 这里调用导出API
|
|
||||||
setTimeout(() => {
|
|
||||||
hide();
|
|
||||||
message.success('申请数据导出成功');
|
|
||||||
}, 2000);
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 查询 */
|
/* 查询 */
|
||||||
const query = () => {
|
const query = () => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* 自定义行属性 */
|
/* 自定义行属性 */
|
||||||
const customRow = (record: ShopDealerApply) => {
|
const customRow = (record: ShopDealerUser) => {
|
||||||
return {
|
return {
|
||||||
// 行点击事件
|
// 行点击事件
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
@@ -447,71 +288,8 @@
|
|||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export default {
|
export default {
|
||||||
name: 'ShopDealerApply'
|
name: 'ShopDealerUser'
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped></style>
|
||||||
.sys-org-table {
|
|
||||||
:deep(.ant-table-thead > tr > th) {
|
|
||||||
background-color: #fafafa;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.ant-table-tbody > tr:hover > td) {
|
|
||||||
background-color: #f8f9fa;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.detail-item {
|
|
||||||
p {
|
|
||||||
margin: 4px 0;
|
|
||||||
color: #666;
|
|
||||||
}
|
|
||||||
|
|
||||||
strong {
|
|
||||||
color: #1890ff;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.ele-text-primary {
|
|
||||||
color: #1890ff;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
color: #40a9ff;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.ele-text-info {
|
|
||||||
color: #13c2c2;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
color: #36cfc9;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.ele-text-success {
|
|
||||||
color: #52c41a;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
color: #73d13d;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.ele-text-warning {
|
|
||||||
color: #faad14;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
color: #ffc53d;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.ele-text-danger {
|
|
||||||
color: #ff4d4f;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
color: #ff7875;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
Reference in New Issue
Block a user