screenInit showWelcome showText showMenu showWXpay showImg showImgs showVideo showVideos imageLists videoLists imagesLists videosLists exitScreen cachefile
商米科技
上海商米科技有限公司是一家专注为O2O互联网平台,软件开发商、中小型商户提供专业的、高性价比的智能商用硬件设备的创新型科技企业。 商米硬件设备
目前商米主推的智能商用硬件包括 V1 , T1 , P1 , M1 ,D1 。设备应用于包括外卖接单,打印小票,扫描,收款,团购核销,点餐预约等一系列商业场景。
SUNMI OS商米设备运行的是SUNMIUI系统,SUNMIUI是基于Android深度优化改良的操作系统,支持安装普通基于Android系统的app,专为智能商用场景深度定制,从操作体验、性能提升与产品外观设计内外呼应,相得益彰。让用户在使用硬件的同时能享受更加专业系统的软件服务体验。 T1是一款面向互联网环境商业场景的多功能一体机,广泛应用于零售、餐饮。 sunmiT1Screen 是双屏异显功能,副屏可以显示不同于主屏的内容,可用来向用户展示广告,视频,图片,购物订单等内容。
官方文档:https://docs.sunmi.com/htmls/index.html?lang=zh##T1%E6%96%87%E6%A1%A3%E8%B5%84%E6%BA%90
注意
使用该插件时需要使用升级后的编译环境,请在应用打包的时候勾选“使用升级环境编译”,并且在控制台 “高级设置” 中将固件版本设置为5.0或以上
初始化副屏
screenInit(callback(ret, err))
ret:
{
status: true, //false
}
var demo = api.require('sunmiT1Screen');
demo.screenInit(function(ret, err) {
alert(JSON.stringify(ret));
});
Android系统
可提供的1.0.0及更高版本
显示欢迎
showWelcome(callback(ret, err))
ret:
{
status: true, //false
}
var demo = api.require('sunmiT1Screen');
demo.showWelcome(function(ret, err) {
alert(JSON.stringify(ret));
});
Android系统
可提供的1.0.0及更高版本
显示文本
showText({params},callback(ret, err))
title: content:
title:'金额',//显示的标题
content:'¥18.5'//显示的内容
ret:
{
status: true, //false
}
var demo = api.require('sunmiT1Screen');
demo.showText({
title:'金额',
content:'¥18.5'
},function(ret, err) {
alert(JSON.stringify(ret));
});
Android系统
可提供的1.0.0及更高版本
显示清单
showMenu({params}, callback(ret, err))
json:
{
"title": "三米奶茶店欢迎您",
"head": {
"param1": "序列号",
"param2": "商品名",
"param3": "单价",
"param4": "数量",
"param5": "小结"
},
"list": [
{
"param1": "1",
"param2": "华夫饼",
"param3": "10.00",
"param4": "1",
"param5":"10.00"
},
{
"param1": "1",
"param2": "吞拿鱼华夫饼",
"param3": "12.00",
"param4": "1",
"param5":"12.00"
}
],
"KVPList": [
{
"name": "收款",
"value": "¥40.00"
},
{
"name": "优惠",
"value": "¥3.00"
},
{
"name": "找零",
"value": "¥3.00"
},
{
"name": "实收",
"value": "¥37.00"
}
]
};
ret:
{
status: true, //false
}
var obj = api.require('sunmiT1Screen');
demo.showMenu({
json:{
"title": "三米奶茶店欢迎您",
"head": {
"param1": "序列号",
"param2": "商品名",
"param3": "单价",
"param4": "数量",
"param5": "小结"
},
"list": [
{
"param1": "1",
"param2": "华夫饼",
"param3": "10.00",
"param4": "1",
"param5":"10.00"
},
{
"param1": "1",
"param2": "吞拿鱼华夫饼",
"param3": "12.00",
"param4": "1",
"param5":"12.00"
}
],
"KVPList": [
{
"name": "收款",
"value": "¥40.00"
},
{
"name": "优惠",
"value": "¥3.00"
},
{
"name": "找零",
"value": "¥3.00"
},
{
"name": "实收",
"value": "¥37.00"
}
]
}
},function(ret){
alert(JSON.stringify(ret));
});
Android系统
可提供的1.0.0及更高版本
微信支付
showWXpay({params},callback(ret, err))
title: img: content:
imgs:'widget://image/qrcode.png',//显示的图片路径
title:'微信支付',//显示的标题
content:'20'//显示的内容
ret:
{
status: true, //false
}
var demo = api.require('sunmiT1Screen');
demo.showWXpay({
imgs:"widget://image/qrcode.png",
title:'微信支付',
content:'20'
},function(ret) {
alert(JSON.stringify(ret));
});
Android系统
可提供的1.0.0及更高版本
显示图片
showImg({params},callback(ret, err))
imgKey: img:
imgKey:在SharedPreferences中存储图片路径的key
img:显示图片本地路径
ret:
{
status: true, //false
}
var demo = api.require('sunmiT1Screen');
demo.showImg({
imgKey:'imgkey',
img:"widget://image/img_06.png"
},function(ret, err) {
alert(JSON.stringify(ret));
});
Android系统
可提供的1.0.0及更高版本
显示轮播图片
showImgs({params},callback(ret, err))
imgsKey: imgs: rotation_time:
imgsKey:在SharedPreferences中存储图片路径数组的key
imgs:显示图片本地路径的数组
rotation_time:轮播时间间隔
ret:
{
status: true, //false
}
var demo = api.require('sunmiT1Screen');
demo.showImgs({
imgsKey:'imgskey',
imgs:[
"widget://image/img_06.png",
"widget://image/img_04.png",
"widget://image/img_02.png"
],
rotation_time:3000
},function(ret){
alert(JSON.stringify(ret));
});
Android系统
可提供的1.0.0及更高版本
显示单个视频
showVideo({params},callback(ret, err))
videosKey: PathVideo:
videosKey:在SharedPreferences中存储视频路径的key
pathVideo:显示视频本地路径
ret:
{
status: true, //false
}
var demo = api.require('sunmiT1Screen');
demo.showVideo(
{
videoKey:'videokey'
pathVideo:"widget://image/video_03.mp4",
},function(ret){
alert(JSON.stringify(ret));
});
Android系统
可提供的1.0.0及更高版本
显示轮播视频
showVideos({params},callback(ret, err))
videosKey: videos:
videosKey:在SharedPreferences中存储视频路径数组的key
videos:显示视频本地路径的数组
ret:
{
status: true, //false
}
var demo = api.require('sunmiT1Screen');
demo.showVideos({
videosKey:'videoskey'
videos:[
"widget://image/video_03.mp4",
"widget://image/video_02.mp4",
"widget://image/video_01.mp4"
],
},function(ret){
alert(JSON.stringify(ret));
});
Android系统
可提供的1.0.0及更高版本
显示单个图片清单
imageLists((params),callback(ret, err))
imgMenuKey: json: img:
imgMenuKey:在SharedPreferences中存储图片路径的key
json:和显示清单一样
img:显示图片本地路径
ret:
{
status: true, //false
}
var demo = api.require('sunmiT1Screen');
demo.imageLists({
json:{
"title": "三米奶茶店欢迎您",
"head": {
"param1": "序列号",
"param2": "商品名",
"param3": "单价",
"param4": "数量",
"param5": "小结"
},
"list": [
{
"param1": "1",
"param2": "华夫饼",
"param3": "10.00",
"param4": "1",
"param5":"10.00"
},
{
"param1": "1",
"param2": "吞拿鱼华夫饼",
"param3": "12.00",
"param4": "1",
"param5":"12.00"
}
],
"KVPList": [
{
"name": "收款",
"value": "¥40.00"
},
{
"name": "优惠",
"value": "¥3.00"
},
{
"name": "找零",
"value": "¥3.00"
},
{
"name": "实收",
"value": "¥37.00"
}
]
},
imgMenuKey:'imgMenuKey',
img:"widget://image/img_05.png"
},function(ret){
alert(JSON.stringify(ret));
});
Android系统
可提供的1.0.0及更高版本
显示单个视频清单
videoLists((parames),callback(ret, err))
json: videoMenuKey: video:
json:和显示清单一样
videoMenuKey:在SharedPreferences中存储视频路径的key
video:显示视频本地路径
ret:
{
status: true, //false
}
var demo = api.require('sunmiT1Screen');
demo.videoLists({
json:{
"title": "三米奶茶店欢迎您",
"head": {
"param1": "序列号",
"param2": "商品名",
"param3": "单价",
"param4": "数量",
"param5": "小结"
},
"list": [
{
"param1": "1",
"param2": "华夫饼",
"param3": "10.00",
"param4": "1",
"param5":"10.00"
},
{
"param1": "1",
"param2": "吞拿鱼华夫饼",
"param3": "12.00",
"param4": "1",
"param5":"12.00"
}
],
"KVPList": [
{
"name": "收款",
"value": "¥40.00"
},
{
"name": "优惠",
"value": "¥3.00"
},
{
"name": "找零",
"value": "¥3.00"
},
{
"name": "实收",
"value": "¥37.00"
}
]
},
videoMenuKey:'videoMenukey',
video:"widget://image/video_03.mp4",
},function(ret){
alert(JSON.stringify(ret));
});
Android系统
可提供的1.0.0及更高版本
显示轮播图清单
imagesLists((parames),callback(ret, err))
json: imgsMenuKey: imgs: rotation_time:
json:和显示清单一样
imgsMenuKey:在SharedPreferences中存储图片数组路径的key
imgs:显示图片数组本地路径
rotation_time:轮播图切换的时间
ret:
{
status: true, //false
}
var demo = api.require('sunmiT1Screen');
demo.imagesLists({
json:{
"title": "三米奶茶店欢迎您",
"head": {
"param1": "序列号",
"param2": "商品名",
"param3": "单价",
"param4": "数量",
"param5": "小结"
},
"list": [
{
"param1": "1",
"param2": "华夫饼",
"param3": "10.00",
"param4": "1",
"param5":"10.00"
},
{
"param1": "1",
"param2": "吞拿鱼华夫饼",
"param3": "12.00",
"param4": "1",
"param5":"12.00"
}
],
"KVPList": [
{
"name": "收款",
"value": "¥40.00"
},
{
"name": "优惠",
"value": "¥3.00"
},
{
"name": "找零",
"value": "¥3.00"
},
{
"name": "实收",
"value": "¥37.00"
}
]
},
imgsMenuKey:'imgsMenukey',
imgs:[
"widget://image/img_06.png",
"widget://image/img_04.png",
"widget://image/img_02.png"
],
rotation_time:2000
},function(ret){
alert(JSON.stringify(ret));
});
Android系统
可提供的1.0.0及更高版本
显示轮播视频清单
videosLists((params),callback(ret, err))
json: videosMenuKey: videos:
json:和显示清单一样
videosMenuKey:在SharedPreferences中存储视频数组路径的key
videos:显示视频数组本地路径
ret:
{
status: true, //false
}
var demo = api.require('sunmiT1Screen');
demo.videosLists({
videosMenuKey:'videosMenukey',
videos:[
"widget://image/video_03.mp4",
"widget://image/video_02.mp4",
"widget://image/video_01.mp4"
],
json:{
"title": "三米奶茶店欢迎您",
"head": {
"param1": "序列号",
"param2": "商品名",
"param3": "单价",
"param4": "数量",
"param5": "小结"
},
"list": [
{
"param1": "1",
"param2": "华夫饼",
"param3": "10.00",
"param4": "1",
"param5":"10.00"
},
{
"param1": "1",
"param2": "吞拿鱼华夫饼",
"param3": "12.00",
"param4": "1",
"param5":"12.00"
}
],
"KVPList": [
{
"name": "收款",
"value": "¥40.00"
},
{
"name": "优惠",
"value": "¥3.00"
},
{
"name": "找零",
"value": "¥3.00"
},
{
"name": "实收",
"value": "¥37.00"
}
]
}
},function(ret){
alert(JSON.stringify(ret));
});
Android系统
可提供的1.0.0及更高版本
退出副屏
exitScreen(callback(ret, err))
ret:
{
status: true
}
var demo = api.require('sunmiT1Screen');
demo.exitScreen(function(ret, err) {
alert(JSON.stringify(ret));
});
Android系统
可提供的1.0.0及更高版本
清除缓存
cachefile(callback(ret, err))
ret:
{
status: true
}
var demo = api.require('sunmiT1Screen');
demo.cachefile(function(ret){
alert(JSON.stringify(ret));
});
Android系统
可提供的1.0.0及更高版本