wx-channel-shop-printer
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

wx-channel-shop-printer

视频号小店 · 电子面单打印,简单封装 API。

https://developers.weixin.qq.com/doc/channels/API/ewaybill/connect_printer.html

使用

import { WxChannelShopPrinter } from "wx-channel-shop-printer";

const printer = new WxChannelShopPrinter();

获取打印机列表

const list = await printer.getPrinterList();
/**
 * [{
 *   "name": "_KM_202_NEW_",
 *   "displayName": "KM-202(NEW)",
 *   "status": 3
 * }]
 */

获取打印组件版本号

获取打印组件的版本号。

const info = await printer.getAppInfo();
/**
 * {
 *   "version": "1.3.4"
 * }
 */

打印面单

发送指令给打印组件,打印对应的面单

注意:

const tasks = await printer.print({
  version: "2.0", // 必传
  taskList: [
    {
      printInfo: "", // String, [获取打印报文]接口返回的 print_info
      printNum: {
        curNum: 1, // 打印计数-当前张数
        sumNum: 2, // 打印计数-总张数
      },
    },
  ],
  printer: "_KM_202_NEW_", // 选中的打印机,printer.name
});
/**
 * [{
 *   "taskID": "1234",
 *   "success": true,
 *   "failureReason": ""
 * }]
 */

Readme

Keywords

none

Package Sidebar

Install

npm i wx-channel-shop-printer

Weekly Downloads

15

Version

0.1.0

License

none

Unpacked Size

10.1 kB

Total Files

8

Last publish

Collaborators

  • lazyfabric