Commit 12a621f0 authored by 武广's avatar 武广

Merge branch 'feature/group-meal' of git.quantgroup.cn:ui/merchant-manage-ui into feature/meal-3.0

parents 45b05eb4 63fda8bf
...@@ -5,7 +5,7 @@ const environment = 'sc'; ...@@ -5,7 +5,7 @@ const environment = 'sc';
// 从tob进入的判断接口前缀 // 从tob进入的判断接口前缀
const getUrlParams = name => { const getUrlParams = name => {
const regArg = new RegExp(`(^|&)${name}=([^&]*)(&|$)`); const regArg = new RegExp(`(^|&)${name}=([^&]*)(&|$)`);
const r = window.location.search.substr(1).match(regArg); const r = window.location.search.substring(1).match(regArg);
if (r != null) return decodeURIComponent(r[2]); if (r != null) return decodeURIComponent(r[2]);
return null; return null;
}; };
......
...@@ -152,24 +152,26 @@ const CustomerInfo = props => { ...@@ -152,24 +152,26 @@ const CustomerInfo = props => {
}); });
}; };
// 改变餐品类型 // 改变餐品类型 (1和2要选都选 要不都不选)
const onChangeMealType = async ms => { const onChangeMealType = async ms => {
try { try {
if (props.info && props.info.id && ms.length < mealTypes.length) { if (props.info && props.info.id && ms.length < mealTypes.length) {
await checkConfirm(); await checkConfirm();
} }
if (mealTypes.includes('1') && mealTypes.includes('2')) { console.log('ms :>> ', ms);
if (!(ms.includes('1') && ms.includes('2'))) { if (mealTypes.length > ms.length) {
if (ms.includes('4')) { if (ms.includes('1') && ms.includes('2')) {
ms = ['4']; ms = ['1', '2'];
} else { } else if (ms.includes('4')) {
ms = []; ms = ['4'];
} } else {
ms = [];
} }
} else if (ms.length < 3 && ms.length) { } else if (ms.includes('1') || ms.includes('2')) {
ms = ['1', '2'];
if (ms.includes('4')) { if (ms.includes('4')) {
ms.push('4'); ms = ['1', '2', '4'];
} else {
ms = ['1', '2'];
} }
} }
form.setFieldsValue({ form.setFieldsValue({
......
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
import { Form, InputNumber, Modal, notification } from 'antd'; import { Form, InputNumber, Modal, notification } from 'antd';
import { layout } from '../staticData/goods';
import { isCheckPriceTwoDecimal } from '@/utils/validator'; import { isCheckPriceTwoDecimal } from '@/utils/validator';
import { apiMealInfoUpdate } from '../service'; import { apiMealInfoUpdate } from '../service';
const SaleDateModal = props => { const SaleDateModal = props => {
const [form] = Form.useForm(); const [form] = Form.useForm();
const layout = {
labelCol: { span: 8 },
wrapperCol: { span: 14 },
};
// 关闭弹窗 // 关闭弹窗
const handleCancel = () => { const handleCancel = () => {
props.handleClose(false); props.handleClose(false);
...@@ -16,14 +20,16 @@ const SaleDateModal = props => { ...@@ -16,14 +20,16 @@ const SaleDateModal = props => {
const handleConfirm = async () => { const handleConfirm = async () => {
const res = await form.validateFields(); const res = await form.validateFields();
console.log('res :>> ', res); console.log('res :>> ', res);
const params = { if (props.id) {
id: props.id, const params = {
enterprisePrice: res.price, id: props.id,
}; enterprisePrice: res.price,
await apiMealInfoUpdate(params); };
notification.success({ message: '保存成功' }); await apiMealInfoUpdate(params);
notification.success({ message: '保存成功' });
}
handleCancel(); handleCancel();
props.handleRefresh(); props.handleRefresh(res.price);
}; };
useEffect(() => { useEffect(() => {
...@@ -38,7 +44,7 @@ const SaleDateModal = props => { ...@@ -38,7 +44,7 @@ const SaleDateModal = props => {
open={props.visible} open={props.visible}
destroyOnClose destroyOnClose
maskClosable={false} maskClosable={false}
width="300px" width="400px"
okText="保存" okText="保存"
onOk={handleConfirm} onOk={handleConfirm}
onCancel={handleCancel} onCancel={handleCancel}
......
...@@ -11,7 +11,7 @@ const { Option } = Select; ...@@ -11,7 +11,7 @@ const { Option } = Select;
const SaleDateModal = props => { const SaleDateModal = props => {
const [searchType, setSearchType] = useState('1'); const [searchType, setSearchType] = useState('1');
const [searchKeyword, setSearchKeyword] = useState(''); const [searchKeyword, setSearchKeyword] = useState('');
const [goodsType, setGoodsType] = useState('1'); // const [goodsType, setGoodsType] = useState('1');
const [shopId, setShopId] = useState(); const [shopId, setShopId] = useState();
const [searchName, setSearchName] = useState(''); const [searchName, setSearchName] = useState('');
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
...@@ -19,7 +19,7 @@ const SaleDateModal = props => { ...@@ -19,7 +19,7 @@ const SaleDateModal = props => {
const [pageSize, setPageSize] = useState(10); const [pageSize, setPageSize] = useState(10);
const [total, setTotal] = useState(0); const [total, setTotal] = useState(0);
const [dataSource, setDataSource] = useState([]); const [dataSource, setDataSource] = useState([]);
const [shopList, setShopList] = useState(jsonToArray(productType)); const [shopList, setShopList] = useState([]);
const [selectedRowKeys, setSelectedRowKeys] = useState([]); const [selectedRowKeys, setSelectedRowKeys] = useState([]);
const [selectedRows, setSelectedRows] = useState([]); const [selectedRows, setSelectedRows] = useState([]);
...@@ -76,6 +76,7 @@ const SaleDateModal = props => { ...@@ -76,6 +76,7 @@ const SaleDateModal = props => {
shopId: v, shopId: v,
}); });
setSelectedRowKeys([]); setSelectedRowKeys([]);
setSelectedRows([]);
}; };
// 关闭弹窗 // 关闭弹窗
...@@ -89,11 +90,21 @@ const SaleDateModal = props => { ...@@ -89,11 +90,21 @@ const SaleDateModal = props => {
notification.error({ message: '请选择要添加的商品' }); notification.error({ message: '请选择要添加的商品' });
return; return;
} }
let shopName = '';
if (shopList) {
shopList.forEach(item => {
if (+item.value === +shopId) {
shopName = item.label;
}
});
}
const arr = deepClone(selectedRows).map(item => ({ const arr = deepClone(selectedRows).map(item => ({
...item, ...item,
shopId, shopId,
shopName,
})); }));
props.onSelectChange(arr); props.onSelectChange(arr);
props.onChangeShop(shopId);
handleCancel(); handleCancel();
}; };
...@@ -122,9 +133,11 @@ const SaleDateModal = props => { ...@@ -122,9 +133,11 @@ const SaleDateModal = props => {
const onSelectAllChange = (selected, rows) => { const onSelectAllChange = (selected, rows) => {
const keys = [...selectedRowKeys]; const keys = [...selectedRowKeys];
const arr = [...selectedRows]; const arr = [...selectedRows];
console.log('selected :>> ', selected);
console.log('rows :>> ', rows);
if (selected) { if (selected) {
rows.forEach(item => { rows.forEach(item => {
if (!keys.includes(item.skuId)) { if (item && !keys.includes(item.skuId)) {
keys.push(item.skuId); keys.push(item.skuId);
arr.push(item); arr.push(item);
} }
...@@ -180,13 +193,17 @@ const SaleDateModal = props => { ...@@ -180,13 +193,17 @@ const SaleDateModal = props => {
}; };
const selectBefore = ( const selectBefore = (
<Select defaultValue="1" onChange={setSearchType}> <Select defaultValue="1" onChange={setSearchType}>
<Option value="1">名称</Option> <Option value="1" key={1}>
<Option value="2">SKU</Option> 名称
</Option>
<Option value="2" key={2}>
SKU
</Option>
</Select> </Select>
); );
const selectAfter = <SearchOutlined onClick={onSearch} />; const selectAfter = <SearchOutlined onClick={onSearch} />;
const footers = () => [ const footers = () => [
<div className={style.footers}> <div className={style.footers} key="footer">
<Pagination defaultCurrent={1} total={total} showQuickJumper onChange={onPageChange} /> <Pagination defaultCurrent={1} total={total} showQuickJumper onChange={onPageChange} />
<div className={style['footers-btn']}> <div className={style['footers-btn']}>
<div className={style['footers-desc']}> <div className={style['footers-desc']}>
...@@ -204,7 +221,7 @@ const SaleDateModal = props => { ...@@ -204,7 +221,7 @@ const SaleDateModal = props => {
useEffect(() => { useEffect(() => {
getShopList(); getShopList();
setGoodsType(props.productType); // setGoodsType(props.productType);
}, []); }, []);
return ( return (
......
...@@ -25,23 +25,21 @@ export const getEnterpriseList = async () => { ...@@ -25,23 +25,21 @@ export const getEnterpriseList = async () => {
}; };
// 获取店铺列表 // 获取店铺列表
export const getShopList = debounce(async e => { export const getShopList = debounce(async e => {
const { name } = e; const res = await apiShopList({ name: e });
const res = await apiShopList({ name });
if (res && res.data && res.data.records) { if (res && res.data && res.data.records) {
const data = res.data.records; const data = res.data.records;
const json = {}; // const json = {};
data.forEach(item => { // data.forEach(item => {
json[item.id] = { text: item.name }; // json[item.id] = { text: item.name };
}); // });
return { // return json;
id: res[res.length - 1].id, return data.map(item => ({
list: json, value: item.id,
}; text: item.name,
}));
} }
return { // return {};
id: '', return [];
list: {},
};
}, 300); }, 300);
// 获取店铺列表通过自提点ID // 获取店铺列表通过自提点ID
export const getShopListByPickSelf = async e => { export const getShopListByPickSelf = async e => {
......
...@@ -26,6 +26,13 @@ export const productType = { ...@@ -26,6 +26,13 @@ export const productType = {
5: '外卖商品', 5: '外卖商品',
}; };
// 餐品类型:(1外卖 2 自助餐 4到店)
export const mealType = {
1: '外卖',
2: '自助餐',
4: '到店',
};
export const weekOptions = { export const weekOptions = {
1: '周一', 1: '周一',
2: '周二', 2: '周二',
...@@ -39,7 +46,6 @@ export const weekOptions = { ...@@ -39,7 +46,6 @@ export const weekOptions = {
export const takeawayGoodsColumn = options => { export const takeawayGoodsColumn = options => {
const { const {
onDel, onDel,
companyEnum,
shopEnum, shopEnum,
onChangeFlag, onChangeFlag,
setVisibleSaleDate, setVisibleSaleDate,
...@@ -68,39 +74,44 @@ export const takeawayGoodsColumn = options => { ...@@ -68,39 +74,44 @@ export const takeawayGoodsColumn = options => {
hideInTable: true, hideInTable: true,
fieldProps: { fieldProps: {
showSearch: true, showSearch: true,
filterOption: false,
onSearch: getShopList,
}, },
// request: getShopList, // request: getShopList,
// valueEnum: {}, // shopEnum, valueEnum: {}, // shopEnum,
}, },
{ {
title: 'SKU编码', title: 'SKU编码',
dataIndex: 'skuId', dataIndex: 'skuId',
width: 120, width: 160,
align: 'center', align: 'center',
}, },
{ {
title: '商品名称', title: '商品名称',
dataIndex: 'skuName', dataIndex: 'skuName',
width: 120,
align: 'center', align: 'center',
}, },
{ {
title: '商品图片', title: '商品图片',
dataIndex: 'primaryImage', dataIndex: 'primaryImage',
width: 120, width: 80,
align: 'center', align: 'center',
hideInSearch: true, hideInSearch: true,
valueType: 'image', valueType: 'image',
}, },
{ {
title: '可售日期', title: '可售日期',
dataIndex: 'saleTimeType', dataIndex: 'saleDateList',
width: 120, width: 120,
align: 'center', align: 'center',
hideInSearch: true, hideInSearch: true,
render: (_, record) => ( render: (_, record) => (
<Space> <Space>
<span>{_}</span> {_ && _.length && (
<div>
{_.length === 7 ? '不限制' : <span>{_.map(item => item.name).join('/')}</span>}
</div>
)}
<span <span
onClick={() => { onClick={() => {
setRecordID(record.id); setRecordID(record.id);
...@@ -114,13 +125,13 @@ export const takeawayGoodsColumn = options => { ...@@ -114,13 +125,13 @@ export const takeawayGoodsColumn = options => {
}, },
{ {
title: '可售餐段', title: '可售餐段',
dataIndex: 'saleDate', dataIndex: 'tabCateList',
width: 120, width: 120,
align: 'center', align: 'center',
hideInSearch: true, hideInSearch: true,
render: (_, record) => ( render: (_, record) => (
<Space> <Space>
<span>{_}</span> {_ && _.length && <span>{_.map(item => item.tabName).join('/')}</span>}
<span <span
onClick={() => { onClick={() => {
setRecordID(record.id); setRecordID(record.id);
...@@ -135,7 +146,7 @@ export const takeawayGoodsColumn = options => { ...@@ -135,7 +146,7 @@ export const takeawayGoodsColumn = options => {
{ {
title: '企业价格', title: '企业价格',
dataIndex: 'activityPrice', dataIndex: 'activityPrice',
width: 120, width: 100,
align: 'center', align: 'center',
hideInSearch: true, hideInSearch: true,
render: (_, record) => ( render: (_, record) => (
...@@ -155,14 +166,14 @@ export const takeawayGoodsColumn = options => { ...@@ -155,14 +166,14 @@ export const takeawayGoodsColumn = options => {
{ {
title: '商品销售价', title: '商品销售价',
dataIndex: 'price', dataIndex: 'price',
width: 120, width: 100,
align: 'center', align: 'center',
hideInSearch: true, hideInSearch: true,
}, },
{ {
title: '状态', title: '状态',
dataIndex: 'status', dataIndex: 'status',
width: 120, width: 80,
align: 'center', align: 'center',
hideInSearch: true, hideInSearch: true,
valueEnum: { valueEnum: {
...@@ -174,7 +185,7 @@ export const takeawayGoodsColumn = options => { ...@@ -174,7 +185,7 @@ export const takeawayGoodsColumn = options => {
{ {
title: '排序', title: '排序',
dataIndex: 'sort', dataIndex: 'sort',
width: 120, width: 80,
align: 'center', align: 'center',
hideInSearch: true, hideInSearch: true,
render: (_, record) => ( render: (_, record) => (
...@@ -194,7 +205,7 @@ export const takeawayGoodsColumn = options => { ...@@ -194,7 +205,7 @@ export const takeawayGoodsColumn = options => {
{ {
title: '列出商品', title: '列出商品',
dataIndex: 'showFlag', dataIndex: 'showFlag',
width: 120, width: 80,
align: 'center', align: 'center',
hideInSearch: true, hideInSearch: true,
render: (_, record) => ( render: (_, record) => (
...@@ -208,7 +219,7 @@ export const takeawayGoodsColumn = options => { ...@@ -208,7 +219,7 @@ export const takeawayGoodsColumn = options => {
{ {
title: '餐品类型', title: '餐品类型',
dataIndex: 'mealType', dataIndex: 'mealType',
width: 120, width: 80,
align: 'center', align: 'center',
hideInSearch: true, hideInSearch: true,
}, },
...@@ -218,6 +229,9 @@ export const takeawayGoodsColumn = options => { ...@@ -218,6 +229,9 @@ export const takeawayGoodsColumn = options => {
width: 120, width: 120,
valueType: 'dateRange', valueType: 'dateRange',
align: 'center', align: 'center',
render(v, record) {
return record.createDate;
},
}, },
{ {
title: '当日餐段', title: '当日餐段',
...@@ -244,11 +258,11 @@ export const takeawayGoodsColumn = options => { ...@@ -244,11 +258,11 @@ export const takeawayGoodsColumn = options => {
}; };
export const GoodsInfoColumn = options => { export const GoodsInfoColumn = options => {
const { onDel, setVisibleSaleDate, setVisibleSaleSection, setEditID } = options; const { onDel, setVisibleSaleDate, setVisibleSaleSection, setEditID, setVisiblePrice } = options;
return [ return [
{ {
title: '微店名称', title: '微店名称',
dataIndex: 'shopId', dataIndex: 'shopName',
}, },
{ {
title: '商品名称', title: '商品名称',
...@@ -263,9 +277,22 @@ export const GoodsInfoColumn = options => { ...@@ -263,9 +277,22 @@ export const GoodsInfoColumn = options => {
}, },
{ {
title: '企业价格', title: '企业价格',
dataIndex: 'activityPrice', dataIndex: 'enterprisePrice',
width: 120, width: 120,
align: 'center', align: 'center',
render: (_, record) => (
<Space>
<span>{_}</span>
<span
onClick={() => {
setEditID(record.skuId);
setVisiblePrice(true);
}}
>
<FormOutlined />
</span>
</Space>
),
}, },
{ {
title: '库存', title: '库存',
...@@ -302,7 +329,7 @@ export const GoodsInfoColumn = options => { ...@@ -302,7 +329,7 @@ export const GoodsInfoColumn = options => {
}, },
{ {
title: '可售餐段', title: '可售餐段',
dataIndex: 'mealType', dataIndex: 'tabCate',
align: 'center', align: 'center',
hideInSearch: true, hideInSearch: true,
render: (_, record) => ( render: (_, record) => (
...@@ -321,10 +348,16 @@ export const GoodsInfoColumn = options => { ...@@ -321,10 +348,16 @@ export const GoodsInfoColumn = options => {
}, },
{ {
title: '餐品类型', title: '餐品类型',
dataIndex: 'mealType', dataIndex: 'mealTypeList',
width: 120, width: 120,
align: 'center', align: 'center',
hideInSearch: true, hideInSearch: true,
render(arr) {
if (arr && arr.length) {
return arr.map(item => item.name).join('/');
}
return '-';
},
}, },
{ {
title: '操作', title: '操作',
...@@ -386,3 +419,139 @@ export const SelectGoodsColumn = [ ...@@ -386,3 +419,139 @@ export const SelectGoodsColumn = [
hideInSearch: true, hideInSearch: true,
}, },
]; ];
// 企业虚拟商品列表字段
export const virtualGoodsColumn = options => {
const { onDel, enterprises, onChangeEnterprise } = options;
return [
{
title: '企业名称',
dataIndex: 'enterpriseId',
hideInTable: true,
fieldProps: {
showSearch: true,
filterOption: (v, option) => (option?.label ?? '').toLowerCase().includes(v.toLowerCase()),
onChange: onChangeEnterprise,
},
valueEnum: enterprises, // companyEnum,
},
{
title: '微店名称',
dataIndex: 'shopId',
hideInTable: true,
fieldProps: {
showSearch: true,
filterOption: false,
onSearch: getShopList,
},
// request: getShopList,
valueEnum: {}, // shopEnum,
},
{
title: 'SKU编码',
dataIndex: 'skuId',
width: 160,
align: 'center',
},
{
title: '商品名称',
dataIndex: 'skuName',
align: 'center',
},
{
title: '商品图片',
dataIndex: 'primaryImage',
width: 80,
align: 'center',
hideInSearch: true,
valueType: 'image',
},
{
title: '可售日期',
dataIndex: 'saleDateList',
width: 120,
align: 'center',
hideInSearch: true,
render: (_, record) => (
<Space>
{_ && _.length && (
<div>
{_.length === 7 ? '不限制' : <span>{_.map(item => item.name).join('/')}</span>}
</div>
)}
</Space>
),
},
{
title: '可售餐段',
dataIndex: 'tabCateList',
width: 120,
align: 'center',
hideInSearch: true,
render: (_, record) => (
<Space>{_ && _.length && <span>{_.map(item => item.tabName).join('/')}</span>}</Space>
),
},
{
title: '企业价格',
dataIndex: 'activityPrice',
width: 100,
align: 'center',
hideInSearch: true,
render: (_, record) => (
<Space>
<span>{_}</span>
</Space>
),
},
{
title: '商品销售价',
dataIndex: 'price',
width: 100,
align: 'center',
hideInSearch: true,
},
{
title: '状态',
dataIndex: 'status',
width: 80,
align: 'center',
hideInSearch: true,
valueEnum: {
1: '生效中',
2: '已下架',
3: '已售罄',
},
},
{
title: '餐品类型',
dataIndex: 'mealType',
width: 80,
align: 'center',
hideInSearch: true,
},
{
title: '添加时间',
dataIndex: 'createDate',
width: 120,
valueType: 'dateRange',
align: 'center',
render(v, record) {
return record.createDate;
},
},
{
title: '操作',
hideInSearch: true,
dataIndex: 'action',
width: '100px',
align: 'center',
fixed: 'right',
render: (val, r) => (
<Button key="del" onClick={() => onDel(r.id)}>
删除
</Button>
),
},
];
};
...@@ -17,48 +17,60 @@ import { getToUrlQuery } from '@/utils/utils'; ...@@ -17,48 +17,60 @@ import { getToUrlQuery } from '@/utils/utils';
const TakeawayGoods = () => { const TakeawayGoods = () => {
const history = useHistory(); const history = useHistory();
const refTable = useRef(); const refTable = useRef();
const [pageLoading, setPageLoading] = useState(true); // 可售日期弹窗 const [pageLoaded, setPageLoaded] = useState(false); // 可售日期弹窗
const [visibleSaleDate, setVisibleSaleDate] = useState(false); // 可售日期弹窗 const [visibleSaleDate, setVisibleSaleDate] = useState(false); // 可售日期弹窗
const [visibleSaleSection, setVisibleSaleSection] = useState(false); // 可售餐段弹窗 const [visibleSaleSection, setVisibleSaleSection] = useState(false); // 可售餐段弹窗
const [visiblePrice, setVisiblePrice] = useState(false); // 修改企业商品价格弹窗 const [visiblePrice, setVisiblePrice] = useState(false); // 修改企业商品价格弹窗
const [visibleSort, setVisibleSort] = useState(false); // 商品排序弹窗 const [visibleSort, setVisibleSort] = useState(false); // 商品排序弹窗
const [enterprises, setEnterprises] = useState({ 1: { text: '领红包' } }); // 企业列表 const [enterprises, setEnterprises] = useState({}); // 企业列表
const [shopEnum, setShopEnum] = useState({}); // 店铺列表 const [shopEnum, setShopEnum] = useState({}); // 店铺列表
const [activeKey, setActiveKey] = useState(''); const [activeKey, setActiveKey] = useState('');
const [enterpriseId, setEnterpriseId] = useState('1'); const [enterpriseId, setEnterpriseId] = useState();
const [pickSelfList, setPickSelfList] = useState([]); // 取餐点列表 const [pickSelfList, setPickSelfList] = useState([]); // 取餐点列表
const [recordID, setRecordID] = useState(''); // 编辑的记录ID const [recordID, setRecordID] = useState(''); // 编辑的记录ID
// 刷新列表
const onRefresh = () => {
if (pageLoaded) {
refTable.current.reloadAndRest();
// refTable.current.reload();
}
};
// 搜索商品列表 // 搜索商品列表
const searchList = async params => { const searchList = async params => {
if (params.enterpriseId && params.enterpriseId !== enterpriseId) {
setEnterpriseId(params.enterpriseId);
}
const data = { const data = {
page: params.current, page: params.current || 1,
size: params.pageSize, size: params.pageSize || 10,
data: Object.assign( data: Object.assign({}, params, {
{ enterpriseId,
enterpriseId, pickSelfId: activeKey,
}, }),
params,
),
}; };
const res = await apiTakeawayList(data); const res = await apiTakeawayList(data);
if (res && res.records) {
return {
data: res.records || [],
total: res.total || 0,
};
}
return { return {
data: res.records, data: [],
total: res.total, total: 0,
}; };
}; };
// 删除商品
const onDel = async id => { const onDel = async id => {
await apiMealInfoDel({ await apiMealInfoDel({
id, id,
}); });
refTable.current.reload();
notification.success({ notification.success({
message: '删除成功', message: '删除成功',
}); });
}; };
const onAdd = async () => { // 跳转添加商品
const toAdd = async () => {
const params = getToUrlQuery(); const params = getToUrlQuery();
const query = Object.assign( const query = Object.assign(
{ {
...@@ -72,7 +84,7 @@ const TakeawayGoods = () => { ...@@ -72,7 +84,7 @@ const TakeawayGoods = () => {
query, query,
}); });
}; };
// 修改商品是否列出
const onChangeFlag = async (id, checked) => { const onChangeFlag = async (id, checked) => {
const params = { const params = {
id, id,
...@@ -80,28 +92,33 @@ const TakeawayGoods = () => { ...@@ -80,28 +92,33 @@ const TakeawayGoods = () => {
}; };
await apiMealInfoUpdate(params); await apiMealInfoUpdate(params);
notification.success({ message: '保存成功' }); notification.success({ message: '保存成功' });
onRefresh();
}; };
// 根据企业ID获取取餐点 // 根据企业ID获取取餐点
const getPickSelf = async id => { const getPickSelf = async id => {
const res = await apiSelPickSelfList({ enterpriseId: id }); const res = await apiSelPickSelfList({ enterpriseId: id });
if (res) { if (res && res.data && res.data.length) {
setPickSelfList( setPickSelfList(
res.map(item => ({ res.data.map(item => ({
key: item.pickSelfId, key: `${item.pickSelfId}`,
label: <span>{item.pickSelfName}</span>, label: <span>{item.pickSelfName}</span>,
})), })),
); );
setActiveKey(res[0].pickSelfId); const pid = res.data[0].pickSelfId;
setActiveKey(`${pid}`);
if (pageLoaded) {
onRefresh();
}
} else {
setPickSelfList([]);
setActiveKey('');
if (pageLoaded) {
onRefresh();
}
} }
}; };
// 根据企业ID获取取餐点
// const getShops = async () => {
// const res = await getShopList({});
// setShopEnum(res.list);
// };
// 改变企业 // 改变企业
const onChangeEnterprise = v => { const onChangeEnterprise = v => {
setEnterpriseId(v); setEnterpriseId(v);
...@@ -113,18 +130,14 @@ const TakeawayGoods = () => { ...@@ -113,18 +130,14 @@ const TakeawayGoods = () => {
const obj = await getEnterpriseList(); const obj = await getEnterpriseList();
if (obj.list && Object.keys(obj.list).length) { if (obj.list && Object.keys(obj.list).length) {
setEnterprises(obj.list); setEnterprises(obj.list);
setEnterpriseId(obj.id); setEnterpriseId(`${obj.id}`);
getPickSelf(obj.id); await getPickSelf(obj.id);
setPageLoading(true); setPageLoaded(true);
} }
}; };
useEffect(() => { useEffect(() => {
getList(); getList();
// getShops();
// setTimeout(() => {
// // refTable.current.reload();
// }, 1000);
}, []); }, []);
const options = { const options = {
...@@ -137,12 +150,13 @@ const TakeawayGoods = () => { ...@@ -137,12 +150,13 @@ const TakeawayGoods = () => {
enterprises, enterprises,
onChangeEnterprise, onChangeEnterprise,
onChangeFlag, onChangeFlag,
onRefresh,
shopEnum, shopEnum,
}; };
return ( return (
<div> <div className={utilStyle.formPageBox}>
{pageLoading && ( {pageLoaded && (
<ProTable <ProTable
search={{ search={{
span: 6, span: 6,
...@@ -165,11 +179,12 @@ const TakeawayGoods = () => { ...@@ -165,11 +179,12 @@ const TakeawayGoods = () => {
activeKey, activeKey,
items: pickSelfList, items: pickSelfList,
onChange: key => { onChange: key => {
setActiveKey(key); setActiveKey(`${key}`);
onRefresh();
}, },
}, },
actions: [ actions: [
<Button key="1" icon={<PlusOutlined />} type="primary" onClick={onAdd}> <Button key="1" icon={<PlusOutlined />} type="primary" onClick={toAdd}>
添加外卖商品 添加外卖商品
</Button>, </Button>,
], ],
...@@ -182,7 +197,7 @@ const TakeawayGoods = () => { ...@@ -182,7 +197,7 @@ const TakeawayGoods = () => {
<SaleDateModal <SaleDateModal
visible={visibleSaleDate} visible={visibleSaleDate}
id={recordID} id={recordID}
handleRefresh={() => searchList({})} handleRefresh={() => onRefresh()}
handleClose={() => setVisibleSaleDate(false)} handleClose={() => setVisibleSaleDate(false)}
/> />
)} )}
...@@ -191,7 +206,7 @@ const TakeawayGoods = () => { ...@@ -191,7 +206,7 @@ const TakeawayGoods = () => {
<SaleSectionModal <SaleSectionModal
visible={visibleSaleSection} visible={visibleSaleSection}
id={recordID} id={recordID}
handleRefresh={() => searchList({})} handleRefresh={() => onRefresh()}
handleClose={() => setVisibleSaleSection(false)} handleClose={() => setVisibleSaleSection(false)}
/> />
)} )}
...@@ -200,7 +215,7 @@ const TakeawayGoods = () => { ...@@ -200,7 +215,7 @@ const TakeawayGoods = () => {
<GoodPriceModal <GoodPriceModal
visible={visiblePrice} visible={visiblePrice}
id={recordID} id={recordID}
handleRefresh={() => searchList({})} handleRefresh={() => onRefresh()}
handleClose={() => setVisiblePrice(false)} handleClose={() => setVisiblePrice(false)}
/> />
)} )}
...@@ -209,7 +224,7 @@ const TakeawayGoods = () => { ...@@ -209,7 +224,7 @@ const TakeawayGoods = () => {
<GoodSortModal <GoodSortModal
visible={visibleSort} visible={visibleSort}
id={recordID} id={recordID}
handleRefresh={() => searchList({})} handleRefresh={() => onRefresh()}
handleClose={() => setVisibleSort(false)} handleClose={() => setVisibleSort(false)}
/> />
)} )}
......
...@@ -4,6 +4,7 @@ import { useHistory } from 'react-router-dom'; ...@@ -4,6 +4,7 @@ import { useHistory } from 'react-router-dom';
import { PageHeaderWrapper } from '@ant-design/pro-layout'; import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { GoodsInfoColumn } from './staticData/goods'; import { GoodsInfoColumn } from './staticData/goods';
import SaleDateModal from './components/SaleDateModal'; import SaleDateModal from './components/SaleDateModal';
import GoodPriceModal from './components/GoodPriceModal';
import SaleSectionModal from './components/SaleSectionModal'; import SaleSectionModal from './components/SaleSectionModal';
import SelectGoodsModal from './components/SelectGoodsModal'; import SelectGoodsModal from './components/SelectGoodsModal';
import { apiSelPickSelfList, apiPickSelfList, apiSaveGoodsList } from './service'; import { apiSelPickSelfList, apiPickSelfList, apiSaveGoodsList } from './service';
...@@ -17,10 +18,12 @@ const TakeawayGoodsInfo = props => { ...@@ -17,10 +18,12 @@ const TakeawayGoodsInfo = props => {
const [visibleSaleDate, setVisibleSaleDate] = useState(false); // 可售日期弹窗 const [visibleSaleDate, setVisibleSaleDate] = useState(false); // 可售日期弹窗
const [visibleSaleSection, setVisibleSaleSection] = useState(false); // 可售餐段弹窗 const [visibleSaleSection, setVisibleSaleSection] = useState(false); // 可售餐段弹窗
const [visibleSelectGoods, setVisibleSelectGoods] = useState(false); // 选择商品弹窗 const [visibleSelectGoods, setVisibleSelectGoods] = useState(false); // 选择商品弹窗
const [visiblePrice, setVisiblePrice] = useState(false); // 修改企业商品价格弹窗
const [dataSource, setDataSource] = useState([]); const [dataSource, setDataSource] = useState([]);
const [pickSelfList, setPickSelfList] = useState([]); // 取餐点列表 const [pickSelfList, setPickSelfList] = useState([]); // 取餐点列表
const [slePickSelf, setSelPickSelf] = useState([]); // 选中的取餐点列表 const [slePickSelf, setSelPickSelf] = useState([]); // 选中的取餐点列表
const [editID, setEditID] = useState(''); // 编辑ID const [editID, setEditID] = useState(''); // 编辑ID
const [shopId, setShopId] = useState(''); // 店铺ID
// 取消 // 取消
const onCancel = () => { const onCancel = () => {
...@@ -35,18 +38,21 @@ const TakeawayGoodsInfo = props => { ...@@ -35,18 +38,21 @@ const TakeawayGoodsInfo = props => {
const skuInfoList = dataSource.map(item => ({ const skuInfoList = dataSource.map(item => ({
skuId: item.skuId, skuId: item.skuId,
enterprisePrice: item.enterprisePrice, enterprisePrice: item.enterprisePrice,
mealTypeList: item.mealType, mealTypeList: item.mealTypeList.map(m => m.code),
saleDateList: item.saleDate, saleDateList: item.saleDate,
tabCateList: item.tabCate.map(t => ({ tabId: t })),
})); }));
const params = { const params = {
shopId: id, shopId,
enterpriseId: id, enterpriseId: id,
pickSelfIdList: slePickSelf, pickSelfIdList: slePickSelf,
skuInfoList, skuInfoList,
}; };
await apiSaveGoodsList(params); const res = await apiSaveGoodsList(params);
notification.success({ message: '添加成功' }); if (res && res.success) {
onCancel(); notification.success({ message: '添加成功' });
onCancel();
}
}; };
// 删除 // 删除
...@@ -74,7 +80,7 @@ const TakeawayGoodsInfo = props => { ...@@ -74,7 +80,7 @@ const TakeawayGoodsInfo = props => {
enterpriseId: id, enterpriseId: id,
}); });
if (res && res.data) { if (res && res.data) {
setSelPickSelf(res.map(item => item.pickSelfId)); setSelPickSelf(res.data.map(item => item.pickSelfId));
} }
}; };
...@@ -115,6 +121,7 @@ const TakeawayGoodsInfo = props => { ...@@ -115,6 +121,7 @@ const TakeawayGoodsInfo = props => {
setVisibleSaleSection, setVisibleSaleSection,
setEditID, setEditID,
onDel, onDel,
setVisiblePrice,
}; };
return ( return (
...@@ -176,7 +183,11 @@ const TakeawayGoodsInfo = props => { ...@@ -176,7 +183,11 @@ const TakeawayGoodsInfo = props => {
批量配置餐段 批量配置餐段
</Button> </Button>
</div> </div>
<Table columns={GoodsInfoColumn(options)} dataSource={dataSource} /> <Table
columns={GoodsInfoColumn(options)}
pagination={false}
dataSource={dataSource}
/>
</Col> </Col>
</Row> </Row>
<Row className={style['info-box--btns']}> <Row className={style['info-box--btns']}>
...@@ -205,10 +216,18 @@ const TakeawayGoodsInfo = props => { ...@@ -205,10 +216,18 @@ const TakeawayGoodsInfo = props => {
{visibleSaleSection && ( {visibleSaleSection && (
<SaleSectionModal <SaleSectionModal
visible={visibleSaleSection} visible={visibleSaleSection}
handleRefresh={v => refreshList('mealType', v)} handleRefresh={v => refreshList('tabCate', v)}
handleClose={() => setVisibleSaleSection(false)} handleClose={() => setVisibleSaleSection(false)}
/> />
)} )}
{/* 修改企业商品价格弹窗 */}
{visiblePrice && (
<GoodPriceModal
visible={visiblePrice}
handleRefresh={v => refreshList('enterprisePrice', v)}
handleClose={() => setVisiblePrice(false)}
/>
)}
{/* 选择商品弹窗 */} {/* 选择商品弹窗 */}
{visibleSelectGoods && ( {visibleSelectGoods && (
<SelectGoodsModal <SelectGoodsModal
...@@ -216,6 +235,8 @@ const TakeawayGoodsInfo = props => { ...@@ -216,6 +235,8 @@ const TakeawayGoodsInfo = props => {
enterpriseId={id} enterpriseId={id}
productType={5} productType={5}
pickSelfIdList={slePickSelf} pickSelfIdList={slePickSelf}
shopID={shopId}
onChangeShop={setShopId}
onSelectChange={setDataSource} onSelectChange={setDataSource}
handleClose={() => setVisibleSelectGoods(false)} handleClose={() => setVisibleSelectGoods(false)}
/> />
......
...@@ -3,110 +3,105 @@ import { useHistory } from 'react-router-dom'; ...@@ -3,110 +3,105 @@ import { useHistory } from 'react-router-dom';
import { ProTable } from '@ant-design/pro-components'; import { ProTable } from '@ant-design/pro-components';
import { Button, notification } from 'antd'; import { Button, notification } from 'antd';
import { PlusOutlined } from '@ant-design/icons'; import { PlusOutlined } from '@ant-design/icons';
import { takeawayGoodsColumn } from './staticData/goods'; import { virtualGoodsColumn } from './staticData/goods';
import utilStyle from '@/utils/utils.less'; import utilStyle from '@/utils/utils.less';
import { apiVirtualList, apiSelPickSelfList, apiMealInfoDel, apiMealInfoUpdate } from './service'; import { apiVirtualList, apiSelPickSelfList, apiMealInfoDel } from './service';
import { getEnterpriseList } from './service/bll'; import { getEnterpriseList, getShopList } from './service/bll';
import SaleDateModal from './components/SaleDateModal';
import SaleSectionModal from './components/SaleSectionModal';
import GoodPriceModal from './components/GoodPriceModal';
import GoodSortModal from './components/GoodSortModal';
import { getToUrlQuery } from '@/utils/utils'; import { getToUrlQuery } from '@/utils/utils';
// 企业虚拟商品 // 企业虚拟商品
const VirtualGoods = () => { const VirtualGoods = () => {
const history = useHistory(); const history = useHistory();
const refTable = useRef(); const refTable = useRef();
const [pageLoading, setPageLoading] = useState(true); // 可售日期弹窗 const [pageLoaded, setPageLoaded] = useState(false);
const [visibleSaleDate, setVisibleSaleDate] = useState(false); // 可售日期弹窗 const [enterprises, setEnterprises] = useState({}); // 企业列表
const [visibleSaleSection, setVisibleSaleSection] = useState(false); // 可售餐段弹窗
const [visiblePrice, setVisiblePrice] = useState(false); // 修改企业商品价格弹窗
const [visibleSort, setVisibleSort] = useState(false); // 商品排序弹窗
const [enterprises, setEnterprises] = useState([]); // 企业列表
const [activeKey, setActiveKey] = useState(''); const [activeKey, setActiveKey] = useState('');
const [enterpriseId, setEnterpriseId] = useState(''); const [enterpriseId, setEnterpriseId] = useState();
const [pickSelfList, setPickSelfList] = useState([]); // 取餐点列表
const [recordID, setRecordID] = useState(''); // 编辑的记录ID // 刷新列表
// const onRefresh = () => {
// if (pageLoaded) {
// refTable.current.reloadAndRest();
// // refTable.current.reload();
// }
// };
// 搜索商品列表 // 搜索商品列表
const searchList = async params => { const searchList = async params => {
if (params.enterpriseId && params.enterpriseId !== enterpriseId) { const data = {
setEnterpriseId(params.enterpriseId); page: params.current || 1,
size: params.pageSize || 10,
data: Object.assign({}, params, {
enterpriseId,
pickSelfId: activeKey,
}),
};
const res = await apiVirtualList(data);
if (res && res.records) {
return {
data: res.records || [],
total: res.total || 0,
};
} }
// const data = { return {
// page: params.current, data: [],
// size: params.pageSize, total: 0,
// data: params, };
// };
// return apiVirtualList(data);
}; };
// 删除商品
const onDel = async id => { const onDel = async id => {
await apiMealInfoDel({ await apiMealInfoDel({
id, id,
}); });
refTable.current.reload();
notification.success({ notification.success({
message: '删除成功', message: '删除成功',
}); });
}; };
const onAdd = async () => { // 跳转添加商品
const query = getToUrlQuery(); const toAdd = async () => {
const params = getToUrlQuery();
const query = Object.assign(
{
id: enterpriseId,
name: enterprises[enterpriseId].text,
},
params,
);
history.push({ history.push({
pathname: '/takeawayGoodsInfo', pathname: '/takeawayGoodsInfo',
query, query,
}); });
}; };
const onChangeFlag = async (id, checked) => { // 改变企业
const params = { const onChangeEnterprise = v => {
id, setEnterpriseId(v);
showFlag: checked ? 1 : 0,
};
await apiMealInfoUpdate(params);
notification.success({ message: '保存成功' });
};
const options = {
setVisibleSaleDate,
setVisibleSaleSection,
setVisiblePrice,
setVisibleSort,
onDel,
setRecordID,
enterprises,
onChangeFlag,
};
// 根据企业ID获取取餐点
const getPickSelf = async () => {
const res = await apiSelPickSelfList({});
setPickSelfList(
res.map(item => ({
key: item.pickSelfId,
label: <span>{item.pickSelfName}</span>,
})),
);
setActiveKey(res[0].pickSelfId);
}; };
// 获取企业列表 // 获取企业列表
const getList = async name => { const getList = async () => {
const obj = await getEnterpriseList(name); const obj = await getEnterpriseList();
setEnterprises(obj.list); if (obj.list && Object.keys(obj.list).length) {
setEnterpriseId(obj.id); setEnterprises(obj.list);
getPickSelf(obj.id); setEnterpriseId(`${obj.id}`);
setPageLoading(true); setPageLoaded(true);
}
}; };
useEffect(() => { useEffect(() => {
getList(''); getList();
// setTimeout(() => {
// // refTable.current.reload();
// }, 1000);
}, []); }, []);
const options = {
onDel,
enterprises,
onChangeEnterprise,
};
return ( return (
<div> <div className={utilStyle.formPageBox}>
{pageLoading && ( {pageLoaded && (
<ProTable <ProTable
search={{ search={{
span: 6, span: 6,
...@@ -116,7 +111,7 @@ const VirtualGoods = () => { ...@@ -116,7 +111,7 @@ const VirtualGoods = () => {
}} }}
actionRef={refTable} actionRef={refTable}
tableClassName={utilStyle.formTable} tableClassName={utilStyle.formTable}
columns={takeawayGoodsColumn(options)} columns={virtualGoodsColumn(options)}
request={params => searchList({ ...params })} request={params => searchList({ ...params })}
rowKey={r => r.id} rowKey={r => r.id}
expandIconColumnIndex={10} expandIconColumnIndex={10}
...@@ -124,59 +119,15 @@ const VirtualGoods = () => { ...@@ -124,59 +119,15 @@ const VirtualGoods = () => {
options={false} options={false}
form={{ initialValues: { enterpriseId } }} form={{ initialValues: { enterpriseId } }}
toolbar={{ toolbar={{
menu: {
type: 'tab',
activeKey,
items: pickSelfList,
onChange: key => {
setActiveKey(key);
},
},
actions: [ actions: [
<Button key="1" icon={<PlusOutlined />} type="primary" onClick={onAdd}> <Button key="1" icon={<PlusOutlined />} type="primary" onClick={toAdd}>
添加外卖商品 添加虚拟商品
</Button>, </Button>,
], ],
}} }}
scroll={{ x: '100%', y: 400 }} scroll={{ x: '100%', y: 400 }}
/> />
)} )}
{/* 可售日期弹窗 */}
{visibleSaleDate && (
<SaleDateModal
visible={visibleSaleDate}
id={recordID}
handleRefresh={() => searchList({})}
handleClose={() => setVisibleSaleDate(false)}
/>
)}
{/* 可售餐段弹窗 */}
{visibleSaleSection && (
<SaleSectionModal
visible={visibleSaleSection}
id={recordID}
handleRefresh={() => searchList({})}
handleClose={() => setVisibleSaleSection(false)}
/>
)}
{/* 修改企业商品价格弹窗 */}
{visiblePrice && (
<GoodPriceModal
visible={visiblePrice}
id={recordID}
handleRefresh={() => searchList({})}
handleClose={() => setVisiblePrice(false)}
/>
)}
{/* 商品排序弹窗 */}
{visibleSort && (
<GoodSortModal
visible={visibleSort}
id={recordID}
handleRefresh={() => searchList({})}
handleClose={() => setVisibleSort(false)}
/>
)}
</div> </div>
); );
}; };
......
...@@ -11,7 +11,7 @@ import { apiSaveVirtualGoodsList, apiShopListByEnterpriseID } from './service'; ...@@ -11,7 +11,7 @@ import { apiSaveVirtualGoodsList, apiShopListByEnterpriseID } from './service';
import style from './style/index.less'; import style from './style/index.less';
const VirtualGoodsInfo = props => { const VirtualGoodsInfo = props => {
const { id } = props.location.query; const { id, name } = props.location.query;
const history = useHistory(); const history = useHistory();
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [visibleSaleDate, setVisibleSaleDate] = useState(false); // 可售日期弹窗 const [visibleSaleDate, setVisibleSaleDate] = useState(false); // 可售日期弹窗
...@@ -35,22 +35,25 @@ const VirtualGoodsInfo = props => { ...@@ -35,22 +35,25 @@ const VirtualGoodsInfo = props => {
const skuInfoList = dataSource.map(item => ({ const skuInfoList = dataSource.map(item => ({
skuId: item.skuId, skuId: item.skuId,
enterprisePrice: item.enterprisePrice, enterprisePrice: item.enterprisePrice,
mealTypeList: item.mealType, mealTypeList: item.mealTypeList.map(m => m.code),
saleDateList: item.saleDate, saleDateList: item.saleDate,
tabCateList: item.tabCate.map(t => ({ tabId: t })),
})); }));
const params = { const params = {
shopId: sleShopID,
enterpriseId: id, enterpriseId: id,
skuInfoList, skuInfoList,
}; };
await apiSaveVirtualGoodsList(params); const res = await apiSaveVirtualGoodsList(params);
notification.success({ message: '添加成功' }); if (res && res.success) {
onCancel(); notification.success({ message: '添加成功' });
onCancel();
}
}; };
// 删除 // 删除
const onDel = i => { const onDel = i => {
const arr = dataSource.splice(i, 1); const arr = [...dataSource];
arr.splice(i, 1);
setDataSource(arr); setDataSource(arr);
}; };
...@@ -59,12 +62,14 @@ const VirtualGoodsInfo = props => { ...@@ -59,12 +62,14 @@ const VirtualGoodsInfo = props => {
const res = await apiShopListByEnterpriseID({ const res = await apiShopListByEnterpriseID({
enterpriseId: id, enterpriseId: id,
}); });
setShopList( if (res && res.data) {
res.map(item => ({ setShopList(
key: item.id, res.data.map(item => ({
label: <span>{item.name}</span>, value: item.id,
})), label: item.name,
); })),
);
}
}; };
// 刷新列表数据 // 刷新列表数据
...@@ -104,7 +109,7 @@ const VirtualGoodsInfo = props => { ...@@ -104,7 +109,7 @@ const VirtualGoodsInfo = props => {
<Col span={3} className={style['info-box--label']}> <Col span={3} className={style['info-box--label']}>
企业名称: 企业名称:
</Col> </Col>
<Col span={20}>企业名称111</Col> <Col span={20}>{name}</Col>
</Row> </Row>
<Row className={style['info-box--line']}> <Row className={style['info-box--line']}>
<Col span={3} className={style['info-box--label']}> <Col span={3} className={style['info-box--label']}>
...@@ -116,6 +121,7 @@ const VirtualGoodsInfo = props => { ...@@ -116,6 +121,7 @@ const VirtualGoodsInfo = props => {
options={shopList} options={shopList}
className={style['info-box--select']} className={style['info-box--select']}
placeholder="清选择" placeholder="清选择"
value={sleShopID}
onChange={setSelShopID} onChange={setSelShopID}
filterOption={(input, option) => filterOption={(input, option) =>
(option?.label ?? '').toLowerCase().includes(input.toLowerCase()) (option?.label ?? '').toLowerCase().includes(input.toLowerCase())
...@@ -135,24 +141,6 @@ const VirtualGoodsInfo = props => { ...@@ -135,24 +141,6 @@ const VirtualGoodsInfo = props => {
</Row> </Row>
<Row className={style['info-box--line']}> <Row className={style['info-box--line']}>
<Col span={24}> <Col span={24}>
<div className={style['info-box--batch-btn']}>
<Button
onClick={() => {
setEditID('');
setVisibleSaleDate(true);
}}
>
批量配置日期
</Button>
<Button
onClick={() => {
setEditID('');
setVisibleSaleSection(true);
}}
>
批量配置餐段
</Button>
</div>
<Table columns={GoodsInfoColumn(options)} dataSource={dataSource} /> <Table columns={GoodsInfoColumn(options)} dataSource={dataSource} />
</Col> </Col>
</Row> </Row>
...@@ -191,6 +179,9 @@ const VirtualGoodsInfo = props => { ...@@ -191,6 +179,9 @@ const VirtualGoodsInfo = props => {
<SelectGoodsModal <SelectGoodsModal
visible={visibleSelectGoods} visible={visibleSelectGoods}
type="virtual" type="virtual"
enterpriseId={id}
productType={2}
shopID={sleShopID}
onSelectChange={setDataSource} onSelectChange={setDataSource}
handleClose={() => setVisibleSelectGoods(false)} handleClose={() => setVisibleSelectGoods(false)}
/> />
......
...@@ -183,7 +183,7 @@ export const getErrorMessage = err => { ...@@ -183,7 +183,7 @@ export const getErrorMessage = err => {
// 获取地址栏参数,name:参数名称 // 获取地址栏参数,name:参数名称
export const getUrlParams = name => { export const getUrlParams = name => {
const regArg = new RegExp(`(^|&)${name}=([^&]*)(&|$)`); const regArg = new RegExp(`(^|&)${name}=([^&]*)(&|$)`);
const r = window.location.search.substr(1).match(regArg); const r = window.location.search.substring(1).match(regArg);
if (r != null) return decodeURIComponent(r[2]); if (r != null) return decodeURIComponent(r[2]);
return null; return null;
}; };
......
...@@ -59,3 +59,7 @@ ...@@ -59,3 +59,7 @@
.formTable { .formTable {
padding: 0; padding: 0;
} }
.formPageBox {
box-sizing: border-box;
padding: 20px;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment