更新记录

1.0.2(2022-06-06)

1、【优化】优化插件找不到第三方依赖问题

2、【优化】优化使用文档以及案例

1.0.1(2022-06-03)

1、【优化】优化插件处理接口,消息提示问题

1.0.0(2022-05-30)

1、芯烨云打印机插件发布最新版本

2、支持所有芯烨云平台的接口和打印机

查看更多

平台兼容性

Android Android CPU类型 iOS
适用版本区间:4.4 - 11.0 armeabi-v7a:未测试,arm64-v8a:未测试,x86:未测试 ×

原生插件通用使用流程:

  1. 购买插件,选择该插件绑定的项目。
  2. 在HBuilderX里找到项目,在manifest的app原生插件配置中勾选模块,如需要填写参数则参考插件作者的文档添加。
  3. 根据插件作者的提供的文档开发代码,在代码中引用插件,调用插件功能。
  4. 打包自定义基座,选择插件,得到自定义基座,然后运行时选择自定义基座,进行log输出测试。
  5. 开发完毕后正式云打包

付费原生插件目前不支持离线打包。
Android 离线打包原生插件另见文档 https://nativesupport.dcloud.net.cn/NativePlugin/offline_package/android
iOS 离线打包原生插件另见文档 https://nativesupport.dcloud.net.cn/NativePlugin/offline_package/ios

注意事项:使用HBuilderX2.7.14以下版本,如果同一插件且同一appid下购买并绑定了多个包名,提交云打包界面提示包名绑定不一致时,需要在HBuilderX项目中manifest.json->“App原生插件配置”->”云端插件“列表中删除该插件重新选择


芯烨云打印机插件

插件需求

使用插件前,请先使用试用版本,在本地调试好,看插件是否满足,再进行购买。如果插件不满足你的需求,可以联系我,尝试修改插件或者增加功能的方式,来帮助实现你的业务逻辑。

接口列表

  • 获取插件
  • 测试插件
  • 初始化配置:在线
  • 初始化配置:离线
  • 添加打印机【必接】
  • 设置打印机语音类型
  • 打印小票订单
  • 打印标签订单
  • 删除打印机
  • 修改打印机信息
  • 清空待打印队列
  • 查询订单状态
  • 查询打印机订单数
  • 查询打印机状态
  • 批量查询打印机状态
  • 云喇叭播放语音
  • POS 指令
  • 钱箱控制

使用案例

获取插件

// 芯烨云打印机插件
let xpyunPrinterPlugin = uni.requireNativePlugin('Tellsea-XpyunPrinterPlugin');
console.log('芯烨云打印机插件:' + JSON.stringify(xpyunPrinterPlugin));

测试插件

// 测试插件
testPlugin() {
    xpyunPrinterPlugin.testPlugin('测试插件', (e) => {
        let res = JSON.parse(e);
        if (res.code == 200) {
            that.$msg('安装成功');
        } else {
            that.$msg(res.msg);
        }
    });
},

初始化配置:在线

// 初始化配置:在线
onLine() {
    let params = {
        userName: '账号',
        userKey: 'key'
    };
    xpyunPrinterPlugin.onLine(params.userName, params.userKey, (e) => {
        let res = JSON.parse(e);
        console.log(res);
        if (res.code == 200) {
            that.$msg(res.msg);
        } else {
            that.$msg(res.msg);
        }
    });
},

初始化配置:离线

// 初始化配置:离线
offLine() {
    let params = {
        userName: '账号',
        userKey: 'key'
        // 内网IP映射到公网地址 https://open.xpyun.net/api/openapi
        baseUrl: '这里填写内网地址',
    };
    xpyunPrinterPlugin.offLine(params.userName, params.userKey, params.baseUrl, (e) => {
        let res = JSON.parse(e);
        console.log(res);
        if (res.code == 200) {
            that.$msg(res.msg);
        } else {
            that.$msg(res.msg);
        }
    });
},

添加打印机【必接】

// 添加打印机【必接】
addPrinters() {
    let params = {
        items: [{
            sn: 'XPY123456789A',
            name: '测试打印机'
        },
            {
                sn: 'XPY123456789A',
                name: '测试打印机'
            }
        ]
    };
    xpyunPrinterPlugin.execute('addPrinters', params, (e) => {
        let res = JSON.parse(e);
        console.log(res);
        if (res.code == 200) {
            that.$msg(res.msg);
        } else {
            that.$msg(res.msg);
        }
    });
},

设置打印机语音类型

// 设置打印机语音类型
setPrinterVoiceType() {
    let params = {
        sn: 'XPY123456789A',
        'voiceType': 3,
        'volumeLevel': 0
    };
    xpyunPrinterPlugin.execute('setPrinterVoiceType', params, (e) => {
        let res = JSON.parse(e);
        console.log(res);
        if (res.code == 200) {
            that.$msg(res.msg);
        } else {
            that.$msg(res.msg);
        }
    });
},

打印小票订单

// 打印小票订单
print() {
    let params = {
        "sn": "XPY123456789A",
        "content": "<CB>配送总单<BR></CB><CB>配送总单<BR></CB><CB>配送总单<BR></CB><CB>配送总单<BR></CB>",
        "copies": 1,
        "voice": 1,
    };
    xpyunPrinterPlugin.execute('print', params, (e) => {
        let res = JSON.parse(e);
        console.log(res);
        if (res.code == 200) {
            that.$msg(res.msg);
        } else {
            that.$msg(res.msg);
        }
    });
},

打印标签订单

