npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

turbo-feie-printer

v1.0.6

Published

飞鹅打印机

Downloads

4

Readme

飞鹅打印机SDK

根据飞鹅开放平台放出的文档简单处理,原文档传送门


使用文档

yarn add turbo-feie-printer
import { Feie } from "turbo-feie-printer";
import { FeieTemplate } from "turbo-feie-printer/dist/libs/template";


const user = '********';
const ukey = '********';

const feie = new Feie(user, ukey);

const printer = feie.getPrinterManger()

// 解析打印机背后的二维码
const { sn, key } = printer.parseQrCode('1234567:7yet221')

// 添加打印机
printer.add({
    sn: sn,
    key: key,
    remark: '厨房',
    simno: ''
}).then((res) => {
    console.log(`添加打印机`, res)
})


// 移除打印机
printer.remove('d111231111')

// 修改打印机
printer.modify({
    sn: 'd111231111',
    remark: '厨房',
    simno: '621000000000000'
})

// 查询打印机状态
printer.queryPrinterStatus(sn).then((p) => {
    console.log(`打印机状态:`, p)
})


// 查询订单打印状态
printer.queryOrderPrintState('816501678_20160919184316_1419533539')

// 打印58mm宽的纸
const goods = [
    {
        title: "番茄炒粉",
        price: 1200,
        goodsNum: 1,
        amount: 1200
    },
    {
        title: "西红柿炒鸡蛋",
        price: 1200,
        goodsNum: 1,
        amount: 1200
    },
    {
        title: "西红柿炒鸡蛋(500g装)",
        price: 1200,
        goodsNum: 1,
        amount: 1200
    },
    {
        title: "西红柿炒鸡蛋(1500g装)",
        price: 3500,
        goodsNum: 3,
        amount: 10500
    },
    {
        title: "老北京乡土走地鸡(1500g装)",
        price: 3500,
        goodsNum: 3,
        amount: 10500
    },
    {
        title: "日本进口雪花和牛(3kg装)",
        price: 35000,
        goodsNum: 3,
        amount: 105000
    },
    {
        title: "日本进口😄雪花和牛(3kg装)",
        price: 35000,
        goodsNum: 3,
        amount: 105000
    },
    {
        title: "YSL井口装2023元旦纪念版",
        price: 350.00,
        goodsNum: 3,
        amount: 1050.00
    },
    {
        title: "戴尔(DELL)成就3690商用办公台式电脑家用迷你单主机【i5-11400 16G 512G固态 定制】",
        price: 3450.00,
        goodsNum: 1,
        amount: 3450.00
    },
    {
        title: 'ThinkPad 联想ThinkBook16+ 22款12代英特尔酷睿处理器 16英寸笔记本电脑 i5-12500H 16G Xe显卡 01CD',
        price: 5629.00,
        goodsNum: 1,
        amount: 5629.00
    }
]



const tmp = feie.getTemplateManager()
tmp.addText(FeieTemplate.textCenterAndBigger("1# 新订单"))
    .addText(FeieTemplate.textRightAlign(`#2号店`))
    .barcodeC('2022120000120001234567')//订单号
    .textBr()
    .textBr()
    .addText('名称           单价  数量 金额')
    .addText('--------------------------------')
    .addText(FeieTemplate.orderRowsFormat(goods, {
        titleLength: 14,
        priceLength: 6,
        numLength: 3,
        amountLength: 6
    }))
    .addText('--------------------------------')
    .addText(`合计:xx.0元`)
    .addText('--------------------------------')
    .addText(`收货人:王大锤`)
    .addText(`地址:xxxxxxxxxxxxxxxxx`)
    .addText(`联系电话:138000000000`)
    .addText(`时间:2022-12-25 19:30:10`)
    .addText(`备注:多家点辣椒`)
    .textBr()
    .addText('------请扫描二维码关注我们------')
    .textBr()
    .qrcode('https://baidu.com')
    .printLogo()
    .setPrinter(sn)
    .cutPaper()
    .doPrint().then(res => {
        console.log(`打印成功`, res)
    })

console.log(tmp.getPrintContent().replace(/\<BR\>/g, '\n'))

打印效果图