ソースを参照

feat: 添加产品分享功能并优化购物车和订单页面

- 在多个页面添加产品分享功能,支持通过按钮分享特定产品
- 优化购物车页面降价标签样式,添加降价图标
- 在订单页面添加超时发货状态显示和处理逻辑
- 修改.env.dev.js中的apiUrl配置
- 更新服务弹窗中的"无货必赔"为"缺货必赔"
- 优化商品详情页导航栏滚动效果
- 添加热搜词横向滚动区域
- 修复搜索结果显示折扣计算精度问题
ylong 1 週間 前
コミット
87a5bef9cb

+ 1 - 1
.env.dev.js

@@ -1,5 +1,5 @@
 export default {
     "NODE_ENV": 'development',
-    "apiUrl":"https://bk.shuhi.com",
+    "apiUrl":"https://bpi.shuhi.com",
     "apiUrlPrefix":"/api",
 };

+ 6 - 0
pages-car/components/buy-order-item.vue

@@ -74,6 +74,12 @@
             <u-button v-if="order.showUrge == 1" size="mini" shape="circle" type="warning" plain
                 :custom-style="btnStyle" @click.stop="handleAction('remind', order)">催发货</u-button>
 
+            <!-- 超时发货 -->
+            <u-button v-if="order.showSendTimeout == 1" size="mini" shape="circle" type="warning" plain
+                :custom-style="btnStyle" @click.stop="handleAction('overtime', order)">超时发货</u-button>
+            <u-button v-if="order.showSendTimeout == 2" size="mini" shape="circle" type="warning" plain
+                :custom-style="btnStyle">超时发货已赔付</u-button>
+
 
             <!-- 申请售后 -->
             <u-button v-if="order.showAfterSales == 1 && order.status != '4' && order.status != '3'" size="mini" shape="circle" type="error"

+ 227 - 223
pages-car/components/cart-item.vue

@@ -34,10 +34,14 @@
                 <!-- 已降价标签 -->
                 <view class="tag green-tag" v-if="item.currReduceMoney > 0">
                     <text>已降¥{{ item.currReduceMoney }}</text>
+                    <image src="../static/down.jpg"
+                        style="width: 20rpx; height: 20rpx; margin-left: 4rpx;position: relative;top: 4rpx;"></image>
                 </view>
                 <!-- 可降价标签 -->
-                <view class="tag orange-tag" v-if="canReduce" @click.stop="handleReduce">
+                <view class="tag green-tag" v-if="canReduce" @click.stop="handleReduce">
                     <text>可降¥{{ item.reduceMoney }}</text>
+                    <image src="../static/down.jpg"
+                        style="width: 20rpx; height: 20rpx; margin-left: 4rpx;position: relative;top: 4rpx;"></image>
                 </view>
 
                 <!-- 倒计时 -->
@@ -71,273 +75,273 @@
 </template>
 
 <script>
