新增功能:收银台
This commit is contained in:
@@ -23,12 +23,9 @@ export async function pageMp(params: MpParam) {
|
||||
* 查询小程序信息列表
|
||||
*/
|
||||
export async function listMp(params?: MpParam) {
|
||||
const res = await request.get<ApiResult<Mp[]>>(
|
||||
MODULES_API_URL + '/cms/mp',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
const res = await request.get<ApiResult<Mp[]>>(MODULES_API_URL + '/cms/mp', {
|
||||
params
|
||||
});
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
|
||||
@@ -57,5 +57,6 @@ export interface Mp {
|
||||
*/
|
||||
export interface MpParam extends PageParam {
|
||||
mpId?: number;
|
||||
type?: number;
|
||||
keywords?: string;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { Cart, CartParam } from './model';
|
||||
import { Cart, CartParam, CartVo } from './model';
|
||||
import { MODULES_API_URL } from '@/config/setting';
|
||||
|
||||
/**
|
||||
@@ -23,7 +23,7 @@ export async function pageCart(params: CartParam) {
|
||||
* 查询购物车列表
|
||||
*/
|
||||
export async function listCart(params?: CartParam) {
|
||||
const res = await request.get<ApiResult<Cart[]>>(
|
||||
const res = await request.get<ApiResult<CartVo>>(
|
||||
MODULES_API_URL + '/shop/cart',
|
||||
{
|
||||
params
|
||||
@@ -104,3 +104,48 @@ export async function getCart(id: number) {
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 挂单
|
||||
* @param data
|
||||
*/
|
||||
export async function packCart(data: Cart) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/cart/packCart',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 减少数量
|
||||
* @param data
|
||||
*/
|
||||
export async function subCartNum(data: Cart) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/cart/subCartNum',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加数量
|
||||
* @param data
|
||||
*/
|
||||
export async function addCartNum(data: Cart) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/cart/addCartNum',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
@@ -1,17 +1,45 @@
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
export interface CartVo {
|
||||
// 店铺列表
|
||||
shops?: CartShopVo[];
|
||||
// 购物车总金额
|
||||
totalPrice?: number;
|
||||
// 宝贝总数量
|
||||
totalNums?: number;
|
||||
// 已选宝贝
|
||||
selectNums?: number;
|
||||
// 是否全选
|
||||
selectAll?: boolean;
|
||||
}
|
||||
|
||||
export interface CartShopVo {
|
||||
// 店铺ID
|
||||
shopId?: number;
|
||||
// 店铺名称
|
||||
shopName?: string;
|
||||
// 店铺LOGO
|
||||
shopLogo?: string;
|
||||
// 购物车商品列表
|
||||
carts?: Cart[];
|
||||
}
|
||||
|
||||
/**
|
||||
* 购物车
|
||||
*/
|
||||
export interface Cart {
|
||||
// 购物车表ID
|
||||
id?: string;
|
||||
id?: number;
|
||||
// 类型 0商城 1预定
|
||||
type?: number;
|
||||
// 商品ID
|
||||
goodsId?: string;
|
||||
goodsId?: number;
|
||||
// 商品名称
|
||||
goodsName?: string;
|
||||
// 唯一标识
|
||||
code?: string;
|
||||
// 是否多规格
|
||||
specs?: number;
|
||||
// 商品规格
|
||||
spec?: string;
|
||||
// 商品数量
|
||||
@@ -36,6 +64,14 @@ export interface Cart {
|
||||
createTime?: string;
|
||||
// 修改时间
|
||||
updateTime?: string;
|
||||
// 商品图片
|
||||
image?: string;
|
||||
// 商品价格
|
||||
price?: number;
|
||||
// 加载完成
|
||||
loading?: boolean;
|
||||
// 收银员ID
|
||||
adminId?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
194
src/api/shop/cashier/index.ts
Normal file
194
src/api/shop/cashier/index.ts
Normal file
@@ -0,0 +1,194 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { Cashier, CashierParam, CashierVo } from './model';
|
||||
import { MODULES_API_URL } from '@/config/setting';
|
||||
|
||||
/**
|
||||
* 分页查询收银
|
||||
*/
|
||||
export async function pageCashier(params: CashierParam) {
|
||||
const res = await request.get<ApiResult<PageResult<Cashier>>>(
|
||||
MODULES_API_URL + '/shop/cashier/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询收银列表
|
||||
*/
|
||||
export async function listCashier(params?: CashierParam) {
|
||||
const res = await request.get<ApiResult<CashierVo>>(
|
||||
MODULES_API_URL + '/shop/cashier',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询收银列表
|
||||
*/
|
||||
export async function listByGroupId(params?: CashierParam) {
|
||||
const res = await request.get<ApiResult<CashierVo[]>>(
|
||||
MODULES_API_URL + '/shop/cashier/listByGroupId',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加收银
|
||||
*/
|
||||
export async function addCashier(data: Cashier) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/cashier',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改收银
|
||||
*/
|
||||
export async function updateCashier(data: Cashier) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/cashier',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除收银
|
||||
*/
|
||||
export async function removeCashier(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/cashier/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除收银
|
||||
*/
|
||||
export async function removeBatchCashier(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/cashier/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询收银
|
||||
*/
|
||||
export async function getCashier(id: number) {
|
||||
const res = await request.get<ApiResult<Cashier>>(
|
||||
MODULES_API_URL + '/shop/cashier/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 挂单
|
||||
* @param data
|
||||
*/
|
||||
export async function packCashier(data: Cashier[]) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/cashier/packCashier',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 减少数量
|
||||
* @param data
|
||||
*/
|
||||
export async function subCartNum(data: Cashier) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/cashier/subCartNum',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加数量
|
||||
* @param data
|
||||
*/
|
||||
export async function addCartNum(data: Cashier) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/cashier/addCartNum',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 取单
|
||||
*/
|
||||
export async function getByGroup(groupId: number) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/cashier/getByGroup/' + groupId
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除整单
|
||||
*/
|
||||
export async function removeByGroup(groupId: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/cashier/removeByGroup/' + groupId
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
78
src/api/shop/cashier/model/index.ts
Normal file
78
src/api/shop/cashier/model/index.ts
Normal file
@@ -0,0 +1,78 @@
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
export interface CashierVo {
|
||||
// 购物车总金额
|
||||
totalPrice?: number;
|
||||
// 宝贝总数量
|
||||
totalNums?: number;
|
||||
// 已选宝贝
|
||||
selectNums?: number;
|
||||
// 是否全选
|
||||
selectAll?: boolean;
|
||||
// 订单备注
|
||||
comments?: string;
|
||||
// 收银台商品列表
|
||||
cashiers?: Cashier[];
|
||||
// 按groupId分组
|
||||
groups?: any[];
|
||||
}
|
||||
|
||||
/**
|
||||
* 收银
|
||||
*/
|
||||
export interface Cashier {
|
||||
// 收银单ID
|
||||
id?: number;
|
||||
// 类型 0商城 1外卖
|
||||
type?: number;
|
||||
// 唯一标识
|
||||
code?: string;
|
||||
// 商品ID
|
||||
goodsId?: string;
|
||||
// 商品名称
|
||||
goodsName?: string;
|
||||
// 商品封面图
|
||||
image?: string;
|
||||
// 商品规格
|
||||
spec?: string;
|
||||
// 商品价格
|
||||
price?: string;
|
||||
// 商品数量
|
||||
cartNum?: number;
|
||||
// 单商品合计
|
||||
totalPrice?: string;
|
||||
// 0 = 未购买 1 = 已购买
|
||||
isPay?: string;
|
||||
// 是否为立即购买
|
||||
isNew?: string;
|
||||
// 是否选中
|
||||
selected?: string;
|
||||
// 商户ID
|
||||
merchantId?: string;
|
||||
// 用户ID
|
||||
userId?: string;
|
||||
// 收银员ID
|
||||
cashierId?: string;
|
||||
// 收银单分组ID
|
||||
groupId?: number;
|
||||
// 租户id
|
||||
tenantId?: number;
|
||||
// 创建时间
|
||||
createTime?: string;
|
||||
// 修改时间
|
||||
updateTime?: string;
|
||||
// 是否多规格
|
||||
specs?: number;
|
||||
// 商品规格数据
|
||||
goodsSpecValue?: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* 收银搜索条件
|
||||
*/
|
||||
export interface CashierParam extends PageParam {
|
||||
id?: number;
|
||||
groupId?: number;
|
||||
showByGroup?: boolean;
|
||||
keywords?: string;
|
||||
}
|
||||
119
src/api/shop/count/index.ts
Normal file
119
src/api/shop/count/index.ts
Normal file
@@ -0,0 +1,119 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { Count, CountParam } from './model';
|
||||
import { MODULES_API_URL } from '@/config/setting';
|
||||
|
||||
export async function data(params: CountParam) {
|
||||
const res = await request.get<ApiResult<Count[]>>(
|
||||
MODULES_API_URL + '/shop/count/data',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询商城销售统计表
|
||||
*/
|
||||
export async function pageCount(params: CountParam) {
|
||||
const res = await request.get<ApiResult<PageResult<Count>>>(
|
||||
MODULES_API_URL + '/shop/count/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询商城销售统计表列表
|
||||
*/
|
||||
export async function listCount(params?: CountParam) {
|
||||
const res = await request.get<ApiResult<Count[]>>(
|
||||
MODULES_API_URL + '/shop/count',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加商城销售统计表
|
||||
*/
|
||||
export async function addCount(data: Count) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/count',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商城销售统计表
|
||||
*/
|
||||
export async function updateCount(data: Count) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/count',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商城销售统计表
|
||||
*/
|
||||
export async function removeCount(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/count/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除商城销售统计表
|
||||
*/
|
||||
export async function removeBatchCount(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/count/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询商城销售统计表
|
||||
*/
|
||||
export async function getCount(id: number) {
|
||||
const res = await request.get<ApiResult<Count>>(
|
||||
MODULES_API_URL + '/shop/count/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
40
src/api/shop/count/model/index.ts
Normal file
40
src/api/shop/count/model/index.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
/**
|
||||
* 商城销售统计表
|
||||
*/
|
||||
export interface Count {
|
||||
// ID
|
||||
id?: number;
|
||||
// 统计日期
|
||||
dateTime?: string;
|
||||
// 总销售额
|
||||
totalPrice?: string;
|
||||
// 今日销售额
|
||||
todayPrice?: string;
|
||||
// 总会员数
|
||||
totalUsers?: string;
|
||||
// 今日新增
|
||||
todayUsers?: string;
|
||||
// 总订单笔数
|
||||
totalOrders?: string;
|
||||
// 今日订单笔数
|
||||
todayOrders?: string;
|
||||
// 备注
|
||||
comments?: string;
|
||||
// 状态, 0正常, 1冻结
|
||||
status?: number;
|
||||
// 租户id
|
||||
tenantId?: number;
|
||||
// 注册时间
|
||||
createTime?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 商城销售统计表搜索条件
|
||||
*/
|
||||
export interface CountParam extends PageParam {
|
||||
id?: number;
|
||||
dateTime?: string;
|
||||
keywords?: string;
|
||||
}
|
||||
@@ -96,6 +96,7 @@ export interface BathSet {
|
||||
*/
|
||||
export interface GoodsParam extends PageParam {
|
||||
goodsId?: number;
|
||||
goodsName?: string;
|
||||
isShow?: number;
|
||||
stock?: number;
|
||||
keywords?: string;
|
||||
|
||||
Reference in New Issue
Block a user