approve.vue 10.3 KB
<!--  积分提现审批-->
<template>
  <div class="points">
    <div class="container">
      <GLCombiForm ref="showSearch" :rowNumber="1" :formObj="searchForm" :formData="showFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
      <!-- 表格区域 开始 -->
      <GLTable ref="withdrawRef" :getListApi="getListApi" :noDataImg="url" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun" @selectionTable="selectionTable">
        <div class="flex_sc" slot="colorStatus" slot-scope="scope">
          <div class="table_point" :style="{ background: colors[scope.scope.status] }"></div>
          <span>{{ tableStatus[scope.scope.status] }}</span>
        </div>
        <div class="table-btns" slot="auth-button" slot-scope="scope">
          <GLTableButton :buttonList="tableButtonList" :buttonItem="scope.scope" :buttonNum="3"></GLTableButton>
        </div>
      </GLTable>
      <!-- 表格区域 end -->
    </div>
    <!-- 详情 -->
    <detail-dialog :detail-visible="detailVisible" :id="id" @dialogClose="dialogClose"></detail-dialog>
    <pay-approval :payVisible="payVisible" :recordInfo="recordInfo" @cancelPay="cancelPay"></pay-approval>
  </div>
</template>
  
  <script>
import * as dayjs from 'dayjs'
import url from '@/assets/empty.png'
import DetailDialog from './approveView.vue'
import PayApproval from './payApproval.vue'
import { colors, tableStatus,PayerelList,channelList,statusList } from '@/utils/constants.js'
export default {
  components: {
    DetailDialog,
    PayApproval
  },
  data() {
    return {
      recordInfo: {},
      id: '',
      checkLoading: false,
      loading: false,
      detailVisible: false,
      payVisible: false,
      colors,
      tableStatus,
      size: 'small',
      url: url,
      searchForm: {
        batchNo: '',
        paymentChannel: '',
        approvalTime: [],
        oaApprovalTime: [],
        userSettleTime: []
      },
      hasFooter: false,
      tableSearchForm: {},
      showFormData: [
        {
          label: '批次号',
          name: 'batchNo',
          type: 'input',
          isClear: true,
          maxlength: 20
        },
        {
          label: 'OA审批编号',
          name: 'oaSpNo',
          type: 'input',
          isClear: true,
          maxlength: 20
        },
        {
          label: '付款渠道',
          name: 'paymentChannel',
          type: 'select',
          optionList: [],
          optionId: 'confId',
          optionLabel: 'confLabel',
          optionsName: 'channelList'
        },
        {
          label: '付款主体',
          name: 'paymentSubject',
          type: 'select',
          optionList: [],
          optionId: 'confId',
          optionLabel: 'confLabel',
          optionsName: 'PayerelList'
        },
        {
          label: '状态',
          name: 'status',
          type: 'select',
          optionList: [],
          optionId: 'confId',
          optionLabel: 'confLabel',
          optionsName: 'statusList'
        },
        {
          label: '审批时间',
          name: 'approvalTime',
          type: 'datePicker',
          isClear: true,
          pickerOptions: 'beforeRangePickerOptions'
        },
        {
          label: 'OA审批时间',
          name: 'oaApprovalTime',
          type: 'datePicker',
          isClear: true,
          pickerOptions: 'beforeRangePickerOptions'
        },
        {
          label: '付款时间',
          name: 'userSettleTime',
          type: 'datePicker',
          isClear: true,
          pickerOptions: 'beforeRangePickerOptions'
        }
      ],
      tableButtonList: [
        {
          type: 'el-button',
          name: '查看',
          attrs: {
            type: 'text',
            fn: '查看'
          },
          listeners: {
            click: this.handleDetail
          }
        },
        {
          type: 'el-button',
          name: '编辑',
          attrs: {
            type: 'text',
            fn: '编辑'
          },
          condition: row => {
              return row.status == 0||row.status ==3
            },
          listeners: {
            click: row => {
              this.handleEdit(row)
            }
          }
        },
        {
          type: 'el-button',
          name: '付款审批',
          attrs: {
            type: 'text',
            fn: '付款审批'
          },
            condition: row => {
              return row.status == 0||row.status ==3
            },
          listeners: {
            click: row => {
              this.handleCheck(row)
            }
          }
        },
        {
          type: 'el-button',
          name: '到账明细',
          attrs: {
            type: 'text',
            fn: '到账明细'
          },
          condition: row => {
            return row.status == 5|| row.status == 6
          },
          listeners: {
            click: row => {
              this.handleParticulars(row)
            }
          }
        },
        {
          type: 'el-button',
          name: '导出',
          attrs: {
            type: 'text',
            fn: '导出'
          },
          listeners: {
            click: row => {
              this.handleExport(row)
            }
          }
        }
      ],
      // 表格
      getListApi: this.$apis.withdraw.getApprovalPage,
      tableParams: {
        listName: 'list',
        tableOption: {
          width: 170
        },
        tableColumns: [
          {
            label: '批次号',
            prop: 'batchNo',
            width: 120
          },
          {
            label: '客户数量',
            prop: 'customerCount',
            width: 110
          },
          {
            label: '积分总额',
            prop: 'pointTotal',
            width: 110
          },
          {
            label: '付款总额/元',
            prop: 'paymentTotal',
            width: 120
          },
          {
            label: '付款渠道',
            prop: 'paymentChannel',
            width: '200px'
          },
          {
            label: '付款主体',
            prop: 'paymentSubject',
            width: '200px'
          },

          {
            label: '状态',
            prop: 'status',
            width: '200px',
            addHtml: 'colorStatus'
          },
          {
            label: '批次生成时间',
            prop: 'createdDate',
            width: 180
          },
          {
            label: '审批人',
            prop: 'approver',
            width: 150
          },
          {
            label: '审批时间',
            prop: 'approvalTime',
            width: 180
          },
          {
            label: 'OA审批编号',
            prop: 'oaSpNo',
            width: '200px'
          },
          {
            label: 'OA审批时间',
            prop: 'oaApprovalTime',
            width: 180
          },

          {
            label: '渠道到账时间',
            prop: 'channelSettleTime',
            width: 180
          },
          {
            label: '用户到账时间',
            prop: 'userSettleTime',
            width: 180
          }
        ]
      },
      pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' },
      // 基本数据
      baseData: {
        //付款主体
        PayerelList,
        merchantList: [],
        statusList,
        channelList,
      }
    }
  },

  mounted() {
    this.$utils.getOptionsList(this, 'showFormData')
  },
  methods: {
    dialogClose() {
      this.detailVisible = false
    },
    handleCheck(row) {
      this.recordInfo = row
      this.payVisible = true
    },
    cancelPay() {
      this.payVisible = false
      this.handleSearch()
    },
    //查看
    handleDetail(row) {
      this.id = row.id
      this.detailVisible = true
    },
    //导出
    handleExport(row) {
      const params ={approvalId: row.id}
      this.$apis.withdraw.orderExport(params).then(res => {
        this.$utils.aToExport(res)
      })
    },
    //到账明细
    handleParticulars(row) {
      this.$router.push({
        path: '/withdraw/approveDetail',
        query: {
          id: row.id
        }
      })
    },
    //编辑
    handleEdit(row) {
      this.$router.push({
        path: '/withdraw/approveEdit',
        query: {
          id: row.id
        }
      })
    },

    getParams() {
      var params = JSON.parse(JSON.stringify(this.searchForm))
      if (this.searchForm.approvalTime && this.searchForm.approvalTime.length) {
        params.approvalTimeStart = dayjs(this.searchForm.approvalTime[0]).format('YYYY-MM-DD') + ' 00:00:01'
        params.approvalTimeEnd = dayjs(this.searchForm.approvalTime[1]).format('YYYY-MM-DD') + ' 23:59:59'
      }
      if (this.searchForm.userSettleTime && this.searchForm.userSettleTime.length) {
        params.userSettleTimeStart = dayjs(this.searchForm.userSettleTime[0]).format('YYYY-MM-DD') + ' 00:00:01'
        params.userSettleTimeEnd = dayjs(this.searchForm.userSettleTime[1]).format('YYYY-MM-DD') + ' 23:59:59'
      }
      console.log(this.searchForm.oaApprovalTime)
      if (this.searchForm.oaApprovalTime && this.searchForm.oaApprovalTime.length) {
        params.oaApprovalTimeStart = dayjs(this.searchForm.oaApprovalTime[0]).format('YYYY-MM-DD') + ' 00:00:01'
        params.oaApprovalTimeEnd = dayjs(this.searchForm.oaApprovalTime[1]).format('YYYY-MM-DD') + ' 23:59:59'
      }

      delete params.userSettleTime, delete params.approvalTime, delete params.oaApprovalTime
      return params
    },
    beforeSearchFn() {
      return new Promise(resolve => {
        this.tableSearchForm = this.getParams()
        resolve()
      })
    },
    handleSearch() {
      this.$refs.withdrawRef.refreshTable()
    },
    handleReset() {
      this.searchForm = {
        batchNo: '',
        oaSpNo:'',
        paymentSubject: '',
        paymentChannel: '',
        approvalTime: [],
        oaApprovalTime: [],
        userSettleTime: []
      }
      this.handleSearch()
    },

    exportExcel() {
      const params = this.getParams()
      this.$apis.withdraw.orderExport(params).then(res => {
        this.$utils.aToExport(res)
      })
    }
  }
}
</script>
  <style scoped lang='scss'>
.table_point {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 8px;
}
.gl-form-page /deep/ .el-dialog__footer {
  text-align: center !important;
}

</style>