Commit e3206489 authored by 武广's avatar 武广

feat: 添加虚拟商品逻辑

parent 63fda8bf
...@@ -25,8 +25,8 @@ export default [ ...@@ -25,8 +25,8 @@ export default [
}, },
{ {
title: '商户管理后台-企业团餐-虚拟商品-添加商品', title: '商户管理后台-企业团餐-虚拟商品-添加商品',
path: '/takeawayGoodsInfo', path: '/virtualGoodsInfo',
name: 'TakeawayGoodsInfo', name: 'VirtualGoodsInfo',
component: './businessGoods/virtualGoodsInfo', component: './businessGoods/virtualGoodsInfo',
}, },
]; ];
...@@ -51,11 +51,13 @@ const CustomerInfo = props => { ...@@ -51,11 +51,13 @@ const CustomerInfo = props => {
}; };
// 校验时间 // 校验时间
const checkTime = (arr, curren) => { const checkTime = (arr, curren, curName) => {
let valid = false; let valid = false;
arr.forEach(item => { arr.forEach(item => {
if (curren > item.beginTime && curren < item.endTime) { if (curren < item.endTime) {
valid = true; valid = true;
const name = meals[item.mealPeriodType];
notification.error({ message: `${curName}起始时间不能早于${name}截止时间` });
} }
}); });
return valid; return valid;
...@@ -79,19 +81,19 @@ const CustomerInfo = props => { ...@@ -79,19 +81,19 @@ const CustomerInfo = props => {
const arr = []; const arr = [];
let validTime = false; let validTime = false;
res.mealTimePeriod.forEach(item => { res.mealTimePeriod.forEach(item => {
if (item.mealPeriodType) { if (item && meals[item.mealPeriodType]) {
const obj = Object.assign({}, item); const obj = Object.assign({}, item);
obj.beginTime = moment(obj.time[0]).format('HH:mm'); obj.beginTime = moment(obj.time[0]).format('HH:mm');
obj.endTime = moment(obj.time[1]).format('HH:mm'); obj.endTime = moment(obj.time[1]).format('HH:mm');
delete obj.time; delete obj.time;
if (checkTime(arr, obj.beginTime) || checkTime(arr, obj.endTime)) { if (checkTime(arr, obj.beginTime, meals[item.mealPeriodType])) {
validTime = true; validTime = true;
} }
arr.push(obj); arr.push(obj);
} }
}); });
if (validTime) { if (validTime) {
notification.error({ message: '时间段不能交叉!' }); // notification.error({ message: '时间段不能交叉!' });
return; return;
} }
params.mealTimePeriod = arr; params.mealTimePeriod = arr;
...@@ -107,18 +109,27 @@ const CustomerInfo = props => { ...@@ -107,18 +109,27 @@ const CustomerInfo = props => {
} }
// 处理限额 // 处理限额
Object.keys(res.mealLimit).forEach(item => { Object.keys(res.mealLimit).forEach(item => {
const json = { const mealPeriodType = item.replace('limit', '');
mealPeriodType: item.replace('limit', ''), if (meals[mealPeriodType]) {
limit: [], const json = {
}; mealPeriodType,
Object.keys(res.mealLimit[item]).forEach(t => { limit: [],
json.limit.push({ };
mealType: t, Object.keys(res.mealLimit[item]).forEach(t => {
limit: res.mealLimit[item][t], if (mealTypes.includes(t)) {
json.limit.push({
mealType: t,
limit: res.mealLimit[item][t],
});
}
}); });
}); limits.push(json);
limits.push(json); }
}); });
if (limits.length < 1) {
notification.error({ message: '请选择餐段配置!' });
return;
}
params.mealLimit = limits; params.mealLimit = limits;
console.log('params :>> ', params); console.log('params :>> ', params);
let api = apiNewEnterprise; let api = apiNewEnterprise;
...@@ -127,7 +138,7 @@ const CustomerInfo = props => { ...@@ -127,7 +138,7 @@ const CustomerInfo = props => {
api = apiEditEnterprise; api = apiEditEnterprise;
} }
const resp = await api(params); const resp = await api(params);
if (resp) { if (resp && resp.data) {
handleCancel(); handleCancel();
props.reFresh(); props.reFresh();
notification.success({ message: '保存成功!' }); notification.success({ message: '保存成功!' });
...@@ -158,7 +169,6 @@ const CustomerInfo = props => { ...@@ -158,7 +169,6 @@ const CustomerInfo = props => {
if (props.info && props.info.id && ms.length < mealTypes.length) { if (props.info && props.info.id && ms.length < mealTypes.length) {
await checkConfirm(); await checkConfirm();
} }
console.log('ms :>> ', ms);
if (mealTypes.length > ms.length) { if (mealTypes.length > ms.length) {
if (ms.includes('1') && ms.includes('2')) { if (ms.includes('1') && ms.includes('2')) {
ms = ['1', '2']; ms = ['1', '2'];
......
...@@ -12,7 +12,8 @@ const SaleDateModal = props => { ...@@ -12,7 +12,8 @@ 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(props.shopID);
const [shopName, setShopName] = useState('');
const [searchName, setSearchName] = useState(''); const [searchName, setSearchName] = useState('');
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [page, setPage] = useState(1); const [page, setPage] = useState(1);
...@@ -90,21 +91,25 @@ const SaleDateModal = props => { ...@@ -90,21 +91,25 @@ const SaleDateModal = props => {
notification.error({ message: '请选择要添加的商品' }); notification.error({ message: '请选择要添加的商品' });
return; return;
} }
let shopName = ''; let sName = '';
if (shopList) { if (shopList && shopList.length) {
shopList.forEach(item => { shopList.forEach(item => {
if (+item.value === +shopId) { if (+item.value === +shopId) {
shopName = item.label; sName = item.label;
} }
}); });
} else {
sName = shopName;
} }
const arr = deepClone(selectedRows).map(item => ({ const arr = deepClone(selectedRows).map(item => ({
...item, ...item,
shopId, shopId,
shopName, shopName: sName,
})); }));
props.onSelectChange(arr); props.onSelectChange(arr);
props.onChangeShop(shopId); if (!props.shopID) {
props.onChangeShop(shopId);
}
handleCancel(); handleCancel();
}; };
...@@ -220,7 +225,13 @@ const SaleDateModal = props => { ...@@ -220,7 +225,13 @@ const SaleDateModal = props => {
]; ];
useEffect(() => { useEffect(() => {
getShopList(); if (+props.productType === 5) {
getShopList();
} else {
setShopId(props.shopID);
setShopName(props.shopName);
searchList({});
}
// setGoodsType(props.productType); // setGoodsType(props.productType);
}, []); }, []);
...@@ -236,13 +247,17 @@ const SaleDateModal = props => { ...@@ -236,13 +247,17 @@ const SaleDateModal = props => {
footer={footers()} footer={footers()}
> >
<div className={style['select-goods-box']}> <div className={style['select-goods-box']}>
<Select {props.productType === 5 ? (
placeholder="请选择店铺" <Select
options={shopList} placeholder="请选择店铺"
value={shopId} options={shopList}
onChange={onChangeShop} value={shopId}
className={style['select-goods-box--select']} onChange={onChangeShop}
/> className={style['select-goods-box--select']}
/>
) : (
<Input disabled value={shopName} className={style['select-goods-box--txt']} />
)}
<Select <Select
placeholder="请选择商品类型" placeholder="请选择商品类型"
disabled disabled
......
...@@ -24,23 +24,19 @@ export const getEnterpriseList = async () => { ...@@ -24,23 +24,19 @@ export const getEnterpriseList = async () => {
}; };
}; };
// 获取店铺列表 // 获取店铺列表
export const getShopList = debounce(async e => { export const getShopList = async e => {
const res = await apiShopList({ name: e }); if (e.keyWords) {
if (res && res.data && res.data.records) { const res = await apiShopList({ name: e.keyWords });
const data = res.data.records; if (res && res.data) {
// const json = {}; const { data } = res;
// data.forEach(item => { return data.map(item => ({
// json[item.id] = { text: item.name }; value: item.id,
// }); label: item.name,
// return json; }));
return data.map(item => ({ }
value: item.id,
text: item.name,
}));
} }
// return {};
return []; return [];
}, 300); };
// 获取店铺列表通过自提点ID // 获取店铺列表通过自提点ID
export const getShopListByPickSelf = async e => { export const getShopListByPickSelf = async e => {
const { name } = e; const { name } = e;
......
...@@ -64,15 +64,25 @@ export async function apiMealInfoUpdate(param) { ...@@ -64,15 +64,25 @@ export async function apiMealInfoUpdate(param) {
}); });
} }
/** /**
* 企业团餐->删除 * 企业团餐->删除外卖商品
* http://yapi.quantgroups.com/project/389/interface/api/65109 * http://yapi.quantgroups.com/project/389/interface/api/65109
*/ */
export async function apiMealInfoDel(param) { export async function apiTakeawayGoodsDel(param) {
return request.post(`${apiPrefix}/product/enterprise/main/deleteById`, { return request.post(`${apiPrefix}/product/enterprise/main/deleteById`, {
data: param, data: param,
prefix: roleApi, prefix: roleApi,
}); });
} }
/**
* 企业团餐->删除虚拟商品
* http://yapi.quantgroups.com/project/389/interface/api/65109
*/
export async function apiVirtualGoodsDel(param) {
return request.post(`${apiPrefix}/product/enterprise/virtual/deleteById`, {
data: param,
prefix: roleApi,
});
}
/** /**
* 企业团餐->查询自提点列表 * 企业团餐->查询自提点列表
* http://yapi.quantgroups.com/project/389/interface/api/65494 * http://yapi.quantgroups.com/project/389/interface/api/65494
...@@ -127,7 +137,7 @@ export async function apiSaveGoodsList(param) { ...@@ -127,7 +137,7 @@ export async function apiSaveGoodsList(param) {
* http://yapi.quantgroups.com/project/389/interface/api/65484 * http://yapi.quantgroups.com/project/389/interface/api/65484
*/ */
export async function apiSaveVirtualGoodsList(param) { export async function apiSaveVirtualGoodsList(param) {
return request.post(`${apiPrefix}/products/enterprise/virtual/add`, { return request.post(`${apiPrefix}/product/enterprise/virtual/add`, {
data: param, data: param,
prefix: roleApi, prefix: roleApi,
}); });
......
...@@ -46,7 +46,6 @@ export const weekOptions = { ...@@ -46,7 +46,6 @@ export const weekOptions = {
export const takeawayGoodsColumn = options => { export const takeawayGoodsColumn = options => {
const { const {
onDel, onDel,
shopEnum,
onChangeFlag, onChangeFlag,
setVisibleSaleDate, setVisibleSaleDate,
enterprises, enterprises,
...@@ -66,7 +65,7 @@ export const takeawayGoodsColumn = options => { ...@@ -66,7 +65,7 @@ export const takeawayGoodsColumn = options => {
filterOption: (v, option) => (option?.label ?? '').toLowerCase().includes(v.toLowerCase()), filterOption: (v, option) => (option?.label ?? '').toLowerCase().includes(v.toLowerCase()),
onChange: onChangeEnterprise, onChange: onChangeEnterprise,
}, },
valueEnum: enterprises, // companyEnum, valueEnum: enterprises,
}, },
{ {
title: '微店名称', title: '微店名称',
...@@ -75,10 +74,10 @@ export const takeawayGoodsColumn = options => { ...@@ -75,10 +74,10 @@ export const takeawayGoodsColumn = options => {
fieldProps: { fieldProps: {
showSearch: true, showSearch: true,
filterOption: false, filterOption: false,
onSearch: getShopList, // onSearch: getShopList,
}, },
// request: getShopList, request: getShopList,
valueEnum: {}, // shopEnum, valueEnum: {},
}, },
{ {
title: 'SKU编码', title: 'SKU编码',
...@@ -177,7 +176,7 @@ export const takeawayGoodsColumn = options => { ...@@ -177,7 +176,7 @@ export const takeawayGoodsColumn = options => {
align: 'center', align: 'center',
hideInSearch: true, hideInSearch: true,
valueEnum: { valueEnum: {
1: '生效中', 1: '已上架',
2: '已下架', 2: '已下架',
3: '已售罄', 3: '已售罄',
}, },
...@@ -442,9 +441,9 @@ export const virtualGoodsColumn = options => { ...@@ -442,9 +441,9 @@ export const virtualGoodsColumn = options => {
fieldProps: { fieldProps: {
showSearch: true, showSearch: true,
filterOption: false, filterOption: false,
onSearch: getShopList, // onSearch: getShopList,
}, },
// request: getShopList, request: getShopList,
valueEnum: {}, // shopEnum, valueEnum: {}, // shopEnum,
}, },
{ {
...@@ -518,17 +517,23 @@ export const virtualGoodsColumn = options => { ...@@ -518,17 +517,23 @@ export const virtualGoodsColumn = options => {
align: 'center', align: 'center',
hideInSearch: true, hideInSearch: true,
valueEnum: { valueEnum: {
1: '生效中', 1: '已上架',
2: '已下架', 2: '已下架',
3: '已售罄', 3: '已售罄',
}, },
}, },
{ {
title: '餐品类型', title: '餐品类型',
dataIndex: 'mealType', dataIndex: 'mealTypeList',
width: 80, 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: '添加时间',
......
...@@ -5,8 +5,13 @@ import { Button, notification } from 'antd'; ...@@ -5,8 +5,13 @@ import { Button, notification } from 'antd';
import { PlusOutlined } from '@ant-design/icons'; import { PlusOutlined } from '@ant-design/icons';
import { takeawayGoodsColumn } from './staticData/goods'; import { takeawayGoodsColumn } from './staticData/goods';
import utilStyle from '@/utils/utils.less'; import utilStyle from '@/utils/utils.less';
import { apiTakeawayList, apiSelPickSelfList, apiMealInfoDel, apiMealInfoUpdate } from './service'; import {
import { getEnterpriseList, getShopList } from './service/bll'; apiTakeawayList,
apiSelPickSelfList,
apiTakeawayGoodsDel,
apiMealInfoUpdate,
} from './service';
import { getEnterpriseList } from './service/bll';
import SaleDateModal from './components/SaleDateModal'; import SaleDateModal from './components/SaleDateModal';
import SaleSectionModal from './components/SaleSectionModal'; import SaleSectionModal from './components/SaleSectionModal';
import GoodPriceModal from './components/GoodPriceModal'; import GoodPriceModal from './components/GoodPriceModal';
...@@ -23,7 +28,6 @@ const TakeawayGoods = () => { ...@@ -23,7 +28,6 @@ const TakeawayGoods = () => {
const [visiblePrice, setVisiblePrice] = useState(false); // 修改企业商品价格弹窗 const [visiblePrice, setVisiblePrice] = useState(false); // 修改企业商品价格弹窗
const [visibleSort, setVisibleSort] = useState(false); // 商品排序弹窗 const [visibleSort, setVisibleSort] = useState(false); // 商品排序弹窗
const [enterprises, setEnterprises] = useState({}); // 企业列表 const [enterprises, setEnterprises] = useState({}); // 企业列表
const [shopEnum, setShopEnum] = useState({}); // 店铺列表
const [activeKey, setActiveKey] = useState(''); const [activeKey, setActiveKey] = useState('');
const [enterpriseId, setEnterpriseId] = useState(); const [enterpriseId, setEnterpriseId] = useState();
const [pickSelfList, setPickSelfList] = useState([]); // 取餐点列表 const [pickSelfList, setPickSelfList] = useState([]); // 取餐点列表
...@@ -39,6 +43,11 @@ const TakeawayGoods = () => { ...@@ -39,6 +43,11 @@ const TakeawayGoods = () => {
// 搜索商品列表 // 搜索商品列表
const searchList = async params => { const searchList = async params => {
if (params.createDate && params.createDate.length) {
const [startDateTime, endDateTime] = params.createDate;
params.startDateTime = startDateTime;
params.endDateTime = endDateTime;
}
const data = { const data = {
page: params.current || 1, page: params.current || 1,
size: params.pageSize || 10, size: params.pageSize || 10,
...@@ -61,7 +70,7 @@ const TakeawayGoods = () => { ...@@ -61,7 +70,7 @@ const TakeawayGoods = () => {
}; };
// 删除商品 // 删除商品
const onDel = async id => { const onDel = async id => {
await apiMealInfoDel({ await apiTakeawayGoodsDel({
id, id,
}); });
refTable.current.reload(); refTable.current.reload();
...@@ -151,7 +160,6 @@ const TakeawayGoods = () => { ...@@ -151,7 +160,6 @@ const TakeawayGoods = () => {
onChangeEnterprise, onChangeEnterprise,
onChangeFlag, onChangeFlag,
onRefresh, onRefresh,
shopEnum,
}; };
return ( return (
......
...@@ -5,8 +5,8 @@ import { Button, notification } from 'antd'; ...@@ -5,8 +5,8 @@ import { Button, notification } from 'antd';
import { PlusOutlined } from '@ant-design/icons'; import { PlusOutlined } from '@ant-design/icons';
import { virtualGoodsColumn } from './staticData/goods'; import { virtualGoodsColumn } from './staticData/goods';
import utilStyle from '@/utils/utils.less'; import utilStyle from '@/utils/utils.less';
import { apiVirtualList, apiSelPickSelfList, apiMealInfoDel } from './service'; import { apiVirtualList, apiVirtualGoodsDel } from './service';
import { getEnterpriseList, getShopList } from './service/bll'; import { getEnterpriseList } from './service/bll';
import { getToUrlQuery } from '@/utils/utils'; import { getToUrlQuery } from '@/utils/utils';
// 企业虚拟商品 // 企业虚拟商品
...@@ -15,7 +15,6 @@ const VirtualGoods = () => { ...@@ -15,7 +15,6 @@ const VirtualGoods = () => {
const refTable = useRef(); const refTable = useRef();
const [pageLoaded, setPageLoaded] = useState(false); const [pageLoaded, setPageLoaded] = useState(false);
const [enterprises, setEnterprises] = useState({}); // 企业列表 const [enterprises, setEnterprises] = useState({}); // 企业列表
const [activeKey, setActiveKey] = useState('');
const [enterpriseId, setEnterpriseId] = useState(); const [enterpriseId, setEnterpriseId] = useState();
// 刷新列表 // 刷新列表
...@@ -28,19 +27,23 @@ const VirtualGoods = () => { ...@@ -28,19 +27,23 @@ const VirtualGoods = () => {
// 搜索商品列表 // 搜索商品列表
const searchList = async params => { const searchList = async params => {
if (params.createDate && params.createDate.length) {
const [startDateTime, endDateTime] = params.createDate;
params.startDateTime = startDateTime;
params.endDateTime = endDateTime;
}
const data = { const data = {
page: params.current || 1, page: params.current || 1,
size: params.pageSize || 10, size: params.pageSize || 10,
data: Object.assign({}, params, { data: Object.assign({}, params, {
enterpriseId, enterpriseId,
pickSelfId: activeKey,
}), }),
}; };
const res = await apiVirtualList(data); const res = await apiVirtualList(data);
if (res && res.records) { if (res && res.data && res.data.records && res.data.records.length) {
return { return {
data: res.records || [], data: res.data.records || [],
total: res.total || 0, total: res.data.total || 0,
}; };
} }
return { return {
...@@ -50,7 +53,7 @@ const VirtualGoods = () => { ...@@ -50,7 +53,7 @@ const VirtualGoods = () => {
}; };
// 删除商品 // 删除商品
const onDel = async id => { const onDel = async id => {
await apiMealInfoDel({ await apiVirtualGoodsDel({
id, id,
}); });
refTable.current.reload(); refTable.current.reload();
...@@ -69,7 +72,7 @@ const VirtualGoods = () => { ...@@ -69,7 +72,7 @@ const VirtualGoods = () => {
params, params,
); );
history.push({ history.push({
pathname: '/takeawayGoodsInfo', pathname: '/virtualGoodsInfo',
query, query,
}); });
}; };
......
...@@ -3,7 +3,9 @@ import { Button, notification, Spin, Select, Row, Col, Table, message } from 'an ...@@ -3,7 +3,9 @@ import { Button, notification, Spin, Select, Row, Col, Table, message } from 'an
import { useHistory } from 'react-router-dom'; 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 { jsonToArray } from '@/utils/utils';
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 { apiSaveVirtualGoodsList, apiShopListByEnterpriseID } from './service'; import { apiSaveVirtualGoodsList, apiShopListByEnterpriseID } from './service';
...@@ -17,15 +19,27 @@ const VirtualGoodsInfo = props => { ...@@ -17,15 +19,27 @@ const VirtualGoodsInfo = 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 [shopList, setShopList] = useState([]); // 店铺列表 const [shopList, setShopList] = useState({}); // 店铺列表
const [sleShopID, setSelShopID] = useState(''); // 选中的店铺 const [sleShopID, setSelShopID] = useState(''); // 选中的店铺ID
const [sleShopName, setSelShopName] = useState(''); // 选中的店铺名称
const [editID, setEditID] = useState(''); // 编辑ID const [editID, setEditID] = useState(''); // 编辑ID
// 取消 // 取消
const onCancel = () => { const onCancel = () => {
history.goBack(); history.goBack();
}; };
// 打开选择商品弹窗
const openSelectModal = () => {
if (!sleShopID) {
message.error('请选择店铺');
return;
}
setVisibleSelectGoods(true);
};
// 提交 // 提交
const onSubmit = async () => { const onSubmit = async () => {
if (!dataSource || dataSource.length < 1) { if (!dataSource || dataSource.length < 1) {
...@@ -41,6 +55,7 @@ const VirtualGoodsInfo = props => { ...@@ -41,6 +55,7 @@ const VirtualGoodsInfo = props => {
})); }));
const params = { const params = {
enterpriseId: id, enterpriseId: id,
shopId: sleShopID,
skuInfoList, skuInfoList,
}; };
const res = await apiSaveVirtualGoodsList(params); const res = await apiSaveVirtualGoodsList(params);
...@@ -63,15 +78,20 @@ const VirtualGoodsInfo = props => { ...@@ -63,15 +78,20 @@ const VirtualGoodsInfo = props => {
enterpriseId: id, enterpriseId: id,
}); });
if (res && res.data) { if (res && res.data) {
setShopList( const json = {};
res.data.map(item => ({ res.data.forEach(item => {
value: item.id, json[item.id] = item.name;
label: item.name, });
})), setShopList(json);
);
} }
}; };
// 选中店铺
const onSelectShop = sid => {
setSelShopID(sid);
setSelShopName(shopList[sid]);
};
// 刷新列表数据 // 刷新列表数据
const refreshList = (type, v) => { const refreshList = (type, v) => {
const arr = dataSource.map(item => { const arr = dataSource.map(item => {
...@@ -98,6 +118,7 @@ const VirtualGoodsInfo = props => { ...@@ -98,6 +118,7 @@ const VirtualGoodsInfo = props => {
setVisibleSaleDate, setVisibleSaleDate,
setVisibleSaleSection, setVisibleSaleSection,
setEditID, setEditID,
setVisiblePrice,
onDel, onDel,
}; };
...@@ -118,11 +139,11 @@ const VirtualGoodsInfo = props => { ...@@ -118,11 +139,11 @@ const VirtualGoodsInfo = props => {
<Col span={20}> <Col span={20}>
<Select <Select
showSearch showSearch
options={shopList} options={jsonToArray(shopList)}
className={style['info-box--select']} className={style['info-box--select']}
placeholder="清选择" placeholder="清选择"
value={sleShopID} value={sleShopID}
onChange={setSelShopID} onChange={e => onSelectShop(e)}
filterOption={(input, option) => filterOption={(input, option) =>
(option?.label ?? '').toLowerCase().includes(input.toLowerCase()) (option?.label ?? '').toLowerCase().includes(input.toLowerCase())
} }
...@@ -134,7 +155,7 @@ const VirtualGoodsInfo = props => { ...@@ -134,7 +155,7 @@ const VirtualGoodsInfo = props => {
添加商品: 添加商品:
</Col> </Col>
<Col span={20}> <Col span={20}>
<Button type="primary" onClick={() => setVisibleSelectGoods(true)}> <Button type="primary" onClick={openSelectModal}>
选择商品 选择商品
</Button> </Button>
</Col> </Col>
...@@ -170,18 +191,27 @@ const VirtualGoodsInfo = props => { ...@@ -170,18 +191,27 @@ const VirtualGoodsInfo = 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
visible={visibleSelectGoods} visible={visibleSelectGoods}
type="virtual" type="virtual"
enterpriseId={id} enterpriseId={id}
productType={2} productType={4}
shopID={sleShopID} shopID={sleShopID}
shopName={sleShopName}
onSelectChange={setDataSource} onSelectChange={setDataSource}
handleClose={() => setVisibleSelectGoods(false)} handleClose={() => setVisibleSelectGoods(false)}
/> />
......
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