提交 a8b87878 作者: 龚洪江

Merge branch 'develop'

......@@ -14,4 +14,4 @@ patches:
images:
- name: REGISTRY/NAMESPACE/IMAGE:TAG
newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/admin
newTag: e8642a205674071202d22ba8f884dd9dd226bc36
newTag: 69a87f6953407401ad1c17c2d6e409c4f5d581f7
......@@ -14,6 +14,7 @@ import { ResourceManageAPI } from './modules/resourceManageAPI';
import { ForumManageAPI } from './modules/forumManageAPI';
import { PilotTrainAPI } from './modules/pilotTrainAPI';
import { FlyerCenterAPI } from './modules/flyerCenterAPI';
import { RentManageAPI } from './modules/rentManageAPI';
export {
CommonAPI,
......@@ -32,4 +33,5 @@ export {
ForumManageAPI,
PilotTrainAPI,
FlyerCenterAPI,
RentManageAPI,
};
......@@ -109,161 +109,62 @@ export type removeMallGoodsType = InterFunction<{ id: number }, any>;
export type exchangeGoodsInfoType = InterFunction<{ firstId: number; secondId: number }, any>;
//商品-新增(新)
export type addMallGoodsType = InterFunction<
{
categoryPrimaryId: number;
categorySubId: number;
description: string;
goodsDetails: string;
goodsLabel: string;
goodsSpecList: {
chooseType: number;
goodsSpecValuesList: {
channelPrice?: number;
id: any;
partNo: string;
salePrice: number;
showPrice: number;
specValueImage: string;
specValueName: string;
stock?: number;
goodsSpecId?: number;
}[];
//商品item类型
type goodsItemType = {
categoryPrimaryId: number;
categorySubId: number;
description: string;
goodsDetails: string;
goodsLabel: string;
goodsSpecList?: {
chooseType: number;
goodsSpecValuesList: {
channelPrice?: number;
id: any;
mallGoodsId: number;
must: number;
skuUnitId: number;
specName: string;
}[];
labelShow: number;
resourcesList: {
id: number;
type: number;
url: string;
}[];
shelfStatus: number;
tradeName: string;
},
any
>;
//商品-编辑(新)
export type editMallGoodsType = InterFunction<
{
categoryPrimaryId: number;
categorySubId: number;
description: string;
goodsDetails: string;
goodsLabel: string;
goodsSpecList: {
chooseType: number;
goodsSpecValuesList: {
channelPrice?: number;
id: any;
partNo: string;
salePrice: number;
showPrice: number;
specValueImage: string;
specValueName: string;
stock?: number;
goodsSpecId: number;
}[];
id: any;
mallGoodsId: number;
must: number;
skuUnitId: number;
specName: string;
partNo: string;
salePrice: number;
showPrice: number;
specValueImage: string;
specValueName: string;
stock?: number;
goodsSpecId?: number;
}[];
id: any;
mallGoodsId: number;
must: number;
skuUnitId: number;
specName: string;
}[];
labelShow: number;
resourcesList: {
id: number;
labelShow: number;
resourcesList: {
id: number;
type: number;
url: string;
}[];
shelfStatus: number;
tradeName: string;
},
any
>;
type: number;
url: string;
}[];
shelfStatus: number;
tradeName: string;
priceStock: {
channelPrice: number;
id?: number;
productSpec: string;
salePrice: number;
skuImage: string;
skuNo: string;
stock: number;
}[];
specAttrList: {
specName: string;
id: number;
specValuesList: { specName: string; id: number }[];
}[];
};
export type addMallGoodsType = InterFunction<goodsItemType, any>;
//商品-编辑(新)
export type editMallGoodsType = InterFunction<goodsItemType & { id: number }, any>;
//商品-列表(新)
export type listPageGoodsInfoType = InterItemFunction<
{ categoryPrimaryId?: number; tradeName?: string; shelfStatus?: number },
{
categoryPrimaryId: number;
categorySubId: number;
createTime: string;
description: string;
goodsDetails: string;
goodsLabel: string;
goodsSpecList: {
chooseType: number;
goodsSpecValuesList: {
channelPrice: number;
goodsSpecId: number;
id: number;
partNo: string;
salePrice: number;
showPrice: number;
specValueImage: string;
specValueName: string;
stock: number;
}[];
id: number;
mallGoodsId: number;
must: number;
skuUnitId: number;
specName: string;
}[];
id: number;
labelShow: number;
resourcesList: {
id: number;
type: number;
url: string;
}[];
shelfStatus: number;
tradeName: string;
userAccountId: number;
}[]
goodsItemType & { id: number }[]
>;
//商城-详情(新)
export type mallGoodsDetailsType = InterFunction<
{ id: number },
{
categoryPrimaryId: number;
categorySubId: number;
createTime: string;
description: string;
goodsDetails: string;
goodsLabel: string;
goodsSpecList: {
chooseType: number;
goodsSpecValuesList: {
channelPrice: number;
goodsSpecId: number;
id: number;
partNo: string;
salePrice: number;
showPrice: number;
specValueImage: string;
specValueName: string;
stock: number;
}[];
id: number;
mallGoodsId: number;
must: number;
skuUnitId: number;
specName: string;
}[];
id: number;
labelShow: number;
resourcesList: {
id: number;
type: number;
url: string;
}[];
shelfStatus: number;
tradeName: string;
userAccountId: number;
}
>;
export type mallGoodsDetailsType = InterFunction<{ id: number }, goodsItemType & { id: number }>;
......@@ -649,3 +649,36 @@ export type DistributeMallOrderBonusType = InterFunction<
}>;
}
>;
// 后台管理——积分列表
export type UserPointListType = InterListFunction<
{
nickName?: string;
phoneNum?: string;
},
{
createTime: string;
id: number;
nickName: string;
phoneNum: number;
totalPoints: number;
updateTime: string;
userAccountId: number;
}
>;
// 后台管理——积分详情
export type DetailPointListType = InterListFunction<
{
userAccountId: number;
},
{
createTime: string;
id: number;
nickName: string;
phoneNum: number;
point: number;
pointSource: number;
timeOfRelease: number;
updateTime: string;
userAccountId: number;
}
>;
import { InterFunction, InterItemFunction } from '~/api/interface';
//租赁-类型-新增
export type addType = InterFunction<{ name: string; url: string }, any>;
//租赁-类型-列表
export type getTypeListType = InterItemFunction<any, { id: number; name: string; url: string }[]>;
//租赁-类型-编辑
export type rentTypeEditType = InterFunction<{ name: string; url: string; id: number }, any>;
//租赁-类型-删除
export type rentTypeRemoveType = InterFunction<{ id: number }, any>;
//租赁-品牌-新增
export type rentMakeAddType = InterFunction<{ brandName: string }, any>;
//租赁-品牌-编辑
export type editBrandInfoType = InterFunction<{ brandName: string; id?: number }, any>;
//租赁-品牌-列表
export type listBrandInfoType = InterItemFunction<
any,
{
brandName: string;
createTime: string;
id: number;
modeInfoList: {
brandInfoId: number;
id: number;
modeName: string;
productTypeId: number;
tag: string;
}[];
}[]
>;
//租赁-型号-新增
export type addRentModeType = InterFunction<
{ modeName: string; brandInfoId: number; productTypeId: number },
any
>;
......@@ -2,6 +2,7 @@ import axios from '../request';
import {
AddAndEditBonusRuleType,
AddConvertRuleType,
UserPointListType,
BonusRuleListQueryType,
CalculateOrderBonusVOType,
CheckUserScoreType,
......@@ -25,6 +26,7 @@ import {
UpdateMallOrderBonusType,
UserScoreDetailsListType,
UserScorePageListType,
DetailPointListType,
} from '../interface/pointManageType';
export class PointManageAPI {
......@@ -127,4 +129,14 @@ export class PointManageAPI {
// 积分管理-订单分成-发放积分
static DistributeMallOrderBonus: DistributeMallOrderBonusType = (params) =>
axios.get('/mallorder/orderBonus/distributeMallOrderBonus', { params });
// 后台管理——积分列表
static UserPointList: UserPointListType = (params) => {
return axios.post('/userapp/userPoint/userPointList', params);
};
// 后台管理——积分详情
static DetailPointList: DetailPointListType = (params) => {
return axios.post('/userapp/userPoint/detailPoint', params);
};
}
import {
addRentModeType,
addType,
editBrandInfoType,
getTypeListType,
listBrandInfoType,
rentMakeAddType,
rentTypeEditType,
rentTypeRemoveType,
} from '~/api/interface/rentManageType';
import axios from '../request';
export class RentManageAPI {
//租赁-类型-新增
static addTypeReq: addType = (data) => axios.post('/pms/attribute/addType', data);
//租赁-类型-列表
static getTypeList: getTypeListType = (params) =>
axios.get('/pms/attribute/typeList', { params });
// 租赁-类型-编辑
static editTypeReq: rentTypeEditType = (data) => axios.post('/pms/attribute/editType', data);
// 租赁-类型-删除
static rentTypeRemove: rentTypeRemoveType = (params) =>
axios.get('/pms/attribute/removeType', { params });
// 租赁-品牌-新增
static addBrandInfo: rentMakeAddType = (params) =>
axios.get('/pms/brand/addBrandInfo', { params });
// 租赁-品牌-编辑
static editBrandInfo: editBrandInfoType = (params) =>
axios.get('/pms/brand/editBrandInfo', { params });
// 租赁-品牌-列表
static getListBrandInfo: listBrandInfoType = (params) =>
axios.get('/pms/brand/listBrandInfo', { params });
// 租赁-型号-新增
static addRentMode: addRentModeType = (data) => axios.post('/pms/brand/addMode', data);
}
......@@ -20,6 +20,7 @@ const EditableCell: React.FC<
uploadSuccess?: (record: any, result: any) => void;
rules?: any;
maxLength?: number;
placeholder?: string;
}
> = ({
editing,
......@@ -34,15 +35,16 @@ const EditableCell: React.FC<
children,
rules,
maxLength,
placeholder,
...restProps
}) => {
const inputNode = () => {
switch (inputType) {
case 'number':
return <InputNumber placeholder={`请输入${title}`} maxLength={maxLength} />;
return <InputNumber placeholder={`请输入${placeholder || title}`} maxLength={maxLength} />;
case 'select':
return (
<Select placeholder={`请选择${title}`} style={{ textAlign: 'start' }}>
<Select placeholder={`请选择${placeholder || title}`} style={{ textAlign: 'start' }}>
{selectOption &&
selectOption.map((v) => (
<Select.Option value={v.id} key={v.id}>
......@@ -73,9 +75,15 @@ const EditableCell: React.FC<
</Radio.Group>
);
case 'textArea':
return <Input.TextArea placeholder={`请输入${title}`} maxLength={maxLength} showCount />;
return (
<Input.TextArea
placeholder={`请输入${placeholder || title}`}
maxLength={maxLength}
showCount
/>
);
default:
return <Input placeholder={`请输入${title}`} maxLength={maxLength} />;
return <Input placeholder={`请输入${placeholder || title}`} maxLength={maxLength} />;
}
};
return (
......
import { Button, Popconfirm, Table, Tag } from 'antd';
import { PlusOutlined } from '@ant-design/icons';
import { ColumnsType } from 'antd/es/table';
import { FC, useState } from 'react';
import { InterDataType, InterReqType, PaginationProps } from '~/api/interface';
import { addMallGoodsType, skuUnitType } from '~/api/interface/goodsType';
//商品sku规格类型
type goodsSpecType = Exclude<InterReqType<addMallGoodsType>, undefined>['goodsSpecList'][0];
//单位返回类型
type unitType = InterDataType<skuUnitType>;
import { Button, Col, Form, Input, message, Row, Select, Table, Tag } from 'antd';
import { DeleteOutlined, PlusOutlined } from '@ant-design/icons';
import { forwardRef, useEffect, useImperativeHandle, useState } from 'react';
import { isEmptyBol, regPriceNumber } from '~/utils/validateUtils';
import EditableCell from '~/components/EditableCell';
import { InterDataType, InterReqType } from '~/api/interface';
import { addMallGoodsType, mallGoodsDetailsType } from '~/api/interface/goodsType';
import { filterObjAttr } from '~/utils';
type EditableTableProps = Parameters<typeof Table>[0];
type ColumnTypes = Exclude<EditableTableProps['columns'], undefined>;
//规格表单数据类型
type specificationFormListType = {
optionList: { label: string; value: string }[];
id: number;
name: string;
addSpecificationValueShow: boolean;
specificationValueList: { name: string; id: number; specificationName: string }[];
};
//规格表格类型
type skuTableType = Exclude<InterReqType<addMallGoodsType>, undefined>['priceStock'][0] & {
fileList: {
id: number;
name: string;
uid: number;
url: string;
}[];
};
//商品详情-返回类型
type goodsDetailType = InterDataType<mallGoodsDetailsType>;
interface selfProps {
addOrEditSkuClick: () => void;
skuTableData: goodsSpecType[];
skuUnitList: unitType;
deleteSkuClick: (record: goodsSpecType) => void;
editSkuClick: (record: goodsSpecType) => void;
ref: any;
goodsDetailsInfo: goodsDetailType | undefined;
}
const SkuInfo: FC<selfProps> = ({
addOrEditSkuClick,
skuTableData,
skuUnitList,
deleteSkuClick,
editSkuClick,
}) => {
const tableColumns: ColumnsType<goodsSpecType> = [
const SkuInfo = forwardRef<any, selfProps>(({ goodsDetailsInfo }, ref) => {
//规格项表单
const [form] = Form.useForm<{ [x: string]: string }>();
//可编辑表格表单
const [skuValueForm] = Form.useForm<{ [x: string]: string }>();
//表格数据
const [tableData, setTableData] = useState<(skuTableType & { [key: string]: string })[]>([]);
//销售价格正则校验
const salePriceValidator = (_rules: any, value: number) => {
if (!isEmptyBol(value)) {
if (regPriceNumber(value.toString())) {
if (value > 99999999 || value < 0) {
return Promise.reject(new Error('价格最大为99999999且大于0'));
}
return Promise.resolve();
} else {
return Promise.reject(new Error('为整数且最多保留两位小数'));
}
} else {
return Promise.reject(new Error('请输入销售价'));
}
};
//渠道正则价格校验
const channelPriceValidator = (_rules: any, value: number) => {
if (!isEmptyBol(value)) {
if (regPriceNumber(value.toString())) {
if (value > 99999999 || value < 0) {
return Promise.reject(new Error('价格最大为99999999且大于0'));
}
return Promise.resolve();
} else {
return Promise.reject(new Error('为整数且最多保留两位小数'));
}
} else {
return Promise.resolve();
}
};
//库存正则校验
const stockPriceValidator = (_rules: any, value: number) => {
if (!isEmptyBol(value)) {
if (/^[+]{0,1}(\d+)$/.test(value.toString())) {
if (value > 99999999 || value < 0) {
return Promise.reject(new Error('库存最大为99999999且大于0'));
}
return Promise.resolve();
} else {
return Promise.reject(new Error('请输入正整数'));
}
} else {
return Promise.resolve();
}
};
//表格-列
const [defaultColumns, setDefaultColumns] = useState<
(ColumnTypes[number] & {
editable?: boolean;
dataIndex?: string;
inputType?: string;
radioOption?: { name: string; id: number }[];
rules?: any;
maxLength?: number;
children?: any;
placeholder?: string;
})[]
>([
{
title: '序号',
title: '商品规格',
align: 'center',
render: (_text: string, _record, index: number) => index + 1,
children: [],
},
{
title: '规格名称',
title: '图片',
align: 'center',
dataIndex: 'specName',
editable: true,
dataIndex: 'skuImage',
inputType: 'uploader',
},
{
title: '选择方式',
title: 'sku编号(料号)',
align: 'center',
dataIndex: 'chooseType',
render: (text: number) => (text ? '多选' : '单选'),
editable: true,
dataIndex: 'skuNo',
maxLength: 30,
width: '15%',
},
{
title: '是否必选',
title: (
<div>
<span style={{ color: 'red' }}>*</span>
<span>销售价</span>
</div>
),
align: 'center',
dataIndex: 'must',
render: (text: number) => (text ? '必选' : '非必选'),
editable: true,
dataIndex: 'salePrice',
rules: [{ required: true, validator: salePriceValidator }],
inputType: 'number',
onHeaderCell: () => ({ className: 'custom-header-cell' }),
placeholder: '销售价',
},
{
title: '规格单位',
title: '渠道价',
editable: true,
align: 'center',
dataIndex: 'skuUnitId',
render: (text: number) => skuUnitList.find((v) => v.id === text)?.unitName || '',
dataIndex: 'channelPrice',
rules: [{ required: false, validator: channelPriceValidator }],
inputType: 'number',
},
{
title: '规格值',
title: '库存',
editable: true,
align: 'center',
dataIndex: 'goodsSpecValuesList',
render: (text: goodsSpecType['goodsSpecValuesList']) =>
text.map((v) => (
<Tag key={v.id}>
{v.specValueName}
{v.partNo ? `(${v.partNo})` : ''}
</Tag>
)),
dataIndex: 'stock',
rules: [{ required: false, validator: stockPriceValidator }],
inputType: 'number',
},
]);
const covertColumns = () => {
return defaultColumns.map((col) => {
if (!col.editable) {
return col;
}
return {
...col,
onCell: (record: any) => ({
record,
dataIndex: col.dataIndex,
title: col.title,
editing: col.editable,
radioOption: col.radioOption,
inputType: col.inputType,
uploadSuccess: col.inputType === 'uploader' ? uploadSuccess : undefined,
rules: col.rules,
placeholder: col.placeholder,
}),
};
});
};
//规格表单数组
const [specificationFormList, setSpecificationFormList] = useState<specificationFormListType[]>([
{
title: '操作',
align: 'center',
render: (_text: string, record) => (
<>
<Button type='link' onClick={() => editSkuClick(record)}>
编辑
</Button>
<Popconfirm
placement='topLeft'
title={'删除规格'}
description={'确认删除该规格吗?'}
onConfirm={() => deleteSkuClick(record)}
okText='确定'
cancelText='取消'
>
<Button type='link' danger>
删除
</Button>
</Popconfirm>
</>
),
id: Math.random(),
name: `specName`,
optionList: [],
specificationValueList: [],
addSpecificationValueShow: false,
},
];
const [pagination, setPagination] = useState<PaginationProps>({
pageNo: 1,
pageSize: 10,
});
//分页
const paginationChange = (pageNo: number, pageSize: number) => {
pagination.pageNo = pageNo;
pagination.pageSize = pageSize;
setPagination({ ...pagination });
]);
useImperativeHandle(ref, () => ({
submitSku,
getForm: () => skuValueForm,
}));
//新增规格项目
const addSpecificationClick = () => {
setSpecificationFormList([
...specificationFormList,
{
id: Math.random(),
name: `specName${specificationFormList.length + 1}`,
optionList: [],
specificationValueList: [],
addSpecificationValueShow: false,
},
]);
};
// 删除规格项目
const deleteSpecificationClick = (index: number) => {
console.log('数据-->', specificationFormList[index]);
form.setFieldValue(specificationFormList[index].name, undefined);
specificationFormList.splice(index, 1);
combineSpecificationValue();
setSpecificationFormList([...specificationFormList]);
};
//规格项名称输入完成
const specificationPressEnter = (e: any, index: number) => {
specificationFormList[index].optionList = e.target.value
? [{ label: e.target.value, value: e.target.value }]
: [];
form.setFieldValue(specificationFormList[index].name, e.target.value);
setSpecificationFormList([...specificationFormList]);
};
//规格值添加
const addSpecificationValueClick = (index: number) => {
specificationFormList[index].addSpecificationValueShow = true;
setSpecificationFormList([...specificationFormList]);
};
//存在
const specificationValuePressEnter = (e: any, index: number) => {
const isExist = specificationFormList[index].specificationValueList.some(
(v) => v.name === e.target.value,
);
if (isExist) {
return message.warning('该规格值已存在');
}
specificationFormList[index].specificationValueList.push({
id: Math.random(),
name: e.target.value,
specificationName: specificationFormList[index].optionList[0].value,
});
combineSpecificationValue();
setSpecificationFormList(specificationFormList);
specificationValueCancel(index);
};
//规格值添加-取消
const specificationValueCancel = (index: number) => {
specificationFormList[index].addSpecificationValueShow = false;
setSpecificationFormList([...specificationFormList]);
};
//规格值-删除
const specificationValueDelete = (i: number, j: number) => {
specificationFormList[i].specificationValueList.splice(j, 1);
combineSpecificationValue();
setSpecificationFormList([...specificationFormList]);
};
//组合数据
const combineSpecificationValue = () => {
let combineSpecificationList: any = [];
let tableDataList: any = [];
//过滤规格值为空的
const filterSpecificationFormList = specificationFormList.filter(
(v) => v.specificationValueList.length,
);
if (filterSpecificationFormList.length > 1) {
const combineList = filterSpecificationFormList.reduce((pre: any, cur, currentIndex) => {
// 首次组合两个数据
if (currentIndex === 0 && filterSpecificationFormList.length > 1) {
combineSpecificationList = combineEvent(
cur.specificationValueList,
filterSpecificationFormList[currentIndex + 1].specificationValueList,
);
//二维数组拆分为对象
combineSpecificationList = getCombineObj(combineSpecificationList);
// 两个数据以上的组合
} else if (
currentIndex < filterSpecificationFormList.length - 1 &&
filterSpecificationFormList[currentIndex + 1].specificationValueList.length
) {
// 上一次的组合作为下一次组合的参数
combineSpecificationList = combineEvent(
combineSpecificationList,
filterSpecificationFormList[currentIndex + 1].specificationValueList,
);
//二维数组拆分为对象
combineSpecificationList = getCombineObj(combineSpecificationList);
}
pre = combineSpecificationList;
return pre;
}, []);
tableDataList = combineList.reduce((pre: any, cur: any) => {
const tabCovertObj = cur.reduce((a: any, b: any, currentIndex: number) => {
a['name' + (currentIndex + 1)] = b.name;
a['specificationName' + (currentIndex + 1)] = b.specificationName;
return a;
}, {});
//判断表格中是否已存在该条(缓存)
const tableItemObj = tableData.find((i) =>
Object.getOwnPropertyNames(tabCovertObj).every((key) => i[key] === tabCovertObj[key]),
);
pre.push({
...tabCovertObj,
id: tableItemObj ? tableItemObj.id : Math.random(), //存在则用之前的id,不存在新建id
fileList: tableItemObj ? tableItemObj.fileList : [],
});
return pre;
}, []);
} else if (filterSpecificationFormList.length === 1) {
//当存在一个规格项时
tableDataList = filterSpecificationFormList[0].specificationValueList.map((v) => {
const obj = Object.create(null);
obj['name1'] = v.name;
obj['specificationName1'] = v.specificationName;
//判断表格中是否已存在该条(缓存)
const tableItemObj = tableData.find((i) =>
Object.getOwnPropertyNames(obj).every((key) => i[key] === obj[key]),
);
obj['id'] = Math.random();
return tableItemObj ? tableItemObj : obj; //存在则用之前的一条,不存在新建一条
});
}
if (tableDataList.length) {
setTableFormDefault(tableDataList);
mergeTableRow(filterSpecificationFormList);
}
setTableData([...tableDataList]);
};
//组合数据拆分为对象
const getCombineObj = (combineSpecificationList: any) => {
return combineSpecificationList.reduce((pre: any, cur: any) => {
pre.push(
cur.reduce((a: any, b: any) => {
if (Array.isArray(b)) {
a.push(...b);
} else {
a.push({ ...b });
}
return a;
}, []),
);
return pre;
}, []);
};
//两数组排列组合(通用)
const combineEvent = (list1: any, list2: any) => {
return list1.reduce((pre: any, cur: any) => pre.concat(list2.map((v: any) => [cur, v])), []);
};
//表头拆分及合并列
const mergeTableRow = (filterSpecificationFormList: specificationFormListType[]) => {
const columns = filterSpecificationFormList.map((v, index) => ({
title: v.optionList[0].value,
dataIndex: 'name' + (index + 1),
align: 'center',
onCell: (_: any, i: number) => {
//合并列
if (index < filterSpecificationFormList.length - 1) {
const count: number = filterSpecificationFormList
.slice(index + 1, filterSpecificationFormList.length)
.reduce((pre: number, cur) => {
return pre * cur.specificationValueList.length;
}, 1);
return {
rowSpan: count !== 1 ? ((i + 1) % count === 1 ? count : 0) : 1,
};
} else {
return {
rowSpan: 1,
};
}
},
}));
defaultColumns[0].children = columns;
setDefaultColumns([...defaultColumns]);
};
//规格值上传图片返回
const uploadSuccess = (
record: skuTableType,
fileList: {
id: number;
name: string;
uid: number;
url: string;
}[],
) => {
const tableIndex: number = tableData.findIndex((v) => v.id === record.id);
if (tableIndex !== -1) {
tableData[tableIndex].fileList = fileList;
const obj = Object.create(null);
obj['skuImage' + record.id] = fileList.length ? fileList[0].url : undefined;
skuValueForm.setFieldsValue(obj);
setTableData([...tableData]);
}
};
//提交验证
const submitSku = () => {
return new Promise((resolve, reject) => {
form
.validateFields()
.then(() => {
const specificationFormItem = specificationFormList.find(
(v) => !v.specificationValueList.length,
);
if (specificationFormItem) {
reject(`请为规格项${specificationFormItem.optionList[0].value}添加规格值`);
} else {
//规格项数据转化
const specAttrList = specificationFormList.map((v) => ({
specName: v.optionList[0].value,
id: goodsDetailsInfo
? goodsDetailsInfo.specAttrList.find((i) => i.id === v.id)?.id
: undefined,
specValuesList: v.specificationValueList.map((j) => ({
specName: j.name,
id: goodsDetailsInfo
? goodsDetailsInfo.specAttrList
.find((i) => i.id === v.id)
?.specValuesList.find((i) => i.id === j.id)?.id
: undefined,
})),
}));
skuValueForm
.validateFields()
.then((value) => {
//规格值数据转化
const priceStock = tableData.reduce((pre: any, cur: any) => {
//规格名,规格值组合类型
const productSpec = specificationFormList.reduce(
(a: { [x: string]: string }, b, currentIndex) => {
a[b.optionList[0].value] = cur['name' + (currentIndex + 1)];
return a;
},
{},
);
pre.push({
...Object.getOwnPropertyNames(value).reduce((a: any, b) => {
if (b.includes(cur.id)) {
a[b.replace(cur.id, '')] = value[b];
}
return a;
}, {}),
productSpec: JSON.stringify(productSpec),
});
return pre;
}, []);
resolve({ priceStock, specAttrList });
})
.catch((err) => {
reject(err);
});
}
})
.catch((err) => {
reject(err);
});
});
};
//排列组合规格值表单默认数据
const setTableFormDefault = (tableDataList: (skuTableType & { [key: string]: string })[]) => {
const tableFormDefault = tableDataList.reduce((pre: any, cur) => {
return {
...pre,
...Object.getOwnPropertyNames(filterObjAttr(cur, ['id'])).reduce((a: any, b) => {
a[b + cur.id] = cur[b];
return a;
}, {}),
};
}, {});
skuValueForm.setFieldsValue(tableFormDefault);
};
useEffect(() => {
if (goodsDetailsInfo) {
//转化数据
const covertSpecAttrList = goodsDetailsInfo.specAttrList.map((v, index) => ({
id: v.id,
name: 'specName' + index,
optionList: [{ label: v.specName, value: v.specName }],
specificationValueList: v.specValuesList.map((i) => ({
id: i.id,
name: i.specName,
specificationName: v.specName,
})),
addSpecificationValueShow: false,
}));
//规格项表单数据默认数据
const specFormDefault = goodsDetailsInfo.specAttrList.reduce(
(pre: any, cur: any, currentIndex) => {
pre['specName' + currentIndex] = cur.specName;
return pre;
},
{},
);
form.setFieldsValue(specFormDefault);
setSpecificationFormList([...covertSpecAttrList]);
mergeTableRow(covertSpecAttrList);
const tableDataList: (skuTableType & { [key: string]: string })[] =
goodsDetailsInfo.priceStock.map((v) => ({
id: v.id,
salePrice: v.salePrice,
skuImage: v.skuImage,
skuNo: v.skuNo,
stock: v.stock,
channelPrice: v.channelPrice,
fileList: v.skuImage
? [{ id: Math.random(), uid: Math.random(), url: v.skuImage, name: '规格图片' }]
: [],
...Object.getOwnPropertyNames(JSON.parse(v.productSpec)).reduce(
(pre: any, cur, currentIndex) => {
pre['name' + (currentIndex + 1)] = JSON.parse(v.productSpec)[cur];
pre['specificationName' + (currentIndex + 1)] = cur;
return pre;
},
{},
),
}));
setTableFormDefault(tableDataList);
setTableData(tableDataList);
}
}, [goodsDetailsInfo]);
return (
<div className='sku-info'>
<div className='sku-info-operate' style={{ margin: ' 20px 0 ' }}>
<Button
type='primary'
icon={<PlusOutlined></PlusOutlined>}
onClick={() => addOrEditSkuClick()}
>
添加规格
</Button>
</div>
<Table
bordered
columns={tableColumns}
dataSource={skuTableData.slice(
(pagination.pageNo - 1) * pagination.pageSize,
pagination.pageNo * pagination.pageSize,
)}
rowKey='id'
pagination={{
total: skuTableData.length,
pageSize: pagination.pageSize,
current: pagination.pageNo,
showSizeChanger: true,
showQuickJumper: true,
onChange: (page: number, pageSize: number) => paginationChange(page, pageSize),
showTotal: (total, range) => `当前 ${range[0]}-${range[1]} 条记录 / 共 ${total} 条数据`,
}}
/>
<Form wrapperCol={{ span: 5 }} labelCol={{ span: 1 }} form={form}>
{specificationFormList.map((v, index) => (
<>
{/* 规格项*/}
<Row key={v.id}>
<Col span={7}>
<Form.Item
label={'规格项' + (index + 1)}
wrapperCol={{ span: 18 }}
labelCol={{ span: 5 }}
name={v.name}
rules={[{ required: true, message: `请输入规格项${index + 1}` }]}
>
<Select
placeholder='请输入规格项,按回车键完成'
dropdownRender={(menu) => (
<>
{v.optionList.length ? menu : ''}
<Input
onPressEnter={(e) => specificationPressEnter(e, index)}
maxLength={30}
/>
</>
)}
options={v.optionList}
/>
</Form.Item>
</Col>
{index ? (
<Col span={2}>
<Button
danger
icon={<DeleteOutlined />}
onClick={() => deleteSpecificationClick(index)}
>
删除
</Button>
</Col>
) : (
''
)}
</Row>
{/*规格值显示*/}
{v.specificationValueList.length ? (
<Row style={{ marginBottom: '10px' }}>
<Col span={2}></Col>
<Col span={4}>
<div>
{v.specificationValueList.map((v, i) => (
<Tag key={v.id} closable onClose={() => specificationValueDelete(index, i)}>
{v.name}
</Tag>
))}
</div>
</Col>
</Row>
) : (
''
)}
{/*规格值操作*/}
{v.optionList.length ? (
<Row>
<Col span={2}></Col>
<Col span={4} style={{ marginBottom: '10px' }}>
{v.addSpecificationValueShow ? (
<Input
placeholder='请输入规格值,按回车键完成'
onPressEnter={(e) => specificationValuePressEnter(e, index)}
maxLength={30}
/>
) : (
<Button
type='link'
danger
icon={<PlusOutlined />}
onClick={() => addSpecificationValueClick(index)}
>
添加规格值
</Button>
)}
</Col>
{v.addSpecificationValueShow ? (
<Col>
<Button
type='primary'
style={{ marginLeft: '10px' }}
onClick={() => specificationValueCancel(index)}
>
取消
</Button>
</Col>
) : (
''
)}
</Row>
) : (
''
)}
</>
))}
<Row>
<Col span={2}></Col>
<Col>
<Button type='primary' icon={<PlusOutlined />} onClick={addSpecificationClick}>
添加规格
</Button>
</Col>
</Row>
</Form>
{tableData.length ? (
<Form form={skuValueForm}>
<Table
style={{ marginTop: '10px' }}
rowKey='id'
columns={covertColumns() as ColumnTypes}
components={{
body: {
cell: EditableCell,
},
}}
bordered
dataSource={tableData}
pagination={false}
size='small'
/>
</Form>
) : (
''
)}
</div>
);
};
});
export default SkuInfo;
import BaseInfo from '~/components/goods/commonAddOrEdit/baseInfo';
import StockSku from '~/components/goods/commonAddOrEdit/stockSku';
import OtherInfo from '~/components/goods/commonAddOrEdit/otherInfo';
import GoodsIntroduce from '~/components/goods/commonAddOrEdit/goodsIntroduce';
import AddOrEditSkuModal from '~/components/goods/commonAddOrEdit/addOrEditSkuModal';
import { Button, message } from 'antd';
import { useNavigate, useSearchParams } from 'react-router-dom';
import './index.scss';
import { useEffect, useRef, useState } from 'react';
import { CategoryManageAPI } from '~/api';
import { InterDataType } from '~/api/interface';
import { categoryListType } from '~/api/interface/categoryManage';
import {
customizeEntity,
detailGoodsType,
skuUnitType,
specEntity,
} from '~/api/interface/goodsType';
import goodsAPI from '~/api/modules/goodsAPI';
import { filterObjAttr } from '~/utils';
import GoodsAPI from '~/api/modules/goodsAPI';
import { UploadFile } from 'antd/es/upload/interface';
//分类返回类型
type categoryType = InterDataType<categoryListType>['list'];
//产品-规格单位返回类型
type unitType = InterDataType<skuUnitType>;
//商品返回类型
type goodsDetailType = InterDataType<detailGoodsType>;
const GoodsAddOrEditOrDetail = () => {
const [searchParams] = useSearchParams();
//基本信息ref
const baseInfoRef = useRef<any>();
const navigate = useNavigate();
//当前目录
const [currentDesc, setCurrentDesc] = useState<number>(-1);
//分类
const [categoryList, setCategoryList] = useState<categoryType>([]);
//添加、编辑库存规格弹窗
const [addOrEditSkuModalShow, setAddOrEditSkuModalShow] = useState(false);
//库存规格数据
const [specData, setSpecData] = useState<specEntity[]>([]);
const [goodsSpecCopy, setGoodsSpecCopy] = useState<specEntity[]>([]);
//产品规格-单位
const [skuUnitList, setSkuUnitList] = useState<unitType>([]);
//其它服务
const [otherService, setOtherService] = useState<number[]>([]);
// 当前操作行数据
const [curtRowData, setCurtRowData] = useState<Partial<specEntity>>({});
//商品详情
const [goodsDetail, setGoodsDetail] = useState<goodsDetailType>();
//产品介绍
const [productIntroduce, setProductIntroduce] = useState<string>('');
//是否商品详情
const [isDetail, setIsDetail] = useState<boolean>(false);
//添加、编辑规格
const addOrEditSkuShowEvent = (record?: specEntity) => {
const baseInfoForm = baseInfoRef.current.baseInform;
setCurrentDesc(baseInfoForm.getFieldValue('directoryId') || -1);
if (!baseInfoForm.getFieldValue('directoryId')) {
return message.warning('请先选择目录');
}
if (record) {
setCurtRowData({ ...record });
}
setAddOrEditSkuModalShow(true);
};
//删除规格
const deleteSkuEvent = (record: specEntity) => {
const index = specData.findIndex((v) => v.id === record.id);
specData.splice(index, 1);
setSpecData([...specData]);
};
const addOrEditSkuModalCancel = () => {
setAddOrEditSkuModalShow(false);
setCurtRowData({});
};
const addOrEditSkuModalOk = (data: specEntity) => {
if (Object.keys(curtRowData).length != 0) {
const index: number = specData.findIndex((i) => i.id === data.id);
specData.splice(index, 1, data);
setSpecData([...specData]);
} else {
setSpecData([...specData, data]);
}
addOrEditSkuModalCancel();
};
//根据目录获取分类列表
const getCategoryList = (directoryId: number) => {
CategoryManageAPI.getCategoryList({ directoryId, type: 4, pageSize: 9999, pageNo: 1 }).then(
({ result }) => {
setCategoryList(result.list || []);
},
);
};
//产品-单位
const getSkuUnit = () => {
goodsAPI.getSkuUnit().then(({ result }) => {
setSkuUnitList(result || []);
});
};
//其它服务选择
const otherServiceSelect = (ids: number[]) => {
setOtherService(ids);
};
//获取产品详情
const getRichText = (html?: string) => {
setProductIntroduce(html || '');
};
//商品详情
const getGoodsDetail = (goodsInfoId: number) => {
GoodsAPI.getGoodsDetail({ goodsInfoId, type: 0 }).then(({ result }) => {
setGoodsDetail(result);
getCategoryList(result.directoryId);
const specList: specEntity[] = result.goodsSpec.reduce((pre: any, cur: specEntity) => {
// 自定义
if (cur.flag === 1) {
const cusList: customizeEntity[] =
cur.productSpecList &&
cur.productSpecList.reduce((preProd: any, curProd: customizeEntity, index: number) => {
const obj: UploadFile = {
uid: `img${index}`,
status: 'done',
url: curProd.specImage,
name: 'image',
};
preProd.push({ ...curProd, fileList: [obj] });
return preProd;
}, []);
cur.customizeInfo = cusList;
} else {
const specId: number[] =
result.directoryId === 2
? cur.industrySpecList &&
cur.industrySpecList.map((curIndu: any) => {
return {
mallSpecId: curIndu.industrySpecId,
specName: curIndu.specName,
partNo: curIndu.partNo,
id: curIndu.id,
};
})
: cur.productSpecList &&
cur.productSpecList.map((item: any) => {
return {
mallSpecId: item.productSpec,
specName: item.specName,
partNo: item.partNo,
id: item.id,
};
});
cur.specIds = specId;
}
pre.push({ ...cur, productName: cur.skuName });
return pre;
}, []);
setGoodsSpecCopy(result.goodsSpec);
setOtherService(result.otherService.map((v) => v.saleServiceId));
setSpecData(specList);
});
};
//保存
const saveSubmit = () => {
const baseInfoForm = baseInfoRef.current.baseInform;
baseInfoForm.validateFields().then((values: any) => {
if (specData.length === 0) {
return message.warning('清添加库存规格');
}
//主图
values.images = [
{
imgType: 0,
imgUrl: values.mainImg[0].url,
id: goodsDetail
? goodsDetail.images.some((i) => i.id === values.mainImg[0].id)
? values.mainImg[0].id
: undefined
: undefined,
},
];
//副图
if (values.subImg) {
values.images.push(
...values.subImg.map((v: any) => ({
imgType: 1,
imgUrl: v.url,
id: goodsDetail
? goodsDetail.images.some((i) => i.id === v.id)
? v.id
: undefined
: undefined,
})),
);
}
//分类
values.categoryByOne = values.masterTypeId[0];
values.categoryByTwo = values.masterTypeId[1] || undefined;
// 过滤对象属性
const goodsSpecVO: specEntity[] = specData.reduce((pre: any, cur: specEntity) => {
cur.customizeInfo = cur.customizeInfo?.reduce((cusPre: any, cusCur: customizeEntity) => {
const bol: boolean = goodsSpecCopy.some((i: specEntity) => {
return i.customizeInfo?.some((i: customizeEntity) => i.id === cusCur.id);
});
cusPre = [
...cusPre,
bol ? filterObjAttr(cusCur, ['fileList']) : filterObjAttr(cusCur, ['id', 'fileList']),
];
return cusPre;
}, []);
// 存在对象属性改变!
cur.specIds = cur.specIds?.reduce((preSpec: any, curSpec: any) => {
preSpec = [...preSpec, filterObjAttr(curSpec, ['specName', 'partNo'])];
return preSpec;
}, []);
// 是否新增
const isAdd: boolean = goodsSpecCopy.every((i: specEntity) => i.id != cur.id);
// 是否修改了某一条
const isEdit: boolean = goodsSpecCopy.every(
(i: specEntity) => i.categoryId != cur.categoryId,
);
pre = [
...pre,
!isAdd
? isEdit
? filterObjAttr(cur, ['industrySpecList', 'productSpecList', 'skuName', 'id'])
: filterObjAttr(cur, ['industrySpecList', 'productSpecList', 'skuName'])
: filterObjAttr(cur, ['id', 'skuName']),
];
return pre;
}, []);
goodsAPI[goodsDetail ? 'editGoods' : 'addGoods']({
...filterObjAttr(values, ['mainImg', 'subImg', 'video', 'masterTypeId', 'id', 'goodsDesc']),
productSpec: goodsSpecVO,
goodsType: 0,
goodsDetailVO: { goodsDesc: values.goodsDesc, productDesc: productIntroduce },
otherService: otherService,
id: goodsDetail ? goodsDetail.id : undefined,
}).then(({ code }) => {
if (code === '200') {
message.success(goodsDetail ? '编辑成功' : '新增成功');
navigate(-1);
}
});
});
};
//返回
const backRoute = () => {
navigate(-1);
};
useEffect(() => {
if (searchParams.get('id')) {
getGoodsDetail(Number(searchParams.get('id')));
}
setIsDetail(!!searchParams.get('isDetail'));
getSkuUnit();
}, []);
return (
<div className='goods-info'>
{/* 基本信息*/}
<BaseInfo
ref={baseInfoRef}
categoryList={categoryList}
getCategoryList={getCategoryList}
goodsDetail={goodsDetail}
isDetail={isDetail}
goodsType={0}
/>
{/* 库存规格*/}
<StockSku
addOrEditSku={addOrEditSkuShowEvent}
specData={specData}
skuUnitList={skuUnitList}
deleteSku={deleteSkuEvent}
isDetail={isDetail}
/>
{/*其它信息*/}
<OtherInfo
otherServiceSelect={otherServiceSelect}
goodsDetail={goodsDetail}
isDetail={isDetail}
/>
{/*产品介绍图*/}
<GoodsIntroduce getRichText={getRichText} goodsDetail={goodsDetail} isDetail={isDetail} />
{/*库存规格,添加、编辑弹窗*/}
<AddOrEditSkuModal
currentDesc={currentDesc}
open={addOrEditSkuModalShow}
handleCancel={addOrEditSkuModalCancel}
handleOk={addOrEditSkuModalOk}
skuUnitList={skuUnitList}
curtRowData={curtRowData}
goodsType={0}
/>
<div className='goods-info-operate'>
{!isDetail && (
<Button type='primary' onClick={saveSubmit}>
保存
</Button>
)}
<Button onClick={backRoute}>返回</Button>
</div>
</div>
);
};
export default GoodsAddOrEditOrDetail;
......@@ -3,19 +3,13 @@ import { useEffect, useRef, useState } from 'react';
import BaseInfo from './components/baseInfo';
import SkuInfo from './components/skuInfo';
import IntroduceInfo from './components/introduceInfo';
import SkuAddOrEditModal from './components/skuAddOrEditModal';
import './index.scss';
import { useNavigate, useSearchParams } from 'react-router-dom';
import { baseInfoType } from './components/baseInfo';
import { InterDataType, InterReqType } from '~/api/interface';
import { addMallGoodsType, mallGoodsDetailsType, skuUnitType } from '~/api/interface/goodsType';
import { InterDataType } from '~/api/interface';
import { mallGoodsDetailsType } from '~/api/interface/goodsType';
import GoodsAPI from '~/api/modules/goodsAPI';
import { filterObjAttr } from '~/utils';
//商品sku规格类型
type goodsSpecType = Exclude<InterReqType<addMallGoodsType>, undefined>['goodsSpecList'][0];
//单位返回类型
type unitType = InterDataType<skuUnitType>;
//商品详情-返回类型
type goodsDetailType = InterDataType<mallGoodsDetailsType>;
......@@ -23,16 +17,9 @@ const GoodsAddOrEditOrDetail = () => {
const baseInfoRef = useRef<any>();
const navigate = useNavigate();
const [searchParams] = useSearchParams();
const skuInfoRef = useRef<any>();
//单位列表
const [skuUnitList, setSkuUnitList] = useState<unitType>([]);
const [tabSelectKeys, setTabSelectKeys] = useState<string>('1');
//新增、编辑sku弹窗
const [addOrEditSkuModalShow, setAddOrEditSkuModalShow] = useState<boolean>(false);
//当前编辑sku
const [currentSku, setCurrentSku] = useState<goodsSpecType>();
//skuTable数据
const [skuTable, setSkuTable] = useState<goodsSpecType[]>([]);
//商品介绍详情
const [goodsDetails, setGoodsDetails] = useState<string>('');
//商品id
......@@ -40,30 +27,6 @@ const GoodsAddOrEditOrDetail = () => {
//商品详情
const [goodsDetailsInfo, setGoodsDetailsInfo] = useState<goodsDetailType>();
//新增、编辑sku弹窗显示
const addOrEditSkuClick = (record?: goodsSpecType) => {
setCurrentSku(record ? { ...record } : undefined);
setAddOrEditSkuModalShow(true);
};
const addOrEditSkuModalCancel = () => {
setAddOrEditSkuModalShow(false);
};
const addOrEditSkuModalOk = (values: goodsSpecType) => {
setAddOrEditSkuModalShow(false);
const skuTableIndex: number = skuTable.findIndex((v) => v.id === values.id);
if (skuTableIndex !== -1) {
skuTable.splice(skuTableIndex, 1, values);
setSkuTable([...skuTable]);
} else {
setSkuTable([...skuTable, { ...values }]);
}
};
//sku删除
const deleteSkuClick = (record: goodsSpecType) => {
const skuIndex: number = skuTable.findIndex((v) => v.id === record.id);
skuTable.splice(skuIndex, 1);
setSkuTable([...skuTable]);
};
//商品详情获取
const getIntroduceInfo = (richText: string) => {
setGoodsDetails(richText);
......@@ -78,15 +41,7 @@ const GoodsAddOrEditOrDetail = () => {
{
key: '2',
label: `商品规格`,
children: (
<SkuInfo
addOrEditSkuClick={addOrEditSkuClick}
skuTableData={skuTable}
skuUnitList={skuUnitList}
deleteSkuClick={deleteSkuClick}
editSkuClick={addOrEditSkuClick}
/>
),
children: <SkuInfo ref={skuInfoRef} goodsDetailsInfo={goodsDetailsInfo} />,
},
{
key: '3',
......@@ -114,11 +69,14 @@ const GoodsAddOrEditOrDetail = () => {
});
break;
case '2':
if (skuTable.length) {
setTabSelectKeys((Number(tabSelectKeys) + 1).toString());
} else {
message.warning('请添加规格');
}
skuInfoRef.current
.submitSku()
.then(() => {
setTabSelectKeys((Number(tabSelectKeys) + 1).toString());
})
.catch((error: any) => {
message.warning(error?.errorFields?.[0].errors[0] || error);
});
break;
case '3':
break;
......@@ -133,62 +91,45 @@ const GoodsAddOrEditOrDetail = () => {
const backRoute = () => {
navigate(-1);
};
//单位列表
const getSkuUnit = () => {
GoodsAPI.getSkuUnit().then(({ result }) => {
setSkuUnitList(result || []);
});
};
//商品保存
const saveGoods = () => {
baseInfoRef.current
.getForm()
.validateFields()
.then((values: baseInfoType) => {
if (skuTable.length) {
const skuList = skuTable.map((v) => ({
...v,
id: goodsDetailsInfo
? goodsDetailsInfo.goodsSpecList.find((i) => i.id === v.id)?.id
: undefined,
goodsSpecValuesList: v.goodsSpecValuesList.map((i) => ({
...i,
id: goodsDetailsInfo
? goodsDetailsInfo.goodsSpecList
.find((j) => j.id === v.id)
?.goodsSpecValuesList.find((k) => k.id === i.id)?.id
: undefined,
goodsSpecId: goodsDetailsInfo
? goodsDetailsInfo.goodsSpecList.find((i) => i.id === v.id)?.id
: undefined,
})),
}));
const addGoodsEditReq = {
...filterObjAttr(values, ['mainImgList', 'subImgList', 'videoList', 'categoryId']),
resourcesList: [
...values.mainImgList.map((v) => ({ type: 0, url: v.url })),
...(values.subImgList?.map((v) => ({ type: 1, url: v.url })) || []),
...(values.videoList?.map((v) => ({ type: 2, url: v.url })) || []),
],
categoryPrimaryId: values.categoryId[0],
categorySubId: values.categoryId.length === 2 ? values.categoryId[1] : undefined,
goodsDetails,
goodsSpecList: skuList,
id: goodsId || undefined,
};
GoodsAPI[goodsId ? 'editMallGoods' : 'addMallGoods'](addGoodsEditReq).then(({ code }) => {
if (code === '200') {
message.success(goodsId ? '编辑商城成功' : '新增商品成功');
navigate(-1);
}
});
} else {
message.warning('商品规格未添加');
}
Promise.all([
baseInfoRef.current.getForm().validateFields(),
skuInfoRef.current ? skuInfoRef.current.submitSku() : getDefaultSku(),
])
.then((values: any) => {
const addGoodsEditReq = {
...filterObjAttr(values[0], ['mainImgList', 'subImgList', 'videoList', 'categoryId']),
resourcesList: [
...values[0].mainImgList.map((v: any) => ({ type: 0, url: v.url })),
...(values[0].subImgList?.map((v: any) => ({ type: 1, url: v.url })) || []),
...(values[0].videoList?.map((v: any) => ({ type: 2, url: v.url })) || []),
],
categoryPrimaryId: values[0].categoryId[0],
categorySubId: values[0].categoryId.length === 2 ? values[0].categoryId[1] : undefined,
goodsDetails,
...values[1],
id: goodsId || undefined,
};
GoodsAPI[goodsId ? 'editMallGoods' : 'addMallGoods'](addGoodsEditReq).then(({ code }) => {
if (code === '200') {
message.success(goodsId ? '编辑商品成功' : '新增商品成功');
navigate(-1);
}
});
})
.catch((error: any) => {
message.error(error.errorFields[0].errors[0]);
baseInfoRef.current
.getForm()
.validateFields()
.then(() => {
setTabSelectKeys('2');
})
.catch(() => {
setTabSelectKeys('1');
});
message.error(error?.errorFields?.[0].errors[0] || error);
});
};
//商品详情
......@@ -204,7 +145,6 @@ const GoodsAddOrEditOrDetail = () => {
.filter((v) => v.type === 2)
.map((v) => ({ id: v.id, name: 'video', uid: v.id, url: v.url }));
setGoodsDetailsInfo(JSON.parse(JSON.stringify(result)));
setSkuTable(result.goodsSpecList);
setGoodsDetails(result.goodsDetails || '');
baseInfoRef.current.getForm().setFieldsValue({
tradeName: result.tradeName,
......@@ -225,9 +165,21 @@ const GoodsAddOrEditOrDetail = () => {
baseInfoRef.current.mediaData.setVideoFileList(videoList);
});
};
//编辑未点击规格时数据处理
const getDefaultSku = () => {
return new Promise((resolve, reject) => {
if (goodsDetailsInfo) {
resolve({
priceStock: goodsDetailsInfo.priceStock,
specAttrList: goodsDetailsInfo.specAttrList,
});
} else {
reject('请上传商品规格');
}
});
};
useEffect(() => {
getSkuUnit();
if (searchParams.get('id')) {
setGoodsId(Number(searchParams.get('id')));
getMallGoodsDetails(Number(searchParams.get('id')));
......@@ -255,14 +207,6 @@ const GoodsAddOrEditOrDetail = () => {
返回
</Button>
</div>
{/*新增、编辑sku弹窗*/}
<SkuAddOrEditModal
open={addOrEditSkuModalShow}
onCancel={addOrEditSkuModalCancel}
onHandleOk={addOrEditSkuModalOk}
skuUnitList={skuUnitList}
currentSku={currentSku}
/>
</div>
);
};
......
import { useSearchParams, useNavigate } from 'react-router-dom';
import { useEffect, useState } from 'react';
import GoodsAPI from '~/api/modules/goodsAPI';
import { InterDataType } from '~/api/interface';
import { mallGoodsDetailsType, skuUnitType } from '~/api/interface/goodsType';
import { Badge, Button, Descriptions, Image, Table, Tag } from 'antd';
import { InterDataType, InterReqType } from '~/api/interface';
import { addMallGoodsType, mallGoodsDetailsType } from '~/api/interface/goodsType';
import { Badge, Button, Descriptions, Image, Table } from 'antd';
import { CategoryManageAPI } from '~/api';
import { categoryListRespType } from '~/api/interface/categoryManage';
import './index.scss';
import { ColumnsType } from 'antd/es/table';
//详情返回类型
type detailType = InterDataType<mallGoodsDetailsType>;
//分类返回类型
type categoryType = InterDataType<categoryListRespType>['list'];
//单位返回类型
type unitType = InterDataType<skuUnitType>;
//规格表格类型
type skuTableType = Exclude<InterReqType<addMallGoodsType>, undefined>['priceStock'][0] & {
fileList: {
id: number;
name: string;
uid: number;
url: string;
}[];
};
//规格表单数据类型
type specificationFormListType = {
optionList: { label: string; value: string }[];
id: number;
name: string;
addSpecificationValueShow: boolean;
specificationValueList: { name: string; id: number; specificationName: string }[];
};
const GoodsDetails = () => {
const [searchParams] = useSearchParams();
const navigate = useNavigate();
//分类列表
const [categoryList, setCategoryList] = useState<categoryType>([]);
//单位列表
const [skuUnitList, setSkuUnitList] = useState<unitType>([]);
//表格数据
const [tableData, setTableData] = useState<(skuTableType & { [key: string]: string })[]>([]);
const [goodsInfoDetails, setGoodsInfoDetails] = useState<detailType>();
const tableColumns: ColumnsType<detailType['goodsSpecList'][0]> = [
const [tableColumns, setTableColumns] = useState<any>([
{
title: '序号',
title: '商品规格',
align: 'center',
render: (_text: string, _record, index: number) => index + 1,
dataIndex: 'specName',
children: [],
},
{
title: '规格名称',
title: '图片',
align: 'center',
dataIndex: 'specName',
dataIndex: 'skuImage',
render: (text: string) => <Image src={text} width={50} height={50} alt='暂无图片' />,
},
{
title: '选择方式',
title: 'sku编号',
align: 'center',
dataIndex: 'chooseType',
render: (text: number) => (text ? '多选' : '单选'),
dataIndex: 'skuNo',
},
{
title: '是否必选',
title: '销售价',
align: 'center',
dataIndex: 'must',
render: (text: number) => (text ? '必选' : '非必选'),
dataIndex: 'salePrice',
},
{
title: '规格单位',
title: '渠道价',
align: 'center',
dataIndex: 'skuUnitId',
render: (text: number) => skuUnitList.find((v) => v.id === text)?.unitName || '',
dataIndex: 'channelPrice',
},
{
title: '规格值',
title: '库存',
align: 'center',
dataIndex: 'goodsSpecValuesList',
render: (text: detailType['goodsSpecList'][0]['goodsSpecValuesList']) =>
text.map((v) => (
<Tag key={v.id}>
{v.specValueName}
{v.partNo ? `(${v.partNo})` : ''}
</Tag>
)),
dataIndex: 'stock',
},
];
]);
const getGoodsDetails = (id: number) => {
GoodsAPI.getMallGoodsDetails({ id }).then(({ result }) => {
setGoodsInfoDetails(result);
//转化数据
const covertSpecAttrList = result.specAttrList.map((v, index) => ({
id: v.id,
name: 'specName' + index,
optionList: [{ label: v.specName, value: v.specName }],
specificationValueList: v.specValuesList.map((i) => ({
id: i.id,
name: i.specName,
specificationName: v.specName,
})),
addSpecificationValueShow: false,
}));
mergeTableRow(covertSpecAttrList);
const tableDataList: (skuTableType & { [key: string]: string })[] = result.priceStock.map(
(v) => ({
id: v.id,
salePrice: v.salePrice,
skuImage: v.skuImage,
skuNo: v.skuNo,
stock: v.stock,
channelPrice: v.channelPrice,
fileList: v.skuImage
? [{ id: Math.random(), uid: Math.random(), url: v.skuImage, name: '规格图片' }]
: [],
...Object.getOwnPropertyNames(JSON.parse(v.productSpec)).reduce(
(pre: any, cur, currentIndex) => {
pre['name' + (currentIndex + 1)] = JSON.parse(v.productSpec)[cur];
pre['specificationName' + (currentIndex + 1)] = cur;
return pre;
},
{},
),
}),
);
setTableData(tableDataList);
});
};
//表头拆分及合并列
const mergeTableRow = (filterSpecificationFormList: specificationFormListType[]) => {
const columns = filterSpecificationFormList.map((v, index) => ({
title: v.optionList[0].value,
dataIndex: 'name' + (index + 1),
align: 'center',
onCell: (_: any, i: number) => {
//合并列
if (index < filterSpecificationFormList.length - 1) {
const count: number = filterSpecificationFormList
.slice(index + 1, filterSpecificationFormList.length)
.reduce((pre: number, cur) => {
return pre * cur.specificationValueList.length;
}, 1);
return {
rowSpan: count !== 1 ? ((i + 1) % count === 1 ? count : 0) : 1,
};
} else {
return {
rowSpan: 1,
};
}
},
}));
tableColumns[0].children = columns;
setTableColumns([...tableColumns]);
};
//分类列表
const getCategoryList = () => {
CategoryManageAPI.getCategoryRespList({ pageNo: 1, pageSize: 99999 }).then(({ result }) => {
setCategoryList(result.list || []);
});
};
//单位列表
const getSkuUnit = () => {
GoodsAPI.getSkuUnit().then(({ result }) => {
setSkuUnitList(result || []);
});
};
//返回
const backRoute = () => {
navigate(-1);
......@@ -91,7 +154,6 @@ const GoodsDetails = () => {
useEffect(() => {
getGoodsDetails(Number(searchParams.get('id')));
getCategoryList();
getSkuUnit();
}, []);
return (
<div className='goods-detail'>
......@@ -157,7 +219,7 @@ const GoodsDetails = () => {
<Table
bordered
columns={tableColumns}
dataSource={goodsInfoDetails?.goodsSpecList}
dataSource={tableData}
rowKey='id'
pagination={false}
></Table>
......
import React, { useEffect, useState } from 'react';
import { useEffect, useState } from 'react';
import { Button, message, Table } from 'antd';
import qs from 'query-string';
import { PlusOutlined } from '@ant-design/icons';
import { ColumnsType } from 'antd/es/table';
import { useNavigate } from 'react-router-dom';
import { useLocation, useNavigate } from 'react-router-dom';
import SearchView from '~/components/search-box';
import { UserScoreDetailsListType } from '~/api/interface/pointManageType';
import { DetailPointListType } from '~/api/interface/pointManageType';
import { PointManageAPI } from '~/api';
import { DetailModal } from '../comp/detailModal';
import { DistributionModal } from '~/pages/pointManage/pointList/comp/distributionModal';
import { ApproveModal } from '~/pages/pointManage/pointList/comp/approveModal';
import useOperate from '~/common/hook/optionHook';
import { useSearchParams } from 'react-router-dom';
// import { DetailModal } from '../comp/detailModal';
// import { DistributionModal } from '~/pages/pointManage/pointList/comp/distributionModal';
// import { ApproveModal } from '~/pages/pointManage/pointList/comp/approveModal';
// import useOperate from '~/common/hook/optionHook';
import { InterListType } from '~/api/interface';
// 列表的类型
type TableType = (ReturnType<UserScoreDetailsListType> extends Promise<infer T>
? T
: never)['result']['list']['userScoreList'];
// 后台返回的类型,但不是列表
type ListType = (ReturnType<UserScoreDetailsListType> extends Promise<infer T>
? T
: never)['result']['list'];
type TableType = InterListType<DetailPointListType>;
// 状态类型
const statusList = [
{ value: 0, label: '提现中' },
{ value: 1, label: '提现成功' },
{ value: 2, label: '提现失败' },
];
export function PointDetail(props: any) {
const [searchParams] = useSearchParams();
// const statusList = [
// { value: 0, label: '提现中' },
// { value: 1, label: '提现成功' },
// { value: 2, label: '提现失败' },
// ];
export function PointDetail() {
// 路由钩子
const location = useLocation();
// 返回上一页
const handleBack = () => {
navigate(-1);
};
// 参数解析
const option = qs.parse(props.location.search);
const option = qs.parse(location.search);
// 路由操作
const navigate = useNavigate();
// 金额数据
const [pointData, setPointData] = useState<ListType>();
// const [pointData, setPointData] = useState<ListType>();
// 表格数据
const [tableData, setTableData] = useState<TableType>([]);
// 表格分页配置
......@@ -45,25 +43,25 @@ export function PointDetail(props: any) {
totalPage: 0,
});
// 查看参数
const [recordData, setRecordData] = useState<TableType[0]>();
// const [recordData, setRecordData] = useState<TableType[0]>();
// 显示查看弹窗
const [detailVisible, setDetailVisible] = useState(false);
// const [detailVisible, setDetailVisible] = useState(false);
// 积分发放弹窗
const [distributionVisible, setDistributionVisible] = useState(false);
// const [distributionVisible, setDistributionVisible] = useState(false);
// 审批弹窗
const [approveVisible, setApproveVisible] = useState(false);
// const [approveVisible, setApproveVisible] = useState(false);
// 按钮权限
const isDistributePointBtnShow = useOperate(25101);
// const isDistributePointBtnShow = useOperate(25101);
// +++++++++++++++++++++++++++++++++++++++++++++++++++ //
// 新版通用部分(ES6+ for React) ZhangLK 2022/08/30 Start
// 加载列表
const getTableList = async (value = {}) => {
// 只需要修改这个地方的接口即可
const res = await PointManageAPI.UserScoreDetailsList({
const res = await PointManageAPI.DetailPointList({
pageNo: pagination.current,
pageSize: pagination.pageSize,
...value,
mallUserId: Number(option.id),
userAccountId: Number(option.id),
});
if (res && res.code === '200') {
const { list, pageNo, totalCount, pageSize, totalPage } = res.result; // 解构
......@@ -73,8 +71,8 @@ export function PointDetail(props: any) {
pageSize,
totalPage,
});
setTableData(list.userScoreList);
setPointData(res?.result?.list);
setTableData(list || []);
// setPointData(res?.result?.list);
} else {
message.warning(res.message);
}
......@@ -88,147 +86,140 @@ export function PointDetail(props: any) {
const columns: ColumnsType<TableType[0]> = [
{
title: '积分数值',
dataIndex: 'scoreNum',
align: 'center',
render: (text) => (text > 0 ? `+${text}` : text),
},
{ title: '流通方式', dataIndex: 'type', align: 'center' },
{ title: '兑换比例', dataIndex: 'convertRatio', align: 'center' },
{ title: '领取时间', dataIndex: 'getTime', align: 'center' },
{
title: '使用时间',
dataIndex: 'useTime',
align: 'center',
render: (_text, record) => {
if (record?.type === '积分提现' && record?.status === 0) {
return '';
}
if (record?.type === '积分提现' && record?.status === 2) {
return '';
}
if (record?.type === '积分提现' && record?.status === 1) {
return record?.approvalTime;
}
return record?.useTime;
},
},
{
title: '订单编号',
dataIndex: 'orderNo',
align: 'center',
render: (text, record) =>
!!text && (
<Button
type='link'
onClick={() => {
// 跳转到订单列表
navigate({
pathname: '/orderManage/list/detail',
search: qs.stringify({ id: record.orderId, activeTabKey: 1 }),
});
}}
>
{text}
</Button>
),
},
{
title: '状态',
dataIndex: 'status',
dataIndex: 'point',
align: 'center',
render: (text) => statusList.find((i) => i.value === text)?.label || text,
render: (text) => (text < 0 ? `-${text}` : `+${text}`),
},
{ title: '流通方式', dataIndex: 'pointSource', align: 'center' },
// { title: '兑换比例', dataIndex: 'convertRatio', align: 'center' },
{
title: '操作',
title: '领取时间',
dataIndex: 'timeOfRelease',
align: 'center',
fixed: 'right',
width: 180,
render: (_text, record) => {
return (
<>
{record.status === 0 && (
<Button
type='link'
onClick={() => {
setRecordData(JSON.parse(JSON.stringify(record)));
setApproveVisible(true);
}}
>
审批
</Button>
)}
<Button
type='link'
onClick={() => {
setRecordData(JSON.parse(JSON.stringify(record)));
setDetailVisible(true);
}}
>
查看
</Button>
</>
);
},
render: (text, record) => text || record.updateTime || record.createTime,
},
// { title: '使用时间', dataIndex: 'updateTime', align: 'center' },
// {
// title: '订单编号',
// dataIndex: 'orderNo',
// align: 'center',
// render: (text, record) =>
// !!text && (
// <Button
// type='link'
// onClick={() => {
// // 跳转到订单列表
// navigate({
// pathname: '/orderManage/list/detail',
// search: qs.stringify({ id: record.orderId, activeTabKey: 1 }),
// });
// }}
// >
// {text}
// </Button>
// ),
// },
// {
// title: '状态',
// dataIndex: 'status',
// align: 'center',
// render: (text) => statusList.find((i) => i.value === text)?.label || text,
// },
// {
// title: '操作',
// align: 'center',
// fixed: 'right',
// width: 180,
// render: (_text, record) => {
// return (
// <>
// {/*{record.status === 0 && (*/}
// {/* <Button*/}
// {/* type='link'*/}
// {/* onClick={() => {*/}
// {/* setRecordData(JSON.parse(JSON.stringify(record)));*/}
// {/* setApproveVisible(true);*/}
// {/* }}*/}
// {/* >*/}
// {/* 审批*/}
// {/* </Button>*/}
// {/*)}*/}
// <Button
// type='link'
// onClick={() => {
// setRecordData(JSON.parse(JSON.stringify(record)));
// setDetailVisible(true);
// }}
// >
// 查看
// </Button>
// </>
// );
// },
// },
];
// 一键关闭全部弹窗
const handleCloseAll = () => {
setDetailVisible(false);
setDistributionVisible(false);
setApproveVisible(false);
setRecordData(undefined);
getTableList().then();
};
// const handleCloseAll = () => {
// setDetailVisible(false);
// setDistributionVisible(false);
// setApproveVisible(false);
// setRecordData(undefined);
// getTableList().then();
// };
// 组件加载
useEffect(() => {
console.log('获取参数 --->', searchParams.get('id'));
(async () => {
await getTableList();
})();
// console.log('获取参数 --->', location);
console.log('获取参数 --->', qs.parse(location.search));
getTableList().then();
}, []);
return (
<>
<SearchView
preFixBtn={
<div>
{pointData?.uid}&nbsp;{pointData?.userName}({pointData?.nickName})
</div>
}
sufFixBtn={
<div className='point-list-head-number'>
<div className='head-number'>
<span className='number-label'>积分总额</span>
<Button type='link'>{pointData?.scoreTotal}</Button>
</div>
<div className='head-number'>
<span className='number-label'>已使用积分</span>
<Button type='link'>{pointData?.useScore}</Button>
</div>
<div className='head-number'>
<span className='number-label'>已兑换积分</span>
<Button type='link'>{pointData?.convertScore}</Button>
</div>
<div className='head-number'>
<Button
type='primary'
icon={<PlusOutlined />}
onClick={() => {
setDistributionVisible(true);
}}
disabled={!isDistributePointBtnShow}
>
积分发放
</Button>
<div style={{ display: 'flex', justifyContent: 'space-between', width: '100%' }}>
<div>
UID{option?.id}&nbsp;&nbsp;{option?.nickName}
</div>
<Button type={'primary'} onClick={handleBack}>
返回
</Button>
</div>
}
// sufFixBtn={
// <div className='point-list-head-number'>
// <div className='head-number'>
// <span className='number-label'>积分总额</span>
// <Button type='link'>{pointData?.scoreTotal}</Button>
// </div>
// <div className='head-number'>
// <span className='number-label'>已使用积分</span>
// <Button type='link'>{pointData?.useScore}</Button>
// </div>
// <div className='head-number'>
// <span className='number-label'>已兑换积分</span>
// <Button type='link'>{pointData?.convertScore}</Button>
// </div>
// <div className='head-number'>
// <Button
// type='primary'
// icon={<PlusOutlined />}
// onClick={() => {
// setDistributionVisible(true);
// }}
// disabled={!isDistributePointBtnShow}
// >
// 积分发放
// </Button>
// </div>
// </div>
// }
/>
<Table
size='small'
dataSource={tableData}
columns={columns}
rowKey='id'
scroll={{ x: 1500 }}
// scroll={{ x: 1500 }}
bordered
pagination={{
total: pagination.total,
......@@ -240,24 +231,24 @@ export function PointDetail(props: any) {
showTotal: (total, range) => `当前 ${range[0]}-${range[1]} 条记录 / 共 ${total} 条数据`,
}}
/>
<DetailModal
open={detailVisible}
data={recordData}
title='查看详情'
closed={handleCloseAll}
/>
<DistributionModal
open={distributionVisible}
data={pointData}
title='发放积分'
closed={handleCloseAll}
/>
<ApproveModal
open={approveVisible}
data={recordData}
title='提现审批'
closed={handleCloseAll}
/>
{/*<DetailModal*/}
{/* open={detailVisible}*/}
{/* data={recordData}*/}
{/* title='查看详情'*/}
{/* closed={handleCloseAll}*/}
{/*/>*/}
{/*<DistributionModal*/}
{/* open={distributionVisible}*/}
{/* data={pointData}*/}
{/* title='发放积分'*/}
{/* closed={handleCloseAll}*/}
{/*/>*/}
{/*<ApproveModal*/}
{/* open={approveVisible}*/}
{/* data={recordData}*/}
{/* title='提现审批'*/}
{/* closed={handleCloseAll}*/}
{/*/>*/}
</>
);
}
import React, { useEffect, useState } from 'react';
import { useEffect, useState } from 'react';
import { Button, message, Table } from 'antd';
import { ColumnsType } from 'antd/es/table';
import SearchView from '~/components/search-box/index';
import { PointManageAPI } from '~/api';
import { UserScorePageListType } from '~/api/interface/pointManageType';
import { UserPointListType } from '~/api/interface/pointManageType';
import { useNavigate } from 'react-router-dom';
import { InterListType, InterReqListType } from '~/api/interface';
import qs from 'query-string';
// 列表的类型
type TableType = (ReturnType<UserScorePageListType> extends Promise<infer T>
? T
: never)['result']['list']['userBasicInfo'];
// 后台返回的类型,但不是列表
type ListType = (ReturnType<UserScorePageListType> extends Promise<infer T>
? T
: never)['result']['list'];
type TableType = InterListType<UserPointListType>;
// 搜索表单的类型
type ReqType = Parameters<UserScorePageListType>[0];
type ReqType = InterReqListType<UserPointListType>;
// 搜索表单的数据
let query: ReqType = {};
export const PointList = () => {
// 路由操作
const navigation = useNavigate();
const navigate = useNavigate();
// 金额数据
const [pointData, setPointData] = useState<ListType>();
// const [pointData, setPointData] = useState<ListType>();
// 表格数据
const [tableData, setTableData] = useState<TableType>([]);
// 表格分页配置
......@@ -34,36 +30,30 @@ export const PointList = () => {
totalPage: 0,
});
// 跳转指定明细详情
const handleDetailList = (type: number) => {
navigation(`/pointManage/pointList/list?type=${type}`);
};
// const handleDetailList = (type: number) => {
// navigation(`/pointManage/pointList/list?type=${type}`);
// };
// +++++++++++++++++++++++++++++++++++++++++++++++++++ //
// 新版通用部分(ES6+ for React) ZhangLK 2022/08/30 Start
// 加载列表
const getTableList = async (value = {}) => {
// 只需要修改这个地方的接口即可
const res = await PointManageAPI.UserScorePageList({
const res = await PointManageAPI.UserPointList({
pageNo: pagination.current,
pageSize: pagination.pageSize,
...value,
...query,
});
if (res && res.code === '200') {
const {
list: { convertScore, releaseScore, userBasicInfo, withdrawScore, withdrawingScore },
pageNo,
totalCount,
pageSize,
totalPage,
} = res.result; // 解构
const { list, pageNo, totalCount, pageSize, totalPage } = res.result; // 解构
setPagination({
total: totalCount,
current: pageNo,
pageSize,
totalPage,
});
setTableData(userBasicInfo);
setPointData(res?.result?.list);
setTableData(list || []);
// setPointData(res?.result?.list);
} else {
message.warning(res.message);
}
......@@ -81,26 +71,28 @@ export const PointList = () => {
// +++++++++++++++++++++++++++++++++++++++++++++++++++ //
// 跳转详情
const handleDetail = (record: TableType[0]) => {
navigation({
pathname: '/pointManage/pointList/detail',
search: `id=${record?.mallUserId}&uid=${record?.uid}`,
});
const search = {
id: record.userAccountId,
totalPoints: record.totalPoints,
nickName: record.nickName || '游客用户',
};
navigate(`/pointManage/pointList/detail?${qs.stringify(search)}`);
};
// 表格结构
const columns: ColumnsType<TableType[0]> = [
{ title: 'UID', dataIndex: 'uid', align: 'center' },
{ title: 'UID', dataIndex: 'userAccountId', align: 'center' },
{
title: '用户名称',
dataIndex: 'userName',
align: 'center',
render: (text, record) => text || record?.nickName || `游客用户`,
},
{
title: '企业名称',
dataIndex: 'entName',
align: 'center',
render: (text: string, record) => text || (record.phoneNum ? '微信用户' : '游客用户'),
},
// {
// title: '企业名称',
// dataIndex: 'entName',
// align: 'center',
// render: (text: string, record) => text || (record.phoneNum ? '微信用户' : '游客用户'),
// },
{
title: '手机号',
dataIndex: 'phoneNum',
......@@ -108,7 +100,7 @@ export const PointList = () => {
},
{
title: '积分总额',
dataIndex: 'score',
dataIndex: 'totalPoints',
align: 'center',
render: (text: string, record) => {
return (
......@@ -132,10 +124,10 @@ export const PointList = () => {
<SearchView
search={[
{
label: '用户UID',
name: 'uid',
label: '微信昵称',
name: 'nickName',
type: 'input',
placeholder: '请输入UID',
placeholder: '请输入微信昵称',
width: 180,
},
{
......@@ -144,42 +136,42 @@ export const PointList = () => {
type: 'input',
placeholder: '请输入手机号',
},
{
label: '企业名称',
name: 'entName',
type: 'input',
placeholder: '请输入企业名称',
},
// {
// label: '企业名称',
// name: 'entName',
// type: 'input',
// placeholder: '请输入企业名称',
// },
]}
searchData={onFinish}
sufFixBtn={
<div className='point-list-head-number'>
<div className='head-number'>
<span className='number-label'>积分发放总额</span>
<Button type='link' onClick={() => handleDetailList(0)}>
{pointData?.releaseScore}
</Button>
</div>
<div className='head-number'>
<span className='number-label'>积分兑换总额</span>
<Button type='link' onClick={() => handleDetailList(1)}>
{pointData?.convertScore}
</Button>
</div>
<div className='head-number'>
<span className='number-label'>积分提现总额</span>
<Button type='link' onClick={() => handleDetailList(2)}>
{pointData?.withdrawScore}
</Button>
</div>
<div className='head-number'>
<span className='number-label'>待处理提现积分</span>
<Button type='link' onClick={() => handleDetailList(2)}>
{pointData?.withdrawingScore}
</Button>
</div>
</div>
}
// sufFixBtn={
// <div className='point-list-head-number'>
// <div className='head-number'>
// <span className='number-label'>积分发放总额</span>
// <Button type='link' onClick={() => handleDetailList(0)}>
// {pointData?.releaseScore}
// </Button>
// </div>
// <div className='head-number'>
// <span className='number-label'>积分兑换总额</span>
// <Button type='link' onClick={() => handleDetailList(1)}>
// {pointData?.convertScore}
// </Button>
// </div>
// <div className='head-number'>
// <span className='number-label'>积分提现总额</span>
// <Button type='link' onClick={() => handleDetailList(2)}>
// {pointData?.withdrawScore}
// </Button>
// </div>
// <div className='head-number'>
// <span className='number-label'>待处理提现积分</span>
// <Button type='link' onClick={() => handleDetailList(2)}>
// {pointData?.withdrawingScore}
// </Button>
// </div>
// </div>
// }
/>
<Table
size='small'
......
......@@ -71,7 +71,6 @@ const GoodsAddOrEditOrDetail = () => {
//删除规格
const deleteSkuEvent = (record: specEntity) => {
const index = specData.findIndex((v) => v.id === record.id);
console.log('删除index-->', index);
specData.splice(index, 1);
setSpecData([...specData]);
};
......
......@@ -188,19 +188,19 @@ const RentList = () => {
};
//新增商品
const toAddRentGoods = () => {
navigate({ pathname: '/mallManage/rentGoods/add' });
navigate({ pathname: '/rentManage/rentGoods/add' });
};
//编辑商品
const toEditGoods = (id: number) => {
navigate({
pathname: '/mallManage/rentGoods/edit',
pathname: '/rentManage/rentGoods/edit',
search: `id=${id}`,
});
};
//商品详情
const toRentGoodsDetail = (id: number) => {
navigate({
pathname: '/mallManage/rentGoods/detail',
pathname: '/rentManage/rentGoods/detail',
search: `id=${id}&isDetail=1`,
});
};
......
import { Form, Input, message, Modal, ModalProps } from 'antd';
import { FC, useEffect } from 'react';
import { InterDataType, InterReqType } from '~/api/interface';
import { listBrandInfoType, rentMakeAddType } from '~/api/interface/rentManageType';
import { RentManageAPI } from '~/api';
//品牌列表返回类型
type makeListType = InterDataType<listBrandInfoType>['list'];
interface selfProps {
onCancel: () => void;
onOk: () => void;
currentRentMakeItem: makeListType[0] | undefined;
}
//新增品牌参数类型
type addRentMakeParameterType = Exclude<InterReqType<rentMakeAddType>, undefined>;
const AddOrEditRentMakeModal: FC<ModalProps & selfProps> = ({
open,
onCancel,
onOk,
currentRentMakeItem,
}) => {
const [form] = Form.useForm<addRentMakeParameterType>();
const handleCancel = () => {
form.resetFields();
onCancel();
};
const handleOk = () => {
form.validateFields().then((values) => {
RentManageAPI[currentRentMakeItem ? 'editBrandInfo' : 'addBrandInfo']({
...values,
id: currentRentMakeItem ? currentRentMakeItem.id : undefined,
}).then(({ code }) => {
if (code === '200') {
message.success(currentRentMakeItem ? '编辑成功' : '新增成功');
form.resetFields();
onOk();
}
});
});
};
useEffect(() => {
if (currentRentMakeItem) {
form.setFieldValue('brandName', currentRentMakeItem.brandName);
}
}, [currentRentMakeItem]);
return (
<Modal open={open} onOk={handleOk} onCancel={handleCancel} title='新增品牌'>
<Form form={form}>
<Form.Item
label='品牌名称'
name='brandName'
rules={[{ required: true, message: '请输入品牌名称' }]}
>
<Input placeholder='请输入品牌名称' maxLength={30} />
</Form.Item>
</Form>
</Modal>
);
};
export default AddOrEditRentMakeModal;
import { Button, Table, Tag } from 'antd';
import { PlusOutlined } from '@ant-design/icons';
import { ColumnsType } from 'antd/es/table';
import AddOrEditRentMakeModal from './components/addOrEditRentMakeModal';
import { useEffect, useState } from 'react';
import { RentManageAPI } from '~/api';
import { InterDataType, PaginationProps } from '~/api/interface';
import { listBrandInfoType } from '~/api/interface/rentManageType';
//品牌列表返回类型
type makeListType = InterDataType<listBrandInfoType>['list'];
const RentMake = () => {
const tableColumns: ColumnsType<makeListType[0]> = [
{
title: '品牌名称',
align: 'center',
dataIndex: 'brandName',
},
{
title: '设备型号',
align: 'center',
dataIndex: 'modeInfoList',
render: (text: makeListType[0]['modeInfoList']) =>
text?.map((v) => <Tag key={v.id}>{v.modeName}</Tag>),
},
{
title: '操作',
align: 'center',
width: '15%',
render: (_: any, record) => (
<>
<Button type='link'>绑定型号</Button>
<Button type='link' onClick={() => addOrEditRentMakeModalClick(record)}>
编辑
</Button>
<Button type='link'>详情</Button>
</>
),
},
];
const [addOrEditRentMakeModalShow, setAddOrEditRentMakeModalShow] = useState<boolean>(false);
const [pagination, setPagination] = useState<PaginationProps & { totalCount: number }>({
pageNo: 1,
pageSize: 10,
totalCount: 0,
});
const [tableData, setTableData] = useState<makeListType>([]);
const [currentRentMakeItem, setCurrentRentMakeItem] = useState<makeListType[0]>();
//品牌列表
const getListBrandInfo = () => {
RentManageAPI.getListBrandInfo({
pageNo: pagination.pageNo,
pageSize: pagination.pageSize,
}).then(({ result }) => {
pagination.totalCount = result.totalCount;
setPagination({ ...pagination });
setTableData(result.list || []);
});
};
//品牌新增,编辑弹窗
const addOrEditRentMakeModalClick = (record?: makeListType[0]) => {
setCurrentRentMakeItem(record ? { ...record } : undefined);
setAddOrEditRentMakeModalShow(true);
};
const addOrEditRentMakeModalCancel = () => {
setAddOrEditRentMakeModalShow(false);
};
const addOrEditRentMakeModalOk = () => {
getListBrandInfo();
setAddOrEditRentMakeModalShow(false);
};
//分页
const paginationChange = (pageNo: number, pageSize: number) => {
pagination.pageNo = pageNo;
pagination.pageSize = pageSize;
getListBrandInfo();
};
useEffect(() => {
getListBrandInfo();
}, []);
return (
<div className='rent-make'>
<div className='rent-make-operate' style={{ marginBottom: '10px' }}>
<Button
icon={<PlusOutlined />}
type='primary'
onClick={() => addOrEditRentMakeModalClick()}
>
新增品牌
</Button>
</div>
<Table
columns={tableColumns}
bordered
dataSource={tableData}
pagination={{
total: pagination.totalCount,
pageSize: pagination.pageSize,
current: pagination.pageNo,
showSizeChanger: true,
showQuickJumper: true,
onChange: (page: number, pageSize: number) => paginationChange(page, pageSize),
showTotal: (total, range) => `当前 ${range[0]}-${range[1]} 条记录 / 共 ${total} 条数据`,
}}
rowKey='id'
/>
<AddOrEditRentMakeModal
open={addOrEditRentMakeModalShow}
onCancel={addOrEditRentMakeModalCancel}
onOk={addOrEditRentMakeModalOk}
currentRentMakeItem={currentRentMakeItem}
/>
</div>
);
};
export default RentMake;
import { Form, Input, Modal, ModalProps, Select } from 'antd';
import { FC, useEffect, useState } from 'react';
import { InterDataType, InterReqType } from '~/api/interface';
import { addRentModeType, getTypeListType } from '~/api/interface/rentManageType';
import { RentManageAPI } from '~/api';
interface selfProps {
onOk: () => void;
onCancel: () => void;
}
//型号新增参数类型
type addRentParameterType = Exclude<InterReqType<addRentModeType>, undefined>;
//类型类别返回类型
type rentTypeListType = InterDataType<getTypeListType>['list'];
const AddOrEditRentModeModal: FC<ModalProps & selfProps> = ({ open, onOk, onCancel }) => {
const [form] = Form.useForm<addRentParameterType>();
const [rentTypeList, setRentTypeList] = useState<rentTypeListType>([]);
const handleOk = () => {
onOk();
};
const handleCancel = () => {
onCancel();
};
//获取类型列表
const getRentTypeList = () => {
RentManageAPI.getTypeList({ pageNo: 1, pageSize: 99999 }).then(({ result }) => {
setRentTypeList(result.list || []);
});
};
useEffect(() => {
getRentTypeList();
}, []);
return (
<Modal open={open} onOk={handleOk} onCancel={handleCancel} title='新增型号'>
<Form form={form}>
<Form.Item label='所属类别'>
<Select placeholder='请选择所属类别'>
{rentTypeList.map((v) => (
<Select.Option key={v.id} value={v.id}>
{v.name}
</Select.Option>
))}
</Select>
</Form.Item>
<Form.Item label='型号名称'>
<Input placeholder='请输入型号名称' />
</Form.Item>
</Form>
</Modal>
);
};
export default AddOrEditRentModeModal;
import SearchBox, { searchColumns as searchColumnsType } from '~/components/search-box';
import { Button, Table } from 'antd';
import { PlusOutlined } from '@ant-design/icons';
import { ColumnsType } from 'antd/es/table/InternalTable';
import AddOrEditRentModeModal from '~/pages/rentManage/rentMode/components/addOrEditRentModeModal';
import { useState } from 'react';
const RentMode = () => {
const tableColumns: ColumnsType<any> = [
{
title: '型号名称',
align: 'center',
},
{
title: '所属类型',
align: 'center',
},
{
title: '所属品牌',
align: 'center',
},
{
title: '标签',
align: 'center',
},
{
title: '操作',
align: 'center',
},
];
const searchColumns: searchColumnsType[] = [
{
name: '',
label: '设备类型',
placeholder: '请选择设备类型',
type: 'select',
options: [],
},
];
const [addOrEditRentModelModalShow, setAddOrEditRentModelModalShow] = useState<boolean>(false);
//新增,编辑型号弹窗
const addOrEditRentModelClick = () => {
setAddOrEditRentModelModalShow(true);
};
const addOrEditRentModelModalCancel = () => {
setAddOrEditRentModelModalShow(false);
};
const addOrEditRentModelModalOk = () => {
setAddOrEditRentModelModalShow(true);
};
return (
<div className='rent-model'>
<SearchBox
search={searchColumns}
child={
<Button type='primary' icon={<PlusOutlined />} onClick={addOrEditRentModelClick}>
新增型号
</Button>
}
/>
<Table bordered columns={tableColumns} />
<AddOrEditRentModeModal
open={addOrEditRentModelModalShow}
onCancel={addOrEditRentModelModalCancel}
onOk={addOrEditRentModelModalOk}
/>
</div>
);
};
export default RentMode;
import { FC, useEffect, useState } from 'react';
import { Form, Input, message, Modal, ModalProps } from 'antd';
import { Uploader } from '~/components/uploader';
import { UploadOutlined } from '@ant-design/icons';
import { RentManageAPI } from '~/api';
import { InterDataType, InterReqType } from '~/api/interface';
import { addType, getTypeListType } from '~/api/interface/rentManageType';
//类型类别返回类型
type rentTypeListType = InterDataType<getTypeListType>['list'];
//新增租赁类型参数类型
type addRentTypeParameters = InterReqType<addType>;
interface selfProps {
onCancel: () => void;
onOk: () => void;
currentRentTypeItem: rentTypeListType[0] | undefined;
}
const AddOrEditTypeModal: FC<ModalProps & selfProps> = ({
open,
onCancel,
onOk,
currentRentTypeItem,
}) => {
const [form] = Form.useForm<addRentTypeParameters>();
const [fileList, setFileList] = useState<any>([]);
const handleCancel = () => {
form.resetFields();
setFileList([]);
onCancel();
};
const handelOk = () => {
form.validateFields().then((values: any) => {
RentManageAPI[currentRentTypeItem ? 'editTypeReq' : 'addTypeReq']({
...values,
id: currentRentTypeItem ? currentRentTypeItem.id : undefined,
}).then(({ code }) => {
if (code === '200') {
message.success(currentRentTypeItem ? '编辑成功' : '新增成功');
form.resetFields();
setFileList([]);
onOk();
}
});
});
};
//上传成功
const uploadSuccess = (fileList: any) => {
form.setFieldValue('url', fileList[0].url);
setFileList(fileList);
};
useEffect(() => {
if (currentRentTypeItem) {
form.setFieldsValue({
name: currentRentTypeItem.name,
url: currentRentTypeItem.url,
});
setFileList([
{ id: Math.random(), uid: Math.random(), url: currentRentTypeItem.url, name: '类型图片' },
]);
}
}, [currentRentTypeItem]);
return (
<Modal open={open} title='新增类型' onCancel={handleCancel} onOk={handelOk}>
<Form form={form} labelCol={{ span: 4 }} wrapperCol={{ span: 20 }}>
<Form.Item label='类型名称' name='name'>
<Input placeholder='请输入类型名称' maxLength={30} />
</Form.Item>
<Form.Item label='图片' name='url' rules={[{ required: true, message: '请上传图片' }]}>
<Uploader
fileUpload
listType='picture-card'
onChange={uploadSuccess}
defaultFileList={fileList}
>
<UploadOutlined />
</Uploader>
</Form.Item>
</Form>
</Modal>
);
};
export default AddOrEditTypeModal;
import { Button, Image, message, Modal, Table } from 'antd';
import { ColumnsType } from 'antd/es/table';
import AddOrEditTypeModal from './components/addOrEditTypeModal';
import { useEffect, useState } from 'react';
import { InterDataType, PaginationProps } from '~/api/interface';
import { RentManageAPI } from '~/api';
import { getTypeListType } from '~/api/interface/rentManageType';
//类型类别返回类型
type rentTypeListType = InterDataType<getTypeListType>['list'];
const RentType = () => {
const [addOrEditTypeModalShow, setAddOrEditTypeModalShow] = useState<boolean>(false);
const [pagination, setPagination] = useState<PaginationProps & { totalCount: number }>({
pageNo: 1,
pageSize: 10,
totalCount: 0,
});
const tableColumns: ColumnsType<rentTypeListType[0]> = [
{
title: '类型名称',
align: 'center',
dataIndex: 'name',
},
{
title: '图片',
align: 'center',
dataIndex: 'url',
render: (text: string) => <Image src={text} width={50} height={50} />,
},
{
title: '操作',
align: 'center',
render: (_text: string, record) => (
<>
<Button type='link' onClick={() => addOrEditTypeModalClick(record)}>
编辑
</Button>
<Button type='link' onClick={() => deleteRentType(record)}>
删除
</Button>
</>
),
},
];
const [tableData, setTableData] = useState<rentTypeListType>([]);
const [currentRentTypeItem, setCurrentRentTypeItem] = useState<rentTypeListType[0]>();
//类型列表
const getTypeList = () => {
RentManageAPI.getTypeList({ pageNo: pagination.pageNo, pageSize: pagination.pageSize }).then(
({ result }) => {
pagination.totalCount = result.totalCount;
setPagination({ ...pagination });
setTableData(result.list || []);
},
);
};
//新增,编辑类型
const addOrEditTypeModalClick = (record?: rentTypeListType[0]) => {
setCurrentRentTypeItem(record ? { ...record } : undefined);
setAddOrEditTypeModalShow(true);
};
const addOrEditTypeModalCancel = () => {
setAddOrEditTypeModalShow(false);
};
const addOrEditTypeModalOk = () => {
setAddOrEditTypeModalShow(false);
getTypeList();
};
//删除类型
const deleteRentType = (record: rentTypeListType[0]) => {
Modal.confirm({
title: '提示',
content: '确认删除该类型',
onOk: () => {
RentManageAPI.rentTypeRemove({ id: record.id }).then(({ code }) => {
if (code === '200') {
if (tableData.length === 1 && pagination.pageNo !== 1) {
pagination.pageNo -= 1;
}
message.success('删除成功');
getTypeList();
}
});
},
});
};
//分页
const paginationChange = (pageNo: number, pageSize: number) => {
pagination.pageNo = pageNo;
pagination.pageSize = pageSize;
getTypeList();
};
useEffect(() => {
getTypeList();
}, []);
return (
<div className='rent-type'>
<div className='rent-type-operate' style={{ marginBottom: '10px' }}>
<Button type='primary' onClick={() => addOrEditTypeModalClick()}>
新增类型
</Button>
</div>
<Table
bordered
columns={tableColumns}
dataSource={tableData}
rowKey='id'
pagination={{
total: pagination.totalCount,
pageSize: pagination.pageSize,
current: pagination.pageNo,
showSizeChanger: true,
showQuickJumper: true,
onChange: (page: number, pageSize: number) => paginationChange(page, pageSize),
showTotal: (total, range) => `当前 ${range[0]}-${range[1]} 条记录 / 共 ${total} 条数据`,
}}
/>
<AddOrEditTypeModal
open={addOrEditTypeModalShow}
onCancel={addOrEditTypeModalCancel}
onOk={addOrEditTypeModalOk}
currentRentTypeItem={currentRentTypeItem}
/>
</div>
);
};
export default RentType;
......@@ -20,7 +20,7 @@ export const authRouterList = async () => {
const getRouteList = (data: RouteObjectType[]) => {
return data.reduce((pre: RouteObjectType[], cur) => {
const Obj: RouteObjectType = { ...cur };
if (ids.includes(Obj.meta.id) || Obj.meta.hidden) {
if (ids.includes(Obj.meta.id) || Obj.meta.hidden || Obj.meta.develop) {
if (Obj.children) {
Obj.children = [...getRouteList(Obj.children)];
}
......
......@@ -34,6 +34,7 @@ import {
ThunderboltOutlined,
BankOutlined,
VerifiedOutlined,
AccountBookOutlined,
} from '@ant-design/icons';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
......@@ -43,8 +44,8 @@ import { Spin } from 'antd';
import LoginView from '~/pages/common/login';
// 积分
// import { PointList } from '~/pages/pointManage/pointList';
// import { PointDetail } from '~/pages/pointManage/pointList/detail';
import { PointList } from '~/pages/pointManage/pointList';
import { PointDetail } from '~/pages/pointManage/pointList/detail';
// import { PointRules } from '~/pages/pointManage/pointRules';
// import PointDetailList from '~/pages/pointManage/pointDetail';
// 分成
......@@ -95,10 +96,15 @@ const ServiceDetailView = React.lazy(
const ServiceIntroduceView = React.lazy(
() => import('~/pages/mallManage/serviceManage/serviceIntroduce'),
); //服务介绍
const RentListView = React.lazy(() => import('~/pages/mallManage/rentGoods/rentList')); //租赁列表
const RentListView = React.lazy(() => import('~/pages/rentManage/rentGoods/rentList')); //租赁列表
const RentAddOrEditOrDetailView = React.lazy(
() => import('~/pages/mallManage/rentGoods/rentAddOrEditOrDetail'),
() => import('~/pages/rentManage/rentGoods/rentAddOrEditOrDetail'),
); //租赁新增、编辑、详情
const RentTypeView = React.lazy(() => import('~/pages/rentManage/rentType')); //租赁-类型管理
const RentMakeView = React.lazy(() => import('~/pages/rentManage/rentMake')); //租赁-品牌管理
const RentModeView = React.lazy(() => import('~/pages/rentManage/rentMode')); //租赁-型号管理
const MallGoodsView = React.lazy(() => import('~/pages/mallManage/mallGoods/goodsList')); //商城商品
const MallAddOrEditOrDetailView = React.lazy(
() => import('~/pages/mallManage/mallGoods/goodsAddOrEditOrDetail'),
......@@ -175,6 +181,7 @@ export interface RouteObjectType {
icon: any;
customIcon?: boolean;
title: string;
develop?: boolean;
};
}
// 加载页面
......@@ -612,49 +619,6 @@ export const routerList: Array<RouteObjectType> = [
},
},
{
path: '/mallManage/rentGoods',
element: withLoadingComponent(<RentListView />),
errorElement: <ErrorPage />,
meta: {
id: 1030,
icon: <SmileOutlined />,
title: '租赁商品',
},
},
{
path: '/mallManage/rentGoods/add',
element: withLoadingComponent(<RentAddOrEditOrDetailView />),
errorElement: <ErrorPage />,
meta: {
id: 10135,
icon: <SmileOutlined />,
title: '租赁商品新增',
hidden: true,
},
},
{
path: '/mallManage/rentGoods/edit',
element: withLoadingComponent(<RentAddOrEditOrDetailView />),
errorElement: <ErrorPage />,
meta: {
id: 10136,
icon: <SmileOutlined />,
title: '租赁商品编辑',
hidden: true,
},
},
{
path: '/mallManage/rentGoods/detail',
element: withLoadingComponent(<RentAddOrEditOrDetailView />),
errorElement: <ErrorPage />,
meta: {
id: 10136,
icon: <SmileOutlined />,
title: '租赁商品详情',
hidden: true,
},
},
{
path: '/mallManage/mallGoods',
element: withLoadingComponent(<MallGoodsView />),
errorElement: <ErrorPage />,
......@@ -728,25 +692,94 @@ export const routerList: Array<RouteObjectType> = [
title: '品牌管理',
},
},
// {
// path: '/mallManage/industryList',
// element: withLoadingComponent(<IndustryListView />),
// meta: {
// id: 10180,
// icon: <SmileOutlined />,
// title: '行业方案',
// },
// },
// {
// path: '/mallManage/industryDetail',
// element: withLoadingComponent(<IndustryDetailView />),
// meta: {
// id: 10190,
// icon: <SmileOutlined />,
// title: '行业详情',
// hidden: true,
// },
// },
],
},
{
path: '/rentManage',
element: <LayoutView />,
errorElement: <ErrorPage />,
meta: {
id: 2000,
icon: <ShopOutlined />,
title: '租赁管理',
},
children: [
{
path: '/rentManage/rentGoods',
element: withLoadingComponent(<RentListView />),
errorElement: <ErrorPage />,
meta: {
id: 1030,
icon: <SmileOutlined />,
title: '租赁商品',
},
},
{
path: '/rentManage/rentGoods/add',
element: withLoadingComponent(<RentAddOrEditOrDetailView />),
errorElement: <ErrorPage />,
meta: {
id: 10135,
icon: <SmileOutlined />,
title: '租赁商品新增',
hidden: true,
},
},
{
path: '/rentManage/rentGoods/edit',
element: withLoadingComponent(<RentAddOrEditOrDetailView />),
errorElement: <ErrorPage />,
meta: {
id: 10136,
icon: <SmileOutlined />,
title: '租赁商品编辑',
hidden: true,
},
},
{
path: '/rentManage/rentGoods/detail',
element: withLoadingComponent(<RentAddOrEditOrDetailView />),
errorElement: <ErrorPage />,
meta: {
id: 10136,
icon: <SmileOutlined />,
title: '租赁商品详情',
hidden: true,
},
},
{
path: '/rentManage/rentType',
element: withLoadingComponent(<RentTypeView />),
errorElement: <ErrorPage />,
meta: {
id: 2010,
icon: <SmileOutlined />,
title: '类型管理',
// develop: true,
},
},
{
path: '/rentManage/rentMake',
element: withLoadingComponent(<RentMakeView />),
errorElement: <ErrorPage />,
meta: {
id: 10138,
icon: <SmileOutlined />,
title: '品牌管理',
// develop: true,
},
},
{
path: '/rentManage/rentModel',
element: withLoadingComponent(<RentModeView />),
errorElement: <ErrorPage />,
meta: {
id: 10139,
icon: <SmileOutlined />,
title: '型号管理',
// develop: true,
},
},
],
},
{
......@@ -854,87 +887,83 @@ export const routerList: Array<RouteObjectType> = [
},
],
},
// {
// path: '/pointManage',
// element: <LayoutView />,
// errorElement: <ErrorPage />,
// meta: {
// id: 25000,
// icon: <AccountBookOutlined />,
// title: '积分管理',
// },
// children: [
// {
// path: '/pointManage/pointList',
// element: withLoadingComponent(<PointList />),
// meta: {
// id: 25100,
// title: '积分列表',
// icon: <MacCommandOutlined />,
// },
// },
// {
// path: '/pointManage/pointList/detail',
// element: withLoadingComponent(
// <PointDetail
// location={{
// search: '',
// }}
// />,
// ),
// meta: {
// id: 25100,
// title: '个人积分明细',
// icon: <MacCommandOutlined />,
// hidden: true,
// },
// },
// {
// path: '/pointManage/pointRule',
// element: withLoadingComponent(<PointRules />),
// meta: {
// id: 25200,
// title: '兑换规则',
// icon: <MacCommandOutlined />,
// },
// },
// {
// path: '/pointManage/pointList/list',
// element: withLoadingComponent(
// <PointDetailList
// location={{
// search: '',
// }}
// />,
// ),
// meta: {
// id: 25100,
// title: '积分明细',
// icon: <MacCommandOutlined />,
// hidden: true,
// },
// },
// {
// path: '/pointManage/divideOrder',
// element: withLoadingComponent(<DivideOrder />),
// meta: {
// id: 25300,
// title: '订单分成',
// icon: <MacCommandOutlined />,
// },
// },
// {
// path: '/pointManage/divideRules',
// element: withLoadingComponent(<DivideRules />),
// meta: {
// id: 25400,
// title: '分成规则',
// icon: <MacCommandOutlined />,
// hidden: true,
// },
// },
// ],
// },
{
path: '/pointManage',
element: <LayoutView />,
errorElement: <ErrorPage />,
meta: {
id: 2200,
icon: <AccountBookOutlined />,
title: '积分管理',
develop: true,
},
children: [
{
path: '/pointManage/pointList',
element: withLoadingComponent(<PointList />),
meta: {
id: 2210,
title: '积分列表',
icon: <MacCommandOutlined />,
develop: true,
},
},
{
path: '/pointManage/pointList/detail',
element: withLoadingComponent(<PointDetail />),
meta: {
id: 12110,
title: '个人积分明细',
icon: <MacCommandOutlined />,
hidden: true,
},
},
// {
// path: '/pointManage/pointRule',
// element: withLoadingComponent(<PointRules />),
// meta: {
// id: 25200,
// title: '兑换规则',
// icon: <MacCommandOutlined />,
// },
// },
// {
// path: '/pointManage/pointList/list',
// element: withLoadingComponent(
// <PointDetailList
// location={{
// search: '',
// }}
// />,
// ),
// meta: {
// id: 25100,
// title: '积分明细',
// icon: <MacCommandOutlined />,
// hidden: true,
// },
// },
// {
// path: '/pointManage/divideOrder',
// element: withLoadingComponent(<DivideOrder />),
// meta: {
// id: 25300,
// title: '订单分成',
// icon: <MacCommandOutlined />,
// },
// },
// {
// path: '/pointManage/divideRules',
// element: withLoadingComponent(<DivideRules />),
// meta: {
// id: 25400,
// title: '分成规则',
// icon: <MacCommandOutlined />,
// hidden: true,
// },
// },
],
},
// {
// path: '/couponManage',
// element: <LayoutView />,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论