index.vue 9.56 KB
<!-- 规则审核 - 列表 -->
<template>
  <div>
    <!-- class="order-detail" -->
    <d2-container>
      <!-- <div class="offline-account"> -->
      <div class="header"
           slot="header"
           style="padding: 10px 20px;">
        <d2-search ref="showSearch"
                   class="show-search"
                   :search-form="searchForm"
                   :label-width="labelWidth"
                   :form-data="showFormData" />
        <div class="up-btns">
          <el-button @click="handleSearch"
                     size="small"
                     type="primary">
            查询
          </el-button>
          <el-button size="small"
                     @click="handleReset">
            重置
          </el-button>
        </div>
      </div>
      <!-- </d2-container>
          <d2-container> -->
      <div class="d2-container-content">
        <d2-table-header>
          <auth-button category="Button" />
        </d2-table-header>
        <d2-table ref="recordTable"
                  :get-list-api="getListApi"
                  :search-form="searchFormSearch"
                  :table-params="tableParams"
                  :before-search-fn="beforeSearchFn">
          <div slot="auth-button"
               slot-scope="scope">
            <!-- 审核 -->
            <span style="margin-right: 10px;"
                  v-if="scope.scope.auditStatus == 1">
              <auth-button :data="scope.scope"
                           :show-btn-ids="['9062401']" />
            </span>
            <!-- 驳回 -->
            <span style="margin-right: 10px;"
                  v-if="scope.scope.auditStatus == 1">
              <auth-button :data="scope.scope"
                           :show-btn-ids="['9062402']" />
            </span>
            <!-- 撤销 -->
            <span style="margin-right: 10px;"
                  v-if="scope.scope.auditStatus == 2 && scope.scope.enabledFlag == 'N'">
              <auth-button :data="scope.scope"
                           :show-btn-ids="['9062403']" />
            </span>
          </div>
        </d2-table>
      </div>
    </d2-container>
  </div>
</template>

