Commit 10f7fb21 authored by 武广's avatar 武广

fix: 修改获取列表接口

parent ad8efe20
......@@ -14,7 +14,7 @@ module.exports = {
'@typescript-eslint/no-unused-vars': ['off'],
'import/no-unresolved': 0,
'import/extensions': 0,
'no-unused-expressions': ['error', { allowShortCircuit: true }],
'no-unused-expressions': ['off'],
'template-curly-spacing': 'off',
},
};
......@@ -28,6 +28,8 @@ import DraftModal from './DraftModal';
import Takeaway from './Takeaway';
import { GOOD_MANAGE } from '@/../config/permission.config';
import LocalStroage from '@/utils/localStorage';
import configApi from '@/../config/env.config';
@connect(({ goodsManage, menu }) => ({
goodsManage,
......@@ -123,6 +125,15 @@ class goodsManage extends Component {
this.handleSearch(page);
};
audit = skuId => {
this.setState({
previewVisible: true,
src: `${configApi.prologueDomain}/goods/${skuId}?h=0&token=${LocalStroage.get(
'token',
)}&hideReport=1&time=${Date.now()}`,
});
};
onPageSizeChange = (current, size) => {
this.setState(
{
......
......@@ -55,14 +55,19 @@ const SaleDateModal = props => {
};
// 获取店铺餐段通过企业ID
const getEnterpriseMealColumn = async () => {
const getEnterpriseMealColumn = async valueList => {
setLoading(true);
const res = await apiEnterpriseInfo(props.enterpriseID);
setLoading(false);
if (res && res.data && res.data.mealTimePeriod && res.data.mealTimePeriod.length) {
const arr = res.data.mealTimePeriod.map(item => `${item.mealPeriodType}`);
setTabCateList(arr);
setValue(arr);
// 餐段的值需在企业配置的可选餐段之内
const v = [];
valueList.forEach(t => {
arr.includes(t) && v.push(t);
});
setValue(v);
}
};
......@@ -86,7 +91,7 @@ const SaleDateModal = props => {
}
setValue(v);
if (props.enterpriseID) {
getEnterpriseMealColumn();
getEnterpriseMealColumn(v);
}
}
}, [props.visible]);
......
......@@ -18,12 +18,11 @@ const VirtualGoods = () => {
const [enterpriseId, setEnterpriseId] = useState();
// 刷新列表
// const onRefresh = () => {
// if (pageLoaded) {
// refTable.current.reloadAndRest();
// // refTable.current.reload();
// }
// };
const onRefresh = () => {
if (pageLoaded) {
refTable?.current?.reloadAndRest();
}
};
// 搜索商品列表
const searchList = async params => {
......@@ -80,6 +79,7 @@ const VirtualGoods = () => {
// 改变企业
const onChangeEnterprise = v => {
setEnterpriseId(v);
onRefresh();
};
// 获取企业列表
......@@ -105,6 +105,11 @@ const VirtualGoods = () => {
onChangeEnterprise,
};
let request = () => [];
if (enterpriseId) {
request = params => searchList({ ...params });
}
return (
<div className={utilStyle.formPageBox}>
{pageLoaded && (
......@@ -118,11 +123,10 @@ const VirtualGoods = () => {
actionRef={refTable}
tableClassName={utilStyle.formTable}
columns={virtualGoodsColumn(options)}
request={params => searchList({ ...params })}
request={request}
rowKey={r => r.id}
bordered
options={false}
form={{ initialValues: { enterpriseId } }}
scroll={{ x: 1300 }}
toolbar={{
actions: [
......
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