<template>
  <div class="app-container">
    <!-- 订单信息 -->
    <div class="info">
      <div class="info-title">订单信息</div>
      <div class="info-item">
        <div class="info-item-content">
          <div class="info-item-content-one">
            <div class="title">订单编号：</div>
            <div class="txt">{{ info.orderId }}</div>
          </div>
          <div class="info-item-content-one">
            <div class="title">订单类型：</div>
            <div class="txt">用户盲票订单</div>
          </div>
          <div class="info-item-content-one">
            <div class="title">下单时间：</div>
            <div class="txt">{{ parseTime(info.createdTime) }}</div>
          </div>
        </div>
        <div class="info-item-content">
          <div class="info-item-content-one">
            <div class="title">订单状态：</div>
            <div class="txt">{{ info.status && JSON.parse(info.status).desc }}</div>
          </div>
          <div class="info-item-content-one">
            <div class="title">优惠金额：</div>
            <div class="txt">{{ $numberFormat(info.discountAmt) }}元</div>
          </div>
          <div class="info-item-content-one">
            <div class="title">实付金额：</div>
            <div class="txt">{{ $numberFormat(info.payAmt) }}元</div>
          </div>
        </div>
      </div>
    </div>
    <!-- 买家信息 -->
    <div class="info">
      <div class="info-title">买家信息</div>
      <div class="info-item">
        <div class="info-item-content">
          <div class="info-item-content-one">
            <div class="title">用户昵称：</div>
            <div class="txt">{{ info.nickName }}</div>
          </div>
          <div class="info-item-content-one">
            <div class="title">手机号：</div>
            <div class="txt">{{ info.phone }}</div>
          </div>
          <div class="info-item-content-one">
            <div class="title">上级渠道商：</div>
            <div class="txt">{{ info.channelName }}</div>
          </div>
        </div>
      </div>
    </div>
    <!-- 盲票信息 -->
    <div class="info">
      <div class="info-title">盲票信息</div>
      <div class="info-item">
        <div class="info-item-content">
          <div class="info-item-content-one">
            <div class="title">盲票组名称：</div>
            <div class="txt">{{ info.ticketBoxTitle }}</div>
          </div>
          <div class="info-item-content-one">
            <div class="title">盲票类型：</div>
            <div class="txt">{{ info.ticketBoxType && JSON.parse(info.ticketBoxType).desc }}</div>
          </div>
          <div class="info-item-content-one">
            <div class="title">佣金系数：</div>
            <div class="txt">{{ info.saleCommRate }}%</div>
          </div>
        </div>
        <div class="info-item-content">
          <div class="info-item-content-one">
            <div class="title">购买数量：</div>
            <div class="txt">{{ info.ticketNum }}</div>
          </div>
          <div class="info-item-content-one">
            <div class="title">盲票售价：</div>
            <div class="txt">{{ $numberFormat(info.salePrice) }}元</div>
          </div>
        </div>
      </div>
    </div>
    <div class="info" v-if="info.ticketDetailList instanceof Array && info.ticketDetailList.length > 0 && info.ticketDetailList[0] instanceof Object">
      <table border="1" class="table" bordercolor="#CCC">
        <tr width="20%">
          <th>盲票序列号</th>
          <th>兑奖状态</th>
          <th>奖级</th>
          <th>奖品</th>
        </tr>
        <tr v-for="(item, index) in info.ticketDetailList" :key="index">
          <td>{{ item && item.serialNo }}</td>
          <td>{{ item && item.status && JSON.parse(item.status).desc }}</td>
          <td>{{ item && item.prizeGrade }}</td>
          <td>{{ item && item.prizeTitle }}</td>
        </tr>
      </table>
    </div>
  </div>
</template>
<script>
import { ticketOrderDetail } from "@/api/business/order";
export default {
  name: "UserTicketDetail",
  data() {
    return {
      info: {}
    };
  },
  created() {
    this.getDetail(this.$route.query.id);
  },
  methods: {
    // 订单详情
    getDetail(id) {
      ticketOrderDetail(id).then((res) => {
        if (res.code == 0) {
          this.info = {
            ...res.data,
          };
        }
      });
    },
  },
};
</script>
<style lang="scss" scoped>
.info {
  margin-bottom: 10px;
  &-title {
    font-size: 14px;
    margin-bottom: 10px;
    font-weight: bold;
  }
  &-item {
    padding-left: 50px;
    &-content {
      display: flex;

      &-one {
        display: flex;
        margin-bottom: 10px;

        .title {
          line-height: 22px;
          width: 100px;
        }

        .txt {
          line-height: 22px;
          width: 200px;
        }
      }
    }
  }
}
.flex {
  display: flex;
  align-items: center;
  .txt {
    margin-left: 20px;
  }
}
.table {
  border-collapse: collapse;
  width: 100%;
  line-height: 32px;
  color: #606266;
  font-size: 14px;
  th {
    background-color: #ECECEC;
  }
  td {
    text-align: center;
  }
}
</style>