南骏 池
2025-05-16 21bdf0f6e844a1a747c616197f1427d6a7445afe
Scripts/config.js
@@ -162,6 +162,47 @@
    window.history.back();
}
// 新增全局打印方法
Vue.prototype.sendPrintMessage = function (tbBillList) {
    const cfDetails = tbBillList.cfBarInfo.map(item => {
        return "! 0 200 200 210 1\r\n" +
            "PAGE - WIDTH 700 \r\n" +
            "GAP-SENSE \r\n" +
/*            "BOX 0 0 700 180 0 \r\n" +*/
            `T 16 0 10 10 物料编码:\r\n` +
            `T 55 3 120 10 ${item.iteM_NO}\r\n` +
            `T 16 0 310 10 ${item.item_name}\r\n` +
            "T 55 2 10 42 物料规格:\r\n" +
            `T 55 2 110 42 ${item.item_model}\r\n` +
            "T 16 0 10 78 数量:\r\n" +
            `T 0 5 90 78 ${item.quantity}\r\n` +
            `T 16 5 180 78 ${item.barType}\r\n` +
            `BARCODE 128 1 25 35 350 130 ${item.iteM_BARCODE}\r\n` +
/*            `T 0 1 350 130 ${item.iteM_BARCODE}\r\n` +*/
            "T 55 0 10 125 创建时间:\r\n" +
            `T 55 0 120 125 ${item.creatE_DATE}\r\n` +
            "T 55 0 10 150 打印时间:\r\n" +
            `T 55 0 120 150 ${item.print_date}\r\n` +
            "B QR 580 12 M 2 U 4\r\n" +
            `MA,${item.iteM_BARCODE}\r\n` +
            "ENDQR\r\nFORM\r\nPRINT\r\n";
    });
    let sendData = {
        Type: 'Bar',
        Barcode: tbBillList.cfBarInfo[0].iteM_BARCODE,
        Detail: cfDetails,
        Ip: tbBillList.printInfo[0].ip,
        Port: tbBillList.printInfo[0].port,
    }
    console.log('打印数据:', sendData);
    uni.webView.postMessage({
        data: JSON.stringify(sendData)
    })
};
// 新增音频播放方法
Vue.prototype.$playSound = function(type = 'success') {
    try {
@@ -178,3 +219,6 @@
        console.error('音频初始化错误:', e);
    }
};