order-detail.vue 8.41 KB
<script setup>
import { reactive } from "vue";
import { cancelOrder, getOrderDetail } from "./api/index.js";
import qrCodeDialog from "./components/qrCodeDialog.vue";
import { ElMessageBox, ElMessage } from "element-plus";

const route = useRoute();
const router = useRouter();

const status = reactive({
  0: {
    txt: "待支付",
    color: "#F740A6",
    bgColor: "#FFE2F2",
  },
  1: {
    txt: "已支付",
    color: "#757575",
    bgColor: "#DDDDDD",
  },
  2: {
    txt: "未支付",
    color: "#34C759",
    bgColor: "#D2FFDD",
  },
  3: {
    txt: "已退款",
    color: "#FFCC00",
    bgColor: "#FFF7D9",
  },
});

const detail = reactive({
  data: null,
  fetchData() {
    getOrderDetail({ orderSn: route.query.orderSn }).then((res) => {
      detail.data = res.data;
    });
  },
});

detail.fetchData();
</script>

<template>
  <div class="container">
    <div class="left">
      <!-- 票务信息 -->
      <div class="ticket">
        <div class="th">
          <div style="width: 33%" class="td">票务信息</div>
          <div style="width: 25%" class="td">地点</div>
          <div style="width: 20%" class="td">单价</div>
          <div style="width: 10%" class="td">数量</div>
          <div style="width: 12%; text-align: right" class="td">小计</div>
        </div>
        <div class="line"></div>
        <div class="tr">
          <div style="width: 30%" class="td">{{ detail.data?.name }}</div>
          <div style="width: 25%" class="td">{{ detail.data?.placeName }}</div>
          <div style="width: 20%" class="td">
            ¥{{ detail.data?.singlePrice }}
          </div>
          <div style="width: 12%" class="td">
            x{{ detail.data?.seatList?.length }}
          </div>
          <div style="width: 13%; text-align: right" class="td">
            ¥{{ detail.data?.payAmount }}
          </div>
        </div>
      </div>
      <!-- 座位 -->
      <div class="seat_box">
        <div class="th">
          <div style="width: 30.33%" class="td">时间座位</div>
          <div style="width: 30.33%" class="td">订单信息</div>
          <div style="width: 30.33%" class="td">联系方式</div>
        </div>
        <div class="tr">
          <div style="width: 30.33%" class="td flex-col">
            <div>{{ detail.data?.dateStr }}</div>
            <div v-for="(it, index) in detail.data?.seatList" :key="index">
              <span v-if="it.venueId == 1">{{ it.area }}</span
              >{{ it.pai }}{{ it.no }}座 ({{
                it.venueId == 1 ? "B6" : "B4"
              }}馆)
            </div>
          </div>
          <div style="width: 30.33%" class="td flex-col">
            <div>订单编号:{{ detail.data?.orderSn }}</div>
            <div>创建时间:{{ detail.data?.orderTime }}</div>
          </div>
          <div style="width: 30.33%" class="td">
            <div>联系电话:{{ detail.data?.contactPhone }}</div>
          </div>
        </div>
      </div>
      <!-- 购票人 -->
      <div class="pay_ticket">
        <div class="title">购票人</div>
        <div class="people">
          <div
            v-for="(it, index) in detail.data?.customerList"
            :key="index"
            class="p_info"
          >
            <div>{{ it.name }}</div>
            <div class="idcard">身份证:{{ it.idCard }}</div>
          </div>
        </div>
      </div>
    </div>

    <div class="right">
      <div class="balance">
        <div class="title">结算信息</div>
        <div class="cell">
          <div class="label">订单状态</div>
          <div class="value">{{ status[detail.data?.state]?.txt }}</div>
        </div>
        <div class="cell">
          <div class="label">订单金额</div>
          <div class="value">¥{{ detail.data?.payAmount }}</div>
        </div>
        <!-- button -->
        <div v-if="detail.data?.state == 0" class="btn_box">
          <div class="can_pay">取消支付</div>
          <div class="pay">立即支付</div>
        </div>
        <div v-else>
          <div v-if="detail.data?.state == 1 && detail.data?.isRefund" class="btn_box">
            <div class="can_pay">取消购票</div>
            <div class="pay">再来一单</div>
          </div>

          <div v-else class="btn_box">
            <div class="pay_dis">请联系工作人员</div>
          </div>
        </div>
      </div>
      <div v-if="detail.data?.state == 0" class="tip">
        请尽快完成支付,还剩15分00秒
      </div>
    </div>
  </div>
