import getLodop from "./LodopFuncs.js";
/**
 * 打印订单发票
 */
export default (data) => {
  console.log("data.deviceName===", data.deviceName);
  let LODOP = getLodop();
  LODOP.PRINT_INIT("打印小票");
  // 设置打印纸大小D
  LODOP.SET_PRINT_PAGESIZE(3, "58mm", 20, "");
  //   二维码控制大小;
  LODOP.ADD_PRINT_BARCODE("", "40px", "150px", "150px", "QRCode", data.url);
  //设置默认打印机(这里用的是打印机名称)
  LODOP.SET_PRINTER_INDEX(data.deviceName);
  // 文字内容
  let html = `
        <div style="height: 100px;"></div>
        <div style="width: 100%;font-size: 16px;display:flex;justify-content:center;">
            请使用微信扫码下载发票，二维码有效期30天，超过自动失效
        </div>
        <div>.</div>
        <div>.</div>
        <div>.</div>
        <div>.</div>
  `;

  setTimeout(() => {
    LODOP.ADD_PRINT_HTM("9mm", "0mm", "RightMargin:0mm", 20, html);
    LODOP.SET_LICENSES("", "DCFF409304DFCEB3E2C644BF96CD0720", "", "");
    LODOP.PRINT();
  }, 800);
};
