chunk-3b3dda54.a90f19e3.js 10 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-3b3dda54"],{"63c8":function(e,r,t){"use strict";t("d432")},c225:function(e,r,t){"use strict";t.r(r);var i=function(){var e=this,r=e.$createElement,t=e._self._c||r;return t("div",{staticClass:"app-container"},[t("div",{staticStyle:{display:"inline-block","font-size":"18px","margin-bottom":"10px"}},[t("el-page-header",{attrs:{content:"添加优惠券"},on:{back:e.prev}})],1),t("el-form",{ref:"ruleForm",staticStyle:{"font-weight":"bold","margin-left":"0px"},attrs:{model:e.ruleForm,rules:e.rules,"label-width":"150px",size:"small"}},[t("el-form-item",{attrs:{label:"优惠劵名称",prop:"name"}},[t("el-input",{staticStyle:{width:"350px"},attrs:{placeholder:"请输入优惠券名称"},model:{value:e.ruleForm.name,callback:function(r){e.$set(e.ruleForm,"name",r)},expression:"ruleForm.name"}})],1),t("el-form-item",{attrs:{label:"优惠劵类型"}},[t("el-radio-group",{model:{value:e.ruleForm.useType,callback:function(r){e.$set(e.ruleForm,"useType",r)},expression:"ruleForm.useType"}},[t("el-radio",{attrs:{label:1}},[e._v("通用券")]),t("el-radio",{attrs:{label:2}},[e._v("商品券")]),t("el-radio",{attrs:{label:3}},[e._v("品类券")])],1)],1),3===e.ruleForm.useType?t("el-form-item",{attrs:{label:"选择品类:",prop:"primaryKey"}},[t("el-cascader",{staticClass:"selWidth",attrs:{options:e.merCateList,props:e.categoryProps,clearable:"","show-all-levels":!0},model:{value:e.ruleForm.primaryKey,callback:function(r){e.$set(e.ruleForm,"primaryKey",r)},expression:"ruleForm.primaryKey"}})],1):e._e(),2===e.ruleForm.useType?t("el-form-item",{attrs:{label:"商品:",prop:"checked"}},[t("div",{staticClass:"acea-row"},[e._l(e.ruleForm.checked,(function(r,i){return e.ruleForm.checked.length?t("div",{key:i,staticClass:"picture"},[t("img",{staticStyle:{"object-fit":"cover"},attrs:{src:r.image}}),t("span",{staticClass:"dels"},[t("i",{staticClass:"el-icon-delete el-icon-del",on:{click:function(r){return e.handleRemove(i)}}})])]):e._e()})),t("div",{staticClass:"upLoadPicBox",on:{click:e.showProductList}},[t("div",{staticClass:"upLoad"},[t("i",{staticClass:"el-icon-camera cameraIconfont"})])])],2)]):e._e(),t("el-form-item",{attrs:{label:"优惠券面值",prop:"money"}},[t("el-input-number",{attrs:{size:"medium",min:1,label:"描述文字"},model:{value:e.ruleForm.money,callback:function(r){e.$set(e.ruleForm,"money",r)},expression:"ruleForm.money"}})],1),t("el-form-item",{attrs:{label:"使用门槛"}},[t("el-radio-group",{model:{value:e.threshold,callback:function(r){e.threshold=r},expression:"threshold"}},[t("el-radio",{attrs:{label:!1}},[e._v("无门槛")]),t("el-radio",{attrs:{label:!0}},[e._v("有门槛")])],1)],1),e.threshold?t("el-form-item",{attrs:{label:"优惠券最低消费",prop:"minPrice"}},[t("el-input-number",{attrs:{min:1,label:"描述文字"},model:{value:e.ruleForm.minPrice,callback:function(r){e.$set(e.ruleForm,"minPrice",r)},expression:"ruleForm.minPrice"}})],1):e._e(),t("el-form-item",{attrs:{label:"使用有效期"}},[t("el-radio-group",{model:{value:e.ruleForm.isFixedTime,callback:function(r){e.$set(e.ruleForm,"isFixedTime",r)},expression:"ruleForm.isFixedTime"}},[t("el-radio",{attrs:{label:!1}},[e._v("天数")]),t("el-radio",{attrs:{label:!0}},[e._v("时间段")])],1)],1),e.ruleForm.isFixedTime?e._e():t("el-form-item",{attrs:{label:"使用有效期限(天)",prop:"day"}},[t("el-input-number",{attrs:{size:"medium",min:0,max:999,label:"描述文字"},model:{value:e.ruleForm.day,callback:function(r){e.$set(e.ruleForm,"day",r)},expression:"ruleForm.day"}})],1),e.ruleForm.isFixedTime?t("el-form-item",{attrs:{label:"使用有效期限",prop:"resource"}},[t("el-date-picker",{staticStyle:{width:"550px"},attrs:{type:"datetimerange","range-separator":"至","value-format":"yyyy-MM-dd HH:mm:ss","start-placeholder":"开始日期","picker-options":e.pickerOptions,"end-placeholder":"结束日期"},model:{value:e.termTime,callback:function(r){e.termTime=r},expression:"termTime"}})],1):e._e(),t("el-form-item",{attrs:{label:"领取是否限时",prop:"isForever"}},[t("el-radio-group",{model:{value:e.ruleForm.isForever,callback:function(r){e.$set(e.ruleForm,"isForever",r)},expression:"ruleForm.isForever"}},[t("el-radio",{attrs:{label:!0}},[e._v("限时")]),t("el-radio",{attrs:{label:!1}},[e._v("不限时")])],1)],1),e.ruleForm.isForever?t("el-form-item",{attrs:{label:"领取时间"}},[t("el-date-picker",{staticStyle:{width:"550px"},attrs:{type:"datetimerange","range-separator":"至","value-format":"yyyy-MM-dd HH:mm:ss","picker-options":e.pickerOptions,"start-placeholder":"开始日期","end-placeholder":"结束日期"},on:{blur:e.handleTimestamp},model:{value:e.isForeverTime,callback:function(r){e.isForeverTime=r},expression:"isForeverTime"}})],1):e._e(),t("el-form-item",{attrs:{label:"领取方式",prop:"resource"}},[t("el-radio-group",{model:{value:e.ruleForm.type,callback:function(r){e.$set(e.ruleForm,"type",r)},expression:"ruleForm.type"}},[t("el-radio",{attrs:{label:1}},[e._v("手动领取")]),t("el-radio",{attrs:{label:2}},[e._v("新人券")]),t("el-radio",{attrs:{label:3}},[e._v("赠送券")])],1)],1),t("el-form-item",{attrs:{label:"是否限量",prop:"isLimited"}},[t("el-radio-group",{model:{value:e.ruleForm.isLimited,callback:function(r){e.$set(e.ruleForm,"isLimited",r)},expression:"ruleForm.isLimited"}},[t("el-radio",{attrs:{label:!0}},[e._v("限量")]),t("el-radio",{attrs:{label:!1}},[e._v("不限量")])],1)],1),e.ruleForm.isLimited?t("el-form-item",{attrs:{label:"发布数量",prop:"total"}},[t("el-input-number",{attrs:{min:1,label:"排序"},model:{value:e.ruleForm.total,callback:function(r){e.$set(e.ruleForm,"total",r)},expression:"ruleForm.total"}})],1):e._e(),t("el-form-item",{attrs:{label:"排序",prop:"sort"}},[t("el-input-number",{attrs:{size:"medium",min:0,label:"排序"},model:{value:e.ruleForm.sort,callback:function(r){e.$set(e.ruleForm,"sort",r)},expression:"ruleForm.sort"}})],1),t("el-form-item",{attrs:{label:"状态",prop:"status"}},[t("el-radio-group",{model:{value:e.ruleForm.status,callback:function(r){e.$set(e.ruleForm,"status",r)},expression:"ruleForm.status"}},[t("el-radio",{attrs:{label:!0}},[e._v("开启")]),t("el-radio",{attrs:{label:!1}},[e._v("关闭")])],1)],1),t("el-form-item",[t("el-button",{attrs:{size:"mini",type:"primary",loading:e.loading},on:{click:function(r){return e.submitForm("ruleForm")}}},[e._v("立即创建 ")])],1)],1)],1)},l=[],o=(t("a15b"),t("d81d"),t("14d9"),t("a434"),t("b0c0"),t("d3b7"),t("0643"),t("a573"),t("61f7")),a={name:"couponCreate",data:function(){return{pickerOptions:{disabledDate:function(e){return e.getTime()<Date.now()-864e5||e.getTime()>Date.now()+5184e7}},loading:!1,threshold:!1,termTime:[],categoryProps:{children:"children",label:"name",value:"id",expandTrigger:"hover",checkStrictly:!1,emitPath:!1},merCateList:[],ruleForm:{useType:1,isFixedTime:!1,name:"",money:1,minPrice:1,day:null,isForever:!1,primaryKey:"",type:1,isLimited:!1,useStartTime:"",useEndTime:"",receiveStartTime:"",receiveEndTime:"",sort:0,total:1,status:!1,checked:[]},isForeverTime:[],rules:{name:[{required:!0,message:"请输入优惠券名称",trigger:"blur"}],day:[{required:!0,message:"请输入使用有效期限(天)",trigger:"blur"}],money:[{required:!0,message:"请输入优惠券面值",trigger:"blur"}],primaryKey:[{required:!0,message:"请选择品类",trigger:"change"}],checked:[{required:!0,message:"请至少选择一个商品",trigger:"change",type:"array"}],isForeverTime:[{required:!0,message:"请选择领取时间",trigger:"change",type:"array"}],total:[{required:!0,message:"请输入发布数量",trigger:"blur"}],minPrice:[{required:!0,message:"请输入最低消费",trigger:"blur"}]}}},mounted:function(){this.getCategorySelect()},methods:{prev:function(){this.$store.dispatch("tagsView/delView",this.$route),this.$router.back()},handleTimestamp:function(){},getCategorySelect:function(){var e=this;this.request({url:"/api/admin/category/list",method:"get",params:{type:1,status:1,pid:0}}).then((function(r){200===r.code&&(e.merCateList=r.rows.map((function(e){return{id:e.id,name:e.name}})))})).catch((function(){}))},handleRemove:function(e){this.ruleForm.checked.length&&this.ruleForm.checked.splice(e,1)},showProductList:function(){var e=this;this.$modalProductList((function(r){e.ruleForm.checked=r}),!0,e.ruleForm.checked)},submitForm:Object(o["a"])((function(e){var r=this;this.ruleForm.isFixedTime&&!this.termTime||this.ruleForm.isFixedTime&&!this.termTime.length?this.$notify({title:"提示",duration:1800,message:"请选择使用有效期限",type:"warning"}):this.ruleForm.isForever&&!this.isForeverTime||this.ruleForm.isForever&&!this.isForeverTime.length?this.$notify({title:"提示",duration:1800,message:"请选择请选择领取时间",type:"warning"}):(2===this.ruleForm.useType&&(this.ruleForm.primaryKey=this.ruleForm.checked.map((function(e){return e.id})).join(",")),1===this.ruleForm.useType&&(this.ruleForm.primaryKey=""),this.threshold||(this.ruleForm.minPrice=0),this.ruleForm.isLimited||(this.ruleForm.total=0),this.ruleForm.isFixedTime&&this.termTime.length?(this.ruleForm.useStartTime=this.termTime[0],this.ruleForm.day=null):this.ruleForm.useStartTime="",this.ruleForm.isFixedTime&&this.termTime.length?(this.ruleForm.useEndTime=this.termTime[1],this.ruleForm.day=null):this.ruleForm.useEndTime="",this.ruleForm.isForever&&this.isForeverTime.length?this.ruleForm.receiveStartTime=this.isForeverTime[0]:this.ruleForm.receiveStartTime="",this.ruleForm.isForever&&this.isForeverTime.length?this.ruleForm.receiveEndTime=this.isForeverTime[1]:this.ruleForm.receiveEndTime="",this.$refs[e].validate((function(e){e?(r.loading=!0,r.$confirm("确定保存?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){r.request({url:"/api/admin/coupon/save",method:"post",data:r.ruleForm}).then((function(e){200===e.code?r.$message({message:"新增优惠券成功",type:"success",duration:1e3,onClose:function(){r.$router.push({path:"/marketing/coupon/couponCategory"})}}):(r.loading=!1,r.msgError(e.msg))})).catch((function(){r.loading=!1}))})).catch((function(){r.loading=!1}))):r.loading=!1})))}))}},s=a,m=(t("63c8"),t("2877")),n=Object(m["a"])(s,i,l,!1,null,null,null);r["default"]=n.exports},d432:function(e,r,t){}}]);