1、右上角的登录信息改为优先显示真实姓名
2、修复已知bug
This commit is contained in:
@@ -114,11 +114,7 @@
|
||||
DatasourceFunction,
|
||||
ColumnItem
|
||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||
import {
|
||||
toDateString,
|
||||
messageLoading,
|
||||
formatNumber
|
||||
} from 'ele-admin-pro/es';
|
||||
import { toDateString, messageLoading, formatNumber } from 'ele-admin-pro/es';
|
||||
import {
|
||||
pageUserBalanceLog,
|
||||
removeUserBalanceLog,
|
||||
@@ -141,7 +137,7 @@
|
||||
customRender: ({ index }) => index + (tableRef.value?.tableIndex ?? 0)
|
||||
},
|
||||
{
|
||||
title: '用户昵称',
|
||||
title: '用户',
|
||||
key: 'nickname',
|
||||
dataIndex: 'nickname',
|
||||
showSorterTooltip: false
|
||||
|
||||
@@ -111,8 +111,8 @@
|
||||
showSorterTooltip: false
|
||||
},
|
||||
{
|
||||
title: '用户账号',
|
||||
dataIndex: 'username',
|
||||
title: '用户',
|
||||
dataIndex: 'mobile',
|
||||
sorter: true,
|
||||
showSorterTooltip: false
|
||||
},
|
||||
|
||||
@@ -118,6 +118,7 @@
|
||||
rechargeOrder.value?.push({
|
||||
rechargeType: 10,
|
||||
payPrice: form.payPrice,
|
||||
actualMoney: form.payPrice,
|
||||
comments: form.comments,
|
||||
organizationId: d.organizationId,
|
||||
userId: d.userId,
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
});
|
||||
if (list.length) {
|
||||
if (typeof list[0].key === 'number') {
|
||||
selectedRowKeys.value = [list[0].key];
|
||||
// selectedRowKeys.value = [list[0].key];
|
||||
}
|
||||
current.value = list[0];
|
||||
current.value.organizationId = 0;
|
||||
|
||||
172
src/views/user/recharge-export/components/search.vue
Normal file
172
src/views/user/recharge-export/components/search.vue
Normal file
@@ -0,0 +1,172 @@
|
||||
<!-- 搜索表单 -->
|
||||
<template>
|
||||
<div class="search">
|
||||
<a-space :size="10" style="flex-wrap: wrap">
|
||||
<!-- <a-button-->
|
||||
<!-- danger-->
|
||||
<!-- type="primary"-->
|
||||
<!-- class="ele-btn-icon"-->
|
||||
<!-- :disabled="selection.length === 0"-->
|
||||
<!-- @click="removeBatch"-->
|
||||
<!-- >-->
|
||||
<!-- <template #icon>-->
|
||||
<!-- <DeleteOutlined />-->
|
||||
<!-- </template>-->
|
||||
<!-- <span>批量删除</span>-->
|
||||
<!-- </a-button>-->
|
||||
<SelectOrganization
|
||||
:placeholder="`请选择部门`"
|
||||
v-model:value="where.organizationName"
|
||||
@done="chooseOrganization"
|
||||
/>
|
||||
<a-range-picker
|
||||
v-model:value="dateRange"
|
||||
@change="search"
|
||||
value-format="YYYY-MM-DD"
|
||||
class="ele-fluid"
|
||||
/>
|
||||
<a-input-search
|
||||
allow-clear
|
||||
placeholder="请输入手机号|用户ID"
|
||||
v-model:value="where.keywords"
|
||||
@pressEnter="search"
|
||||
@search="search"
|
||||
style="width: 220px"
|
||||
/>
|
||||
<a-button @click="reset">重置</a-button>
|
||||
<a-button type="primary" class="ele-btn-icon" @click="handleExport">
|
||||
<template #icon>
|
||||
<download-outlined />
|
||||
</template>
|
||||
<span>导出</span>
|
||||
</a-button>
|
||||
</a-space>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {
|
||||
PlusOutlined,
|
||||
DeleteOutlined,
|
||||
DownloadOutlined
|
||||
} from '@ant-design/icons-vue';
|
||||
import useSearch from '@/utils/use-search';
|
||||
import { ref, watch } from 'vue';
|
||||
import { countOrderGoods } from '@/api/apps/statistics';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { utils, writeFile } from 'xlsx';
|
||||
import { Organization } from '@/api/system/organization/model';
|
||||
import { BcExportParam } from '@/api/apps/bc/export/model';
|
||||
import { RechargeOrder } from '@/api/user/recharge/export/model';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
// 选中的角色
|
||||
selection?: [];
|
||||
exportData?: [];
|
||||
}>(),
|
||||
{}
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'search', where?: BcExportParam): void;
|
||||
(e: 'add'): void;
|
||||
(e: 'remove'): void;
|
||||
(e: 'done'): void;
|
||||
(e: 'export'): void;
|
||||
}>();
|
||||
|
||||
// 表单数据
|
||||
const { where, resetFields } = useSearch<BcExportParam>({
|
||||
exportId: undefined,
|
||||
keywords: undefined,
|
||||
organizationName: '',
|
||||
organizationId: undefined,
|
||||
createTimeStart: undefined,
|
||||
createTimeEnd: undefined
|
||||
});
|
||||
// 下来选项
|
||||
// const categoryId = ref<number>(0);
|
||||
const post = ref<number>(0);
|
||||
const sign = ref<number>(0);
|
||||
const noSign = ref<number>(0);
|
||||
// 请求状态
|
||||
const loading = ref(true);
|
||||
// const deliveryStatus = ref<number>(0);
|
||||
// const gear = ref<number>(0);
|
||||
// 预定日期
|
||||
// const deliveryTime = ref<Dayjs>();
|
||||
// 日期范围选择
|
||||
const dateRange = ref<[string, string]>(['', '']);
|
||||
|
||||
/* 搜索 */
|
||||
const search = () => {
|
||||
const [d1, d2] = dateRange.value ?? [];
|
||||
where.createTimeStart = d1 ? d1 + ' 00:00:00' : undefined;
|
||||
where.createTimeEnd = d2 ? d2 + ' 00:00:00' : undefined;
|
||||
emit('search', {
|
||||
...where
|
||||
});
|
||||
count();
|
||||
};
|
||||
|
||||
const chooseOrganization = (e: Organization) => {
|
||||
where.organizationName = e.organizationName;
|
||||
where.organizationId = e.organizationId;
|
||||
search();
|
||||
};
|
||||
|
||||
/* 重置 */
|
||||
const reset = () => {
|
||||
resetFields();
|
||||
post.value = 0;
|
||||
sign.value = 0;
|
||||
noSign.value = 0;
|
||||
dateRange.value = ['', ''];
|
||||
search();
|
||||
};
|
||||
|
||||
const count = () => {
|
||||
if (where.deliveryTimeStart == undefined) {
|
||||
console.log('sss>>>');
|
||||
loading.value = false;
|
||||
return false;
|
||||
}
|
||||
loading.value = true;
|
||||
countOrderGoods(where)
|
||||
.then((data) => {
|
||||
console.log('data>>>', data);
|
||||
if (data) {
|
||||
post.value = data.post;
|
||||
sign.value = data.sign;
|
||||
noSign.value = data.noSign;
|
||||
} else {
|
||||
post.value = 0;
|
||||
sign.value = 0;
|
||||
noSign.value = 0;
|
||||
}
|
||||
loading.value = false;
|
||||
})
|
||||
.catch((err) => {
|
||||
message.error(err.message);
|
||||
loading.value = false;
|
||||
});
|
||||
};
|
||||
|
||||
// 导出
|
||||
const handleExport = () => {
|
||||
emit('done');
|
||||
};
|
||||
|
||||
// 批量删除
|
||||
const removeBatch = () => {
|
||||
emit('remove');
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.selection,
|
||||
() => {}
|
||||
);
|
||||
|
||||
count();
|
||||
</script>
|
||||
330
src/views/user/recharge-export/index.vue
Normal file
330
src/views/user/recharge-export/index.vue
Normal file
@@ -0,0 +1,330 @@
|
||||
<template>
|
||||
<div class="page">
|
||||
<div class="ele-body">
|
||||
<a-card :bordered="false">
|
||||
<!-- 表格 -->
|
||||
<ele-pro-table
|
||||
ref="tableRef"
|
||||
row-key="orderId"
|
||||
:columns="columns"
|
||||
:datasource="datasource"
|
||||
:parse-data="parseData"
|
||||
:customRow="customRow"
|
||||
tool-class="ele-toolbar-form"
|
||||
:scroll="{ x: 1200 }"
|
||||
class="sys-org-table"
|
||||
:striped="true"
|
||||
>
|
||||
<template #toolbar>
|
||||
<search
|
||||
@search="reload"
|
||||
:selection="selection"
|
||||
:export-data="exportData"
|
||||
@remove="removeBatch"
|
||||
@done="handleExport"
|
||||
/>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'organizationName'">
|
||||
{{ record.organizationName || '-' }}
|
||||
</template>
|
||||
<template v-if="column.key === 'createTime'">
|
||||
{{ record.createTime }}
|
||||
</template>
|
||||
<template v-if="column.key === 'rechargeType'">
|
||||
<span v-if="record.rechargeType == 10">自定义</span>
|
||||
<span v-if="record.rechargeType == 20">套餐</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<a-button @click="openInfo(record)">详情</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
</a-card>
|
||||
</div>
|
||||
<!-- 订单详情 -->
|
||||
<!-- <order-info v-model:visible="showInfo" :data="current" @done="reload" />-->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { createVNode, ref } from 'vue';
|
||||
import { message, Modal } from 'ant-design-vue';
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||
import type { EleProTable } from 'ele-admin-pro';
|
||||
import type {
|
||||
DatasourceFunction,
|
||||
ColumnItem
|
||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||
import Search from './components/search.vue';
|
||||
// import OrderInfo from './components/order-info.vue';
|
||||
import {
|
||||
pageRechargeOrder,
|
||||
removeBatchRechargeOrder
|
||||
} from '@/api/user/recharge/export';
|
||||
import type {
|
||||
RechargeOrder,
|
||||
RechargeOrderParam
|
||||
} from '@/api/user/recharge/export/model';
|
||||
import { utils, writeFile } from 'xlsx';
|
||||
|
||||
defineProps<{
|
||||
activeKey?: boolean;
|
||||
data?: any;
|
||||
}>();
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
// 表格列配置
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
key: 'index',
|
||||
width: 48,
|
||||
title: '序号',
|
||||
align: 'center',
|
||||
fixed: 'left',
|
||||
hideInTable: true,
|
||||
customRender: ({ index }) => index + (tableRef.value?.tableIndex ?? 0)
|
||||
},
|
||||
{
|
||||
title: '用户ID',
|
||||
dataIndex: 'userId',
|
||||
showSorterTooltip: false
|
||||
},
|
||||
{
|
||||
title: '部门名称',
|
||||
dataIndex: 'organizationName',
|
||||
key: 'organizationName',
|
||||
hideInTable: true,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '姓名',
|
||||
dataIndex: 'realName',
|
||||
key: 'realName',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '手机号',
|
||||
dataIndex: 'mobile',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '充值金额',
|
||||
dataIndex: 'payPrice',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '赠送金额',
|
||||
dataIndex: 'giftMoney',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '实际到账',
|
||||
dataIndex: 'actualMoney',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '充值方式',
|
||||
dataIndex: 'rechargeType',
|
||||
key: 'rechargeType',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '操作员',
|
||||
dataIndex: 'operator',
|
||||
key: 'operator',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
dataIndex: 'comments',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '充值时间',
|
||||
dataIndex: 'createTime',
|
||||
align: 'center',
|
||||
width: 180
|
||||
}
|
||||
]);
|
||||
|
||||
// 表格选中数据
|
||||
const selection = ref<RechargeOrder[]>([]);
|
||||
const exportData = ref<RechargeOrder[]>([]);
|
||||
// 当前编辑数据
|
||||
const current = ref<RechargeOrder | null>(null);
|
||||
// 是否显示资产详情
|
||||
const showInfo = ref(false);
|
||||
// 是否显示编辑弹窗
|
||||
// const showEdit = ref(false);
|
||||
|
||||
// 表格数据源
|
||||
const datasource: DatasourceFunction = ({ page, limit, where, orders }) => {
|
||||
return pageRechargeOrder({
|
||||
...where,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
});
|
||||
};
|
||||
|
||||
// 表单数据
|
||||
// const { form } = useFormData<RechargeOrder>({
|
||||
// exportId: undefined
|
||||
// });
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: RechargeOrderParam) => {
|
||||
selection.value = [];
|
||||
tableRef?.value?.reload({ where: where });
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openInfo = (row?: RechargeOrder) => {
|
||||
current.value = row ?? null;
|
||||
showInfo.value = true;
|
||||
};
|
||||
|
||||
/* 数据转为树形结构 */
|
||||
const parseData = (data: any) => {
|
||||
exportData.value = data?.list;
|
||||
return data;
|
||||
};
|
||||
|
||||
/* 批量删除 */
|
||||
const removeBatch = () => {
|
||||
console.log(selection.value);
|
||||
if (!selection.value.length) {
|
||||
message.error('请至少选择一条数据');
|
||||
return;
|
||||
}
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
content: '确定要删除选中的记录吗?',
|
||||
icon: createVNode(ExclamationCircleOutlined),
|
||||
maskClosable: true,
|
||||
onOk: () => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeBatchRechargeOrder(selection.value.map((d) => d.orderId))
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
hide();
|
||||
message.error(e.message);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 导出
|
||||
const handleExport = () => {
|
||||
const array: (string | number)[][] = [
|
||||
[
|
||||
'用户ID',
|
||||
'真实姓名',
|
||||
'手机号码',
|
||||
'充值金额',
|
||||
'赠送金额',
|
||||
'实际到账',
|
||||
'所属部门',
|
||||
'充值时间',
|
||||
'充值方式',
|
||||
'操作员',
|
||||
'备注'
|
||||
]
|
||||
];
|
||||
console.log('>>>>>>>>.', exportData.value);
|
||||
exportData.value?.forEach((d: RechargeOrder) => {
|
||||
array.push([
|
||||
`${d.userId}`,
|
||||
`${d.realName}`,
|
||||
`${d.phone}`,
|
||||
`${d.payPrice}`,
|
||||
`${d.giftMoney}`,
|
||||
`${d.actualMoney}`,
|
||||
`${d.organizationName}`,
|
||||
`${d.createTime}`,
|
||||
`${d.rechargeType == 10 ? '自定义' : '套餐'}`,
|
||||
`${d.operator}`,
|
||||
`${d.comments}`
|
||||
]);
|
||||
});
|
||||
const sheetName = '充值记录导出';
|
||||
const workbook = {
|
||||
SheetNames: [sheetName],
|
||||
Sheets: {}
|
||||
};
|
||||
const sheet = utils.aoa_to_sheet(array);
|
||||
workbook.Sheets[sheetName] = sheet;
|
||||
// 设置列宽
|
||||
sheet['!cols'] = [
|
||||
{ wch: 10 },
|
||||
{ wch: 10 },
|
||||
{ wch: 10 },
|
||||
{ wch: 10 },
|
||||
{ wch: 20 },
|
||||
{ wch: 40 },
|
||||
{ wch: 10 }
|
||||
];
|
||||
writeFile(workbook, '充值记录导出.xlsx');
|
||||
};
|
||||
|
||||
/* 自定义行属性 */
|
||||
const customRow = (record: RechargeOrder) => {
|
||||
return {
|
||||
// 行点击事件
|
||||
onClick: () => {
|
||||
// console.log(record);
|
||||
},
|
||||
// 行双击事件
|
||||
onDblclick: () => {
|
||||
// openEdit(record);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// const query = () => {
|
||||
// pageRechargeOrder({}).then((data) => {
|
||||
// if (data?.list) {
|
||||
// exportData.value = data?.list;
|
||||
// }
|
||||
// });
|
||||
// };
|
||||
|
||||
// query();
|
||||
reload();
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'RechargeOrderIndex'
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
p {
|
||||
line-height: 0.8;
|
||||
}
|
||||
.sys-org-table :deep(.ant-table-body) {
|
||||
overflow: auto !important;
|
||||
overflow: overlay !important;
|
||||
}
|
||||
|
||||
.sys-org-table :deep(.ant-table-pagination.ant-pagination) {
|
||||
padding: 0 4px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.price-edit {
|
||||
padding-right: 5px;
|
||||
}
|
||||
.comments {
|
||||
max-width: 200px;
|
||||
}
|
||||
</style>
|
||||
@@ -11,7 +11,6 @@
|
||||
:datasource="datasource"
|
||||
:scroll="{ x: 1000 }"
|
||||
:where="defaultWhere"
|
||||
v-model:selection="selection"
|
||||
cache-key="proSystemUserTable"
|
||||
>
|
||||
<template #toolbar>
|
||||
|
||||
Reference in New Issue
Block a user