#
whycq
2023-05-08 3b9a0380f8dfb24964c0afbd635dc7d2f013d475
#
4个文件已修改
163 ■■■■ 已修改文件
common/mock/index.js 119 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/mat/matList.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/print/print.vue 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/print/printUNI.vue 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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",
pages/mat/matList.vue
@@ -170,7 +170,6 @@
                });
            },
            toPrint(item) {
                console.log(item);
                let that = this
                uni.navigateTo({
                    url: "../print/print",
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
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) {