explainDialog.vue 6.01 KB
<template>
  <d2-dialog :title="title" mode="mid" v-if="isVisible" :is-visible.sync="isVisible" width="750px" no-cancel btn-ok-label="关闭" :before-close="handleClose" @confirmDialog="handleConfirm" @closeDialog="handleClose">
    <div class="explain-title">示例规则定义</div>
    <div v-if="diffExplain == 'performanceConfig'">
      <div class="mb10">提成配置中,高产值,成交率以及均客单为联动配置,需请完整填写,无提成时填无,请将此三项全部填无。根据员工每月单店完成(升级订单) 的订单产值累计,匹配符合的奖励规则进行每单奖励计算。</div>
      <div v-for="(item, index) in commissionConfigArr" :key="index">
        <div>{{ item.title }}</div>
        <d2-table :table-data="item.tableData" :table-params="item.tableParams" :has-page="false"></d2-table>
      </div>
    </div>
    <d2-table v-else :table-data="tableData" :table-params="tableParams" :has-page="false"></d2-table>
    <template>
      <div class="explain-title mt20">示例业务场景</div>
      <div class="business-info" v-html="infoHtml"></div>
    </template>
  </d2-dialog>
</template>

<script>
import { deepClone } from '@/common/util'
export default {
  data() {
    return {
      tableParams: {
        tableColumns: [
          {
            label: '区间开始值/元',
            prop: 'startValue'
          },
          {
            label: '区间结束值/元',
            prop: 'endValue'
          },
          {
            label: '提成比例',
            prop: 'calculateValue'
          }
        ]
      },
      tableData: [],
      commissionConfigArr: [{
        title: '高产值比例配置',
        name: 'outputBonus',
        tableData: [],
        tableParams: {}
      }, {
        title: '成交率系数配置',
        name: 'upgradeRateBonus',
        tableData: [],
        tableParams: {}
      }, {
        title: '均客单系数配置',
        name: 'averagePriceBonus',
        tableData: [],
        tableParams: {}
      }]
    }
  },
  props: {
    isExplain: {
      type: Boolean,
      default: false
    },
    diffExplain: {
      type: String,
      default: ''
    }
  },
  computed: {
    title() {
      const titleObj = {
        performanceConfig: '工资绩效示例说明',
        tutorBonusConfigs: '导师附加提成示例说明'
      }
      return titleObj[this.diffExplain]
    },
    infoHtml() {
      const infoObj = {
        performanceConfig: `<div class='mb10'>员工A在某个月中单店完成产值20000元,按高产值奖励规则,奖励值落点区间在0-80000,则提成比例为产值4%;根据该员工的当月成交率为45%,均可单价为2000计算,则整体提成系数为0.8*0.8=0.64</div>
        <div class='mb10'>汇总计算员工A在该月份获得的提成为=20000*5%*0.8*0.8=640元。</div>`,
        tutorBonusConfigs: `<div class='mb10'>1、员工a入职时间为8月18日,对应0-3个月内的导师提成比例为20%,假如第一个月内员工a产生订单产值40000元,根据业绩配置该员工提成为4000元,则其关联导师的导师提成激励为4000*20%=800元,计入次月导师的月份最终工资</div>
<div class='mb10'>2、员工a到11月18日为满三个月,12月份初计算导师提成时,按11.1-11.18的学员提成20%和11.19-11.30的学员提成10%计算为该导师的11月总导师激励提成</div>
<div class='mb10'>3、删除解绑学员时不影响订单提成规则,如8月18日关联导师,8月20日解绑学员时,导师在9月初将计算8.18-8.20该学员的订单提成比例,并入导师提成激励计算到9月初发放的最终工资中。</div>
<div class='mb10'>4、按导师学员的绑定关系计算,区间月份含当月,0即为第一个月份,0-3代表前三个月,4-6代表第四到第六个月整,以此类推</div>`
      }
      return infoObj[this.diffExplain]
    },
    isVisible() {
      return this.isExplain
    }
  },
  watch: {
    diffExplain(newVal) {
      if (newVal == 'performanceConfig') {
        this.commissionConfigArr.forEach(val => {
          val.tableParams = deepClone(this.tableParams)
          switch (val.name) {
            case 'outputBonus':
              val.tableData = [
                { startValue: 0, endValue: 80000, calculateValue: '4%' },
                { startValue: 80000.01, endValue: '--', calculateValue: '5%' }
              ]
              val.tableParams.tableColumns[2].label = '提成比例'
              break
            case 'upgradeRateBonus':
              val.tableData = [
                { startValue: 0, endValue: '50%', calculateValue: 0.8 },
                { startValue: '50.01%', endValue: '55%', calculateValue: 1.0 },
                { startValue: '55.01%', endValue: '100%', calculateValue: 1.1 }
              ]
              val.tableParams.tableColumns[2].label = '提成系数'
              break
            case 'averagePriceBonus':
              val.tableData = [
                { startValue: 0, endValue: 3000, calculateValue: 0.8 },
                { startValue: 3000.01, endValue: '--', calculateValue: 1.0 }
              ]
              val.tableParams.tableColumns[2].label = '提成系数'
              break
          }
        })
      } else { // 导师附加提成
        this.tableData = [
          { startValue: 0, endValue: 3, calculateValue: '20%' },
          { startValue: 4, endValue: 6, calculateValue: '10%' }
        ]
        this.tableParams.tableColumns[0].label = '区间开始值/月(含当月)'
        this.tableParams.tableColumns[1].label = '区间结束值/月'
        this.tableParams.tableColumns[2].label = '提成比例'
      }
    }
  },
  methods: {
    handleConfirm() {
      this.$emit('handleClose')
    },
    handleClose() {
      this.$emit('handleClose')
    }
  }
}
</script>

<style lang="scss">
.explain-title {
  font-weight: 600;
  font-size: 16px;
  color: #333333;
  margin-bottom: 10px;
}

.business-info {
  font-size: 14px;
  color: #333333;
  line-height: 18px;
}

.mb10 {
  margin-bottom: 10px;
}

.mt20 {
  margin-top: 20px;
}
</style>