(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-37ee6f14"],{"31a8":function(e,t,a){"use strict";var r=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"upload-corp-container"},[a("div",{staticClass:"source"},[a("div",[a("div",{staticClass:"avatar-uploader"},[a("div",{staticClass:"el-upload el-upload--text",attrs:{tabindex:"0"}},[e.hasImg?e._e():a("i",{staticClass:"el-icon-plus avatar-uploader-icon",on:{click:e.handleClick}}),e.hasImg?a("img",{staticClass:"upload-preview-img",attrs:{alt:"",src:e.initialImgUrl},on:{click:e.showInitImg}}):e._e(),a("input",{ref:"fileinput",staticClass:"el-upload__input",attrs:{type:"file",name:"file",accept:"image/*"},on:{change:e.handleChange}}),e.hasImg?a("div",{staticClass:"action-bar"},[a("el-button",{attrs:{type:"success",size:"small",icon:"el-icon-edit"},on:{click:e.handleClick}},[e._v(" 替换 ")]),a("el-button",{attrs:{type:"danger",size:"small",icon:"el-icon-delete"},on:{click:e.removeImg}},[e._v(" 移除 ")])],1):e._e()])])])]),a("div",{directives:[{name:"show",rawName:"v-show",value:e.show,expression:"show"}],staticClass:"vue-image-crop-upload"},[a("div",{staticClass:"vicp-wrap"},[a("div",{staticClass:"vicp-close",on:{click:e.off}},[a("i",{staticClass:"vicp-icon4"})]),2===e.step?a("div",{staticClass:"vicp-step2"},[a("div",{staticClass:"vicp-crop"},[a("div",{directives:[{name:"show",rawName:"v-show",value:!0,expression:"true"}],staticClass:"vicp-crop-left"},[a("div",{staticClass:"vicp-img-container",on:{wheel:function(t){return t.preventDefault(),e.handleMouseWheel(t)}}},[a("img",{ref:"img",staticClass:"vicp-img",style:e.sourceImgStyle,attrs:{src:e.sourceImgUrl,draggable:"false",alt:""},on:{drag:e.preventDefault,dragstart:e.preventDefault,dragend:e.preventDefault,dragleave:e.preventDefault,dragover:e.preventDefault,dragenter:e.preventDefault,drop:e.preventDefault,touchstart:e.imgStartMove,touchmove:e.imgMove,touchend:e.createImg,touchcancel:e.createImg,mousedown:e.imgStartMove,mousemove:e.imgMove,mouseup:e.createImg,mouseout:e.createImg}}),a("div",{staticClass:"vicp-img-shade vicp-img-shade-1",style:e.sourceImgShadeStyle}),a("div",{staticClass:"vicp-img-shade vicp-img-shade-2",style:e.sourceImgShadeStyle})]),a("div",{staticClass:"vicp-range"},[a("input",{directives:[{name:"model",rawName:"v-model",value:e.scale.range,expression:"scale.range"}],attrs:{type:"range",step:"1",min:"0",max:"100"},domProps:{value:e.scale.range},on:{mousemove:e.zoomChange,__r:function(t){return e.$set(e.scale,"range",t.target.value)}}}),a("i",{staticClass:"vicp-icon5",on:{mousedown:e.startZoomSub,mouseout:e.endZoomSub,mouseup:e.endZoomSub}}),a("i",{staticClass:"vicp-icon6",on:{mousedown:e.startZoomAdd,mouseout:e.endZoomAdd,mouseup:e.endZoomAdd}})]),e.noRotate?e._e():a("div",{staticClass:"vicp-rotate"},[a("i",{on:{click:e.rotateImg}},[e._v("↻")])])]),a("div",{directives:[{name:"show",rawName:"v-show",value:!0,expression:"true"}],staticClass:"vicp-crop-right"},[a("div",{staticClass:"vicp-preview"},[e.noSquare?e._e():a("div",{staticClass:"vicp-preview-item"},[a("img",{style:e.previewStyle,attrs:{src:e.createImgUrl}}),a("span",[e._v("预览")])]),e.noCircle?e._e():a("div",{staticClass:"vicp-preview-item vicp-preview-item-circle"},[a("img",{style:e.previewStyle,attrs:{src:e.createImgUrl}}),a("span",[e._v("预览")])])])])]),a("div",{staticClass:"vicp-operate"},[a("el-button",{attrs:{type:"warning",size:"small",icon:"el-icon-edit"},on:{click:e.off}},[e._v(" 取消 ")]),a("el-button",{attrs:{type:"primary",size:"small",icon:"el-icon-success"},on:{click:e.prepareUpload}},[e._v(" 保存 ")])],1)]):e._e(),3===e.step?a("div",{staticClass:"vicp-step3"},[a("div",{staticClass:"vicp-upload"},[a("span",{directives:[{name:"show",rawName:"v-show",value:1===e.loading,expression:"loading === 1"}],staticClass:"vicp-loading"},[e._v("正在上传……")]),a("div",{staticClass:"vicp-progress-wrap"},[a("span",{directives:[{name:"show",rawName:"v-show",value:1===e.loading,expression:"loading === 1"}],staticClass:"vicp-progress",style:e.progressStyle})]),a("div",{directives:[{name:"show",rawName:"v-show",value:2===e.loading,expression:"loading === 2"}],staticClass:"vicp-success"},[a("i",{staticClass:"vicp-icon3"}),e._v(" 上传成功 ")])]),a("div",{staticClass:"vicp-operate"},[a("a",{on:{click:function(t){return e.setStep(2)},mousedown:e.ripple}},[e._v("返回")]),a("a",{on:{click:e.off,mousedown:e.ripple}},[e._v("关闭")])])]):e._e(),a("canvas",{directives:[{name:"show",rawName:"v-show",value:!1,expression:"false"}],ref:"canvas",attrs:{width:e.width,height:e.height}})])])])},i=[],s=a("1da1"),o=a("53ca"),n=a("d4ec"),c=a("bee2"),l=a("262e"),u=a("2caf"),p=(a("96cf"),a("c975"),a("4795"),a("b0c0"),a("4160"),a("159b"),a("b64b"),a("d3b7"),a("9ab4")),h=a("1b40"),d=(a("4ec9"),a("3ca3"),a("ddb0"),new Map([["jpg","image/jpeg"],["png","image/png"],["gif","image/gif"],["svg","image/svg+xml"],["psd","image/photoshop"]]));a("ac1f"),a("1276"),a("ace4"),a("5cc6"),a("9a8c"),a("a975"),a("735e"),a("c1ac"),a("d139"),a("3a7b"),a("d5d6"),a("82f8"),a("e91f"),a("60bd"),a("5f96"),a("3280"),a("3fcc"),a("ca91"),a("25a1"),a("cd26"),a("3c5d"),a("2954"),a("649e"),a("219c"),a("170b"),a("b39a"),a("72f7");function m(e,t){e=e.split(",")[1],e=window.atob(e);for(var a=new Uint8Array(e.length),r=0;rs&&(u=i.width/e,l=i.width/a,n=(i.height-l)/2),{scale:u,x:o,y:n,width:c,height:l}}},{key:"sourceImgShadeStyle",get:function(){var e=this.sourceImgMasking,t=this.sourceImgContainer,a=t,r=e,i=r.width===a.width?r.width:(a.width-r.width)/2,s=r.height===a.height?r.height:(a.height-r.height)/2;return{width:i+"px",height:s+"px"}}},{key:"previewStyle",get:function(){var e=this.ratio,t=this.previewContainer,a=t,r=a.width,i=a.height,s=r/i;return es&&(i=a.width/e),{width:r+"px",height:i+"px"}}},{key:"beforeUnmount",value:function(){document.removeEventListener("keyup",this.handleEscClose)}},{key:"mounted",value:function(){this.sourceImgUrl&&this.startCrop()}},{key:"showInitImg",value:function(){this.initialImgUrl&&(this.sourceImgUrl=this.initialImgUrl,this.startCrop())}},{key:"handleEscClose",value:function(e){!this.show||"Escape"!==e.key&&27!==e.keyCode||this.off()}},{key:"ripple",value:function(e){g(e)}},{key:"stepChange",value:function(){this.show=1!==this.step}},{key:"checkShowError",value:function(){this.hasError&&this.errorMsg&&(this.$message.error(this.errorMsg),this.hasError=!1,this.errorMsg="")}},{key:"off",value:function(){var e=this;setTimeout((function(){e.show=!1,3===e.step&&2===e.loading&&e.setStep(1)}),200)}},{key:"setStep",value:function(e){var t=this;setTimeout((function(){t.step=e}),200)}},{key:"preventDefault",value:function(e){return e.preventDefault(),!1}},{key:"handleClick",value:function(e){1!==this.loading&&e.target!==this.$refs.fileinput&&(e.preventDefault(),this.$refs.fileinput.click())}},{key:"handleChange",value:function(e){if(e.preventDefault(),1!==this.loading){var t=e.target.files||e.dataTransfer.files;this.reset(),this.checkFile(t[0])?this.setSourceImg(t[0]):this.off()}}},{key:"checkFile",value:function(e){var t=this.maxSize;return-1===e.type.indexOf("image")?(this.hasError=!0,this.errorMsg="仅限图片格式",!1):!(e.size/1024>t)||(this.hasError=!0,this.errorMsg="单文件大小不能超过 "+t+"kb",!1)}},{key:"reset",value:function(){this.loading=0,this.hasError=!1,this.errorMsg="",this.progress=0}},{key:"setSourceImg",value:function(e){this.$emit("src-file-set",e.name,e.type,e.size);var t=new FileReader,a=this;t.onload=function(e){a.sourceImgUrl=t.result+"",a.startCrop()},t.readAsDataURL(e)}},{key:"startCrop",value:function(){var e=this.width,t=this.height,a=this.ratio,r=this.scale,i=this.sourceImgUrl,s=this.sourceImgMasking,o=s,n=new Image;n.src=i,n.setAttribute("crossOrigin","Anonymous");var c=this;n.onload=function(){var i=n.naturalWidth,s=n.naturalHeight,l=i/s,u=o.width,p=o.height,h=0,d=0;if(il&&(p=u/l,d=(o.height-p)/2),a0&&(g=0),f>0&&(f=0),g0&&this.zoomImg(t.range>=100?100:++t.range),e.wheelDelta<0&&this.zoomImg(t.range<=0?0:--t.range)):e.detail&&(e.detail>0&&this.zoomImg(t.range>=100?100:++t.range),e.detail<0&&this.zoomImg(t.range<=0?0:--t.range))}},{key:"startZoomAdd",value:function(e){var t=this.scale,a=this;function r(){if(t.zoomAddOn){var e=t.range>=100?100:++t.range;a.zoomImg(e),setTimeout((function(){r()}),60)}}t.zoomAddOn=!0,r()}},{key:"endZoomAdd",value:function(e){this.scale.zoomAddOn=!1}},{key:"startZoomSub",value:function(e){var t=this.scale,a=this;function r(){if(t.zoomSubOn){var e=t.range<=0?0:--t.range;a.zoomImg(e),setTimeout((function(){r()}),60)}}t.zoomSubOn=!0,r()}},{key:"endZoomSub",value:function(e){var t=this.scale;t.zoomSubOn=!1}},{key:"zoomChange",value:function(e){this.zoomImg(e.target.value)}},{key:"zoomImg",value:function(e){var t=this.sourceImgMasking,a=this.scale,r=a.maxWidth,i=a.maxHeight,s=a.minWidth,o=a.minHeight,n=a.width,c=a.height,l=a.x,u=a.y,p=t,h=p.width,d=p.height,m=s+(r-s)*e/100,g=o+(i-o)*e/100,f=h/2-m/n*(h/2-l),v=d/2-g/c*(d/2-u);f>0&&(f=0),v>0&&(v=0),f1&&(this.postForm.beginDay=this.dataRange[0].getTime(),this.postForm.endDay=this.dataRange[1].getTime()),this.postForm.qtypes=this.$refs.typeTree.getCheckedKeys(),this.loading=!0,e.next=15,Object(w["g"])(this.postForm);case 15:l=e.sent,u=l.data,this.postForm=u,this.loading=!1,this.$notify({title:"Success",message:"The post save successfully",type:"success",duration:2e3}),I["k"].$emit(I["a"],{}),e.next=27;break;case 23:return e.prev=23,e.t0=e["catch"](0),console.error("Submit Error!"),e.abrupt("return",!1);case 27:case"end":return e.stop()}}),e,this,[[0,23]])})));function t(){return e.apply(this,arguments)}return t}()},{key:"onCancel",value:function(){var e=Object(o["a"])(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.$confirm("确认不保存当前活动信息?","Warning",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"});case 3:this.$store.dispatch("delView",this.$route),this.$router.go(-1),e.next=9;break;case 7:e.prev=7,e.t0=e["catch"](0);case 9:case"end":return e.stop()}}),e,this,[[0,7]])})));function t(){return e.apply(this,arguments)}return t}()},{key:"getRemoteDeptList",value:function(){var e=Object(o["a"])(regeneratorRuntime.mark((function e(){var t,a;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Object(y["k"])({});case 2:if(t=e.sent,a=t.data,a.records){e.next=6;break}return e.abrupt("return");case 6:this.allDepts=a.records;case 7:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"fetchMyShop",value:function(){var e=Object(o["a"])(regeneratorRuntime.mark((function e(){var t,a;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Object(y["d"])();case 2:t=e.sent,a=t.data,this.typeSelected=a.qtypes,console.log(this.typeSelected),this.$refs.typeTree.setCheckedKeys(this.typeSelected);case 7:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"dataChange",value:function(e){console.log(this.selectDate)}},{key:"initTimes",value:function(){for(var e=0;e<24;e++)for(var t=0;t<4;t++){var a=3600*e+15*t*60,r=Object(k["f"])(a,!1);this.times.push(r)}this.monthDays.push({id:0,label:"全选"});for(var i=1;i<32;i++)this.monthDays.push({id:i,label:i+""})}},{key:"timeChange",value:function(e){if(e.length>0){var t=this.selectTime[this.selectTime.length-1];/^\d{1,2}:\d{1,2}$/.test(t)||this.selectTime.pop(),t=Object(k["f"])(Object(k["g"])(t),!1),this.selectTime.splice(this.selectTime.length-1,1,t),console.log(this.selectTime)}}},{key:"monthDaysChange",value:function(e){if(e.indexOf(0)>=0){this.postForm.monthDays.length=0;for(var t=1;t<32;t++)this.postForm.monthDays.push(t)}}},{key:"onShopChange",value:function(){var e;if(this.postForm.shop&&this.getCouponList(this.postForm.shop),(null===(e=this.postForm.qtypes)||void 0===e?void 0:e.length)>0)this.typeSelected=this.postForm.qtypes;else if(this.postForm.shop){var t,a,r=Object(s["a"])(this.allDepts);try{for(r.s();!(a=r.n()).done;){var i=a.value;if(i._id===this.postForm.shop){t=i;break}}}catch(o){r.e(o)}finally{r.f()}this.typeSelected=t?t.qtypes:[]}this.$refs.typeTree.setCheckedKeys(this.typeSelected)}},{key:"getRemoteCategory",value:function(){var e=Object(o["a"])(regeneratorRuntime.mark((function e(){var t,a,r,i,o,n,c,l,u;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Object(x["d"])();case 2:t=e.sent,a=t.data,r=Object(s["a"])(a);try{for(r.s();!(i=r.n()).done;){o=i.value,n=[],c=Object(s["a"])(o.children);try{for(c.s();!(l=c.n()).done;)u=l.value,n.push({id:u._id,label:u.name})}catch(p){c.e(p)}finally{c.f()}this.typeOptions.push({id:o._id,label:o.name,children:n})}}catch(p){r.e(p)}finally{r.f()}case 6:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"getCouponList",value:function(){var e=Object(o["a"])(regeneratorRuntime.mark((function e(t){var a,r;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Object(j["d"])({shop:t});case 2:a=e.sent,r=a.data,this.coupons=r.records;case 5:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"formatCoupon",value:function(e,t,a,r){var i,o="未知(".concat(a,")"),n=this.postForm.rewardInfo[r],c=Object(s["a"])(this.coupons);try{for(c.s();!(i=c.n()).done;){var l=i.value;if(l._id===a){o=l.name;break}}}catch(u){c.e(u)}finally{c.f()}return"".concat(o," x ").concat(n.count)}},{key:"formatRank",value:function(e,t,a,r){var i=this.postForm.rewardInfo[r],s="第 ".concat(i.rank," 名");return i.rankEnd&&(s="第 ".concat(i.rank," 至 ").concat(i.rankEnd," 名")),s}},{key:"deleteRank",value:function(){var e=Object(o["a"])(regeneratorRuntime.mark((function e(t){var a;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return a=t.$index,e.prev=1,e.next=4,this.$confirm("Confirm to remove the record?","Warning",{confirmButtonText:"Confirm",cancelButtonText:"Cancel",type:"warning"});case 4:this.postForm.rewardInfo.splice(a,1),this.$message({type:"success",message:"删除成功, 请点击保存"}),e.next=10;break;case 8:e.prev=8,e.t0=e["catch"](1);case 10:case"end":return e.stop()}}),e,this,[[1,8]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"handleCreateReward",value:function(){this.record=Object.assign({},w["b"]),this.record.id=this.postForm.rewardInfo.length,this.dialogType="new",this.dialogVisible=!0}},{key:"handleEdit",value:function(e){this.dialogType="edit",this.dialogVisible=!0,this.record=Object(O["cloneDeep"])(e.row)}},{key:"closeModal",value:function(){this.dialogVisible=!1,this.$refs.modalForm.clearValidate()}},{key:"saveReward",value:function(){var e=this,t="edit"===this.dialogType;this.$refs.modalForm.validate(function(){var a=Object(o["a"])(regeneratorRuntime.mark((function a(r){var i;return regeneratorRuntime.wrap((function(a){while(1)switch(a.prev=a.next){case 0:if(r){a.next=3;break}return e.$message.error("请按要求填写表单"),a.abrupt("return",!1);case 3:if(!t){a.next=14;break}i=0;case 5:if(!(i