-    export default {
-        props: {
-            item: {
-                type: Object,
-                default: () => ({})
-            }
+export default {
+    props: {
+        item: {
+            type: Object,
+            default: () => ({})
+        }
+    },
+    data() {
+        return {
+        };
+    },
+    computed: {
+        conditionName() {
+            // 如果是数字,映射;如果是字符串,直接显示
+            return this.$conditionMap[this.item.conditionType] || '-';
         },
-        data() {
-            return {
-            };
+        isValid() {
+            // stockStatus: 1-有库存 2-库存紧张 3-暂无库存
+            return this.item.stockStatus !== 3 && this.item.availableStock > 0;
         },
-        computed: {
-            conditionName() {
-                // 如果是数字,映射;如果是字符串,直接显示
-                return this.$conditionMap[this.item.conditionType] || '-';
-            },
-            isValid() {
-                // stockStatus: 1-有库存 2-库存紧张 3-暂无库存
-                return this.item.stockStatus !== 3 && this.item.availableStock > 0;
-            },
-            statusText() {
-                if (this.item.stockStatus === 3 || this.item.availableStock <= 0) return '暂无库存';
-                // 如果后端定义了其他状态,你可能需要处理它们
-                return '';
-            },
-            canReduce() {
-                // 逻辑:如果成功减价次数少于允许的最大次数,且 reduceMoney > 0
-                // 或者简单地如果 reduceMoney > 0 且我们还没有达到限制?
-                // 假设 reduceMoney 是单价减少额。
-                return (this.item.reduceNum < this.item.maxReduceNum) && (this.item.reduceMoney > 0);
-            }
+        statusText() {
+            if (this.item.stockStatus === 3 || this.item.availableStock <= 0) return '暂无库存';
+            // 如果后端定义了其他状态,你可能需要处理它们
+            return '';
         },
-        methods: {
-            toggleCheck() {
-                if (!this.isValid) return;
-                const newChecked = !this.item.checked;
-                this.item.checked = newChecked;
-                this.$emit('check', { id: this.item.id, checked: newChecked });
-            },
-            onCheckChange(val) {
-                this.$emit('check', { id: this.item.id, checked: val.value });
-            },
-            onNumChange(val) {
-                this.$emit('changeNum', { id: this.item.id, num: val.value });
-            },
-            handleReduce() {
-                this.$emit('reduce', this.item);
-            },
-            handleSelectCondition() {
-                this.$emit('selectCondition', this.item);
-            },
-            onCountdownFinish() {
-                this.$emit('countdown-finish', this.item);
-            },
-            goToDetail() {
-                const isbn = this.item.isbn || this.item.bookIsbn || this.item.id;
-                if (isbn) {
-                    uni.navigateTo({
-                        url: `/pages-sell/pages/detail?isbn=${isbn}`
-                    });
-                }
+        canReduce() {
+            // 逻辑:如果成功减价次数少于允许的最大次数,且 reduceMoney > 0
+            // 或者简单地如果 reduceMoney > 0 且我们还没有达到限制?
+            // 假设 reduceMoney 是单价减少额。
+            return (this.item.reduceNum < this.item.maxReduceNum) && (this.item.reduceMoney > 0);
+        }
+    },
+    methods: {
+        toggleCheck() {
+            if (!this.isValid) return;
+            const newChecked = !this.item.checked;
+            this.item.checked = newChecked;
+            this.$emit('check', { id: this.item.id, checked: newChecked });
+        },
+        onCheckChange(val) {
+            this.$emit('check', { id: this.item.id, checked: val.value });
+        },
+        onNumChange(val) {
+            this.$emit('changeNum', { id: this.item.id, num: val.value });
+        },
+        handleReduce() {
+            this.$emit('reduce', this.item);
+        },
+        handleSelectCondition() {
+            this.$emit('selectCondition', this.item);
+        },
+        onCountdownFinish() {
+            this.$emit('countdown-finish', this.item);
+        },
+        goToDetail() {
+            const isbn = this.item.isbn || this.item.bookIsbn || this.item.id;
+            if (isbn) {
+                uni.navigateTo({
+                    url: `/pages-sell/pages/detail?isbn=${isbn}`
+                });
             }
         }
-    };
+    }
+};
 </script>
 
 <style lang="scss">
-    .cart-item {
+.cart-item {
+    display: flex;
+    align-items: center;
+    background-color: #fff;
+    padding: 20rpx 20rpx;
+    border-radius: 16rpx;
+    border-bottom: 1rpx dashed #f5f5f5;
+
+    .checkbox-box {
+        width: 80rpx;
+        height: 100%;
+        min-height: 200rpx;
         display: flex;
+        justify-content: center;
         align-items: center;
-        background-color: #fff;
-        padding: 20rpx 20rpx;
-        border-radius: 16rpx;
-        border-bottom: 1rpx dashed #f5f5f5;
+        flex-shrink: 0;
+        margin-right: -20rpx;
+        position: relative;
+        z-index: 10;
+
+        &.disabled-checkbox {
+            .circle {
+                width: 34rpx;
+                height: 34rpx;
+                border-radius: 50%;
+                background-color: #e5e5e5;
+            }
+        }
+    }
 
-        .checkbox-box {
-            width: 80rpx;
+    .image-wrapper {
+        position: relative;
+        width: 150rpx;
+        height: 200rpx;
+        border-radius: 8rpx;
+        overflow: hidden;
+        flex-shrink: 0;
+        margin-right: 20rpx;
+
+        .book-cover {
+            width: 100%;
             height: 100%;
-            min-height: 200rpx;
+        }
+
+        .status-mask {
+            position: absolute;
+            bottom: 0;
+            left: 0;
+            width: 100%;
+            height: 40rpx;
+            background-color: rgba(0, 0, 0, 0.6);
             display: flex;
             justify-content: center;
             align-items: center;
-            flex-shrink: 0;
-            margin-right: -20rpx;
-            position: relative;
-            z-index: 10;
-
-            &.disabled-checkbox {
-                .circle {
-                    width: 34rpx;
-                    height: 34rpx;
-                    border-radius: 50%;
-                    background-color: #e5e5e5;
-                }
-            }
-        }
 
-        .image-wrapper {
-            position: relative;
-            width: 150rpx;
-            height: 200rpx;
-            border-radius: 8rpx;
-            overflow: hidden;
-            flex-shrink: 0;
-            margin-right: 20rpx;
-
-            .book-cover {
-                width: 100%;
-                height: 100%;
+            text {
+                color: #fff;
+                font-size: 20rpx;
             }
+        }
 
-            .status-mask {
-                position: absolute;
-                bottom: 0;
-                left: 0;
-                width: 100%;
-                height: 40rpx;
-                background-color: rgba(0, 0, 0, 0.6);
-                display: flex;
-                justify-content: center;
-                align-items: center;
+        .stock-mask {
+            position: absolute;
+            bottom: 0;
+            left: 0;
+            width: 100%;
+            height: 40rpx;
+            background-color: #38C148; // 绿色背景
+            opacity: 0.8;
+            display: flex;
+            justify-content: center;
+            align-items: center;
 
-                text {
-                    color: #fff;
-                    font-size: 20rpx;
-                }
+            text {
+                color: #fff;
+                font-size: 20rpx;
             }
+        }
+    }
 
-            .stock-mask {
-                position: absolute;
-                bottom: 0;
-                left: 0;
-                width: 100%;
-                height: 40rpx;
-                background-color: #38C148; // 绿色背景
-                opacity: 0.8;
-                display: flex;
-                justify-content: center;
-                align-items: center;
+    .info-box {
+        flex: 1;
+        height: 220rpx;
+        display: flex;
+        flex-direction: column;
+        justify-content: space-between;
 
-                text {
-                    color: #fff;
-                    font-size: 20rpx;
-                }
-            }
+        ::v-deep .u-countdown-colon {
+            font-size: 24rpx !important;
         }
 
-        .info-box {
-            flex: 1;
-            height: 220rpx;
+        .title-row {
             display: flex;
-            flex-direction: column;
             justify-content: space-between;
-
-            ::v-deep .u-countdown-colon {
-                font-size: 24rpx !important;
+            align-items: flex-start;
+
+            .title {
+                flex: 1;
+                font-size: 28rpx;
+                color: #333;
+                line-height: 1.4;
+                display: -webkit-box;
+                -webkit-box-orient: vertical;
+                -webkit-line-clamp: 2;
+                overflow: hidden;
+                font-weight: 600;
+                margin-right: 10rpx;
             }
+        }
 
-            .title-row {
-                display: flex;
-                justify-content: space-between;
-                align-items: flex-start;
-
-                .title {
-                    flex: 1;
-                    font-size: 28rpx;
-                    color: #333;
-                    line-height: 1.4;
-                    display: -webkit-box;
-                    -webkit-box-orient: vertical;
-                    -webkit-line-clamp: 2;
-                    overflow: hidden;
-                    font-weight: 600;
-                    margin-right: 10rpx;
+        .tags-quality-row {
+            display: flex;
+            flex-wrap: wrap;
+            justify-content: space-between;
+            align-items: center;
+            margin: 20rpx 0 0 0;
+
+            .tag {
+                font-size: 22rpx;
+                padding: 4rpx 8rpx;
+                border-radius: 4rpx;
+                margin-right: 10rpx;
+                border: 1rpx solid transparent;
+                margin-bottom: 6rpx;
+
+                &.green-tag {
+                    color: #38C148;
+                    background-color: rgba(56, 193, 72, 0.1);
                 }
-            }
 
-            .tags-quality-row {
-                display: flex;
-                flex-wrap: wrap;
-                justify-content: space-between;
-                align-items: center;
-                margin: 20rpx 0 0 0;
-
-                .tag {
-                    font-size: 22rpx;
-                    padding: 2rpx 8rpx;
-                    border-radius: 4rpx;
-                    margin-right: 10rpx;
-                    border: 1rpx solid transparent;
-                    margin-bottom: 6rpx;
-
-                    &.green-tag {
-                        color: #38C148;
-                        border-color: #38C148;
-                        background-color: rgba(56, 193, 72, 0.1);
-                    }
-
-                    &.orange-tag {
-                        color: #ff6a00;
-                        border-color: #ff6a00;
-                        background-color: rgba(255, 106, 0, 0.1);
-                    }
-
-                    &.red-text-tag {
-                        background-color: #38C148;
-                        color: #fff;
-                        border: none;
-                    }
+                &.orange-tag {
+                    color: #ff6a00;
+                    border-color: #ff6a00;
+                    background-color: rgba(255, 106, 0, 0.1);
                 }
 
-                .quality-selector {
-                    display: flex;
-                    align-items: center;
-                    font-size: 24rpx;
-                    color: #999;
-                    background-color: #f5f5f5;
-                    padding: 4rpx 12rpx;
-                    border-radius: 4rpx;
-                    width: fit-content;
-                    margin-bottom: 6rpx;
-                    margin-right: 10rpx;
-                    order: -1; // 移到前面
+                &.red-text-tag {
+                    background-color: #38C148;
+                    color: #fff;
+                    border: none;
                 }
+            }
 
-                .countdown-wrap {
-                    display: flex;
-                    align-items: center;
-                    font-size: 24rpx !important;
-                    color: #db0702;
-                    margin-left: 6rpx;
-
-                    text {
-                        margin-right: 6rpx;
-                    }
-                }
+            .quality-selector {
+                display: flex;
+                align-items: center;
+                font-size: 24rpx;
+                color: #999;
+                background-color: #f5f5f5;
+                padding: 4rpx 12rpx;
+                border-radius: 4rpx;
+                width: fit-content;
+                margin-bottom: 6rpx;
+                margin-right: 10rpx;
+                order: -1; // 移到前面
             }
 
-            .bottom-row {
+            .countdown-wrap {
                 display: flex;
                 align-items: center;
-                justify-content: space-between;
-                margin-top: auto;
+                font-size: 24rpx !important;
+                color: #db0702;
+                margin-left: 6rpx;
+                margin-top: 6rpx;
 
-                .price-box {
-                    color: #e02020;
-                    font-weight: bold;
+                text {
+                    margin-right: 6rpx;
+                }
+            }
+        }
 
-                    .symbol {
-                        font-size: 24rpx;
-                    }
+        .bottom-row {
+            display: flex;
+            align-items: center;
+            justify-content: space-between;
+            margin-top: auto;
 
-                    .amount {
-                        font-size: 36rpx;
-                    }
-                }
+            .price-box {
+                color: #e02020;
+                font-weight: bold;
 
-                .reduce-btn {
-                    background-color: #38C148;
-                    color: #fff;
+                .symbol {
                     font-size: 24rpx;
-                    padding: 6rpx 16rpx;
-                    border-radius: 26rpx;
-                    margin-left: 10rpx;
-                    margin-right: auto; // 将数字框推到右边
                 }
+
+                .amount {
+                    font-size: 36rpx;
+                }
+            }
+
+            .reduce-btn {
+                background-color: #38C148;
+                color: #fff;
+                font-size: 24rpx;
+                padding: 6rpx 16rpx;
+                border-radius: 26rpx;
+                margin-left: 10rpx;
+                margin-right: auto; // 将数字框推到右边
             }
         }
     }
+}
 </style>

+ 10 - 1
pages-car/components/order-bottom-bar.vue

@@ -17,8 +17,10 @@
 			@click="emitAction('complaint')">投诉</u-button>
 
 		<!-- 超时发货 -->
-		<u-button v-if="orderInfo.showSendTimeout" size="mini" shape="circle" type="warning" :custom-style="btnStyle"
+		<u-button v-if="orderInfo.showSendTimeout === 1" size="mini" shape="circle" type="warning" :custom-style="btnStyle"
 			@click="emitAction('overtime')">超时发货</u-button>
+		<u-button v-if="orderInfo.showSendTimeout === 2" size="mini" shape="circle" type="warning" plain :custom-style="autoBtnStyle"
+			>超时发货已赔付</u-button>
 
 		<!-- 降价补差 -->
 		<u-button v-if="orderInfo.showCompensation" size="mini" shape="circle" type="primary"
@@ -60,6 +62,13 @@
 					padding: '0',
 					fontSize: '26rpx'
 				},
+				autoBtnStyle: {
+					marginLeft: '20rpx',
+					height: '60rpx',
+					lineHeight: '60rpx',
+					padding: '0 20rpx',
+					fontSize: '26rpx'
+				},
 				themeBtnStyle: {
 					marginLeft: '20rpx',
 					width: '160rpx',

+ 8 - 0
pages-car/pages/index.vue

@@ -122,6 +122,14 @@
         // 分享配置
         onShareAppMessage(res) {
             console.log(res, '分享');
+            if (res && res.from === 'button' && res.target && res.target.dataset && res.target.dataset.shareType === 'product') {
+                const dataset = res.target.dataset;
+                return {
+                    title: dataset.title || '',
+                    path: `/pages-sell/pages/detail?isbn=${dataset.isbn}`,
+                    imageUrl: dataset.image || ''
+                };
+            }
             if (res.from === "button") {
                 let reduceCode = uni.getStorageSync("reduceCodeShare");
                 // 调用分享接口

BIN
pages-car/static/down.jpg


+ 8 - 13
pages-sell/components/select-good-popup/index.vue

@@ -68,10 +68,10 @@
 
 			<!-- Footer Buttons -->
 			<view class="footer-btns">
-				<view class="btn btn-orange" @click="handleShareAction">
+				<button class="btn btn-orange" open-type="share" :data-share-type="'product'" :data-title="currentProduct.bookName" :data-isbn="currentProduct.isbn" :data-image="currentProduct.cover" @click="handleShareAction">
 					<text class="price">¥{{ displayReducePrice }}</text>
 					<text class="desc">分享一人可降 {{ currentProduct.reducePrice }} 元</text>
-				</view>
+				</button>
 				<view class="btn btn-green" @click="handleAction" :class="{ 'btn-gray': !hasStock && currentProduct.hasArrivalNotice === 1 }">
 					<text v-if="hasStock" class="price">¥{{ displayTotalPrice }}</text>
 					<text class="desc" :class="{ 'notice': !hasStock }">{{ hasStock ? '加入购物车' : (currentProduct.hasArrivalNotice === 1 ? '取消到货通知' : '到货通知') }}</text>
@@ -265,23 +265,14 @@ export default {
 			}).then(async res => {
 				if (res.code === 200) {
 					await this.$updateCartBadge();
-					this.$u.toast('加入购物车成功');
+					// this.$u.toast('加入购物车成功'); // 可选,看是否需要提示
 					this.$emit('confirm', {
 						product: this.currentProduct,
 						quality: this.currentQuality,
 						quantity: this.quantity
 					});
 					this.close();
-					
-					// 打开减价弹窗
-					setTimeout(() => {
-						if (this.$refs.reducePopup) {
-							this.$refs.reducePopup.open({
-								isbn: this.currentProduct.isbn,
-								conditionType: conditionType
-							});
-						}
-					}, 300);
+					// 移除降价弹窗逻辑
 				} else {
 					this.$u.toast(res.msg || '加入购物车失败');
 				}
@@ -547,6 +538,10 @@ export default {
 		margin: 0;
 		-webkit-tap-highlight-color: transparent;
 
+		&::after {
+			border: none;
+		}
+
 		.price {
 			font-size: 38rpx;
 			color: #fff;

+ 92 - 8
pages-sell/components/sell-container/index.vue

@@ -30,18 +30,30 @@
 						</view>
 					</view>
 				</view>
+
+                <!-- 热搜词横向滚动区域 -->
+                <view class="hot-search-wrapper" v-if="hotSearchList.length > 0">
+                    <view class="hot-search-fixed-title">
+                        <view class="hot-tag hot-tag-highlight" @click="navigateTo('/pages-sell/pages/search')">热搜</view>
+                    </view>
+                    <scroll-view class="hot-search-scroll" scroll-x="true" :show-scrollbar="false">
+                        <view class="hot-search-list">
+                            <view 
+                                class="hot-tag" 
+                                v-for="(item, index) in hotSearchList" 
+                                :key="index" 
+                                @click="goSearchResult(item)"
+                            >
+                                {{ item }}
+                            </view>
+                        </view>
+                    </scroll-view>
+                </view>
 			</view>
 
 			<!-- 占位,防止内容被 fixed 区域遮挡 -->
 			<view class="search-placeholder"></view>
 
-			<!-- tab标签 -->
-			<!-- <view class="tabs-wrapper">
-				<u-tabs :list="hotTagList" :current="currentHotTag" @change="changeHotTag" bgColor="transparent"
-					lineColor="transparent" :active-item-style="{ fontWeight: 'bold', color: '#333' }"
-					inactive-color="#3C4F3E" :barStyle="barStyle" :bar-height="27" :bar-width="52"></u-tabs>
-			</view> -->
-
 			<!-- 顶部横幅 Banner -->
 			<view class="top-banner-wrapper">
 				<image src="/pages-sell/static/top-banner.png" class="top-banner-img" mode="widthFix"></image>
@@ -217,6 +229,7 @@ export default {
 			leftBookList: [], // 左侧推荐书籍
 			rightBookList: [], // 右侧推荐书籍
 			shareList: [], // 分享列表
+			hotSearchList: [] // 存放热搜词
 		}
 	},
 	created() {
@@ -225,8 +238,27 @@ export default {
 		this.hasShareList()
 
 		this.getIndexCateInfo()
+		this.getHotSearchData()
 	},
 	methods: {
+		async getHotSearchData() {
+			try {
+				const res = await this.$u.api.getHotSearchListAjax();
+				if (res.code === 200 || res.code === 0) {
+					this.hotSearchList = res.data || [];
+				}
+			} catch (error) {
+				console.log('获取热搜词失败', error);
+			}
+		},
+		goSearchResult(keyword) {
+			if (!keyword) return;
+			// 过滤可能带有的 <em> 等后端返回的 HTML 标签
+			const cleanKey = keyword.replace(/<[^>]+>/g, '');
+			uni.navigateTo({
+				url: '/pages-sell/pages/search-result?keyword=' + encodeURIComponent(cleanKey)
+			});
+		},
 		// 接收外部传入的页面滚动事件
 		onPageScroll(scrollTop) {
 			this.scrollTop = scrollTop || 0;
@@ -395,7 +427,59 @@ export default {
 }
 
 .search-placeholder {
-	height: 100rpx;
+	height: 160rpx; /* 增加高度以容纳热搜词 */
+}
+
+/* 热搜词横向滚动 */
+.hot-search-wrapper {
+    margin-bottom: 24rpx;
+    width: 100%;
+    display: flex;
+    align-items: center;
+}
+
+.hot-search-fixed-title {
+    flex-shrink: 0;
+    padding-left: 24rpx;
+}
+
+.hot-search-scroll {
+    flex: 1;
+    white-space: nowrap;
+    overflow: hidden;
+}
+
+.hot-search-list {
+    display: inline-flex;
+    align-items: center;
+    padding: 0 20rpx;
+}
+
+.hot-tag {
+    display: inline-block;
+    margin-right: 30rpx;
+    font-size: 26rpx;
+    color: #666;
+    font-weight: 500;
+}
+
+.hot-tag-highlight {
+    color: #38C148;
+    font-weight: bold;
+    padding-right: 20rpx;
+    margin-right: 0;
+    position: relative;
+}
+
+.hot-tag-highlight::after {
+    content: '';
+    position: absolute;
+    right: 0;
+    top: 50%;
+    transform: translateY(-50%);
+    width: 2rpx;
+    height: 24rpx;
+    background-color: #E0E0E0;
 }
 
 /* 搜索框 */

+ 1 - 1
pages-sell/components/service-popup/index.vue

@@ -51,7 +51,7 @@ export default {
                 },
                 {
                     icon: '/pages-sell/static/service/icon-6.png',
-                    title: '货必赔',
+                    title: '货必赔',
                     desc: '订单付款后,因平台除因无法发货的订单,48 小时后可申请补偿到余额,平台将在 24 小时内处理申请。'
                 }
             ]

+ 25 - 3
pages-sell/pages/detail.vue

@@ -4,8 +4,8 @@
         <view class="header-bg"></view>
 
         <!-- Custom Navbar -->
-        <Navbar :title="product.bookName || '详情'" :titleSize="32" title-color="#fff" back-icon-color="#fff"
-            background="transparent">
+        <Navbar :title="product.bookName || '详情'" :titleSize="32" :title-color="navbarTitleColor" :back-icon-color="navbarIconColor"
+            :background="navbarBackground">
         </Navbar>
 
         <!-- Notification Bar -->
@@ -112,6 +112,9 @@
             return {
                 currentTab: 0,
                 hasStock: false, // Toggle this to test stock status
+                navbarBackground: 'transparent',
+                navbarTitleColor: '#ffffff',
+                navbarIconColor: '#ffffff',
                 tipsContent: [
                     '印刷版次较多,二手图书封面、版次、原价等信息可能与商品介绍有差异,具体以收到实物为准;',
                     '二手图书性质特殊,不保证随新书赠送的光盘、海报、卡片等内容,仅支持图书质量问题退款,否则将扣除运费成本;',
@@ -140,6 +143,17 @@
                 }, 1500);
             }
         },
+        onPageScroll(e) {
+            if (e.scrollTop > 0) {
+                this.navbarBackground = '#ffffff';
+                this.navbarTitleColor = '#000000';
+                this.navbarIconColor = '#000000';
+            } else {
+                this.navbarBackground = 'transparent';
+                this.navbarTitleColor = '#ffffff';
+                this.navbarIconColor = '#ffffff';
+            }
+        },
         methods: {
             getBookDetail(isbn) {
                 uni.showLoading({ title: '加载中' });
@@ -246,7 +260,15 @@
                 });
             },
         },
-        onShareAppMessage() {
+        onShareAppMessage(res) {
+            if (res && res.from === 'button' && res.target && res.target.dataset && res.target.dataset.shareType === 'product') {
+                const dataset = res.target.dataset;
+                return {
+                    title: dataset.title || '',
+                    path: `/pages-sell/pages/detail?isbn=${dataset.isbn}`,
+                    imageUrl: dataset.image || ''
+                };
+            }
             return {
                 title: `${this.product.bookName}`,
                 path: `/pages-sell/pages/detail?isbn=${this.product.isbn}`,

+ 9 - 1
pages-sell/pages/recommend.vue

@@ -62,7 +62,15 @@ export default {
 			this.loadData();
 		}
 	},
-	onShareAppMessage() {
+	onShareAppMessage(res) {
+		if (res && res.from === 'button' && res.target && res.target.dataset && res.target.dataset.shareType === 'product') {
+			const dataset = res.target.dataset;
+			return {
+				title: dataset.title || '',
+				path: `/pages-sell/pages/detail?isbn=${dataset.isbn}`,
+				imageUrl: dataset.image || ''
+			};
+		}
 		return {
 			title: this.showName || '推荐图书专题',
 			path: `/pages-sell/pages/recommend?cateId=${this.cateId}`,

+ 1 - 1
pages-sell/pages/search-result.vue

@@ -195,7 +195,7 @@
                 if (this.pageNum === 1) {
                     this.$u.api.getSearchRecommendAjax().then(res => {
                         if (res.code == 200) {
-                            res.data.discountDesc = res.data.productPrice ? (res.data.productPrice / res.data.price) + '折' : '';
+                            res.data.discountDesc = res.data.productPrice ? (res.data.productPrice / res.data.price).toFixed(2) * 10 + '折' : '';
                             res.data.discountPrice = res.data.productPrice ? res.data.price - res.data.productPrice : '';
                             this.hotBook = res.data;
                         }

+ 8 - 0
pages/cart/index.vue

@@ -34,6 +34,14 @@
         // 分享配置
         onShareAppMessage(res) {
             console.log(res, '分享');
+            if (res && res.from === 'button' && res.target && res.target.dataset && res.target.dataset.shareType === 'product') {
+                const dataset = res.target.dataset;
+                return {
+                    title: dataset.title || '',
+                    path: `/pages-sell/pages/detail?isbn=${dataset.isbn}`,
+                    imageUrl: dataset.image || ''
+                };
+            }
             if (res.from === "button") {
                 let reduceCode = uni.getStorageSync("reduceCodeShare");
                 // 调用分享接口

+ 10 - 2
pages/home/index.vue

@@ -227,8 +227,16 @@ export default {
         });
     },
     // 分享配置
-    onShareAppMessage(res) {
-        if (res.from === "button") {
+        onShareAppMessage(res) {
+            if (res && res.from === 'button' && res.target && res.target.dataset && res.target.dataset.shareType === 'product') {
+                const dataset = res.target.dataset;
+                return {
+                    title: dataset.title || '',
+                    path: `/pages-sell/pages/detail?isbn=${dataset.isbn}`,
+                    imageUrl: dataset.image || ''
+                };
+            }
+            if (res.from === "button") {
             let upsellCode = uni.getStorageSync("upsellCodeShare");
             console.log(upsellCode, "分享");
             // 调用分享接口

+ 9 - 1
uview-ui/libs/mixin/mpShare.js

@@ -7,7 +7,15 @@ module.exports = {
 			imageUrl: '' // 默认为当前页面的截图
 		}
 	},
-	onShareAppMessage() {
+	onShareAppMessage(res) {
+		if (res && res.from === 'button' && res.target && res.target.dataset && res.target.dataset.shareType === 'product') {
+			const dataset = res.target.dataset;
+			return {
+				title: dataset.title || '',
+				path: `/pages-sell/pages/detail?isbn=${dataset.isbn}`,
+				imageUrl: dataset.image || ''
+			}
+		}
 		return this.$u.mpShare
 	},
 	// #ifdef MP-WEIXIN