123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- const util = require('../../utils/util.js')
- const BL = require('../../utils/lanya.js')
- var pos = require('../../utils/pos.js')
- var GXZT;//更新状态
- Page({
- data: {
- LYData: {
- openOK: false,//蓝牙是否打开
- BLZT: false,//蓝牙状态是否可用
- BLSO: false,//蓝牙是否正在搜索
- TS: "",
- },
- LYSB: [],
- },
- onShow:function(){
- //BL.zdlj();
- },
- onUnload: function () {
- //BL.stopBL();
- },
- openP: function (e) {
- BL.OpenPrint();
- clearTimeout(GXZT);
- tim(this);
- },
- lianjie: function (e) {
- console.log("连接按钮", e)
- var uuid = e.currentTarget.dataset.uuid;
- BL.lianjie(uuid,function(res){
- console.log(res)
- });
- //BL.dellb(e.currentTarget.dataset.ite);
- },
- duankai: function (e) {
- var uuid = e.currentTarget.dataset.uuid;
- BL.duankai(uuid,"no",function(){});
- },
- Printg: function () {
- printText()
- },
- tuichu:function(){
- wx.navigateBack({
- delta: 0,
- })
- }
-
- })
- function tim(that) {
- that.setData({
- LYData: BL.GETData(),
- LYSB: BL.GETSB()
- })
- //console.log(BL.BLData)
- GXZT=setTimeout(function () { tim(that) }, 500)
- }
- function printText() {
- console.log("开始打印")
- //pos.PrintText("情景4:综合支付不使用零钱也不存零,无找零");//打印标题
- pos.PrintJumpLines(5);
- pos.PrintTitle(" 测试");//打印标题
- pos.PrintNameValue('单号: ', 'ls0220180125000001');
- pos.PrintText("收银员: 1001 机器编号: 001");//打印标题
- pos.PrintNameValue('时间: ', '2017-12-23 12:01:01');
- pos.PrintText("品名 数量 单价 小计");
- pos.PrintMiddleText('--------------------------------');
- // pos.PrintText("可口可乐(听)");
- // pos.PPP("2.0", "2", "4.00");
- // pos.PrintText("大泽山葡萄(kg)");
- // pos.PPP("12.8", "2.0", "25.6");
- // pos.PrintText("大泽山葡萄(盒)");
- // pos.PPP("30", "2.0", "60.0");
- // pos.PrintMiddleText('--------------------------------');
- // pos.PrintNameValue('合计数量: ', '6.0');
- // pos.PrintNameValue('标价金额: ', '128.8');
- // pos.PrintText('合计优惠(促销/特价等): -2.3');
- // pos.PrintNameValue('合计应收: ', '126.5');
- // pos.PrintNameValue('实际收款: ', '126.5');
- // //pos.PrintNameValue('优惠(抹零): ', '0.5');
- // pos.PrintMiddleText('--------------------------------');
- // pos.PrintText("收款明细: ");//打印标题
- // pos.PrintNameValue('现金: ', '100');
- // pos.PrintNameValue('微信刷卡: ', '26.5');
- // //pos.PrintNameValue('零钱包支付: ', '0.5');
- // //pos.PrintNameValue('现金找零: ', '4.0');
- // pos.PrintMiddleText('--------------------------------');
- // pos.PrintNameValue('会员卡: ', '132****8588');
- // //pos.PrintNameValue('支付前余额: ', '5.00');
- // pos.PrintNameValue('当前可用余额: ', '4.5');
- // pos.PrintNameValue('本次积分: ', '12.0');
- // pos.PrintNameValue('当前可用积分: ', '285.0');
- // pos.PrintMiddleText('--------------------------------');
- // pos.PrintText("谢谢您的惠顾,欢迎下次光临!");//打印标题
- // pos.PrintQRcode('http://xxx.xxx.xxx');//二维码 PrintBarcode: PrintBarcode,//打印条码
- // pos.PrintJumpLines(3);
- pos.PrintBarcode('6934199500017');//条码
- // pos.PrintJumpLines(3);
- pos.DaYin(function (res) {
- if (res == "err") {
- pos.ClearQueue();//清空打印列队
- //提示,打印出错,请稍后再试,仍然出错请重新设置打印机
- }
- });
- }
|