Commit 29036ed9 by 修福龙

后端获取收银台数据

parent 46badebe
...@@ -140,6 +140,9 @@ const CounterMixins = ComposeComponent => { ...@@ -140,6 +140,9 @@ const CounterMixins = ComposeComponent => {
if (window.socket.hasListeners('adsOperate')) { if (window.socket.hasListeners('adsOperate')) {
window.socket.removeAllListeners('adsOperate'); window.socket.removeAllListeners('adsOperate');
} }
if (window.socket.hasListeners('goodsData')) {
window.socket.removeAllListeners('goodsData');
}
window.socket.on('cmdOperate', this.command.bind(this)); window.socket.on('cmdOperate', this.command.bind(this));
window.socket.on('adsOperate', ({adsData}) => { window.socket.on('adsOperate', ({adsData}) => {
this.setState({ this.setState({
...@@ -148,6 +151,36 @@ const CounterMixins = ComposeComponent => { ...@@ -148,6 +151,36 @@ const CounterMixins = ComposeComponent => {
adType: adsData.type, adType: adsData.type,
}); });
}); });
window.socket.on('goodsData', () => {
const data = [];
const {goodsArr} = this.state;
goodsArr.map(
({
barcode,
category,
name,
num,
prePrice,
price,
spec,
unit,
weight,
}) => {
data.push({
name,
barcode,
category: category || '',
price: price || 0,
unit: unit || '个',
prePrice: prePrice || 0,
num,
weight: weight || 0,
spec: spec || '',
});
},
);
window.socket.emit('goodsData', JSON.stringify(data));
});
window.socket.on( window.socket.on(
'counterOrder', 'counterOrder',
({type, msg, sid, token, payType, orderId}) => { ({type, msg, sid, token, payType, orderId}) => {
......
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