From 62b483cc627b0a5f7d626d6b333a3ef7c7c1f4f4 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期三, 25 二月 2026 18:41:01 +0800
Subject: [PATCH] 调试

---
 mini-program/pages/search/search.vue |   53 ++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 48 insertions(+), 5 deletions(-)

diff --git a/mini-program/pages/search/search.vue b/mini-program/pages/search/search.vue
index d7b2310..6ec5f00 100644
--- a/mini-program/pages/search/search.vue
+++ b/mini-program/pages/search/search.vue
@@ -4,10 +4,10 @@
 			<u-search placeholder="璇疯緭鍏ュ晢鍝佸悕绉版悳绱�" height="36" searchIconColor="#999999" borderColor="#EEEEEE"
 				bgColor="#F9F9FB" :showAction="false" v-model="goodsName" @search="search" />
 		</view>
-		<view class="history">
+		<view class="history" v-if="historyList && historyList.length > 0">
 			<view class="history-title">鍘嗗彶鎼滅储</view>
 			<view class="history-list">
-				<view class="history-list-item">鏀噸杞�</view>
+				<view class="history-list-item" v-for="(item, index) in historyList" :key="index" @click="seleContent(item.content)">{{item.content}}</view>
 			</view>
 		</view>
 		<template v-if="isSearch">
@@ -42,20 +42,54 @@
 </template>
 
 <script>
+	import { mapState } from 'vuex'
 	export default {
+		computed: {
+			...mapState(['userInfo'])
+		},
 		data() {
 			return {
 				goodsName: '',
 				goodsList: [],
 				page: 1,
 				next: true,
-				isSearch: false
+				isSearch: false,
+				historyList: [],
+				categoryId: null,
+				applicableBrandId: null
 			};
+		},
+		onLoad(option) {
+			if (option.categoryId) {
+				this.categoryId = option.categoryId
+				this.isSearch = true
+				this.getGoodsList()
+			}
+			if (option.applicableBrandId) {
+				this.applicableBrandId = option.applicableBrandId
+				this.isSearch = true
+				this.getGoodsList()
+			}
+			this.gethistary()
 		},
 		onReachBottom() {
 			this.getGoodsList()
 		},
 		methods: {
+			seleContent(val) {
+				this.goodsName = val
+				this.search()
+			},
+			gethistary() {
+				if (!this.userInfo) return
+				this.$u.api.searchHistoryList({
+					memberId: this.userInfo.id
+				}).then(res => {
+					if (res.code === 200) {
+						this.historyList = res.data
+					}
+				})
+			},
 			search() {
 				if (!this.isSearch) {
 					this.isSearch = true
@@ -73,10 +107,14 @@
 					model: {
 						type: 0,
 						sortInfo: 3,
-						goodsName: this.goodsName
+						goodsName: this.goodsName,
+						memberId: this.userInfo.id,
+						categoryId: this.categoryId,
+						applicableBrandId: this.applicableBrandId
 					}
 				}).then(res => {
 					if (res.code === 200) {
+						this.gethistary()
 						res.data.records.forEach(item => {
 							item.minPrice = item.minPrice.toFixed(2).split('.')
 						})
@@ -92,6 +130,11 @@
 	}
 </script>
 
+<style>
+	page {
+		background-color: #F9F9FB;
+	}
+</style>
 <style lang="scss" scoped>
 	.box {
 		width: 100%;
@@ -133,7 +176,7 @@
 					margin-right: 24rpx;
 					margin-bottom: 24rpx;
 					&:last-child {
-						margin: 0 !important;
+						margin-right: 0 !important;
 					}
 				}
 			}

--
Gitblit v1.9.3