From dea6ae1c23b13523cf4f65f44f32a0df7c8c03a9 Mon Sep 17 00:00:00 2001 From: gxwebsoft Date: Fri, 24 May 2024 14:53:29 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=82=E9=85=8D=E5=A4=9A=E5=95=86=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/booking/userInvoice/index.ts | 106 ++++++ src/api/booking/userInvoice/model/index.ts | 53 +++ src/api/booking/users/model/index.ts | 7 +- src/api/passport/login/index.ts | 1 + src/api/shop/merchant/model/index.ts | 4 +- src/api/system/user/model/index.ts | 3 + src/components/SelectMerchantDown/index.vue | 9 +- src/layout/components/header-tools-bak.vue | 158 -------- src/layout/components/header-tools.vue | 20 +- src/store/modules/theme.ts | 2 +- src/utils/merchant.ts | 15 +- .../{merchantAccountEdit.vue => edit.vue} | 113 +++--- .../account/components/role-select.vue | 73 ++++ src/views/booking/account/index.vue | 85 +++-- src/views/booking/field/index.vue | 14 +- src/views/booking/field/list.vue | 4 +- src/views/booking/school/index.vue | 9 +- .../booking/users.bak/components/search.vue | 53 +++ .../booking/users.bak/components/userEdit.vue | 347 ++++++++++++++++++ src/views/booking/users.bak/index.vue | 309 ++++++++++++++++ .../booking/users/components/userEdit.vue | 76 ++-- src/views/booking/users/index.vue | 20 +- src/views/passport/login/index.vue | 1 + 23 files changed, 1167 insertions(+), 315 deletions(-) create mode 100644 src/api/booking/userInvoice/index.ts create mode 100644 src/api/booking/userInvoice/model/index.ts delete mode 100644 src/layout/components/header-tools-bak.vue rename src/views/booking/account/components/{merchantAccountEdit.vue => edit.vue} (71%) create mode 100644 src/views/booking/account/components/role-select.vue create mode 100644 src/views/booking/users.bak/components/search.vue create mode 100644 src/views/booking/users.bak/components/userEdit.vue create mode 100644 src/views/booking/users.bak/index.vue diff --git a/src/api/booking/userInvoice/index.ts b/src/api/booking/userInvoice/index.ts new file mode 100644 index 0000000..201ca7e --- /dev/null +++ b/src/api/booking/userInvoice/index.ts @@ -0,0 +1,106 @@ +import request from '@/utils/request'; +import type { ApiResult, PageResult } from '@/api'; +import type { UserInvoice, UserInvoiceParam } from './model'; +import { MODULES_API_URL } from '@/config/setting'; + +/** + * 分页查询发票 + */ +export async function pageUserInvoice(params: UserInvoiceParam) { + const res = await request.get>>( + MODULES_API_URL + '/booking/user-invoice/page', + { + params + } + ); + if (res.data.code === 0) { + return res.data.data; + } + return Promise.reject(new Error(res.data.message)); +} + +/** + * 查询发票列表 + */ +export async function listUserInvoice(params?: UserInvoiceParam) { + const res = await request.get>( + MODULES_API_URL + '/booking/user-invoice', + { + params + } + ); + if (res.data.code === 0 && res.data.data) { + return res.data.data; + } + return Promise.reject(new Error(res.data.message)); +} + +/** + * 添加发票 + */ +export async function addUserInvoice(data: UserInvoice) { + const res = await request.post>( + MODULES_API_URL + '/booking/user-invoice', + data + ); + if (res.data.code === 0) { + return res.data.message; + } + return Promise.reject(new Error(res.data.message)); +} + +/** + * 修改发票 + */ +export async function updateUserInvoice(data: UserInvoice) { + const res = await request.put>( + MODULES_API_URL + '/booking/user-invoice', + data + ); + if (res.data.code === 0) { + return res.data.message; + } + return Promise.reject(new Error(res.data.message)); +} + +/** + * 删除发票 + */ +export async function removeUserInvoice(id?: number) { + const res = await request.delete>( + MODULES_API_URL + '/booking/user-invoice/' + id + ); + if (res.data.code === 0) { + return res.data.message; + } + return Promise.reject(new Error(res.data.message)); +} + +/** + * 批量删除发票 + */ +export async function removeBatchUserInvoice(data: (number | undefined)[]) { + const res = await request.delete>( + MODULES_API_URL + '/booking/user-invoice/batch', + { + data + } + ); + if (res.data.code === 0) { + return res.data.message; + } + return Promise.reject(new Error(res.data.message)); +} + +/** + * 根据id查询发票 + */ +export async function getUserInvoice(id: number) { + const res = await request.get>( + MODULES_API_URL + '/booking/user-invoice/' + id + ); + if (res.data.code === 0 && res.data.data) { + return res.data.data; + } + return Promise.reject(new Error(res.data.message)); +} diff --git a/src/api/booking/userInvoice/model/index.ts b/src/api/booking/userInvoice/model/index.ts new file mode 100644 index 0000000..408ceca --- /dev/null +++ b/src/api/booking/userInvoice/model/index.ts @@ -0,0 +1,53 @@ +import type { PageParam } from '@/api'; + +/** + * 发票 + */ +export interface UserInvoice { + // id + id?: number; + // 发票类型(0纸质 1电子) + type?: number; + // 发票名称 + name?: string; + // 开票类型(0铺票 1专票) + invoiceType?: string; + // 税号 + invoiceCode?: string; + // 公司地址 + address?: string; + // 公司电话 + tel?: string; + // 开户行 + bankName?: string; + // 开户账号 + bankAccount?: string; + // 手机号码 + phone?: string; + // 电子邮箱 + email?: string; + // 备注 + comments?: string; + // 排序(数字越小越靠前) + sortNumber?: number; + // 状态, 0待使用, 1已使用, 2已失效 + status?: number; + // 是否删除, 0否, 1是 + deleted?: number; + // 用户ID + userId?: number; + // 租户id + tenantId?: number; + // 创建时间 + createTime?: string; + // 修改时间 + updateTime?: string; +} + +/** + * 发票搜索条件 + */ +export interface UserInvoiceParam extends PageParam { + id?: number; + keywords?: string; +} diff --git a/src/api/booking/users/model/index.ts b/src/api/booking/users/model/index.ts index 8d9467f..73b4a11 100644 --- a/src/api/booking/users/model/index.ts +++ b/src/api/booking/users/model/index.ts @@ -5,7 +5,7 @@ import type { PageParam } from '@/api'; */ export interface Users { // - userId?: number; + uid?: number; // 用户唯一小程序id openid?: string; // 小程序用户秘钥 @@ -46,6 +46,9 @@ export interface Users { realName?: string; // 是否管理员:1是;2否 isAdmin?: string; + truename?: string; + idcard?: string; + gender?: string; // 客户端ID clientId?: string; // 注册来源客户端 (APP、H5、小程序等) @@ -68,6 +71,6 @@ export interface Users { * 用户搜索条件 */ export interface UsersParam extends PageParam { - userId?: number; + uid?: number; keywords?: string; } diff --git a/src/api/passport/login/index.ts b/src/api/passport/login/index.ts index 35a6a50..8463317 100644 --- a/src/api/passport/login/index.ts +++ b/src/api/passport/login/index.ts @@ -57,6 +57,7 @@ export async function loginBySms(data: LoginParam) { localStorage.setItem('Phone', String(user.phone)); localStorage.setItem('UserId', String(user.userId)); localStorage.setItem('MerchantId', String(user.merchantId)); + localStorage.setItem('MerchantName', String(user.merchantName)); } return res.data.message; diff --git a/src/api/shop/merchant/model/index.ts b/src/api/shop/merchant/model/index.ts index f4a8754..ce7c7fb 100644 --- a/src/api/shop/merchant/model/index.ts +++ b/src/api/shop/merchant/model/index.ts @@ -65,7 +65,9 @@ export interface Merchant { roleId?: number; roleName?: string; label?: string; - value?: string; + value?: number; + key?: number; + title?: string; } /** diff --git a/src/api/system/user/model/index.ts b/src/api/system/user/model/index.ts index 593c1b5..e775093 100644 --- a/src/api/system/user/model/index.ts +++ b/src/api/system/user/model/index.ts @@ -57,6 +57,8 @@ export interface User { // 角色列表 roles?: Role[]; roleCode?: string; + roleId?: number; + roleName?: string; // 权限列表 authorities?: Menu[]; payTime?: string; @@ -83,6 +85,7 @@ export interface User { setting?: string; realName?: string; companyName?: string; + merchantName?: string; gradeName?: string; idCard?: string; comments?: string; diff --git a/src/components/SelectMerchantDown/index.vue b/src/components/SelectMerchantDown/index.vue index b519e39..4c1cadc 100644 --- a/src/components/SelectMerchantDown/index.vue +++ b/src/components/SelectMerchantDown/index.vue @@ -10,6 +10,7 @@ @update:value="updateValue" :style="`width: 200px`" @blur="onBlur" + @change="onChange" /> @@ -20,6 +21,7 @@ const emit = defineEmits<{ (e: 'update:value', value: string, item: any): void; + (e: 'done', item: Merchant): void; (e: 'blur'): void; }>(); @@ -48,11 +50,16 @@ emit('blur'); }; + const onChange = (item: Merchant) => { + emit('done', item); + }; + const reload = () => { listMerchant({}).then((list) => { options.value = list.map((d) => { d.label = d.merchantName; - d.value = d.merchantCode; + d.value = d.merchantId; + d.key = d.merchantCode; return d; }); }); diff --git a/src/layout/components/header-tools-bak.vue b/src/layout/components/header-tools-bak.vue deleted file mode 100644 index af0d920..0000000 --- a/src/layout/components/header-tools-bak.vue +++ /dev/null @@ -1,158 +0,0 @@ - - - - diff --git a/src/layout/components/header-tools.vue b/src/layout/components/header-tools.vue index 1934a12..cf22e84 100644 --- a/src/layout/components/header-tools.vue +++ b/src/layout/components/header-tools.vue @@ -1,11 +1,6 @@ @@ -74,20 +75,15 @@ diff --git a/src/views/booking/account/index.vue b/src/views/booking/account/index.vue index 1e6bf86..ce7c8b5 100644 --- a/src/views/booking/account/index.vue +++ b/src/views/booking/account/index.vue @@ -24,6 +24,15 @@ + @@ -55,23 +64,23 @@ import { message, Modal } from 'ant-design-vue'; import { ExclamationCircleOutlined } from '@ant-design/icons-vue'; import type { EleProTable } from 'ele-admin-pro'; - import { toDateString } from 'ele-admin-pro'; import type { DatasourceFunction, ColumnItem } from 'ele-admin-pro/es/ele-pro-table/types'; import Search from './components/search.vue'; - import MerchantAccountEdit from './components/merchantAccountEdit.vue'; - import { pageMerchantAccount, removeMerchantAccount, removeBatchMerchantAccount } from '@/api/shop/merchantAccount'; - import type { MerchantAccount, MerchantAccountParam } from '@/api/shop/merchantAccount/model'; + import Edit from './components/edit.vue'; + import { pageUsers, removeUser, removeUsers } from '@/api/system/user'; + import type { User, UserParam } from '@/api/system/user/model'; + import { getMerchantId } from "@/utils/common"; // 表格实例 const tableRef = ref | null>(null); // 表格选中数据 - const selection = ref([]); + const selection = ref([]); // 当前编辑数据 - const current = ref(null); + const current = ref(null); // 是否显示编辑弹窗 const showEdit = ref(false); // 是否显示批量移动弹窗 @@ -90,46 +99,62 @@ if (filters) { where.status = filters.status; } - return pageMerchantAccount({ + where.isAdmin = true; + where.merchantId = getMerchantId(); + return pageUsers({ ...where, ...orders, page, limit + }).then((res) => { + res?.list.map((d) => { + d.roles = d.roles?.filter( + (m) => m.roleCode == 'merchant' || m.roleCode == 'merchantClerk' + ); + return d; + }); + return res; }); }; // 表格列配置 const columns = ref([ { - title: 'ID', - dataIndex: 'id', - key: 'id', + title: '用户ID', + dataIndex: 'userId', + key: 'userId', align: 'center', - width: 90, + width: 90 + }, + { + title: '场馆名称', + dataIndex: 'merchantName', + key: 'merchantName', + align: 'center' }, { title: '账号', + dataIndex: 'username', + key: 'username', + align: 'center' + }, + { + title: '手机号码', dataIndex: 'phone', key: 'phone', - align: 'center', + align: 'center' }, { title: '真实姓名', dataIndex: 'realName', key: 'realName', - align: 'center', + align: 'center' }, { title: '角色', - dataIndex: 'roleName', - key: 'roleName', - align: 'center', - }, - { - title: '备注', - dataIndex: 'comments', - key: 'comments', - align: 'center', + dataIndex: 'roles', + key: 'roles', + align: 'center' }, { title: '操作', @@ -142,13 +167,13 @@ ]); /* 搜索 */ - const reload = (where?: MerchantAccountParam) => { + const reload = (where?: UserParam) => { selection.value = []; tableRef?.value?.reload({ where: where }); }; /* 打开编辑弹窗 */ - const openEdit = (row?: MerchantAccount) => { + const openEdit = (row?: User) => { current.value = row ?? null; showEdit.value = true; }; @@ -159,9 +184,9 @@ }; /* 删除单个 */ - const remove = (row: MerchantAccount) => { + const remove = (row: User) => { const hide = message.loading('请求中..', 0); - removeMerchantAccount(row.id) + removeUser(row.userId) .then((msg) => { hide(); message.success(msg); @@ -186,7 +211,7 @@ maskClosable: true, onOk: () => { const hide = message.loading('请求中..', 0); - removeBatchMerchantAccount(selection.value.map((d) => d.id)) + removeUsers(selection.value.map((d) => d.userId)) .then((msg) => { hide(); message.success(msg); @@ -206,7 +231,7 @@ }; /* 自定义行属性 */ - const customRow = (record: MerchantAccount) => { + const customRow = (record: User) => { return { // 行点击事件 onClick: () => { @@ -223,7 +248,7 @@ diff --git a/src/views/booking/field/index.vue b/src/views/booking/field/index.vue index b36b13a..5b07c44 100644 --- a/src/views/booking/field/index.vue +++ b/src/views/booking/field/index.vue @@ -2,12 +2,12 @@
-
+
场馆列表 @@ -70,6 +70,8 @@ import { removeMerchant } from '@/api/shop/merchant'; import { Merchant } from '@/api/shop/merchant/model'; import { listMerchant } from '@/api/shop/merchant'; + import { getMerchantId } from '@/utils/common'; + import { getMerchantName } from "@/utils/merchant"; // 加载状态 const loading = ref(true); @@ -95,7 +97,9 @@ /* 查询 */ const query = () => { loading.value = true; - listMerchant() + listMerchant({ + merchantId: getMerchantId() + }) .then((list) => { loading.value = false; const eks: number[] = []; diff --git a/src/views/booking/field/list.vue b/src/views/booking/field/list.vue index a1c00f2..0d1d952 100644 --- a/src/views/booking/field/list.vue +++ b/src/views/booking/field/list.vue @@ -7,7 +7,7 @@ :datasource="datasource" v-model:selection="selection" :customRow="customRow" - height="calc(100vh - 290px)" + height="calc(100vh - 390px)" tool-class="ele-toolbar-form" :scroll="{ x: 800 }" > @@ -95,6 +95,7 @@ import { ExclamationCircleOutlined } from '@ant-design/icons-vue'; import { Merchant } from '@/api/shop/merchant/model'; import PeriodEdit from './period/index.vue'; + import { getMerchantId } from "@/utils/common"; const props = defineProps<{ // 场馆场地 id @@ -223,6 +224,7 @@ where.sortNumber = filters.sortNumber; where.status = filters.status; } + where.merchantId = getMerchantId(); return pageField({ ...where, ...orders, diff --git a/src/views/booking/school/index.vue b/src/views/booking/school/index.vue index e607a0e..c91c5d3 100644 --- a/src/views/booking/school/index.vue +++ b/src/views/booking/school/index.vue @@ -30,8 +30,8 @@ @@ -192,14 +175,15 @@