approveEdit.vue 5.81 KB

<!-- 编辑 -->
<template>
  <div class="points">
    <div class="header">
      <div class="title">编辑</div>
    </div>
    <div class="container gl-form-page">
      <GLCombiForm ref="showSearch" :rowNumber="1" :formObj="searchForm" :formData="showFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
      <div class="table-header flex-sb">
        <h2>积分提现明细</h2>
        <el-button size="small" @click="handleDissolve(true)" type="primary" plain>解散批次</el-button>
      </div>

      <!-- 表格区域 开始 -->
      <GLTable ref="withdrawRef" :getListApi="getListApi" :noDataImg="url" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun" @selectionTable="selectionTable">
        <div class="table-btns" slot="auth-button" slot-scope="scope">
          <GLTableButton :buttonList="tableButtonList" :buttonItem="scope.scope" :buttonNum="3"></GLTableButton>
        </div>
      </GLTable>
      <!-- 表格区域 end -->
    </div>
  </div>
</template>
    
    <script>
import url from '@/assets/empty.png'
import { modeTypeList } from '@/utils/constants.js'
export default {
  data() {
    return {
      id: this.$route.query.id,
      size: 'small',
      url: url,
      searchForm: {
        customerName: '',
        customerPhone: ''
      },
      tableSearchForm: {},
      tableButtonList: [
        {
          type: 'el-button',
          name: '移除',
          attrs: {
            type: 'text',
            fn: '移除'
          },
          listeners: {
            click: row => {
              this.handleDissolve(false, row)
            }
          }
        }
      ],
      showFormData: [
        {
          label: '客户名称',
          name: 'customerName',
          type: 'input',
          isClear: true,
          maxlength: 20
        },
        {
          label: '手机号',
          name: 'customerPhone',
          type: 'input',
          isClear: true,
          maxlength: 11
        }
      ],
      // 表格
      getListApi: this.$apis.withdraw.getList,
      tableParams: {
        listName: 'list',
        tableOption: {
          width: 100
        },
        tableColumns: [
          {
            label: '客户名称',
            prop: 'customerName',
            width: 150
          },
          {
            label: '提现方式',
            prop: 'mode',
            width: '200px',
            formatter: cellValue => {
              let arr = this.baseData.modeTypeList.filter(item => item.confId == cellValue.mode)
              return arr.length > 0 ? arr[0].confLabel : '--'
            }
          },
          {
            label: '手机号',
            prop: 'customerPhone',
            width: '140px'
          },
          {
            label: '所属门店',
            prop: 'merchantName',
            line: 1,
            width: 150
          },
          {
            label: '提现积分',
            prop: 'integralAmount',
            width: 100
          },
          {
            label: '提现金额/元',
            prop: 'payAmount',
            width: 110,
            formatter: cellValue => {
              return cellValue.payAmount ? (cellValue.payAmount / 100).toFixed(2) : '--'
            }
          },
          {
            label: '提现时间',
            prop: 'createdDate',
            width: 180
          },
          {
            label: '收款人姓名',
            prop: 'name',
            width: '110px'
          },
          {
            label: '收款人身份证',
            prop: 'idCardNo',
            width: '180px'
          },
          {
            label: '收款银行卡号',
            prop: 'recvBankCardNo',
            width: 230
          },
          {
            label: '收款银行',
            prop: 'recvBank',
            line: 1,
            width: 150
          },
          {
            label: '收款手机号',
            prop: 'mobile',
            width: '130px'
          }
        ]
      },
      pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' },
      // 基本数据
      baseData: {
        modeTypeList
      }
    }
  },
  mounted() {},
  methods: {
    handleDissolve(isAll, row) {
      let title = isAll ? '解散批次提示' : '移除提示',
        cxt = isAll ? '解散本批次,所有未驳回的积分提现记录将恢复「待审核」状态,如需重新生成批次,请选中后重新生成批次。' : '移除该记录,该条积分提现记录将恢复「待审核」状态,如需重新生成批次,请选中后重新生成批次。',
        params = {
          type: isAll ? 2 : 1
        },
        Method = 'removeApproval'
      !isAll ? (params.id = row.id) : (params.id = this.id) //单个移除时传明细id,解散批次时传审批批次id
      this.$utils.secondConfirm(this, title, cxt, 'withdraw', Method, params)
    },
    getParams() {
      var params = JSON.parse(JSON.stringify(this.searchForm))
      params.approvalId = this.id
      return params
    },
    beforeSearchFn() {
      return new Promise(resolve => {
        this.tableSearchForm = this.getParams()
        resolve()
      })
    },
    handleSearch() {
      this.$refs.withdrawRef.refreshTable()
    },
    handleReset() {
      this.searchForm = {
        customerName: '',
        customerPhone: ''
      }
      this.handleSearch()
    },
    setTableFinishFun(data){
    if(!data.length){
        this.$router.back()
      }
  }
  },

}
</script>
    <style scoped lang='scss'>
.points {
  .header {
    padding: 14px 20px;
    background: #fff;
    color: #333333;
    font-size: 20px;
    font-weight: 600;
    border-bottom: 1px solid #e5e5e5;
  }
  .table-header {
    align-items: center;

    h2 {
      color: #333333;
      font-size: 16px;
    }
  }
}
</style>