From 3b9a0380f8dfb24964c0afbd635dc7d2f013d475 Mon Sep 17 00:00:00 2001 From: whycq <10027870+whycq@user.noreply.gitee.com> Date: 星期一, 08 五月 2023 10:38:58 +0800 Subject: [PATCH] # --- common/mock/index.js | 119 +++++++++++++++++++++++++++++++++------ pages/mat/matList.vue | 1 pages/print/printUNI.vue | 17 +++++ pages/print/print.vue | 26 ++++++++ 4 files changed, 142 insertions(+), 21 deletions(-) diff --git a/common/mock/index.js b/common/mock/index.js index fd4017d..6f7b8cf 100644 --- a/common/mock/index.js +++ b/common/mock/index.js @@ -6,6 +6,9 @@ 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", @@ -38,6 +41,7 @@ "pageWidth": "74" }, "printItem": [ + // 涓婅竟妗� { "top": "2", "left": "0", @@ -48,6 +52,7 @@ "fontWeight": "400", "height": "3" }, + // 涓嬭竟妗� { "top": "180", "left": "0", @@ -58,6 +63,7 @@ "fontWeight": "400", "height": "3" }, + // 宸﹁竟妗� { "top": "2", "left": "0", @@ -66,8 +72,9 @@ "text": "", "type": "vertical", "fontWeight": "400", - "height": "180" + "height": "176" }, + // 鍙宠竟妗� { "top": "2", "left": "270", @@ -76,18 +83,9 @@ "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", @@ -98,6 +96,18 @@ "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", @@ -106,8 +116,9 @@ "text": "", "type": "vertical", "fontWeight": "400", - "height": "180" + "height": "176" }, + // 绔栫嚎2 { "top": "2", "left": "140", @@ -118,19 +129,91 @@ "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", diff --git a/pages/mat/matList.vue b/pages/mat/matList.vue index e6f3af9..c4470ee 100644 --- a/pages/mat/matList.vue +++ b/pages/mat/matList.vue @@ -170,7 +170,6 @@ }); }, toPrint(item) { - console.log(item); let that = this uni.navigateTo({ url: "../print/print", diff --git a/pages/print/print.vue b/pages/print/print.vue index 0eb7d08..7eace59 100644 --- a/pages/print/print.vue +++ b/pages/print/print.vue @@ -24,6 +24,9 @@ </table> </view> </view> + <view> + <button @click="toPrint">鎵撳嵃</button> + </view> </view> </template> @@ -61,13 +64,34 @@ 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 diff --git a/pages/print/printUNI.vue b/pages/print/printUNI.vue index 75b8835..0a2fdf8 100644 --- a/pages/print/printUNI.vue +++ b/pages/print/printUNI.vue @@ -46,6 +46,9 @@ val: "", dateTimer: "", valArr: [], + print_data: '', + mat: '', + time: '', // 宸存灙鍙傛暟 // broadcase_actions: "com.android.receive_scan_action", // broadcast_flag: "data" @@ -69,13 +72,25 @@ 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) { -- Gitblit v1.9.1