You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
11 KiB
1 lines
11 KiB
(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["package1/index/addTemplate"],{"55d0":function(t,i,e){"use strict";e.d(i,"b",(function(){return s})),e.d(i,"c",(function(){return o})),e.d(i,"a",(function(){return n}));var n={uniEasyinput:function(){return e.e("uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput").then(e.bind(null,"5fa6"))},uniIcons:function(){return Promise.all([e.e("common/vendor"),e.e("uni_modules/uni-icons/components/uni-icons/uni-icons")]).then(e.bind(null,"6bbb6"))},uqrcode:function(){return Promise.all([e.e("common/vendor"),e.e("uni_modules/Sansnn-uQRCode/components/uqrcode/uqrcode")]).then(e.bind(null,"532c"))},uniPopup:function(){return e.e("uni_modules/uni-popup/components/uni-popup/uni-popup").then(e.bind(null,"2864"))}},s=function(){var t=this,i=t.$createElement;t._self._c;t._isMounted||(t.e0=function(i){return t.$refs.printPopup.open()},t.e1=function(i){return t.$refs.showIconPopup.close()},t.e2=function(i){return t.$refs.showIconPopup.close()})},o=[]},"610f":function(t,i,e){"use strict";var n=e("71d6"),s=e.n(n);s.a},"6a92":function(t,i,e){"use strict";e.r(i);var n=e("9a12"),s=e.n(n);for(var o in n)["default"].indexOf(o)<0&&function(t){e.d(i,t,(function(){return n[t]}))}(o);i["default"]=s.a},7012:function(t,i,e){"use strict";(function(t,i){var n=e("47a9");e("7859");n(e("3240"));var s=n(e("e023"));t.__webpack_require_UNI_MP_PLUGIN__=e,i(s.default)}).call(this,e("3223")["default"],e("df3c")["createPage"])},"71d6":function(t,i,e){},"9a12":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("072a"),a=(n(e("60b9")),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("769c")));n(e("b9aa"));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:[]}},components:{kkPrinter:function(){Promise.all([e.e("common/vendor"),e.e("components/kk-printer/index")]).then(function(){return resolve(e("4af3"))}.bind(null,e)).catch(e.oe)}},onLoad:function(i){if(this.iconList=(0,o.washingInstructions)(),t.getStorageSync("qrcode")&&(this.QrList1=t.getStorageSync("qrcode"),t.removeStorageSync("qrcode")),i){var e=JSON.parse(i.item);this.shipId=e.id,this.printName=e.printName,this.shippList=e.content;for(var n=0;n<this.shippList.length;n++)void 0==this.shippList[n].leftIcon&&(this.shippList[n].leftIcon=[]),void 0==this.shippList[n].rightIcon&&(this.shippList[n].rightIcon=[]);this.$forceUpdate()}},methods:{addItemName:function(i,e){if(i.detail.value.length>6)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),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;e<this.shippList.length;e++)if(""==this.shippList[e].name)return void this.tui.toast("请输入标签名称");""!=this.QrList1.path&&this.shippList.unshift(this.QrList1);var n=JSON.stringify(this.shippList);""!=this.shipId?this.tui.request("/app/shopprint/update","POST",{printName:this.printName,id:this.shipId,content:n},!1,!1).then((function(t){200==t.code?(i.tui.toast("修改成功"),i.printName="",i.shipId="",i.$refs.getaPopup.close()):i.tui.toast(t.message)})).catch((function(t){})):this.tui.request("/app/shopprint/add","POST",{printName:this.printName,shopId:t.getStorageSync("shopId"),content:n},!1,!1).then((function(t){200==t.code?i.tui.toast("新增成功"):i.tui.toast(t.message)})).catch((function(t){})),setTimeout((function(i){t.navigateBack({delta:1})}),300)},onPrint1:function(){if(""!=this.number){for(var i=0;i<this.number;i++){this.yNum=20;for(var e=0,n=0;n<this.shippList.length;n++)if(this.shippList[n].name.length>15){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;r<this.shippList.length;r++){var p=0;if("right"==this.shippList[r].modelLeft)if(this.shippList[r].leftIcon.length>0||this.shippList[r].rightIcon.length>0){h+=a.addCPCLLocation(0);var u=370;(this.shippList[r].name+this.shippList[r].value).length>0&&(u-=30),p=Math.floor((u-(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 c=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,this.shippList[r].leftIcon.length>0){p+=31;for(var l=0;l<this.shippList[r].leftIcon.length;l++)h+="EG 4 32 "+p+" "+this.yNum+" "+this.shippList[r].leftIcon[l]+" ",p+=40}if(this.shippList[r].name=this.shippList[r].name.replace(/^\s+/," "),""!=this.shippList[r].value)this.shippList[r].leftIcon.length>0||this.shippList[r].rightIcon.length>0?h+=a.addCPCLText((c+p).toString(),this.yNum+4,"24","0",0,this.shippList[r].name+": "+this.shippList[r].value):h+=a.addCPCLText((c+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;f<d;f++)this.shippList[r].leftIcon.length>0||this.shippList[r].rightIcon.length>0?h+=a.addCPCLText((c+p).toString(),this.yNum+4,"24","0",0,this.shippList[r].name.substring(15*f,15*(f+1))):h+=a.addCPCLText((c+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((c+p).toString(),this.yNum+4,"24","0",0,this.shippList[r].name):h+=a.addCPCLText((c+p).toString(),this.yNum,"24","0",0,this.shippList[r].name);if(this.shippList[r].rightIcon.length>0)for(var m=Number(25*(this.shippList[r].name+this.shippList[r].value).length+30)+p,L=0;L<this.shippList[r].rightIcon.length;L++)h+="EG 4 32 "+m+" "+this.yNum+" "+this.shippList[r].rightIcon[L]+" ",m+=40}h+=a.addCPCLLocation(1),310}else h+=a.addCPCLLocation(2),this.yNum+60;h+=a.addCPCLPrint(),this.bufferData.push(h)}this.$nextTick((function(){t.navigateBack({delta:1})}))}else this.tui.toast("请输入数量再打印")}}};i.default=r}).call(this,e("df3c")["default"])},e023:function(t,i,e){"use strict";e.r(i);var n=e("55d0"),s=e("6a92");for(var o in s)["default"].indexOf(o)<0&&function(t){e.d(i,t,(function(){return s[t]}))}(o);e("610f");var a=e("828b"),h=Object(a["a"])(s["default"],n["b"],n["c"],!1,null,null,null,!1,n["a"],void 0);i["default"]=h.exports}},[["7012","common/runtime","common/vendor"]]]);
|