<script>
import { Util, deepClone } from '@/common/util'
import { mapActions, mapState } from 'vuex'
import { sceneCodeList, ruleReview_status, ruleReview_type, withdrawalManageStatusList } from '@/common/constants.js'
import { withdrawOrderRecordPage, rewithdraw } from '@api/withdrawalManage'
import { ruleAuditPage, ruleAuditReject, ruleAuditCancel } from '@api/ruleReview'
export default {
  name: 'TransferAccountsList',
  components: {

  },
  data() {
    return {
      userInfo: this.$store.state.d2admin.user.info,
      labelWidth: '100px',
      searchForm: {
        merchantName: '',
        merchantIdFuzzy: '',
        sceneType: '',
        ruleType: '',
        auditStatus: 1
      },
      searchFormSearch: {},
      showFormData: [{
        label: '商户名称',
        name: 'merchantName',
        type: 'input',
        maxlength: '50',
        isClear: true
      }, {
        label: '商户号',
        name: 'merchantIdFuzzy',
        type: 'input',
        inputType: 'number',
        maxlength: '20',
        isClear: true
      }, {
        label: '业务场景',
        name: 'sceneType',
        type: 'select',
        isClear: true,
        optionList: [],
        optionId: 'confId',
        optionLabel: 'confValue',
        optionsName: 'sceneTypeList'
      }, {
        label: '类型',
        name: 'ruleType',
        type: 'select',
        optionList: [],
        optionId: 'confId',
        optionLabel: 'confValue',
        optionsName: 'typeList'
      }, {
        label: '状态',
        name: 'auditStatus',
        type: 'select',
        optionList: [],
        optionId: 'confId',
        optionLabel: 'confValue',
        optionsName: 'statusList'
      }],
      getListApi: ruleAuditPage,
      tableParams: {
        btnId: new Date().getTime() + parseInt(Math.random() * 1000),
        listName: 'list',
        // tableOption: { width: '200px' },
        tableOption: true,
        tableColumns: [{
          label: '商户名称',
          prop: 'merchantName',
          width: '160px'
        }, {
          label: '商户号',
          prop: 'merchantId',
          width: '160px'
        }, {
          label: '业务场景',
          prop: 'sceneType',
          width: '100px',
          formatter: (cellValue) => {
            return this.baseData.sceneTypeList.find(item => item.confId === cellValue.sceneType)?.confValue
          }
        },
        {
          label: '类型',
          prop: 'ruleType',
          width: '100px',
          formatter: (cellValue) => {
            return this.baseData.typeList.find(item => item.confId === cellValue.ruleType)?.confValue
          }
        },
        {
          label: '生效开始时间',
          prop: 'effectStartDate',
          width: '160px',
          formatter: (cellValue) => {
            if (cellValue.effectDateType == 2) {
              return '立即生效'
            } else {
              return cellValue.effectStartDate ? Util.dateFormate(cellValue.effectStartDate, 'YYYY-MM-DD HH:mm:ss') : '--'
            }
          }
        },
        {
          label: '状态',
          prop: 'auditStatus',
          width: '100px',
          formatter: (cellValue) => {
            return this.baseData.statusList.find(item => item.confId === cellValue.auditStatus)?.confValue
          }
        },
        {
          label: '创建人',
          prop: 'creatorName'
        },
        {
          label: '创建时间',
          prop: 'createdDate',
          width: '160px',
          formatter: (cellValue) => {
            return cellValue.createdDate ? Util.dateFormate(cellValue.createdDate, 'YYYY-MM-DD HH:mm:ss') : '--'
          }
        },
        {
          label: '审核人',
          prop: 'auditorName'
        },
        {
          label: '审核时间',
          prop: 'auditDate',
          width: '160px',
          formatter: (cellValue) => {
            return cellValue.auditDate ? Util.dateFormate(cellValue.auditDate, 'YYYY-MM-DD HH:mm:ss') : '--'
          }
        }
        ]
      },
      baseData: {
        sceneTypeList: deepClone(sceneCodeList),
        statusList: deepClone(ruleReview_status),
        typeList: deepClone(ruleReview_type)
      }

    }
  },
  computed: {
    ...mapState({
      dowloadList: (state) => state.d2admin.user.dowloadList
    })
  },
  mounted() {
    this.getBaseData()
  },

  methods: {
    ...mapActions({
      get: 'd2admin/base/get',
      close: 'd2admin/page/close'
    }),
    ...mapActions('d2admin/user', ['actionSetDownloadList']),

    async getBaseData() {
      this.getOptionsList()
    },

    beforeSearchFn() {
      return new Promise(resolve => {
        this.searchFormSearch = deepClone(this.searchForm)
        resolve()
      })
    },

    getOptionsList() {
      this.showFormData.forEach((item, index) => {
        if (item.type === 'select') {
          if (this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this.showFormData[index].optionLabel] !== '全部') {
            const temp = {}
            temp[this.showFormData[index].optionId] = ''
            temp[this.showFormData[index].optionLabel] = '全部'
            this.baseData[item.optionsName].unshift(temp)
          }
          this.$set(this.showFormData[index], 'optionList', this.baseData[item.optionsName])
        }
      })
    },

    handleSearch() {
      this.$refs.recordTable.refreshTable(false, true)
    },
    handleReset() {
      this.searchForm = {
        merchantName: '',
        merchantIdFuzzy: '',
        sceneType: '',
        ruleType: '',
        auditStatus: 1
      }
      this.$refs.recordTable.refreshTable(false, true)
    },

    // 审核
    handleReview(row) {
      this.$router.push({
        name: "examineDetail",
        query: {
          params: JSON.stringify(row)
        }
      })
    },

    // 驳回
    handleReject(row) {
      this.$confirm('进行驳回后,自动作废该申请,且无法撤回。是否确认操作?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
        closeOnClickModal: false
      }).then(() => {
        ruleAuditReject({ id: row.id }).then(res => {
          this.notice.okTips()
          this.$refs.recordTable.refreshTable()
        })
      }).catch(err => {
        console.log(err)
      })
    },

    // 撤销
    handleRevoke(row) {
      this.$confirm('进行撤销后,自动作废该规则记录,且无法撤回。是否确认操作?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
        closeOnClickModal: false
      }).then(() => {
        ruleAuditCancel({ id: row.id }).then(res => {
          this.notice.okTips()
          this.$refs.recordTable.refreshTable()
        })
      }).catch(err => {
        console.log(err)
      })
    },

    // 根据生效时间判断是否可以撤销
    isRevoke(row) {
      const nowDate = Util.dateFormate(new Date(), 'YYYY-MM-DD')
      console.log(nowDate)
      console.log(Util.dateFormate(row.effectStartDate, 'YYYY-MM-DD'))
      console.log(Util.dateFormate(row.effectStartDate, 'YYYY-MM-DD') > nowDate)
      if (Util.dateFormate(row.effectStartDate, 'YYYY-MM-DD') > nowDate) { // 未生效时可以撤销
        return true
      } else {
        return false
      }
    }

  }

}

</script>
<style scoped>
.count-txt {
  font-weight: 700;
  color: #2a58ad;
  margin: 0 2px;
}

.leftSpan {
  display: inline-block;
  box-sizing: border-box;
  margin-right: 10px;
}
</style>