Commit 019a08ca by 修福龙

增加了运营端对收银台的商品数据的控制socket

parent 29036ed9
......@@ -143,6 +143,9 @@ const CounterMixins = ComposeComponent => {
if (window.socket.hasListeners('goodsData')) {
window.socket.removeAllListeners('goodsData');
}
if (window.socket.hasListeners('goodsOperate')) {
window.socket.removeAllListeners('goodsOperate');
}
window.socket.on('cmdOperate', this.command.bind(this));
window.socket.on('adsOperate', ({adsData}) => {
this.setState({
......@@ -151,6 +154,29 @@ const CounterMixins = ComposeComponent => {
adType: adsData.type,
});
});
window.socket.on(
'goodsOperate',
({type, number, row, barcode, price}) => {
const index = row;
if (type === 'add') {
// 新增
this.submitBarcode(barcode);
} else if (type === 'update') {
// 修改
this.numIndex = index;
this.submitGoodNum(number);
} else if (type === 'delete') {
// 删除
this.removeIndex(index);
} else if (type === 'price') {
// 无码商品
this.submitCodeless(price);
} else if (type === 'clear') {
// 清除商品
this.clearList();
}
},
);
window.socket.on('goodsData', () => {
const data = [];
const {goodsArr} = this.state;
......
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