orderDetail.vue 3.91 KB
<!-- 核销订单详情 -->
<template>
  <div class="order-detail">
    <div class="edit-box points">
      <div class="container m-b-20 all-page">
        <p class="page-title">订单信息</p>
        <el-form label-width="100px" class="m-t-12" :inline="true">
          <el-row v-for="(item, index) in detailFormDataRow" :key="index">
            <el-form-item v-for="(subItem, subIndex) in item.rowList" :key="subIndex" :label="subItem.label" class="row-item">
              <span class="detail-txt ellipsis-1" :title="detailForm[subItem.name]">{{ detailForm[subItem.name] ? detailForm[subItem.name] + (subItem.suffix || '') : '-' }}</span>
            </el-form-item>
          </el-row>
        </el-form>
      </div>
    </div>
    <GLFooter>
      <el-button @click="handleCancel" size="medium" type="primary">取消</el-button>
    </GLFooter>
  </div>
</template>

<script>
export default {
  name: 'orderDetail',
  data() {
    return {
      size: 'small',
      title: '查看订单',
      editChildRef: 'editChildRef',
      routeInfo: {
        orderCode: ''
      },
      detailForm: {},
      orderRefund: null,
      orderGoods: [],
      // 订单信息
      detailFormDataRow: [],
      detailFormData: [
        {
          label: '项目名称',
          name: 'bizRelName'
        },
        {
          label: '消费积分',
          name: 'integralValue'
        },
        {
          label: '客户昵称',
          name: 'customerWechatName'
        },
        {
          label: '手机号',
          name: 'customerPhone'
        },
        {
          label: '核销员工',
          name: 'verificationStaff'
        },
        {
          label: '结算状态',
          name: 'settlementStatusTxt'
        },
        {
          label: '核算日期',
          name: 'verificationTime'
        },
        {
          label: '订单编号',
          name: 'orderCode'
        },
        {
          label: '操作人',
          name: 'updatedBy'
        },
        {
          label: '商户名称',
          name: 'merchantName'
        }
      ],
      // 基本数据
      baseData: {
        refundTypeList: [
          { confId: '1', confName: '退款退货' },
          { confId: '2', confName: '退款不退货' },
          { confId: '3', confName: '众筹订单退款' }
        ],
        shareStaffTypeList: [
          { confId: '1', confName: '个微' },
          { confId: '2', confName: '企微' }
        ]
      }
    }
  },

  created() {
    this.formToRow('detailFormData')
  },

  mounted() {
    // this.setMinHeight('.edit-box')
    this.routeInfo = this.$route.query
    this.getInfo()
  },

  methods: {
    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])
          }
        }
      }
      console.log(this.detailFormDataRow)
    },
    getInfo() {
      this.$apis.points.getOrderDetail({ id: this.routeInfo.id }).then(res => {
        this.detailForm = res
        this.detailForm.settlementStatusTxt = this.detailForm.settlementStatus ? '已结算' : '未结算'
      })
    },
    handleCancel() {
      this.$router.push({
        path: '/pointsList/index'
      })
    }
  }
}
</script>
<style>
.order-detail .el-form--inline .el-form-item {
  margin: 0;
}
.order-detail .el-form--inline .el-form-item__content {
  height: 30px;
}
.order-detail .form-img .el-form--inline .el-form-item__content {
  height: auto !important;
}
.m-t-12 {
  margin-top: 12px;
}
.order-detail .flex {
  justify-content: flex-start;
}
.order-detail .row-item {
  width: 33%;
}
.detail-txt {
  display: inline-block;
  width: 220px;
}
</style>