approveView.vue 7.6 KB
<!-- 查看 -->
<template>
  <GLDialog bigTitle="详细信息" :visible.sync="isVisible" :hasFooter="false" :before-close="handleClose" class="points" mode="big" okText="关闭" @onCancel="handleClose" @onOk="handleClose">
    <div class="wrap edit-box">
      <div>
        <p class="edit-title">订单信息</p>
        <el-form label-width="120px" :inline="true">
          <el-row v-for="(item, index) in withdrawDataRow" :key="index">
            <el-form-item v-for="(subItem, subIndex) in item.rowList" :key="subIndex" :label="subItem.label + ':'" class="row-item">
              <span v-if="subItem.addHtml">
                {{ subItem.addHtml(recordInfo) }}
              </span>
              <span v-else-if="subItem.addStyle" class="flex_sc">
                <div class="table_point" :style="{ background: subItem.addStyle(recordInfo).color }"></div>
                {{ subItem.addStyle(recordInfo).status }}
              </span>
              <span v-else class="detail-txt ellipsis-1" :title="recordInfo[subItem.name]">{{ recordInfo[subItem.name] || recordInfo[subItem.name] === 0 ? recordInfo[subItem.name] + (subItem.suffix || '') : '-' }}</span>
            </el-form-item>
          </el-row>
        </el-form>
      </div>
      <div>
        <p class="edit-title">付款信息</p>
        <el-form label-width="120px" :inline="true">
          <el-row v-for="(item, index) in paymentDataRow" :key="index">
            <el-form-item v-for="(subItem, subIndex) in item.rowList" :key="subIndex" :label="subItem.label + ':'" class="row-item">
              <span v-if="subItem.addHtml">
                {{ subItem.addHtml(recordInfo) }}
              </span>
              <span v-else-if="subItem.addStyle" class="flex_sc">
                <div class="table_point" :style="{ background: subItem.addStyle(recordInfo).color }"></div>
                {{ subItem.addStyle(recordInfo).status }}
              </span>
              <span v-else class="detail-txt ellipsis-1" :title="recordInfo[subItem.name]">{{ recordInfo[subItem.name] ? recordInfo[subItem.name] + (subItem.suffix || '') : '-' }}</span>
            </el-form-item>
          </el-row>
        </el-form>
      </div>
      <div v-if="operationList && operationList.length">
        <p class="edit-title">操作记录</p>
        <div class="block">
          <el-timeline>
            <template v-for="(item, index) in operationList">
              <el-timeline-item :key="index">
                <div class="timeline-item">
                  <div class="operation-result">
                    {{ item.operationTypetext }}
                    <span :class="item.active">{{ item.operationResult }}</span>
                  </div>
                  <div class="operation-Note">{{ item.operationNote }}</div>
                </div>
              </el-timeline-item>
            </template>
          </el-timeline>
        </div>
      </div>
    </div>
  </GLDialog>
</template>
    <script>
import { colors, tableStatus, operate_status } from '@/utils/constants.js'

export default {
  name: 'DetailDialog',
  data() {
    return {
      recordInfo: {},
      operationList: [],
      withdrawDataRow: [],
      paymentDataRow: [],
      withdrawData: [],
      paymentData: [],
      isVisible: this.detailVisible
    }
  },
  props: {
    detailVisible: {
      type: Boolean,
      default: false
    },
    id: {
      type: Number,
      default: 0
    }
  },
  watch: {
    detailVisible(newVal) {
      this.isVisible = newVal
      this.getDetails()
    }
  },
  computed: {},
  mounted() {},
  methods: {
    getDetails() {
      this.$apis.withdraw.approvalDetail({ id: this.id }).then(res => {
        this.recordInfo = res
        this.getApprovalLog()
        this.getConfig()
      })
    },
    getApprovalLog() {
      let arr
      this.$apis.withdraw.getApprovalLog({ id: this.id }).then(res => {
        arr = res.map(item => {
          let active, operationTypetext
          //单独处理付款审核时,屏蔽付款审核结果
          if (item.operationType == 1) {
            item.operationResult = ''
          }
          if (item.operationResult == '审批中') {
            active = 'wait'
          } else if (item.operationResult == '通过') {
            active = 'success'
          } else if (item.operationResult == '审批驳回' || item.operationResult == '不通过') {
            active = 'fail'
          } else {
            active = 'close'
          }

          operationTypetext = operate_status[item.operationType]
          return {
            ...item,
            active,
            operationTypetext
          }
        })
        this.operationList = arr
      })
    },
    getConfig() {
      this.withdrawData = [
        {
          label: '批次号',
          name: 'batchNo'
        },
        {
          label: '客户数量',
          name: 'customerCount'
        },
        {
          label: '积分总额',
          name: 'pointTotal'
        },
        {
          label: '付款总额/元',
          name: 'paymentTotal'
        },
        {
          label: '状态',
          name: 'status',
          addStyle: obj => {
            return {
              status: tableStatus[obj.status],
              color: colors[obj.status]
            }
          }
        }
      ]
      this.paymentData = [
        {
          label: '付款渠道',
          name: 'paymentChannel'
        },
        {
          label: '付款主体',
          name: 'paymentSubject'
        },
        {
          label: '代征主体',
          name: 'levyName',
          addHtml:(cellValue)=>{
           return cellValue.channelAccount ? cellValue.channelAccount.levyName : '-'
            }
        },

        {
          label: '渠道到账时间',
          name: 'channelSettleTime'
        }
      ]
      this.formToRow('withdrawData')
      this.formToRow('paymentData')
    },

    handleJudgment(target, key) {
      let arr = target,
        len = arr.length,
        item
      for (let i = 0; i < len; i++) {
        item = arr[i]
        if (item.name == key) {
          arr.splice(i, 1)
        }
      }
    },
    formToRow(formName, numOfRow = 3) {
      var rowNum = Math.ceil(this[formName].length / numOfRow)
      for (var i = 0; i < rowNum; i++) {
        for (var j = 0; j < numOfRow; j++) {
          if (j == 0) {
            this[formName + 'Row'][i] = {
              rowList: []
            }
          }
          if (i * numOfRow + j < this[formName].length) {
            this[formName + 'Row'][i].rowList.push(this[formName][i * numOfRow + j])
          }
        }
      }
    },
    handleClose() {
      this.isVisible = false
      this.$emit('dialogClose')
    }
  }
}
</script>
    <style scoped lang="scss">
.edit-box .row-item {
  width: 30%;
  /deep/ {
    .el-form-item__content {
      height: 30px;
    }
  }
}
.edit-box {
  .el-form--inline {
    margin-bottom: 10px;
  }
}
.detail-txt {
  display: inline-block;
  width: 190px;
}
.edit-title {
  font-weight: 600;
  font-size: 16px;
  color: #000000d9;
  line-height: 24px;
}
.m-b-20 {
  margin-top: 20px;
}
/deep/ .el-form-item {
  margin-bottom: 0;
}
.table_point {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 8px;
}
.block {
  margin-top: 20px;
  max-height: 250px;
  overflow-y: auto;
}
.timeline-item {
  .operation-result {
    color: #1d2129ff;
    font-size: 14px;
    line-height: 20px;
    span {
      margin-left: 12px;
    }
    .success {
      color: #2cca74ff;
    }
    .wait {
      color: #f59619ff;
    }
    .close {
      color: #999999ff;
    }
    .fail {
      color: #eb4e4eff;
    }
  }
  .operation-Note {
    color: #999999ff;
    font-size: 12px;
    margin-top: 4px;
  }
}
</style>