shizhongqi 11 месяцев назад
Родитель
Сommit
d5bea12da0

+ 81 - 22
hdApp/src/admin/chat/chatPage.vue

@@ -44,17 +44,31 @@
     </scroll-view>
 
     <!-- 输入区域 -->
-    <view class="input-area">
+    <view class="input-area" :style="{ 'padding-bottom': keyboardHeight > 0 ? keyboardHeight + 'px' : 'calc(20upx + env(safe-area-inset-bottom))' }">
       <view class="input-wrapper">
-        <input
+        <textarea
           class="message-input"
           v-model="inputText"
           placeholder="请输入消息..."
           :placeholder-style="placeholderStyle"
           @confirm="sendMessage"
+          @focus="onInputFocus"
+          @blur="onInputBlur"
+          @input="onInputChange"
           confirm-type="send"
+          :adjust-position="false"
+          :auto-height="true"
+          :maxlength="500"
+          :show-confirm-bar="false"
         />
-        <button class="send-button" :class="{ 'send-active': inputText.trim() }" @click="sendMessage" :disabled="!inputText.trim()">发送</button>
+        <button
+          class="send-button"
+          :class="{ 'send-active': inputText.trim() }"
+          @click="sendMessage"
+          :disabled="!inputText.trim()"
+        >
+          发送
+        </button>
       </view>
     </view>
   </view>
@@ -90,12 +104,9 @@ export default {
       reconnectCount: 0,
       maxReconnectCount: 3,
       isManualDisconnect: false, // 添加标志位:是否主动断开连接
-      // 调试选项
-      debugOptions: {
-        forceBasic: false, // 强制使用基础参数
-        forceSegmented: false, // 强制使用分段传输
-        logDetails: true // 是否输出详细日志
-      }
+      // 键盘相关
+      keyboardHeight: 0, // 键盘高度
+      isKeyboardShow: false, // 键盘是否显示
     };
   },
   onLoad(options) {
@@ -143,6 +154,21 @@ export default {
     this.$nextTick(() => {
       this.scrollToBottom();
     });
+     
+    // 监听键盘弹起事件
+    uni.onKeyboardHeightChange((res) => {
+      this.keyboardHeight = res.height;
+      this.isKeyboardShow = res.height > 0;
+      
+      // 键盘弹起时,延迟滚动到底部
+      if (this.isKeyboardShow) {
+        this.$nextTick(() => {
+          setTimeout(() => {
+            this.scrollToBottom();
+          }, 300);
+        });
+      }
+    });
   },
   onUnload() {
     // 页面卸载时关闭WebSocket连接
@@ -664,7 +690,32 @@ export default {
       const hours = String(now.getHours()).padStart(2, '0');
       const minutes = String(now.getMinutes()).padStart(2, '0');
       return `${hours}:${minutes}`;
-    }
+    },
+    // 输入框聚焦事件
+    onInputFocus() {
+      console.log('输入框聚焦');
+      // 微信小程序中,聚焦时延迟滚动到底部
+      setTimeout(() => {
+        this.scrollToBottom();
+      }, 300);
+    },
+
+    // 输入框失焦事件
+    onInputBlur() {
+      console.log('输入框失焦');
+    },
+
+    // 输入内容变化事件
+    onInputChange(e) {
+      // 可以在这里处理输入内容的变化,比如限制行数等
+      const value = e.detail.value;
+      // 限制最大行数为5行,避免输入框过高
+      const lines = value.split('\n');
+      if (lines.length > 5) {
+        // 截取前5行
+        this.inputText = lines.slice(0, 5).join('\n');
+      }
+    },
   }
 };
 </script>
@@ -791,7 +842,7 @@ export default {
 }
 
 .message-text {
-  font-size: 28upx;
+  font-size: 32upx;
   line-height: 1.4;
   color: $fontColorMain;
 }