// 打印标签订单
printLabel() {
    let params = {
        "sn": "XPY123456789A",
        "content": "<TEXT x=\"10\" y=\"100\" font=\"9\" w=\"1\" h=\"2\" r=\"0\">测试文本内容1</TEXT>",
        "copies": 1,
        "voice": 2,
    };
    xpyunPrinterPlugin.execute('printLabel', params, (e) => {
        let res = JSON.parse(e);
        console.log(res);
        if (res.code == 200) {
            that.$msg(res.msg);
        } else {
            that.$msg(res.msg);
        }
    });
},

删除打印机

// 删除打印机
delPrinters() {
    let params = {
        "snlist": ["XPY123456789A", "XPY987654321B", "XPY123456723A", "XPY987654345B"],
    };
    xpyunPrinterPlugin.execute('delPrinters', params, (e) => {
        let res = JSON.parse(e);
        console.log(res);
        if (res.code == 200) {
            that.$msg(res.msg);
        } else {
            that.$msg(res.msg);
        }
    });
},

修改打印机信息

// 修改打印机信息
updPrinter() {
    let params = {
        "sn": "XPY123456789A",
        "name": "X58C1",
        "cardno": "13031547528",
    };
    xpyunPrinterPlugin.execute('updPrinter', params, (e) => {
        let res = JSON.parse(e);
        console.log(res);
        if (res.code == 200) {
            that.$msg(res.msg);
        } else {
            that.$msg(res.msg);
        }
    });
},

清空待打印队列

// 清空待打印队列
delPrinterQueue() {
    let params = {
        "sn": "XPY123456789A",
    };
    xpyunPrinterPlugin.execute('delPrinterQueue', params, (e) => {
        let res = JSON.parse(e);
        console.log(res);
        if (res.code == 200) {
            that.$msg(res.msg);
        } else {
            that.$msg(res.msg);
        }
    });
},

查询订单状态

// 查询订单状态
queryOrderState() {
    let params = {
        "orderId": "OM19081005152569029225",
    };
    xpyunPrinterPlugin.execute('queryOrderState', params, (e) => {
        let res = JSON.parse(e);
        console.log(res);
        if (res.code == 200) {
            that.$msg(res.msg);
        } else {
            that.$msg(res.msg);
        }
    });
},

查询打印机订单数

// 查询打印机订单数
queryOrderStatis() {
    let params = {
        "sn": "XPY123456789A",
        "date": "2019-08-15",
    };
    xpyunPrinterPlugin.execute('queryOrderStatis', params, (e) => {
        let res = JSON.parse(e);
        console.log(res);
        if (res.code == 200) {
            that.$msg(res.msg);
        } else {
            that.$msg(res.msg);
        }
    });
},

查询打印机状态

// 查询打印机状态
queryPrinterStatus() {
    let params = {
        "sn": "XPY123456789A",
    };
    xpyunPrinterPlugin.execute('queryPrinterStatus', params, (e) => {
        let res = JSON.parse(e);
        console.log(res);
        if (res.code == 200) {
            that.$msg(res.msg);
        } else {
            that.$msg(res.msg);
        }
    });
},

批量查询打印机状态

// 批量查询打印机状态
queryPrintersStatus() {
    let params = {
        "snlist": ["XPY123456789A", "XPY123456789B"],
    };
    xpyunPrinterPlugin.execute('queryPrintersStatus', params, (e) => {
        let res = JSON.parse(e);
        console.log(res);
        if (res.code == 200) {
            that.$msg(res.msg);
        } else {
            that.$msg(res.msg);
        }
    });
},

云喇叭播放语音

// 云喇叭播放语音
playVoice() {
    let params = {
        "sn": "0504B38PFGB6A49",
        // 支付方式41~55:支付宝 微信 ...
        "payType": 41,
        // 支付与否59~61:退款 到账 消费
        "payMode": 59,
        // 支付金额
        "money": 100,
    };
    xpyunPrinterPlugin.execute('playVoice', params, (e) => {
        let res = JSON.parse(e);
        console.log(res);
        if (res.code == 200) {
            that.$msg(res.msg);
        } else {
            that.$msg(res.msg);
        }
    });
},

POS 指令

// POS 指令
pos() {
    let params = {
        "sn": "XPY123456789A",
        "content": "<CB>配送总单<BR></CB><CB>配送总单<BR></CB><CB>配送总单<BR></CB><CB>配送总单<BR></CB>",
        "copies": 1,
        "voice": 1,
    };
    xpyunPrinterPlugin.execute('pos', params, (e) => {
        let res = JSON.parse(e);
        console.log(res);
        if (res.code == 200) {
            that.$msg(res.msg);
        } else {
            that.$msg(res.msg);
        }
    });
},

钱箱控制

// 钱箱控制
controlBox() {
    let params = {
        "sn": "XPY123456789A",
        "content": "<CB>配送总单<BR></CB><CB>配送总单<BR></CB><CB>配送总单<BR></CB><CB>配送总单<BR></CB>",
        "copies": 1,
        "voice": 1,
    };
    xpyunPrinterPlugin.execute('controlBox', params, (e) => {
        let res = JSON.parse(e);
        console.log(res);
        if (res.code == 200) {
            that.$msg(res.msg);
        } else {
            that.$msg(res.msg);
        }
    });
},

隐私、权限声明

1. 本插件需要申请的系统权限列表:

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

插件不采集任何数据

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

暂无用户评论。

使用中有什么不明白的地方,就向插件作者提问吧~ 我要提问