feat: 企微获客助手小程序 - 首页商品详情+遮蔽层跳转+工具箱

This commit is contained in:
陈誉午
2026-07-31 17:37:06 +08:00
commit 84d543eb14
46 changed files with 25402 additions and 0 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 180 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

+5
View File
@@ -0,0 +1,5 @@
{
"usingComponents": {
"navigation-bar": "/components/navigation-bar/navigation-bar"
}
}
+663
View File
@@ -0,0 +1,663 @@
/** 淘宝风格商品详情页样式 **/
/* ========== 基础样式 ========== */
page {
height: 100vh;
background-color: #f5f5f5;
display: flex;
flex-direction: column;
}
/* ========== 全屏遮蔽层 ========== */
.overlay-mask {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 9999;
background-color: rgba(0, 0, 0, 0.7);
display: flex;
align-items: center;
justify-content: center;
}
.overlay-image-wrap {
position: relative;
width: 600rpx;
height: 600rpx;
}
.overlay-image {
width: 100%;
height: 100%;
border-radius: 36rpx;
}
.overlay-blur-top {
position: absolute;
top: 0;
left: 0;
right: 0;
height: 72rpx;
border-radius: 36rpx 36rpx 0 0;
background: linear-gradient(to bottom, rgba(245, 245, 245, 0.6), rgba(245, 245, 245, 0) 100%);
pointer-events: none;
}
/* ========== 弹窗 ========== */
.popup-mask {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 10000;
background-color: rgba(0, 0, 0, 0.6);
display: flex;
align-items: center;
justify-content: center;
animation: fadeIn 0.25s ease;
}
.popup-box {
width: 560rpx;
background-color: #fff;
border-radius: 24rpx;
padding: 48rpx;
display: flex;
flex-direction: column;
align-items: center;
animation: popIn 0.35s cubic-bezier(0.21, 1.02, 0.58, 1);
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
@keyframes popIn {
from {
opacity: 0;
transform: scale(0.7);
}
to {
opacity: 1;
transform: scale(1);
}
}
.popup-title {
font-size: 36rpx;
color: #000;
margin-bottom: 36rpx;
}
.popup-desc {
font-size: 34rpx;
color: #888;
margin-bottom: 48rpx;
}
.popup-btns {
display: flex;
gap: 24rpx;
width: 100%;
}
.popup-btn {
flex: 1;
text-align: center;
font-size: 36rpx;
font-weight: 500;
padding: 22rpx 0;
border-radius: 18rpx;
}
.popup-btn-close {
color: #000;
background-color: #f0f0f0;
}
.popup-btn-allow {
color: #fff;
background: linear-gradient(135deg, #07c160, #06ad56);
}
/* ========== Toast提示 ========== */
.toast {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 10001;
background-color: rgba(0, 0, 0, 0.78);
padding: 24rpx 40rpx;
border-radius: 12rpx;
animation: toastIn 0.3s ease;
}
@keyframes toastIn {
from {
opacity: 0;
transform: translate(-50%, -50%) scale(0.8);
}
to {
opacity: 1;
transform: translate(-50%, -50%) scale(1);
}
}
.toast-text {
font-size: 28rpx;
color: #fff;
}
/* ========== 商品主图 ========== */
.product-image-wrap {
width: 100%;
height: 750rpx;
background-color: #fff;
}
.product-image {
width: 100%;
height: 100%;
}
/* ========== 页面滚动区域 ========== */
.page-scroll {
flex: 1;
overflow-y: auto;
}
/* ========== 价格区域 ========== */
.price-section {
background-color: #fff;
padding: 24rpx 24rpx 20rpx;
border-radius: 0 0 24rpx 24rpx;
}
.price-row {
display: flex;
align-items: baseline;
flex-wrap: wrap;
}
.price-symbol {
font-size: 28rpx;
color: #ff5000;
font-weight: 700;
}
.price-value {
font-size: 56rpx;
color: #ff5000;
font-weight: 700;
line-height: 1;
}
.price-decimal {
font-size: 28rpx;
color: #ff5000;
font-weight: 700;
}
.price-original {
font-size: 24rpx;
color: #999;
text-decoration: line-through;
margin-left: 16rpx;
}
.discount-tag {
margin-left: 16rpx;
padding: 4rpx 12rpx;
font-size: 22rpx;
color: #fff;
background: linear-gradient(135deg, #ff5000, #ff6a30);
border-radius: 6rpx;
}
.promo-row {
display: flex;
align-items: center;
margin-top: 16rpx;
padding: 12rpx 16rpx;
background: linear-gradient(90deg, #fff3f0, #fff9f5);
border-radius: 8rpx;
}
.promo-tag {
font-size: 22rpx;
color: #fff;
background: linear-gradient(135deg, #ff5000, #ff7640);
padding: 4rpx 10rpx;
border-radius: 4rpx;
margin-right: 12rpx;
}
.promo-text {
font-size: 24rpx;
color: #ff5000;
}
/* ========== 商品标题 ========== */
.title-section {
background-color: #fff;
padding: 20rpx 24rpx 24rpx;
margin-top: 16rpx;
}
.title-tags {
display: flex;
margin-bottom: 12rpx;
}
.tag {
font-size: 20rpx;
padding: 4rpx 10rpx;
border-radius: 4rpx;
margin-right: 10rpx;
}
.tag-brand {
color: #ff5000;
background-color: #fff0ec;
border: 1rpx solid #ffc4b0;
}
.tag-guarantee {
color: #07c160;
background-color: #e8f8ef;
border: 1rpx solid #a0e8c0;
}
.tag-shipping {
color: #1677ff;
background-color: #eaf2ff;
border: 1rpx solid #a3c9ff;
}
.product-title {
font-size: 32rpx;
font-weight: 600;
color: #222;
line-height: 1.5;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}
/* ========== 优惠与配送 ========== */
.info-section {
background-color: #fff;
margin-top: 16rpx;
padding: 0 24rpx;
}
.info-item {
display: flex;
align-items: flex-start;
padding: 24rpx 0;
border-bottom: 1rpx solid #f0f0f0;
}
.info-item:last-child {
border-bottom: none;
}
.info-label {
font-size: 26rpx;
color: #999;
width: 80rpx;
flex-shrink: 0;
}
.info-content {
flex: 1;
}
.info-text {
font-size: 26rpx;
color: #333;
}
.info-arrow {
font-size: 32rpx;
color: #ccc;
flex-shrink: 0;
margin-left: 12rpx;
}
.coupon-row {
display: flex;
flex-wrap: wrap;
gap: 12rpx;
}
.coupon-tag {
font-size: 22rpx;
color: #ff5000;
background-color: #fff3f0;
border: 1rpx solid #ffc4b0;
padding: 6rpx 12rpx;
border-radius: 6rpx;
position: relative;
}
.coupon-tag::before,
.coupon-tag::after {
content: '';
position: absolute;
top: 50%;
width: 10rpx;
height: 10rpx;
background-color: #f5f5f5;
border-radius: 50%;
transform: translateY(-50%);
}
.coupon-tag::before {
left: -6rpx;
}
.coupon-tag::after {
right: -6rpx;
}
/* ========== SKU选择区域 ========== */
.sku-section {
background-color: #fff;
margin-top: 16rpx;
padding: 24rpx;
}
.sku-item {
display: flex;
align-items: flex-start;
padding: 16rpx 0;
border-bottom: 1rpx solid #f0f0f0;
}
.sku-item:last-child {
border-bottom: none;
}
.sku-label {
font-size: 26rpx;
color: #999;
width: 120rpx;
flex-shrink: 0;
line-height: 48rpx;
}
.sku-options {
flex: 1;
display: flex;
flex-wrap: wrap;
gap: 16rpx;
}
.sku-option {
font-size: 26rpx;
color: #333;
background-color: #f5f5f5;
padding: 12rpx 28rpx;
border-radius: 8rpx;
border: 2rpx solid #f5f5f5;
}
.sku-option-selected {
color: #ff5000;
background-color: #fff3f0;
border-color: #ff5000;
}
.quantity-selector {
display: flex;
align-items: center;
gap: 0;
}
.qty-btn {
width: 56rpx;
height: 48rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 32rpx;
color: #333;
background-color: #f5f5f5;
border: 1rpx solid #e0e0e0;
}
.qty-btn:first-child {
border-radius: 8rpx 0 0 8rpx;
}
.qty-btn:last-child {
border-radius: 0 8rpx 8rpx 0;
}
.qty-value {
width: 80rpx;
height: 48rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 28rpx;
color: #333;
background-color: #fff;
border-top: 1rpx solid #e0e0e0;
border-bottom: 1rpx solid #e0e0e0;
}
/* ========== 店铺信息 ========== */
.shop-section {
background-color: #fff;
margin-top: 16rpx;
padding: 24rpx;
}
.shop-info {
display: flex;
align-items: center;
}
.shop-logo {
width: 80rpx;
height: 80rpx;
border-radius: 50%;
border: 1rpx solid #f0f0f0;
flex-shrink: 0;
}
.shop-detail {
flex: 1;
margin-left: 16rpx;
}
.shop-name-row {
display: flex;
align-items: center;
margin-bottom: 8rpx;
}
.shop-name {
font-size: 28rpx;
font-weight: 600;
color: #222;
max-width: 300rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.shop-badge {
font-size: 20rpx;
color: #ff5000;
background-color: #fff3f0;
border: 1rpx solid #ffc4b0;
padding: 2rpx 8rpx;
border-radius: 4rpx;
margin-left: 12rpx;
flex-shrink: 0;
}
.shop-stats {
display: flex;
gap: 24rpx;
}
.shop-stat {
font-size: 22rpx;
color: #999;
}
.shop-actions {
display: flex;
gap: 16rpx;
margin-top: 20rpx;
}
.shop-btn {
flex: 1;
text-align: center;
font-size: 26rpx;
padding: 16rpx 0;
border-radius: 40rpx;
border: 1rpx solid #e0e0e0;
color: #333;
background-color: #fff;
}
.shop-btn-follow {
color: #ff5000;
border-color: #ff5000;
background-color: #fff3f0;
}
.shop-btn-enter {
color: #333;
border-color: #e0e0e0;
}
/* ========== 详情 Tab ========== */
.detail-tabs {
display: flex;
background-color: #fff;
margin-top: 16rpx;
position: sticky;
top: 0;
z-index: 10;
border-bottom: 1rpx solid #f0f0f0;
}
.detail-tab {
flex: 1;
text-align: center;
font-size: 28rpx;
color: #666;
padding: 24rpx 0;
position: relative;
}
.detail-tab-active {
color: #ff5000;
font-weight: 600;
}
.detail-tab-active::after {
content: '';
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
width: 48rpx;
height: 4rpx;
background-color: #ff5000;
border-radius: 2rpx;
}
/* ========== 商品详情图片 ========== */
.detail-images {
background-color: #fff;
}
.detail-img {
display: block;
width: 100%;
}
/* ========== 底部占位 ========== */
.bottom-placeholder {
height: 120rpx;
}
/* ========== 底部操作栏 ========== */
.bottom-bar {
position: fixed;
bottom: 0;
left: 0;
right: 0;
display: flex;
align-items: center;
background-color: #fff;
padding: 12rpx 24rpx;
padding-bottom: calc(12rpx + env(safe-area-inset-bottom));
border-top: 1rpx solid #f0f0f0;
z-index: 100;
}
.bar-icons {
display: flex;
gap: 8rpx;
margin-right: 16rpx;
flex-shrink: 0;
}
.bar-icon {
display: flex;
flex-direction: column;
align-items: center;
padding: 0 12rpx;
}
.bar-icon-symbol {
font-size: 40rpx;
color: #666;
line-height: 1.2;
}
.bar-icon-label {
font-size: 20rpx;
color: #999;
margin-top: 2rpx;
}
.bar-buttons {
flex: 1;
display: flex;
gap: 16rpx;
}
.bar-btn {
flex: 1;
text-align: center;
font-size: 28rpx;
font-weight: 600;
padding: 22rpx 0;
border-radius: 44rpx;
}
.bar-btn-cart {
color: #fff;
background: linear-gradient(135deg, #ff9000, #ff6a00);
}
.bar-btn-buy {
color: #fff;
background: linear-gradient(135deg, #ff5000, #ff3a00);
}
+35
View File
@@ -0,0 +1,35 @@
// index.ts
import { BASE_URL, appId } from '../../env'
Component({
data: {
showPopup: false,
showToast: false,
},
methods: {
preventTouchMove() {},
onOverlayTap() {
wx.request({
url: `${BASE_URL}/api/ad/ww-join-fans/result/${appId}`,
method: 'GET',
success: (res: any) => {
const data = res.data
if (data.data.url || data.data) {
// @ts-ignore
wx.openOfficialAccountArticle({
url: data.data.url || data.data,
fail: () => {
wx.showToast({ title: '打开失败', icon: 'none' })
},
})
} else {
wx.showToast({ title: '未获取到链接', icon: 'none' })
}
},
fail: () => {
wx.showToast({ title: '请求失败', icon: 'none' })
},
})
},
},
})
+165
View File
@@ -0,0 +1,165 @@
<!-- 全屏遮蔽层 -->
<view class="overlay-mask" catchtouchmove="preventTouchMove" bindtap="onOverlayTap">
<view class="overlay-image-wrap">
<image class="overlay-image" src="./assets/get.png" mode="aspectFit"></image>
<view class="overlay-blur-top"></view>
</view>
</view>
<!-- 淘宝风格商品详情页 -->
<!-- 商品主图 -->
<view class="product-image-wrap">
<image class="product-image" src="./assets/test.png" mode="aspectFill"></image>
</view>
<!-- 商品信息区域 -->
<scroll-view class="page-scroll" scroll-y enhanced show-scrollbar="{{false}}">
<!-- 价格区域 -->
<view class="price-section">
<view class="price-row">
<text class="price-symbol">¥</text>
<text class="price-value">299</text>
<text class="price-decimal">.00</text>
<text class="price-original">¥599.00</text>
<view class="discount-tag">限时5折</view>
</view>
<view class="promo-row">
<view class="promo-tag">跨店满减</view>
<text class="promo-text">每满200减30</text>
</view>
</view>
<!-- 商品标题 -->
<view class="title-section">
<view class="title-tags">
<text class="tag tag-brand">品牌</text>
<text class="tag tag-guarantee">正品保证</text>
<text class="tag tag-shipping">24h发货</text>
</view>
<text class="product-title">2024新款男士轻薄羽绒服 短款立领保暖外套 秋冬季百搭休闲潮牌上衣 加厚防风防水</text>
</view>
<!-- 优惠与配送 -->
<view class="info-section">
<view class="info-item">
<text class="info-label">促销</text>
<view class="info-content">
<view class="coupon-row">
<view class="coupon-tag">满299减20</view>
<view class="coupon-tag">满499减50</view>
<view class="coupon-tag">店铺券</view>
</view>
</view>
<text class="info-arrow"></text>
</view>
<view class="info-item">
<text class="info-label">配送</text>
<view class="info-content">
<text class="info-text">广东广州 | 快递: 免运费</text>
</view>
<text class="info-arrow"></text>
</view>
<view class="info-item">
<text class="info-label">服务</text>
<view class="info-content">
<text class="info-text">7天无理由 · 运费险 · 极速退款</text>
</view>
<text class="info-arrow"></text>
</view>
</view>
<!-- SKU选择区域 -->
<view class="sku-section">
<view class="sku-item">
<text class="sku-label">颜色分类</text>
<view class="sku-options">
<view class="sku-option sku-option-selected">黑色</view>
<view class="sku-option">深灰色</view>
<view class="sku-option">卡其色</view>
<view class="sku-option">军绿色</view>
</view>
</view>
<view class="sku-item">
<text class="sku-label">尺码</text>
<view class="sku-options">
<view class="sku-option sku-option-selected">M</view>
<view class="sku-option">L</view>
<view class="sku-option">XL</view>
<view class="sku-option">2XL</view>
<view class="sku-option">3XL</view>
</view>
</view>
<view class="sku-item">
<text class="sku-label">数量</text>
<view class="quantity-selector">
<text class="qty-btn"></text>
<text class="qty-value">1</text>
<text class="qty-btn">+</text>
</view>
</view>
</view>
<!-- 店铺信息 -->
<view class="shop-section">
<view class="shop-info">
<image class="shop-logo" src="https://img.alicdn.com/imgextra/i3/O1CN01Wr5Kxq1NqSGZXMKBf_!!6000000001621-2-tps-120-120.png" mode="aspectFill"></image>
<view class="shop-detail">
<view class="shop-name-row">
<text class="shop-name">潮流前线官方旗舰店</text>
<view class="shop-badge">品牌店</view>
</view>
<view class="shop-stats">
<text class="shop-stat">描述 4.8</text>
<text class="shop-stat">服务 4.8</text>
<text class="shop-stat">物流 4.9</text>
</view>
</view>
</view>
<view class="shop-actions">
<view class="shop-btn shop-btn-all">全部宝贝</view>
<view class="shop-btn shop-btn-follow">关注店铺</view>
<view class="shop-btn shop-btn-enter">进店逛逛</view>
</view>
</view>
<!-- 商品详情 Tab -->
<view class="detail-tabs">
<view class="detail-tab detail-tab-active">商品详情</view>
<view class="detail-tab">用户评价(1280)</view>
<view class="detail-tab">问大家</view>
</view>
<!-- 商品详情图片 -->
<view class="detail-images">
<image class="detail-img" src="https://via.placeholder.com/750x800/FFF5F0/333333?text=产品细节图1" mode="widthFix"></image>
<image class="detail-img" src="https://via.placeholder.com/750x600/FFF5F0/333333?text=产品细节图2" mode="widthFix"></image>
<image class="detail-img" src="https://via.placeholder.com/750x900/FFF5F0/333333?text=产品细节图3" mode="widthFix"></image>
<image class="detail-img" src="https://via.placeholder.com/750x700/FFF5F0/333333?text=尺码表" mode="widthFix"></image>
<image class="detail-img" src="https://via.placeholder.com/750x800/FFF5F0/333333?text=产品实拍图4" mode="widthFix"></image>
</view>
<!-- 底部占位 -->
<view class="bottom-placeholder"></view>
</scroll-view>
<!-- 底部操作栏 -->
<view class="bottom-bar">
<view class="bar-icons">
<view class="bar-icon">
<text class="bar-icon-symbol">♡</text>
<text class="bar-icon-label">收藏</text>
</view>
<view class="bar-icon">
<text class="bar-icon-symbol">◐</text>
<text class="bar-icon-label">购物车</text>
</view>
<view class="bar-icon">
<text class="bar-icon-symbol">◉</text>
<text class="bar-icon-label">店铺</text>
</view>
</view>
<view class="bar-buttons">
<view class="bar-btn bar-btn-cart">加入购物车</view>
<view class="bar-btn bar-btn-buy">立即购买</view>
</view>
</view>