<template>
  <div class="app-container">
    <!-- 订单信息 -->
    <el-row :gutter="10">
      <el-col :span="22" :offset="1">
        <div class="info-title">订单信息</div>
        <el-col :span="8" :offset="1" :xs="{span: 24, offset: 0}">
          <div class="title">订单编号：{{ info.orderId }}</div>
        </el-col>
        <el-col :span="7" :xs="{span: 24, offset: 0}">
          <div class="title">订单类型：用户盲票订单</div>
        </el-col>
        <el-col :span="8" :xs="{span: 24, offset: 0}">
          <div class="title">下单时间：{{ parseTime(info.createdTime) }}</div>
        </el-col>
        <el-col :span="8" :offset="1" :xs="{span: 24, offset: 0}">
          <div class="title">订单状态：{{ info.status && JSON.parse(info.status).desc }}</div>
        </el-col>
        <el-col :span="7" :xs="{span: 24, offset: 0}">
          <div class="title">优惠金额：{{ $numberFormat(info.discountAmt) }}元</div>
        </el-col>
        <el-col :span="8" :xs="{span: 24, offset: 0}">
          <div class="title">实付金额：{{ $numberFormat(info.payAmt) }}元</div>
        </el-col>
        <el-col :span="8" :offset="1" :xs="{span: 24, offset: 0}">
          <div class="title">付款方式：{{ info.payType == 1 || info.payType == 10 ? '支付宝支付': info.payType == 2 ? '微信支付': '--' }}</div>
        </el-col>
      </el-col>
    </el-row>

    <!-- 买家信息 -->
    <el-row :gutter="10">
      <el-col :span="22" :offset="1">
        <div class="info-title">买家信息</div>
        <el-col :span="8" :offset="1" :xs="{span: 24, offset: 0}">
          <div class="title">用户昵称：{{ info.nickName }}</div>
        </el-col>
        <el-col :span="7" :xs="{span: 24, offset: 0}">
          <div class="title">手机号：{{ info.phone }}</div>
        </el-col>
      </el-col>
    </el-row>

    <!-- 盲票信息 -->
    <el-row :gutter="10">
      <el-col :span="22" :offset="1">
        <div class="info-title">盲票信息</div>
        <el-col :span="8" :offset="1" :xs="{span: 24, offset: 0}">
          <div class="title">盲票组名称：{{ info.ticketBoxTitle }}</div>
        </el-col>
        <el-col :span="7" :xs="{span: 24, offset: 0}">
          <div class="title">盲票类型：{{ info.ticketBoxType && JSON.parse(info.ticketBoxType).desc }}</div>
        </el-col>
        <el-col :span="8" :xs="{span: 24, offset: 0}">
          <div class="title">佣金系数：{{ info.saleCommRate }}%</div>
        </el-col>
        <el-col :span="8" :offset="1" :xs="{span: 24, offset: 0}">
          <div class="title">购买数量：{{ info.ticketNum }}</div>
        </el-col>
        <el-col :span="7" :xs="{span: 24, offset: 0}">
          <div class="title">盲票售价：{{ $numberFormat(info.salePrice) }}元</div>
        </el-col>
        <el-col :span="8" :xs="{span: 24, offset: 0}">
          <div class="title">门店：{{ info.channelName ? info.channelName : '--' }}</div>
        </el-col>
      </el-col>
    </el-row>
    <br>
    <el-row :gutter="10">
      <el-col :span="22" :offset="1">
        <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>
      </el-col>
    </el-row>
  </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>
.title {
  line-height: 30px;
  text-align: left;
}

.edit-express {
  color: #409eff;
  cursor: pointer;
}

.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>
