15 changed files with 696 additions and 566 deletions
@ -1,319 +1,290 @@ |
|||
<template> |
|||
<el-dialog |
|||
v-model="showDialog" |
|||
:title="formData.id ? t('updateCourse') : t('addCourse')" |
|||
width="50%" |
|||
class="diy-dialog-wrap" |
|||
:destroy-on-close="true" |
|||
> |
|||
<el-form |
|||
:model="formData" |
|||
label-width="120px" |
|||
ref="formRef" |
|||
:rules="formRules" |
|||
class="page-form" |
|||
v-loading="loading" |
|||
> |
|||
<el-form-item :label="t('courseName')" prop="course_name"> |
|||
<el-input |
|||
v-model="formData.course_name" |
|||
clearable |
|||
:placeholder="t('courseNamePlaceholder')" |
|||
class="input-width" |
|||
/> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="t('courseType')" prop="course_type"> |
|||
<el-select |
|||
class="input-width" |
|||
v-model="formData.course_type" |
|||
:placeholder="t('courseTypePlaceholder')" |
|||
> |
|||
<el-option |
|||
v-for="(item, index) in courseTypeList" |
|||
:key="index" |
|||
:label="item.name" |
|||
:value="item.name" |
|||
/> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item :label="t('duration')" prop="duration"> |
|||
<el-input |
|||
v-model="formData.duration" |
|||
clearable |
|||
:placeholder="t('durationPlaceholder')" |
|||
class="input-width" |
|||
/> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="t('sessionCount')" prop="session_count"> |
|||
<el-input |
|||
v-model="formData.session_count" |
|||
clearable |
|||
:placeholder="t('sessionCountPlaceholder')" |
|||
class="input-width" |
|||
/> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="t('giftSessionCount')" prop="gift_session_count"> |
|||
<el-input |
|||
v-model="formData.gift_session_count" |
|||
clearable |
|||
:placeholder="t('giftSessionCountPlaceholder')" |
|||
class="input-width" |
|||
/> |
|||
</el-form-item> |
|||
|
|||
<el-form-item |
|||
:label="t('singleSessionCount')" |
|||
prop="single_session_count" |
|||
> |
|||
<el-input |
|||
v-model="formData.single_session_count" |
|||
clearable |
|||
:placeholder="t('singleSessionCountPlaceholder')" |
|||
class="input-width" |
|||
/> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="t('price')" prop="price"> |
|||
<el-input |
|||
v-model="formData.price" |
|||
clearable |
|||
:placeholder="t('pricePlaceholder')" |
|||
class="input-width" |
|||
/> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="t('internalReminder')" prop="internal_reminder"> |
|||
<el-input |
|||
v-model="formData.internal_reminder" |
|||
clearable |
|||
:placeholder="t('internalReminderPlaceholder')" |
|||
class="input-width" |
|||
/> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="t('customerReminder')" prop="customer_reminder"> |
|||
<el-input |
|||
v-model="formData.customer_reminder" |
|||
clearable |
|||
:placeholder="t('customerReminderPlaceholder')" |
|||
class="input-width" |
|||
/> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="t('remarks')"> |
|||
<el-input |
|||
v-model="formData.remarks" |
|||
clearable |
|||
:placeholder="t('remarksPlaceholder')" |
|||
class="input-width" |
|||
/> |
|||
</el-form-item> |
|||
</el-form> |
|||
|
|||
<template #footer> |
|||
<span class="dialog-footer"> |
|||
<el-button @click="showDialog = false">{{ t('cancel') }}</el-button> |
|||
<el-button |
|||
type="primary" |
|||
:loading="loading" |
|||
@click="confirm(formRef)" |
|||
>{{ t('confirm') }}</el-button |
|||
> |
|||
</span> |
|||
</template> |
|||
</el-dialog> |
|||
<el-dialog v-model="showDialog" :title="formData.id ? t('updateCourse') : t('addCourse')" width="50%" |
|||
class="diy-dialog-wrap" :destroy-on-close="true"> |
|||
<el-form :model="formData" label-width="120px" ref="formRef" :rules="formRules" class="page-form" |
|||
v-loading="loading"> |
|||
<el-form-item :label="t('courseName')" prop="course_name"> |
|||
<el-input v-model="formData.course_name" clearable :placeholder="t('courseNamePlaceholder')" |
|||
class="input-width" /> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="t('courseType')" prop="course_type"> |
|||
<el-select class="input-width" v-model="formData.course_type" :placeholder="t('courseTypePlaceholder')"> |
|||
<el-option v-for="(item, index) in courseTypeList" :key="index" :label="item.name" |
|||
:value="item.name" /> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item :label="t('duration')" prop="duration"> |
|||
<el-input v-model="formData.duration" clearable :placeholder="t('durationPlaceholder')" |
|||
class="input-width"> |
|||
<template #suffix> |
|||
<span>天</span> |
|||
</template> |
|||
</el-input> |
|||
</el-form-item> |
|||
|
|||
|
|||
<el-form-item :label="t('sessionCount')" prop="session_count"> |
|||
<el-input v-model="formData.session_count" clearable :placeholder="t('sessionCountPlaceholder')" |
|||
class="input-width" > |
|||
|
|||
<template #suffix> |
|||
<span>节</span> |
|||
</template> |
|||
</el-input> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="t('giftSessionCount')" prop="gift_session_count"> |
|||
<el-input v-model="formData.gift_session_count" clearable |
|||
:placeholder="t('giftSessionCountPlaceholder')" class="input-width" > |
|||
|
|||
<template #suffix> |
|||
<span>节</span> |
|||
</template> |
|||
</el-input> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="t('singleSessionCount')" prop="single_session_count"> |
|||
<el-input v-model="formData.single_session_count" clearable |
|||
:placeholder="t('singleSessionCountPlaceholder')" class="input-width" > |
|||
|
|||
<template #suffix> |
|||
<span>节</span> |
|||
</template> |
|||
</el-input> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="t('price')" prop="price"> |
|||
<el-input v-model="formData.price" clearable :placeholder="t('pricePlaceholder')" class="input-width" > |
|||
|
|||
<template #suffix> |
|||
<span>元</span> |
|||
</template> |
|||
</el-input> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="t('internalReminder')" prop="internal_reminder"> |
|||
<el-input v-model="formData.internal_reminder" clearable :placeholder="t('internalReminderPlaceholder')" |
|||
class="input-width" > |
|||
|
|||
<template #suffix> |
|||
<span>节</span> |
|||
</template> |
|||
</el-input> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="t('customerReminder')" prop="customer_reminder"> |
|||
<el-input v-model="formData.customer_reminder" clearable :placeholder="t('customerReminderPlaceholder')" |
|||
class="input-width" > |
|||
|
|||
<template #suffix> |
|||
<span>节</span> |
|||
</template> |
|||
</el-input> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="t('remarks')"> |
|||
<el-input v-model="formData.remarks" clearable :placeholder="t('remarksPlaceholder')" |
|||
class="input-width" /> |
|||
</el-form-item> |
|||
</el-form> |
|||
|
|||
<template #footer> |
|||
<span class="dialog-footer"> |
|||
<el-button @click="showDialog = false">{{ t('cancel') }}</el-button> |
|||
<el-button type="primary" :loading="loading" @click="confirm(formRef)">{{ t('confirm') }}</el-button> |
|||
</span> |
|||
</template> |
|||
</el-dialog> |
|||
</template> |
|||
|
|||
<script lang="ts" setup> |
|||
import { ref, reactive, computed, watch } from 'vue' |
|||
import { useDictionary } from '@/app/api/dict' |
|||
import { t } from '@/lang' |
|||
import type { FormInstance } from 'element-plus' |
|||
import { addCourse, editCourse, getCourseInfo } from '@/app/api/course' |
|||
|
|||
let showDialog = ref(false) |
|||
const loading = ref(false) |
|||
|
|||
/** |
|||
* 表单数据 |
|||
*/ |
|||
const initialFormData = { |
|||
id: '', |
|||
course_name: '', |
|||
course_type: '', |
|||
duration: '', |
|||
session_count: '', |
|||
single_session_count: '', |
|||
price: '', |
|||
internal_reminder: '', |
|||
customer_reminder: '', |
|||
remarks: '', |
|||
gift_session_count: '0', |
|||
} |
|||
const formData: Record<string, any> = reactive({ ...initialFormData }) |
|||
|
|||
const formRef = ref<FormInstance>() |
|||
|
|||
// 表单验证规则 |
|||
const formRules = computed(() => { |
|||
return { |
|||
course_name: [ |
|||
{ required: true, message: t('courseNamePlaceholder'), trigger: 'blur' }, |
|||
], |
|||
course_type: [ |
|||
{ required: true, message: t('courseTypePlaceholder'), trigger: 'blur' }, |
|||
], |
|||
duration: [ |
|||
{ required: true, message: t('durationPlaceholder'), trigger: 'blur' }, |
|||
], |
|||
session_count: [ |
|||
{ |
|||
required: true, |
|||
message: t('sessionCountPlaceholder'), |
|||
trigger: 'blur', |
|||
}, |
|||
], |
|||
gift_session_count: [ |
|||
{ |
|||
required: false, |
|||
message: t('giftSessionCountPlaceholder'), |
|||
trigger: 'blur', |
|||
}, |
|||
], |
|||
single_session_count: [ |
|||
{ |
|||
required: true, |
|||
message: t('singleSessionCountPlaceholder'), |
|||
trigger: 'blur', |
|||
}, |
|||
], |
|||
price: [ |
|||
{ required: true, message: t('pricePlaceholder'), trigger: 'blur' }, |
|||
], |
|||
internal_reminder: [ |
|||
{ |
|||
required: true, |
|||
message: t('internalReminderPlaceholder'), |
|||
trigger: 'blur', |
|||
}, |
|||
], |
|||
customer_reminder: [ |
|||
{ |
|||
required: true, |
|||
message: t('customerReminderPlaceholder'), |
|||
trigger: 'blur', |
|||
}, |
|||
], |
|||
remarks: [ |
|||
{ required: true, message: t('remarksPlaceholder'), trigger: 'blur' }, |
|||
], |
|||
} |
|||
}) |
|||
|
|||
const emit = defineEmits(['complete']) |
|||
|
|||
const courseTypeList = ref([]) |
|||
const getcourseTypeList = async () => { |
|||
courseTypeList.value = await ( |
|||
await useDictionary('course_type') |
|||
).data.dictionary |
|||
} |
|||
getcourseTypeList() |
|||
/** |
|||
* 确认 |
|||
* @param formEl |
|||
*/ |
|||
const confirm = async (formEl: FormInstance | undefined) => { |
|||
if (loading.value || !formEl) return |
|||
let save = formData.id ? editCourse : addCourse |
|||
|
|||
await formEl.validate(async (valid) => { |
|||
if (valid) { |
|||
loading.value = true |
|||
|
|||
let data = formData |
|||
|
|||
save(data) |
|||
.then((res) => { |
|||
loading.value = false |
|||
showDialog.value = false |
|||
emit('complete') |
|||
}) |
|||
.catch((err) => { |
|||
loading.value = false |
|||
}) |
|||
} |
|||
}) |
|||
} |
|||
|
|||
// 获取字典数据 |
|||
|
|||
const setFormData = async (row: any = null) => { |
|||
Object.assign(formData, initialFormData) |
|||
loading.value = true |
|||
if (row) { |
|||
const data = await (await getCourseInfo(row.id)).data |
|||
if (data) |
|||
Object.keys(formData).forEach((key: string) => { |
|||
if (data[key] != undefined) formData[key] = data[key] |
|||
}) |
|||
} |
|||
loading.value = false |
|||
} |
|||
|
|||
// 验证手机号格式 |
|||
const mobileVerify = (rule: any, value: any, callback: any) => { |
|||
if (value && !/^1[3-9]\d{9}$/.test(value)) { |
|||
callback(new Error(t('generateMobile'))) |
|||
} else { |
|||
callback() |
|||
} |
|||
} |
|||
|
|||
// 验证身份证号 |
|||
const idCardVerify = (rule: any, value: any, callback: any) => { |
|||
if ( |
|||
value && |
|||
!/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/.test( |
|||
value |
|||
) |
|||
) { |
|||
callback(new Error(t('generateIdCard'))) |
|||
} else { |
|||
callback() |
|||
} |
|||
} |
|||
|
|||
// 验证邮箱号 |
|||
const emailVerify = (rule: any, value: any, callback: any) => { |
|||
if (value && !/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/.test(value)) { |
|||
callback(new Error(t('generateEmail'))) |
|||
} else { |
|||
callback() |
|||
} |
|||
} |
|||
|
|||
// 验证请输入整数 |
|||
const numberVerify = (rule: any, value: any, callback: any) => { |
|||
if (!Number.isInteger(value)) { |
|||
callback(new Error(t('generateNumber'))) |
|||
} else { |
|||
callback() |
|||
} |
|||
} |
|||
|
|||
defineExpose({ |
|||
showDialog, |
|||
setFormData, |
|||
}) |
|||
import { ref, reactive, computed, watch } from 'vue' |
|||
import { useDictionary } from '@/app/api/dict' |
|||
import { t } from '@/lang' |
|||
import type { FormInstance } from 'element-plus' |
|||
import { addCourse, editCourse, getCourseInfo } from '@/app/api/course' |
|||
|
|||
let showDialog = ref(false) |
|||
const loading = ref(false) |
|||
|
|||
/** |
|||
* 表单数据 |
|||
*/ |
|||
const initialFormData = { |
|||
id: '', |
|||
course_name: '', |
|||
course_type: '', |
|||
duration: '', |
|||
session_count: '', |
|||
single_session_count: '', |
|||
price: '', |
|||
internal_reminder: '', |
|||
customer_reminder: '', |
|||
remarks: '', |
|||
gift_session_count: '0', |
|||
} |
|||
const formData : Record<string, any> = reactive({ ...initialFormData }) |
|||
|
|||
const formRef = ref<FormInstance>() |
|||
|
|||
// 表单验证规则 |
|||
const formRules = computed(() => { |
|||
return { |
|||
course_name: [ |
|||
{ required: true, message: t('courseNamePlaceholder'), trigger: 'blur' }, |
|||
], |
|||
course_type: [ |
|||
{ required: true, message: t('courseTypePlaceholder'), trigger: 'blur' }, |
|||
], |
|||
duration: [ |
|||
{ required: true, message: t('durationPlaceholder'), trigger: 'blur' }, |
|||
], |
|||
session_count: [ |
|||
{ |
|||
required: true, |
|||
message: t('sessionCountPlaceholder'), |
|||
trigger: 'blur', |
|||
}, |
|||
], |
|||
gift_session_count: [ |
|||
{ |
|||
required: false, |
|||
message: t('giftSessionCountPlaceholder'), |
|||
trigger: 'blur', |
|||
}, |
|||
], |
|||
single_session_count: [ |
|||
{ |
|||
required: true, |
|||
message: t('singleSessionCountPlaceholder'), |
|||
trigger: 'blur', |
|||
}, |
|||
], |
|||
price: [ |
|||
{ required: true, message: t('pricePlaceholder'), trigger: 'blur' }, |
|||
], |
|||
internal_reminder: [ |
|||
{ |
|||
required: true, |
|||
message: t('internalReminderPlaceholder'), |
|||
trigger: 'blur', |
|||
}, |
|||
], |
|||
customer_reminder: [ |
|||
{ |
|||
required: true, |
|||
message: t('customerReminderPlaceholder'), |
|||
trigger: 'blur', |
|||
}, |
|||
], |
|||
remarks: [ |
|||
{ required: true, message: t('remarksPlaceholder'), trigger: 'blur' }, |
|||
], |
|||
} |
|||
}) |
|||
|
|||
const emit = defineEmits(['complete']) |
|||
|
|||
const courseTypeList = ref([]) |
|||
const getcourseTypeList = async () => { |
|||
courseTypeList.value = await ( |
|||
await useDictionary('course_type') |
|||
).data.dictionary |
|||
} |
|||
getcourseTypeList() |
|||
/** |
|||
* 确认 |
|||
* @param formEl |
|||
*/ |
|||
const confirm = async (formEl : FormInstance | undefined) => { |
|||
if (loading.value || !formEl) return |
|||
let save = formData.id ? editCourse : addCourse |
|||
|
|||
await formEl.validate(async (valid) => { |
|||
if (valid) { |
|||
loading.value = true |
|||
|
|||
let data = formData |
|||
|
|||
save(data) |
|||
.then((res) => { |
|||
loading.value = false |
|||
showDialog.value = false |
|||
emit('complete') |
|||
}) |
|||
.catch((err) => { |
|||
loading.value = false |
|||
}) |
|||
} |
|||
}) |
|||
} |
|||
|
|||
// 获取字典数据 |
|||
|
|||
const setFormData = async (row : any = null) => { |
|||
Object.assign(formData, initialFormData) |
|||
loading.value = true |
|||
if (row) { |
|||
const data = await (await getCourseInfo(row.id)).data |
|||
if (data) |
|||
Object.keys(formData).forEach((key : string) => { |
|||
if (data[key] != undefined) formData[key] = data[key] |
|||
}) |
|||
} |
|||
loading.value = false |
|||
} |
|||
|
|||
// 验证手机号格式 |
|||
const mobileVerify = (rule : any, value : any, callback : any) => { |
|||
if (value && !/^1[3-9]\d{9}$/.test(value)) { |
|||
callback(new Error(t('generateMobile'))) |
|||
} else { |
|||
callback() |
|||
} |
|||
} |
|||
|
|||
// 验证身份证号 |
|||
const idCardVerify = (rule : any, value : any, callback : any) => { |
|||
if ( |
|||
value && |
|||
!/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/.test( |
|||
value |
|||
) |
|||
) { |
|||
callback(new Error(t('generateIdCard'))) |
|||
} else { |
|||
callback() |
|||
} |
|||
} |
|||
|
|||
// 验证邮箱号 |
|||
const emailVerify = (rule : any, value : any, callback : any) => { |
|||
if (value && !/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/.test(value)) { |
|||
callback(new Error(t('generateEmail'))) |
|||
} else { |
|||
callback() |
|||
} |
|||
} |
|||
|
|||
// 验证请输入整数 |
|||
const numberVerify = (rule : any, value : any, callback : any) => { |
|||
if (!Number.isInteger(value)) { |
|||
callback(new Error(t('generateNumber'))) |
|||
} else { |
|||
callback() |
|||
} |
|||
} |
|||
|
|||
defineExpose({ |
|||
showDialog, |
|||
setFormData, |
|||
}) |
|||
</script> |
|||
|
|||
<style lang="scss" scoped></style> |
|||
<style lang="scss"> |
|||
.diy-dialog-wrap .el-form-item__label { |
|||
height: auto !important; |
|||
} |
|||
.diy-dialog-wrap .el-form-item__label { |
|||
height: auto !important; |
|||
} |
|||
</style> |
|||
@ -1,228 +1,275 @@ |
|||
<template> |
|||
<div class="main-container"> |
|||
<el-card class="box-card !border-none" shadow="never" v-loading="loading"> |
|||
<div class="flex justify-between items-center"> |
|||
<span class="text-lg">{{ pageName }}</span> |
|||
<el-button type="primary" @click="addStage"> 新增阶段 </el-button> |
|||
</div> |
|||
</el-card> |
|||
|
|||
<el-card class="box-card !border-none" shadow="never"> |
|||
<div |
|||
class="flex items-center justify-between p-[10px] table-item-border bg" |
|||
> |
|||
<span class="text-base w-[230px]">阶段名称</span> |
|||
<span class="text-base w-[110px] text-center">底薪</span> |
|||
</div> |
|||
|
|||
<el-collapse v-model="activeNames" accordion> |
|||
<el-collapse-item |
|||
v-for="(stage, index) in stages" |
|||
:key="stage.id" |
|||
:name="stage.id" |
|||
> |
|||
<template #title> |
|||
<div class="collapse-title"> |
|||
<span class="title-name">{{ stage.name }}</span> |
|||
<span class="arrow">{{ stage.price }} 元</span> |
|||
<!-- <span class="arrow">></span> --> |
|||
</div> |
|||
</template> |
|||
|
|||
<el-form label-width="100px" style="margin-bottom: 10px"> |
|||
<el-form-item label="阶段名称"> |
|||
<el-input v-model="stage.name" placeholder="请输入阶段名称" /> |
|||
</el-form-item> |
|||
</el-form> |
|||
|
|||
<el-form label-width="100px" style="margin-bottom: 10px"> |
|||
<el-form-item label="阶段底薪"> |
|||
<el-input v-model="stage.price" placeholder="请输入阶段底薪" /> |
|||
</el-form-item> |
|||
</el-form> |
|||
|
|||
<el-button type="success" size="small" @click="addRule(stage)" |
|||
>新增规则</el-button |
|||
> |
|||
|
|||
<el-table :data="stage.rules" border style="margin-top: 10px"> |
|||
<el-table-column prop="renewal_standard_min" label="续费上限"> |
|||
<template #default="{ row }"> |
|||
<el-input |
|||
v-model="row.renewal_standard_min" |
|||
placeholder="请输入续费上限" |
|||
/> |
|||
</template> |
|||
</el-table-column> |
|||
|
|||
<el-table-column prop="renewal_standard_max" label="续费下限"> |
|||
<template #default="{ row }"> |
|||
<el-input |
|||
v-model="row.renewal_standard_max" |
|||
placeholder="请输入续费下限" |
|||
/> |
|||
</template> |
|||
</el-table-column> |
|||
|
|||
<el-table-column prop="renewal_commission" label="续费提成"> |
|||
<template #default="{ row }"> |
|||
<el-input v-model="row.renewal_commission" placeholder="%" /> |
|||
</template> |
|||
</el-table-column> |
|||
|
|||
<el-table-column prop="new_count_min" label="新单成交数上限"> |
|||
<template #default="{ row }"> |
|||
<el-input v-model="row.new_count_min" /> |
|||
</template> |
|||
</el-table-column> |
|||
|
|||
<el-table-column prop="new_count_max" label="新单成交数下限"> |
|||
<template #default="{ row }"> |
|||
<el-input v-model="row.new_count_max" /> |
|||
</template> |
|||
</el-table-column> |
|||
|
|||
<el-table-column prop="new_move_5" label="新招(5+1)x3"> |
|||
<template #default="{ row }"> |
|||
<el-input v-model="row.new_move_5" /> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column prop="new_move_7" label="新招(7+1)x3"> |
|||
<template #default="{ row }"> |
|||
<el-input v-model="row.new_move_7" /> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="操作" width="100"> |
|||
<template #default="{ $index }"> |
|||
<el-button |
|||
type="danger" |
|||
size="small" |
|||
@click="removeRule(stage, $index)" |
|||
>删除</el-button |
|||
> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
|
|||
<el-button |
|||
type="danger" |
|||
size="small" |
|||
style="margin-top: 10px" |
|||
@click="removeStage(index)" |
|||
>删除该阶段</el-button |
|||
> |
|||
</el-collapse-item> |
|||
</el-collapse> |
|||
|
|||
<div style="text-align: right; margin-top: 20px"> |
|||
<el-button type="primary" @click="onSave">提交保存</el-button> |
|||
</div> |
|||
</el-card> |
|||
</div> |
|||
<div class="main-container"> |
|||
<el-card class="box-card !border-none" shadow="never" v-loading="loading"> |
|||
<div class="flex justify-between items-center"> |
|||
<span class="text-lg">{{ pageName }}</span> |
|||
<el-button type="primary" @click="addStage"> 新增阶段 </el-button> |
|||
</div> |
|||
</el-card> |
|||
|
|||
<el-card class="box-card !border-none" shadow="never"> |
|||
<div class="flex items-center justify-between p-[10px] table-item-border bg"> |
|||
<span class="text-base w-[230px]">阶段名称</span> |
|||
<span class="text-base w-[110px] text-center">底薪</span> |
|||
</div> |
|||
|
|||
<el-collapse v-model="activeNames" accordion> |
|||
<el-collapse-item v-for="(stage, index) in stages" :key="stage.id" :name="stage.id"> |
|||
<template #title> |
|||
<div class="collapse-title"> |
|||
<span class="title-name">{{ stage.name }}</span> |
|||
<span class="arrow">{{ stage.price }} 元</span> |
|||
<!-- <span class="arrow">></span> --> |
|||
</div> |
|||
</template> |
|||
|
|||
<el-form label-width="100px" style="margin-bottom: 10px"> |
|||
<el-form-item label="阶段名称"> |
|||
<el-input v-model="stage.name" placeholder="请输入阶段名称" /> |
|||
</el-form-item> |
|||
</el-form> |
|||
|
|||
<el-form label-width="100px" style="margin-bottom: 10px"> |
|||
<el-form-item label="阶段底薪"> |
|||
<el-input v-model="stage.price" placeholder="请输入阶段底薪" /> |
|||
</el-form-item> |
|||
</el-form> |
|||
|
|||
<el-button type="success" size="small" @click="addRule(stage)">新增规则</el-button> |
|||
|
|||
<el-table :data="stage.rules" border style="margin-top: 10px"> |
|||
<el-table-column prop="renewal_standard_min" label="续费上限"> |
|||
<template #default="{ row }"> |
|||
<el-input v-model="row.renewal_standard_min" placeholder="请输入续费上限" /> |
|||
</template> |
|||
</el-table-column> |
|||
|
|||
<el-table-column prop="renewal_standard_max" label="续费下限"> |
|||
<template #default="{ row }"> |
|||
<el-input v-model="row.renewal_standard_max" placeholder="请输入续费下限" /> |
|||
</template> |
|||
</el-table-column> |
|||
|
|||
<el-table-column prop="renewal_commission" label="续费提成"> |
|||
<template #default="{ row }"> |
|||
<el-input v-model="row.renewal_commission" placeholder="%" /> |
|||
</template> |
|||
</el-table-column> |
|||
|
|||
<el-table-column prop="new_count_min" label="新单成交数上限"> |
|||
<template #default="{ row }"> |
|||
<el-input v-model="row.new_count_min" /> |
|||
</template> |
|||
</el-table-column> |
|||
|
|||
<el-table-column prop="new_count_max" label="新单成交数下限"> |
|||
<template #default="{ row }"> |
|||
<el-input v-model="row.new_count_max" /> |
|||
</template> |
|||
</el-table-column> |
|||
|
|||
|
|||
<el-table-column prop="xf_count_min" label="续费成交数上限"> |
|||
<template #default="{ row }"> |
|||
<el-input v-model="row.xf_count_min" /> |
|||
</template> |
|||
</el-table-column> |
|||
|
|||
<el-table-column prop="xf_count_max" label="续费成交数下限"> |
|||
<template #default="{ row }"> |
|||
<el-input v-model="row.xf_count_max" /> |
|||
</template> |
|||
</el-table-column> |
|||
|
|||
<el-table-column prop="new_move_5" label="新招(5+1)x3"> |
|||
<template #default="{ row }"> |
|||
<el-input v-model="row.new_move_5" /> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column prop="new_move_7" label="新招(7+1)x3"> |
|||
<template #default="{ row }"> |
|||
<el-input v-model="row.new_move_7" /> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="操作" width="100"> |
|||
<template #default="{ $index }"> |
|||
<el-button type="danger" size="small" @click="removeRule(stage, $index)">删除</el-button> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
|
|||
<el-button type="danger" size="small" style="margin-top: 10px" |
|||
@click="removeStage(index)">删除该阶段</el-button> |
|||
</el-collapse-item> |
|||
</el-collapse> |
|||
|
|||
|
|||
<el-form label-position="left" label-width="100px" class="config-form" style="margin-top: 70px;"> |
|||
|
|||
|
|||
<h3>其他绩效配置</h3> |
|||
<el-row :gutter="20"> |
|||
<el-col :span="6"> |
|||
<el-form-item label="一访成交"> |
|||
<el-input v-model="form.qt_firstVisit" placeholder="%" suffix-icon="el-icon-percent" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
|
|||
<el-col :span="6"> |
|||
<el-form-item label="二访成交"> |
|||
<el-input v-model="form.qt_secondVisit" placeholder="%" suffix-icon="el-icon-percent" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
|
|||
<el-col :span="6"> |
|||
<el-form-item label="追单"> |
|||
<el-input v-model="form.qt_followUp" placeholder="%" suffix-icon="el-icon-percent" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
|
|||
<el-col :span="6"> |
|||
<el-form-item label="内部员工"> |
|||
<el-input v-model="form.qt_internalStaff" placeholder="元" suffix-icon="el-icon-money" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
|
|||
|
|||
<view v-for="(item, index) in course_type"> |
|||
<el-form-item :label="item.name" > |
|||
<el-input v-model="item.num" placeholder="元" style="width: 200px;"/> |
|||
</el-form-item> |
|||
</view> |
|||
|
|||
</el-form> |
|||
<div style="text-align: right; margin-top: 20px"> |
|||
<el-button type="primary" @click="onSave">提交保存</el-button> |
|||
</div> |
|||
</el-card> |
|||
</div> |
|||
</template> |
|||
|
|||
<script lang="ts" setup> |
|||
import { xsyjConfig, getXsyjConfig } from '@/app/api/sys' |
|||
import { reactive, ref } from 'vue' |
|||
import { ElMessage } from 'element-plus' |
|||
import { useRoute } from 'vue-router' |
|||
const route = useRoute() |
|||
const pageName = route.meta.title |
|||
|
|||
const loading = ref(true) |
|||
const stages = ref([]) |
|||
const activeNames = ref(null) |
|||
|
|||
function addStage() { |
|||
const newStage = { |
|||
name: '默认阶段', |
|||
price: 0, |
|||
rules: [ |
|||
{ |
|||
renewal_standard_min: '', |
|||
renewal_standard_max: '', |
|||
renewal_commission: '', |
|||
new_count_min: '', |
|||
new_count_max: '', |
|||
new_move_5: '', |
|||
new_move_7: '', |
|||
}, |
|||
], |
|||
} |
|||
stages.value.push(newStage) |
|||
activeNames.value = newStage.name |
|||
} |
|||
|
|||
function removeStage(index) { |
|||
stages.value.splice(index, 1) |
|||
} |
|||
|
|||
function addRule(stage) { |
|||
stage.rules.push({ |
|||
renewal_standard_min: '', |
|||
renewal_standard_max: '', |
|||
renewal_commission: '', |
|||
new_count_min: '', |
|||
new_count_max: '', |
|||
new_move_5: '', |
|||
new_move_7: '', |
|||
}) |
|||
} |
|||
|
|||
function removeRule(stage, ruleIndex) { |
|||
if (stage.rules.length === 1) { |
|||
ElMessage.warning('至少保留一条规则') |
|||
return |
|||
} |
|||
stage.rules.splice(ruleIndex, 1) |
|||
} |
|||
|
|||
const setFormData = async () => { |
|||
const data = await (await getXsyjConfig()).data |
|||
stages.value = data |
|||
loading.value = false |
|||
} |
|||
|
|||
setFormData() |
|||
|
|||
const onSave = async () => { |
|||
xsyjConfig(stages.value) |
|||
.then(() => { |
|||
loading.value = true |
|||
setFormData() |
|||
}) |
|||
.catch(() => { |
|||
loading.value = false |
|||
}) |
|||
} |
|||
import { xsyjConfig, getXsyjConfig } from '@/app/api/sys' |
|||
import { reactive, ref } from 'vue' |
|||
import { ElMessage } from 'element-plus' |
|||
import { useRoute } from 'vue-router' |
|||
const route = useRoute() |
|||
const pageName = route.meta.title |
|||
|
|||
const loading = ref(true) |
|||
const stages = ref([]) |
|||
const activeNames = ref(null) |
|||
|
|||
|
|||
const form = ref({ |
|||
qt_firstVisit: '', |
|||
qt_secondVisit: '', |
|||
qt_followUp: '', |
|||
qt_internalStaff: '', |
|||
}); |
|||
|
|||
const course_type = ref({}); |
|||
|
|||
|
|||
|
|||
|
|||
function addStage() { |
|||
const newStage = { |
|||
name: '默认阶段', |
|||
price: 0, |
|||
rules: [ |
|||
{ |
|||
renewal_standard_min: '', |
|||
renewal_standard_max: '', |
|||
renewal_commission: '', |
|||
new_count_min: '', |
|||
new_count_max: '', |
|||
xf_count_min: '', |
|||
xf_count_max: '', |
|||
new_move_5: '', |
|||
new_move_7: '', |
|||
}, |
|||
], |
|||
} |
|||
stages.value.push(newStage) |
|||
activeNames.value = newStage.name |
|||
} |
|||
|
|||
function removeStage(index) { |
|||
stages.value.splice(index, 1) |
|||
} |
|||
|
|||
function addRule(stage) { |
|||
stage.rules.push({ |
|||
renewal_standard_min: '', |
|||
renewal_standard_max: '', |
|||
renewal_commission: '', |
|||
new_count_min: '', |
|||
new_count_max: '', |
|||
xf_count_min: '', |
|||
xf_count_max: '', |
|||
new_move_5: '', |
|||
new_move_7: '', |
|||
}) |
|||
} |
|||
|
|||
function removeRule(stage, ruleIndex) { |
|||
if (stage.rules.length === 1) { |
|||
ElMessage.warning('至少保留一条规则') |
|||
return |
|||
} |
|||
stage.rules.splice(ruleIndex, 1) |
|||
} |
|||
|
|||
const setFormData = async () => { |
|||
const data = await (await getXsyjConfig()).data |
|||
stages.value = data.data |
|||
form.value = data.form |
|||
course_type.value = data.course_type |
|||
loading.value = false |
|||
} |
|||
|
|||
setFormData() |
|||
|
|||
const onSave = async () => { |
|||
xsyjConfig({ 'stages': stages.value, 'form': form.value,'course_type':course_type.value}) |
|||
.then(() => { |
|||
loading.value = true |
|||
setFormData() |
|||
}) |
|||
.catch(() => { |
|||
loading.value = false |
|||
}) |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
.collapse-title { |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: space-between; |
|||
width: 100%; |
|||
font-size: 14px; |
|||
font-weight: 500; |
|||
padding-right: 10px; |
|||
color: #333; |
|||
padding: 10px; |
|||
} |
|||
|
|||
.title-name { |
|||
width: 230px; |
|||
} |
|||
|
|||
.title-salary { |
|||
width: 110px; |
|||
text-align: center; |
|||
color: #7438d5; |
|||
} |
|||
|
|||
.arrow { |
|||
margin-left: auto; |
|||
color: #999; |
|||
font-size: 14px; |
|||
} |
|||
.collapse-title { |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: space-between; |
|||
width: 100%; |
|||
font-size: 14px; |
|||
font-weight: 500; |
|||
padding-right: 10px; |
|||
color: #333; |
|||
padding: 10px; |
|||
} |
|||
|
|||
.title-name { |
|||
width: 230px; |
|||
} |
|||
|
|||
.title-salary { |
|||
width: 110px; |
|||
text-align: center; |
|||
color: #7438d5; |
|||
} |
|||
|
|||
.arrow { |
|||
margin-left: auto; |
|||
color: #999; |
|||
font-size: 14px; |
|||
} |
|||
</style> |
|||
Loading…
Reference in new issue