detail.vue 8.86 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="154px" :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 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>
        <p class="edit-title">付款信息</p>
        <el-form label-width="154px" :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="recordInfo.operationList">
        <p class="edit-title">操作记录</p>
        <template v-for="(record, recordIdx) in recordInfo.operationList">
          <el-form label-width="154px" :inline="true" :key="recordIdx">
            <el-row v-for="(item, index) in operationDataRow" :key="index">
              <el-form-item v-for="(subItem, subIndex) in item.rowList" :key="subIndex" :label="subItem.label(record) + ':'" class="row-item">
                <span v-if="subItem.addHtml" class="flex_sc">
                  <div class="table_point" :style="{ background: subItem.addHtml(record).color }"></div>
                  {{ subItem.addHtml(record).status }}
                </span>
                <span v-else class="detail-txt ellipsis-1" :title="record[subItem.name]">{{ record[subItem.name] ? record[subItem.name] + (subItem.suffix || '') : '-' }}</span>
              </el-form-item>
            </el-row>
          </el-form>
        </template>
      </div>
    </div>
  </GLDialog>
</template>
  <script>
const tableStatus = ['待审核', '已审核', '第三方处理', '成功', '失败', '驳回']
const colors = ['#FDB757', '#2CCA74', '#5850FF', '#2CCA74', '#999999', '#EB4E4E']
export default {
  name: 'DetailDialog',
  data() {
    return {
      recordInfo: {},
      withdrawDataRow: [],
      paymentDataRow: [],
      operationDataRow: [],
      withdrawData: [],
      paymentData: [],
      operationData: [],
      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.getDetails({ id: this.id }).then(res => {
        this.recordInfo = res
        this.getConfig()
      })
    },
    getConfig() {
      this.withdrawData = [
        {
          label: '提现单号',
          name: 'outSettleOrderId'
        },
        {
          label: '提现类型',
          name: 'transferType',
          addHtml: obj => {
            return obj.transferType ==0?'积分提现':'普通提现'
          }
        },
        {
          label: '提现金额',
          name: 'payAmount',
          addHtml: obj => {
            return obj.payAmount?(obj.payAmount / 100).toFixed(2):'--'
          }
        },
        {
          label: '客户名称',
          name: 'customerName'
        },
        {
          label: '客户手机',
          name: 'customerPhone'
        },
        {
          label: '提现积分',
          name: 'integralAmount'
        },
       
        {
          label: '所属门店',
          name: 'merchantName'
        },
        {
          label: '申请时间',
          name: 'createdDate'
        }
      ]
      this.paymentData = [
        {
          label: '收款人姓名',
          name: 'name'
        },
        {
          label: '收款人身份证',
          name: 'idCardNo'
        },
        {
          label: '收款银行卡号',
          name: 'recvBankCardNo'
        },
        {
          label: '收款银行',
          name: 'recvBank'
        },
        {
          label: '收款手机号',
          name: 'mobile'
        },
        {
          label: '付款渠道',
          name: 'channel',
          addHtml: obj => {
            return obj.channel == 'TXIAT' ? '熠轩' : '--'
          }
        },
        {
          label: '结算金额',
          name: 'settleAmount',
          addHtml: obj => {
            return obj.settleAmount?(obj.settleAmount / 100).toFixed(2):'--'
          }
        },
        {
          label: '到账时间',
          name: 'receiptDate'
        },
        {
          label: '状态',
          name: 'status',
          addStyle: obj => {
            return {
              status: tableStatus[obj.status],
              color: colors[obj.status]
            }
          }
        },
        {
          label: '失败原因',
          name: 'errorMessage'
        }
      ]
      this.operationData = [
        {
          label: obj => {
            return ['审核', '付款'][obj.type]
          },
          name: 'type',
          addHtml: obj => {
            let status = '--',
              color;
            if (obj.result == 0) {
              status = '通过'
              color = '#2CCA74'
            } else if (obj.result == 1) {
              status = '驳回'
              color = '#EB4E4E'
            }
            return {
              status,
              color
            }
          }
        },
        {
          // label: ['审核人', '付款人', '操作人'],
          label: obj => {
            let arr = ['审核人', '付款人','受理人'],
              label
            if (obj.result == 0) {
              label = arr[obj.type]
            } else if (obj.result == 1) {
              label = '操作人'
            }
            return label
          },
          name: 'createdBy'
        },
        {
          label: obj => {
            let arr = ['审核时间', '付款时间','受理时间'],
              label
            if (obj.result == 0) {
              label = arr[obj.type]
            } else if (obj.result == 1) {
              label = '操作时间'
            }
            return label
          },
          name: 'createdDate'
        },
        {
          label: () => {
            return '备注'
          },
          name: 'remark'
        }
      ]
      if (this.recordInfo.status != 4) {
        this.handleJudgment(this.paymentData, 'errorMessage')
      }
      this.formToRow('withdrawData')
      this.formToRow('operationData')
      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: 28%;
  /deep/ {
    .el-form-item__content {
      height: 30px;
    }
  }
}
.detail-txt {
  display: inline-block;
  width: 133px;
}
.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;
}
</style>