(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["package1/index/addTemplate"],{"38fd":function(t,i,e){"use strict";(function(t){var n=e("47a9"),s=e("3b2d");Object.defineProperty(i,"__esModule",{value:!0}),i.default=void 0;var o=e("7312"),a=(n(e("3cc2")),function(t,i){if(!i&&t&&t.__esModule)return t;if(null===t||"object"!==s(t)&&"function"!==typeof t)return{default:t};var e=h(i);if(e&&e.has(t))return e.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in t)if("default"!==a&&Object.prototype.hasOwnProperty.call(t,a)){var r=o?Object.getOwnPropertyDescriptor(t,a):null;r&&(r.get||r.set)?Object.defineProperty(n,a,r):n[a]=t[a]}n.default=t,e&&e.set(t,n);return n}(e("b37f")));n(e("ec9a"));function h(t){if("function"!==typeof WeakMap)return null;var i=new WeakMap,e=new WeakMap;return(h=function(t){return t?e:i})(t)}var r={data:function(){return{QrUrl:"1212",QrList1:{name:"",path:"",imgUrl:""},number:"",shippList:[],bufferData:[],categoryId:"",printName:"",shopId:t.getStorageSync("shopId"),shipId:"",discountCurrent:"left",items:[{value:"left",name:"靠左"},{value:"right",name:"居中"}],discountCurrent2:"blod",items2:[{value:"blod",name:"加粗"},{value:"notblod",name:"不加粗"}],iconList:[],screenHeight:0}},components:{kkPrinter:function(){Promise.all([e.e("common/vendor"),e.e("components/kk-printer/index")]).then(function(){return resolve(e("6e81"))}.bind(null,e)).catch(e.oe)}},onLoad:function(i){var e=t.getSystemInfoSync();if(this.screenHeight=e.screenHeight,this.iconList=(0,o.washingInstructions)(),t.getStorageSync("qrcode")&&(this.QrList1=t.getStorageSync("qrcode"),t.removeStorageSync("qrcode")),i){var n=JSON.parse(i.item);this.shipId=n.id,this.printName=n.printName,this.shippList=n.content;for(var s=0;s6)return t.showToast({title:"最多输入6个字符",icon:"none"}),void(this.QrList1.name="");this.QrList1.name=i.detail.value},scanCodeAdd:function(i){var e=this;t.scanCode({success:function(n){if(""!=n.result){if(-1==n.result.indexOf("u.wechat.com")&&-1==n.result.indexOf("qr.alipay.com")&&-1==n.result.indexOf("wxp://")&&n.result.length>80){var s=t.getStorageSync("shopId").substring("10","12")+(0,o.generateUUID)().substring("0","7"),a=[];a.push({id:s,longUrl:n.result}),e.tui.request("/app/urlMapping/saveOrUpdateUrlMapping","post",a,!1,!1).then((function(t){200==t.code&&(e.QrList1.path=e.tui.interfaceUrl()+"/app/urlMapping/redirect?id="+s)}))}else e.QrList1.path=n.result;e.QrUrl=e.QrList1.path,e.canUpdate=!1,e.$forceUpdate(),setTimeout((function(t){e.getQRCode(i)}),1e3)}else t.showToast({title:"扫描失败",icon:"none"})},fail:function(i){t.showToast({title:"扫描失败",icon:"none"})}})},getQRCode:function(i){var e=this;setTimeout((function(i){e.$refs.uqrcode.toTempFilePath({success:function(i){var n=t.createCanvasContext("qrcode1",e);n.setFillStyle("#fff"),n.fillRect(0,0,200,200);var s=e.getTempFilePath(i.tempFilePath);s.then((function(i){n.drawImage(i,8,8,184,184),n.draw(!0),setTimeout((function(i){t.canvasToTempFilePath({x:0,y:0,width:200,height:200,destWidth:200,destHeight:200,canvasId:"qrcode1",success:function(i){t.uploadFile({url:e.tui.interfaceUrl()+"/upload/file",filePath:i.tempFilePath,name:"file",header:{"content-type":"multipart/form-data",accessToken:e.tui.getToken()},formData:{},success:function(t){var i=JSON.parse(t.data);e.QrList1.imgUrl=i.result,e.canUpdate=!0,e.$forceUpdate()}})}})}),500)}))}})}),1e3)},getTempFilePath:function(i){return new Promise((function(e,n){var s=t.getFileSystemManager();i=i.split(",")[1];var o="temp_image_"+Date.now()+".png",a=t.env.USER_DATA_PATH+"/"+o,h=t.base64ToArrayBuffer(i);s.writeFile({filePath:a,data:h,encoding:"binary",success:function(t){return e(a)},fail:function(t){return n(t)}})}))},delIcon:function(i,e,n){var s=this;t.showModal({title:"提示",content:"确定删除此图标吗?",success:function(t){t.confirm&&("left"==n?s.shippList[i].leftIcon.splice(e,1):s.shippList[i].rightIcon.splice(e,1)),s.$forceUpdate()}})},checkIcon:function(t){"left"==this.listType?this.shippList[this.listIndex].leftIcon.push(t.value):this.shippList[this.listIndex].rightIcon.push(t.value),console.log(this.shippList),this.$forceUpdate(),this.$refs.showIconPopup.close()},addIcon:function(t,i){this.listIndex=t,this.listType=i,this.$refs.showIconPopup.open("bottom")},delItem:function(i){var e=this;t.showModal({title:"提示",content:"确定要删除吗?",success:function(t){t.confirm&&e.shippList.splice(i,1)}})},discountChange1:function(t,i){this.shippList[t].modelBlod=i.detail.value},discountChange:function(t,i){this.shippList[t].modelLeft=i.detail.value},topAddShip:function(){this.printName="",this.shipId="",this.shippList=[],this.addShippList(),this.$refs.getaPopup.open()},addShippList:function(){this.shippList.push({name:"",value:"",modelLeft:"left",modelBlod:"blod",leftIcon:[],rightIcon:[]}),this.$forceUpdate()},goAddClass:function(){for(var i=this,e=0;e15){var s=Math.ceil(Number(this.shippList[n].name.length)/15);e+=s}else e+=1;var o;o=Math.ceil((440-24*e)/e);var h=a.CreatCPCLPage(640,800,1,0);h+=a.addCPCLSETBOLD("1"),h+=a.addCPCLSETMAG(2,2),""!=this.printName&&(h+=a.addCPCLLocation(2),h+=a.addCPCLText("0",this.yNum,"24","0",0,this.printName)),h+=a.addCPCLLocation(0);if(h+=a.addCPCLQRCode(420,580,"M","2",4,this.QrList1.path),h+=a.addCPCLSETMAG(1,1),h+=a.addCPCLText(420,750,"24","0",0,this.QrList1.name),h+=a.addCPCLSETMAG(2,2),this.shippList.length>0){for(var r=0;r0||this.shippList[r].rightIcon.length>0){h+=a.addCPCLLocation(0);var c=370;(this.shippList[r].name+this.shippList[r].value).length>0&&(c-=30),p=Math.floor((c-(32*(this.shippList[r].leftIcon.length+this.shippList[r].rightIcon.length)+25*(this.shippList[r].name+this.shippList[r].value).length))/2)}else h+=a.addCPCLLocation(2);else h+=a.addCPCLLocation(0);"notblod"==this.shippList[r].modelBlod?h+=a.addCPCLSETBOLD("0"):h+=a.addCPCLSETBOLD("1");var u=25*(this.shippList[r].name.length-this.shippList[r].name.replace(/^\s+/," ").length)+30;if(this.shippList[r].leftIcon.length>0||this.shippList[r].rightIcon.length>0?this.yNum+=32+o:this.yNum+=25+o,console.log("beginNum",u),console.log("that.shippList",this.shippList),this.shippList[r].leftIcon.length>0){p+=31;for(var l=0;l0||this.shippList[r].rightIcon.length>0?h+=a.addCPCLText((u+p).toString(),this.yNum+4,"24","0",0,this.shippList[r].name+": "+this.shippList[r].value):h+=a.addCPCLText((u+p).toString(),this.yNum,"24","0",0,this.shippList[r].name+": "+this.shippList[r].value);else if(this.shippList[r].name.length>15)for(var d=Math.ceil(Number(this.shippList[r].name.length)/15),f=0;f0||this.shippList[r].rightIcon.length>0?h+=a.addCPCLText((u+p).toString(),this.yNum+4,"24","0",0,this.shippList[r].name.substring(15*f,15*(f+1))):h+=a.addCPCLText((u+p).toString(),this.yNum,"24","0",0,this.shippList[r].name.substring(15*f,15*(f+1))),this.shippList[r].leftIcon.length>0||this.shippList[r].rightIcon.length>0?this.yNum+=32+o:this.yNum+=25+o;else this.shippList[r].leftIcon.length>0||this.shippList[r].rightIcon.length>0?h+=a.addCPCLText((u+p).toString(),this.yNum+4,"24","0",0,this.shippList[r].name):h+=a.addCPCLText((u+p).toString(),this.yNum,"24","0",0,this.shippList[r].name);if(this.shippList[r].rightIcon.length>0){var m=Number(25*(this.shippList[r].name+this.shippList[r].value).length+30)+p;console.log("iconWidth1",m);for(var L=0;L