sunmiprint-plugin v1.0.2
KissNeck Sunmi Print the plugin
打印机初始化
调用 进行打印机初始化 call KissSunmiPrint.showToast Initialize the printer 例子: Example: btn.onclick = function(){ KissSunmiPrint.showToast(1,2) .then(function(msg) { console.log("============================1" + msg) }) .catch(function(error){ console.log("============================2" + error) }); }
开始事务打印 Start transaction printing
调用 KissSunmiPrint.transactionPrint 进行事务打印 call KissSunmiPrint.transactionPrint Start transaction printing KissSunmiPrint.transactionPrint([ 这里面传打印模板数据 This is where the print template data is passed
Inside the data field according to their own to define { "type":"2", "shop_name":"", "staff":"", "order_num":"4456654526582", "s_time":"2021.08.19 20:20:30", "data":[ [ "商品名称", "价格", "数量", "小计" ], [ "", "100", "3", "300" ], [ "", "2.09", "6", "12.54" ] ], "price":"100", "total_sum":"5", "total_price":"1000", "pay_type":"", "address":"", "tel":"" }
]) .then(function(msg) { console.log("============================3" + msg) 事务打印成功的回调 }) .catch(function(error){ console.log("============================4" + error) 事务打印失败的回调 });
ThreadPoolManager 线程管理类
SunmiPrintHelper ->printExample 小票数据接收 打印小票 Receipt data receives printed receipts