shizhongqi пре 11 месеци
родитељ
комит
8a61c5d975

+ 21 - 0
hdApp/src/admin/chat/list.vue

@@ -18,6 +18,9 @@
                   </view>
                   </view>
                 </view>
                 </view>
               </view>
               </view>
+              <view v-if="item.unReadNum > 0" class="unread-badge">
+                {{ item.unReadNum > 9 ? '9+' : item.unReadNum }}
+              </view>
             </view>
             </view>
           </tui-list-cell>
           </tui-list-cell>
         </block>
         </block>
@@ -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 {
 ::v-deep .tui-list-cell.tui-cell-arrow:before {
   z-index: 10;
   z-index: 10;

+ 30 - 4
hdApp/src/admin/home/workbench.vue

@@ -12,7 +12,8 @@
         <view class="today-overview-card">
         <view class="today-overview-card">
           <view class="today-header">
           <view class="today-header">
             <view class="today-title">今日概况</view>
             <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>
           
           
           <view class="today-income-section" @click="pageTo({url:'/admin/stat/kdIncome'})">
           <view class="today-income-section" @click="pageTo({url:'/admin/stat/kdIncome'})">
@@ -453,6 +454,7 @@ import { ghsList } from "@/api/purchase";
 import { changeDelStatus,hasMoreGhs } from "@/api/ghs";
 import { changeDelStatus,hasMoreGhs } from "@/api/ghs";
 import {currentShop} from "@/api/shop";
 import {currentShop} from "@/api/shop";
 import { clearLogin,hasNotice } from "@/api/admin";
 import { clearLogin,hasNotice } from "@/api/admin";
+import { unReadMsgCount } from "@/api/chat";
 export default {
 export default {
   name: "workbench",
   name: "workbench",
   mixins: [autoUpdateMixins],
   mixins: [autoUpdateMixins],
@@ -480,7 +482,8 @@ export default {
       displaySupplierList: [],// 用于显示在弹框中的供货商列表
       displaySupplierList: [],// 用于显示在弹框中的供货商列表
       shopInfo:[],
       shopInfo:[],
       urlNo:1,
       urlNo:1,
-      shortUrlList:[]
+      shortUrlList:[],
+      unReadMsgNum:0, //未读消息数
     };
     };
   },
   },
   computed: {
   computed: {
@@ -501,7 +504,6 @@ export default {
     uni.stopPullDownRefresh();
     uni.stopPullDownRefresh();
   },
   },
   onShow () {
   onShow () {
-
       if(this.backAction == 'login'){
       if(this.backAction == 'login'){
         this.init()
         this.init()
       }
       }
@@ -517,7 +519,7 @@ export default {
       }
       }
 
 
       this.showShopName()
       this.showShopName()
-
+      this.getUnReadMsgCount()
   },
   },
 	onShareAppMessage(res) {
 	onShareAppMessage(res) {
 		return {
 		return {
@@ -946,6 +948,13 @@ export default {
 				return false
 				return false
       }
       }
 			// #endif
 			// #endif
+    },
+    getUnReadMsgCount(){
+      unReadMsgCount().then(res=>{
+        if(res.code == 1){
+          this.unReadMsgNum = res.data.msg_count
+        }
+      })
     }
     }
   }
   }
 };
 };
@@ -1658,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>
 </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 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)

+ 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 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)

+ 21 - 0
mallApp/src/pages/chat/list.vue

@@ -39,6 +39,9 @@
                   </view>
                   </view>
                 </view>
                 </view>
               </view>
               </view>
+              <view v-if="item.unReadNum > 0" class="unread-badge">
+                {{ item.unReadNum > 9 ? '9+' : item.unReadNum }}
+              </view>
             </view>
             </view>
           </tui-list-cell>
           </tui-list-cell>
         </block>
         </block>
@@ -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 {
 ::v-deep .tui-list-cell.tui-cell-arrow:before {
   z-index: 10;
   z-index: 10;

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

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