</template>

<style scoped lang="scss">
.container {
  width: 1200px;
  margin: 0 auto;
  padding: 20px 0;
  display: flex;
  gap: 20px;
  .left {
    width: 780px;
    // 票务信息
    .ticket {
      background-color: #fff;
      padding: 0 20px;
      .th {
        display: flex;
        justify-content: space-between;
        padding: 20px 0;
        .td {
          font-weight: bold;
          font-size: 16px;
          color: #333333;
          line-height: 24px;
        }
      }
      .line {
        width: 740px;
        height: 1px;
        background: #eee;
      }
      .tr {
        display: flex;
        justify-content: space-between;
        padding: 20px 0;
        .td {
          font-weight: 400;
          font-size: 16px;
          color: #333333;
          line-height: 24px;
        }
      }
    }
    // 座位
    .seat_box {
      background-color: #fff;
      padding: 0 20px;
      margin-top: 20px;
      .th {
        display: flex;
        justify-content: space-between;
        padding: 20px 0;
        .td {
          font-weight: bold;
          font-size: 16px;
          color: #333333;
          line-height: 24px;
        }
      }
      .tr {
        display: flex;
        justify-content: space-between;
        padding: 20px 0;
        .td {
          font-weight: 400;
          font-size: 16px;
          color: #333333;
          line-height: 24px;
        }
        .flex-col {
          display: flex;
          flex-direction: column;
          gap: 16px;
        }
      }
    }
    // 购票人
    .pay_ticket {
      background-color: #fff;
      padding: 20px;
      margin-top: 20px;
      .title {
        font-weight: bold;
        font-size: 16px;
        color: #333333;
        margin-bottom: 28px;
      }
      .people {
        display: flex;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 15px 50px;
        .p_info {
          font-weight: 400;
          font-size: 16px;
          color: #333333;
          line-height: 24px;
          .idcard {
            color: #999999;
          }
        }
      }
    }
  }
  .right {
    width: 400px;
    .balance {
      background-color: #fff;
      padding: 20px;
      .title {
        font-weight: bold;
        font-size: 20px;
        color: #333333;
        line-height: 30px;
        margin-bottom: 28px;
      }
      .cell {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 20px;
        &:last-child {
          margin: 0;
        }
        .label {
          font-weight: 400;
          font-size: 16px;
          color: #333333;
        }
        .value {
          font-weight: 400;
          font-size: 16px;
          color: #ff8124;
        }
      }
      .btn_box {
        border-top: 1px solid #eee;
        padding-top: 20px;
        display: flex;
        gap: 20px;
        .pay_dis {
          width: 360px;
          height: 40px;
          background: #A09DFF;
          border-radius: 20px;
          font-weight: 500;
          font-size: 16px;
          color: #ffffff;
          line-height: 40px;
          text-align: center;
          cursor: pointer;
        }
        .pay {
          width: 170px;
          height: 40px;
          background: linear-gradient(270deg, #493ceb 0%, #8623fc 100%);
          border-radius: 20px;
          font-weight: 500;
          font-size: 16px;
          color: #ffffff;
          line-height: 40px;
          text-align: center;
          cursor: pointer;
        }
        .can_pay {
          width: 170px;
          height: 40px;
          background: #f6f6f6;
          border-radius: 20px;
          font-weight: 500;
          font-size: 16px;
          color: #999;
          line-height: 40px;
          text-align: center;
          box-sizing: border-box;
          cursor: pointer;
        }
      }
    }
    .tip {
      font-weight: 400;
      font-size: 16px;
      color: #ea3d6b;
      line-height: 24px;
      margin-top: 20px;
      text-align: center;
    }
  }
}
</style>