| | |
| | | test: ['静态数据'], |
| | | //面单数据 |
| | | order_data: { |
| | | MATNR: "1200128-10055", |
| | | MAKTX: "X5S-4-M03/333", |
| | | MODI_TIME: "2023-04-24 15:25:32", |
| | | CUSTOMER_CODE: "00001", |
| | | CUSTOMER_NAME: "宋小姐", |
| | | BILL_CODE: "JYM100005228492", |
| | |
| | | "pageWidth": "74" |
| | | }, |
| | | "printItem": [ |
| | | // 上边框 |
| | | { |
| | | "top": "2", |
| | | "left": "0", |
| | |
| | | "fontWeight": "400", |
| | | "height": "3" |
| | | }, |
| | | // 下边框 |
| | | { |
| | | "top": "180", |
| | | "left": "0", |
| | |
| | | "fontWeight": "400", |
| | | "height": "3" |
| | | }, |
| | | // 左边框 |
| | | { |
| | | "top": "2", |
| | | "left": "0", |
| | |
| | | "text": "", |
| | | "type": "vertical", |
| | | "fontWeight": "400", |
| | | "height": "180" |
| | | "height": "176" |
| | | }, |
| | | // 右边框 |
| | | { |
| | | "top": "2", |
| | | "left": "270", |
| | |
| | | "text": "", |
| | | "type": "vertical", |
| | | "fontWeight": "400", |
| | | "height": "180" |
| | | "height": "176" |
| | | }, |
| | | { |
| | | "top": "140", |
| | | "left": "0", |
| | | "textAlign": "start", |
| | | "width": "281", |
| | | "text": "", |
| | | "type": "cross", |
| | | "fontWeight": "400", |
| | | "height": "4" |
| | | }, |
| | | // 横线1 |
| | | { |
| | | "top": "70", |
| | | "left": "0", |
| | |
| | | "fontWeight": "400", |
| | | "height": "4" |
| | | }, |
| | | // 横线2 |
| | | { |
| | | "top": "144", |
| | | "left": "0", |
| | | "textAlign": "start", |
| | | "width": "270", |
| | | "text": "", |
| | | "type": "cross", |
| | | "fontWeight": "400", |
| | | "height": "4" |
| | | }, |
| | | // 竖线1 |
| | | { |
| | | "top": "2", |
| | | "left": "40", |
| | |
| | | "text": "", |
| | | "type": "vertical", |
| | | "fontWeight": "400", |
| | | "height": "180" |
| | | "height": "176" |
| | | }, |
| | | // 竖线2 |
| | | { |
| | | "top": "2", |
| | | "left": "140", |
| | |
| | | "fontWeight": "400", |
| | | "height": "140" |
| | | }, |
| | | // 静态文字 |
| | | { |
| | | "top": "35", |
| | | "left": "7.6", |
| | | "top": "30", |
| | | "left": "10", |
| | | "textAlign": "left", |
| | | "barcodetype": "128Auto", |
| | | "width": "38", |
| | | "width": "54", |
| | | "fontSize": 9, |
| | | "text": "料号", |
| | | "type": "text", |
| | | "fontWeight": "400", |
| | | "height": "19" |
| | | }, |
| | | { |
| | | "top": "105", |
| | | "left": "10", |
| | | "textAlign": "left", |
| | | "width": "54", |
| | | "fontSize": 9, |
| | | "text": "商品", |
| | | "type": "text", |
| | | "fontWeight": "400", |
| | | "height": "19" |
| | | }, |
| | | { |
| | | "top": "155", |
| | | "left": "10", |
| | | "textAlign": "left", |
| | | "width": "54", |
| | | "fontSize": 9, |
| | | "text": "日期", |
| | | "type": "text", |
| | | "fontWeight": "400", |
| | | "height": "19" |
| | | }, |
| | | // 二维码 |
| | | { |
| | | "imgUrl": "/static/img/order/ewm.png", |
| | | "dataId": "MATNR", |
| | | "top": "12", |
| | | "left": "152", |
| | | "textAlign": "start", |
| | | "width": "66", |
| | | "text": "料号号二维码", |
| | | "type": "qrCode", |
| | | "fontWeight": "400", |
| | | "height": "66" |
| | | }, |
| | | // 料号 |
| | | { |
| | | "dataId": "MATNR", |
| | | "top": "30", |
| | | "left": "55", |
| | | "textAlign": "start", |
| | | "width": "152", |
| | | "fontSize": "8", |
| | | "text": "料号", |
| | | "type": "field", |
| | | "fontWeight": "400", |
| | | "height": "19" |
| | | }, |
| | | // 商品名称 |
| | | { |
| | | "dataId": "MAKTX", |
| | | "top": "105", |
| | | "left": "55", |
| | | "textAlign": "start", |
| | | "width": "152", |
| | | "fontSize": "7", |
| | | "text": "商品", |
| | | "type": "field", |
| | | "fontWeight": "400", |
| | | "height": "19" |
| | | }, |
| | | // 日期 |
| | | { |
| | | "dataId": "MODI_TIME", |
| | | "top": "155", |
| | | "left": "100", |
| | | "textAlign": "start", |
| | | "width": "152", |
| | | "fontSize": "8", |
| | | "text": "商品", |
| | | "type": "field", |
| | | "fontWeight": "400", |
| | | "height": "19" |
| | | }, |
| | | // { |
| | | // "top": "304", |
| | | // "left": "0", |
| | |
| | | }); |
| | | }, |
| | | toPrint(item) { |
| | | console.log(item); |
| | | let that = this |
| | | uni.navigateTo({ |
| | | url: "../print/print", |
| | |
| | | </table> |
| | | </view> |
| | | </view> |
| | | <view> |
| | | <button @click="toPrint">打印</button> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | |
| | | let that = this |
| | | const eventChannel = this.getOpenerEventChannel(); |
| | | eventChannel.on('data', function(data) { |
| | | console.log(data.data); |
| | | that.mat = data.data |
| | | that.qrFun(that.mat.matnr) |
| | | }) |
| | | |
| | | }, |
| | | methods: { |
| | | // 打印 |
| | | toPrint() { |
| | | let that = this |
| | | uni.navigateTo({ |
| | | url: "../print/printUNI", |
| | | success: function(res) { |
| | | // 通过eventChannel向被打开页面传送数据 向另外一个页面传递值的 |
| | | res.eventChannel.emit('data1', { |
| | | data: that.mat, |
| | | time: that.time |
| | | }) |
| | | }, |
| | | events: { |
| | | // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据 另外一个页面传过来的 |
| | | acceptDataFromOpenedPage: function(data) { |
| | | that.matnr = data.data |
| | | }, |
| | | }, |
| | | |
| | | |
| | | }); |
| | | }, |
| | | //**生成二维码**// |
| | | qrFun(text) { |
| | | this.qrShow = true |
| | |
| | | val: "", |
| | | dateTimer: "", |
| | | valArr: [], |
| | | print_data: '', |
| | | mat: '', |
| | | time: '', |
| | | // 巴枪参数 |
| | | // broadcase_actions: "com.android.receive_scan_action", |
| | | // broadcast_flag: "data" |
| | |
| | | onLoad(options) { |
| | | _this = this; |
| | | this.$init_bluetooth(); |
| | | let that = this |
| | | const eventChannel = this.getOpenerEventChannel(); |
| | | eventChannel.on('data1', function(data1) { |
| | | that.mat = data1.data |
| | | that.time = data1.time |
| | | console.log(data1); |
| | | }) |
| | | }, |
| | | methods: { |
| | | ...mapActions([SET_CONNECTBLEDATA]), |
| | | senBleLabel() { |
| | | // console.log(this.$Mock.order_data); |
| | | if(!print) return; |
| | | print.startPrint(this.$Mock.order_data); |
| | | console.log(this.mat); |
| | | this.print_data = this.$Mock.order_data |
| | | this.print_data.MATNR = this.mat.matnr |
| | | this.print_data.MAKTX = this.mat.maktx |
| | | this.print_data.MODI_TIME = this.time |
| | | print.startPrint(this.print_data); |
| | | }, |
| | | // 连接打印机 |
| | | confirm_bluetooth(item) { |