import React from 'react';
// Taro mini-program - Coupon Detail + Purchase

/**
 * E1. 小程序核心页面 - 券详情 + 购买
 *
 * 同App，微信支付/支付宝支付
 */

const DetailPage: React.FC = () => {
  return (
    <view className="detail-page">
      {/* Coupon Image */}
      <view className="detail-hero">
        <view className="detail-hero-bg">
          <text className="hero-icon">🎫</text>
        </view>
      </view>

      {/* Main Info */}
      <view className="detail-info">
        <view className="brand-row">
          <view className="brand-logo">S</view>
          <view className="brand-info">
            <text className="brand-name">Starbucks</text>
            <view className="credit-badge">
              <text className="credit-text">AAA</text>
            </view>
          </view>
        </view>
        <text className="coupon-title">星巴克 ¥25 礼品卡</text>

        {/* Price */}
        <view className="price-card">
          <view className="price-row">
            <text className="price-symbol">¥</text>
            <text className="price-value">21.25</text>
            <text className="price-original">¥25</text>
            <view className="discount-tag">8.5折</view>
          </view>
          <text className="price-save">比面值节省 ¥3.75</text>
        </view>

        {/* Info List */}
        <view className="info-card">
          {[
            { label: '面值', value: '¥25.00' },
            { label: '有效期', value: '2026/12/31' },
            { label: '类型', value: '消费券' },
            { label: '使用门店', value: '全国 12,800+ 门店' },
          ].map((item, i) => (
            <view key={i} className="info-row">
              <text className="info-label">{item.label}</text>
              <text className="info-value">{item.value}</text>
            </view>
          ))}
        </view>

        {/* Rules */}
        <view className="rules-card">
          <text className="rules-title">使用说明</text>
          {[
            '全国星巴克门店通用',
            '可转赠给好友',
            '有效期内随时使用',
            '不可叠加使用',
          ].map((rule, i) => (
            <view key={i} className="rule-item">
              <text className="rule-dot">•</text>
              <text className="rule-text">{rule}</text>
            </view>
          ))}
        </view>

        {/* Utility Track Notice */}
        <view className="utility-notice">
          <text className="utility-icon">✓</text>
          <text className="utility-text">您正在购买消费券用于消费</text>
        </view>
      </view>

      {/* Bottom Buy Bar */}
      <view className="buy-bar">
        <view className="buy-bar-price">
          <text className="buy-label">合计</text>
          <text className="buy-price">¥21.25</text>
        </view>
        <view className="buy-button">
          <text className="buy-button-text">立即购买</text>
        </view>
      </view>
    </view>
  );
};

export default DetailPage;

/*
CSS (index.scss):

.detail-page { padding-bottom: 140rpx; background: #F8F9FC; }

.detail-hero { height: 400rpx; }
.detail-hero-bg {
  height: 100%; background: linear-gradient(135deg, #6C5CE7, #9B8FFF);
  display: flex; align-items: center; justify-content: center;
}
.hero-icon { font-size: 120rpx; opacity: 0.3; }

.detail-info { margin-top: -40rpx; position: relative; z-index: 1; padding: 0 32rpx; }

.brand-row {
  display: flex; align-items: center;
  background: white; border-radius: 24rpx; padding: 24rpx;
  box-shadow: 0 4rpx 16rpx rgba(0,0,0,0.06);
}
.brand-logo {
  width: 64rpx; height: 64rpx; border-radius: 12rpx;
  background: #F1F3F8; display: flex; align-items: center; justify-content: center;
  font-size: 28rpx; font-weight: 700; color: #6C5CE7;
}
.brand-info { margin-left: 16rpx; display: flex; align-items: center; gap: 12rpx; }
.brand-name { font-size: 28rpx; color: #5C6478; }
.credit-badge {
  padding: 2rpx 12rpx; background: rgba(0,196,140,0.1);
  border: 1rpx solid rgba(0,196,140,0.3); border-radius: 999rpx;
}
.credit-text { font-size: 20rpx; color: #00C48C; font-weight: 700; }

.coupon-title {
  display: block; font-size: 36rpx; font-weight: 600; color: #141723;
  margin-top: 20rpx; margin-bottom: 16rpx;
}

.price-card {
  background: #F3F1FF; border-radius: 16rpx; padding: 24rpx; margin-bottom: 16rpx;
}
.price-row { display: flex; align-items: flex-end; }
.price-symbol { font-size: 28rpx; font-weight: 700; color: #6C5CE7; }
.price-value { font-size: 52rpx; font-weight: 700; color: #6C5CE7; line-height: 1; }
.price-original { font-size: 24rpx; color: #A0A8BE; text-decoration: line-through; margin-left: 12rpx; }
.discount-tag {
  margin-left: 12rpx; padding: 4rpx 12rpx;
  background: linear-gradient(135deg, #6C5CE7, #9B8FFF);
  color: white; font-size: 20rpx; font-weight: 700; border-radius: 999rpx;
}
.price-save { font-size: 22rpx; color: #00C48C; margin-top: 8rpx; }

.info-card {
  background: white; border-radius: 16rpx; padding: 24rpx; margin-bottom: 16rpx;
  border: 1rpx solid #F1F3F8;
}
.info-row {
  display: flex; justify-content: space-between; padding: 14rpx 0;
  border-bottom: 1rpx solid #F1F3F8;
}
.info-row:last-child { border-bottom: none; }
.info-label { font-size: 26rpx; color: #5C6478; }
.info-value { font-size: 26rpx; color: #141723; font-weight: 500; }

.rules-card {
  background: white; border-radius: 16rpx; padding: 24rpx; margin-bottom: 16rpx;
  border: 1rpx solid #F1F3F8;
}
.rules-title { font-size: 28rpx; font-weight: 500; margin-bottom: 16rpx; }
.rule-item { display: flex; align-items: center; margin-bottom: 12rpx; }
.rule-dot { color: #A0A8BE; margin-right: 12rpx; }
.rule-text { font-size: 24rpx; color: #5C6478; }

.utility-notice {
  display: flex; align-items: center; padding: 16rpx 24rpx;
  background: #E6FAF3; border-radius: 12rpx;
}
.utility-icon { color: #00C48C; margin-right: 12rpx; font-weight: 700; }
.utility-text { font-size: 24rpx; color: #3D4459; }

.buy-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 20rpx 32rpx; padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
  background: white; border-top: 1rpx solid #F1F3F8;
}
.buy-bar-price { display: flex; flex-direction: column; }
.buy-label { font-size: 22rpx; color: #A0A8BE; }
.buy-price { font-size: 40rpx; font-weight: 700; color: #6C5CE7; }
.buy-button {
  padding: 20rpx 48rpx; background: #6C5CE7; border-radius: 16rpx;
}
.buy-button-text { color: white; font-size: 30rpx; font-weight: 600; }
*/
