|
@@ -6,8 +6,6 @@ import request from '@/helpers/request'
|
|
|
import { postMessage } from '@/helpers/native-message'
|
|
|
import {
|
|
|
Form,
|
|
|
- Radio,
|
|
|
- RadioGroup,
|
|
|
Tag,
|
|
|
Sticky,
|
|
|
Button,
|
|
@@ -21,14 +19,17 @@ import {
|
|
|
import { defineComponent } from 'vue'
|
|
|
import styles from './practice-setting.module.less'
|
|
|
import { verifyNumberIntegerAndFloat } from '@/helpers/toolsValidate'
|
|
|
-import Timer from './model/timer'
|
|
|
import ColHeader from '@/components/col-header'
|
|
|
import { state } from '@/state'
|
|
|
+import TheSticky from '@/components/the-sticky'
|
|
|
|
|
|
export default defineComponent({
|
|
|
name: 'PracticeSetting',
|
|
|
data() {
|
|
|
+ const query = this.$route.query
|
|
|
return {
|
|
|
+ courseType: query.tabs == 'vip' ? 'VIP' : 'PRACTICE',
|
|
|
+ text: query.tabs == 'vip' ? 'VIP定制课' : '趣纠课',
|
|
|
subjectList: [],
|
|
|
chargeTypeArr: {
|
|
|
0: '否',
|
|
@@ -37,23 +38,12 @@ export default defineComponent({
|
|
|
checkStatus:false, // 是否审核版本
|
|
|
classTimeStatus: false,
|
|
|
subjectStatus: false,
|
|
|
- timerStatus: false,
|
|
|
- timeSetting: {
|
|
|
- courseMinutes: 25,
|
|
|
- freeMinutes: 5,
|
|
|
- startSetting: '08:00',
|
|
|
- endSetting: '18:00'
|
|
|
- },
|
|
|
- timerObject: {} as any,
|
|
|
form: {
|
|
|
- enableFlag: 1,
|
|
|
courseMinutes: null as any,
|
|
|
freeMinutes: 0,
|
|
|
subjectIdTemp: '',
|
|
|
subjectId: [] as any[],
|
|
|
subjectPrice: [] as any[],
|
|
|
- skipHolidayFlag: 1,
|
|
|
- setting: ''
|
|
|
},
|
|
|
minutes: [] as any,
|
|
|
rate: 0
|
|
@@ -67,6 +57,7 @@ export default defineComponent({
|
|
|
}
|
|
|
},
|
|
|
async mounted() {
|
|
|
+ document.title = `${this.text}设置`
|
|
|
try {
|
|
|
// 获取手续费和分钟数
|
|
|
const config = await request.get(
|
|
@@ -74,13 +65,13 @@ export default defineComponent({
|
|
|
{
|
|
|
params: {
|
|
|
paramNames:
|
|
|
- 'practice_times_setting,practice_service_fee,course_start_setting,course_end_setting'
|
|
|
+ 'practice_times_setting,practice_service_fee,vip_course_times_setting'
|
|
|
}
|
|
|
}
|
|
|
)
|
|
|
const configData = config.data || []
|
|
|
configData.forEach((item: any) => {
|
|
|
- if (item.paramName === 'practice_times_setting') {
|
|
|
+ if (item.paramName === (this.courseType === 'VIP' ? 'vip_course_times_setting' : 'practice_times_setting')) {
|
|
|
const mins = item.paramValue ? JSON.parse(item.paramValue) : []
|
|
|
const tempArr = [] as any
|
|
|
mins.forEach((item: any) => {
|
|
@@ -90,16 +81,14 @@ export default defineComponent({
|
|
|
})
|
|
|
})
|
|
|
this.minutes = [...tempArr]
|
|
|
+ if(this.minutes.length > 0) {
|
|
|
+ this.form.courseMinutes = this.minutes[0].courseMinutes
|
|
|
+ this.form.freeMinutes = this.minutes[0].freeMinutes
|
|
|
+ }
|
|
|
}
|
|
|
if (item.paramName === 'practice_service_fee') {
|
|
|
this.rate = item.paramValue
|
|
|
}
|
|
|
- if (item.paramName === 'course_start_setting') {
|
|
|
- this.timeSetting.startSetting = item.paramValue
|
|
|
- }
|
|
|
- if (item.paramName === 'course_end_setting') {
|
|
|
- this.timeSetting.endSetting = item.paramValue
|
|
|
- }
|
|
|
})
|
|
|
//
|
|
|
const teacher = await request.post('/api-teacher/teacher/querySubject')
|
|
@@ -107,60 +96,30 @@ export default defineComponent({
|
|
|
|
|
|
// 获取课程设置
|
|
|
const setting = await request.post(
|
|
|
- '/api-teacher/teacherFreeTime/getDetail',
|
|
|
+ '/api-teacher/teacherSubjectPrice/list',
|
|
|
{
|
|
|
data: {
|
|
|
- defaultFlag: 1
|
|
|
+ courseType: this.courseType
|
|
|
}
|
|
|
}
|
|
|
)
|
|
|
const sr = setting.data
|
|
|
- if (sr) {
|
|
|
- this.timeSetting.courseMinutes = sr.courseMinutes
|
|
|
- this.timeSetting.freeMinutes = sr.freeMinutes
|
|
|
-
|
|
|
- this.timerObject = {
|
|
|
- monday: sr.monday ? JSON.parse(sr.monday) : [],
|
|
|
- tuesday: sr.tuesday ? JSON.parse(sr.tuesday) : [],
|
|
|
- wednesday: sr.wednesday ? JSON.parse(sr.wednesday) : [],
|
|
|
- thursday: sr.thursday ? JSON.parse(sr.thursday) : [],
|
|
|
- friday: sr.friday ? JSON.parse(sr.friday) : [],
|
|
|
- saturday: sr.saturday ? JSON.parse(sr.saturday) : [],
|
|
|
- sunday: sr.sunday ? JSON.parse(sr.sunday) : []
|
|
|
- }
|
|
|
-
|
|
|
- const tempIds: any = []
|
|
|
- const tempPrices: any = []
|
|
|
- const subjectPrice = sr.subjectPrice || []
|
|
|
- subjectPrice.forEach((item: any) => {
|
|
|
- tempIds.push(item.subjectId)
|
|
|
- tempPrices.push({
|
|
|
+ if(Array.isArray(sr)) {
|
|
|
+ const tempSubjects: any = []
|
|
|
+ sr.forEach((item: any) => {
|
|
|
+ this.form.courseMinutes = item.courseMinutes
|
|
|
+ this.form.freeMinutes = item.freeMinutes
|
|
|
+ this.form.subjectId.push(item.subjectId)
|
|
|
+ tempSubjects.push({
|
|
|
subjectId: item.subjectId,
|
|
|
- subjectPrice: item.subjectPrice,
|
|
|
- subjectName: item.subjectName
|
|
|
+ subjectName: item.subjectName,
|
|
|
+ subjectPrice: item.subjectPrice
|
|
|
})
|
|
|
})
|
|
|
- const to = this.timerObject
|
|
|
- this.form = {
|
|
|
- enableFlag: sr.enableFlag,
|
|
|
- courseMinutes: sr.courseMinutes,
|
|
|
- freeMinutes: sr.freeMinutes,
|
|
|
- subjectIdTemp: tempIds.join(','),
|
|
|
- subjectId: tempIds,
|
|
|
- subjectPrice: tempPrices,
|
|
|
- skipHolidayFlag: sr.skipHolidayFlag,
|
|
|
- setting:
|
|
|
- to.monday.length > 0 ||
|
|
|
- to.tuesday.length > 0 ||
|
|
|
- to.wednesday.length > 0 ||
|
|
|
- to.thursday.length > 0 ||
|
|
|
- to.friday.length > 0 ||
|
|
|
- to.saturday.length > 0 ||
|
|
|
- to.sunday.length > 0
|
|
|
- ? '已设置'
|
|
|
- : ''
|
|
|
- }
|
|
|
+ this.form.subjectIdTemp = this.form.subjectId.join(',')
|
|
|
+ this.form.subjectPrice = tempSubjects
|
|
|
}
|
|
|
+
|
|
|
|
|
|
// 判断如果是审核的则不显示
|
|
|
const resVersion = await request.post('/api-teacher/open/appVersion', {
|
|
@@ -176,31 +135,9 @@ export default defineComponent({
|
|
|
},
|
|
|
methods: {
|
|
|
onSelect(item: any) {
|
|
|
- // 如果分钟数不同,则清空
|
|
|
- if (this.form.courseMinutes !== item.courseMinutes) {
|
|
|
- this.timerObject = {}
|
|
|
- this.form.setting = ''
|
|
|
- }
|
|
|
this.form.courseMinutes = item.courseMinutes
|
|
|
this.form.freeMinutes = item.freeMinutes
|
|
|
},
|
|
|
- async onTimer() {
|
|
|
- try {
|
|
|
- const form = this.form
|
|
|
- if (!form.courseMinutes) {
|
|
|
- Toast('请选择单课时时长')
|
|
|
- return
|
|
|
- }
|
|
|
- this.timeSetting.courseMinutes = Number(form.courseMinutes)
|
|
|
- this.timeSetting.freeMinutes = Number(form.freeMinutes)
|
|
|
- this.timerStatus = true
|
|
|
- } catch {}
|
|
|
- },
|
|
|
- onChoiceTimer(item: any, status: boolean) {
|
|
|
- this.form.setting = status ? '已设置' : ''
|
|
|
- this.timerObject = item
|
|
|
- this.timerStatus = false
|
|
|
- },
|
|
|
onChoice(item: any) {
|
|
|
console.log(item)
|
|
|
const tempItem = item || []
|
|
@@ -240,16 +177,26 @@ export default defineComponent({
|
|
|
async onSubmit() {
|
|
|
try {
|
|
|
const form = this.form
|
|
|
+ const params: any = []
|
|
|
form.subjectPrice.forEach((item: any) => {
|
|
|
- item.subjectName = this.getSubjectName(item.subjectId)
|
|
|
+ const subjectName = this.getSubjectName(item.subjectId)
|
|
|
+ console.log(subjectName, 'subjectName')
|
|
|
+ params.push({
|
|
|
+ ...item,
|
|
|
+ courseMinutes: this.form.courseMinutes,
|
|
|
+ courseType: this.courseType,
|
|
|
+ freeMinutes: this.form.freeMinutes,
|
|
|
+ subjectName
|
|
|
+
|
|
|
+ })
|
|
|
})
|
|
|
- await request.post('/api-teacher/teacherFreeTime/upSet', {
|
|
|
- data: {
|
|
|
- ...form,
|
|
|
- ...this.timerObject
|
|
|
- }
|
|
|
+ console.log(params,'foparamsrm')
|
|
|
+ await request.post('/api-teacher/teacherSubjectPrice/saveOrUpdate', {
|
|
|
+ data: params
|
|
|
})
|
|
|
- Toast('设置成功')
|
|
|
+ setTimeout(() => {
|
|
|
+ Toast('设置成功')
|
|
|
+ }, 100);
|
|
|
setTimeout(() => {
|
|
|
postMessage({ api: 'back', content: {} })
|
|
|
}, 500)
|
|
@@ -259,27 +206,8 @@ export default defineComponent({
|
|
|
render() {
|
|
|
return (
|
|
|
<Form style={{ paddingTop: '15px' }} onSubmit={this.onSubmit}>
|
|
|
- <ColHeader />
|
|
|
+ <ColHeader title={`${this.text}设置`} />
|
|
|
<ColFieldGroup>
|
|
|
- <ColField title="是否开启陪练课" required border={false}>
|
|
|
- <RadioGroup
|
|
|
- class={styles['radio-group']}
|
|
|
- modelValue={this.form.enableFlag}
|
|
|
- onUpdate:modelValue={val => (this.form.enableFlag = val)}
|
|
|
- >
|
|
|
- {['1', '0'].map((item: string) => {
|
|
|
- const isActive = Number(item) === Number(this.form.enableFlag)
|
|
|
- const type = isActive ? 'primary' : 'default'
|
|
|
- return (
|
|
|
- <Radio class={styles.radio} name={item}>
|
|
|
- <Tag size="large" plain={isActive} type={type}>
|
|
|
- {this.chargeTypeArr[item]}
|
|
|
- </Tag>
|
|
|
- </Radio>
|
|
|
- )
|
|
|
- })}
|
|
|
- </RadioGroup>
|
|
|
- </ColField>
|
|
|
<ColField title="可教授乐器" required>
|
|
|
{this.form.subjectPrice && this.form.subjectPrice.length > 0 && (
|
|
|
<CheckboxGroup
|
|
@@ -371,7 +299,7 @@ export default defineComponent({
|
|
|
<ColFieldGroup>
|
|
|
{this.form.subjectPrice.map((item: any) => (
|
|
|
<ColField
|
|
|
- title={`${this.getSubjectName(item.subjectId)}声部陪练价格`}
|
|
|
+ title={`${this.getSubjectName(item.subjectId)}声部${this.text}价格`}
|
|
|
required
|
|
|
>
|
|
|
<Field
|
|
@@ -383,12 +311,12 @@ export default defineComponent({
|
|
|
rules={[
|
|
|
{
|
|
|
required: true,
|
|
|
- message: `请选择声部陪练价格`
|
|
|
+ message: `请选择声部${this.text}价格`
|
|
|
}
|
|
|
]}
|
|
|
formatter={this.onFormatter}
|
|
|
maxlength={8}
|
|
|
- placeholder={`请选择声部陪练价格`}
|
|
|
+ placeholder={`请选择声部${this.text}价格`}
|
|
|
v-slots={{
|
|
|
button: () => <span>元</span>
|
|
|
}}
|
|
@@ -398,49 +326,13 @@ export default defineComponent({
|
|
|
</ColFieldGroup>
|
|
|
)}
|
|
|
|
|
|
- <ColFieldGroup>
|
|
|
- <ColField title="可陪练时间段">
|
|
|
- <Field
|
|
|
- modelValue={this.form.setting}
|
|
|
- name="singleMins"
|
|
|
- readonly
|
|
|
- isLink
|
|
|
- onClick={this.onTimer}
|
|
|
- placeholder="未设置"
|
|
|
- />
|
|
|
- </ColField>
|
|
|
- </ColFieldGroup>
|
|
|
-
|
|
|
- <ColFieldGroup>
|
|
|
- <ColField required title="是否跳过节假日" border={false}>
|
|
|
- <RadioGroup
|
|
|
- class={styles['radio-group']}
|
|
|
- modelValue={this.form.skipHolidayFlag}
|
|
|
- onUpdate:modelValue={val => (this.form.skipHolidayFlag = val)}
|
|
|
- >
|
|
|
- {['1', '0'].map((item: string) => {
|
|
|
- const isActive =
|
|
|
- Number(item) === Number(this.form.skipHolidayFlag)
|
|
|
- const type = isActive ? 'primary' : 'default'
|
|
|
- return (
|
|
|
- <Radio class={styles.radio} name={item}>
|
|
|
- <Tag size="large" plain={isActive} type={type}>
|
|
|
- {this.chargeTypeArr[item]}
|
|
|
- </Tag>
|
|
|
- </Radio>
|
|
|
- )
|
|
|
- })}
|
|
|
- </RadioGroup>
|
|
|
- </ColField>
|
|
|
- </ColFieldGroup>
|
|
|
-
|
|
|
- <Sticky offsetBottom={0} position="bottom">
|
|
|
- <div class={'btnGroup'}>
|
|
|
+ <TheSticky position="bottom">
|
|
|
+ <div class={['btnGroup', styles.PracticeSettingBtns]}>
|
|
|
<Button block round type="primary" native-type="submit">
|
|
|
提交
|
|
|
</Button>
|
|
|
</div>
|
|
|
- </Sticky>
|
|
|
+ </TheSticky>
|
|
|
|
|
|
<ColPopup v-model={this.subjectStatus} destroy>
|
|
|
<ColHeader />
|
|
@@ -453,17 +345,7 @@ export default defineComponent({
|
|
|
/>
|
|
|
</ColPopup>
|
|
|
|
|
|
- <ColPopup v-model={this.timerStatus} destroy>
|
|
|
- <ColHeader title="设置陪练时间段" />
|
|
|
- <Timer
|
|
|
- onChoice={this.onChoiceTimer}
|
|
|
- timerObject={this.timerObject}
|
|
|
- courseMinutes={Number(this.timeSetting.courseMinutes)}
|
|
|
- freeMinutes={Number(this.timeSetting.freeMinutes)}
|
|
|
- startSetting={this.timeSetting.startSetting}
|
|
|
- endSetting={this.timeSetting.endSetting}
|
|
|
- />
|
|
|
- </ColPopup>
|
|
|
+
|
|
|
|
|
|
<ActionSheet
|
|
|
v-model:show={this.classTimeStatus}
|