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