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 n})),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 a=r("829b"),n=function(t){return Object(a["a"])({url:"/api-web/platformServe/queryPage",method:"get",params:t})},i=function(t){return Object(a["a"])({url:"/api-web/platformServe/add",method:"post",data:t})},o=function(t){return Object(a["a"])({url:"/api-web/platformServe/update",method:"post",data:t})},c=function(t){return Object(a["a"])({url:"/api-web/platformServe/delete/"+t.id,method:"get"})},l=function(t){return Object(a["a"])({url:"/api-web/platformServe/queryInfo/"+t.id,method:"get"})},s=function(t){return Object(a["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 n})),r.d(e,"d",(function(){return i})),r.d(e,"b",(function(){return o})),r.d(e,"c",(function(){return c}));var a=r("829b"),n=function(t){return Object(a["a"])({url:"/api-web/platformProduct/add",method:"post",data:t})},i=function(t){return Object(a["a"])({url:"/api-web/platformProduct/update",method:"post",data:t})},o=function(t){return Object(a["a"])({url:"/api-web/platformProduct/delete/"+t.id,method:"get"})},c=function(t){return Object(a["a"])({url:"/api-web/platformProduct/queryPage",method:"get",params:t})}},d3e1:function(t,e,r){"use strict";r.r(e);var a=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,a){return r("div",{key:a,staticClass:"serviceAttr"},[r("div",{staticClass:"serviceBlock"},[r("el-form-item",{attrs:{label:"付费模式",prop:"attrList."+a+".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(n,i){return r("div",{key:i},[r("el-form-item",{attrs:{label:"学员上限",prop:"attrList."+a+".attr."+i+".studentUpLimit",rules:[{required:!0,message:"请输入学员上限",trigger:"blur"},{type:"number",message:"学员上限必须为数字值"}]}},[r("el-input",{attrs:{placeholder:"请输入学员上限"},model:{value:n.studentUpLimit,callback:function(e){t.$set(n,"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."+a+".attr."+i+".originalPrice",rules:[{required:!0,message:"请输入服务原价",trigger:"blur"},{type:"number",message:"服务原价必须为数字值"}]}},[r("el-input",{attrs:{placeholder:"请输入服务原价"},model:{value:n.originalPrice,callback:function(e){t.$set(n,"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,a)}}},[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)])},n=[],i=r("b85c"),o=(r("6762"),r("5530")),c=(r("ac6a"),r("15fd")),l=r("c7eb"),s=(r("7f7f"),r("c5f6"),r("28a5"),r("96cf"),r("1da1")),u=r("9dc3"),d=r("4cab"),p=["attrList","productId"],m={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(s["a"])(Object(l["a"])().mark((function t(){var e,r,a,n;return Object(l["a"])().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,Object(u["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(d["c"])({id:this.form.id});case 8:a=t.sent,console.log(a),n=a.data||null,n&&(this.form.productId=n.productId.split(",").map((function(t){return Number(t)})),this.form.name=n.name,this.form.attrList=this.formatAttr(n.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(s["a"])(Object(l["a"])().mark((function r(){return Object(l["a"])().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(s["a"])(Object(l["a"])().mark((function t(e){var r=this;return Object(l["a"])().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,a=e.attrList,n=e.productId,i=Object(c["a"])(e,p),l=0,s=0;if(a.forEach((function(t){"YEAR"==t.mode?l++:"MONTH"==t.mode&&s++})),l>1||s>1)r.$message.error("付费模式重复");else{var u=Object(o["a"])(Object(o["a"])({},i),{},{productId:n.join(","),detailList:r.formatAttr(a)});"create"==r.payType?Object(d["a"])(u).then((function(t){200==t.code?(r.$message.success("保存成功"),r.onCancel()):r.$message.error(t.msg)})):"update"==r.payType&&Object(d["f"])(u).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 a=[];t.forEach((function(t){a.includes(t.mode)?r.forEach((function(e){e.mode==t.mode&&e.attr.push({originalPrice:t.originalPrice,studentUpLimit:t.studentUpLimit})})):(a.push(t.mode),r.push({mode:t.mode,attr:[{originalPrice:t.originalPrice,studentUpLimit:t.studentUpLimit}]}))}))}else{var n,o=Object(i["a"])(t);try{for(o.s();!(n=o.n()).done;){var c=n.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"})}}},f=m,b=(r("6fbe"),r("2877")),v=Object(b["a"])(f,a,n,!1,null,"18ddf557",null);e["default"]=v.exports}}]);
|