Commit 03514c94 by zeven

优化打印机连接

parent ac52cf32
android @ c8c06aeb
Subproject commit baab8abedf9e86b923151a4fa61bc968f358e22a
Subproject commit c8c06aeb3b1938888aecd245c3838466a9dce74e
......@@ -120,6 +120,8 @@ const CounterMixins = ComposeComponent => {
await handleScan();
this.barcode = '';
});
const isConnected = await Printer.isConnected();
if (!isConnected) await Printer.usbConnect(); // 尝试连接打印机模块
this.listen();
};
......@@ -412,14 +414,6 @@ const CounterMixins = ComposeComponent => {
};
print = async () => {
const isConnected = await Printer.isConnected();
if (!isConnected) {
const success = await Printer.usbConnect();
if (!success) {
Toast.info('打印机模块未连接,无法打印');
return;
}
}
let total = 0;
let goods = [];
this.state.printer.map(v => {
......
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