商米钱箱插件
插件需求
使用插件前,请先使用试用版本,在本地调试好,看插件是否满足,再进行购买。如果插件不满足你的需求,可以联系我,尝试修改插件或者增加功能的方式,来帮助实现你的业务逻辑。
插件介绍
只要是商米设备连接的钱箱, 都能使用此插件打开钱箱,钱箱不限制品牌
使用案例
获取插件
// 商米钱箱插件
let sunmiCashboxPlugin = uni.requireNativePlugin('Tellsea-SunmiCashboxPlugin');
console.log('商米钱箱插件:' + JSON.stringify(sunmiCashboxPlugin));
连接服务
// 连接服务
connect() {
sunmiPrinterPlugin.connect((e) => {
let res = JSON.parse(e);
console.log(res);
if (res.code == 200) {
that.$msg(res.msg);
} else {
that.$msg(res.msg);
}
});
},
断开服务
// 断开服务
disconnect() {
sunmiPrinterPlugin.disconnect((e) => {
let res = JSON.parse(e);
console.log(res);
if (res.code == 200) {
that.$msg(res.msg);
} else {
that.$msg(res.msg);
}
});
},
打开钱箱
// 打开钱箱
openDrawer() {
sunmiCashboxPlugin.openDrawer((e) => {
let res = JSON.parse(e);
console.log(res);
if (res.code == 200) {
that.$msg(res.msg);
} else {
that.$msg(res.msg);
}
});
},