From f2acabac3f007ce28d1968f633a3f28779351fba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E6=AF=85?= <1335909236@qq.com> Date: Mon, 20 Oct 2025 11:17:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=A6=96=E9=A1=B5=E9=A1=B6?= =?UTF-8?q?=E9=83=A8=E6=90=9C=E7=B4=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v2User.js | 2 +- packages/community/propertyPayment/index.vue | 2 +- packages/community/providentFund/index.vue | 2 +- packages/customerService/index/index.vue | 143 +++++++++---------- packages/localLife/houseProvident/index.vue | 4 +- packages/localLife/pay/index.vue | 2 +- packages/workOrderDashboard/wallet/index.vue | 2 +- pages/index/index.css | 8 ++ pages/index/index.vue | 7 +- pages/user/index.vue | 2 +- 10 files changed, 92 insertions(+), 82 deletions(-) diff --git a/api/v2User.js b/api/v2User.js index 649e9614..9928c512 100644 --- a/api/v2User.js +++ b/api/v2User.js @@ -1,6 +1,6 @@ export const apiArr = { getUserInfo: '/api/v2/wechat/mpuser-crud/info', // 获取城市列表 userInfoUpdate: '/api/v2/wechat/mpuser-crud/update', // 会员信息更新 - getAccumulationFund: '/api/v2/wechat/government-housing-fund-flow-crud/page', // 物业费公积金 + getAccumulationFund: '/api/v2/wechat/government-housing-fund-flow-crud/page', // 物业费 getPoints: '/api/v2/wechat/member-points-flow-crud/page', // 积分 } \ No newline at end of file diff --git a/packages/community/propertyPayment/index.vue b/packages/community/propertyPayment/index.vue index 04851d03..4214ba12 100644 --- a/packages/community/propertyPayment/index.vue +++ b/packages/community/propertyPayment/index.vue @@ -172,7 +172,7 @@ - 物业费公积金抵扣金额 + 物业费抵扣金额 -¥{{ item.property_housing_fund }} diff --git a/packages/community/providentFund/index.vue b/packages/community/providentFund/index.vue index 6043b402..510cee21 100644 --- a/packages/community/providentFund/index.vue +++ b/packages/community/providentFund/index.vue @@ -49,7 +49,7 @@ - 物业费公积金总余额 + 物业费总余额 @@ -17,7 +16,7 @@ packages/customerService/index/index + upper-threshold="100" @scrolltolower="loadMoreHistory" @scrolltoupper="loadMoreHistory"> 加载历史消息... @@ -32,8 +31,8 @@ packages/customerService/index/index 'other': !message.isSelf, 'loading': message.isLoading }" class="message-item"> - + + {{ message.content }} @@ -44,10 +43,9 @@ packages/customerService/index/index - + @@ -62,7 +60,7 @@ import { apiArr } from '@/api/customerService' import mqttTool from '@/utils/mqtt' export default { - data(){ + data() { return { localHeight: '', top: '', @@ -106,7 +104,7 @@ export default { scrollToBottomFlag: false } }, - onLoad(options){ + onLoad(options) { const meun = menuButtonInfo() this.top = meun.top this.localHeight = meun.height @@ -119,7 +117,10 @@ export default { this.chatTarget = item console.log('客户找客服跳转:', this.chatTarget) this.chatTarget.title = this.chatTarget.employee_name - this.getMqttConfig() + this.getMqttConfig().then(() => { + // 获取配置后再初始化聊天 + this.initChat() + }) } else { // 客服选择聊天列表进来 this.chatTarget = item @@ -131,20 +132,20 @@ export default { } else { this.chatTarget.openId = this.chatTarget.client_id_one } + // 初始化MQTT连接 + this.initChat() } } - // 初始化MQTT连接 - this.initChat() // 初始化用户头像 this.userAvatar = picUrl + uni.getStorageSync('headPhoto') }, - onShow(){ + onShow() { }, methods: { - getAvatarUrl(record){ + getAvatarUrl(record) { return this.chatTarget.employee_image ? this.chatTarget.employee_image : 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/defaultTx.png' }, - async connect(){ + async connect() { this.client = null const options = { clientId: this.selfClientId @@ -196,7 +197,7 @@ export default { } }) }, - async subscribe(){ + async subscribe() { if (this.isConnected && this.client) { this.client.subscribe('contact/message/receive_msg', { qos: 0 }, (err) => { if (!err) { @@ -213,7 +214,7 @@ export default { } }, // 初始化聊天 - async initChat(){ + async initChat() { try { // 显示连接状态 this.connectingStatus = '正在连接客服...' @@ -234,7 +235,7 @@ export default { }, // 获取MQTT连接配置 - async getMqttConfig(){ + async getMqttConfig() { console.log('🚀 ~ onLoad ~ this.chatTarget.open_id:', this.chatTarget.open_id) try { // 如果没有已创建的实例或clientId,则通过API获取 @@ -270,7 +271,7 @@ export default { }, // MQTT断开连接回调 - onDisconnect(packet){ + onDisconnect(packet) { console.log('MQTT连接断开', packet) this.isConnected = false this.client = null @@ -289,7 +290,7 @@ export default { }, // 加载历史消息 - async loadHistoryMessages(){ + async loadHistoryMessages() { if (!this.hasMoreHistory || this.isLoadingHistory) { return } @@ -322,18 +323,16 @@ export default { return } - // 将获取到的历史消息添加到消息列表开头 - // 这里需要根据消息的发送方判断是否是自己发送的消息 - historyMessages.map(msg => ( - this.messages = [{ - content: msg.content, - time: new Date(msg.create_time).getTime(), - isSelf: msg.send_client === this.chatTarget.openId, - isLoading: false - }, ...this.messages])) // 因为是按时间降序获取的,所以需要反转 + // 处理历史消息,转换为需要的格式 + const formattedMessages = historyMessages.map(msg => ({ + content: msg.content, + time: new Date(msg.create_time).getTime(), + isSelf: msg.send_client === this.selfClientId, // 修正判断条件 + isLoading: false + })).reverse(); // 反转消息顺序,确保最早的消息在最前面 - // 添加到消息列表开头 - // this.messages = [...formattedMessages, ...this.messages] + // 将格式化后的历史消息添加到消息列表开头 + this.messages = [...formattedMessages, ...this.messages] // 增加页码 this.pageNum++ @@ -346,9 +345,9 @@ export default { }, // 加载更多历史消息 - loadMoreHistory(e){ - // 只有当滚动到顶部时才加载更多历史消息 - if (!e || e.detail.direction === 'top') { + loadMoreHistory(e) { + // 当滚动到顶部时加载更多历史消息 + if (e && e.detail.direction === 'top') { if (!this.isLoadingHistory && this.hasMoreHistory) { this.loadHistoryMessages() } @@ -356,7 +355,7 @@ export default { }, // 发送消息 - sendMessage(){ + sendMessage() { const content = this.inputMessage.trim() console.log('发送消息', content) if (!content || !this.client || !this.isConnected) return @@ -365,7 +364,7 @@ export default { console.log('需要发送的对象', this.chatTarget) // 按照用户提供的格式构建发送消息 const msgData = { - bind_id: this.chatTarget.bindId, // 聊天列表的ID,这里暂时固定为1 + bind_id: this.chatTarget.bindId, // 聊天列表的ID send_client: this.selfClientId, // 消息发送方open_id receive_client: this.chatTarget.openId, // 消息接收方open_id type: 1, // 消息类型,1表示文字消息 @@ -374,17 +373,17 @@ export default { } console.log('发送消息', msgData) this.client.publish( - 'contact/message/send_msg', // 使用指定的发送消息主题 - JSON.stringify(msgData), - { Qos: 0 }, - (err) => { - if (err) { - console.error('发送消息失败', err) - // 可以在这里添加消息发送失败的处理逻辑 - } else { - console.log('发送消息成功') - } + 'contact/message/send_msg', // 使用指定的发送消息主题 + JSON.stringify(msgData), + { Qos: 0 }, + (err) => { + if (err) { + console.error('发送消息失败', err) + // 可以在这里添加消息发送失败的处理逻辑 + } else { + console.log('发送消息成功') } + } ) // 清空输入框 @@ -392,11 +391,11 @@ export default { }, // 处理输入事件 - handleInput(){ + handleInput() { this.canSend = this.inputMessage.trim().length > 0 }, - onInputFocus(){ + onInputFocus() { // 输入框获取焦点时,设置滚动到底部的标记 this.scrollToBottomFlag = true setTimeout(() => { @@ -406,13 +405,13 @@ export default { }, 300) }, - onInputBlur(){ + onInputBlur() { // 输入框失去焦点时,重置滚动标记 this.scrollToBottomFlag = false }, // 是否需要显示时间分割线 - needShowTime(index){ + needShowTime(index) { if (index === 0) return true const currentMsg = this.messages[index] @@ -423,28 +422,28 @@ export default { }, // 格式化时间 - formatTime(time){ + formatTime(time) { const date = new Date(time) const hours = date.getHours().toString().padStart(2, '0') const minutes = date.getMinutes().toString().padStart(2, '0') - return `${ hours }:${ minutes }` + return `${hours}:${minutes}` }, // 滚动到底部 - scrollToBottom(){ + scrollToBottom() { setTimeout(() => { this.scrollToView = 'msg-' + (this.messages.length - 1) }, 100) }, // 返回上一页 - goBack(){ + goBack() { uni.navigateBack() }, // 启动心跳包 - 增强版:添加错误处理和状态检查 - startKeepalive(){ + startKeepalive() { // 停止之前的定时器 this.stopKeepalive() @@ -456,20 +455,20 @@ export default { } this.client.publish( - 'contact/message/keep_time', - JSON.stringify(keepaliveData), - {}, - (err) => { - if (err) { - console.error('发送心跳包失败', err) - // 心跳包发送失败可能表示连接有问题,可以考虑触发重连 - if (!this.isConnected) { - return - } - console.log('心跳包发送失败,尝试检查连接状态') - // 这里可以添加额外的连接检查逻辑 + 'contact/message/keep_time', + JSON.stringify(keepaliveData), + {}, + (err) => { + if (err) { + console.error('发送心跳包失败', err) + // 心跳包发送失败可能表示连接有问题,可以考虑触发重连 + if (!this.isConnected) { + return } + console.log('心跳包发送失败,尝试检查连接状态') + // 这里可以添加额外的连接检查逻辑 } + } ) } else { console.warn('MQTT未连接,停止心跳包') @@ -479,7 +478,7 @@ export default { }, // 停止心跳包 - stopKeepalive(){ + stopKeepalive() { if (this.keepaliveTimer) { clearInterval(this.keepaliveTimer) this.keepaliveTimer = null @@ -487,7 +486,7 @@ export default { }, // 跳转到切换客服页面 - goToChangeService(){ + goToChangeService() { uni.navigateTo({ url: '/packages/customerService/changeService/index?currentMchId=' + this.chatTarget.mchId }) @@ -495,10 +494,10 @@ export default { }, // 页面卸载时停止心跳包 - onUnload(){ + onUnload() { // 断开MQTT连接 if (this.client) { - this.client.disconnect() + this.client.end() } // 停止心跳包 diff --git a/packages/localLife/houseProvident/index.vue b/packages/localLife/houseProvident/index.vue index ada011b8..11e5491e 100644 --- a/packages/localLife/houseProvident/index.vue +++ b/packages/localLife/houseProvident/index.vue @@ -5,12 +5,12 @@ -
物业费公积金
+
物业费
¥{{banlance}}
全部房源合计
全部房源 - 物业费公积金流水 + 物业费流水
diff --git a/packages/localLife/pay/index.vue b/packages/localLife/pay/index.vue index 59f2805b..1a485542 100644 --- a/packages/localLife/pay/index.vue +++ b/packages/localLife/pay/index.vue @@ -58,7 +58,7 @@ 付款记录 - + 首页 diff --git a/packages/workOrderDashboard/wallet/index.vue b/packages/workOrderDashboard/wallet/index.vue index d8fcdf46..d379d8fb 100644 --- a/packages/workOrderDashboard/wallet/index.vue +++ b/packages/workOrderDashboard/wallet/index.vue @@ -24,7 +24,7 @@ - 物业费公积金变动记录 + 物业费变动记录 暂无变动记录 diff --git a/pages/index/index.css b/pages/index/index.css index c7fe18ca..9e2aaf72 100644 --- a/pages/index/index.css +++ b/pages/index/index.css @@ -73,6 +73,14 @@ page { background-color: #f5f5f5; } +.search_input{ + width: 55%; + height: 50rpx; + line-height: 50rpx; + padding: 0 15rpx; + color: #666; +} + .searchBox2 { display: flex; align-items: center; diff --git a/pages/index/index.vue b/pages/index/index.vue index 186c25dc..d77b29b4 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -33,8 +33,11 @@ - + + 请输入内容 + + diff --git a/pages/user/index.vue b/pages/user/index.vue index c4bd5921..ad7450ab 100644 --- a/pages/user/index.vue +++ b/pages/user/index.vue @@ -38,7 +38,7 @@