|
|
@@ -0,0 +1,332 @@
|
|
|
+<template>
|
|
|
+ <view class="detail-page">
|
|
|
+ <!-- Top Background -->
|
|
|
+ <view class="header-bg"></view>
|
|
|
+
|
|
|
+ <!-- Custom Navbar -->
|
|
|
+ <Navbar title="非暴力沟通" :titleSize="32" title-color="#fff" back-icon-color="#fff" background="transparent">
|
|
|
+ </Navbar>
|
|
|
+
|
|
|
+ <!-- Notification Bar -->
|
|
|
+ <view class="notification-bar">
|
|
|
+ <u-avatar size="40" src="https://img.yzcdn.cn/vant/cat.jpeg"></u-avatar>
|
|
|
+
|
|
|
+ <text class="notif-text">微 ** 用户 购买了 《苏菲的世界》</text>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <view class="content-scroll">
|
|
|
+ <!-- Book Cover Area -->
|
|
|
+ <view class="cover-area">
|
|
|
+ <image class="book-cover" :src="product.cover" mode="aspectFit"></image>
|
|
|
+ <view class="share-btn">
|
|
|
+ <image src="/pages-sell/static/goods/icon-share.png" class="share-icon"></image>
|
|
|
+ <text>分享</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <!-- Product Info Card -->
|
|
|
+ <InfoCard :product="product"></InfoCard>
|
|
|
+
|
|
|
+ <!-- Banner -->
|
|
|
+ <view class="banner-area">
|
|
|
+ <image src="/pages-sell/static/top-banner.png" class="banner-img" mode="widthFix"></image>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <!-- Service Info -->
|
|
|
+ <ServiceCard @click="showServicePopup"></ServiceCard>
|
|
|
+
|
|
|
+ <!-- Customer Service Float -->
|
|
|
+ <FloatingDrag :width="120" :height="120" :initial-position="servicePosition"
|
|
|
+ @position-change="handlePositionChange" :z-index="20">
|
|
|
+ <!-- #ifdef MP-ALIPAY -->
|
|
|
+ <button class="service-btn" @click="navigateToCustomerService">
|
|
|
+ <image src="/pages-sell/static/goods/icon-kefu.png" class="cs-icon" style="width: 100rpx;" mode="widthFix"></image>
|
|
|
+ </button>
|
|
|
+ <!-- #endif -->
|
|
|
+ <!-- #ifndef MP-ALIPAY -->
|
|
|
+ <button class="service-btn" open-type="contact">
|
|
|
+ <image src="/pages-sell/static/goods/icon-kefu.png" class="cs-icon" style="width: 100rpx" mode="widthFix"></image>
|
|
|
+ </button>
|
|
|
+ <!-- #endif -->
|
|
|
+ </FloatingDrag>
|
|
|
+
|
|
|
+ <!-- Tabs -->
|
|
|
+ <view class="tabs-header">
|
|
|
+ <view class="tab-item" :class="{ active: currentTab === 0 }" @click="switchTab(0)">
|
|
|
+ <text>商品详情</text>
|
|
|
+ <view class="indicator" v-if="currentTab === 0"></view>
|
|
|
+ </view>
|
|
|
+ <view class="tab-item" :class="{ active: currentTab === 1 }" @click="switchTab(1)">
|
|
|
+ <text>相关推荐</text>
|
|
|
+ <view class="indicator" v-if="currentTab === 1"></view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <!-- Product Detail Content -->
|
|
|
+ <ProductContent
|
|
|
+ :currentTab="currentTab"
|
|
|
+ :product="product"
|
|
|
+ :tipsContent="tipsContent"
|
|
|
+ :relatedBooksList="relatedBooksList"
|
|
|
+ @bookClick="onBookClick">
|
|
|
+ </ProductContent>
|
|
|
+
|
|
|
+ <u-gap height="220"></u-gap>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <!-- Footer -->
|
|
|
+ <FooterBar :hasStock="hasStock" @addCart="openSelectPopup" @notify="handleNotify"></FooterBar>
|
|
|
+
|
|
|
+ <!-- Select Popup -->
|
|
|
+ <SelectGoodPopup ref="selectPopup" @confirm="onPopupConfirm"></SelectGoodPopup>
|
|
|
+ </view>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import Navbar from '@/components/navbar/navbar.vue'
|
|
|
+import SelectGoodPopup from '../components/select-good-popup/index.vue'
|
|
|
+import InfoCard from '../components/detail/info-card.vue'
|
|
|
+import ServiceCard from '../components/detail/service-card.vue'
|
|
|
+import ProductContent from '../components/detail/product-content.vue'
|
|
|
+import FooterBar from '../components/detail/footer-bar.vue'
|
|
|
+import FloatingDrag from "@/components/floating-drag.vue";
|
|
|
+
|
|
|
+export default {
|
|
|
+ components: {
|
|
|
+ Navbar,
|
|
|
+ SelectGoodPopup,
|
|
|
+ InfoCard,
|
|
|
+ ServiceCard,
|
|
|
+ ProductContent,
|
|
|
+ FooterBar,
|
|
|
+ FloatingDrag
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ currentTab: 0,
|
|
|
+ hasStock: true, // Toggle this to test stock status
|
|
|
+ tipsContent: [
|
|
|
+ '印刷版次较多,二手图书封面、版次、原价等信息可能与商品介绍有差异,具体以收到实物为准;',
|
|
|
+ '二手图书性质特殊,不保证随新书赠送的光盘、海报、卡片等内容,仅支持图书质量问题退款,否则将扣除运费成本;',
|
|
|
+ '收到的图书如有质量问题,请于七天内联系客服处理,超出售后时效,不予处理。'
|
|
|
+ ],
|
|
|
+ relatedBooksList: [
|
|
|
+ { title: '工程数学线性代数第六版', edition: '同济大学数学系编', cover: 'https://img.yzcdn.cn/vant/cat.jpeg' },
|
|
|
+ { title: '高等数学第七版(上册)', edition: '同济大学数学系', cover: 'https://img.yzcdn.cn/vant/cat.jpeg' },
|
|
|
+ { title: 'C++ Primer Plus', edition: '第6版 中文版', cover: 'https://img.yzcdn.cn/vant/cat.jpeg' },
|
|
|
+ { title: '深入理解计算机系统', edition: '原书第3版', cover: 'https://img.yzcdn.cn/vant/cat.jpeg' },
|
|
|
+ { title: '算法导论', edition: '原书第3版', cover: 'https://img.yzcdn.cn/vant/cat.jpeg' },
|
|
|
+ { title: 'Java编程思想', edition: '第4版', cover: 'https://img.yzcdn.cn/vant/cat.jpeg' }
|
|
|
+ ],
|
|
|
+ product: {
|
|
|
+ id: 1,
|
|
|
+ title: '非暴力沟通',
|
|
|
+ author: '美 · 马歇尔 XXXX',
|
|
|
+ authorFull: '马歇尔·卢森堡著 阮胤华',
|
|
|
+ price: '13.80',
|
|
|
+ balancePrice: '6.8',
|
|
|
+ originalPrice: '36.80',
|
|
|
+ cover: 'https://img.yzcdn.cn/vant/cat.jpeg', // Using placeholder for now
|
|
|
+ publisher: '华夏出版社',
|
|
|
+ publishDate: '2018-08',
|
|
|
+ isbn: '9787508095226',
|
|
|
+ intro: '作为一个遵纪守法的好人,也许我们从来没有把谈话和“暴力”扯上关系。不过如果稍微留意一下现实生活中的谈话方式,并且用心体会各种谈话方式给我们的不同感受,我们一定会发现,有些话确实伤人!言语上的指责、嘲讽、否定、说教以及任意打断、拒不回应、随意出口的评价和结论给我们带来的情感和精神上的创伤甚至比肉体的伤害更加令人痛苦。',
|
|
|
+ catalog: '前言\n第一章 让爱融入生活\n第二章 是什么蒙蔽了爱?\n第三章 区分观察和评论\n第四章 体会和表达感受\n第五章 感受的根源\n第六章 请求帮助\n...'
|
|
|
+ },
|
|
|
+ servicePosition: {
|
|
|
+ left: "auto",
|
|
|
+ right: 0,
|
|
|
+ bottom: "300rpx",
|
|
|
+ },
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ switchTab(index) {
|
|
|
+ this.currentTab = index;
|
|
|
+ },
|
|
|
+ openSelectPopup() {
|
|
|
+ this.$refs.selectPopup.open(this.product);
|
|
|
+ },
|
|
|
+ handleNotify() {
|
|
|
+ uni.showToast({
|
|
|
+ title: '已订阅到货通知',
|
|
|
+ icon: 'success'
|
|
|
+ });
|
|
|
+ },
|
|
|
+ onPopupConfirm(data) {
|
|
|
+ console.log('Added to cart:', data);
|
|
|
+ uni.showToast({
|
|
|
+ title: '已加入购物车',
|
|
|
+ icon: 'success'
|
|
|
+ });
|
|
|
+ },
|
|
|
+ showServicePopup() {
|
|
|
+ // Placeholder for service popup
|
|
|
+ },
|
|
|
+ onBookClick(book) {
|
|
|
+ console.log('Book clicked:', book);
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages-sell/pages/detail?id=' + encodeURIComponent(book.title)
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 处理位置变更
|
|
|
+ handlePositionChange(position) {
|
|
|
+ this.servicePosition = position;
|
|
|
+ },
|
|
|
+ //支付宝小程序的客服
|
|
|
+ navigateToCustomerService() {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: "/pages-mine/pages/customer-service",
|
|
|
+ });
|
|
|
+ },
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.detail-page {
|
|
|
+ min-height: 100vh;
|
|
|
+ background-color: #f5f5f5;
|
|
|
+ position: relative;
|
|
|
+ padding-bottom: 100rpx;
|
|
|
+}
|
|
|
+
|
|
|
+.header-bg {
|
|
|
+ position: absolute;
|
|
|
+ top: 0;
|
|
|
+ left: 0;
|
|
|
+ width: 100%;
|
|
|
+ height: 664rpx;
|
|
|
+ background: linear-gradient(0deg, #4ED868 0%, #D1FFE5 100%);
|
|
|
+ z-index: 0;
|
|
|
+}
|
|
|
+
|
|
|
+.notification-bar {
|
|
|
+ position: fixed;
|
|
|
+ top: 180rpx;
|
|
|
+ /* Adjust based on navbar height */
|
|
|
+ left: 30rpx;
|
|
|
+ z-index: 10;
|
|
|
+ background: rgba(0, 0, 0, 0.3);
|
|
|
+ border-radius: 30rpx;
|
|
|
+ padding: 6rpx 20rpx 6rpx 6rpx;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+
|
|
|
+ .notif-text {
|
|
|
+ font-size: 24rpx;
|
|
|
+ color: #fff;
|
|
|
+ margin-left: 10rpx;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.content-scroll {
|
|
|
+ position: relative;
|
|
|
+ z-index: 1;
|
|
|
+ height: 100vh;
|
|
|
+}
|
|
|
+
|
|
|
+.cover-area {
|
|
|
+ position: relative;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ padding-top: 60rpx;
|
|
|
+ padding-bottom: 40rpx;
|
|
|
+
|
|
|
+ .book-cover {
|
|
|
+ width: 360rpx;
|
|
|
+ height: 360rpx;
|
|
|
+ box-shadow: 0 10rpx 20rpx rgba(0, 0, 0, 0.1);
|
|
|
+ }
|
|
|
+
|
|
|
+ .share-btn {
|
|
|
+ position: absolute;
|
|
|
+ right: 50rpx;
|
|
|
+ top: 50rpx;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+
|
|
|
+ .share-icon {
|
|
|
+ width: 40rpx;
|
|
|
+ height: 40rpx;
|
|
|
+ margin-bottom: 4rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ text {
|
|
|
+ font-size: 20rpx;
|
|
|
+ color: #333;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.banner-area {
|
|
|
+ background: #f5f5f5;
|
|
|
+ padding: 20rpx;
|
|
|
+
|
|
|
+ .banner-img {
|
|
|
+ width: 100%;
|
|
|
+ border-radius: 20rpx;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.service-btn {
|
|
|
+ padding: 0;
|
|
|
+ margin: 0;
|
|
|
+ background-color: transparent;
|
|
|
+ line-height: 1;
|
|
|
+ border-radius: 0;
|
|
|
+
|
|
|
+ &::after {
|
|
|
+ border: none;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.tabs-header {
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ /* Center the tabs */
|
|
|
+ background: #F8F8F8;
|
|
|
+ padding: 20rpx 0;
|
|
|
+ /* Remove horizontal padding as we center items */
|
|
|
+
|
|
|
+ .tab-item {
|
|
|
+ padding: 0 30rpx;
|
|
|
+ /* Add internal padding for hit area */
|
|
|
+ position: relative;
|
|
|
+
|
|
|
+ text {
|
|
|
+ font-family: 'Source Han Sans SC';
|
|
|
+ font-size: 30rpx;
|
|
|
+ /* Assuming 30px from design tool = 30rpx */
|
|
|
+ color: #666666;
|
|
|
+ transition: all 0.3s;
|
|
|
+ }
|
|
|
+
|
|
|
+ &.active {
|
|
|
+ text {
|
|
|
+ font-size: 30rpx;
|
|
|
+ /* Keep consistent size or adjust if 'big' effect needed, user said 30px */
|
|
|
+ font-weight: bold;
|
|
|
+ color: #333333;
|
|
|
+ }
|
|
|
+
|
|
|
+ .indicator {
|
|
|
+ position: absolute;
|
|
|
+ bottom: 2rpx;
|
|
|
+ /* Adjust vertical position */
|
|
|
+ left: 50%;
|
|
|
+ transform: translateX(-50%);
|
|
|
+ width: 120rpx;
|
|
|
+ /* Make it wider or relative to text? Usually fixed or text width. Let's try matching text width visually or a fixed width */
|
|
|
+ height: 8rpx;
|
|
|
+ /* Slightly thicker for gradient visibility */
|
|
|
+ background: linear-gradient(90deg, rgba(78, 217, 100, 0.1) 0%, #4ED964 100%);
|
|
|
+ border-radius: 4rpx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+</style>
|