!function(){function e(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,n){if(!e)return;if("string"==typeof e)return t(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return t(e,n)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(e.form.courseMinutes=e.minutes[0].courseMinutes,e.form.freeMinutes=e.minutes[0].freeMinutes)}"practice_service_fee"===t.paramName&&(e.rate=t.paramValue)})),t.next=9,c.post("/api-teacher/teacher/querySubject");case 9:return o=t.sent,e.subjectList=o.data||[],t.next=13,c.post("/api-teacher/teacherSubjectPrice/list",{data:{courseType:e.courseType}});case 13:return i=t.sent,a=i.data,Array.isArray(a)&&(s=[],a.forEach((function(t){e.form.courseMinutes=t.courseMinutes,e.form.freeMinutes=t.freeMinutes,e.form.subjectId.push(t.subjectId),s.push({subjectId:t.subjectId,subjectName:t.subjectName,subjectPrice:t.subjectPrice})})),e.form.subjectIdTemp=e.form.subjectId.join(","),e.form.subjectPrice=s),t.next=18,c.post("/api-teacher/open/appVersion",{data:{platform:"STUDENT"===u.platformType?"ios-student":"ios-teacher",version:u.version}});case 18:f=t.sent,e.checkStatus=!!f.data.check,t.next=24;break;case 22:t.prev=22,t.t0=t.catch(1);case 24:case"end":return t.stop()}}),t,null,[[1,22]])})))()},methods:{onSelect:function(e){this.form.courseMinutes=e.courseMinutes,this.form.freeMinutes=e.freeMinutes},onChoice:function(t){var n=this;console.log(t);var r=t||[];this.form.subjectId=r,this.form.subjectIdTemp=r.join(",")||"";var c=e(this.form.subjectPrice);r.forEach((function(e){-1===c.findIndex((function(t){return t.subjectId===e}))&&c.push({subjectId:e,subjectPrice:n.checkStatus?0:null,subjectName:""})}));var u=[];c.forEach((function(e){r.some((function(t){return t===e.subjectId}))&&u.push(e)})),this.form.subjectPrice=u,this.subjectStatus=!1},getSubjectName:function(e){var t=this.subjectList.find((function(t){return t.id===e}));return t?t.name:""},onFormatter:function(e){return x(e)},onSubmit:function(){var e=this;return o(regeneratorRuntime.mark((function t(){var n,u;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,n=e.form,u=[],n.subjectPrice.forEach((function(t){var n=e.getSubjectName(t.subjectId);console.log(n,"subjectName"),u.push(r(r({},t),{},{courseMinutes:e.form.courseMinutes,courseType:e.courseType,freeMinutes:e.form.freeMinutes,subjectName:n}))})),console.log(u,"foparamsrm"),t.next=7,c.post("/api-teacher/teacherSubjectPrice/saveOrUpdate",{data:u});case 7:setTimeout((function(){i("设置成功")}),100),setTimeout((function(){a({api:"back",content:{}})}),500),t.next=13;break;case 11:t.prev=11,t.t0=t.catch(0);case 13:case"end":return t.stop()}}),t,null,[[0,11]])})))()}},render:function(){var e,t,n=this;return s(P,{style:{paddingTop:"15px"},onSubmit:this.onSubmit},{default:function(){return[s(k,{title:"".concat(n.text,"设置")},null),s(p,null,{default:function(){return[s(m,{title:"可教授乐器",required:!0},{default:function(){return[n.form.subjectPrice&&n.form.subjectPrice.length>0&&s(I,{modelValue:n.form.subjectId,class:T,disabled:!0,onClick:function(){n.subjectStatus=!0}},C(e=n.form.subjectPrice.map((function(e){var t;return s(v,{class:M},{default:function(){return[s(h,{plain:!0,type:"primary",round:!0,closeable:!0,size:"large",style:{backgroundColor:"#E9FFF8"},onClick:function(e){e.stopPropagation(),e.preventDefault()},onClose:function(t){t.stopPropagation(),t.preventDefault(),f.confirm({title:"提示",message:"您是否要删除选择的乐器?",confirmButtonColor:"var(--van-primary)"}).then((function(){var t=n.form.subjectId.indexOf(e.subjectId);-1!==t&&n.form.subjectId.splice(t,1);var r=n.form.subjectPrice.findIndex((function(t){return t.subjectId===e.subjectId}));-1!==r&&n.form.subjectPrice.splice(r,1),n.form.subjectIdTemp=n.form.subjectId.join(",")}))}},C(t=n.getSubjectName(e.subjectId))?t:{default:function(){return[t]}})]}})})))?e:{default:function(){return[e]}}),!n.form.subjectPrice.length&&s(_,{modelValue:n.form.subjectIdTemp,"onUpdate:modelValue":function(e){return n.form.subjectIdTemp=e},name:"courseMinutes",readonly:!0,onClick:function(){n.subjectStatus=!0},rules:[{required:!0,message:"请选择可教授乐器"}],placeholder:"请选择可教授乐器"},null)]}}),s(m,{title:"单课时时长",required:!0},{default:function(){return[s(_,{modelValue:n.form.courseMinutes,"onUpdate:modelValue":function(e){return n.form.courseMinutes=e},name:"courseMinutes",readonly:!0,isLink:!0,onClick:function(){n.classTimeStatus=!0},rules:[{required:!0,message:"请选择单课时时长"}],placeholder:"请选择单课时时长"},{button:function(){return s("span",null,[l("分钟")])}})]}})]}}),n.form.subjectPrice&&n.form.subjectPrice.length>0&&!n.checkStatus&&s(p,null,C(t=n.form.subjectPrice.map((function(e){return s(m,{title:"".concat(n.getSubjectName(e.subjectId),"声部").concat(n.text,"价格"),required:!0},{default:function(){return[s(_,{modelValue:e.subjectPrice,"onUpdate:modelValue":function(t){return e.subjectPrice=t},name:"singleMins",type:"number",labelWidth:"auto",label:"".concat(n.form.courseMinutes||0,"分钟 / "),rules:[{required:!0,message:"请选择声部".concat(n.text,"价格")}],formatter:n.onFormatter,maxlength:8,placeholder:"请选择声部".concat(n.text,"价格")},{button:function(){return s("span",null,[l("元")])}})]}})})))?t:{default:function(){return[t]}}),s(S,{position:"bottom"},{default:function(){return[s("div",{class:["btnGroup",O]},[s(b,{block:!0,round:!0,type:"primary","native-type":"submit"},{default:function(){return[l("提交")]}})])]}}),s(g,{modelValue:n.subjectStatus,"onUpdate:modelValue":function(e){return n.subjectStatus=e},destroy:!0},{default:function(){return[s(k,null,null),s(j,{max:5,single:!0,subjectList:n.subjectList,choiceSubjectIds:n.choiceSubjectId,onChoice:n.onChoice},null)]}}),s(y,{show:n.classTimeStatus,"onUpdate:show":function(e){return n.classTimeStatus=e},actions:n.minutes,cancelText:"取消",closeOnClickAction:!0,onSelect:n.onSelect},null)]}})}}))}}}))}();