<template>
|
<a-modal
|
:title="title"
|
:width="1200"
|
:visible="visible"
|
:confirmLoading="confirmLoading"
|
@ok="handleOk"
|
@cancel="handleCancel">
|
|
<a-spin :spinning="confirmLoading">
|
<a-form-model ref="form" :label-col="labelCol" :wrapper-col="wrapperCol" :model="model" :rules="validatorRules">
|
<!-- 主表单区域 -->
|
<a-row class="form-row" :gutter="16">
|
|
<a-col :lg="8">
|
<a-form-model-item label="发放进度" prop="progress">
|
<j-dict-select-tag @input="changeProgress" v-model="model.ffjd" placeholder="请选择发放进度"
|
dictCode="bonus_ffjd_kh" />
|
</a-form-model-item>
|
</a-col>
|
<a-col :lg="8">
|
<a-form-model-item label="提成系数" prop="tcxs">
|
<a-input addonAfter="%" disabled v-model="model.tcxs" placeholder="提成系数" />
|
</a-form-model-item>
|
</a-col>
|
<a-col :lg="8">
|
<a-form-model-item label="销售额" prop="xse">
|
<a-input-number @change="changexse" style="width: 200px" :min="1" v-model="model.xse"
|
placeholder="请输入销售额" />
|
</a-form-model-item>
|
</a-col>
|
|
|
<div style="margin-left: 40px;margin-top: 30px">
|
<p style="color: red">注:客户型项目奖金前两年发放提成比例的1倍,第三年发放提成比例的0.5倍,三年后不再发放(奖金提成金额 = 当期销售额 * 提成系数* 发放比例)</p>
|
<p>当期销售额100万以内部分,按照基准提成系数提成;<label style="color: #00A0E9">{{part1}}</label></p>
|
<p>当期销售额100万以上不足300万部分,按基准提成系数的80%提成;<label style="color: #00A0E9">{{part2}}</label></p>
|
<p>当期销售额300万以上不足500万部分,按基准提成系数的40%提成;<label style="color: #00A0E9">{{part3}}</label></p>
|
<p>当期销售额500万以上部分,按基准提成系数的20%提成。<label style="color: #00A0E9">{{part4}}</label></p>
|
</div>
|
<p style="margin-left: 40px;margin-top: 30px">提成额:<label style="color: red">{{model.sfje}}</label></p>
|
|
|
|
</a-row>
|
|
</a-form-model>
|
</a-spin>
|
|
<!-- 选择用户 -->
|
|
</a-modal>
|
</template>
|
|
<script>
|
import JSelectUserByDepModal from '@/components/jeecgbiz/modal/JSelectUserByDepModal'
|
import { httpAction, getAction, postAction, putAction } from '@/api/manage'
|
|
export default {
|
name: 'HsKhModal',
|
components: {
|
JSelectUserByDepModal
|
},
|
data() {
|
|
return {
|
title: '操作',
|
visible: false,
|
form: this.$form.createForm(this),
|
base: 0,
|
part1: 0,
|
part2: 0,
|
part3: 0,
|
part4: 0,
|
model: {},
|
labelCol: {
|
xs: { span: 24 },
|
sm: { span: 5 }
|
},
|
wrapperCol: {
|
xs: { span: 24 },
|
sm: { span: 16 }
|
},
|
confirmLoading: false,
|
validatorRules: {
|
type: [
|
{ required: true, message: '项目类型不能为空', trigger: 'blur' }
|
],
|
xse: [
|
{ required: true, message: '销售额不能为空', trigger: 'blur' }
|
],
|
tcxs: [
|
{ required: true, message: '提成系数不能为空', trigger: 'blur' }
|
],
|
ffjd: [
|
{ required: true, message: '请选择发放进度', trigger: 'blur' }
|
],
|
statu: [
|
{ required: true, message: '状态不能为空', trigger: 'blur' }
|
],
|
sfje: [
|
{ required: true, message: '奖金不能为空', trigger: 'blur' }
|
],
|
|
|
},
|
url: {
|
add: '/bon/item/addkh',
|
edit: '/bon/item/editkh',
|
}
|
}
|
},
|
created() {
|
},
|
watch: {},
|
methods: {
|
add() {
|
this.edit({})
|
},
|
edit(record) {
|
|
this.form.resetFields()
|
this.visible = true
|
this.model = Object.assign({}, record)
|
|
if (this.model.id) {
|
let progress = this.model.ffjd
|
if (progress> 0 && progress < 25) {
|
this.base = 1
|
} else if (progress > 24) this.base = 0.5
|
|
this.changexse(this.model.xse)
|
}
|
|
|
|
|
|
|
|
|
},
|
|
handleCancel() {
|
this.close()
|
},
|
handleOk() {
|
|
|
let that = this
|
this.$refs.form.validate(valid => {
|
if (valid) {
|
that.confirmLoading = true
|
//add
|
if (!this.model.id) {
|
postAction(this.url.add, that.model).then((res) => {
|
that.confirmLoading = false
|
if (res.success) {
|
that.close()
|
that.$message.success(res.message)
|
that.$emit('ok', res.result)
|
that.close()
|
} else {
|
that.$message.warning(res.message)
|
}
|
}).finally(() => {
|
that.confirmLoading = false
|
|
})
|
|
//edit
|
} else {
|
putAction(this.url.edit, that.model).then((res) => {
|
that.confirmLoading = false
|
if (res.success) {
|
that.close()
|
that.$message.success(res.message)
|
that.$emit('ok', res.result)
|
that.close()
|
} else {
|
that.$message.warning(res.message)
|
}
|
}).finally(() => {
|
that.confirmLoading = false
|
|
})
|
|
}
|
|
}
|
|
})
|
|
},
|
close() {
|
this.$emit('close')
|
this.visible = false
|
},
|
changexse(e) {
|
if (typeof e != 'number') {
|
return false
|
}
|
if (this.base == 0) {
|
this.$message.warning('请先选择发放进度')
|
return false
|
}
|
this.part1 = 0
|
this.part2 = 0
|
this.part3 = 0
|
this.part4 = 0
|
this.model.sfje = 0
|
const five = 5000000
|
const three = 3000000
|
const two = 2000000
|
const one = 1000000
|
if (e >= five) {
|
this.part1 = one * this.model.tcxs * this.base / 100
|
this.part1 = this.part1.toFixed(2)
|
this.part2 = two * this.model.tcxs * this.base * 0.8 / 100
|
this.part2 = this.part2.toFixed(2)
|
this.part3 = two * this.model.tcxs * this.base * 0.4 / 100
|
this.part3 = this.part3.toFixed(2)
|
this.part4 = (e - five) * this.model.tcxs * this.base * 0.2 / 100
|
this.part4 = this.part4.toFixed(2)
|
}else if(e >= three && e < five){
|
this.part1 = one * this.model.tcxs * this.base / 100
|
this.part1 = this.part1.toFixed(2)
|
this.part2 = two * this.model.tcxs * this.base * 0.8 / 100
|
this.part2 = this.part2.toFixed(2)
|
this.part3 = (e - three) * this.model.tcxs * this.base * 0.4 / 100
|
this.part3 = this.part3.toFixed(2)
|
}else if(e >= one && e < three){
|
this.part1 = one * this.model.tcxs * this.base / 100
|
this.part1 = this.part1.toFixed(2)
|
this.part2 = (e - one) * this.model.tcxs * this.base * 0.8 / 100
|
this.part2 = this.part2.toFixed(2)
|
}else {
|
this.part1 = e * this.model.tcxs * this.base / 100
|
this.part1 = this.part1.toFixed(2)
|
}
|
|
this.model.sfje = Number(this.part1) + Number(this.part2) + Number(this.part3) + Number(this.part4)
|
this.model.sfje = Number(this.model.sfje.toFixed(2))
|
|
},
|
changeProgress(e) {
|
//第一二年发放系数为1 第三年发放系数为0.5
|
if (e > 0 && e < 25) {
|
this.base = 1
|
} else if (e > 24) this.base = 0.5
|
//当计算后再修改发放进度时(修改系数) 需要重新计算
|
if(this.model.xse> 0){
|
this.changexse(this.model.xse)
|
}
|
|
},
|
handleChangeUserCommon(v) {
|
|
}
|
|
}
|
}
|
</script>
|
|
<style scoped>
|
|
</style>
|