Commit bf0c1fc1 authored by 武广's avatar 武广

feat: 添加发布刷新外卖列表

parent c3672f3a
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
"moment": "^2.24.0", "moment": "^2.24.0",
"omit.js": "^1.0.2", "omit.js": "^1.0.2",
"path-to-regexp": "^3.1.0", "path-to-regexp": "^3.1.0",
"pubsub-js": "^1.9.4",
"qs": "^6.9.0", "qs": "^6.9.0",
"react": "^16.8.6", "react": "^16.8.6",
"react-amap": "^1.2.8", "react-amap": "^1.2.8",
...@@ -28657,6 +28658,12 @@ ...@@ -28657,6 +28658,12 @@
"integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==", "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/pubsub-js": {
"version": "1.9.4",
"resolved": "http://npmprivate.quantgroups.com/pubsub-js/-/pubsub-js-1.9.4.tgz",
"integrity": "sha512-hJYpaDvPH4w8ZX/0Fdf9ma1AwRgU353GfbaVfPjfJQf1KxZ2iHaHl3fAUw1qlJIR5dr4F3RzjGaWohYUEyoh7A==",
"license": "MIT"
},
"node_modules/pump": { "node_modules/pump": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "http://npmprivate.quantgroups.com/pump/-/pump-3.0.0.tgz", "resolved": "http://npmprivate.quantgroups.com/pump/-/pump-3.0.0.tgz",
...@@ -59293,6 +59300,11 @@ ...@@ -59293,6 +59300,11 @@
} }
} }
}, },
"pubsub-js": {
"version": "1.9.4",
"resolved": "http://npmprivate.quantgroups.com/pubsub-js/-/pubsub-js-1.9.4.tgz",
"integrity": "sha512-hJYpaDvPH4w8ZX/0Fdf9ma1AwRgU353GfbaVfPjfJQf1KxZ2iHaHl3fAUw1qlJIR5dr4F3RzjGaWohYUEyoh7A=="
},
"pump": { "pump": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "http://npmprivate.quantgroups.com/pump/-/pump-3.0.0.tgz", "resolved": "http://npmprivate.quantgroups.com/pump/-/pump-3.0.0.tgz",
...@@ -67,6 +67,7 @@ ...@@ -67,6 +67,7 @@
"moment": "^2.24.0", "moment": "^2.24.0",
"omit.js": "^1.0.2", "omit.js": "^1.0.2",
"path-to-regexp": "^3.1.0", "path-to-regexp": "^3.1.0",
"pubsub-js": "^1.9.4",
"qs": "^6.9.0", "qs": "^6.9.0",
"react": "^16.8.6", "react": "^16.8.6",
"react-amap": "^1.2.8", "react-amap": "^1.2.8",
......
...@@ -49,6 +49,7 @@ const StockModal = options => { ...@@ -49,6 +49,7 @@ const StockModal = options => {
productStock: info.stock, productStock: info.stock,
autoStock: info.autoStock === 1, autoStock: info.autoStock === 1,
}); });
setMaxStock(info.autoStockStep);
setIsChecked(info.autoStock === 1); setIsChecked(info.autoStock === 1);
} }
}; };
...@@ -83,7 +84,7 @@ const StockModal = options => { ...@@ -83,7 +84,7 @@ const StockModal = options => {
}, [options.visible]); }, [options.visible]);
const maxStockRule = [{ validator: isIntegerNotZero, message: '请输入大于0的整数' }]; const maxStockRule = [{ validator: isIntegerNotZero, message: '请输入大于0的整数' }];
if (isChecked) { if (isChecked || stockType === 2) {
maxStockRule.push({ required: true, message: '请输入最大库存!' }); maxStockRule.push({ required: true, message: '请输入最大库存!' });
} }
......
import React, { useState, useEffect, useCallback, useMemo } from 'react'; import React, { useState, useEffect, useCallback, useMemo } from 'react';
import { Spin, Table, Pagination, message, notification } from 'antd'; import { Spin, Table, Pagination, message, notification } from 'antd';
import { unstable_batchedUpdates } from 'react-dom'; import { unstable_batchedUpdates } from 'react-dom';
import { MenuOutlined, HolderOutlined, FormOutlined, CloseCircleOutlined } from '@ant-design/icons';
import { SortableContainer, SortableElement, SortableHandle } from 'react-sortable-hoc'; import { SortableContainer, SortableElement, SortableHandle } from 'react-sortable-hoc';
import { arrayMoveImmutable } from 'array-move'; import { arrayMoveImmutable } from 'array-move';
import { GOOD_MANAGE } from '@/../config/permission.config'; import { GOOD_MANAGE } from '@/../config/permission.config';
import PubSub from 'pubsub-js';
import GoodsGroup from './components/GoodsGroup'; import GoodsGroup from './components/GoodsGroup';
import { import {
apiTakeawayGoods, apiTakeawayGoods,
...@@ -37,19 +37,20 @@ const Takeaway = options => { ...@@ -37,19 +37,20 @@ const Takeaway = options => {
const [visibleBuy, setVisibleBuy] = useState(false); const [visibleBuy, setVisibleBuy] = useState(false);
const [visibleSend, setVisibleSend] = useState(false); const [visibleSend, setVisibleSend] = useState(false);
const [visibleSwitchGroup, setVisibleSwitchGroup] = useState(false); const [visibleSwitchGroup, setVisibleSwitchGroup] = useState(false);
const [scribeToken, setScribeToken] = useState('');
const rowSelection = { const rowSelection = {
selectedRowKeys, selectedRowKeys,
onChange: setSelectedRowKeys, onChange: setSelectedRowKeys,
}; };
const getDataList = async (page = pageNo, size = pageSize) => { const getDataList = async (page = pageNo, size = pageSize, storageRackId = groupId) => {
setLoading(true); setLoading(true);
const params = Object.assign({}, options.searchValue, { const params = Object.assign({}, options.searchValue, {
pageNo: page || pageNo, pageNo: page || pageNo,
productType: 5, productType: 5,
pageSize: size || pageSize, pageSize: size || pageSize,
storageRackId: groupId, storageRackId,
}); });
const productCategoryId = options.searchValue?.productCategoryId || []; const productCategoryId = options.searchValue?.productCategoryId || [];
params.productCategoryId = params.productCategoryId =
...@@ -181,6 +182,18 @@ const Takeaway = options => { ...@@ -181,6 +182,18 @@ const Takeaway = options => {
} }
}, [groupId, options.refresh]); }, [groupId, options.refresh]);
useEffect(() => {
const stoken = PubSub.subscribe('refreshTakeAway', (_, data) => {
setShopId(data.shopId);
setGroupId(data.groupId);
getDataList(0, pageSize, data.groupId);
});
setScribeToken(stoken);
return () => {
PubSub.unsubscribe(scribeToken);
};
}, []);
const actions = { const actions = {
onShowStockModal, onShowStockModal,
toTop, toTop,
......
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