1 |
- import{d as g,y as m,g as j,bC as S,T as I,n as y,j as t,D as T,A as a,B as C,aS as k,$ as x}from"./ResizeObserver.es.39b48a47.js";import{C as p}from"./index.f6c41ddf.js";import{C as P}from"./index.867583ad.js";import{S as v}from"./index.565ba66d.js";import{C as M}from"./index.a0f53d9f.js";import{T as V}from"./index.34ac729a.js";import"./index.db115763.js";import{F as f}from"./index.428ab1a8.js";import{A}from"./index.b6a283d2.js";import{C as E}from"./index.0a093430.js";import"./index.3c44a6d7.js";import{v as N}from"./toolsValidate.add49407.js";import{C as _}from"./index.970ad07b.js";import{T as B}from"./index.e90d2179.js";import{i as F,T as w}from"./index.f8ad93b3.js";import{F as D}from"./index.45e4ca3e.js";import{C as $}from"./index.a256e876.js";import"./index.16ffd6ad.js";import"./index.fcbcb027.js";import"./index.bb84a3aa.js";import"./index.608320e9.js";import"./checkbox_default.69f49af8.js";import"./use-id.b004ff17.js";import"./index.dc19bc54.js";const q="_select_okh0s_1",L="_showPrice_okh0s_12",U="_tipsAccount_okh0s_27",O="_radio_okh0s_39",Q="_checkbox_okh0s_40",G="_PracticeSettingBtns_okh0s_93",R="_iconQuestion_okh0s_99",z="_tipPopup_okh0s_104";var l={select:q,"tag-list":"_tag-list_okh0s_5",showPrice:L,tipsAccount:U,"radio-group":"_radio-group_okh0s_39","checkbox-group":"_checkbox-group_okh0s_40",radio:O,checkbox:Q,PracticeSettingBtns:G,iconQuestion:R,tipPopup:z};function d(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!x(e)}const H=e=>(e=Number(e),Math.ceil(e*100)/100);var Pe=g({name:"PracticeSetting",data(){const e=this.$route.query;return{tipStatus:!1,courseType:e.tabs=="vip"?"VIP":"PRACTICE",text:e.tabs=="vip"?"VIP\u5B9A\u5236\u8BFE":"\u8DA3\u7EA0\u8BFE",subjectList:[],chargeTypeArr:{0:"\u5426",1:"\u662F"},checkStatus:!1,classTimeStatus:!1,subjectStatus:!1,form:{lowestPrice:0,highestPrice:0,coursePrice:0,courseMinutes:null,freeMinutes:0,subjectIdTemp:"",subjectId:[],subjectPrice:[]},minutes:[],rate:0,accountPeriod:0}},computed:{choiceSubjectId(){const e=this.form;return(e.subjectIdTemp?e.subjectIdTemp.split(","):[]).map(s=>Number(s))||[]}},async mounted(){document.title=`${this.text}\u8BBE\u7F6E`;try{((await m.get("/api-teacher/sysConfig/queryByParamNameList",{params:{paramNames:"practice_times_setting,practice_service_fee,vip_course_times_setting,vip_course_service_fee,vip_course_account_period,practice_account_period"}})).data||[]).forEach(i=>{if(i.paramName===(this.courseType==="VIP"?"vip_course_times_setting":"practice_times_setting")){const c=i.paramValue?JSON.parse(i.paramValue):[],b=[];if(c.forEach(n=>{b.push({...n,name:n.courseMinutes})}),this.minutes=[...b],this.minutes.length>0){const n=this.minutes[0];this.form.coursePrice=n.price,this.form.courseMinutes=n.courseMinutes,this.form.freeMinutes=n.freeMinutes,this.form.lowestPrice=n.lowestPrice||0,this.form.highestPrice=n.highestPrice||0}}i.paramName===(this.courseType==="VIP"?"vip_course_service_fee":"practice_service_fee")&&(this.rate=i.paramValue),i.paramName===(this.courseType==="VIP"?"vip_course_account_period":"practice_account_period")&&(this.accountPeriod=i.paramValue)});const s=await m.post("/api-teacher/teacher/querySubject");this.subjectList=s.data||[];const r=(await m.post("/api-teacher/teacherSubjectPrice/list",{data:{courseType:this.courseType}})).data;if(Array.isArray(r)){const i=[];r.forEach(c=>{this.form.courseMinutes=c.courseMinutes,this.form.freeMinutes=c.freeMinutes,this.form.subjectId.push(c.subjectId),i.push({subjectId:c.subjectId,subjectName:c.subjectName,subjectPrice:c.subjectPrice})}),this.form.subjectIdTemp=this.form.subjectId.join(","),this.form.subjectPrice=i}const h=await m.post("/api-teacher/open/appVersion",{data:{platform:j.platformType==="STUDENT"?"ios-student":"ios-teacher",version:j.version}});this.checkStatus=!!h.data.check}catch{}},methods:{onCalcCoursePrice(e){if(!e)return"-";const o=Number(e);return S(H(o-this.rate*o/100))},onSelect(e){this.form.courseMinutes=e.courseMinutes,this.form.freeMinutes=e.freeMinutes},onChoice(e){console.log(e);const o=e||[];this.form.subjectId=o,this.form.subjectIdTemp=o.join(",")||"";const s=[...this.form.subjectPrice];o.forEach(r=>{s.findIndex(i=>i.subjectId===r)===-1&&(console.log(this.form,"this.orm"),s.push({subjectId:r,subjectPrice:this.checkStatus?0:this.form.coursePrice,subjectName:""}))});const u=[];s.forEach(r=>{o.some(i=>i===r.subjectId)&&u.push(r)}),this.form.subjectPrice=u,this.subjectStatus=!1},getSubjectName(e){const o=this.subjectList.find(s=>s.id===e);return o?o.name:""},validatePrice(e){return!(Number(e)>Number(this.form.highestPrice)||Number(e)<Number(this.form.lowestPrice))},onFormatter(e){return N(e)},async onSubmit(){try{const e=this.form,o=[];e.subjectPrice.forEach(s=>{const u=this.getSubjectName(s.subjectId);console.log(u,"subjectName"),o.push({...s,courseMinutes:this.form.courseMinutes,courseType:this.courseType,freeMinutes:this.form.freeMinutes,subjectName:u})}),console.log(o,"foparamsrm"),await m.post("/api-teacher/teacherSubjectPrice/saveOrUpdate",{data:o}),setTimeout(()=>{I("\u8BBE\u7F6E\u6210\u529F")},100),setTimeout(()=>{y({api:"back",content:{}})},500)}catch{}}},render(){let e,o;return t(D,{style:{paddingTop:"15px"},onSubmit:this.onSubmit},{default:()=>[t(_,{title:`${this.text}\u8BBE\u7F6E`},{right:()=>t("img",{src:F,class:l.iconQuestion,onClick:()=>this.tipStatus=!0},null)}),t(P,null,{default:()=>[t(p,{title:"\u53EF\u6559\u6388\u4E50\u5668",required:!0},{default:()=>[this.form.subjectPrice&&this.form.subjectPrice.length>0&&t($,{modelValue:this.form.subjectId,class:l["checkbox-group"],disabled:!0,onClick:()=>{this.subjectStatus=!0}},d(e=this.form.subjectPrice.map(s=>{let u;return t(E,{class:l.checkbox},{default:()=>[t(V,{plain:!0,type:"primary",round:!0,closeable:!0,size:"large",style:{backgroundColor:"#E9FFF8"},onClick:r=>{r.stopPropagation(),r.preventDefault()},onClose:r=>{r.stopPropagation(),r.preventDefault(),T.confirm({title:"\u63D0\u793A",message:"\u60A8\u662F\u5426\u8981\u5220\u9664\u9009\u62E9\u7684\u4E50\u5668\uFF1F",confirmButtonColor:"var(--van-primary)"}).then(()=>{const h=this.form.subjectId.indexOf(s.subjectId);h!==-1&&this.form.subjectId.splice(h,1);const i=this.form.subjectPrice.findIndex(c=>c.subjectId===s.subjectId);i!==-1&&this.form.subjectPrice.splice(i,1),this.form.subjectIdTemp=this.form.subjectId.join(",")})}},d(u=this.getSubjectName(s.subjectId))?u:{default:()=>[u]})]})}))?e:{default:()=>[e]}),!this.form.subjectPrice.length&&t(f,{modelValue:this.form.subjectIdTemp,"onUpdate:modelValue":s=>this.form.subjectIdTemp=s,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)]}),t(p,{title:"\u5355\u8BFE\u65F6\u65F6\u957F",required:!0},{default:()=>[t(f,{modelValue:this.form.courseMinutes,"onUpdate:modelValue":s=>this.form.courseMinutes=s,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:()=>t("span",null,[a("\u5206\u949F")])})]})]}),this.form.subjectPrice&&this.form.subjectPrice.length>0&&!this.checkStatus&&t(P,null,d(o=this.form.subjectPrice.map(s=>t(p,{title:`${this.getSubjectName(s.subjectId)}\u58F0\u90E8${this.text}\u4EF7\u683C`,required:!0},{default:()=>[t(f,{modelValue:s.subjectPrice,"onUpdate:modelValue":u=>s.subjectPrice=u,name:"singleMins",type:"number",labelWidth:"auto",border:!1,readonly:this.courseType==="PRACTICE",label:`${this.form.courseMinutes||0}\u5206\u949F / `,rules:[{required:!0,message:`\u8BF7\u8F93\u5165${this.getSubjectName(s.subjectId)}\u58F0\u90E8${this.text}\u4EF7\u683C`},this.courseType==="VIP"?{validator:this.validatePrice,message:`\u8BF7\u8F93\u5165\u4EF7\u683C\u5728${this.form.lowestPrice}~${this.form.highestPrice}\u8303\u56F4\u5185`}:{}],formatter:this.onFormatter,maxlength:8,placeholder:this.courseType==="VIP"?`${this.form.lowestPrice}~${this.form.highestPrice}`:`\u8BF7\u9009\u62E9\u58F0\u90E8${this.text}\u4EF7\u683C`},{button:()=>t("span",null,[a("\u5143")])}),t("div",{class:l.showPrice},[a("\u8BFE\u7A0B\u9884\u8BA1\u6536\u5165\uFF1A"),t("span",null,[a("\xA5 "),this.onCalcCoursePrice(s.subjectPrice)])])]})))?o:{default:()=>[o]}),t("div",{class:l.tipsAccount},[a("\u6263\u9664\u5E94\u7F34\u7A0E\u91D1\u548C\u5E73\u53F0\u670D\u52A1\u8D39\u540E "),t("br",null,null),a("\u5B9E\u9645\u8BFE\u7A0B\u6536\u5165\u6309\u5B66\u751F\u5B9E\u9645\u4ED8\u6B3E\u91D1\u989D\u8BA1\u7B97"),t("br",null,null),a("\u60A8\u7684\u8BFE\u7A0B\u6536\u5165\u5C06\u5728\u8BFE\u7A0B\u7ED3\u675F"),t("span",null,[this.accountPeriod]),a("\u5929\u540E\u7ED3\u7B97\u5230\u60A8\u7684\u8D26\u6237")]),t(B,{position:"bottom"},{default:()=>[t("div",{class:["btnGroup",l.PracticeSettingBtns]},[t(C,{block:!0,round:!0,type:"primary","native-type":"submit"},{default:()=>[a("\u63D0\u4EA4")]})])]}),t(M,{modelValue:this.subjectStatus,"onUpdate:modelValue":s=>this.subjectStatus=s,destroy:!0},{default:()=>[t(_,{title:`${this.text}\u8BBE\u7F6E`},null),t(v,{max:5,single:!0,subjectList:this.subjectList,choiceSubjectIds:this.choiceSubjectId,onChoice:this.onChoice},null)]}),t(A,{show:this.classTimeStatus,"onUpdate:show":s=>this.classTimeStatus=s,actions:this.minutes,cancelText:"\u53D6\u6D88",closeOnClickAction:!0,onSelect:this.onSelect},null),t(k,{show:this.tipStatus,class:l.tipPopup,closeable:!0,onClose:()=>this.tipStatus=!1},{default:()=>[t(w,{onClose:()=>this.tipStatus=!1,title:this.courseType==="VIP"?"\u4EC0\u4E48\u662FVIP\u5B9A\u5236\u8BFE\uFF1F":"\u4EC0\u4E48\u662F\u8DA3\u7EA0\u8BFE\uFF1F",content:this.courseType==="VIP"?"VIP\u5B9A\u5236\u8BFE\u91C7\u7528\u4E00\u5BF9\u4E00\u4E13\u5C5E\u6388\u8BFE\u6A21\u5F0F\uFF0C\u6BCF\u8282\u8BFE\u65F6\u957F\u4E3A45\u5206\u949F\u3002\u8BFE\u7A0B\u5185\u5BB9\u6839\u636E\u5B66\u751F\u7684\u5177\u4F53\u9700\u6C42\u91CF\u8EAB\u6253\u9020\uFF0C\u65E8\u5728\u5168\u9762\u63D0\u5347\u5B66\u751F\u7684\u4E2A\u4EBA\u6280\u80FD\u4E0E\u8868\u73B0\u3002\u4E0D\u8BBA\u662F\u5E0C\u671B\u5728\u4E50\u5668\u6F14\u594F\u6280\u5DE7\u4E0A\u53D6\u5F97\u7A81\u7834\uFF0C\u5982\u63D0\u9AD8\u6307\u6CD5\u7CBE\u51C6\u5EA6\u3001\u6C14\u606F\u63A7\u5236\u80FD\u529B\u6216\u8282\u594F\u638C\u63E1\u7B49\uFF1B\u8FD8\u662F\u4E3A\u5373\u5C06\u5230\u6765\u7684\u91CD\u8981\u6D3B\u52A8\u3001\u6BD4\u8D5B\u6216\u8003\u7EA7\u505A\u5145\u5206\u51C6\u5907\uFF0C\u6211\u4EEC\u90FD\u80FD\u63D0\u4F9B\u9AD8\u5EA6\u5339\u914D\u7684\u6559\u5B66\u65B9\u6848\u3002\u6B64\u5916\uFF0C\u6559\u5B66\u8FDB\u5EA6\u5C06\u6839\u636E\u6BCF\u4F4D\u5B66\u5458\u7684\u5B66\u4E60\u5438\u6536\u60C5\u51B5\u7075\u6D3B\u8C03\u6574\uFF0C\u786E\u4FDD\u6BCF\u4E2A\u4EBA\u90FD\u80FD\u5728\u6700\u9002\u5408\u81EA\u5DF1\u7684\u8282\u594F\u4E2D\u7A33\u6B65\u524D\u8FDB\uFF0C\u624E\u5B9E\u63D0\u5347\u4E2A\u4EBA\u80FD\u529B\u3002":"\u8DA3\u7EA0\u8BFE\u4EE5\u4E00\u5BF9\u4E00\u4E13\u5C5E\u3001\u9AD8\u5EA6\u9488\u5BF9\u6027\u7684\u5F62\u5F0F\u8FDB\u884C\uFF0C\u6BCF\u6B21\u8BFE\u7A0B\u65F6\u957F\u4E3A25\u5206\u949F\u3002\u672C\u8BFE\u7A0B\u4E13\u4E3A\u89E3\u51B3\u5B66\u751F\u65E5\u5E38\u7EC3\u4E60\u4E2D\u7684\u7591\u95EE\u4E0E\u8BEF\u533A\u8BBE\u8BA1\uFF0C\u5C24\u5176\u9002\u5408\u90A3\u4E9B\u5728\u81EA\u6211\u7EC3\u4E60\u540E\u611F\u5230\u56F0\u60D1\u6216\u4E0D\u786E\u5B9A\u81EA\u5DF1\u65B9\u6CD5\u662F\u5426\u6B63\u786E\u7684\u5B66\u751F\u3002\u4E0D\u540C\u4E8E\u4F20\u7EDF\u7684\u6559\u5B66\u6A21\u5F0F\uFF0C\u8DA3\u7EA0\u8BFE\u4E0D\u4FA7\u91CD\u4E8E\u65B0\u77E5\u8BC6\u6216\u65B0\u6280\u80FD\u7684\u4F20\u6388\uFF0C\u800C\u662F\u5168\u5FC3\u5168\u610F\u81F4\u529B\u4E8E\u68C0\u67E5\u5B66\u751F\u73B0\u6709\u7684\u7EC3\u4E60\u6210\u679C\uFF0C\u5E76\u53CA\u65F6\u7EA0\u6B63\u5176\u4E2D\u51FA\u73B0\u7684\u95EE\u9898\u3002\u8FD9\u79CD\u65B9\u5F0F\u4E0D\u4EC5\u6709\u52A9\u4E8E\u5B66\u751F\u5DE9\u56FA\u5DF2\u638C\u63E1\u7684\u77E5\u8BC6\u548C\u6280\u80FD\uFF0C\u8FD8\u80FD\u6709\u6548\u9632\u6B62\u9519\u8BEF\u4E60\u60EF\u7684\u5F62\u6210\u548C\u53D1\u5C55\uFF0C\u4E3A\u4ED6\u4EEC\u4ECA\u540E\u7684\u5B66\u4E60\u6253\u4E0B\u66F4\u52A0\u575A\u5B9E\u7684\u57FA\u7840\u3002"},null)]})]})}});export{Pe as default,H as numberToTwoUp};
|