(window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-71a34a28"],{"30c2":function(t,e,i){"use strict";i.r(e);var a=i("85f4"),s=(i("b6c4"),{data:()=>({positionList:[],day:0,hour:0,min:0,form:{id:0,name:"",time:0,price:"",description:"",position_id:"",status:1}}),methods:{submitForm(t){if(this.form.time=24*this.day*60*60+60*this.hour*60+60*this.min,this.form.time<60)return this.$message.error("时间最小为1分钟!"),!1;this.$refs[t].validate(t=>{if(!t)return!1;Object(a.e)({...this.form}).then(t=>{this.$message.success("更新成功!"),setTimeout(()=>this.$router.go(-1),500)}).catch(t=>{this.$message.error("更新失败!")})})},getPositionList(){Object(a.f)({status:1}).then(t=>{this.positionList=t.data})},getPackageDetail(){Object(a.c)({id:this.form.id}).then(t=>{this.form=t.data;var e=this.form.time;this.day=Math.floor(e/86400),e%=86400,this.hour=Math.floor(e/3600),e%=3600,this.min=Math.floor(e/60),e%=60})}},mounted(){this.getPackageDetail(),this.getPositionList()},created(){const t=this.$route.query;this.form.id=t.id}}),r=i("2877"),o=Object(r.a)(s,(function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",[i("div",{staticClass:"ls-card"},[i("el-page-header",{attrs:{content:"编辑套餐"},on:{back:function(e){return t.$router.go(-1)}}})],1),i("div",{staticClass:"ls-card m-t-16"},[i("div",{staticClass:"card-title"},[t._v("编辑套餐")]),i("div",{staticClass:"card-content m-t-24"},[i("el-form",{ref:"ruleForm",attrs:{model:t.form,"label-width":"80px"}},[i("el-form-item",{attrs:{prop:"name",label:"套餐名字"}},[i("el-input",{model:{value:t.form.name,callback:function(e){t.$set(t.form,"name",e)},expression:"form.name"}})],1),i("el-form-item",{attrs:{prop:"time",label:"套餐时长"}},[i("el-input",{staticStyle:{width:"100px"},attrs:{placeholder:"天数"},model:{value:t.day,callback:function(e){t.day=e},expression:"day"}}),i("span",{staticClass:"m-r-12"},[t._v("天")]),i("el-input",{staticStyle:{width:"100px"},attrs:{placeholder:"小时"},model:{value:t.hour,callback:function(e){t.hour=e},expression:"hour"}}),i("span",{staticClass:"m-r-12"},[t._v("小时")]),i("el-input",{staticStyle:{width:"100px"},attrs:{placeholder:"分钟"},model:{value:t.min,callback:function(e){t.min=e},expression:"min"}}),i("span",{staticClass:"m-r-12"},[t._v("分钟")])],1),i("el-form-item",{attrs:{prop:"price",label:"套餐价格"}},[i("el-input",{attrs:{type:"number"},model:{value:t.form.price,callback:function(e){t.$set(t.form,"price",e)},expression:"form.price"}})],1),i("el-form-item",{attrs:{prop:"description",label:"套餐描述"}},[i("el-input",{model:{value:t.form.description,callback:function(e){t.$set(t.form,"description",e)},expression:"form.description"}})],1),i("el-form-item",{attrs:{prop:"position_id",required:"",label:"广告位置"}},[i("el-select",{attrs:{placeholder:"请选择"},model:{value:t.form.position_id,callback:function(e){t.$set(t.form,"position_id",e)},expression:"form.position_id"}},t._l(t.positionList,(function(t,e){return i("el-option",{key:"positionList"+e,attrs:{label:t.name,value:t.id}})})),1)],1),i("el-form-item",{attrs:{prop:"status",label:"状态"}},[i("el-switch",{attrs:{"active-value":1,"inactive-value":0},model:{value:t.form.status,callback:function(e){t.$set(t.form,"status",e)},expression:"form.status"}})],1),i("el-form-item",[i("el-button",{attrs:{type:"primary"},on:{click:function(e){return t.submitForm("ruleForm")}}},[t._v("编辑")])],1)],1)],1)])])}),[],!1,null,null,null);e.default=o.exports},"85f4":function(t,e,i){"use strict";i.d(e,"a",(function(){return s})),i.d(e,"d",(function(){return r})),i.d(e,"c",(function(){return o})),i.d(e,"e",(function(){return n})),i.d(e,"f",(function(){return l})),i.d(e,"g",(function(){return c})),i.d(e,"b",(function(){return m}));var a=i("6b2d");const s=t=>a.a.post("pin.PinPackage/add",t),r=t=>a.a.get("pin.PinPackage/list",{params:t}),o=t=>a.a.get("pin.PinPackage/detail",{params:t}),n=t=>a.a.post("pin.PinPackage/update",t),l=t=>a.a.get("pin.PinPosition/list",{params:t}),c=t=>a.a.post("pin.PinPosition/update",t),m=t=>a.a.get("pin.PinPackage/del",{params:t})}}]);