|
@@ -1,5 +1,155 @@
|
|
|
<template>
|
|
|
- <div> 会员列表 </div>
|
|
|
+ <div class="p-4">
|
|
|
+ <BasicTable @register="registerTable">
|
|
|
+ <template #toolbar> </template>
|
|
|
+ <template #avatarUrl="{ record }">
|
|
|
+ <Avatar :size="80" :src="record.avatarUrl" />
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template #gender="{ record }">
|
|
|
+ {{ renderGenderLabel(record.gender) }}
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template #action="{ record }">
|
|
|
+ <TableAction
|
|
|
+ :actions="[
|
|
|
+ {
|
|
|
+ icon: 'mdi:information-outline',
|
|
|
+ label: '详情',
|
|
|
+ onClick: () => {
|
|
|
+ go(`/order/list/detail/${record.orderNo}`);
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ icon: 'mdi:printer-outline',
|
|
|
+ label: '打印',
|
|
|
+ color: 'error',
|
|
|
+ onClick: () => {
|
|
|
+ createMessage.info(`暂未接入`);
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ]"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ </BasicTable>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
+<script lang="ts">
|
|
|
+ import { defineComponent } from 'vue';
|
|
|
+ import { BasicTable, useTable, BasicColumn, FormProps, TableAction } from '/@/components/Table';
|
|
|
+ import { useMessage } from '/@/hooks/web/useMessage';
|
|
|
+ import { uploadApi } from '/@/api/sys/upload';
|
|
|
+
|
|
|
+ import { ListApi } from '/@/api/member/list';
|
|
|
+ import { useI18n } from '/@/hooks/web/useI18n';
|
|
|
+ // import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard';
|
|
|
+ import { useGo } from '/@/hooks/web/usePage';
|
|
|
+ import { Avatar } from 'ant-design-vue';
|
|
|
+
|
|
|
+ export default defineComponent({
|
|
|
+ components: { BasicTable, TableAction, Avatar },
|
|
|
+ setup() {
|
|
|
+ const { createMessage } = useMessage();
|
|
|
+ const go = useGo();
|
|
|
+ const { t } = useI18n();
|
|
|
+ const columns: BasicColumn[] = [
|
|
|
+ {
|
|
|
+ title: 'ID',
|
|
|
+ dataIndex: 'id',
|
|
|
+ fixed: 'left',
|
|
|
+ width: 60,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '会员名称',
|
|
|
+ dataIndex: 'name',
|
|
|
+ sorter: true,
|
|
|
+ width: 160,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '头像',
|
|
|
+ dataIndex: 'avatarUrl',
|
|
|
+ slots: { customRender: 'avatarUrl' },
|
|
|
+ width: 120,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '性别',
|
|
|
+ dataIndex: 'gender',
|
|
|
+ slots: { customRender: 'gender' },
|
|
|
+ sorter: true,
|
|
|
+ width: 120,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '出生日期',
|
|
|
+ dataIndex: 'birthday',
|
|
|
+ width: 120,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '最后登录时间',
|
|
|
+ dataIndex: 'lastLogin',
|
|
|
+ width: 120,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '微信名',
|
|
|
+ dataIndex: 'nickName',
|
|
|
+ width: 120,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '手机号',
|
|
|
+ dataIndex: 'phone',
|
|
|
+ width: 120,
|
|
|
+ },
|
|
|
+ ];
|
|
|
+
|
|
|
+ const searchForm: Partial<FormProps> = {
|
|
|
+ labelWidth: 100,
|
|
|
+ schemas: [
|
|
|
+ {
|
|
|
+ field: 'name',
|
|
|
+ label: '会员名称',
|
|
|
+ component: 'Input',
|
|
|
+ colProps: {
|
|
|
+ xl: 5,
|
|
|
+ xxl: 5,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ };
|
|
|
+
|
|
|
+ const [registerTable] = useTable({
|
|
|
+ title: '会员列表',
|
|
|
+ api: ListApi,
|
|
|
+ columns: columns,
|
|
|
+ useSearchForm: true,
|
|
|
+ formConfig: searchForm,
|
|
|
+ showTableSetting: true,
|
|
|
+ tableSetting: { fullScreen: true },
|
|
|
+ showIndexColumn: false,
|
|
|
+ rowKey: 'id',
|
|
|
+ pagination: { pageSize: 20 },
|
|
|
+ bordered: true,
|
|
|
+ });
|
|
|
+
|
|
|
+ function renderGenderLabel(gender: number): string {
|
|
|
+ switch (gender) {
|
|
|
+ case 0:
|
|
|
+ return '未知';
|
|
|
+ case 1:
|
|
|
+ return '男';
|
|
|
+ case 2:
|
|
|
+ return '女';
|
|
|
+ default:
|
|
|
+ return '未知';
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
-<script lang="ts" setup></script>
|
|
|
+ return {
|
|
|
+ registerTable,
|
|
|
+ createMessage,
|
|
|
+ t,
|
|
|
+ go,
|
|
|
+ renderGenderLabel,
|
|
|
+ uploadApi: uploadApi as any,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ });
|
|
|
+</script>
|