12 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-15bb4a13"],{"0091":function(e,t,r){},"0137":function(e,t,r){"use strict";r.d(t,"b",function(){return o}),r.d(t,"c",function(){return i}),r.d(t,"a",function(){return n}),r.d(t,"e",function(){return s}),r.d(t,"d",function(){return l}),r.d(t,"f",function(){return u});var a=r("bf9a");function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return a["b"].get("coupon",{params:e})}function i(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return a["b"].get("coupon_user_bags",{params:e})}function n(e){return a["b"].get("coupon/".concat(e,"/edit"))}function s(e){return a["b"].post("coupon",e)}function l(e){return a["b"].post("coupon/giveCouponToUser",e)}function u(e,t){return a["b"].put("coupon/".concat(e),t)}},"0cd2":function(e,t,r){},"469f":function(e,t,r){r("6c1c"),r("1654"),e.exports=r("7d7b")},"4ce6":function(e,t,r){"use strict";var a=r("7d89"),o=r.n(a);o.a},5536:function(e,t,r){"use strict";r.r(t);var a=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("el-card",{scopedSlots:e._u([{key:"header",fn:function(){return[r("content-header")]},proxy:!0}])},[r("el-row",{attrs:{type:"flex",justify:"center"}},[r("lz-form",{ref:"form",attrs:{"get-data":e.getData,submit:e.onSubmit,errors:e.errors,form:e.form,"edit-mode":e.editMode,rules:e.rules},on:{"update:errors":function(t){e.errors=t},"update:form":function(t){e.form=t}}},[r("el-form-item",{attrs:{label:"优惠券名:",required:"",prop:"title"}},[r("el-input",{model:{value:e.form.title,callback:function(t){e.$set(e.form,"title",t)},expression:"form.title"}})],1),r("el-form-item",{attrs:{label:"缩略内容",required:"",prop:"surface"}},[r("el-upload",{staticClass:"avatar-uploader",attrs:{action:"/admin-api/coupon/uploadImg",name:"icon",headers:e.uploadHeaders,"show-file-list":!1,"on-success":e.handleAvatarSuccess,"before-upload":e.beforeAvatarUpload}},[e.form.icon?r("img",{attrs:{src:e.form.icon}}):r("i",{staticClass:"el-icon-plus avatar-uploader-icon"})])],1),r("el-form-item",{attrs:{label:"优惠券类型:",required:"",prop:"type"}},[r("el-select",{attrs:{placeholder:"选择优惠券类型",clearable:""},model:{value:e.form.type,callback:function(t){e.$set(e.form,"type",t)},expression:"form.type"}},e._l(e.type,function(e){return r("el-option",{key:e.value,attrs:{label:e.label,value:e.value}})}),1)],1),r("el-form-item",{attrs:{label:"订单可用类型:",required:"",prop:"order_type"}},[r("el-select",{attrs:{placeholder:"选择优惠券类型",disabled:"",clearable:""},model:{value:e.form.order_type,callback:function(t){e.$set(e.form,"order_type",t)},expression:"form.order_type"}},e._l(e.order_type,function(e){return r("el-option",{key:e.value,attrs:{label:e.label,value:e.value}})}),1)],1),r("el-form-item",{directives:[{name:"show",rawName:"v-show",value:1==e.form.type,expression:"form.type ==1"}],attrs:{label:"满多少金额",required:"",prop:"with_amount"}},[r("el-input-number",{attrs:{precision:0,step:1,max:100},model:{value:e.form.with_amount,callback:function(t){e.$set(e.form,"with_amount",t)},expression:"form.with_amount"}})],1),r("el-form-item",{directives:[{name:"show",rawName:"v-show",value:3!=e.form.type,expression:"form.type !=3"}],attrs:{label:"可减少金额",required:"",prop:"used_amount"}},[r("el-input-number",{attrs:{precision:0,step:1,max:50},model:{value:e.form.used_amount,callback:function(t){e.$set(e.form,"used_amount",t)},expression:"form.used_amount"}})],1),r("el-form-item",{directives:[{name:"show",rawName:"v-show",value:3==e.form.type,expression:"form.type ==3"}],attrs:{label:"折扣",required:"",prop:"discount"}},[r("el-input-number",{attrs:{min:0,precision:0,step:1,max:100},model:{value:e.form.discount,callback:function(t){e.$set(e.form,"discount",t)},expression:"form.discount"}})],1),r("el-form-item",{directives:[{name:"show",rawName:"v-show",value:3==e.form.type,expression:"form.type ==3"}],attrs:{label:"折扣最多可减少金额",required:"",prop:"used_amount"}},[r("el-input-number",{attrs:{precision:0,step:1,max:20},model:{value:e.form.used_amount,callback:function(t){e.$set(e.form,"used_amount",t)},expression:"form.used_amount"}})],1),r("el-form-item",{attrs:{label:"是否限制发券数量:",required:"",prop:"is_quota"}},[r("el-radio",{attrs:{label:e.is_limit_times0,border:""},model:{value:e.form.is_quota,callback:function(t){e.$set(e.form,"is_quota",t)},expression:"form.is_quota"}},[e._v("不限")]),r("el-radio",{attrs:{label:e.is_limit_times1,border:""},model:{value:e.form.is_quota,callback:function(t){e.$set(e.form,"is_quota",t)},expression:"form.is_quota"}},[e._v("限量")])],1),r("el-form-item",{directives:[{name:"show",rawName:"v-show",value:1==e.form.is_quota,expression:"form.is_quota==1"}],attrs:{label:"可发券数量:",required:"",prop:"quota"}},[r("el-input-number",{attrs:{min:0,step:1,max:1e4},model:{value:e.form.quota,callback:function(t){e.$set(e.form,"quota",t)},expression:"form.quota"}})],1),r("el-form-item",{attrs:{label:"区域",prop:"area_id"}},[r("el-select",{attrs:{filterable:"",clearable:"",placeholder:"请选择"},model:{value:e.form.area_id,callback:function(t){e.$set(e.form,"area_id",t)},expression:"form.area_id"}},e._l(e.areas,function(e){return r("el-option",{key:e.id,attrs:{label:e.name,value:e.id}})}),1)],1),r("el-form-item",{attrs:{label:"发放开始时间",required:"",prop:"grant_start_at"}},[r("el-date-picker",{attrs:{type:"datetime",placeholder:"选择日期时间"},model:{value:e.form.grant_start_at,callback:function(t){e.$set(e.form,"grant_start_at",t)},expression:"form.grant_start_at"}})],1),r("el-form-item",{attrs:{label:"发放结束时间",required:"",prop:"grant_end_at"}},[r("el-date-picker",{attrs:{type:"datetime",placeholder:"选择日期时间"},model:{value:e.form.grant_end_at,callback:function(t){e.$set(e.form,"grant_end_at",t)},expression:"form.grant_end_at"}})],1),r("el-form-item",{attrs:{label:"时效类型:",required:"",prop:"valid_type"}},[r("el-radio",{attrs:{label:e.valid_type1,border:""},model:{value:e.form.valid_type,callback:function(t){e.$set(e.form,"valid_type",t)},expression:"form.valid_type"}},[e._v("绝对时效")]),r("el-radio",{attrs:{label:e.valid_type2,border:""},model:{value:e.form.valid_type,callback:function(t){e.$set(e.form,"valid_type",t)},expression:"form.valid_type"}},[e._v("相对时效")])],1),r("el-form-item",{directives:[{name:"show",rawName:"v-show",value:1==e.form.valid_type,expression:"form.valid_type==1"}],attrs:{label:"生效时间",required:"",prop:"valid_start_time"}},[r("el-date-picker",{attrs:{type:"datetime",placeholder:"选择日期时间"},model:{value:e.form.valid_start_time,callback:function(t){e.$set(e.form,"valid_start_time",t)},expression:"form.valid_start_time"}})],1),r("el-form-item",{directives:[{name:"show",rawName:"v-show",value:1==e.form.valid_type,expression:"form.valid_type==1"}],attrs:{label:"失效时间",required:"",prop:"valid_end_time"}},[r("el-date-picker",{attrs:{type:"datetime",placeholder:"选择日期时间"},model:{value:e.form.valid_end_time,callback:function(t){e.$set(e.form,"valid_end_time",t)},expression:"form.valid_end_time"}})],1),r("el-form-item",{directives:[{name:"show",rawName:"v-show",value:2==e.form.valid_type,expression:"form.valid_type==2"}],attrs:{label:"得到后有效天数:",required:"",prop:"valid_days"}},[r("el-input-number",{attrs:{min:0,step:1,max:20},model:{value:e.form.valid_days,callback:function(t){e.$set(e.form,"valid_days",t)},expression:"form.valid_days"}})],1),r("el-form-item",{attrs:{label:"是否启用:",required:"",prop:"status"}},[r("el-radio",{attrs:{label:e.status1,border:""},model:{value:e.form.status,callback:function(t){e.$set(e.form,"status",t)},expression:"form.status"}},[e._v("启用")]),r("el-radio",{attrs:{label:e.status0,border:""},model:{value:e.form.status,callback:function(t){e.$set(e.form,"status",t)},expression:"form.status"}},[e._v("停用")])],1)],1)],1)],1)},o=[],i=(r("ac6a"),r("5df3"),r("768b")),n=(r("96cf"),r("3b8d")),s=r("ada3"),l=r("0137"),u=r("b64d"),c=r("94b0"),d=r("fe06"),m={name:"Form",components:{LzForm:s["a"]},mixins:[d["a"]],data:function(){return{form:{title:"",icon:"",with_amount:0,used_amount:0,discount:100,order_type:1,type:"",is_quota:0,quota:0,grant_start_at:new Date,grant_end_at:new Date,valid_type:1,valid_start_time:new Date,valid_end_time:new Date,valid_days:0,status:0,area_id:""},rules:{},errors:{},areas:[],is_limit_times0:0,is_limit_times1:1,status1:1,status0:0,valid_type1:1,valid_type2:2,uploadHeaders:{Authorization:""},type:[{value:1,label:"满减"},{value:2,label:"无门槛"},{value:3,label:"打折"}],order_type:[{value:1,label:"仅普通订单可用"},{value:2,label:"仅日租订单可用"},{value:3,label:"所有订单可用"}]}},created:function(){this.uploadHeaders.Authorization=Object(c["a"])()},methods:{onSubmit:function(){var e=Object(n["a"])(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:if(!this.editMode){e.next=5;break}return e.next=3,Object(l["f"])(this.resourceId,this.form);case 3:e.next=7;break;case 5:return e.next=7,Object(l["e"])(this.form);case 7:case"end":return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}(),getData:function(){var e=Object(n["a"])(regeneratorRuntime.mark(function e(){var t,r,a,o,n;return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([Object(u["b"])({all:1})]);case 2:if(t=e.sent,r=Object(i["a"])(t,1),a=r[0].data,this.areas=a,!this.editMode){e.next=12;break}return e.next=9,Object(l["a"])(this.resourceId);case 9:o=e.sent,n=o.data,this.fillForm(n);case 12:case"end":return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}(),beforeAvatarUpload:function(e){var t="image/jpeg"===e.type,r="image/png"===e.type,a=e.size/1024/1024<2;return t||r||this.$message.error("上传头像图片只能是 JPG/PNG 格式!"),a||this.$message.error("上传头像图片大小不能超过 2MB!"),(t||r)&&a},handleAvatarSuccess:function(e,t){this.form.icon=e.path}}},f=m,p=(r("4ce6"),r("2877")),b=Object(p["a"])(f,a,o,!1,null,"57a25888",null);t["default"]=b.exports},"5d73":function(e,t,r){e.exports=r("469f")},"6cbc":function(e,t,r){"use strict";var a=r("0cd2"),o=r.n(a);o.a},"768b":function(e,t,r){"use strict";var a=r("a745"),o=r.n(a);function i(e){if(o()(e))return e}var n=r("5d73"),s=r.n(n);function l(e,t){var r=[],a=!0,o=!1,i=void 0;try{for(var n,l=s()(e);!(a=(n=l.next()).done);a=!0)if(r.push(n.value),t&&r.length===t)break}catch(u){o=!0,i=u}finally{try{a||null==l["return"]||l["return"]()}finally{if(o)throw i}}return r}function u(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function c(e,t){return i(e)||l(e,t)||u()}r.d(t,"a",function(){return c})},"7d7b":function(e,t,r){var a=r("e4ae"),o=r("7cd6");e.exports=r("584a").getIterator=function(e){var t=o(e);if("function"!=typeof t)throw TypeError(e+" is not iterable!");return a(t.call(e))}},"7d89":function(e,t,r){},"8a92":function(e,t,r){"use strict";var a=r("0091"),o=r.n(a);o.a},ada3:function(e,t,r){"use strict";r("8e6e"),r("456d");var a=r("bd86"),o=r("75fc"),i=(r("a481"),r("96cf"),r("3b8d")),n=(r("ac6a"),r("28a5"),r("9948")),s=r.n(n),l=r("9b02"),u=r.n(l),c=r("1a38"),d=r("873a"),m=r("a22f");function f(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,a)}return r}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?f(r,!0).forEach(function(t){Object(a["a"])(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):f(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var b,h,v={name:"LzForm",components:{FlexSpacer:m["a"]},inject:{view:{from:"view",default:null}},data:function(){return{loading:!1,stay:!1}},props:{getData:Function,submit:Function,errors:Object,form:Object,submitText:{type:String,default:"保存"},labelPosition:String,inDialog:Boolean,createdRedirect:{type:[String,Function],default:function(){var e=this.$route.path.split("/");return"/"+(e[e.length-2]||"")}},updatedRedirect:{type:[String,Function],default:function(){return this.$router.back.bind(this.$router)}},disableRedirect:Boolean,disableStay:Boolean,editMode:Boolean},computed:{realLabelPosition:function(){return this.labelPosition||(this.$store.state.miniWidth?"top":"right")},miniWidth:function(){return this.$store.state.miniWidth}},created:function(){this.copyMethods()},methods:{copyMethods:function(){var e=this;[c["default"].extends.methods,c["default"].methods].forEach(function(t){s()(t,function(t,r){e[r]=function(){t.apply(this.$refs.form,arguments)}})})},_getData:function(){var e=Object(i["a"])(regeneratorRuntime.mark(function e(){var t=this;return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:if(this.loading=!0,this.view&&this.$emit("update:form",this.view.formBak),e.prev=2,e.t0=this.getData,!e.t0){e.next=7;break}return e.next=7,this.getData();case 7:this.$nextTick(function(){t.setInitialValues()}),e.next=13;break;case 10:e.prev=10,e.t1=e["catch"](2),Promise.reject(e.t1);case 13:this.loading=!1;case 14:case"end":return e.stop()}},e,this,[[2,10]])}));function t(){return e.apply(this,arguments)}return t}(),onSubmit:function(){var e=Object(i["a"])(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:if(this.$emit("update:errors",{}),e.prev=1,e.t0=this.submit,!e.t0){e.next=6;break}return e.next=6,this.submit();case 6:if(this.$message.success(Object(d["h"])(this.editMode?"updated":"created")),!this.stay&&!this.disableRedirect){e.next=9;break}return e.abrupt("return");case 9:t=this.editMode?this.updatedRedirect:this.createdRedirect,"string"===typeof t?this.$router.push(t):"function"===typeof t&&t(),e.next=17;break;case 13:e.prev=13,e.t1=e["catch"](1),this.$emit("update:errors",Object(d["j"])(e.t1.response)),422!==u()(e.t1,"response.status")&&Promise.reject(e.t1);case 17:case"end":return e.stop()}},e,this,[[1,13]])}));function t(){return e.apply(this,arguments)}return t}(),onReset:function(){this.$refs.form.resetFields()}},watch:{$route:{handler:function(){this.$active&&this._getData()},immediate:!0}},render:function(e){var t=this,r=this.$slots.default;Array.isArray(r)&&(r=r.map(function(r){var a=r.componentOptions,i=a.propsData,n=i.helper,s=i.label;if(n){n=n.replace(/\n/g,"<br>");var l=e("template",{slot:"label"},[e("span",[s]),e("el-tooltip",{attrs:{effect:"dark",placement:"top-start","popper-class":"form-helper-popper ".concat(t.miniWidth?"mini-width":"")}},[e("div",{slot:"content",domProps:{innerHTML:n}}),e("i",{class:"ml-1 el-icon-question helper"})])]);return e("el-form-item",{props:a.propsData},[l].concat(Object(o["a"])(a.children)))}return r}));!this.disableStay&&e("el-checkbox",{attrs:{title:"表单提交后,留在此页"},model:{value:t.stay,callback:function(e){t.stay=e}}},["留在此页"]);var a=this.$slots.footer||e("el-form-item",{class:"footer"},[e("loading-action",{attrs:{type:"primary",action:this.onSubmit}},[this.submitText]),e("el-button",{on:{click:this.onReset}},["重置"]),this.$slots.footerAppend,e("flex-spacer")]);return e("el-form",{props:p({model:this.form,errors:this.errors,labelPosition:this.realLabelPosition},this.$attrs),on:p({},this.$listeners),class:{"in-dialog":this.inDialog},style:{width:this.inDialog?"auto":"800px"},directives:[{name:"loading",value:this.loading}],ref:"form"},[r,a])}},_=v,y=(r("6cbc"),r("8a92"),r("2877")),g=Object(y["a"])(_,b,h,!1,null,"3084f0c4",null);t["a"]=g.exports},b64d:function(e,t,r){"use strict";r.d(t,"b",function(){return o}),r.d(t,"c",function(){return i}),r.d(t,"d",function(){return n}),r.d(t,"e",function(){return s}),r.d(t,"a",function(){return l});var a=r("bf9a");function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return a["b"].get("area",{params:e})}function i(e){return a["b"].get("area/".concat(e))}function n(e){return a["b"].post("area",e)}function s(e,t){return a["b"].put("area/".concat(e),t)}function l(e){return a["b"].get("area/".concat(e,"/edit"))}},fe06:function(e,t,r){"use strict";var a=r("873a");t["a"]={provide:function(){return{view:this}},data:function(){return{formField:"form",idField:"id"}},computed:{editMode:function(){return!!this.resourceId},resourceId:function(){return this.$route.params[this.idField]}},created:function(){this.backupForm()},methods:{getResourceId:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"id";return this.$route.params[e]},backupForm:function(){this.formBak=JSON.parse(JSON.stringify(this.$data[this.formField]))},fillForm:function(e){this.$data[this.formField]=Object(a["b"])(this.$data[this.formField],e)}}}}}]);
- //# sourceMappingURL=chunk-15bb4a13.f2c4c94f.js.map
|