orderDetail.vue 6.6 KB
<template>
  <div class="live-room">
    <div class="live-room container">
      <div class="topMsg">
        <div class="orderNo">订单编号:{{ detail.orderCode }}</div>
        <div class="orderTime">下单时间:{{ detail.createDate }}</div>
        <el-button type="primary" size="small" class="backBtn" @click="goBack">
          返回
        </el-button>
      </div>
      <div class="midMsgWrap">
        <div class="midMsgTitle">
          <span>支付信息</span>
          <span>用户信息</span>
          <span>服务名称</span>
          <span>已核/总次数</span>
        </div>
        <div class="midMsgContent">
          <div class="item">
            <div>付款状态:已付款</div>
            <div>付款金额:{{ detail.realPayPrice }}<span v-show="detail.realPayPrice">元</span></div>
            <div>付款方式:微信支付</div>
            <div>付款时间:{{ detail.createDate }}</div>
          </div>
          <div class="item">
            <div class="userName">用户名称:{{ detail.accountName }}</div>
            <div class="phoneNumber">用户手机号:{{ detail.mobile }}</div>
          </div>
          <div class="item">
            <div v-for="(item, index) in detail.list" :key="index">{{ item.serviceName }}</div>
          </div>
          <div class="item">
            <!-- <div>8/12次</div>
            <div>0/1次</div>
            <div>0/3次</div> -->
            <!-- detail.list从上一个页面那list有可能为空 -->
            <div v-for="(item, index) in detail.list" :key="index">{{ item.serviceAmount }}/{{ item.serviceCount }}次</div>
          </div>
        </div>
      </div>
      <div id="tableWrap">
        <div class="tableWrapBox">    
        <el-table :data="tableData" style="width: 100%" :header-cell-style="{ height: '54px', background: '#F4F6FC', color: '#333333', fontSize: '14px' }">
          <el-table-column label="商品名称" align="center">
            <template slot-scope="scope">
              <div v-for="(item, index) in scope.row.couponList" :key="index">{{ item.couponName }}</div>
            </template>
          </el-table-column>
          <el-table-column label="类型" align="center">
            <template slot-scope="scope">
              <span>{{ scope.row.orderType == 1 ? '套餐' : '权益卡' }}</span>
            </template>
          </el-table-column>
          <el-table-column label="有效期" align="center" v-if="detail.orderType == 2">
            <template slot-scope="scope">
              <span>{{ scope.row.effectiveNum == '-1' ? '无限制' : scope.row.effectiveNum + '天' }}</span>
            </template>
          </el-table-column>

          <el-table-column prop="originalPrice" label="单价/元" align="center"></el-table-column>
          <el-table-column prop="amount" label="数量" align="center"></el-table-column>
          <el-table-column prop="totalPrice" label="小计/元" align="center"></el-table-column>
          <el-table-column prop="realPayPrice" label="实收金额" align="center">
            <template slot-scope="scope">
              <span style="color:#EB4E4E">{{ scope.row.realPayPrice }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="orderStatus" label="状态" align="center">
            <template slot-scope="scope">
              <span>{{ scope.row.orderStatus == 2 ? '待收货' : scope.row.orderStatus == 3 ? '已完成' : scope.row.orderStatus == 4 ? '售后中' : scope.row.orderStatus == 5 ? '退款失败' : scope.row.orderStatus == 6 ? '已退款' : '' }}</span>
              <div>{{scope.row.refundReason}}</div>   
            </template>
          </el-table-column>
        </el-table>
        </div>

      </div>
    </div>
  </div>
</template>

<script>
import { getOrderPageDetail } from '@/api/modules/order'
export default {
  data() {
    return {
      tableData: [{}],
      detail: {},//this.$route.query.detail,
      mylist:[]
    }
  },
  created() {
    this.getOrderPageDetail()
    // this.setTableData()
  },
  mounted() {
    
    this.$nextTick(() => {
      let clientHeight = document.documentElement.clientHeight
      let offsettop = document.getElementById('tableWrap').offsetTop
      document.getElementById('tableWrap').style.minHeight = clientHeight - offsettop - 120 + 'px'
    })
  },
  methods: {
    getOrderPageDetail(){
    getOrderPageDetail({id:this.$route.query.id}).then(res=>{
      //  this.mylist=res.list
      if(res.code=='0'){
      this.detail=res.data
      this.$set(this.tableData[0], 'couponList', this.detail.couponList)
      this.$set(this.tableData[0], 'orderType', this.detail.orderType)
      this.$set(this.tableData[0], 'effectiveNum', this.detail.effectiveNum)
      this.$set(this.tableData[0], 'originalPrice', this.detail.originalPrice)
      this.$set(this.tableData[0], 'amount', 1)
      this.$set(this.tableData[0], 'totalPrice', this.detail.originalPrice)
      this.$set(this.tableData[0], 'realPayPrice', this.detail.realPayPrice)
      this.$set(this.tableData[0], 'orderStatus', this.detail.orderStatus)
      this.$set(this.tableData[0],'refundReason',this.detail.refundReason)
      }else{
        this.$message.error(`${res.message}`)
      }
    })
    },
    goBack() {
      console.log(this.detail, 'gggg')
      // this.$router.go(-1)
      this.$router.push("/memberCenter/order")
   
    }
  }
}
</script>

<style lang="scss" scoped>
.container {
  padding: 0 0 20px;
  .topMsg {
    margin-right: 20px;
    display: flex;
    height: 56px;
    align-items: center;
    position: relative;

    .orderNo,
    .orderTime {
      font-size: 14px;
      font-weight: 400;
      color: #333333;
    }
    .orderNo {
      position: absolute;
      left: 50px;
    }
    .orderTime {
      position: absolute;
      left: 350px;
    }
    .backBtn {
      position: absolute;
      right: 0;
    }
  }
  .midMsgWrap {
  
    border-bottom: 1px solid#DCDFE6;
    margin-bottom: 30px;
    .midMsgTitle {
      display: flex;
      height: 56px;
      align-items: center;
      background-color: #f4f6fc;
      padding-left: 50px;
      span {
        font-size: 14px;
        font-weight: 700;
        color: #333333;
        flex: 1;
      }
    }
    .midMsgContent {
      padding-left: 50px;
      display: flex;
      min-height: 150px;
      .item {
        padding-top: 20px;
        font-size: 14px;
        font-weight: 400;
        color: #666666;
        flex: 1;
        div {
          margin-bottom: 10px;
        }
        .userName {
          text-indent: 1em;
        }
      }
    }
  }
.tableWrapBox{
  margin-left: 30px;
  margin-right: 30px;
  border: 1px solid rgba(0, 0, 0, 0.06);
}
}
</style>