pyxis-page/dist/js/chunk-3b7cfdf7.4e19a81f.js
2021-05-19 20:41:13 +08:00

2 lines
9.1 KiB
JavaScript

(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-3b7cfdf7"],{"5fe5":function(t,e,n){"use strict";n.r(e);var a=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"app-container"},[n("el-form",{ref:"postForm",staticClass:"form-container",attrs:{model:t.postForm,rules:t.rules,"label-width":"121px"}},[1===t.userLevel?n("el-form-item",{attrs:{label:"店铺",prop:"shop"}},[n("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 n("el-option",{key:t._id,attrs:{label:t.name,value:t._id}})})),1)],1):t._e(),n("el-form-item",{attrs:{label:"优惠券标题",prop:"name"}},[n("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),n("el-form-item",{attrs:{label:"券描述",prop:"comment"}},[n("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),n("el-form-item",{attrs:{label:"总数",prop:"total"}},[n("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),n("el-form-item",{attrs:{label:"已领取",prop:"count"}},[n("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),n("el-form-item",{attrs:{label:"每人限领",prop:"limitOne"}},[n("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),n("el-form-item",{attrs:{label:"有效期",prop:"dataRange"}},[n("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),n("el-form-item",{staticStyle:{"margin-bottom":"30px"},attrs:{prop:"content"}},[t.tinymceActive?n("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),n("el-form-item",[n("el-button",{attrs:{type:"primary"},on:{click:t.submitForm}},[t._v(" 保存 ")]),n("el-button",{on:{click:t.onCancel}},[t._v(" 取消 ")])],1)],1)],1)},r=[],o=n("1da1"),i=n("d4ec"),s=n("bee2"),c=n("262e"),u=n("2caf"),l=(n("96cf"),n("0d03"),n("99af"),n("9ab4")),p=n("1b40"),m=n("ac1a"),d=n("e741"),h=n("b804"),f=n("6b45"),g=n("8256"),b=n("db85"),v=n("8960"),F=n("9dba"),y=function(t){Object(c["a"])(n,t);var e=Object(u["a"])(n);function n(){var t;return Object(i["a"])(this,n),t=e.apply(this,arguments),t.validateRequire=function(e,n,a){""===n?("imageURL"===e.field?t.$message({message:"Upload cover image is required",type:"error"}):t.$message({message:e.field+" 是必填的",type:"error"}),a(new Error(e.field+" 是必填的"))):a()},t.postForm=Object.assign({},v["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"])(n,[{key:"lang",get:function(){return m["a"].language}},{key:"userLevel",get:function(){return F["a"].level}},{key:"created",value:function(){var t,e=null===(t=this.$route.params)||void 0===t?void 0:t.id;1===F["a"].level?this.getRemoteDeptList(""):this.postForm.shop=F["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 n,a,r;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,Object(v["c"])(e,{});case 3:n=t.sent,a=n.data,console.log(a),this.postForm=a,this.postForm.validBegin&&this.postForm.validEnd&&(this.dataRange=[new Date(this.postForm.validBegin),new Date(this.postForm.validEnd)]),r="zh"===this.lang?"编辑优惠券":"Edit Coupon",this.setTagsViewTitle(r),this.setPageTitle(r),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),d["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,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,t.next=6,Object(v["e"])(this.postForm);case 6:e=t.sent,n=e.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=18;break;case 14:return t.prev=14,t.t0=t["catch"](0),console.error("Submit Error!"),t.abrupt("return",!1);case 18:case"end":return t.stop()}}),t,this,[[0,14]])})));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 n,a;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,Object(b["g"])({key:e});case 2:if(n=t.sent,a=n.data,a.records){t.next=6;break}return t.abrupt("return");case 6:this.allDepts=a.records;case 7:case"end":return t.stop()}}),t,this)})));function e(e){return t.apply(this,arguments)}return e}()}]),n}(p["c"]);Object(l["a"])([Object(p["d"])("dataRange")],y.prototype,"onDataRangeChange",null),y=Object(l["a"])([Object(p["a"])({name:"CouponEditor",components:{Sticky:h["a"],UploadImage:f["a"],Tinymce:g["a"]}})],y);var O=y,k=O,w=n("0c7c"),j=Object(w["a"])(k,a,r,!1,null,null,null);e["default"]=j.exports},8960:function(t,e,n){"use strict";n.d(e,"a",(function(){return r})),n.d(e,"d",(function(){return o})),n.d(e,"c",(function(){return i})),n.d(e,"e",(function(){return s})),n.d(e,"b",(function(){return c}));var a=n("b32d"),r={shop:"",name:"",content:"",total:0,count:0,limitOne:1},o=function(t){return Object(a["a"])({url:"/api/coupons",method:"post",params:t})},i=function(t,e){return Object(a["a"])({url:"/coupon/".concat(t),method:"get",params:e})},s=function(t){return Object(a["a"])({url:"/api/coupon/save",method:"post",data:t})},c=function(t){return Object(a["a"])({url:"/coupon/".concat(t,"/delete"),method:"post"})}},db85:function(t,e,n){"use strict";n.d(e,"a",(function(){return r})),n.d(e,"g",(function(){return o})),n.d(e,"d",(function(){return i})),n.d(e,"c",(function(){return s})),n.d(e,"h",(function(){return c})),n.d(e,"b",(function(){return u})),n.d(e,"i",(function(){return l})),n.d(e,"e",(function(){return p})),n.d(e,"f",(function(){return m})),n.d(e,"k",(function(){return d})),n.d(e,"j",(function(){return h}));var a=n("b32d"),r={name:"",address:"",logo:"",qtypes:[]},o=function(t){return Object(a["a"])({url:"/api/shops",method:"post",params:t})},i=function(t,e){return Object(a["a"])({url:"/shop/".concat(t),method:"get",params:e})},s=function(){return Object(a["a"])({url:"/api/myshop",method:"get"})},c=function(t){return Object(a["a"])({url:"/api/shop/save",method:"post",data:t})},u=function(t){return Object(a["a"])({url:"/shop/".concat(t,"/delete"),method:"post"})},l=function(t){return Object(a["a"])({url:"/api/shop/gameinfo/save",method:"post",data:t})},p=function(t){return Object(a["a"])({url:"/api/shop/gameinfo",method:"post",data:t})},m=function(t){return Object(a["a"])({url:"/api/shop/gameqr",method:"post",data:t})},d=function(t){return Object(a["a"])({url:"/api/shop/save_qtype",method:"post",data:t})},h=function(t){return Object(a["a"])({url:"/api/shop/publish",method:"post",data:t})}}}]);
//# sourceMappingURL=chunk-3b7cfdf7.4e19a81f.js.map