zhuguifei
2025-04-28 442928123f63ee497d766f9a7a14f0a6ee067e25
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
<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>