整理商品管理模块

This commit is contained in:
2024-07-25 19:20:53 +08:00
parent 717c89a58e
commit cf0961afdd
48 changed files with 1814 additions and 965 deletions

View File

@@ -3,6 +3,14 @@ import type { ApiResult, PageResult } from '@/api';
import type { Goods, GoodsParam } from './model';
import { MODULES_API_URL } from '@/config/setting';
export async function getCount() {
const res = await request.get(MODULES_API_URL + '/shop/goods/data');
if (res.data.code === 0) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 分页查询商品记录表
*/

View File

@@ -2,6 +2,12 @@ import type { PageParam } from '@/api';
import { GoodsSpec } from '@/api/shop/goodsSpec/model';
import { GoodsSku } from '@/api/shop/goodsSku/model';
export interface GoodsCount {
totalNum: number;
totalNum2: number;
totalNum3: number;
totalNum4: number;
}
/**
* 商品记录表
*/
@@ -45,6 +51,7 @@ export interface Goods {
// 推荐
recommend?: number;
// 状态, 0正常, 1待修,2异常已修3异常未修
isShow?: number;
status?: number;
// 备注
comments?: string;
@@ -58,6 +65,8 @@ export interface Goods {
tenantId?: number;
// 商户ID
merchantId?: number;
// 店铺名称
merchantName?: string;
// 创建时间
createTime?: string;
// 修改时间
@@ -80,5 +89,8 @@ export interface BathSet {
*/
export interface GoodsParam extends PageParam {
goodsId?: number;
status?: number;
isShow?: number;
stock?: number;
keywords?: string;
}

View File

@@ -1,14 +1,14 @@
import request from '@/utils/request';
import type { ApiResult, PageResult } from '@/api';
import type { MerchantAccount, MerchantAccountParam } from './model';
import { SERVER_API_URL } from '@/config/setting';
import { MODULES_API_URL } from '@/config/setting';
/**
* 分页查询商户账号
*/
export async function pageMerchantAccount(params: MerchantAccountParam) {
const res = await request.get<ApiResult<PageResult<MerchantAccount>>>(
SERVER_API_URL + '/system/merchant-account/page',
MODULES_API_URL + '/shop/merchant-account/page',
{
params
}
@@ -24,7 +24,7 @@ export async function pageMerchantAccount(params: MerchantAccountParam) {
*/
export async function listMerchantAccount(params?: MerchantAccountParam) {
const res = await request.get<ApiResult<MerchantAccount[]>>(
SERVER_API_URL + '/system/merchant-account',
MODULES_API_URL + '/shop/merchant-account',
{
params
}
@@ -40,7 +40,7 @@ export async function listMerchantAccount(params?: MerchantAccountParam) {
*/
export async function addMerchantAccount(data: MerchantAccount) {
const res = await request.post<ApiResult<unknown>>(
SERVER_API_URL + '/system/merchant-account',
MODULES_API_URL + '/shop/merchant-account',
data
);
if (res.data.code === 0) {
@@ -54,7 +54,7 @@ export async function addMerchantAccount(data: MerchantAccount) {
*/
export async function updateMerchantAccount(data: MerchantAccount) {
const res = await request.put<ApiResult<unknown>>(
SERVER_API_URL + '/system/merchant-account',
MODULES_API_URL + '/shop/merchant-account',
data
);
if (res.data.code === 0) {
@@ -68,7 +68,7 @@ export async function updateMerchantAccount(data: MerchantAccount) {
*/
export async function removeMerchantAccount(id?: number) {
const res = await request.delete<ApiResult<unknown>>(
SERVER_API_URL + '/system/merchant-account/' + id
MODULES_API_URL + '/shop/merchant-account/' + id
);
if (res.data.code === 0) {
return res.data.message;
@@ -81,7 +81,7 @@ export async function removeMerchantAccount(id?: number) {
*/
export async function removeBatchMerchantAccount(data: (number | undefined)[]) {
const res = await request.delete<ApiResult<unknown>>(
SERVER_API_URL + '/system/merchant-account/batch',
MODULES_API_URL + '/shop/merchant-account/batch',
{
data
}
@@ -97,7 +97,7 @@ export async function removeBatchMerchantAccount(data: (number | undefined)[]) {
*/
export async function getMerchantAccount(id: number) {
const res = await request.get<ApiResult<MerchantAccount>>(
SERVER_API_URL + '/system/merchant-account/' + id
MODULES_API_URL + '/shop/merchant-account/' + id
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
@@ -107,7 +107,7 @@ export async function getMerchantAccount(id: number) {
export async function getMerchantAccountByPhone(params?: MerchantAccountParam) {
const res = await request.get<ApiResult<MerchantAccount>>(
SERVER_API_URL + '/system/merchant-account/getMerchantAccountByPhone',
MODULES_API_URL + '/shop/merchant-account/getMerchantAccountByPhone',
{
params
}

View File

@@ -20,6 +20,7 @@ export interface MerchantAccount {
roleName?: string;
// 用户ID
userId?: number;
nickname?: string;
// 备注
comments?: string;
// 状态

View File

@@ -1,14 +1,14 @@
import request from '@/utils/request';
import type { ApiResult, PageResult } from '@/api';
import type { MerchantApply, MerchantApplyParam } from './model';
import { SERVER_API_URL } from '@/config/setting';
import { MODULES_API_URL } from '@/config/setting';
/**
* 分页查询商户入驻申请
*/
export async function pageMerchantApply(params: MerchantApplyParam) {
const res = await request.get<ApiResult<PageResult<MerchantApply>>>(
SERVER_API_URL + '/system/merchant-apply/page',
MODULES_API_URL + '/shop/merchant-apply/page',
{
params
}
@@ -24,7 +24,7 @@ export async function pageMerchantApply(params: MerchantApplyParam) {
*/
export async function listMerchantApply(params?: MerchantApplyParam) {
const res = await request.get<ApiResult<MerchantApply[]>>(
SERVER_API_URL + '/system/merchant-apply',
MODULES_API_URL + '/shop/merchant-apply',
{
params
}
@@ -40,7 +40,7 @@ export async function listMerchantApply(params?: MerchantApplyParam) {
*/
export async function addMerchantApply(data: MerchantApply) {
const res = await request.post<ApiResult<unknown>>(
SERVER_API_URL + '/system/merchant-apply',
MODULES_API_URL + '/shop/merchant-apply',
data
);
if (res.data.code === 0) {
@@ -54,7 +54,7 @@ export async function addMerchantApply(data: MerchantApply) {
*/
export async function updateMerchantApply(data: MerchantApply) {
const res = await request.put<ApiResult<unknown>>(
SERVER_API_URL + '/system/merchant-apply',
MODULES_API_URL + '/shop/merchant-apply',
data
);
if (res.data.code === 0) {
@@ -68,7 +68,7 @@ export async function updateMerchantApply(data: MerchantApply) {
*/
export async function removeMerchantApply(id?: number) {
const res = await request.delete<ApiResult<unknown>>(
SERVER_API_URL + '/system/merchant-apply/' + id
MODULES_API_URL + '/shop/merchant-apply/' + id
);
if (res.data.code === 0) {
return res.data.message;
@@ -81,7 +81,7 @@ export async function removeMerchantApply(id?: number) {
*/
export async function removeBatchMerchantApply(data: (number | undefined)[]) {
const res = await request.delete<ApiResult<unknown>>(
SERVER_API_URL + '/system/merchant-apply/batch',
MODULES_API_URL + '/shop/merchant-apply/batch',
{
data
}
@@ -97,7 +97,7 @@ export async function removeBatchMerchantApply(data: (number | undefined)[]) {
*/
export async function getMerchantApply(id: number) {
const res = await request.get<ApiResult<MerchantApply>>(
SERVER_API_URL + '/system/merchant-apply/' + id
MODULES_API_URL + '/shop/merchant-apply/' + id
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;

View File

@@ -1,14 +1,14 @@
import request from '@/utils/request';
import type { ApiResult, PageResult } from '@/api';
import type { MerchantType, MerchantTypeParam } from './model';
import { SERVER_API_URL } from '@/config/setting';
import { MODULES_API_URL } from '@/config/setting';
/**
* 分页查询商户类型
*/
export async function pageMerchantType(params: MerchantTypeParam) {
const res = await request.get<ApiResult<PageResult<MerchantType>>>(
SERVER_API_URL + '/system/merchant-type/page',
MODULES_API_URL + '/shop/merchant-type/page',
{
params
}
@@ -24,7 +24,7 @@ export async function pageMerchantType(params: MerchantTypeParam) {
*/
export async function listMerchantType(params?: MerchantTypeParam) {
const res = await request.get<ApiResult<MerchantType[]>>(
SERVER_API_URL + '/system/merchant-type',
MODULES_API_URL + '/shop/merchant-type',
{
params
}
@@ -40,7 +40,7 @@ export async function listMerchantType(params?: MerchantTypeParam) {
*/
export async function addMerchantType(data: MerchantType) {
const res = await request.post<ApiResult<unknown>>(
SERVER_API_URL + '/system/merchant-type',
MODULES_API_URL + '/shop/merchant-type',
data
);
if (res.data.code === 0) {
@@ -54,7 +54,7 @@ export async function addMerchantType(data: MerchantType) {
*/
export async function updateMerchantType(data: MerchantType) {
const res = await request.put<ApiResult<unknown>>(
SERVER_API_URL + '/system/merchant-type',
MODULES_API_URL + '/shop/merchant-type',
data
);
if (res.data.code === 0) {
@@ -68,7 +68,7 @@ export async function updateMerchantType(data: MerchantType) {
*/
export async function removeMerchantType(id?: number) {
const res = await request.delete<ApiResult<unknown>>(
SERVER_API_URL + '/system/merchant-type/' + id
MODULES_API_URL + '/shop/merchant-type/' + id
);
if (res.data.code === 0) {
return res.data.message;
@@ -81,7 +81,7 @@ export async function removeMerchantType(id?: number) {
*/
export async function removeBatchMerchantType(data: (number | undefined)[]) {
const res = await request.delete<ApiResult<unknown>>(
SERVER_API_URL + '/system/merchant-type/batch',
MODULES_API_URL + '/shop/merchant-type/batch',
{
data
}
@@ -97,7 +97,7 @@ export async function removeBatchMerchantType(data: (number | undefined)[]) {
*/
export async function getMerchantType(id: number) {
const res = await request.get<ApiResult<MerchantType>>(
SERVER_API_URL + '/system/merchant-type/' + id
MODULES_API_URL + '/shop/merchant-type/' + id
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;

View File

@@ -4,7 +4,7 @@ import type { Spec, SpecParam } from './model';
import { MODULES_API_URL } from '@/config/setting';
/**
* 分页查询商品规格组记录表
* 分页查询规格
*/
export async function pageSpec(params: SpecParam) {
const res = await request.get<ApiResult<PageResult<Spec>>>(
@@ -20,7 +20,7 @@ export async function pageSpec(params: SpecParam) {
}
/**
* 查询商品规格组记录表列表
* 查询规格列表
*/
export async function listSpec(params?: SpecParam) {
const res = await request.get<ApiResult<Spec[]>>(
@@ -36,7 +36,7 @@ export async function listSpec(params?: SpecParam) {
}
/**
* 添加商品规格组记录表
* 添加规格
*/
export async function addSpec(data: Spec) {
const res = await request.post<ApiResult<unknown>>(
@@ -50,7 +50,7 @@ export async function addSpec(data: Spec) {
}
/**
* 修改商品规格组记录表
* 修改规格
*/
export async function updateSpec(data: Spec) {
const res = await request.put<ApiResult<unknown>>(
@@ -64,7 +64,7 @@ export async function updateSpec(data: Spec) {
}
/**
* 删除商品规格组记录表
* 删除规格
*/
export async function removeSpec(id?: number) {
const res = await request.delete<ApiResult<unknown>>(
@@ -77,7 +77,7 @@ export async function removeSpec(id?: number) {
}
/**
* 批量删除商品规格组记录表
* 批量删除规格
*/
export async function removeBatchSpec(data: (number | undefined)[]) {
const res = await request.delete<ApiResult<unknown>>(
@@ -93,7 +93,7 @@ export async function removeBatchSpec(data: (number | undefined)[]) {
}
/**
* 根据id查询商品规格组记录表
* 根据id查询规格
*/
export async function getSpec(id: number) {
const res = await request.get<ApiResult<Spec>>(

View File

@@ -1,31 +1,33 @@
import type { PageParam } from '@/api';
import { SpecValue } from '@/api/shop/specValue/model';
/**
* 商品规格组记录表
* 规格
*/
export interface Spec {
// 规格ID
// 规格ID
specId?: number;
// 规格名称
// 规格名称
specName?: string;
// 描述
// 规格值
specValue?: string;
// 创建用户
userId?: number;
// 更新者
updater?: number;
// 备注
comments?: string;
// 状态
// 状态, 0正常, 1待修,2异常已修3异常未修
status?: number;
// 排序
// 排序
sortNumber?: number;
// 租户id
tenantId?: number;
// 规格值
specValues?: SpecValue[];
key?: string;
label?: string;
value?: string;
// 创建时间
createTime?: string;
}
/**
* 商品规格组记录表搜索条件
* 规格搜索条件
*/
export interface SpecParam extends PageParam {
specId?: number;

View File

@@ -19,6 +19,7 @@ export interface SpecValue {
key?: string;
label?: string;
value?: string;
detail?: [string];
}
/**