@@ -814,32 +865,40 @@ export default {
 }
 
 .empty-text {
-  font-size: 28upx;
+  font-size: 32upx;
   color: $fontColor3;
 }
 
 .input-area {
   background-color: #ffffff;
-  padding: 20upx;
+  padding: 26upx;
+  // margin-bottom: 20upx;
   border-top: 1upx solid $borderColor;
-  // 适配安全区域
-  padding-bottom: calc(20upx + env(safe-area-inset-bottom));
+  // 适配安全区域和键盘高度(通过内联样式动态设置)
+  transition: padding-bottom 0.3s ease;
 }
 
 .input-wrapper {
   display: flex;
   align-items: center;
   background-color: #f8f8f8;
-  border-radius: 50upx;
-  padding: 16upx 20upx;
+  border-radius: 40upx;
+  padding: 14upx 18upx 14upx 18upx;
+  margin-bottom: 30upx;
 }
 
 .message-input {
   flex: 1;
-  font-size: 28upx;
+  font-size: 32upx;
   border: none;
   background-color: transparent;
   outline: none;
+  min-height: 28upx;
+  max-height: 140upx;
+  line-height: 1.4;
+  word-wrap: break-word;
+  word-break: break-all;
+  resize: none;
 
   &::placeholder {
     color: #ccc;
@@ -848,12 +907,12 @@ export default {
 
 .send-button {
   margin-left: 20upx;
-  padding: 12upx 32upx;
+  padding: 10upx 30upx;
   background-color: $fontColor4;
   color: #ffffff;
-  border: none;
-  border-radius: 50upx;
-  font-size: 26upx;
+  border: 1px solid #c9c9c9;
+  border-radius: 30upx;
+  font-size: 28upx;
   transition: all 0.3s ease;
 
   &.send-active {

+ 22 - 1
hdApp/src/admin/chat/list.vue

@@ -18,6 +18,9 @@
                   </view>
                 </view>
               </view>
+              <view v-if="item.unReadNum > 0" class="unread-badge">
+                {{ item.unReadNum > 9 ? '9+' : item.unReadNum }}
+              </view>
             </view>
           </tui-list-cell>
         </block>
@@ -127,7 +130,7 @@ export default {
         // 判断是否是今年
         else if (year === this.currentYear) {
           // 如果是今年但不是今天或昨天,显示月日和时间,如 "09-01 12:24"
-          return chatTime.substring(5, 14); // 直接截取 "MM-DD HH:mm" 部分
+          return chatTime.substring(5, 16); // 直接截取 "MM-DD HH:mm" 部分
         }
         // 如果不是今年,显示完整日期
         else {
@@ -229,6 +232,24 @@ export default {
   }
 }
 
+.unread-badge {
+  position: absolute;
+  top: 50%;
+  right: 60upx;
+  transform: translateY(-50%);
+  background-color: #ff4d4f;
+  color: #ffffff;
+  font-size: 28upx;
+  min-width: 42upx;
+  height: 42upx;
+  border-radius: 21upx;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  padding: 0 10upx;
+  box-sizing: border-box;
+}
+
 // 确保箭头正常显示
 ::v-deep .tui-list-cell.tui-cell-arrow:before {
   z-index: 10;

+ 45 - 40
hdApp/src/admin/home/workbench.vue

@@ -12,7 +12,8 @@
         <view class="today-overview-card">
           <view class="today-header">
             <view class="today-title">今日概况</view>
-            <zui-svg-icon icon="home-message" color="#FFFFFF" :width="26" :height="26" @click="pageTo({url:'/admin/chat/list'})" />
+            <zui-svg-icon icon="home-message" color="#FFFFFF" :width="32" :height="29" @click="pageTo({url:'/admin/chat/list'})" />
+            <view class="red-mind" v-if="unReadMsgNum>0">{{ unReadMsgNum>9?'9+':unReadMsgNum }}</view>
           </view>
           
           <view class="today-income-section" @click="pageTo({url:'/admin/stat/kdIncome'})">
@@ -446,17 +447,16 @@
 import { mapGetters } from "vuex";
 import { getWeixinId } from "@/api/invite";
 import { getShortUrl } from "@/api/main";
-import { getStat,getStrokeCount } from '@/api/console'
+import { getStat } from '@/api/console' //getStrokeCount 已弃用
 import { consoleIndex } from "@/api/workbench";
-import NotLogin from "@/components/not-login";
 import autoUpdateMixins from "@/mixins/autoUpdate";
 import { ghsList } from "@/api/purchase";
 import { changeDelStatus,hasMoreGhs } from "@/api/ghs";
 import {currentShop} from "@/api/shop";
 import { clearLogin,hasNotice } from "@/api/admin";
+import { unReadMsgCount } from "@/api/chat";
 export default {
   name: "workbench",
-  components: { NotLogin },
   mixins: [autoUpdateMixins],
   data () {
     return {
@@ -473,20 +473,17 @@ export default {
         isMini:0
       },
       yesterdayIncome: 0,
-      lskd1: `${this.$constant.imgUrl}/ghs/home/lskd001.jpg`,
-      lskd2: `${this.$constant.imgUrl}/ghs/home/lskd002.jpg`,
-      lskd3: `${this.$constant.imgUrl}/ghs/home/lskd003.jpg`,
       supplierList: [],
       //登录状态 0未登录 1登录仅用到了采购 2登录用到完整功能
       loginStyle :0,
       backAction:'',
-      countStat:{systemIncome:0,systemCount:0,debtCount:0,debtIncome:0,kfWxCount:0,kfWxIncome:0},
       lookMoney:1,
       currentGhs:{},
       displaySupplierList: [],// 用于显示在弹框中的供货商列表
       shopInfo:[],
       urlNo:1,
-      shortUrlList:[]
+      shortUrlList:[],
+      unReadMsgNum:0, //未读消息数
     };
   },
   computed: {
@@ -497,15 +494,7 @@ export default {
 		loginInfo(newVal) {
       if(!this.$util.isEmpty(newVal.admin) && newVal.admin.currentShopId > 0){
           if(!this.$util.isEmpty(newVal.onlyCg)){
-            if(Number(newVal.onlyCg) == 1){
-              this.loginStyle  = 1
-              uni.hideTabBar()
-              this.toRemindCustom()
-            }else{
-              this.loginStyle  = 2
-              uni.showTabBar()
-              this.getMallData()
-            }
+            this.handleLoginStyle(newVal.onlyCg)
           }
       }
 		}
@@ -515,7 +504,6 @@ export default {
     uni.stopPullDownRefresh();
   },
   onShow () {
-
       if(this.backAction == 'login'){
         this.init()
       }
@@ -526,20 +514,12 @@ export default {
 
       if(!this.$util.isEmpty(this.loginInfo.admin) && this.loginInfo.admin.currentShopId > 0){
           if(!this.$util.isEmpty(this.loginInfo.onlyCg)){
-            if(Number(this.loginInfo.onlyCg) == 1){
-              this.loginStyle  = 1
-              uni.hideTabBar()
-              this.toRemindCustom()
-            }else{
-              this.loginStyle  = 2
-              uni.showTabBar()
-              this.getMallData()
-            }
+            this.handleLoginStyle(this.loginInfo.onlyCg)
           }
       }
 
       this.showShopName()
-
+      this.getUnReadMsgCount()
   },
 	onShareAppMessage(res) {
 		return {
@@ -550,6 +530,17 @@ export default {
 		}
 	},
   methods: {
+    handleLoginStyle(onlyCg){
+      if(Number(onlyCg) == 1){
+        this.loginStyle  = 1
+        uni.hideTabBar()
+        this.toRemindCustom()
+      }else{
+        this.loginStyle  = 2
+        uni.showTabBar()
+        this.getMallData()
+      }
+    },
     getMallData(){
       getWeixinId().then(res => {
         this.getappIdList = res.data
@@ -648,10 +639,7 @@ export default {
     goMore(){
       let that = this
       let shopkeeper = this.loginInfo.staff && this.loginInfo.staff.founder == 2 //判断店主(老板)
-      let items = ['已屏蔽商家', '我已离职', '开关商城', '也要一个此商城', '修改密码', '退出登录'];
-      if(shopkeeper) {
-        items = ['已屏蔽商家', '改进建议', '开关商城', '也要一个此商城', '修改密码', '退出登录'];
-      }
+      let items = shopkeeper ? ['已屏蔽商家', '改进建议', '开关商城', '也要一个此商城', '修改密码', '退出登录'] : ['已屏蔽商家', '我已离职', '开关商城', '也要一个此商城', '修改密码', '退出登录'];
       uni.showActionSheet({
         itemList: items,
         success: function (res) {
@@ -814,7 +802,6 @@ export default {
       this.$util.pageTo(item)
     },
     init () {
-
         this.getGHSList()
 
         // #ifdef MP-WEIXIN
@@ -827,12 +814,6 @@ export default {
           this.lookMoney = res.data.lookMoney
         })
 
-        getStrokeCount().then(res=>{
-          if(res.code == 1){
-            this.countStat = res.data
-          }
-        })
-
         getStat().then(res=>{
           if(res.code == 1){
             that.overview = res.data.overview
@@ -967,6 +948,13 @@ export default {
 				return false
       }
 			// #endif
+    },
+    getUnReadMsgCount(){
+      unReadMsgCount().then(res=>{
+        if(res.code == 1){
+          this.unReadMsgNum = res.data.msg_count
+        }
+      })
     }
   }
 };
@@ -1679,4 +1667,21 @@ export default {
     }
   }
 }
+
+.red-mind{
+  width: 42upx;
+  height: 42upx;
+  line-height: 38upx;
+  font-size: 28upx;
+  font-weight: 700;
+  text-align: center;
+  position: absolute;
+  right: 16upx;
+  top: 10upx;
+  color: white;
+  background-color: red;
+  border: 1upx solid red;
+  border-radius: 26upx;
+  display: inline-block;
+}
 </style>

+ 3 - 1
hdApp/src/api/chat/index.js

@@ -2,4 +2,6 @@ import https from '@/plugins/luch-request_0.0.7/request'
 
 export const getLatestUsers = param => https.post('/chat/latest-users', param)
 
-export const getChatHistory = param => https.post('/chat/chat-history', param)
+export const getChatHistory = param => https.post('/chat/chat-history', param)
+
+export const unReadMsgCount = param => https.post('/chat/un-read-msg-count', param)

+ 14 - 1
hdApp/src/utils/util.js

@@ -238,18 +238,31 @@ export const $formatDate = (num, fmt = "YYYY-MM-DD HH:mm", all) => {
 	return fmt;
 };
 
+// 防重复导航的时间间隔(毫秒)
+let lastNavigateTime = 0;
+const NAVIGATE_THROTTLE_TIME = 600;
+
 /** *
- * 全局公共按钮跳转
+ * 全局公共按钮跳转(已添加防重复点击功能)
  * @parmas item.funtion 为可执行函数
  * @parmas item.url 为跳转的路径
  * @parmas item.query 为跳转携带的参数
  * @parmas item.type 为跳转调用的函数 1为navigateTo, 2为redirectTo 关闭当前页,跳转到指定页, 3为reLaunch, 4为switchTab
  */
 export const pageTo = item => {
+	// 防重复点击逻辑
+	const currentTime = Date.now();
+	if (currentTime - lastNavigateTime < NAVIGATE_THROTTLE_TIME) {
+		console.log('导航操作过于频繁,已忽略');
+		return false;
+	}
+	lastNavigateTime = currentTime;
+
 	if (isNumber(item)) {
 		uni.navigateBack({
 			delta: item
 		});
+		return false;
 	}
 	if (isString(item)) {
 		uni.navigateTo({

+ 3 - 1
mallApp/src/api/chat/index.js

@@ -2,4 +2,6 @@ import https from '@/plugins/luch-request_0.0.7/request'
 
 export const getLatestUsers = param => https.post('/chat/latest-users', param)
 
-export const getChatHistory = param => https.post('/chat/chat-history', param)
+export const getChatHistory = param => https.post('/chat/chat-history', param)
+
+export const unReadMsgCount = param => https.post('/chat/un-read-msg-count', param)

+ 72 - 13
mallApp/src/pages/chat/chatPage.vue

@@ -61,15 +61,22 @@
     </scroll-view>
 
     <!-- 输入区域 -->
-    <view class="input-area">
+    <view class="input-area" :style="{ 'padding-bottom': keyboardHeight > 0 ? keyboardHeight + 'px' : 'calc(20upx + env(safe-area-inset-bottom))' }">
       <view class="input-wrapper">
-        <input
+        <textarea
           class="message-input"
           v-model="inputText"
           placeholder="请输入消息..."
           :placeholder-style="placeholderStyle"
           @confirm="sendMessage"
+          @focus="onInputFocus"
+          @blur="onInputBlur"
+          @input="onInputChange"
           confirm-type="send"
+          :adjust-position="false"
+          :auto-height="true"
+          :maxlength="500"
+          :show-confirm-bar="false"
         />
         <button
           class="send-button"
@@ -117,6 +124,9 @@ export default {
       reconnectCount: 0,
       maxReconnectCount: 3,
       isManualDisconnect: false, // 添加标志位:是否主动断开连接
+      // 键盘相关
+      keyboardHeight: 0, // 键盘高度
+      isKeyboardShow: false, // 键盘是否显示
     };
   },
   onLoad(options) {
@@ -167,6 +177,21 @@ export default {
     this.$nextTick(() => {
       this.scrollToBottom();
     });
+    
+    // 监听键盘弹起事件
+    uni.onKeyboardHeightChange((res) => {
+      this.keyboardHeight = res.height;
+      this.isKeyboardShow = res.height > 0;
+      
+      // 键盘弹起时,延迟滚动到底部
+      if (this.isKeyboardShow) {
+        this.$nextTick(() => {
+          setTimeout(() => {
+            this.scrollToBottom();
+          }, 300);
+        });
+      }
+    });
   },
   onUnload() {
     // 页面卸载时关闭WebSocket连接
@@ -701,6 +726,32 @@ export default {
       const minutes = String(now.getMinutes()).padStart(2, "0");
       return `${hours}:${minutes}`;
     },
+
+    // 输入框聚焦事件
+    onInputFocus() {
+      console.log('输入框聚焦');
+      // 微信小程序中,聚焦时延迟滚动到底部
+      setTimeout(() => {
+        this.scrollToBottom();
+      }, 300);
+    },
+
+    // 输入框失焦事件
+    onInputBlur() {
+      console.log('输入框失焦');
+    },
+
+    // 输入内容变化事件
+    onInputChange(e) {
+      // 可以在这里处理输入内容的变化,比如限制行数等
+      const value = e.detail.value;
+      // 限制最大行数为5行,避免输入框过高
+      const lines = value.split('\n');
+      if (lines.length > 5) {
+        // 截取前5行
+        this.inputText = lines.slice(0, 5).join('\n');
+      }
+    },
   },
 };
 </script>
@@ -827,7 +878,7 @@ export default {
 }
 
 .message-text {
-  font-size: 28upx;
+  font-size: 32upx;
   line-height: 1.4;
   color: $fontColorMain;
 }
@@ -850,32 +901,40 @@ export default {
 }
 
 .empty-text {
-  font-size: 28upx;
+  font-size: 32upx;
   color: $fontColor3;
 }
 
 .input-area {
   background-color: #ffffff;
   padding: 20upx;
+  // margin-bottom: 20upx;
   border-top: 1upx solid $borderColor;
-  // 适配安全区域
-  padding-bottom: calc(20upx + env(safe-area-inset-bottom));
+  // 适配安全区域和键盘高度(通过内联样式动态设置)
+  transition: padding-bottom 0.3s ease;
 }
 
 .input-wrapper {
   display: flex;
   align-items: center;
   background-color: #f8f8f8;
-  border-radius: 50upx;
-  padding: 16upx 20upx;
+  border-radius: 40upx;
+  padding: 14upx 22upx 14upx 22upx;
+  margin-bottom: 30upx;
 }
 
 .message-input {
   flex: 1;
-  font-size: 28upx;
+  font-size: 32upx;
   border: none;
   background-color: transparent;
   outline: none;
+  min-height: 28upx;
+  max-height: 140upx;
+  line-height: 1.4;
+  word-wrap: break-word;
+  word-break: break-all;
+  resize: none;
 
   &::placeholder {
     color: #ccc;
@@ -884,12 +943,12 @@ export default {
 
 .send-button {
   margin-left: 20upx;
-  padding: 12upx 32upx;
+  padding: 10upx 30upx;
   background-color: $fontColor4;
   color: #ffffff;
-  border: none;
-  border-radius: 50upx;
-  font-size: 26upx;
+  border: 1px solid #c9c9c9;
+  border-radius: 30upx;
+  font-size: 30upx;
   transition: all 0.3s ease;
 
   &.send-active {

+ 22 - 1
mallApp/src/pages/chat/list.vue

@@ -39,6 +39,9 @@
                   </view>
                 </view>
               </view>
+              <view v-if="item.unReadNum > 0" class="unread-badge">
+                {{ item.unReadNum > 9 ? '9+' : item.unReadNum }}
+              </view>
             </view>
           </tui-list-cell>
         </block>
@@ -145,7 +148,7 @@ export default {
         // 判断是否是今年
         else if (year === this.currentYear) {
           // 如果是今年但不是今天或昨天,显示月日和时间,如 "09-01 12:24"
-          return chatTime.substring(5, 14); // 直接截取 "MM-DD HH:mm" 部分
+          return chatTime.substring(5, 16); // 直接截取 "MM-DD HH:mm" 部分
         }
         // 如果不是今年,显示完整日期
         else {
@@ -247,6 +250,24 @@ export default {
   }
 }
 
+.unread-badge {
+  position: absolute;
+  top: 50%;
+  right: 60upx;
+  transform: translateY(-50%);
+  background-color: #ff4d4f;
+  color: #ffffff;
+  font-size: 28upx;
+  min-width: 42upx;
+  height: 42upx;
+  border-radius: 21upx;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  padding: 0 10upx;
+  box-sizing: border-box;
+}
+
 // 确保箭头正常显示
 ::v-deep .tui-list-cell.tui-cell-arrow:before {
   z-index: 10;

+ 5 - 5
mallApp/src/pages/goods/components/buy-foot.vue

@@ -1,21 +1,21 @@
 <template>
 	<view class="app-footer">
-        <view class="btn-left" v-if="priceType == 1">
+        <view class="btn-left">
             <view class="btn-wrap">
                 <i class="iconfont icondianpu"></i>
                 <view class="btn-text">店铺</view>
             </view>
-            <view class="btn-wrap">
+            <view class="btn-wrap" @click="goChat">
                 <i class="iconfont iconxiaoxi"></i>
-                <view class="btn-text" @click="goChat">咨询</view>
+                <view class="btn-text">咨询</view>
             </view>
         </view>
-        <view class="btn-text" v-else-if="priceType == 0">
+        <!-- <view class="btn-right">
             <view class="btn-wrap">
                 <i class="iconfont iconxiaoxi"></i>
                 <view class="btn-text" @click="goChat">咨询</view>
             </view>
-        </view>
+        </view> -->
         <div class="btn-right">
             <button v-if="priceType == 1" class="button-com red" @click="buy">购买</button>
             <button v-else class="button-com red" @click.stop="goChat">询价</button>

+ 13 - 12
mallApp/src/pages/goods/detail.vue

@@ -13,7 +13,7 @@
       <view class="app-price app-bold" v-if="data.priceType == 1">
         <text>¥</text>
         <text class="app-size-34">{{
-          data.price ? parseFloat(data.price) : 0
+          data.price ? parseFloat(data.price).toFixed(2) : 0
         }}</text>
       </view>
       <view class="tui-pro-titbox">
@@ -212,25 +212,26 @@ export default {
       // #endif
     },
     goChat(){
-      if(parseInt(this.loginInfo.id) <= 0){
-        this.$msg("数据异常,请稍后再试");
+      if(isNaN(parseInt(this.loginInfo.id))){
+        this.$msg("登录用户数据异常,请稍后再试");
         return;
       }
-      if(parseInt(this.customId) <= 0){
-        this.$msg("数据异常,请稍后再试");
+      if(isNaN(parseInt(this.customId))){
+        this.$msg("客户数据异常,请稍后再试");
         return;
       }
-      if(parseInt(this.shopInfo.shopAdminId) <= 0){
-        this.$msg("数据异常,请稍后再试");
-        return;
-      }
-      if(parseInt(this.shopInfo.shopId) <= 0){
-        this.$msg("数据异常,请稍后再试");
+      // if(isNaN(parseInt(this.shopInfo.shopAdminId))){ // 无需 staffId
+      //   this.$msg("门店员工数据异常,请稍后再试");
+      //   return;
+      // }
+      if(isNaN(parseInt(this.shopInfo.shopId))){
+        this.$msg("门店数据异常,请稍后再试");
         return;
       }
+
       this.$util.pageTo({
         url: "/pages/chat/chatPage",
-        query: { userId: this.loginInfo.id, customId: this.customId, staffId: this.shopInfo.shopAdminId, shopId: this.shopInfo.shopId, name: this.loginInfo.name, avatar: this.loginInfo.avatar }
+        query: { userId: this.loginInfo.id, customId: this.customId, staffId: 0, shopId: this.shopInfo.shopId, name: this.loginInfo.name, avatar: this.loginInfo.avatar }
       });
     }
   },

+ 4 - 1
mallApp/src/pages/home/category.vue

@@ -176,7 +176,10 @@ export default {
   methods: {
     toBuy(item){
       let account = this.option.account?this.option.account:0
-      this.$util.pageTo({url:"/pages/goods/detail?id="+item.id+'&hdId='+this.hdId+'&categoryId='+this.form.categoryId+'&account='+account})
+      this.$util.pageTo({
+        url:"/pages/goods/detail",
+        query: { id: item.id, hdId: this.hdId, shopId: account, shopAdminId: 0, categoryId: this.form.categoryId, account: account }
+      })
     },
     buyProduct(){
       let account = this.option.account?this.option.account:0

+ 11 - 1
mallApp/src/pages/home/recent.vue

@@ -58,7 +58,7 @@
                 <text class="function-icon">💬</text>
                 <text class="function-text">新消息</text>
               </view>
-              <view class="message-badge">1</view>
+              <view v-if="unReadMsgNum > 0" class="message-badge">{{ unReadMsgNum > 9 ? '9+' : unReadMsgNum }}</view>
             </view>
             <view class="function-item" @click="">
               <text class="function-icon">📱</text>
@@ -214,6 +214,7 @@ import { mapGetters } from "vuex";
 import { currentInfo } from "@/api/user";
 import { list } from "@/mixins";
 import { APIHOST } from "@/config";
+import { unReadMsgCount } from "@/api/chat";
 export default {
   name: "recent",
   components: {
@@ -231,6 +232,7 @@ export default {
       activePopupIndex: -1,
       pageAction: { refresh: 0 },
       user: { name: "", smallAvatar: "", id: 0 },
+      unReadMsgNum:0, //未读消息数
     };
   },
   computed: {
@@ -255,6 +257,7 @@ export default {
       this.init();
       this.pageAction.refresh == 0;
     }
+    this.getUnReadMsgCount()
   },
   onPullDownRefresh() {
     this.resetList();
@@ -421,6 +424,13 @@ export default {
         fail: () => uni.showToast({ title: "上传失败", icon: "none" }),
       });
     },
+    getUnReadMsgCount(){
+      unReadMsgCount().then(res=>{
+        if(res.code == 1){
+          this.unReadMsgNum = res.data.msg_count
+        }
+      })
+    }
   },
 };
 </script>