depositList.vue 4.89 KB
<!-- 激励池 - 存入 -->
<template>
  <div class="deposit-list">
    <d2-table ref="depositTable" 
              :has-num="false"
              :search-form="searchFormSearch"
              :table-params="tableParams"
              :get-list-api="getListApi"
              :before-search-fn="beforeSearchFn">
      <div slot="auth-button"
        slot-scope="scope">
        <auth-button :data="scope.scope"
                        :show-btn-ids="['9121209']" />
      </div>
    </d2-table>
    <deposit-detail-dialog :deposit-detail-visible="depositDetailVisible" v-if="depositDetailVisible" @dialogClose="handleCloseDialog" :detail-row="detailRow"></deposit-detail-dialog>
  </div>
</template>

<script>
import { mapActions } from 'vuex'
import { Util, deepClone } from '@/common/util'
import { staffLevelList } from '@/common/constants.js'
import depositDetailDialog from './depositDetailDialog.vue'
import { getIncentivePoolDepositListApi } from '@/api/resident'
import { filterStr } from '../../inStoreManage/util.js'
export default {
  name: 'DepositList',
  components: {
    depositDetailDialog
  },
  data() {
    return {
      searchFormSearch: {},
      getListApi: getIncentivePoolDepositListApi,
       // 表格参数
       tableParams: {
        needUnique: true,
        mutiSelectUniqueKey: 'uniqueVal',
        btnId: new Date().getTime() + parseInt(Math.random() * 1000),
        listName: 'list',
        tableOption: {
          width: '100'
        },
        tableColumns: [{
          label: '序号',
          prop: 'ownSerialNum',
          type: 'ownSerialNum',
          width: '60'
        }, {
          label: '周期',
          prop: '',
          formatter: (cellValue) => {
            return Util.dateFormate(cellValue.startTime, 'MM月DD日') + '至' + Util.dateFormate(cellValue.endTime, 'MM月DD日')
          },
          width: 160
        }, {
          label: '员工姓名',
          prop: 'staffName',
        }, {
          label: '职级',
          prop: 'jobType',
          width: 120,
          formatter: (cellValue) => {
            return filterStr(cellValue.jobType, this.baseData.jobTypeList, cellValue.hireType)
          }
        }, {
          label: '门店',
          prop: 'merchantName',
          formatter: (cellValue) => {
            return `${cellValue.merchantName}${cellValue.merchantId}` || '-'
          }
        }, {
          label: '业务',
          prop: '',
          formatter: (cellValue) => {
            const mapping = { 1: '轻改', 0: '会员权益/升级' }
            return mapping[cellValue.sceneType] || '-'
          },
          width: 120
        }, {
          label: '贡献产值',
          prop: 'totalPrice',
          formatter: (cellValue) => {
            return cellValue.totalPrice ? '¥' + cellValue.totalPrice : '-'
          },
          width: 120
        }, {
          label: '存入比例',
          prop: 'jlcCommissionRatio',
          formatter: (cellValue) => {
            return cellValue.jlcCommissionRatio ? cellValue.jlcCommissionRatio + '%' : '-'
          },
          width: 100
        }, {
          label: '应存金额',
          prop: 'jlcCommissionPrice',
          formatter: (cellValue) => {
            return cellValue.jlcCommissionPrice ? '¥' + cellValue.jlcCommissionPrice : '-'
          },
          width: 100
        }, {
          label: '实存金额',
          prop: 'actualJlcPrice',
          formatter: (cellValue) => {
            return cellValue.actualJlcPrice ? '¥' + cellValue.actualJlcPrice : '-'
          },
          width: 100
        }]
      },
      baseData: {
        jobTypeList: deepClone(staffLevelList)
      },
      depositDetailVisible: false,
      detailRow: {}
    }
  },

  props: {
    parentSearchForm: {
      type: Object,
      default: () => { }
    }
  },

  mounted() {
  },

  methods: {
    ...mapActions({
      get: 'd2admin/base/get'
    }),
    
    keyDowmGetList() {
      this.$refs.depositTable.refreshTable(true, true)
    },
    beforeSearchFn() {
      return new Promise(resolve => {
        if (this.parentSearchForm.month && this.parentSearchForm.month?.length) {
          const startDate = this.parentSearchForm.month[0]
          const endDate = this.parentSearchForm.month[1]
          this.parentSearchForm.commissionMonthStart = Util.dateFormate(startDate, "YYYY-MM")
          this.parentSearchForm.commissionMonthEnd = Util.dateFormate(endDate, "YYYY-MM")
        }
        delete this.parentSearchForm.month
        this.searchFormSearch = {
          ...this.parentSearchForm
        }
        resolve()
      })
    },
    // 激励池明细
    handleDetail(row) {
      row.cycle = Util.dateFormate(row.startTime, 'MM月DD日') + '至' + Util.dateFormate(row.endTime, 'MM月DD日')
      this.detailRow = row
      this.handleCloseDialog()
    },
    handleCloseDialog() {
      this.depositDetailVisible = !this.depositDetailVisible
    }
  }
}

</script>
<style scoped></style>