order-confirm.vue 4.1 KB
<template>
  <view class="page-shell order-confirm-page">
    <view class="page-blur"></view>
    <view class="page-blur-secondary"></view>
    <view class="page-blur-tertiary"></view>

    <view class="page-content subpage-content">
      <view class="subpage-nav">
        <view class="subpage-back" @tap="goBack">‹</view>
        <view class="subpage-title-wrap">
          <text class="subpage-title">确认订单</text>
          <text class="subpage-subtitle">在下单前,再确认一次商品与收货信息</text>
        </view>
      </view>

      <view class="subpage-card address-card" @tap="manageAddress">
        <text class="address-kicker">DELIVERY ADDRESS</text>
        <text class="address-main">{{ address.name }} {{ address.phone }}</text>
        <text class="address-detail">{{ address.full }}</text>
      </view>

      <view class="product-card glass-card">
        <image class="product-image" :src="product.image" mode="aspectFill" />
        <view class="product-copy">
          <text class="product-name">{{ product.name }}</text>
          <text class="product-spec">默认规格 · 1 件</text>
          <text class="product-desc">{{ product.desc }}</text>
          <text class="product-price">¥{{ product.price }}</text>
        </view>
      </view>

      <view class="subpage-card">
        <view class="info-list">
          <view class="info-row">
            <text class="info-label">商品金额</text>
            <text class="info-value">¥{{ product.price }}</text>
          </view>
          <view class="info-row">
            <text class="info-label">配送方式</text>
            <text class="info-value">品牌合作配送</text>
          </view>
          <view class="info-row">
            <text class="info-label">运费</text>
            <text class="info-value">免运费</text>
          </view>
          <view class="info-row">
            <text class="info-label">实付金额</text>
            <text class="info-value accent">¥{{ product.price }}</text>
          </view>
        </view>
      </view>

      <view class="cta-row">
        <view class="secondary-button" @tap="manageAddress">管理地址</view>
        <view class="primary-button" @tap="submitOrder">提交订单</view>
      </view>
    </view>
  </view>
</template>

<script>
import { findProductById } from '@/packageMall/data/products'
import { addresses } from '@/data/mock'

export default {
  data() {
    return {
      product: findProductById(1),
      address: addresses[0]
    }
  },
  onLoad(options) {
    this.product = findProductById(options.productId)
  },
  methods: {
    goBack() {
      uni.navigateBack({ fail: () => uni.redirectTo({ url: `/pages/product-detail/product-detail?id=${this.product.id}` }) })
    },
    manageAddress() {
      uni.navigateTo({ url: '/pages/address-list/address-list' })
    },
    submitOrder() {
      uni.navigateTo({ url: `/pages/payment-success/payment-success?orderId=5001&productId=${this.product.id}` })
    }
  }
}
</script>

<style lang="scss" scoped>
@import '@/styles/mixins.scss';
@import '@/styles/subpage.scss';

.address-card {
  margin-bottom: 24rpx;
}

.address-kicker,
.address-main,
.address-detail {
  display: block;
}

.address-kicker {
  font-size: 20rpx;
  letter-spacing: 4rpx;
  color: rgba(143, 118, 86, 0.82);
}

.address-main {
  margin-top: 16rpx;
  font-size: 30rpx;
  font-weight: 700;
}

.address-detail {
  margin-top: 12rpx;
  font-size: 24rpx;
  line-height: 1.8;
  color: $text-secondary;
}

.product-card {
  display: flex;
  padding: 28rpx;
  margin-bottom: 24rpx;
}

.product-image {
  width: 180rpx;
  height: 180rpx;
  border-radius: 28rpx;
  flex-shrink: 0;
}

.product-copy {
  flex: 1;
  margin-left: 22rpx;
}

.product-name,
.product-spec,
.product-desc,
.product-price {
  display: block;
}

.product-name {
  font-size: 30rpx;
  line-height: 1.5;
  font-weight: 700;
}

.product-spec,
.product-desc {
  margin-top: 12rpx;
  font-size: 24rpx;
  line-height: 1.7;
  color: $text-secondary;
}

.product-price {
  margin-top: 16rpx;
  font-size: 36rpx;
  font-weight: 700;
  color: $brand-primary-deep;
}

.accent {
  color: $brand-primary-deep;
}
</style>