From 7a27a1d4d0038abe2115adb1753f897f56d66323 Mon Sep 17 00:00:00 2001
From: quanwei <419654421@qq.com>
Date: Fri, 31 Oct 2025 11:52:58 +0800
Subject: [PATCH] 访客列表

---
 mobile/pages/plus/business/visitors.vue |   67 ++++++++-------------------------
 1 files changed, 16 insertions(+), 51 deletions(-)

diff --git a/mobile/pages/plus/business/visitors.vue b/mobile/pages/plus/business/visitors.vue
index 0b88d56..1849583 100644
--- a/mobile/pages/plus/business/visitors.vue
+++ b/mobile/pages/plus/business/visitors.vue
@@ -9,28 +9,24 @@
 					<input type="text" v-model="search" placeholder="搜索访客姓名" @confirm="searchVisitor" />
 				</view>
 			</view>
-
 			<!-- 访客列表 -->
 			<scroll-view scroll-y="true" :width="screenWidth" class="visitor-list" @scrolltolower="loadMore">
 				<view v-if="visitors.length > 0">
 					<view class="visitor-item" v-for="(visitor, index) in visitors" :key="index">
-						<image class="visitor-avatar" :src="visitor.avatar || '/static/default.png'" mode="aspectFill">
+						<image class="visitor-avatar" :src="visitor.user.avatarUrl || '/static/default.png'"
+							mode="aspectFill">
 						</image>
 						<view class="visitor-info">
 							<view class="visitor-header">
-								<view class="visitor-name">{{visitor.user_name || '未知访客'}}</view>
-								<view class="visitor-time">{{formatTime(visitor.visit_time)}}</view>
+								<view class="visitor-name">{{visitor.user.nickName || '未知访客'}}</view>
+								<view class="visitor-time">{{visitor.update_time}}</view>
 							</view>
 							<view v-if="visitor.company_name" class="visitor-company">{{visitor.company_name}}</view>
 							<view v-if="visitor.position" class="visitor-position">{{visitor.position}}</view>
 							<view class="visitor-action">
-								<view class="action-btn" @click="viewCard(visitor.business_card_id)">
+								<view class="action-btn" @click="viewCard(visitor)">
 									<text class="icon iconfont icon-card"></text>
 									<text>查看名片</text>
-								</view>
-								<view class="action-btn" @click="contactVisitor(visitor)">
-									<text class="icon iconfont icon-message"></text>
-									<text>联系访客</text>
 								</view>
 							</view>
 						</view>
@@ -54,6 +50,7 @@
 				</view>
 			</scroll-view>
 		</view>
+	</view>
 </template>
 
 <script>
@@ -92,9 +89,10 @@
 				_this._post('plus.business.business/getVisitors', params, function(res) {
 					_this.loading = false;
 					if (_this.page === 1) {
-						_this.visitors = res.data.list;
+						_this.visitors = res.data.data;
+						console.log(_this.visitors.length);
 					} else {
-						_this.visitors = _this.visitors.concat(res.data.list);
+						_this.visitors = _this.visitors.concat(res.data.data);
 					}
 					// 判断是否还有更多数据
 					_this.hasMore = _this.visitors.length < res.data.total;
@@ -113,48 +111,15 @@
 				}
 			},
 			// 查看访客名片
-			viewCard(business_card_id) {
-				this.gotoPage(`/pages/plus/business/detail?business_card_id=${business_card_id}`);
-			},
-			// 联系访客
-			contactVisitor(visitor) {
-				// 这里可以根据系统功能扩展,比如发送消息、拨打电话等
-				uni.showActionSheet({
-					itemList: ['发送消息', '拨打电话'],
-					success: (res) => {
-						if (res.tapIndex === 0) {
-							// 发送消息
-							this.showError('消息功能暂未开放');
-						} else if (res.tapIndex === 1) {
-							// 拨打电话
-							if (visitor.phone) {
-								uni.makePhoneCall({
-									phoneNumber: visitor.phone
-								});
-							} else {
-								this.showError('暂无联系电话');
-							}
-						}
+			viewCard(visitor) {
+				this._get('plus.business.business/getDetail',{user_id:visitor.user_id},res=>{
+					if(res.data){
+						this.gotoPage(`/pages/plus/business/detail?business_card_id=${res.data.business_card_id}`);
+					}else{
+						this.showError('该用户暂无名片')
 					}
-				});
+				})
 			},
-			// 格式化时间
-			formatTime(time) {
-				if (!time) return '';
-				const date = new Date(time);
-				const now = new Date();
-				const diff = now - date;
-				const days = Math.floor(diff / (1000 * 60 * 60 * 24));
-				if (days === 0) {
-					return '今天 ' + date.getHours() + ':' + (date.getMinutes() < 10 ? '0' : '') + date.getMinutes();
-				} else if (days === 1) {
-					return '昨天 ' + date.getHours() + ':' + (date.getMinutes() < 10 ? '0' : '') + date.getMinutes();
-				} else if (days < 7) {
-					return days + '天前';
-				} else {
-					return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate();
-				}
-			}
 		}
 	};
 </script>

--
Gitblit v1.9.2