All files / src/pages/checkout CheckoutPage.vue

0% Statements 0/8
0% Branches 0/10
0% Functions 0/4
0% Lines 0/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129                                                                                                                                                                                                                                                                 
<script setup lang="ts">
import { computed } from "vue";
import { RouterLink, useRouter } from "vue-router";
 
import { PjPageContainer } from "@plain-journal/ui";
 
import {
  CheckoutWorkspace,
  type CheckoutAccessContext,
} from "../../features/checkout";
import { useSessionStore } from "../../features/customer-session";
 
const session = useSessionStore();
const router = useRouter();
const checkoutAccess = computed<CheckoutAccessContext>(() => ({
  authenticated: session.authenticated,
  ownerId: session.profile?.id ?? null,
  accessToken: session.accessToken,
}));
 
async function openOrder(orderNo: string) {
  await router.push({
    name: "order-detail",
    params: { orderNo },
  });
}
</script>
 
<template>
  <PjPageContainer as="section" class="checkout-page-shell">
    <nav class="content-path" aria-label="当前位置">
      <RouterLink to="/bag">购物袋</RouterLink>
      <span aria-hidden="true">/</span>
      <span>订单确认</span>
    </nav>
 
    <header class="checkout-intro">
      <div class="checkout-intro__copy">
        <p>提交前核对</p>
        <h1>订单确认</h1>
        <p>
          地址、商品和优惠先组成草稿;实时价格、库存与权益资格核对完成后才能提交。
        </p>
      </div>
      <p class="checkout-intro__sequence">
        <strong>草稿</strong>
        <span aria-hidden="true">→</span>
        <strong>权威核对</strong>
        <span aria-hidden="true">→</span>
        <strong>订单事实</strong>
      </p>
    </header>
 
    <CheckoutWorkspace
      :access="checkoutAccess"
      @order-confirmed="openOrder"
    />
  </PjPageContainer>
</template>
 
<style scoped>
.checkout-page-shell {
  padding-block: var(--pj-space-6) var(--pj-space-8);
}
 
.checkout-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: var(--pj-space-7);
  margin-bottom: var(--pj-space-7);
}
 
.checkout-intro__copy {
  max-width: var(--pj-layout-reading);
}
 
.checkout-intro__copy > p:first-child {
  margin: 0 0 var(--pj-space-3);
  color: var(--pj-text-secondary);
  font-size: var(--pj-font-size-xs);
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
 
.checkout-intro h1 {
  margin: 0;
  font-size: clamp(2.4rem, 5vw, 5rem);
  font-weight: 520;
  letter-spacing: -0.055em;
  line-height: 0.98;
}
 
.checkout-intro__copy > p:last-child {
  margin: var(--pj-space-4) 0 0;
  color: var(--pj-text-secondary);
}
 
.checkout-intro__sequence {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--pj-space-2);
  max-width: 24rem;
  margin: 0;
  color: var(--pj-text-secondary);
  font-size: var(--pj-font-size-sm);
}
 
.checkout-intro__sequence strong {
  color: var(--pj-text-primary);
  font-weight: 550;
}
 
@media (max-width: 48rem) {
  .checkout-intro {
    grid-template-columns: 1fr;
    align-items: start;
    gap: var(--pj-space-4);
  }
 
  .checkout-intro__sequence {
    justify-content: flex-start;
  }
}
</style>