适配多商户

This commit is contained in:
gxwebsoft
2024-05-24 14:53:29 +08:00
parent 757822f3ba
commit dea6ae1c23
23 changed files with 1167 additions and 315 deletions

View File

@@ -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<ApiResult<PageResult<UserInvoice>>>(
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<ApiResult<UserInvoice[]>>(
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<ApiResult<unknown>>(
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<ApiResult<unknown>>(
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<ApiResult<unknown>>(
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<ApiResult<unknown>>(
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<ApiResult<UserInvoice>>(
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));
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -65,7 +65,9 @@ export interface Merchant {
roleId?: number;
roleName?: string;
label?: string;
value?: string;
value?: number;
key?: number;
title?: string;
}
/**

View File

@@ -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;