depositDetailDialog.vue 6.11 KB
<!-- 激励池明细 -->
<template>
  <baseDialog :dialog-config="dialogConfig" :is-show.sync="visible"
    @handleClick="handleAddConfirm">
    <div class="dialog-content">
      <div class="header">
        <div class="header-right">
          <span>{{ detailInfo.commissionMonthStr }}月提成构成:</span>
          <span class="cycle">{{ detailRow.cycle }}</span>
        </div>
      </div>
      <div class="content">
        <div class="content-item">
          <div class="content-item-header">
            <span>{{ detailInfo.merchantName }}</span>
            <span>{{ detailInfo.merchantId }}</span>
          </div>
          <div class="content-item-body" v-if="detailInfo.commissionRecord">
            <div class="left-line">
              <div class="line" :style="{'top': (48 * (idx + 1) + 63) + 'px'}" v-for="(v, idx) in detailInfo.commissionRecord.allocationDetailList" :key="idx"></div>
            </div>
            <div class="content-item-body-title">
              <span>{{ detailInfo.staffName }} | </span> 
              <span>{{ detailInfo.sceneType == 1 ? '轻改' : detailInfo.sceneType == 2 ? '会员权益/升级' : '-'}} | </span>
              <span>产值贡献{{ detailInfo.totalPrice }}元 | </span>
              <span>{{ detailInfo.jobTypeStr }} | </span>
              <span>周期渗透率{{ !isEmpty(detailInfo.commissionRecord.penetrationRate) ? `${detailInfo.commissionRecord.penetrationRate}%` : '-' }} | </span>
              <span>提成系数{{ !isEmpty(detailInfo.commissionRecord.calculateValue) ? `${detailInfo.commissionRecord.calculateValue}%` : '-' }} | </span>
            </div>
            <d2-table :hasPage="false"
                :tableData="detailInfo.commissionRecord.allocationDetailList"
                :table-params="tableParams">
            </d2-table>
          </div>
          <div class="content-item-footer">
            <span>激励池实存:</span>
            <span class="amount">{{ detailInfo.actualJlcPrice }}元</span>
          </div>
        </div>
      </div>
    </div>
  </baseDialog>
</template>

<script>
import { getIncentivePoolDetailApi } from '@api/resident'
import { Util } from '@/common/util'
import { staffLevelList } from '@/common/constants'
import { filterStr } from '../../inStoreManage/util.js'
export default {
  name: 'DepositDetailDialog',
  data() {
    return {
      dialogConfig: {
        title: '激励池明细',
        width: '1080px'
      },
      detailInfo: {
        
      },
      tableParams: {
        btnId: new Date().getTime() + parseInt(Math.random() * 1000),
        listName: "list",
        tableColumns: [
          {
            label: '分配实体',
            prop: 'allocationType',
            formatter: (row) => {
              return ['个人', '导师', '督导', '激励池'][row.allocationType - 1] || '-'
            }
          },
          {
            label: '分配人',
            prop: 'staffName'
          },
          {
            label: '比例',
            prop: 'commissionRatio',
            width: 80,
            formatter: (row) => {
              return row.commissionRatio ? `${row.commissionRatio}%` : '-'
            }
          },
          {
            label: '关联时间',
            prop: '',
            formatter: (row) => {
              return row.startTime && row.endTime ? Util.dateFormate(row.startTime, 'MM月DD日') + '至' + Util.dateFormate(row.endTime, 'MM月DD日') : '-'
            }
          },
          {
            label: '应分金额',
            prop: 'commissionPrice',
            width: 100,
            formatter: (row) => {
              return row.commissionPrice ? `¥${row.commissionPrice}` : '-'
            }
          }
        ]
      }
    }
  },
  props: {
    depositDetailVisible: {
      type: Boolean,
      default: false
    },
    detailRow: {
      type: Object,
      default: () => ({})
    }
  },
  computed: {
    visible: {
      get() {
        return this.depositDetailVisible
      },
      set(newVal) {
        this.$emit('dialogClose', { flag: newVal, attrName: 'depositDetailVisible' })
      }
    }
  },
  mounted() {
    this.getIncentivePoolDetail()
  },
  methods: {
    handleAddConfirm() {
      this.$emit('dialogClose')
    },
    isEmpty(data) {
      return (data ?? '') === ''
    },
    getIncentivePoolDetail() {
      getIncentivePoolDetailApi({ id: this.detailRow.id }).then(res => {
        if (res) {
          res.commissionMonthStr = res?.commissionMonth ? res?.commissionMonth.split('-')[1] : '-'
          res.jobTypeStr = filterStr(res?.jobType, staffLevelList, res?.hireType)
        }
        this.detailInfo = res || {}
      })
    }
  }
}
</script>
<style lang="scss" scoped>
.dialog-content{
  max-height: calc(68vh - 60px);
  overflow: auto;
  .header{
    height: 40px;
    display: flex;
    align-items: center;
    .header-left{
      color: #333333;
      font-weight: bold;
      margin-right: 24px;
    }
    .header-right{
      color: #333333;
      font-weight: 600;
      font-size: 14px;
      .cycle{
        color: #2A58AD;
      }
    }
  }
  .content{
    .content-item{
      .content-item-header{
        height: 42px;
        line-height: 42px;
        background: #F5F7FA;
        color: #000000;
        padding: 0 16px;
        font-weight: bold;
        border-bottom: 1px solid #E7E7E7;
      }
      .content-item-body{
        padding: 0 36px;
        position: relative;
        .left-line{
          position: absolute;
          left: 15px;
          width: 1px;
          height: calc(100% - 24px);
          background: #E7E7E7;
          .line{
            width: 21px;
            height: 1px;
            background: #E7E7E7;
            position: absolute;
            left: 0;
          }
        }
        .content-item-body-title{
          color: #1D1D1D;
          padding: 12px 0;
        }
        ::v-deep .el-table th {
          background: #F5F7FA;
        }
        ::v-deep .el-table__row{
          height: 48px;
        }
      }
      .content-item-footer{
        color: #333333;
        font-weight: bold;
        padding: 16px;
        .amount{
          font-size: 16px;
          color: #2A58AD;
        }
      }
    }
  }
}
</style>