Commit 0b3f139a by 黄日华

收银程序开门离店和条码清空时间调整

收银程序增加扫条码消除开门离店弹窗
parent 719d11a0
...@@ -39,7 +39,7 @@ const mStyles = { ...@@ -39,7 +39,7 @@ const mStyles = {
}, },
}; };
const clearTime = 300; // 五分钟自动清空购物车 const clearTime = 120; // 五分钟自动清空购物车
const paidTime = 30; // 支付完成等待时间 30s const paidTime = 30; // 支付完成等待时间 30s
const delay = 1500; // 扫码后延迟时间 const delay = 1500; // 扫码后延迟时间
...@@ -127,7 +127,21 @@ const CounterMixins = ComposeComponent => { ...@@ -127,7 +127,21 @@ const CounterMixins = ComposeComponent => {
DeviceEventEmitter.addListener('onError', () => (this.busy = false)); DeviceEventEmitter.addListener('onError', () => (this.busy = false));
const handleScan = this.submitBarcode; const handleScan = this.submitBarcode;
// if you want to react to keyUp // if you want to react to keyUp
KeyEvent.onKeyDownListener(async e => { // KeyEvent.onKeyDownListener(async e => {
// const {keyCode, pressedKey} = e;
// if (keyCode === 66) {
// // 回车事件
// await handleScan();
// this.barcode = '';
// } else if (keyCode >= 7 && keyCode <= 16) {
// this.barcode += keyCode - 7;
// } else if (keyCode >= 29 && keyCode <= 54) {
// this.barcode += pressedKey;
// } else {
// this.barcode += pressedKey;
// }
// });
KeyEvent.onKeyUpListener(async e => {
const {keyCode, pressedKey} = e; const {keyCode, pressedKey} = e;
if (keyCode === 66) { if (keyCode === 66) {
// 回车事件 // 回车事件
...@@ -485,17 +499,17 @@ const CounterMixins = ComposeComponent => { ...@@ -485,17 +499,17 @@ const CounterMixins = ComposeComponent => {
successPay = async facepay => { successPay = async facepay => {
Toast.hide(); Toast.hide();
const {goodsArr, human} = this.state; const {goodsArr, human} = this.state;
let total = 0; let totalPrice = 0;
let totalNum = 0; let totalNum = 0;
goodsArr.map(item => { goodsArr.map(item => {
totalNum += Number(item.num); totalNum += Number(item.num);
if (item.price) { if (item.price) {
total += Number(item.price) * Number(item.num); totalPrice += Number(item.price) * Number(item.num);
} else { } else {
total += Number(item.prePrice) * Number(item.num); totalPrice += Number(item.prePrice) * Number(item.num);
} }
}); });
let msg = '付款' + total + '元,共' + totalNum + '件商品'; let msg = '付款' + totalPrice + '元,共' + totalNum + '件商品';
this.props.dispatch({ this.props.dispatch({
// 购物完成步骤 // 购物完成步骤
type: 'app/step', type: 'app/step',
...@@ -574,10 +588,10 @@ const CounterMixins = ComposeComponent => { ...@@ -574,10 +588,10 @@ const CounterMixins = ComposeComponent => {
}; };
print = async () => { print = async () => {
let total = 0; let totalPrice = 0;
let goods = []; let goods = [];
this.state.printer.map(v => { this.state.printer.map(v => {
total += (v.price > 0 ? v.price : v.prePrice) * v.num; totalPrice += (v.price > 0 ? v.price : v.prePrice) * v.num;
goods.push( goods.push(
`${v.name},${v.num},${v.price > 0 ? v.price : v.prePrice},${(v.price > `${v.name},${v.num},${v.price > 0 ? v.price : v.prePrice},${(v.price >
0 0
...@@ -585,7 +599,7 @@ const CounterMixins = ComposeComponent => { ...@@ -585,7 +599,7 @@ const CounterMixins = ComposeComponent => {
: v.prePrice) * v.num}`, : v.prePrice) * v.num}`,
); );
}); });
goods.push(`总计, , ,${total.toFixed(2)}`); goods.push(`总计, , ,${totalPrice.toFixed(2)}`);
await Printer.printNote(goods, this.state.receipt); await Printer.printNote(goods, this.state.receipt);
this.setState({printer: []}); this.setState({printer: []});
}; };
...@@ -772,6 +786,9 @@ const CounterMixins = ComposeComponent => { ...@@ -772,6 +786,9 @@ const CounterMixins = ComposeComponent => {
}; };
submitBarcode = async barcode => { submitBarcode = async barcode => {
this.setState({
cloudFinishModal: false,
});
if (this.props.goods.cardVisible) { if (this.props.goods.cardVisible) {
return await this.handleCard(barcode || this.barcode); return await this.handleCard(barcode || this.barcode);
} }
......
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