1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-be03981a"],{"2f92":function(t,e,r){},"4cab":function(t,e,r){"use strict";r.d(e,"e",(function(){return a})),r.d(e,"a",(function(){return i})),r.d(e,"f",(function(){return o})),r.d(e,"b",(function(){return c})),r.d(e,"c",(function(){return l})),r.d(e,"d",(function(){return s}));var n=r("829b"),a=function(t){return Object(n["a"])({url:"/api-web/platformServe/queryPage",method:"get",params:t})},i=function(t){return Object(n["a"])({url:"/api-web/platformServe/add",method:"post",data:t})},o=function(t){return Object(n["a"])({url:"/api-web/platformServe/update",method:"post",data:t})},c=function(t){return Object(n["a"])({url:"/api-web/platformServe/delete/"+t.id,method:"get"})},l=function(t){return Object(n["a"])({url:"/api-web/platformServe/queryInfo/"+t.id,method:"get"})},s=function(t){return Object(n["a"])({url:"/api-web/platformServe/queryModeDetail/"+t.id,method:"get"})}},"6fbe":function(t,e,r){"use strict";r("2f92")},"9dc3":function(t,e,r){"use strict";r.d(e,"a",(function(){return a})),r.d(e,"d",(function(){return i})),r.d(e,"b",(function(){return o})),r.d(e,"c",(function(){return c}));var n=r("829b"),a=function(t){return Object(n["a"])({url:"/api-web/platformProduct/add",method:"post",data:t})},i=function(t){return Object(n["a"])({url:"/api-web/platformProduct/update",method:"post",data:t})},o=function(t){return Object(n["a"])({url:"/api-web/platformProduct/delete/"+t.id,method:"get"})},c=function(t){return Object(n["a"])({url:"/api-web/platformProduct/queryPage",method:"get",params:t})}},d3e1:function(t,e,r){"use strict";r.r(e);var n=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"m-container"},[r("h2",[r("el-page-header",{attrs:{content:"create"==t.payType?"新增服务":"修改服务"},on:{back:t.onCancel}})],1),t._v(" "),r("div",{staticClass:"m-core",staticStyle:{overflow:"hidden","background-color":"#eef4f9",padding:"0"}},[r("el-form",{ref:"accountForm",attrs:{model:t.form,inline:!0,"label-position":"right","label-width":"120px"}},[r("div",{staticStyle:{background:"#fff",padding:"16px 34px 10px","margin-bottom":"20px"}},[r("el-alert",{staticClass:"smallTitle",attrs:{title:"服务信息",type:"info",closable:!1}}),t._v(" "),r("el-form-item",{attrs:{label:"服务名称",prop:"name",rules:[{required:!0,message:"请输入服务名称",trigger:"blur"}]}},[r("el-input",{attrs:{placeholder:"请输入服务名称"},model:{value:t.form.name,callback:function(e){t.$set(t.form,"name",e)},expression:"form.name"}})],1),t._v(" "),r("el-form-item",{attrs:{label:"产品服务",prop:"productId",rules:[{required:!0,message:"请选择产品服务",trigger:"change"}]}},[r("el-select",{attrs:{multiple:"","collapse-tags":"",clearable:"",placeholder:"请选择产品服务"},model:{value:t.form.productId,callback:function(e){t.$set(t.form,"productId",e)},expression:"form.productId"}},t._l(t.productList,(function(t,e){return r("el-option",{key:e,attrs:{label:t.name,value:t.id}})})),1)],1)],1),t._v(" "),r("div",{staticStyle:{background:"#fff",padding:"16px 34px 10px","margin-bottom":"20px"}},[r("el-alert",{staticClass:"smallTitle",attrs:{title:"服务属性",type:"info",closable:!1}}),t._v(" "),t._l(t.form.attrList,(function(e,n){return r("div",{key:n,staticClass:"serviceAttr"},[r("div",{staticClass:"serviceBlock"},[r("el-form-item",{attrs:{label:"付费模式",prop:"attrList."+n+".mode",rules:[{required:!0,message:"请选择付费模式",trigger:"change"}]}},[r("el-select",{attrs:{placeholder:"请选择付费模式"},model:{value:e.mode,callback:function(r){t.$set(e,"mode",r)},expression:"attrList.mode"}},[r("el-option",{attrs:{label:"月",value:"MONTH"}}),t._v(" "),r("el-option",{attrs:{label:"年",value:"YEAR"}})],1)],1),t._v(" "),r("el-form-item",{staticClass:"add"},[r("el-button",{staticStyle:{width:"140px","border-color":"#00A79D",color:"#00A79D"},attrs:{icon:"el-icon-plus",plain:""},on:{click:function(r){return t.onAddItem("child",e.attr)}}},[t._v("添加模式")])],1)],1),t._v(" "),r("div",{staticClass:"serviceBlock"},t._l(e.attr,(function(a,i){return r("div",{key:i},[r("el-form-item",{attrs:{label:"学员上限",prop:"attrList."+n+".attr."+i+".studentUpLimit",rules:[{required:!0,message:"请输入学员上限",trigger:"blur"},{type:"number",message:"学员上限必须为数字值"}]}},[r("el-input",{attrs:{placeholder:"请输入学员上限"},model:{value:a.studentUpLimit,callback:function(e){t.$set(a,"studentUpLimit",t._n(e))},expression:"attrItem.studentUpLimit"}},[r("span",{attrs:{slot:"append"},slot:"append"},[t._v("人")])])],1),t._v(" "),r("el-form-item",{attrs:{label:"服务原价",prop:"attrList."+n+".attr."+i+".originalPrice",rules:[{required:!0,message:"请输入服务原价",trigger:"blur"},{type:"number",message:"服务原价必须为数字值"}]}},[r("el-input",{attrs:{placeholder:"请输入服务原价"},model:{value:a.originalPrice,callback:function(e){t.$set(a,"originalPrice",t._n(e))},expression:"attrItem.originalPrice"}},[r("span",{attrs:{slot:"append"},slot:"append"},[t._v("元")])])],1),t._v(" "),r("el-button",{attrs:{circle:"",type:"text",disabled:e.attr.length<=1},on:{click:function(r){return t.onRemoveItem(e.attr,i)}}},[t._v("删除")])],1)})),0),t._v(" "),r("div",{staticClass:"list-remove"},[r("el-button",{attrs:{type:"text",icon:"el-icon-delete",disabled:t.form.attrList.length<=1},on:{click:function(e){return t.onRemoveItem(t.form.attrList,n)}}},[t._v("删除")])],1)])})),t._v(" "),r("el-form-item",{staticClass:"add",staticStyle:{"margin-top":"18px","padding-left":"50px"}},[r("el-button",{staticStyle:{width:"160px"},attrs:{icon:"el-icon-plus",type:"primary",disabled:t.form.attrList.length>=2},on:{click:function(e){return t.onAddItem("parent")}}},[t._v("添加模式")])],1),t._v(" "),r("div",{staticClass:"btn-group"},[r("el-button",{on:{click:t.onCancel}},[t._v("取 消")]),t._v(" "),r("el-button",{attrs:{type:"primary"},on:{click:function(e){return t.onSubmit("accountForm")}}},[t._v("确 定")])],1)],2)])],1)])},a=[],i=r("b85c"),o=(r("6762"),r("5530")),c=(r("ac6a"),r("15fd")),l=(r("7f7f"),r("c5f6"),r("28a5"),r("96cf"),r("1da1")),s=r("9dc3"),u=r("4cab"),d={name:"serviceManger",data:function(){var t=this.$route.query;return{payType:t.type,productList:[],form:{attrList:[{mode:null,attr:[{originalPrice:null,studentUpLimit:null}]}],name:null,productId:[],id:t.id||null}}},mounted:function(){this.__init()},methods:{__init:function(){var t=Object(l["a"])(regeneratorRuntime.mark((function t(){var e,r,n,a;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,Object(s["c"])({page:1,rows:999});case 3:if(r=t.sent,this.productList=(null===(e=r.data)||void 0===e?void 0:e.rows)||[],"update"!=this.payType){t.next=12;break}return t.next=8,Object(u["c"])({id:this.form.id});case 8:n=t.sent,console.log(n),a=n.data||null,a&&(this.form.productId=a.productId.split(",").map((function(t){return Number(t)})),this.form.name=a.name,this.form.attrList=this.formatAttr(a.detailList,"asc"));case 12:t.next=16;break;case 14:t.prev=14,t.t0=t["catch"](0);case 16:case"end":return t.stop()}}),t,this,[[0,14]])})));function e(){return t.apply(this,arguments)}return e}(),onAddItem:function(t,e){"child"==t?e.push({mode:null,originalPrice:null,studentUpLimit:null}):"parent"==t&&this.form.attrList.push({mode:null,attr:[{originalPrice:null,studentUpLimit:null}]})},onRemoveItem:function(t,e){this.$confirm("是否删除?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(Object(l["a"])(regeneratorRuntime.mark((function r(){return regeneratorRuntime.wrap((function(r){while(1)switch(r.prev=r.next){case 0:t.splice(e,1);case 1:case"end":return r.stop()}}),r)}))))},onSubmit:function(){var t=Object(l["a"])(regeneratorRuntime.mark((function t(e){var r=this;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:this.$refs[e].validate((function(t){if(!t)return r.$nextTick((function(){var t=document.getElementsByClassName("is-error");t[0].scrollIntoView({block:"center",behavior:"smooth"})})),!1;var e=r.form,n=e.attrList,a=e.productId,i=Object(c["a"])(e,["attrList","productId"]),l=0,s=0;if(n.forEach((function(t){"YEAR"==t.mode?l++:"MONTH"==t.mode&&s++})),l>1||s>1)r.$message.error("付费模式重复");else{var d=Object(o["a"])(Object(o["a"])({},i),{},{productId:a.join(","),detailList:r.formatAttr(n)});"create"==r.payType?Object(u["a"])(d).then((function(t){200==t.code?(r.$message.success("保存成功"),r.onCancel()):r.$message.error(t.msg)})):"update"==r.payType&&Object(u["f"])(d).then((function(t){200==t.code?(r.$message.success("保存成功"),r.onCancel()):r.$message.error(t.msg)}))}}));case 1:case"end":return t.stop()}}),t,this)})));function e(e){return t.apply(this,arguments)}return e}(),formatAttr:function(t,e){var r=[];if(t){if("asc"==e){var n=[];t.forEach((function(t){n.includes(t.mode)?r.forEach((function(e){e.mode==t.mode&&e.attr.push({originalPrice:t.originalPrice,studentUpLimit:t.studentUpLimit})})):(n.push(t.mode),r.push({mode:t.mode,attr:[{originalPrice:t.originalPrice,studentUpLimit:t.studentUpLimit}]}))}))}else{var a,o=Object(i["a"])(t);try{for(o.s();!(a=o.n()).done;){var c=a.value;if(c.attr&&c.attr.length>0){var l,s=Object(i["a"])(c.attr);try{for(s.s();!(l=s.n()).done;){var u=l.value;r.push({mode:c.mode,originalPrice:u.originalPrice,studentUpLimit:u.studentUpLimit})}}catch(d){s.e(d)}finally{s.f()}}}}catch(d){o.e(d)}finally{o.f()}}return r}},onCancel:function(){this.$store.dispatch("delVisitedViews",this.$route),this.$router.push({path:"/serviceManager/serviceList"})}}},p=d,m=(r("6fbe"),r("2877")),f=Object(m["a"])(p,n,a,!1,null,"18ddf557",null);e["default"]=f.exports}}]);
|