chenhaozhe
2026-01-26 9d27d3ed337065adade794111654fd6e5c848f53
Merge branch 'Dev' of http://101.37.171.70:10101/r/~jhz/STUWMS into Dev
2个文件已修改
80 ■■■■ 已修改文件
manifest.json 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/tiaomachaima/tiaomachaimaCopy.vue 78 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manifest.json
@@ -162,7 +162,7 @@
            "LcPrinter" : {
                "__plugin_info__" : {
                    "name" : "LcPrinter",
                    "description" : "新版打印插件",
                    "description" : "打印插件",
                    "platforms" : "Android",
                    "url" : "",
                    "android_package_name" : "",
pages/tiaomachaima/tiaomachaimaCopy.vue
@@ -34,7 +34,6 @@
                <button type="default" :class="cantPrint ? 'btn-disabled' : 'btn-c'" @click="PrintHBarCode"
                    :disabled="cantPrint">打印</button>
                    <button type="primary" @click="printerLabel">测试打印</button>
                    <button type="primary" @click="printTest">回纸距离</button>
            </view>
        </view>
        <view class="divide"></view>
@@ -140,12 +139,14 @@
            };
        },
        methods: {
            //打印机初始化
            initPrinter() {
                // 调用异步方法
                console.log('新版初始化');
                var ret = printer.initPrinter({});
                console.log('初始化');
                var ret = printer.initPrinter({
                    name: 'unimp',
                    age: 1
                });
                modal.toast({
                    message: ret,
                    duration: 1.5
@@ -156,36 +157,15 @@
                printer.setConcentration({ //设置打印浓度。font_level 取值范围:1~39。
                    level: 39
                });
                printer.setLineSpacing({
                    spacing: 1
                });
                //add by ljh
                printer.setFontSize({
                    fontSize: 8
                });
                //add end
                printer.getsupportprint();
            
            },
            printTest() {
                printer.printEnableMark({enable: false});
                console.log('测试回纸距离');
                printer.printBarcode({
                    text: 1234567890123456789,
                    height: 80,
                    barcodeType: 73
                });
                printer.setFeedPaperSpace({ space: 1000});
                printer.setUnwindPaperLen({ length: 60 });
                printer.printLine({
                    line_length: 5
                });
                printer.printGoToNextMark();//标签打印使用,开始走纸
                //printer.start();//热敏打印使用,开始走纸
            },
            printerLabel(item) {
                console.log('测试打印');
                printer.setLineSpacing({
                    spacing: 1.2
                });
                printer.setUnwindPaperLen({ length: 60 });
                printer.setFontSize({
                    fontSize: 1
@@ -220,13 +200,13 @@
                    isUnderLine: false,
                    content: '物料简称:12SH 出风网 注塑灰011(同GE灰)\r\n'
                });
                printer.printText2({
                    offset: 1,
                    fontSize:2,
                    isBold: false,
                    isUnderLine: false,
                    content: '物料名称:12SH 出风网 注塑灰011(同GE灰)\r\n'
                });
                // printer.printText2({
                //     offset: 1,
                //     fontSize:2,
                //     isBold: false,
                //     isUnderLine: false,
                //     content: '物料名称:12SH 出风网 注塑灰011(同GE灰)\r\n'
                // });
                
                printer.printText2({
                    offset: 1,
@@ -254,14 +234,23 @@
                    fontSize: 2,
                    isBold: false,
                    isUnderLine: false,
                    content: '工号:000001\r\n'
                    content: '流水号:000001\r\n'
                });
                printer.printText2({
                    offset: 1,
                    fontSize: 2,
                    isBold: false,
                    isUnderLine: false,
                    content: '打印日期:2025-8-13\r\n'
                });
                printer.printQR2({
                    text: 'title',
                    height: 100,
                    height: 120,
                    offset: 3
                });
                printer.printLine({
                    line_length: 5
                });
                printer.printGoToNextMark();
                
                console.log('测试打印QR结束');
@@ -574,6 +563,7 @@
            this.resetButtonState();
            // 添加打印状态监听
            if(!isPrinterInitialized){
                const self = this;
                globalEvent.addEventListener('onPrintCallback', function(e) {
                    uni.showToast({
                        title: 'state: ' + JSON.stringify(e),
@@ -585,10 +575,10 @@
                            duration: 2000
                        });
                        //成功后设置状态
                        this.isPrinting = false;
                        self.isPrinting = false;
                        //this.resetButtonState();
                    } else if (e.key == 3) {
                        this.isPrinting = false;
                        self.isPrinting = false;
                        uni.showToast({
                            title: '缺纸',
                            duration: 2000
@@ -609,6 +599,10 @@
        },
        onReady() {
            
        },
        onUnload() {
            // 调用同步方法
        }
    }
</script>