1 |
- import{d as I,y as n,g as j,T as _,n as y,j as s,D as P,A as m,B as T,$ as k}from"./ResizeObserver.es.de70eb81.js";import{C as l}from"./index.92fd977f.js";import{C as g}from"./index.dc704fbd.js";import{S as x}from"./index.c63dee61.js";import{C}from"./index.7da1a1c2.js";import{T as M}from"./index.b38c0a40.js";import"./index.b204912d.js";import{F as p}from"./index.d298c9f4.js";import{A as N}from"./index.70c2db54.js";import{C as V}from"./index.8229e13f.js";import"./index.f9451404.js";import{v}from"./toolsValidate.add49407.js";import{C as S}from"./index.d44dfb7f.js";import{T as F}from"./index.ebbce041.js";import{F as E}from"./index.3efa8947.js";import{C as q}from"./index.fdfcf414.js";import"./index.b1676f8c.js";import"./index.626a4b65.js";import"./index.5b361b3f.js";import"./index.43cc4a62.js";import"./checkbox_default.ae7153bb.js";import"./use-id.41d29866.js";import"./index.d7d22516.js";const A="_select_usbbk_1",$="_radio_usbbk_12",B="_checkbox_usbbk_13",D="_PracticeSettingBtns_usbbk_56";var h={select:A,"tag-list":"_tag-list_usbbk_5","radio-group":"_radio-group_usbbk_12","checkbox-group":"_checkbox-group_usbbk_13",radio:$,checkbox:B,PracticeSettingBtns:D};function b(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!k(t)}var ae=I({name:"PracticeSetting",data(){const t=this.$route.query;return{courseType:t.tabs=="vip"?"VIP":"PRACTICE",text:t.tabs=="vip"?"VIP\u5B9A\u5236\u8BFE":"\u8DA3\u7EA0\u8BFE",subjectList:[],chargeTypeArr:{0:"\u5426",1:"\u662F"},checkStatus:!1,classTimeStatus:!1,subjectStatus:!1,form:{courseMinutes:null,freeMinutes:0,subjectIdTemp:"",subjectId:[],subjectPrice:[]},minutes:[],rate:0}},computed:{choiceSubjectId(){const t=this.form;return(t.subjectIdTemp?t.subjectIdTemp.split(","):[]).map(e=>Number(e))||[]}},async mounted(){document.title=`${this.text}\u8BBE\u7F6E`;try{((await n.get("/api-teacher/sysConfig/queryByParamNameList",{params:{paramNames:"practice_times_setting,practice_service_fee,vip_course_times_setting"}})).data||[]).forEach(o=>{if(o.paramName===(this.courseType==="VIP"?"vip_course_times_setting":"practice_times_setting")){const u=o.paramValue?JSON.parse(o.paramValue):[],d=[];u.forEach(f=>{d.push({...f,name:f.courseMinutes})}),this.minutes=[...d],this.minutes.length>0&&(this.form.courseMinutes=this.minutes[0].courseMinutes,this.form.freeMinutes=this.minutes[0].freeMinutes)}o.paramName==="practice_service_fee"&&(this.rate=o.paramValue)});const e=await n.post("/api-teacher/teacher/querySubject");this.subjectList=e.data||[];const i=(await n.post("/api-teacher/teacherSubjectPrice/list",{data:{courseType:this.courseType}})).data;if(Array.isArray(i)){const o=[];i.forEach(u=>{this.form.courseMinutes=u.courseMinutes,this.form.freeMinutes=u.freeMinutes,this.form.subjectId.push(u.subjectId),o.push({subjectId:u.subjectId,subjectName:u.subjectName,subjectPrice:u.subjectPrice})}),this.form.subjectIdTemp=this.form.subjectId.join(","),this.form.subjectPrice=o}const a=await n.post("/api-teacher/open/appVersion",{data:{platform:j.platformType==="STUDENT"?"ios-student":"ios-teacher",version:j.version}});this.checkStatus=!!a.data.check}catch{}},methods:{onSelect(t){this.form.courseMinutes=t.courseMinutes,this.form.freeMinutes=t.freeMinutes},onChoice(t){console.log(t);const r=t||[];this.form.subjectId=r,this.form.subjectIdTemp=r.join(",")||"";const e=[...this.form.subjectPrice];r.forEach(i=>{e.findIndex(o=>o.subjectId===i)===-1&&e.push({subjectId:i,subjectPrice:this.checkStatus?0:null,subjectName:""})});const c=[];e.forEach(i=>{r.some(o=>o===i.subjectId)&&c.push(i)}),this.form.subjectPrice=c,this.subjectStatus=!1},getSubjectName(t){const r=this.subjectList.find(e=>e.id===t);return r?r.name:""},onFormatter(t){return v(t)},async onSubmit(){try{const t=this.form,r=[];t.subjectPrice.forEach(e=>{const c=this.getSubjectName(e.subjectId);console.log(c,"subjectName"),r.push({...e,courseMinutes:this.form.courseMinutes,courseType:this.courseType,freeMinutes:this.form.freeMinutes,subjectName:c})}),console.log(r,"foparamsrm"),await n.post("/api-teacher/teacherSubjectPrice/saveOrUpdate",{data:r}),setTimeout(()=>{_("\u8BBE\u7F6E\u6210\u529F")},100),setTimeout(()=>{y({api:"back",content:{}})},500)}catch{}}},render(){let t,r;return s(E,{style:{paddingTop:"15px"},onSubmit:this.onSubmit},{default:()=>[s(S,{title:`${this.text}\u8BBE\u7F6E`},null),s(g,null,{default:()=>[s(l,{title:"\u53EF\u6559\u6388\u4E50\u5668",required:!0},{default:()=>[this.form.subjectPrice&&this.form.subjectPrice.length>0&&s(q,{modelValue:this.form.subjectId,class:h["checkbox-group"],disabled:!0,onClick:()=>{this.subjectStatus=!0}},b(t=this.form.subjectPrice.map(e=>{let c;return s(V,{class:h.checkbox},{default:()=>[s(M,{plain:!0,type:"primary",round:!0,closeable:!0,size:"large",style:{backgroundColor:"#E9FFF8"},onClick:i=>{i.stopPropagation(),i.preventDefault()},onClose:i=>{i.stopPropagation(),i.preventDefault(),P.confirm({title:"\u63D0\u793A",message:"\u60A8\u662F\u5426\u8981\u5220\u9664\u9009\u62E9\u7684\u4E50\u5668\uFF1F",confirmButtonColor:"var(--van-primary)"}).then(()=>{const a=this.form.subjectId.indexOf(e.subjectId);a!==-1&&this.form.subjectId.splice(a,1);const o=this.form.subjectPrice.findIndex(u=>u.subjectId===e.subjectId);o!==-1&&this.form.subjectPrice.splice(o,1),this.form.subjectIdTemp=this.form.subjectId.join(",")})}},b(c=this.getSubjectName(e.subjectId))?c:{default:()=>[c]})]})}))?t:{default:()=>[t]}),!this.form.subjectPrice.length&&s(p,{modelValue:this.form.subjectIdTemp,"onUpdate:modelValue":e=>this.form.subjectIdTemp=e,name:"courseMinutes",readonly:!0,onClick:()=>{this.subjectStatus=!0},rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u53EF\u6559\u6388\u4E50\u5668"}],placeholder:"\u8BF7\u9009\u62E9\u53EF\u6559\u6388\u4E50\u5668"},null)]}),s(l,{title:"\u5355\u8BFE\u65F6\u65F6\u957F",required:!0},{default:()=>[s(p,{modelValue:this.form.courseMinutes,"onUpdate:modelValue":e=>this.form.courseMinutes=e,name:"courseMinutes",readonly:!0,isLink:!0,onClick:()=>{this.classTimeStatus=!0},rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u5355\u8BFE\u65F6\u65F6\u957F"}],placeholder:"\u8BF7\u9009\u62E9\u5355\u8BFE\u65F6\u65F6\u957F"},{button:()=>s("span",null,[m("\u5206\u949F")])})]})]}),this.form.subjectPrice&&this.form.subjectPrice.length>0&&!this.checkStatus&&s(g,null,b(r=this.form.subjectPrice.map(e=>s(l,{title:`${this.getSubjectName(e.subjectId)}\u58F0\u90E8${this.text}\u4EF7\u683C`,required:!0},{default:()=>[s(p,{modelValue:e.subjectPrice,"onUpdate:modelValue":c=>e.subjectPrice=c,name:"singleMins",type:"number",labelWidth:"auto",label:`${this.form.courseMinutes||0}\u5206\u949F / `,rules:[{required:!0,message:`\u8BF7\u9009\u62E9\u58F0\u90E8${this.text}\u4EF7\u683C`}],formatter:this.onFormatter,maxlength:8,placeholder:`\u8BF7\u9009\u62E9\u58F0\u90E8${this.text}\u4EF7\u683C`},{button:()=>s("span",null,[m("\u5143")])})]})))?r:{default:()=>[r]}),s(F,{position:"bottom"},{default:()=>[s("div",{class:["btnGroup",h.PracticeSettingBtns]},[s(T,{block:!0,round:!0,type:"primary","native-type":"submit"},{default:()=>[m("\u63D0\u4EA4")]})])]}),s(C,{modelValue:this.subjectStatus,"onUpdate:modelValue":e=>this.subjectStatus=e,destroy:!0},{default:()=>[s(S,null,null),s(x,{max:5,single:!0,subjectList:this.subjectList,choiceSubjectIds:this.choiceSubjectId,onChoice:this.onChoice},null)]}),s(N,{show:this.classTimeStatus,"onUpdate:show":e=>this.classTimeStatus=e,actions:this.minutes,cancelText:"\u53D6\u6D88",closeOnClickAction:!0,onSelect:this.onSelect},null)]})}});export{ae as default};
|