Commit 1aa8412c authored by 张子雨's avatar 张子雨

Merge branch 'feature/meal-3.0' of...

Merge branch 'feature/meal-3.0' of http://git.quantgroup.cn/ui/merchant-manage-ui into feature/meal-3.0
parents 97be610e 5141123b
const isProduction = process.env.NODE_ENV === 'production'; const isProduction = process.env.NODE_ENV === 'production';
const isPre = process.env.PRE_ENV === 'pre'; const isPre = process.env.PRE_ENV === 'pre';
const environment = 'sc'; const environment = 'sc';
// 从tob进入的判断接口前缀 // 从tob进入的判断接口前缀
const apiPrefix = const getUrlParams = name => {
sessionStorage.getItem('role') === 'platform' ? '/api/consoles' : '/api/merchants'; const regArg = new RegExp(`(^|&)${name}=([^&]*)(&|$)`);
const r = window.location.search.substr(1).match(regArg);
if (r != null) return decodeURIComponent(r[2]);
return null;
};
const isPlatForm = +getUrlParams('isMaster') === 1;
const apiPrefix = isPlatForm ? '/api/consoles' : '/api/merchants';
const envAPi = { const envAPi = {
api: `https://security-${environment}.liangkebang.net`, //'https://security-xyqb.liangkebang.net', api: `https://security-${environment}.liangkebang.net`, //'https://security-xyqb.liangkebang.net',
kdspOpApi: `https://sc-merchant-api-${environment}.liangkebang.net`, kdspOpApi: `https://sc-merchant-api-${environment}.liangkebang.net`,
...@@ -16,6 +24,9 @@ const envAPi = { ...@@ -16,6 +24,9 @@ const envAPi = {
wsApi: `wss://push-${environment}.liangkebang.net`, wsApi: `wss://push-${environment}.liangkebang.net`,
msgApi: `https://msgapi-${environment}.liangkebang.net`, msgApi: `https://msgapi-${environment}.liangkebang.net`,
keystoneApi: `https://sc-op-api-${environment}.liangkebang.net`, keystoneApi: `https://sc-op-api-${environment}.liangkebang.net`,
roleApi: isPlatForm
? `https://sc-op-api-${environment}.liangkebang.net`
: `https://sc-merchant-api-${environment}.liangkebang.net`,
apiPrefix, apiPrefix,
}; };
...@@ -35,6 +46,7 @@ const prodApi = { ...@@ -35,6 +46,7 @@ const prodApi = {
wsApi: 'wss://push.q-gp.com', wsApi: 'wss://push.q-gp.com',
msgApi: 'https://msgapi.q-gp.com', msgApi: 'https://msgapi.q-gp.com',
keystoneApi: '//sc-op-api.q-gp.com', keystoneApi: '//sc-op-api.q-gp.com',
roleApi: isPlatForm ? 'https://sc-op-api.q-gp.com' : 'https://sc-merchant-api-pre.q-gp.com',
apiPrefix, apiPrefix,
}; };
...@@ -50,6 +62,7 @@ const preProdApi = { ...@@ -50,6 +62,7 @@ const preProdApi = {
wsApi: 'wss://push.q-gp.com', wsApi: 'wss://push.q-gp.com',
msgApi: 'https://msgapi.q-gp.com', msgApi: 'https://msgapi.q-gp.com',
keystoneApi: '//sc-op-api-pre.q-gp.com', keystoneApi: '//sc-op-api-pre.q-gp.com',
roleApi: isPlatForm ? 'https://sc-op-api-pre.q-gp.com' : 'https://sc-merchant-api-pre.q-gp.com',
apiPrefix, apiPrefix,
}; };
...@@ -60,6 +73,7 @@ if (isPre) { ...@@ -60,6 +73,7 @@ if (isPre) {
exportApi = prodApi; exportApi = prodApi;
} }
module.exports = exportApi; module.exports = exportApi;
// let exportApi; // let exportApi;
// isProduction ? (exportApi = prodApi) : (exportApi = envAPi); // isProduction ? (exportApi = prodApi) : (exportApi = envAPi);
......
...@@ -11,12 +11,6 @@ export default [ ...@@ -11,12 +11,6 @@ export default [
name: 'TakeawayGoods', name: 'TakeawayGoods',
component: './businessGoods/takeawayGoods', component: './businessGoods/takeawayGoods',
}, },
{
title: '商户管理后台-企业团餐-外卖商品',
path: '/takeawayGoods',
name: 'TakeawayGoods',
component: './businessGoods/takeawayGoods',
},
{ {
title: '商户管理后台-企业团餐-外卖商品-添加商品', title: '商户管理后台-企业团餐-外卖商品-添加商品',
path: '/takeawayGoodsInfo', path: '/takeawayGoodsInfo',
......
...@@ -27,6 +27,7 @@ class SecurityLayout extends React.Component { ...@@ -27,6 +27,7 @@ class SecurityLayout extends React.Component {
/* eslint-disable no-underscore-dangle */ /* eslint-disable no-underscore-dangle */
render() { render() {
// 判断是否从tob进入 // 判断是否从tob进入
console.log('getUrlSearchParams -- 1 :>> ', 1111);
const searchPrams = getUrlSearchParams(); const searchPrams = getUrlSearchParams();
const isTob = searchPrams.source === 'tob'; const isTob = searchPrams.source === 'tob';
if (isTob) { if (isTob) {
......
...@@ -46,6 +46,7 @@ const CustomerInfo = props => { ...@@ -46,6 +46,7 @@ const CustomerInfo = props => {
// 关闭分组信息弹窗 // 关闭分组信息弹窗
const handleCancel = () => { const handleCancel = () => {
props.reFresh();
props.handleClose(false); props.handleClose(false);
}; };
...@@ -120,13 +121,17 @@ const CustomerInfo = props => { ...@@ -120,13 +121,17 @@ const CustomerInfo = props => {
}); });
params.mealLimit = limits; params.mealLimit = limits;
console.log('params :>> ', params); console.log('params :>> ', params);
// let api = apiNewEnterprise; let api = apiNewEnterprise;
// if (props.id) { if (props.id) {
// params.id = props.id; params.id = props.id;
// api = apiEditEnterprise; api = apiEditEnterprise;
// } }
// await api(params); const resp = await api(params);
if (resp) {
handleCancel();
props.reFresh();
notification.success({ message: '保存成功!' }); notification.success({ message: '保存成功!' });
}
}; };
// 风险提示 // 风险提示
...@@ -179,37 +184,33 @@ const CustomerInfo = props => { ...@@ -179,37 +184,33 @@ const CustomerInfo = props => {
}; };
// 改变餐段 // 改变餐段
const onChangeMealSection = e => { const onChangeMealSection = e => {
console.log('e.target :>> ', e.target);
const { id, checked, label } = e.target; const { id, checked, label } = e.target;
const values = Object.assign({}, meals); const values = Object.assign({}, meals);
if (checked) { if (checked) {
values[id] = label; values[id] = label;
// values.push(value);
// } else if (values.includes(value)) {
// const index = values.findIndex(v => v === value);
// values.splice(index, 1);
} else { } else {
delete values[id]; delete values[id];
} }
console.log('values :>> ', values);
setMeals(values); setMeals(values);
}; };
// 获取企业客户信息 // 获取企业客户信息
const getInfo = async () => { const getInfo = async () => {
const res = await apiEnterpriseInfo(props.id); const res = await apiEnterpriseInfo(props.id);
const obj = Object.assign({}, res); if (res && res.data) {
if (res.mealTimePeriod && res.mealTimePeriod.length) { const obj = Object.assign({}, res.data);
obj.mealTimePeriod = res.mealTimePeriod.map(item => ({ if (res.data.mealTimePeriod && res.data.mealTimePeriod.length) {
const m = moment().format('YYYY-MM-DD');
obj.mealTimePeriod = res.data.mealTimePeriod.map(item => ({
mealPeriodType: `${item.mealPeriodType}`, mealPeriodType: `${item.mealPeriodType}`,
time: [moment(item.beginTime), moment(item.endTime)], time: [moment(`${m} ${item.beginTime}`), moment(`${m} ${item.endTime}`)],
})); }));
} else { } else {
obj.mealTimePeriod = []; obj.mealTimePeriod = [];
} }
if (res.mealLimit) {
obj.mealLimit = {}; obj.mealLimit = {};
res.mealLimit.forEach(item => { if (res.data.mealLimit) {
res.data.mealLimit.forEach(item => {
obj.mealLimit[`limit${item.mealPeriodType}`] = {}; obj.mealLimit[`limit${item.mealPeriodType}`] = {};
item.limit.forEach(limit => { item.limit.forEach(limit => {
obj.mealLimit[`limit${item.mealPeriodType}`][limit.mealType] = limit.limit; obj.mealLimit[`limit${item.mealPeriodType}`][limit.mealType] = limit.limit;
...@@ -217,24 +218,36 @@ const CustomerInfo = props => { ...@@ -217,24 +218,36 @@ const CustomerInfo = props => {
}); });
} }
obj.hideInfo = []; obj.hideInfo = [];
if (+res.hidePrice) { if (+res.data.hidePrice) {
obj.hideInfo.push('hidePrice'); obj.hideInfo.push('hidePrice');
} }
if (+res.hideImage) { if (+res.data.hideImage) {
obj.hideInfo.push('hideImage'); obj.hideInfo.push('hideImage');
} }
obj.mealType = res.mealType.map(item => `${item}`); obj.mealType = res.data.mealType.map(item => `${item}`);
console.log('obj :>> ', obj);
setMealTypes(obj.mealType);
const json = {};
res.data.mealTimePeriod.forEach(item => {
json[item.mealPeriodType] = mealSections[item.mealPeriodType];
});
setMeals(json);
form.setFieldsValue(obj); form.setFieldsValue(obj);
}
}; };
// 获取自提点列表 // 获取自提点列表
const getPickSelf = async () => { const getPickSelf = async () => {
const res = await apiEnterprisePickSelf({}); const res = await apiEnterprisePickSelf({});
if (res && res.data && res.data.records) {
const data = res.data.records;
setPickSelfList( setPickSelfList(
res.map(item => ({ data.map(item => ({
[item.id]: { text: item.name }, value: item.id,
label: item.pickselfName,
})), })),
); );
}
}; };
useEffect(() => { useEffect(() => {
...@@ -242,9 +255,14 @@ const CustomerInfo = props => { ...@@ -242,9 +255,14 @@ const CustomerInfo = props => {
if (props.id) { if (props.id) {
getInfo(); getInfo();
} else { } else {
setMealTypes([]);
setMeals({});
form.resetFields();
getPickSelf(); getPickSelf();
} }
} else { } else {
setMealTypes([]);
setMeals({});
form.setFieldsValue({}); form.setFieldsValue({});
} }
}, [props.visible]); }, [props.visible]);
...@@ -274,7 +292,14 @@ const CustomerInfo = props => { ...@@ -274,7 +292,14 @@ const CustomerInfo = props => {
</Form.Item> </Form.Item>
{!props.id && ( {!props.id && (
<Form.Item label="企业取餐点" name="pickselfIds"> <Form.Item label="企业取餐点" name="pickselfIds">
<Select options={pickSelfList} /> <Select
options={pickSelfList}
mode="multiple"
showSearch
filterOption={(v, option) =>
(option?.label ?? '').toLowerCase().includes(v.toLowerCase())
}
/>
</Form.Item> </Form.Item>
)} )}
<Form.Item <Form.Item
...@@ -284,9 +309,7 @@ const CustomerInfo = props => { ...@@ -284,9 +309,7 @@ const CustomerInfo = props => {
rules={[{ required: true, message: '请输入企业截止时间!' }]} rules={[{ required: true, message: '请输入企业截止时间!' }]}
extra={<span>企业员工下单的截至时间,仅支持正整数,单位为分钟。</span>} extra={<span>企业员工下单的截至时间,仅支持正整数,单位为分钟。</span>}
> >
<Row>
<InputNumber min={0} max={600} addonAfter="分钟" /> <InputNumber min={0} max={600} addonAfter="分钟" />
</Row>
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label="餐品类型" label="餐品类型"
......
...@@ -9,16 +9,16 @@ const MealSection = props => ( ...@@ -9,16 +9,16 @@ const MealSection = props => (
<> <>
{Object.keys(mealSections).map((field, i) => ( {Object.keys(mealSections).map((field, i) => (
<Space key={field} align="baseline"> <Space key={field} align="baseline">
<Form.Item label="" name={[fields[i].name, 'mealPeriodType']}> <Form.Item label="" name={[i, 'mealPeriodType']}>
<MealCheckbox changeType={props.onChange} meals={props.meals} field={field} /> <MealCheckbox changeType={props.onChange} meals={props.meals} field={field} />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
name={[fields[i].name, 'time']} name={[i, 'time']}
rules={[ rules={
props.meals[field] ? { type: 'array', required: true, message: '请选择!' } : {}, props.meals[field] ? [{ type: 'array', required: true, message: '请选择!' }] : []
]} }
> >
<TimePicker.RangePicker format="HH:mm" /> <TimePicker.RangePicker format="HH:mm" minuteStep={30} />
</Form.Item> </Form.Item>
</Space> </Space>
))} ))}
......
...@@ -7,20 +7,30 @@ import CustomerInfo from './components/CustomerInfo'; ...@@ -7,20 +7,30 @@ import CustomerInfo from './components/CustomerInfo';
import { apiEnterpriseList } from './service'; import { apiEnterpriseList } from './service';
const BusinessCustomer = () => { const BusinessCustomer = () => {
const refTable = useRef();
const [visible, setVisible] = useState(false); const [visible, setVisible] = useState(false);
const [id, setId] = useState('');
const query = async params => { const query = async params => {
const data = { const data = {
page: params.current, page: params.current,
size: params.pageSize, size: params.pageSize,
data: params, data: params,
}; };
return apiEnterpriseList(data); const res = await apiEnterpriseList(data);
return {
data: res.data.records,
total: res.data.total,
};
};
const onEdit = v => {
setId(v);
setVisible(true);
}; };
const onEdit = async () => {};
return ( return (
<div> <div>
<ProTable <ProTable
actionRef={refTable}
search={{ search={{
collapsed: false, collapsed: false,
collapseRender: () => null, collapseRender: () => null,
...@@ -32,13 +42,26 @@ const BusinessCustomer = () => { ...@@ -32,13 +42,26 @@ const BusinessCustomer = () => {
bordered bordered
options={false} options={false}
toolBarRender={() => [ toolBarRender={() => [
<Button key="3" icon={<PlusOutlined />} type="primary" onClick={() => setVisible(!0)}> <Button
key="3"
icon={<PlusOutlined />}
type="primary"
onClick={() => {
setId('');
setVisible(!0);
}}
>
添加企业客户 添加企业客户
</Button>, </Button>,
]} ]}
scroll={{ x: '100%', y: 400 }} scroll={{ x: '100%', y: 400 }}
/> />
<CustomerInfo visible={visible} handleClose={setVisible} /> <CustomerInfo
visible={visible}
id={id}
reFresh={() => refTable.current.reload()}
handleClose={setVisible}
/>
</div> </div>
); );
}; };
......
...@@ -3,16 +3,16 @@ import config from '@/../config/env.config'; ...@@ -3,16 +3,16 @@ import config from '@/../config/env.config';
// import qs from 'qs'; // import qs from 'qs';
const { kdspApi, goodsApi } = config; const { roleApi, apiPrefix } = config;
/** /**
* 获取企业客户列表 * 获取企业客户列表
* http://yapi.quantgroups.com/project/389/interface/api/65324 * http://yapi.quantgroups.com/project/389/interface/api/65324
*/ */
export async function apiEnterpriseList(data) { export async function apiEnterpriseList(data) {
return request.post('/api/consoles/enterprise/pageList', { return request.post(`${apiPrefix}/enterprise/pageList`, {
data, data,
prefix: goodsApi, prefix: roleApi,
}); });
} }
/** /**
...@@ -20,8 +20,8 @@ export async function apiEnterpriseList(data) { ...@@ -20,8 +20,8 @@ export async function apiEnterpriseList(data) {
* http://yapi.quantgroups.com/project/389/interface/api/65339 * http://yapi.quantgroups.com/project/389/interface/api/65339
*/ */
export async function apiEnterpriseInfo(id) { export async function apiEnterpriseInfo(id) {
return request.get(`/api/consoles/enterprise/info?id=${id}`, { return request.get(`${apiPrefix}/enterprise/info?id=${id}`, {
prefix: goodsApi, prefix: roleApi,
}); });
} }
/** /**
...@@ -29,9 +29,9 @@ export async function apiEnterpriseInfo(id) { ...@@ -29,9 +29,9 @@ export async function apiEnterpriseInfo(id) {
* http://yapi.quantgroups.com/project/389/interface/api/65329 * http://yapi.quantgroups.com/project/389/interface/api/65329
*/ */
export async function apiNewEnterprise(data) { export async function apiNewEnterprise(data) {
return request.post('/api/consoles/enterprise/save', { return request.post(`${apiPrefix}/enterprise/save`, {
data, data,
prefix: goodsApi, prefix: roleApi,
}); });
} }
/** /**
...@@ -39,9 +39,9 @@ export async function apiNewEnterprise(data) { ...@@ -39,9 +39,9 @@ export async function apiNewEnterprise(data) {
* http://yapi.quantgroups.com/project/389/interface/api/65334 * http://yapi.quantgroups.com/project/389/interface/api/65334
*/ */
export async function apiEditEnterprise(data) { export async function apiEditEnterprise(data) {
return request.post('/api/consoles/enterprise/update', { return request.post(`${apiPrefix}/enterprise/update`, {
data, data,
prefix: goodsApi, prefix: roleApi,
}); });
} }
...@@ -49,9 +49,8 @@ export async function apiEditEnterprise(data) { ...@@ -49,9 +49,8 @@ export async function apiEditEnterprise(data) {
* 查询自提点列表 * 查询自提点列表
* http://yapi.quantgroups.com/project/389/interface/api/65494 * http://yapi.quantgroups.com/project/389/interface/api/65494
*/ */
export async function apiEnterprisePickSelf(data) { export async function apiEnterprisePickSelf() {
return request.post('/api/consoles/selfPickUpLocation/list', { return request.get(`${apiPrefix}/selfPickUpLocation/list`, {
data, prefix: roleApi,
prefix: goodsApi,
}); });
} }
...@@ -111,7 +111,7 @@ export const customerColumn = options => { ...@@ -111,7 +111,7 @@ export const customerColumn = options => {
align: 'center', align: 'center',
fixed: 'right', fixed: 'right',
render: (val, r) => ( render: (val, r) => (
<Button key="edit" onClick={() => onEdit(r, 'edit')}> <Button key="edit" onClick={() => onEdit(r.id)}>
编辑 编辑
</Button> </Button>
), ),
......
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { Select, Modal, Table, Input, Button, Pagination, notification } from 'antd'; import { Select, Modal, Table, Input, Button, Pagination, notification } from 'antd';
import { SearchOutlined } from '@ant-design/icons'; import { SearchOutlined } from '@ant-design/icons';
import { apiSelGoodsList, apiSelVirtualGoodsList } from '../service'; import { apiSelGoodsList, apiSelVirtualGoodsList, apiShopListByPickSelfID } from '../service';
import { getShopListByPickSelf } from '../service/bll'; import { getShopListByPickSelf } from '../service/bll';
import { SelectGoodsColumn, productType } from '../staticData/goods'; import { SelectGoodsColumn, productType } from '../staticData/goods';
import style from '../style/index.less'; import style from '../style/index.less';
...@@ -12,11 +12,12 @@ const SaleDateModal = props => { ...@@ -12,11 +12,12 @@ 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);
const [page, setPage] = useState(1); const [page, setPage] = useState(1);
const [pageSize, setPageSize] = useState(10); const [pageSize, setPageSize] = useState(10);
const [total, setTotal] = useState(0);
const [dataSource, setDataSource] = useState([]); const [dataSource, setDataSource] = useState([]);
const [shopList, setShopList] = useState(jsonToArray(productType)); const [shopList, setShopList] = useState(jsonToArray(productType));
const [selectedRowKeys, setSelectedRowKeys] = useState([]); const [selectedRowKeys, setSelectedRowKeys] = useState([]);
...@@ -41,7 +42,7 @@ const SaleDateModal = props => { ...@@ -41,7 +42,7 @@ const SaleDateModal = props => {
data: Object.assign( data: Object.assign(
{ {
shopId, shopId,
productType, productType: props.productType,
enterpriseId, enterpriseId,
}, },
searchObj, searchObj,
...@@ -54,7 +55,11 @@ const SaleDateModal = props => { ...@@ -54,7 +55,11 @@ const SaleDateModal = props => {
api = apiSelVirtualGoodsList; api = apiSelVirtualGoodsList;
} }
const res = await api(data); const res = await api(data);
setDataSource(res); console.log('res :>> ', res);
if (res && res.data && res.data.records) {
setDataSource(res.data.records);
setTotal(res.data.total);
}
setLoading(false); setLoading(false);
}; };
...@@ -84,7 +89,11 @@ const SaleDateModal = props => { ...@@ -84,7 +89,11 @@ const SaleDateModal = props => {
notification.error({ message: '请选择要添加的商品' }); notification.error({ message: '请选择要添加的商品' });
return; return;
} }
props.onSelectChange(deepClone(selectedRows)); const arr = deepClone(selectedRows).map(item => ({
...item,
shopId,
}));
props.onSelectChange(arr);
handleCancel(); handleCancel();
}; };
...@@ -147,11 +156,21 @@ const SaleDateModal = props => { ...@@ -147,11 +156,21 @@ const SaleDateModal = props => {
// 获取店铺列表 // 获取店铺列表
const getShopList = async () => { const getShopList = async () => {
const res = await getShopListByPickSelf({ const res = await apiShopListByPickSelfID({
enterpriseId: props.enterpriseId, enterpriseId: props.enterpriseId,
pickSelfIdList: props.pickSelfIdList, pickSelfIdList: props.pickSelfIdList,
}); });
setShopList(res); if (res && res.data) {
console.log('getShopList res :>> ', res);
setShopList(
res.data.map(item => ({
label: item.name,
value: item.id,
})),
);
// searchList({});
}
// setShopList(res);
}; };
const rowSelection = { const rowSelection = {
...@@ -168,7 +187,7 @@ const SaleDateModal = props => { ...@@ -168,7 +187,7 @@ const SaleDateModal = props => {
const selectAfter = <SearchOutlined onClick={onSearch} />; const selectAfter = <SearchOutlined onClick={onSearch} />;
const footers = () => [ const footers = () => [
<div className={style.footers}> <div className={style.footers}>
<Pagination defaultCurrent={6} total={500} 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']}>
已选商品(<span className={style['footers-num']}>{selectedRows.length}</span>) 已选商品(<span className={style['footers-num']}>{selectedRows.length}</span>)
...@@ -186,7 +205,6 @@ const SaleDateModal = props => { ...@@ -186,7 +205,6 @@ const SaleDateModal = props => {
useEffect(() => { useEffect(() => {
getShopList(); getShopList();
setGoodsType(props.productType); setGoodsType(props.productType);
searchList({});
}, []); }, []);
return ( return (
...@@ -211,7 +229,7 @@ const SaleDateModal = props => { ...@@ -211,7 +229,7 @@ const SaleDateModal = props => {
<Select <Select
placeholder="请选择商品类型" placeholder="请选择商品类型"
disabled disabled
value={goodsType} value={`${props.productType}`}
options={jsonToArray(productType)} options={jsonToArray(productType)}
className={style['select-goods-box--select']} className={style['select-goods-box--select']}
/> />
...@@ -226,6 +244,7 @@ const SaleDateModal = props => { ...@@ -226,6 +244,7 @@ const SaleDateModal = props => {
rowSelection={rowSelection} rowSelection={rowSelection}
rowKey="skuId" rowKey="skuId"
columns={SelectGoodsColumn} columns={SelectGoodsColumn}
pagination={false}
dataSource={dataSource} dataSource={dataSource}
/> />
</Modal> </Modal>
......
...@@ -2,34 +2,64 @@ import debounce from 'lodash/debounce'; ...@@ -2,34 +2,64 @@ import debounce from 'lodash/debounce';
import { apiEnterpriseList, apiShopList, apiShopListByPickSelfID } from './index'; import { apiEnterpriseList, apiShopList, apiShopListByPickSelfID } from './index';
// 获取企业列表 // 获取企业列表
export const getEnterpriseList = async (name = '') => { export const getEnterpriseList = async () => {
const res = await apiEnterpriseList({ name }); const res = await apiEnterpriseList({
page: 1,
size: 10000,
});
if (res && res.data && res.data.records) {
const data = res.data.records;
const json = {};
data.forEach(item => {
json[item.id] = { text: item.name };
});
return { return {
id: res[res.length - 1].id, id: data[data.length - 1].id,
list: res.map(item => ({ list: json,
[item.id]: { text: item.name }, };
})), }
return {
id: '',
list: {},
}; };
}; };
// 获取店铺列表 // 获取店铺列表
export const getShopList = debounce(async e => { export const getShopList = debounce(async e => {
const { name } = e; const { name } = e;
const res = await apiShopList({ name }); const res = await apiShopList({ name });
if (res && res.data && res.data.records) {
const data = res.data.records;
const json = {};
data.forEach(item => {
json[item.id] = { text: item.name };
});
return { return {
id: res[res.length - 1].id, id: res[res.length - 1].id,
list: res.map(item => ({ list: json,
[item.id]: { text: item.name }, };
})), }
return {
id: '',
list: {},
}; };
}, 300); }, 300);
// 获取店铺列表通过自提点ID // 获取店铺列表通过自提点ID
export const getShopListByPickSelf = async e => { export const getShopListByPickSelf = async e => {
const { name } = e; const { name } = e;
const res = await apiShopListByPickSelfID({ name }); const res = await apiShopListByPickSelfID({ name });
if (res && res.data && res.data.records) {
const data = res.data.records;
const json = {};
data.forEach(item => {
json[item.id] = { text: item.name };
});
return { return {
id: res[res.length - 1].id, id: res[res.length - 1].id,
list: res.map(item => ({ list: json,
[item.id]: { text: item.name }, };
})), }
return {
id: '',
list: {},
}; };
}; };
import request from '@/utils/request'; import request from '@/utils/request';
import config from '@/../config/env.config'; import config from '@/../config/env.config';
const { kdspApi, goodsApi, apiPrefix } = config; const { roleApi, apiPrefix } = config;
/** /**
* 获取企业外卖商品列表 * 获取企业外卖商品列表
* http://yapi.quantgroups.com/project/389/interface/api/64794 * http://yapi.quantgroups.com/project/389/interface/api/64794
*/ */
export async function apiTakeawayList(param) { export async function apiTakeawayList(param) {
return request.post(`${apiPrefix}/product/enterprise/main/pageList`, { const res = await request.post(`${apiPrefix}/product/enterprise/main/pageList`, {
data: param, data: param,
prefix: goodsApi, prefix: roleApi,
}); });
return res.data;
} }
/** /**
* 获取企业虚拟商品列表 * 获取企业虚拟商品列表
* http://yapi.quantgroups.com/project/389/interface/api/64794 * http://yapi.quantgroups.com/project/389/interface/api/64794
*/ */
export async function apiVirtualList(param) { export async function apiVirtualList(param) {
return request.post('/api/consoles/product/enterprise/virtual/pageList', { return request.post(`${apiPrefix}/product/enterprise/virtual/pageList`, {
data: param, data: param,
prefix: goodsApi, prefix: roleApi,
}); });
} }
/** /**
...@@ -27,9 +28,9 @@ export async function apiVirtualList(param) { ...@@ -27,9 +28,9 @@ export async function apiVirtualList(param) {
* http://yapi.quantgroups.com/project/389/interface/api/65324 * http://yapi.quantgroups.com/project/389/interface/api/65324
*/ */
export async function apiEnterpriseList(param) { export async function apiEnterpriseList(param) {
return request.post('/api/consoles/enterprise/pageList', { return request.post(`${apiPrefix}/enterprise/pageList`, {
data: param, data: param,
prefix: goodsApi, prefix: roleApi,
}); });
} }
/** /**
...@@ -37,9 +38,9 @@ export async function apiEnterpriseList(param) { ...@@ -37,9 +38,9 @@ export async function apiEnterpriseList(param) {
* http://yapi.quantgroups.com/project/389/interface/api/65289 * http://yapi.quantgroups.com/project/389/interface/api/65289
*/ */
export async function apiShopList(param) { export async function apiShopList(param) {
return request.post('/api/consoles/shops/getListByName', { return request.post(`${apiPrefix}/shops/getListByName`, {
data: param, data: param,
prefix: goodsApi, prefix: roleApi,
}); });
} }
/** /**
...@@ -47,9 +48,9 @@ export async function apiShopList(param) { ...@@ -47,9 +48,9 @@ export async function apiShopList(param) {
* http://yapi.quantgroups.com/project/389/interface/api/65444 * http://yapi.quantgroups.com/project/389/interface/api/65444
*/ */
export async function apiMealTimePeriod(param) { export async function apiMealTimePeriod(param) {
return request.post('/api/consoles/product/enterprise/getMealTimePeriod', { return request.post(`${apiPrefix}/product/enterprise/getMealTimePeriod`, {
data: param, data: param,
prefix: goodsApi, prefix: roleApi,
}); });
} }
/** /**
...@@ -57,9 +58,9 @@ export async function apiMealTimePeriod(param) { ...@@ -57,9 +58,9 @@ export async function apiMealTimePeriod(param) {
* http://yapi.quantgroups.com/project/389/interface/api/65099 * http://yapi.quantgroups.com/project/389/interface/api/65099
*/ */
export async function apiMealInfoUpdate(param) { export async function apiMealInfoUpdate(param) {
return request.post('/api/consoles/product/enterprise/main/update', { return request.post(`${apiPrefix}/product/enterprise/main/update`, {
data: param, data: param,
prefix: goodsApi, prefix: roleApi,
}); });
} }
/** /**
...@@ -67,9 +68,9 @@ export async function apiMealInfoUpdate(param) { ...@@ -67,9 +68,9 @@ 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 apiMealInfoDel(param) {
return request.post('/api/consoles/product/enterprise/main/deleteById', { return request.post(`${apiPrefix}/product/enterprise/main/deleteById`, {
data: param, data: param,
prefix: goodsApi, prefix: roleApi,
}); });
} }
/** /**
...@@ -77,8 +78,8 @@ export async function apiMealInfoDel(param) { ...@@ -77,8 +78,8 @@ export async function apiMealInfoDel(param) {
* http://yapi.quantgroups.com/project/389/interface/api/65494 * http://yapi.quantgroups.com/project/389/interface/api/65494
*/ */
export async function apiPickSelfList() { export async function apiPickSelfList() {
return request.get('/api/consoles/selfPickUpLocation/list', { return request.get(`${apiPrefix}/selfPickUpLocation/list`, {
prefix: goodsApi, prefix: roleApi,
}); });
} }
/** /**
...@@ -86,9 +87,9 @@ export async function apiPickSelfList() { ...@@ -86,9 +87,9 @@ export async function apiPickSelfList() {
* http://yapi.quantgroups.com/project/389/interface/api/65449 * http://yapi.quantgroups.com/project/389/interface/api/65449
*/ */
export async function apiSelPickSelfList(param) { export async function apiSelPickSelfList(param) {
return request.post('/api/consoles/product/enterprise/queryByEnterpriseId', { return request.post(`${apiPrefix}/product/enterprise/queryByEnterpriseId`, {
data: param, data: param,
prefix: goodsApi, prefix: roleApi,
}); });
} }
/** /**
...@@ -96,9 +97,9 @@ export async function apiSelPickSelfList(param) { ...@@ -96,9 +97,9 @@ export async function apiSelPickSelfList(param) {
* http://yapi.quantgroups.com/project/389/interface/api/65479 * http://yapi.quantgroups.com/project/389/interface/api/65479
*/ */
export async function apiSelGoodsList(param) { export async function apiSelGoodsList(param) {
return request.post('/api/consoles/product/enterprise/sku/page', { return request.post(`${apiPrefix}/product/enterprise/sku/page`, {
data: param, data: param,
prefix: goodsApi, prefix: roleApi,
}); });
} }
/** /**
...@@ -106,9 +107,9 @@ export async function apiSelGoodsList(param) { ...@@ -106,9 +107,9 @@ export async function apiSelGoodsList(param) {
* http://yapi.quantgroups.com/project/389/interface/api/65479 * http://yapi.quantgroups.com/project/389/interface/api/65479
*/ */
export async function apiSelVirtualGoodsList(param) { export async function apiSelVirtualGoodsList(param) {
return request.post('/api/consoles/product/enterprise/virtual/sku/page', { return request.post(`${apiPrefix}/product/enterprise/virtual/sku/page`, {
data: param, data: param,
prefix: goodsApi, prefix: roleApi,
}); });
} }
/** /**
...@@ -116,9 +117,9 @@ export async function apiSelVirtualGoodsList(param) { ...@@ -116,9 +117,9 @@ export async function apiSelVirtualGoodsList(param) {
* http://yapi.quantgroups.com/project/389/interface/api/65094 * http://yapi.quantgroups.com/project/389/interface/api/65094
*/ */
export async function apiSaveGoodsList(param) { export async function apiSaveGoodsList(param) {
return request.post('/api/consoles/product/enterprise/add', { return request.post(`${apiPrefix}/product/enterprise/add`, {
data: param, data: param,
prefix: goodsApi, prefix: roleApi,
}); });
} }
/** /**
...@@ -126,9 +127,9 @@ export async function apiSaveGoodsList(param) { ...@@ -126,9 +127,9 @@ 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('/api/consoles/products/enterprise/virtual/add', { return request.post(`${apiPrefix}/products/enterprise/virtual/add`, {
data: param, data: param,
prefix: goodsApi, prefix: roleApi,
}); });
} }
/** /**
...@@ -136,9 +137,9 @@ export async function apiSaveVirtualGoodsList(param) { ...@@ -136,9 +137,9 @@ export async function apiSaveVirtualGoodsList(param) {
* http://yapi.quantgroups.com/project/389/interface/api/65504 * http://yapi.quantgroups.com/project/389/interface/api/65504
*/ */
export async function apiShopListByEnterpriseID(param) { export async function apiShopListByEnterpriseID(param) {
return request.post('/api/consoles/product/enterprise/virtual/shops', { return request.post(`${apiPrefix}/product/enterprise/virtual/shops`, {
data: param, data: param,
prefix: goodsApi, prefix: roleApi,
}); });
} }
/** /**
...@@ -146,8 +147,8 @@ export async function apiShopListByEnterpriseID(param) { ...@@ -146,8 +147,8 @@ export async function apiShopListByEnterpriseID(param) {
* http://yapi.quantgroups.com/project/389/interface/api/65539 * http://yapi.quantgroups.com/project/389/interface/api/65539
*/ */
export async function apiShopListByPickSelfID(param) { export async function apiShopListByPickSelfID(param) {
return request.post('/api/consoles/product/enterprise/queryByEnterpriseIdAndPickSelfId', { return request.post(`${apiPrefix}/product/enterprise/queryByEnterpriseIdAndPickSelfId`, {
data: param, data: param,
prefix: goodsApi, prefix: roleApi,
}); });
} }
...@@ -48,6 +48,7 @@ export const takeawayGoodsColumn = options => { ...@@ -48,6 +48,7 @@ export const takeawayGoodsColumn = options => {
setVisiblePrice, setVisiblePrice,
setVisibleSaleSection, setVisibleSaleSection,
setVisibleSort, setVisibleSort,
onChangeEnterprise,
} = options; } = options;
return [ return [
{ {
...@@ -57,6 +58,7 @@ export const takeawayGoodsColumn = options => { ...@@ -57,6 +58,7 @@ export const takeawayGoodsColumn = options => {
fieldProps: { fieldProps: {
showSearch: true, showSearch: true,
filterOption: (v, option) => (option?.label ?? '').toLowerCase().includes(v.toLowerCase()), filterOption: (v, option) => (option?.label ?? '').toLowerCase().includes(v.toLowerCase()),
onChange: onChangeEnterprise,
}, },
valueEnum: enterprises, // companyEnum, valueEnum: enterprises, // companyEnum,
}, },
...@@ -67,7 +69,7 @@ export const takeawayGoodsColumn = options => { ...@@ -67,7 +69,7 @@ export const takeawayGoodsColumn = options => {
fieldProps: { fieldProps: {
showSearch: true, showSearch: true,
}, },
request: getShopList, // request: getShopList,
// valueEnum: {}, // shopEnum, // valueEnum: {}, // shopEnum,
}, },
{ {
...@@ -255,7 +257,7 @@ export const GoodsInfoColumn = options => { ...@@ -255,7 +257,7 @@ export const GoodsInfoColumn = options => {
}, },
{ {
title: '商品售价', title: '商品售价',
dataIndex: 'price', dataIndex: 'salePrice',
width: 120, width: 120,
align: 'center', align: 'center',
}, },
...@@ -267,9 +269,16 @@ export const GoodsInfoColumn = options => { ...@@ -267,9 +269,16 @@ export const GoodsInfoColumn = options => {
}, },
{ {
title: '库存', title: '库存',
dataIndex: 'status', dataIndex: 'stock',
width: 120, width: 120,
align: 'center', align: 'center',
render(v, record) {
const arr = record.supplierProductItemList;
if (arr && arr.length) {
return arr[0].stock;
}
return '-';
},
}, },
{ {
title: '可售日期', title: '可售日期',
...@@ -324,8 +333,8 @@ export const GoodsInfoColumn = options => { ...@@ -324,8 +333,8 @@ export const GoodsInfoColumn = options => {
width: '100px', width: '100px',
align: 'center', align: 'center',
fixed: 'right', fixed: 'right',
render: (val, r) => ( render: (val, r, i) => (
<Button key="del" onClick={() => onDel(r, 'del')}> <Button key="del" onClick={() => onDel(i)}>
删除 删除
</Button> </Button>
), ),
...@@ -337,36 +346,43 @@ export const SelectGoodsColumn = [ ...@@ -337,36 +346,43 @@ export const SelectGoodsColumn = [
{ {
title: '商品ID', title: '商品ID',
width: 120, width: 120,
align: 'center',
dataIndex: 'skuId', dataIndex: 'skuId',
}, },
{ {
title: '商品名称', title: '商品名称',
dataIndex: 'skuName', dataIndex: 'skuName',
width: 120,
align: 'center',
},
{
title: '商品编号',
dataIndex: 'skuNo',
width: 120,
align: 'center',
}, },
// {
// title: '商品编号',
// dataIndex: 'skuNo',
// width: 120,
// align: 'center',
// },
{ {
title: '销售价', title: '销售价',
dataIndex: 'price', dataIndex: 'salePrice',
width: 120, width: 120,
align: 'center', align: 'center',
}, },
{ {
title: '剩余库存', title: '剩余库存',
dataIndex: 'status', dataIndex: 'stock',
width: 120, width: 100,
align: 'center', align: 'center',
render(v, record) {
const arr = record.supplierProductItemList;
if (arr && arr.length) {
return arr[0].stock;
}
return '-';
},
}, },
{ {
title: '已参与活动', title: '已参与活动',
dataIndex: 'mealType', dataIndex: 'activity',
align: 'center', align: 'center',
width: 110,
hideInSearch: true, hideInSearch: true,
}, },
]; ];
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
text-align: right; text-align: right;
} }
&--select { &--select {
width: 100%;
min-width: 200px; min-width: 200px;
} }
&--btns { &--btns {
......
...@@ -6,7 +6,7 @@ import { PlusOutlined } from '@ant-design/icons'; ...@@ -6,7 +6,7 @@ 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 { apiTakeawayList, apiSelPickSelfList, apiMealInfoDel, apiMealInfoUpdate } from './service';
import { getEnterpriseList } from './service/bll'; import { getEnterpriseList, getShopList } 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';
...@@ -22,9 +22,10 @@ const TakeawayGoods = () => { ...@@ -22,9 +22,10 @@ const TakeawayGoods = () => {
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([]); // 企业列表 const [enterprises, setEnterprises] = useState({ 1: { text: '领红包' } }); // 企业列表
const [shopEnum, setShopEnum] = useState({}); // 店铺列表
const [activeKey, setActiveKey] = useState(''); const [activeKey, setActiveKey] = useState('');
const [enterpriseId, setEnterpriseId] = useState(''); const [enterpriseId, setEnterpriseId] = useState('1');
const [pickSelfList, setPickSelfList] = useState([]); // 取餐点列表 const [pickSelfList, setPickSelfList] = useState([]); // 取餐点列表
const [recordID, setRecordID] = useState(''); // 编辑的记录ID const [recordID, setRecordID] = useState(''); // 编辑的记录ID
...@@ -36,9 +37,18 @@ const TakeawayGoods = () => { ...@@ -36,9 +37,18 @@ const TakeawayGoods = () => {
const data = { const data = {
page: params.current, page: params.current,
size: params.pageSize, size: params.pageSize,
data: params, data: Object.assign(
{
enterpriseId,
},
params,
),
};
const res = await apiTakeawayList(data);
return {
data: res.records,
total: res.total,
}; };
return apiTakeawayList(data);
}; };
const onDel = async id => { const onDel = async id => {
await apiMealInfoDel({ await apiMealInfoDel({
...@@ -49,7 +59,14 @@ const TakeawayGoods = () => { ...@@ -49,7 +59,14 @@ const TakeawayGoods = () => {
}); });
}; };
const onAdd = async () => { const onAdd = async () => {
const query = getToUrlQuery(); const params = getToUrlQuery();
const query = Object.assign(
{
id: enterpriseId,
name: enterprises[enterpriseId].text,
},
params,
);
history.push({ history.push({
pathname: '/takeawayGoodsInfo', pathname: '/takeawayGoodsInfo',
query, query,
...@@ -65,20 +82,10 @@ const TakeawayGoods = () => { ...@@ -65,20 +82,10 @@ const TakeawayGoods = () => {
notification.success({ message: '保存成功' }); notification.success({ message: '保存成功' });
}; };
const options = {
setVisibleSaleDate,
setVisibleSaleSection,
setVisiblePrice,
setVisibleSort,
onDel,
setRecordID,
enterprises,
onChangeFlag,
};
// 根据企业ID获取取餐点 // 根据企业ID获取取餐点
const getPickSelf = async () => { const getPickSelf = async id => {
const res = await apiSelPickSelfList({}); const res = await apiSelPickSelfList({ enterpriseId: id });
if (res) {
setPickSelfList( setPickSelfList(
res.map(item => ({ res.map(item => ({
key: item.pickSelfId, key: item.pickSelfId,
...@@ -86,24 +93,53 @@ const TakeawayGoods = () => { ...@@ -86,24 +93,53 @@ const TakeawayGoods = () => {
})), })),
); );
setActiveKey(res[0].pickSelfId); setActiveKey(res[0].pickSelfId);
}
};
// 根据企业ID获取取餐点
// const getShops = async () => {
// const res = await getShopList({});
// setShopEnum(res.list);
// };
// 改变企业
const onChangeEnterprise = v => {
setEnterpriseId(v);
getPickSelf(v);
}; };
// 获取企业列表 // 获取企业列表
const getList = async name => { const getList = async () => {
const obj = await getEnterpriseList(name); const obj = await getEnterpriseList();
if (obj.list && Object.keys(obj.list).length) {
setEnterprises(obj.list); setEnterprises(obj.list);
setEnterpriseId(obj.id); setEnterpriseId(obj.id);
getPickSelf(obj.id); getPickSelf(obj.id);
setPageLoading(true); setPageLoading(true);
}
}; };
useEffect(() => { useEffect(() => {
getList(''); getList();
// getShops();
// setTimeout(() => { // setTimeout(() => {
// // refTable.current.reload(); // // refTable.current.reload();
// }, 1000); // }, 1000);
}, []); }, []);
const options = {
setVisibleSaleDate,
setVisibleSaleSection,
setVisiblePrice,
setVisibleSort,
onDel,
setRecordID,
enterprises,
onChangeEnterprise,
onChangeFlag,
shopEnum,
};
return ( return (
<div> <div>
{pageLoading && ( {pageLoading && (
......
...@@ -11,7 +11,7 @@ import { apiSelPickSelfList, apiPickSelfList, apiSaveGoodsList } from './service ...@@ -11,7 +11,7 @@ import { apiSelPickSelfList, apiPickSelfList, apiSaveGoodsList } from './service
import style from './style/index.less'; import style from './style/index.less';
const TakeawayGoodsInfo = props => { const TakeawayGoodsInfo = 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); // 可售日期弹窗
...@@ -51,31 +51,31 @@ const TakeawayGoodsInfo = props => { ...@@ -51,31 +51,31 @@ const TakeawayGoodsInfo = props => {
// 删除 // 删除
const onDel = i => { const onDel = i => {
const arr = dataSource.splice(i, 1); const arr = [...dataSource];
arr.splice(i, 1);
setDataSource(arr); setDataSource(arr);
}; };
// 根据企业ID获取取餐点 // 根据企业ID获取取餐点
const getPickSelf = async () => { const getPickSelf = async () => {
const res = await apiPickSelfList(); const res = await apiPickSelfList();
if (res && res.data && res.data.records) {
setPickSelfList( setPickSelfList(
res.map(item => ({ res.data.records.map(item => ({
key: item.pickSelfId, value: item.id,
label: <span>{item.pickSelfName}</span>, label: item.pickselfName,
})), })),
); );
}
}; };
// 根据企业ID获取已选取餐点 // 根据企业ID获取已选取餐点
const getSelPickSelf = async () => { const getSelPickSelf = async () => {
const res = await apiSelPickSelfList({ const res = await apiSelPickSelfList({
enterpriseId: id, enterpriseId: id,
}); });
setSelPickSelf( if (res && res.data) {
res.map(item => ({ setSelPickSelf(res.map(item => item.pickSelfId));
key: item.pickSelfId, }
label: <span>{item.pickSelfName}</span>,
})),
);
}; };
// 刷新列表数据 // 刷新列表数据
...@@ -93,6 +93,15 @@ const TakeawayGoodsInfo = props => { ...@@ -93,6 +93,15 @@ const TakeawayGoodsInfo = props => {
setDataSource(arr); setDataSource(arr);
}; };
// 显示选择商品弹窗
const onShowSelect = () => {
if (!slePickSelf || slePickSelf.length < 1) {
message.error('请选择取餐点!');
return;
}
setVisibleSelectGoods(true);
};
// const initData = async () => { // const initData = async () => {
// setLoading(true); // setLoading(true);
// }; // };
...@@ -116,7 +125,7 @@ const TakeawayGoodsInfo = props => { ...@@ -116,7 +125,7 @@ const TakeawayGoodsInfo = 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']}>
...@@ -129,6 +138,7 @@ const TakeawayGoodsInfo = props => { ...@@ -129,6 +138,7 @@ const TakeawayGoodsInfo = props => {
options={pickSelfList} options={pickSelfList}
className={style['info-box--select']} className={style['info-box--select']}
placeholder="清选择" placeholder="清选择"
value={slePickSelf}
onChange={setSelPickSelf} onChange={setSelPickSelf}
filterOption={(input, option) => filterOption={(input, option) =>
(option?.label ?? '').toLowerCase().includes(input.toLowerCase()) (option?.label ?? '').toLowerCase().includes(input.toLowerCase())
...@@ -141,7 +151,7 @@ const TakeawayGoodsInfo = props => { ...@@ -141,7 +151,7 @@ const TakeawayGoodsInfo = props => {
添加商品: 添加商品:
</Col> </Col>
<Col span={20}> <Col span={20}>
<Button type="primary" onClick={() => setVisibleSelectGoods(true)}> <Button type="primary" onClick={() => onShowSelect()}>
选择商品 选择商品
</Button> </Button>
</Col> </Col>
...@@ -203,6 +213,9 @@ const TakeawayGoodsInfo = props => { ...@@ -203,6 +213,9 @@ const TakeawayGoodsInfo = props => {
{visibleSelectGoods && ( {visibleSelectGoods && (
<SelectGoodsModal <SelectGoodsModal
visible={visibleSelectGoods} visible={visibleSelectGoods}
enterpriseId={id}
productType={5}
pickSelfIdList={slePickSelf}
onSelectChange={setDataSource} onSelectChange={setDataSource}
handleClose={() => setVisibleSelectGoods(false)} handleClose={() => setVisibleSelectGoods(false)}
/> />
......
...@@ -188,7 +188,7 @@ export const getUrlParams = name => { ...@@ -188,7 +188,7 @@ export const getUrlParams = name => {
return null; return null;
}; };
// 获取地址栏所参数 // 获取地址栏所参数
export const getUrlSearchParams = () => { export const getUrlSearchParams = () => {
const newObj = {}; const newObj = {};
const url = window.location.search; // 获取url中"?"符后的字符串 const url = window.location.search; // 获取url中"?"符后的字符串
...@@ -212,11 +212,13 @@ export const getToken = () => { ...@@ -212,11 +212,13 @@ export const getToken = () => {
// 获取跳转参数 // 获取跳转参数
export const getToUrlQuery = () => { export const getToUrlQuery = () => {
const params = getUrlSearchParams();
// 从消费地图后管过来 // 从消费地图后管过来
if (getUrlParams('source') === 'tob' && localStorage.get('tobToken')) { if (params.source) {
return { return {
source: 'tob', source: params.source,
token: localStorage.get('tobToken'), token: params.token,
isMaster: params.isMaster,
}; };
} }
return {}; return {};
......
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