优化usb打印机订单小票

This commit is contained in:
gyq
2026-04-25 18:20:01 +08:00
parent 6aec434015
commit da6b45e9e9
2 changed files with 29529 additions and 425 deletions

File diff suppressed because one or more lines are too long

View File

@@ -3,7 +3,7 @@ import getLodop from "./LodopFuncs.js";
* 打印交班小票
*/
export default (data) => {
console.log("data.deviceName===", data.deviceName);
console.log("USB.打印交班小票===", data);
let LODOP = getLodop();
LODOP.PRINT_INIT("打印小票");
// 设置打印纸大小D
@@ -19,31 +19,31 @@ export default (data) => {
交班小票
</div>
<div style="font-size: 12px;margin-top:50px;">
当班时间:${data.loginTime}
当班时间:${data.handoverTime }
</div>
<div style="font-size: 12px;">
交班时间:${data.handoverTime}
交班时间:${data.loginTime || ""} - ${data.handoverTime || ""}
</div>
<div style="font-size: 12px;">
收银员:${data.staffName}
收银员:${data.staffName || ""}
</div>
<div style="font-size: 12px;margin-top: 4px;">
当班总收入:${data.handAmount}
当班总收入:${data.turnover || 0}
</div>
<div style="font-size: 12px;margin-top: 4px;">
现金收入:${data.cashAmount}
现金收入:${data.cash || 0}
</div>
<div style="font-size: 12px;margin-top: 4px;">
微信收入:${data.wechatAmount}
微信收入:${data.wechat || 0}
</div>
<div style="font-size: 12px;margin-top: 4px;">
支付宝收入:${data.alipayAmount}
支付宝收入:${data.alipay || 0}
</div>
<div style="font-size: 12px;margin-top: 4px;">
会员支付:${data.vipPay}
会员支付:${data.balance || 0}
</div>
<div style="font-size: 12px;margin-top: 4px;">
会员充值:${data.vipRecharge}
会员充值:${data.recharge || 0}
</div>
`;
@@ -86,72 +86,74 @@ export default (data) => {
`;
let productCategoriesTableBody = "";
if (data.categoryDataList && data.categoryDataList.length) {
for (let item of data.categoryDataList) {
if (data.categoryList && data.categoryList.length) {
for (let item of data.categoryList) {
productCategoriesTableBody += `
<tr>
<td style="font-size: 12px;width:50%;">
<div>${item.categoryName}</div>
</td>
<td style="font-size: 12px;width:25%;">${item.num}</td>
<td style="font-size: 12px;width:25%;">${item.num || 0}</td>
<td style="font-size: 12px;width:25%;">
${item.amount}
${item.amount || 0}
</td>
</tr>
`;
}
}
let tabHead = `
</table>
<div style="font-size: 12px;margin-top: 4px;">商品数据</div>
<table class="table" style="width: 100%;">
<tr>
<td style="font-size: 12px;width:75%;">商品</td>
<td style="font-size: 12px;width:25%;">数量</td>
</tr>
`;
// let tabHead = `
// </table>
// <div style="font-size: 12px;margin-top: 4px;">商品数据</div>
// <table class="table" style="width: 100%;">
// <tr>
// <td style="font-size: 12px;width:75%;">商品</td>
// <td style="font-size: 12px;width:25%;">数量</td>
// </tr>
// `;
// let tableBody = "";
// if (data.productDataList && data.productDataList.length) {
// for (let item of data.productDataList) {
// tableBody += `
// <tr>
// <td style="font-size: 12px;width:75%;">
// <div>${item.productName}</div>
// </td>
// <td style="font-size: 12px;width:25%;">${item.num}</td>
// </tr>
// `;
// }
// }
// if (!data.printShop) {
// tabHead = "";
// tableBody = "";
// }
let tabHead = "";
let tableBody = "";
if (data.productDataList && data.productDataList.length) {
for (let item of data.productDataList) {
tableBody += `
<tr>
<td style="font-size: 12px;width:75%;">
<div>${item.productName}</div>
</td>
<td style="font-size: 12px;width:25%;">${item.num}</td>
</tr>
`;
}
}
if (!data.printShop) {
tabHead = "";
tableBody = "";
}
let str = `
</table>
<div style="font-size: 12px;margin-top: 4px;">
<span>快捷收款金额:</span>
<span>${data.quickInAmount}</span>
<span>${data.barScan || 0}</span>
</div>
<div style="font-size: 12px;">
<span>退款金额:</span>
<span>${data.refundAmount}</span>
<span>${data.refundAmount || 0}</span>
</div>
<div style="font-size: 12px;">
<span>总收入:</span>
<span>${data.handAmount}</span>
<span>${data.turnover || 0}</span>
</div>
<div style="font-size: 12px;">
<span>挂账金额:</span>
<span>${data.creditAmount}</span>
<span>${data.owed || 0}</span>
</div>
<div style="margin-top: 20px; font-size: 12px;">
<span>总订单数:</span>
<span>${data.orderCount}</span>
<span>${data.orderCount || 0}</span>
</div>
<div style="font-size: 12px;">
打印时间:${data.printTime}