pickup-code.vue 6.13 KB
<template>
  <view class="page-shell pickup-code-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-hero glass-card">
        <text class="hero-kicker">{{ order.status }}</text>
        <text class="hero-title">{{ order.title }}</text>
        <text class="hero-desc">订单编号 {{ order.orderNo }} · 二维码核销自提</text>
      </view>

      <lf-pickup-code
        v-if="!verifyUsed"
        :code="order.verifyCode"
        :used="verifyUsed"
        :desc="verifyDesc"
      />

      <lf-pickup-complete
        v-else
        title="该订单已完成核销"
        desc="门店已完成核销与自提,本页不再展示二维码,可继续查看商品与核销记录。"
        :status="order.status"
        :time="order.pickupTime || order.verifyTime"
      />

      <view class="product-card glass-card">
        <view class="product-art">
          <view class="product-art-ring"></view>
          <text class="product-art-label">{{ shortLabel(order.title) }}</text>
        </view>
        <view class="product-copy">
          <text class="product-name">{{ order.title }}</text>
          <text class="product-spec">{{ order.collection }} · {{ order.sku }}</text>
          <text class="product-qty">数量 {{ order.quantity }} 件</text>
          <text class="product-amount">实付 ¥{{ order.amount }}</text>
        </view>
      </view>

      <view class="subpage-card">
        <view class="section-head">
          <text class="section-title">核销信息</text>
          <text class="section-link">门店自提</text>
        </view>
        <view class="info-list">
          <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">二维码核销自提</text>
          </view>
          <view class="info-row">
            <text class="info-label">核销码</text>
            <text class="info-value">{{ order.verifyCode }}</text>
          </view>
          <view v-if="order.verifyExpire" class="info-row">
            <text class="info-label">有效期</text>
            <text class="info-value">{{ order.verifyExpire }}</text>
          </view>
          <view v-if="order.pickupTime" class="info-row">
            <text class="info-label">自提完成</text>
            <text class="info-value">{{ order.pickupTime }}</text>
          </view>
        </view>
      </view>

      <view class="cta-row">
        <view class="secondary-button" @tap="contactStore">联系客服</view>
        <view class="primary-button" @tap="goOrderDetail">返回订单</view>
      </view>
    </view>
  </view>
</template>

<script>
import { getDisplayOrderById } from '@/packageMall/data/orderFlow'

export default {
  data() {
    return {
      order: getDisplayOrderById(5001)
    }
  },
  computed: {
    verifyUsed() {
      return this.order.statusKey === 'pickup'
    },
    verifyDesc() {
      if (this.verifyUsed) {
        return `门店已完成核销与自提${this.order.pickupTime ? ` · ${this.order.pickupTime}` : ''}`
      }
      return '到店出示核销码即可核销自提,支持任意时间任意门店使用。'
    }
  },
  onLoad(options) {
    this.order = getDisplayOrderById(options.id)
  },
  methods: {
    shortLabel(title) {
      return String(title || '绿纤').replace(/\s+/g, '').slice(0, 2)
    },
    goBack() {
      uni.navigateBack({ fail: () => this.goOrderDetail() })
    },
    goOrderDetail() {
      uni.redirectTo({ url: `/packageProfile/order-detail/order-detail?id=${this.order.id}` })
    },
    contactStore() {
      if (!this.order.pickupPhone) {
        uni.showToast({ title: '已为您接入专属客服', icon: 'none' })
        return
      }
      uni.showToast({ title: '已为您接入专属客服', icon: 'none' })
    }
  }
}
</script>

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

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

.product-art {
  width: 180rpx;
  height: 180rpx;
  border-radius: 28rpx;
  flex-shrink: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(241, 246, 241, 0.96);
  border: 1rpx solid rgba(120, 146, 121, 0.14);
  box-shadow: inset 0 1rpx 0 rgba(255, 255, 255, 0.65);
  overflow: hidden;
}

.product-art-ring {
  width: 96rpx;
  height: 96rpx;
  border-radius: 50%;
  border: 1rpx solid rgba(120, 146, 121, 0.18);
  background: rgba(255, 255, 255, 0.45);
  animation: lfPulseSoft 5.2s ease-in-out infinite;
}

.product-art-label {
  position: absolute;
  font-size: 24rpx;
  letter-spacing: 4rpx;
  color: $brand-primary-deep;
  font-weight: 600;
}

.product-art::before {
  content: '';
  position: absolute;
  right: -30rpx;
  top: -30rpx;
  width: 120rpx;
  height: 120rpx;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(210, 191, 156, 0.22), rgba(210, 191, 156, 0));
  animation: lfFloatSoft 9.8s ease-in-out infinite;
}

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

.product-name,
.product-spec,
.product-qty,
.product-amount {
  display: block;
}

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

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

.product-amount {
  margin-top: 18rpx;
  font-size: 34rpx;
  font-weight: 700;
  color: $brand-primary-deep;
}
</style>