(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["components/kk-printer/index"],{"0024":function(e,t,i){"use strict";(function(e,n){var c=i("47a9"),o=i("3b2d");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=c(i("2df0"));(function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==o(e)&&"function"!==typeof e)return{default:e};var i=r(t);if(i&&i.has(e))return i.get(e);var n={},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var s=c?Object.getOwnPropertyDescriptor(e,a):null;s&&(s.get||s.set)?Object.defineProperty(n,a,s):n[a]=e[a]}n.default=e,i&&i.set(e,n)})(i("769c")),c(i("60b9"));function r(e){if("function"!==typeof WeakMap)return null;var t=new WeakMap,i=new WeakMap;return(r=function(e){return e?i:t})(e)}var s={data:function(){return{isPrinting:!1,isSearching:!1,isShowSearch:!1,filterName:"",filterRSSI:-95,devicesList:[],picWaitTime:0,deviceId:"",services:"",serviceId:"",writeId:"",readId:"",iosNo:!1,deviceType:"ios"}},props:{defaultText:{type:String,default:"打印"},printingText:{type:String,default:"打印中..."},bufferData:{type:Array,require:!0},roomcode:{type:String,require:!0},CustName:{type:String,require:!0},roomid:{type:String,require:!0}},mounted:function(){},onLoad:function(){},beforeDestroy:function(){this.stopSearchBtnTap()},methods:{doNothing:function(){},handlePrintTap:function(){var t=this;e.showLoading({mask:!0,title:"打印中..."}),e.getSystemInfo({success:function(e){t.deviceType=e.osName},fail:function(e){}}),n.openBluetoothAdapter({mode:"central",success:function(e){t.sousuo()},fail:function(i){"10001"==i.errCode?e.showToast({duration:2e3,title:"请打开蓝牙后,再进行连接",icon:"none",mask:!0}):(t.tui.toast("连接失败,请重启蓝牙或删除小程序重新进入-1"),t.isShowSearch=!0),setTimeout((function(t){e.hideLoading()}),2e3)}})},sousuo:function(){var t=this;this.devicesList=[],n.startBluetoothDevicesDiscovery({success:function(e){t.jiantingshebei()},fail:function(i){t.tui.toast("连接失败,请重启蓝牙或删除小程序重新进入-2",i),n.closeBLEConnection({deviceId:e.getStorageSync("deviceId"),success:function(e){},fail:function(e){}}),n.closeBluetoothAdapter({success:function(e){},fail:function(e){}}),e.removeStorageSync("deviceId"),t.handlePrintTap(),t.isShowSearch=!0,setTimeout((function(t){e.hideLoading()}),2e3)}})},stopSearchBtnTap:function(){n.stopBluetoothDevicesDiscovery()},jiantingshebei:function(){var t=this;e.getStorageSync("deviceId")?t.lianejieshebei(e.getStorageSync("deviceId")):(e.hideLoading(),t.isShowSearch=!0,n.onBluetoothDeviceFound((function(e){e.devices.forEach((function(e){(e.name||e.localName)&&t.devicesList.push(e)}))})))},lianejieshebei:function(t){var i=this;e.showLoading({mask:!0,title:"加载中..."});var c=setTimeout((function(){n.closeBLEConnection({deviceId:t,success:function(e){},fail:function(e){}}),n.closeBluetoothAdapter({success:function(e){},fail:function(e){}}),e.removeStorageSync("deviceId"),i.handlePrintTap(),i.isShowSearch=!0}),5e3);n.createBLEConnection({deviceId:t,success:function(){clearTimeout(c),i.isShowSearch=!1,i.huoqufuwu(t)},fail:function(e){clearTimeout(c),"1509007"==e.errno&&i.huoqufuwu(t),"1509003"==e.errno&&i.lianejieshebei(t)}})},huoqufuwu:function(t){var i=this;n.getBLEDeviceServices({deviceId:t,success:function(e){i.duxietezhengzhi(t,e)},fail:function(t){i.tui.toast("连接失败,请重启蓝牙或删除小程序重新进入-4",t),n.closeBLEConnection({deviceId:e.getStorageSync("deviceId"),success:function(e){}}),e.removeStorageSync("deviceId"),i.sousuo(),i.isShowSearch=!0,setTimeout((function(t){e.hideLoading()}),2e3)}})},duxietezhengzhi:function(t,i){var c=this;n.getBLEDeviceCharacteristics({deviceId:t,serviceId:i.services[0].uuid,success:function(n){for(var o=0;o