pyxis-page/dist/js/chunk-db2c0ce8.c653e7f6.js

2 lines
13 KiB
JavaScript

(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-db2c0ce8"],{"5fe5":function(t,e,a){"use strict";a.r(e);var n=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"app-container"},[a("el-form",{ref:"postForm",staticClass:"form-container",attrs:{model:t.postForm,rules:t.rules,"label-width":"121px"}},[1===t.userLevel?a("el-form-item",{attrs:{label:"店铺",prop:"shop"}},[a("el-select",{staticClass:"w100",attrs:{placeholder:"选择店铺",name:"shop",required:""},model:{value:t.postForm.shop,callback:function(e){t.$set(t.postForm,"shop",e)},expression:"postForm.shop"}},t._l(t.allDepts,(function(t){return a("el-option",{key:t._id,attrs:{label:t.name,value:t._id}})})),1)],1):t._e(),a("el-form-item",{attrs:{label:"优惠券标题",prop:"name"}},[a("el-input",{staticStyle:{width:"50%"},attrs:{name:"name",required:""},model:{value:t.postForm.name,callback:function(e){t.$set(t.postForm,"name",e)},expression:"postForm.name"}})],1),a("el-form-item",{attrs:{label:"券描述",prop:"comment"}},[a("el-input",{staticStyle:{width:"50%"},attrs:{name:"comment",placeholder:"只在后台显示, 区分相似券"},model:{value:t.postForm.comment,callback:function(e){t.$set(t.postForm,"comment",e)},expression:"postForm.comment"}})],1),a("el-form-item",{attrs:{label:"总数",prop:"total"}},[a("el-input",{staticStyle:{width:"50%"},attrs:{name:"total",placeholder:""},model:{value:t.postForm.total,callback:function(e){t.$set(t.postForm,"total",e)},expression:"postForm.total"}})],1),a("el-form-item",{attrs:{label:"已领取",prop:"count"}},[a("el-input",{staticStyle:{width:"50%"},attrs:{name:"count",placeholder:"",readonly:""},model:{value:t.postForm.count,callback:function(e){t.$set(t.postForm,"count",e)},expression:"postForm.count"}})],1),a("el-form-item",{attrs:{label:"每人限领",prop:"limitOne"}},[a("el-input",{staticStyle:{width:"50%"},attrs:{name:"limitOne",placeholder:"0或不填表示不限制"},model:{value:t.postForm.limitOne,callback:function(e){t.$set(t.postForm,"limitOne",e)},expression:"postForm.limitOne"}})],1),a("el-form-item",{attrs:{label:"有效期",prop:"dataRange"}},[a("el-date-picker",{attrs:{type:"daterange",align:"right","unlink-panels":"","range-separator":"至","start-placeholder":"开始日期","end-placeholder":"结束日期"},model:{value:t.dataRange,callback:function(e){t.dataRange=e},expression:"dataRange"}})],1),a("el-form-item",{staticStyle:{"margin-bottom":"30px"},attrs:{prop:"content"}},[t.tinymceActive?a("tinymce",{ref:"editor",attrs:{height:600},model:{value:t.postForm.content,callback:function(e){t.$set(t.postForm,"content",e)},expression:"postForm.content"}}):t._e()],1),a("el-form-item",[a("el-button",{attrs:{type:"primary"},on:{click:t.submitForm}},[t._v(" 保存 ")]),a("el-button",{on:{click:t.onCancel}},[t._v(" 取消 ")])],1)],1)],1)},i=[],o=a("1da1"),r=a("d4ec"),s=a("bee2"),c=a("262e"),l=a("2caf"),u=(a("96cf"),a("0d03"),a("99af"),a("ac1f"),a("841c"),a("5319"),a("9ab4")),p=a("1b40"),d=a("ac1a"),m=a("e741"),h=a("b804"),f=a("6b45"),v=a("8256"),g=a("db85"),b=a("8960"),y=a("9dba"),w=function(t){Object(c["a"])(a,t);var e=Object(l["a"])(a);function a(){var t;return Object(r["a"])(this,a),t=e.apply(this,arguments),t.validateRequire=function(e,a,n){""===a?("imageURL"===e.field?t.$message({message:"Upload cover image is required",type:"error"}):t.$message({message:e.field+" 是必填的",type:"error"}),n(new Error(e.field+" 是必填的"))):n()},t.postForm=Object.assign({},b["a"]),t.loading=!1,t.tinymceActive=!0,t.rules={shop:[{validator:t.validateRequire,trigger:["blur","change"]}],name:[{validator:t.validateRequire}]},t.allDepts=[],t.dataRange=[],t}return Object(s["a"])(a,[{key:"lang",get:function(){return d["a"].language}},{key:"userLevel",get:function(){return y["a"].level}},{key:"created",value:function(){var t,e=null===(t=this.$route.params)||void 0===t?void 0:t.id;1===y["a"].level?this.getRemoteDeptList(""):this.postForm.shop=y["a"].department,e&&this.fetchData(e),this.tempTagView=Object.assign({},this.$route)}},{key:"onDataRangeChange",value:function(t){console.log("onDataRangeChange ".concat(t)),t&&(this.postForm.validBegin=t[0].getTime(),this.postForm.validEnd=t[1].getTime())}},{key:"fetchData",value:function(){var t=Object(o["a"])(regeneratorRuntime.mark((function t(e){var a,n,i;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,Object(b["c"])(e,{});case 3:a=t.sent,n=a.data,console.log(n),this.postForm=n,this.postForm.validBegin&&this.postForm.validEnd&&(this.dataRange=[new Date(this.postForm.validBegin),new Date(this.postForm.validEnd)]),i="zh"===this.lang?"编辑优惠券":"Edit Coupon",this.setTagsViewTitle(i),this.setPageTitle(i),t.next=16;break;case 13:t.prev=13,t.t0=t["catch"](0),console.error(t.t0);case 16:case"end":return t.stop()}}),t,this,[[0,13]])})));function e(e){return t.apply(this,arguments)}return e}()},{key:"setTagsViewTitle",value:function(t){var e=this.tempTagView;e&&(e.title="".concat(t,"-").concat(this.postForm._id),m["a"].updateVisitedView(e))}},{key:"setPageTitle",value:function(t){document.title="".concat(t," - ").concat(this.postForm._id)}},{key:"submitForm",value:function(){var t=Object(o["a"])(regeneratorRuntime.mark((function t(){var e,a,n;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.$refs.postForm.validate();case 3:return this.loading=!0,-1===this.postForm.content.search(/meta name=.+?viewport/)&&(e='\n<meta name="viewport" content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no" />\n',this.postForm.content=this.postForm.content.replace("<head>","<head>".concat(e))),t.next=7,Object(b["e"])(this.postForm);case 7:a=t.sent,n=a.data,this.postForm=n,this.postForm.validBegin&&this.postForm.validEnd&&(this.dataRange=[new Date(this.postForm.validBegin),new Date(this.postForm.validEnd)]),this.loading=!1,this.$notify({title:"Success",message:"优惠券保存成功",type:"success",duration:2e3}),t.next=19;break;case 15:return t.prev=15,t.t0=t["catch"](0),console.error("Submit Error!"),t.abrupt("return",!1);case 19:case"end":return t.stop()}}),t,this,[[0,15]])})));function e(){return t.apply(this,arguments)}return e}()},{key:"onCancel",value:function(){var t=Object(o["a"])(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.$confirm("确认不保存当前优惠券信息?","Warning",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"});case 3:this.$store.dispatch("delView",this.$route),this.$router.go(-1),t.next=9;break;case 7:t.prev=7,t.t0=t["catch"](0);case 9:case"end":return t.stop()}}),t,this,[[0,7]])})));function e(){return t.apply(this,arguments)}return e}()},{key:"getRemoteDeptList",value:function(){var t=Object(o["a"])(regeneratorRuntime.mark((function t(e){var a,n;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,Object(g["h"])({key:e});case 2:if(a=t.sent,n=a.data,n.records){t.next=6;break}return t.abrupt("return");case 6:this.allDepts=n.records;case 7:case"end":return t.stop()}}),t,this)})));function e(e){return t.apply(this,arguments)}return e}()}]),a}(p["c"]);Object(u["a"])([Object(p["d"])("dataRange")],w.prototype,"onDataRangeChange",null),w=Object(u["a"])([Object(p["a"])({name:"CouponEditor",components:{Sticky:h["a"],UploadImage:f["a"],Tinymce:v["a"]}})],w);var O=w,k=O,j=a("0c7c"),F=Object(j["a"])(k,n,i,!1,null,null,null);e["default"]=F.exports},"6b45":function(t,e,a){"use strict";var n=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"upload-container"},[a("el-upload",{staticClass:"image-uploader",attrs:{data:t.dataObj,name:"image-file",accept:"image/jpeg,image/gif,image/png",multiple:!1,"show-file-list":!1,"on-success":t.handleImageSuccess,drag:"",action:t.uploadUrl}},[a("i",{staticClass:"el-icon-upload"}),a("div",{staticClass:"el-upload__text"},[t._v(" 将文件拖到此处,或"),a("em",[t._v("点击上传")])])]),a("div",{staticClass:"image-preview"},[a("div",{directives:[{name:"show",rawName:"v-show",value:t.imageUrl.length>1,expression:"imageUrl.length>1"}],staticClass:"image-preview-wrapper"},[a("img",{attrs:{src:t.imageUrl}}),a("div",{staticClass:"image-preview-action"},[a("i",{staticClass:"el-icon-delete",on:{click:t.rmImage}})])])])],1)},i=[],o=a("d4ec"),r=a("bee2"),s=a("262e"),c=a("2caf"),l=a("9ab4"),u=a("1b40"),p=function(t){Object(s["a"])(a,t);var e=Object(c["a"])(a);function a(){var t;return Object(o["a"])(this,a),t=e.apply(this,arguments),t.uploadUrl="https://opm.kingsome.cn/api/upload",t.tempUrl="",t.dataObj={sub_path:"game",type:"image"},t}return Object(r["a"])(a,[{key:"imageUrl",get:function(){return this.value}},{key:"emitInput",value:function(t){this.$emit("input",t)}},{key:"rmImage",value:function(){this.emitInput("")}},{key:"handleImageSuccess",value:function(t){console.log(t),this.emitInput(t.url_cdn)}}]),a}(u["c"]);Object(l["a"])([Object(u["b"])({default:""})],p.prototype,"value",void 0),p=Object(l["a"])([Object(u["a"])({name:"UploadImage"})],p);var d=p,m=d,h=(a("961d"),a("0c7c")),f=Object(h["a"])(m,n,i,!1,null,"62f54f8e",null);e["a"]=f.exports},8960:function(t,e,a){"use strict";a.d(e,"a",(function(){return i})),a.d(e,"d",(function(){return o})),a.d(e,"c",(function(){return r})),a.d(e,"e",(function(){return s})),a.d(e,"b",(function(){return c}));var n=a("b32d"),i={shop:"",name:"",content:"",total:0,count:0,limitOne:1},o=function(t){return Object(n["a"])({url:"/api/coupons",method:"post",params:t})},r=function(t,e){return Object(n["a"])({url:"/api/coupon/".concat(t),method:"get",params:e})},s=function(t){return Object(n["a"])({url:"/api/coupon/save",method:"post",data:t})},c=function(t){return Object(n["a"])({url:"/api/coupon/".concat(t,"/delete"),method:"post"})}},"961d":function(t,e,a){"use strict";a("b43b")},b43b:function(t,e,a){},b804:function(t,e,a){"use strict";var n=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{style:{height:t.height,zIndex:t.zIndex}},[a("div",{class:t.className,style:{top:t.isSticky?t.stickyTop+"px":"",zIndex:t.zIndex,position:t.position,width:t.width,height:t.height}},[t._t("default",[a("div",[t._v("sticky")])])],2)])},i=[],o=a("d4ec"),r=a("bee2"),s=a("262e"),c=a("2caf"),l=(a("0d03"),a("d3b7"),a("25f0"),a("9ab4")),u=a("1b40"),p=function(t){Object(s["a"])(a,t);var e=Object(c["a"])(a);function a(){var t;return Object(o["a"])(this,a),t=e.apply(this,arguments),t.active=!1,t.position="",t.isSticky=!1,t.width="auto",t.height="auto",t}return Object(r["a"])(a,[{key:"mounted",value:function(){this.height=this.$el.getBoundingClientRect().height.toString()+"px",window.addEventListener("scroll",this.handleScroll),window.addEventListener("resize",this.handleResize)}},{key:"activated",value:function(){this.handleScroll()}},{key:"destroyed",value:function(){window.removeEventListener("scroll",this.handleScroll),window.removeEventListener("resize",this.handleResize)}},{key:"sticky",value:function(){this.active||(this.position="fixed",this.active=!0,this.width=this.width+"px",this.isSticky=!0)}},{key:"handleReset",value:function(){this.active&&(this.position="",this.width="auto",this.active=!1,this.isSticky=!1)}},{key:"handleScroll",value:function(){var t=this.$el.getBoundingClientRect().width;this.width=t.toString()+"px"||!1;var e=this.$el.getBoundingClientRect().top;e<this.stickyTop?this.sticky():this.handleReset()}},{key:"handleResize",value:function(){this.isSticky&&(this.width=this.$el.getBoundingClientRect().width.toString()+"px")}}]),a}(u["c"]);Object(l["a"])([Object(u["b"])({default:0})],p.prototype,"stickyTop",void 0),Object(l["a"])([Object(u["b"])({default:1})],p.prototype,"zIndex",void 0),Object(l["a"])([Object(u["b"])({default:""})],p.prototype,"className",void 0),p=Object(l["a"])([Object(u["a"])({name:"Sticky"})],p);var d=p,m=d,h=a("0c7c"),f=Object(h["a"])(m,n,i,!1,null,null,null);e["a"]=f.exports},db85:function(t,e,a){"use strict";a.d(e,"a",(function(){return i})),a.d(e,"h",(function(){return o})),a.d(e,"e",(function(){return r})),a.d(e,"d",(function(){return s})),a.d(e,"j",(function(){return c})),a.d(e,"b",(function(){return l})),a.d(e,"k",(function(){return u})),a.d(e,"f",(function(){return p})),a.d(e,"g",(function(){return d})),a.d(e,"m",(function(){return m})),a.d(e,"l",(function(){return h})),a.d(e,"c",(function(){return f})),a.d(e,"i",(function(){return v}));var n=a("b32d"),i={name:"",address:"",logo:"",qtypes:[]},o=function(t){return Object(n["a"])({url:"/api/shops",method:"post",params:t})},r=function(t,e){return Object(n["a"])({url:"/api/shop/".concat(t),method:"get",params:e})},s=function(){return Object(n["a"])({url:"/api/myshop",method:"get"})},c=function(t){return Object(n["a"])({url:"/api/shop/save",method:"post",data:t})},l=function(t){return Object(n["a"])({url:"/api/shop/".concat(t,"/delete"),method:"post"})},u=function(t){return Object(n["a"])({url:"/api/shop/gameinfo/save",method:"post",data:t})},p=function(t){return Object(n["a"])({url:"/api/shop/gameinfo",method:"post",data:t})},d=function(t){return Object(n["a"])({url:"/api/shop/gameqr",method:"post",data:t})},m=function(t){return Object(n["a"])({url:"/api/shop/save_qtype",method:"post",data:t})},h=function(t){return Object(n["a"])({url:"/api/shop/publish",method:"post",data:t})},f=function(t){return Object(n["a"])({url:"/api/shop/gametheme",method:"post",data:t})},v=function(t){return Object(n["a"])({url:"/api/shop/gametheme/save",method:"post",data:t})}}}]);
//# sourceMappingURL=chunk-db2c0ce8.c653e7f6.js.map