Эх сурвалжийг харах

Merge branch 'zhongqi-chat'

shizhongqi 10 сар өмнө
parent
commit
86465388e5

+ 72 - 87
hdApp/src/admin/chat/chatPage.vue

@@ -26,7 +26,6 @@
           </view>
 
           <view v-if="message.messageType == 'text' || message.messageType != 'goods'" class="message-content-wrapper">
-            <view class="username" v-if="isMultiUser">{{ message.username }}</view>
             <view class="message-bubble left-bubble">
               <text class="message-text">{{ message.message }}</text>
             </view>
@@ -34,7 +33,6 @@
           </view>
 
           <view v-if="message.messageType == 'goods'" class="goods-content-wrapper">
-            <view class="username align-right" v-if="isMultiUser">{{ message.username }}</view>
             <view class="goods-info left-bubble">
               <view class="goods-main" @click="toGoodsDetail(message.goodsInfo)">
                 <image class="goods-image" :src="message.goodsInfo.goodsImg" mode="aspectFill"></image>
@@ -61,13 +59,13 @@
                     @focus="hideKeyboard"
                     @blur="showKeyboard"
                   />
-                  <button class="action-btn buy-btn" form-type="submit">价</button>
+                  <button class="action-btn buy-btn" form-type="submit">价</button>
                 </form>
               </view>
               <view v-else>
-                <text v-if="message.goodsInfo.goodsPriceType == 0">报价窗口期已过,无法报价</text>
+                <text v-if="message.goodsInfo.goodsPriceType == 0">改价窗口期已过</text>
               </view>
-              <!-- 报价类型显示重新报价 -->
+              <!-- 改价类型显示重新改价 -->
               <view v-if="message.goodsInfo.goodsPriceType == 2 && isExpired(message.timestamp)" class="action-buttons">
                 <form @submit.prevent="createQrotedPrice(message)">
                   <text class="goods-price" v-if="message.goodsInfo.lastPrice || message.goodsInfo.goodsPrice"
@@ -81,7 +79,7 @@
                     @focus="hideKeyboard"
                     @blur="showKeyboard"
                   />
-                  <button class="action-btn buy-btn" form-type="submit">重新价</button>
+                  <button class="action-btn buy-btn" form-type="submit">重新价</button>
                 </form>
               </view>
             </view>
@@ -92,7 +90,6 @@
         <!-- 右侧消息(我的) -->
         <view class="message-right" v-if="message.isMine">
           <view v-if="message.messageType == 'text' || message.messageType != 'goods'" class="message-content-wrapper">
-            <view class="username align-right" v-if="isMultiUser">{{ message.username }}</view>
             <view class="message-bubble right-bubble">
               <text class="message-text">{{ message.message }}</text>
             </view>
@@ -100,7 +97,6 @@
           </view>
 
           <view v-if="message.messageType == 'goods'" class="goods-content-wrapper">
-            <view class="username align-right" v-if="isMultiUser">{{ message.username }}</view>
             <view class="goods-info right-bubble">
               <view class="goods-main" @click="toGoodsDetail(message.goodsInfo)">
                 <image class="goods-image" :src="message.goodsInfo.goodsImg" mode="aspectFill" />
@@ -108,9 +104,7 @@
                   <view class="goods-name-wrapper">
                     <text class="goods-name">{{ message.goodsInfo.goodsName }}</text>
                   </view>
-                  <text v-if="message.goodsInfo.goodsPriceType == 1 || message.goodsInfo.goodsPriceType == 2" class="goods-price"
-                    >¥{{ parseFloat(message.goodsInfo.goodsPrice).toFixed(2) }}</text
-                  >
+                  <text v-if="message.goodsInfo.goodsPriceType == 1 || message.goodsInfo.goodsPriceType == 2" class="goods-price">¥{{ parseFloat(message.goodsInfo.goodsPrice).toFixed(2) }}</text>
                   <view class="sales-info">
                     <!-- <text class="delivery-time">48小时发</text> -->
                   </view>
@@ -126,7 +120,7 @@
               <!--<view class="action-buttons">
                 <button class="action-btn spec-btn" @click="toGoodsDetail(message.goodsInfo)">查看商品</button>
                 <button v-if="message.goodsInfo.goodsPriceType == 1" class="action-btn buy-btn" @click="toBuy">去购买</button>
-                //价类型显示去购买
+                //价类型显示去购买
                 <button v-if="message.goodsInfo.goodsPriceType == 2" class="action-btn buy-btn" @click="toBuy">去购买</button>
               </view> -->
             </view>
@@ -181,8 +175,6 @@ export default {
       scrollTop: 0,
       scrollIntoView: '',
       placeholderStyle: 'color: #ccc; font-size: 28upx;',
-      // 是否多人聊天
-      isMultiUser: false,
       // 当前用户信息
       currentUser: {
         userId: 0,  //客户登录帐户的id(不是 customId)
@@ -212,66 +204,17 @@ export default {
       isKeyboardShow: false, // 键盘是否显示
       inputFocus: false, // 输入框焦点
       isInputFocused: false, // 标记输入框是否聚焦
-      expireTime: 23 * 60 * 60, // 商品报价有效窗口时长 -- 23小时
+      expireTime: 24 * 60 * 60, // 商品改价有效窗口时长 -- 24小时
       msgInputShow: true, // 消息输入框是否显示
     };
   },
   onLoad(options) {
-    // console.log('---------- options: ', options);
-    if (options.chatPerson) {
-      // 设置聊天人名称
-      uni.setNavigationBarTitle({
-        title: options.chatPerson
-      });
-    }
-
-    // 根据传入参数判断是否多人聊天
-    if (options.isMultiUser) {
-      this.isMultiUser = options.isMultiUser === 'true';
-    }
-
-    if (options.userId) {
-      this.currentUser.userId = parseInt(options.userId);
-      if(this.currentUser.userId == 0) {
-        console.error('userId 出错 ---------- this.currentUser.userId: ', this.currentUser.userId);
-      }
-    }
-    if (options.customId) {
-      this.currentUser.customId = parseInt(options.customId);
-      if(this.currentUser.customId == 0) {
-        console.error('customId 出错 ---------- this.currentUser.customId: ', this.currentUser.customId);
-      }
-    }
-    if (options.shopId) {
-      this.currentUser.shopId = parseInt(options.shopId);
-      if(this.currentUser.shopId == 0) {
-        console.error('shopId 出错 ---------- this.currentUser.shopId: ', this.currentUser.shopId);
-      }
-    }
-    if (options.name) {
-      this.currentUser.username = options.name;
-    }
-    if (options.staffId) {
-      this.currentUser.staffId = parseInt(options.staffId);
-    }
-    if (options.avatar) {
-      this.currentUser.avatar = options.avatar;
-    }
-
-    // 获取房间号
-    if (this.currentUser.customId && this.currentUser.shopId) {
-      this.room = 'custom_id-' + this.currentUser.customId + 'AND' + 'shop_id-' + this.currentUser.shopId;
-    } else {
-      // 如果没有传入房间号,使用默认值或生成一个
-      this.room = 'default_room';
-      console.error('房间号为默认房间 ---------- this.room: ', this.room);
-    }
-    // console.log('---------- this.room: ', this.room);
-
-    // 加载聊天记录
-    this.loadChatHistory();
-    // 连接WebSocket
-    this.connectWebSocket();
+    const eventChannel = this.getOpenerEventChannel();
+    eventChannel.on('acceptDataFromList', (data) => {
+      this.pageParams = data;
+      // console.log("---------- pageParams: ", data);
+      this.initializePage(data);
+    })
   },
   onReady() {
     // 页面加载完成后滚动到底部
@@ -310,6 +253,58 @@ export default {
   },
   methods: {
     init() {},
+
+    initializePage(options) {
+      if (options.chatPerson) {
+        // 设置聊天人名称
+        uni.setNavigationBarTitle({
+          title: options.chatPerson
+        });
+      }
+
+      if (options.userId) {
+        this.currentUser.userId = parseInt(options.userId);
+        if(this.currentUser.userId == 0) {
+          console.error('userId 出错 ---------- this.currentUser.userId: ', this.currentUser.userId);
+        }
+      }
+      if (options.customId) {
+        this.currentUser.customId = parseInt(options.customId);
+        if(this.currentUser.customId == 0) {
+          console.error('customId 出错 ---------- this.currentUser.customId: ', this.currentUser.customId);
+        }
+      }
+      if (options.shopId) {
+        this.currentUser.shopId = parseInt(options.shopId);
+        if(this.currentUser.shopId == 0) {
+          console.error('shopId 出错 ---------- this.currentUser.shopId: ', this.currentUser.shopId);
+        }
+      }
+      if (options.name) {
+        this.currentUser.username = options.name;
+      }
+      if (options.staffId) {
+        this.currentUser.staffId = parseInt(options.staffId);
+      }
+      if (options.avatar) {
+        this.currentUser.avatar = options.avatar;
+      }
+
+      // 获取房间号
+      if (this.currentUser.customId && this.currentUser.shopId) {
+        this.room = 'custom_id-' + this.currentUser.customId + 'AND' + 'shop_id-' + this.currentUser.shopId;
+      } else {
+        // 如果没有传入房间号,使用默认值或生成一个
+        this.room = 'default_room';
+        console.error('房间号为默认房间 ---------- this.room: ', this.room);
+      }
+      // console.log('---------- this.room: ', this.room);
+
+      // 加载聊天记录
+      this.loadChatHistory();
+      // 连接WebSocket
+      this.connectWebSocket();
+    },
     // 加载聊天历史记录
     loadChatHistory() {
       getChatHistory({
@@ -946,8 +941,8 @@ export default {
         // 如果是字符串,则尝试解析
         if (typeof messageStr === 'string') {
           let parsed = JSON.parse(messageStr);
-          if(parsed.goodsPriceType == 0) { // 无价格类型,则要请求后端获取报价,再根据结果展示
-            // 如果没有过期,请求后端获取报价
+          if(parsed.goodsPriceType == 0) { // 无价格类型,则要请求后端获取修改价格,再根据结果展示
+            // 如果没有过期,请求后端获取修改价格
             const now = Math.floor(Date.now()/1000);
             const timeDiff = now - parsed.timestamp;
             const expireTime = 24 * 60 * 60;
@@ -961,10 +956,10 @@ export default {
                 getQuotedPrice({
                   key: key,
                 }).then(res => {
-                  console.log("res", res)
+                  // console.log("res", res)
                   if (res.code == 1) {
                     if (res.data.price != -1) {
-                      parsed.goodsPriceType = 2; // 价类型
+                      parsed.goodsPriceType = 2; // 价类型
                       parsed.goodsPrice = parseFloat(res.data.price).toFixed(2);
                     }
                   }
@@ -976,7 +971,7 @@ export default {
           } else if(parsed.goodsPriceType == 1) {
             // console.log("parsed 有价格:", parsed);
           } else if(parsed.goodsPriceType == 2) {
-            // console.log("parsed 重新价:", parsed);
+            // console.log("parsed 重新价:", parsed);
           } else {
             console.error("parsed 其他类型:", parsed);
             return {};
@@ -998,7 +993,7 @@ export default {
       }
     },
 
-    // 发送商品价信息
+    // 发送商品价信息
     sendMessageOfGoodsPrice(currentGoodsInfo) {
       if (!this.isConnected) {
         uni.showToast({
@@ -1083,7 +1078,7 @@ export default {
         .then((res) => {
           // console.log("createQuotedPrice", res)
           if (res.code == 1) {
-            this.$msg('价成功');
+            this.$msg('价成功');
             message.goodsInfo.goodsPriceType = 2;
             message.goodsInfo.goodsPrice = parseFloat(message.quotedPrice).toFixed(2);
             message.goodsInfo.lastPrice = parseFloat(message.quotedPrice).toFixed(2);
@@ -1218,16 +1213,6 @@ export default {
   width: 72%;
 }
 
-.username {
-  font-size: 24upx;
-  color: $fontColor3;
-  margin-bottom: 8upx;
-
-  &.align-right {
-    text-align: right;
-  }
-}
-
 .message-bubble {
   padding: 20upx 24upx;
   border-radius: 16upx;

+ 26 - 9
hdApp/src/admin/chat/list.vue

@@ -93,16 +93,33 @@ export default {
       if (item.unReadNum > 0) {
         item.unReadNum = 0;
       }
-      this.pageTo({
+      // this.pageTo({
+      //   url: '/admin/chat/chatPage',
+      //   query: {
+      //     userId: item.userId,
+      //     customId: item.id,
+      //     staffId: this.getLoginInfo.shopAdminId,
+      //     shopId: this.getLoginInfo.shopId,
+      //     name: this.getLoginInfo.name,
+      //     avatar: this.shopAvatar,
+      //     chatPerson: item.name
+      //   }
+      // });
+
+      // 使用事件通道传递数据
+      const params = {
+        userId: item.userId,
+        customId: item.id,
+        staffId: this.getLoginInfo.shopAdminId,
+        shopId: this.getLoginInfo.shopId,
+        name: this.getLoginInfo.name,
+        avatar: this.shopAvatar,
+        chatPerson: item.name
+      };
+      uni.navigateTo({
         url: '/admin/chat/chatPage',
-        query: {
-          userId: item.userId,
-          customId: item.id,
-          staffId: this.getLoginInfo.shopAdminId,
-          shopId: this.getLoginInfo.shopId,
-          name: this.getLoginInfo.name,
-          avatar: this.shopAvatar,
-          chatPerson: item.name
+        success: function(res) {
+          res.eventChannel.emit('acceptDataFromList', params)
         }
       });
     },

+ 93 - 88
mallApp/src/pages/chat/chatPage.vue

@@ -31,7 +31,6 @@
           </view>
 
           <view v-if="message.messageType == 'text'|| message.messageType != 'goods'" class="message-content-wrapper">
-            <view class="username" v-if="isMultiUser">{{ message.username }}</view>
             <view class="message-bubble left-bubble">
               <text class="message-text">{{ message.message }}</text>
             </view>
@@ -39,9 +38,6 @@
           </view>
 
           <view v-if="message.messageType == 'goods'" class="goods-content-wrapper">
-            <view class="username align-right" v-if="isMultiUser">{{
-              message.username
-            }}</view>
             <view class="goods-info left-bubble">
               <view class="goods-main" @click="toGoodsDetail(message.goodsInfo)">
                 <image class="goods-image" :src="message.goodsInfo.goodsImg" mode="aspectFill"></image>
@@ -49,12 +45,12 @@
                   <view class="goods-name-wrapper">
                     <text class="goods-name">{{message.goodsInfo.goodsName}}</text>
                   </view>
-                  <view class="sales-info" v-if="message.goodsInfo.goodsPriceType == 2">
+                  <!-- <view class="sales-info" v-if="message.goodsInfo.goodsPriceType == 2">
                     <text class="delivery-time">商家标价</text>
                   </view>
                   <view class="sales-info" v-if="message.goodsInfo.notExpired === false">
-                    <text class="delivery-time">价窗口过期</text>
-                  </view>
+                    <text class="delivery-time">价窗口过期</text>
+                  </view> -->
                   <text v-if="message.goodsInfo.goodsPriceType != 0" class="goods-price">¥{{ parseFloat(message.goodsInfo.goodsPrice).toFixed(2) }}</text>
                 </view>
               </view>
@@ -78,16 +74,12 @@
         <!-- 右侧消息(我的) -->
         <view class="message-right" v-if="message.isMine">
           <view v-if="message.messageType == 'text'|| message.messageType != 'goods'" class="message-content-wrapper">
-            <view class="username align-right" v-if="isMultiUser">{{ message.username}}</view>
             <view class="message-bubble right-bubble">
               <text class="message-text">{{ message.message }}</text>
             </view>
             <view class="message-time align-right">{{ message.time }}</view>
           </view>
           <view v-if="message.messageType == 'goods'" class="goods-content-wrapper">
-            <view class="username align-right" v-if="isMultiUser">
-              {{ message.username }}
-            </view>
             <view class="goods-info right-bubble">
               <view class="goods-main" @click="toGoodsDetail(message.goodsInfo)">
                 <image class="goods-image" :src="message.goodsInfo.goodsImg" mode="aspectFill"/>
@@ -95,15 +87,15 @@
                   <view class="goods-name-wrapper">
                     <text class="goods-name">{{ message.goodsInfo.goodsName }}</text>
                   </view>
-                  <view class="sales-info" v-if="message.goodsInfo.goodsPriceType == 2">
+                  <!-- <view class="sales-info" v-if="message.goodsInfo.goodsPriceType == 2">
                     <text class="delivery-time">商家标价</text>
                   </view>
                   <view class="sales-info" v-if="(message.goodsInfo.goodsPriceType == 0 && message.goodsInfo.notExpired === true)">
                     <text class="delivery-time">等待商家标价</text>
                   </view>
                   <view class="sales-info" v-if="message.goodsInfo.notExpired === false">
-                    <text class="delivery-time">价窗口过期</text>
-                  </view>
+                    <text class="delivery-time">价窗口过期</text>
+                  </view> -->
                   <text v-if="message.goodsInfo.goodsPriceType != 0" class="goods-price">¥{{ parseFloat(message.goodsInfo.goodsPrice).toFixed(2) }}</text>
                 </view>
               </view>
@@ -199,8 +191,6 @@ export default {
       scrollTop: 0,
       scrollIntoView: "",
       placeholderStyle: "color: #ccc; font-size: 28upx;",
-      // 是否多人聊天
-      isMultiUser: false,
       // 当前用户信息
       currentUser: {
         userId: 0,
@@ -228,66 +218,22 @@ export default {
       keyboardHeight: 0, // 键盘高度
       isKeyboardShow: false, // 键盘是否显示
       currentGoodsInfo: {}, // 进入聊天页面时,带过来的商品信息
+      pageParams: {}, // 页面参数
     };
   },
   onLoad(options) {
-    // console.log("---------- options: ", options);
-    if (options.goodsId) {
-      this.currentGoodsInfo = {
-        ...options
-      };
-    }
-
-    if (options.chatPerson) {
-      // 设置聊天人名称
-      uni.setNavigationBarTitle({
-        title: options.chatPerson
-      })
-    }
-
-    // 根据传入参数判断是否多人聊天
-    if (options.isMultiUser) {
-      this.isMultiUser = options.isMultiUser === "true";
-    }
-
-    if (this.loginInfo.id) {
-      this.currentUser.userId = parseInt(this.loginInfo.id);
-      if(this.currentUser.userId == 0) {
-        console.error('userId 出错 ---------- this.currentUser.userId: ', this.currentUser.userId);
-      }
-    }
-    if (options.customId) {
-      this.currentUser.customId = parseInt(options.customId);
-      if(this.currentUser.customId == 0) {
-        console.error('customId 出错 ---------- this.currentUser.customId: ', this.currentUser.customId);
-      }
-    }
-    if (options.shopId) {
-      this.currentUser.shopId = parseInt(options.shopId);
-      if(this.currentUser.shopId == 0) {
-        console.error('shopId 出错 ---------- this.currentUser.shopId: ', this.currentUser.shopId);
-      }
-    }
-    if (options.name) {
-      this.currentUser.username = options.name;
-    }
-    if (options.avatar) {
-      this.currentUser.avatar = options.avatar;
-    }
-
-    // 获取房间号
-    if (this.currentUser.customId && this.currentUser.shopId) {
-      this.room = "custom_id-" + this.currentUser.customId + "AND" + "shop_id-" + this.currentUser.shopId;
-    } else {
-      // 如果没有传入房间号,使用默认值或生成一个
-      this.room = "default_room";
-    }
-    // console.log("---------- this.room: ", this.room);
-
-    // 加载聊天记录
-    this.loadChatHistory();
-    // 连接WebSocket
-    this.connectWebSocket();
+    const eventChannel = this.getOpenerEventChannel();
+    eventChannel.on('acceptDataFromOpenerPage', (data) => {
+      this.pageParams = data;
+      // console.log("---------- pageParams: ", data);
+      this.initializePage(data);
+    })
+    
+    // 兼容旧版本通过 options 传递参数
+    // if (Object.keys(options).length > 0) {
+    //   this.pageParams = options;
+    //   this.initializePage(options);
+    // }
   },
   onReady() {
     // 页面加载完成后滚动到底部
@@ -313,6 +259,7 @@ export default {
   onUnload() {
     // 页面卸载时关闭WebSocket连接
     this.disconnectWebSocket();
+    this.goBack();
   },
   onHide() {
     // 页面隐藏时可以选择性地关闭连接(根据业务需求)
@@ -326,6 +273,73 @@ export default {
   },
   methods: {
     init() {},
+
+    initializePage(params) {
+      if (params.goodsId) {
+        this.currentGoodsInfo = {
+          ...params
+        };
+      }
+
+      if (params.chatPerson) {
+        // 设置聊天人名称
+        uni.setNavigationBarTitle({
+          title: params.chatPerson
+        })
+      }
+
+      if (this.loginInfo.id) {
+        this.currentUser.userId = parseInt(this.loginInfo.id);
+        if(this.currentUser.userId == 0) {
+          console.error('userId 出错 ---------- this.currentUser.userId: ', this.currentUser.userId);
+          this.$msg("登录用户数据异常,请稍后再试");
+          return;
+        }
+      }
+      if (params.customId) {
+        this.currentUser.customId = parseInt(params.customId);
+        if(this.currentUser.customId == 0) {
+          console.error('customId 出错 ---------- this.currentUser.customId: ', this.currentUser.customId);
+        }
+      }
+      if (params.shopId) {
+        this.currentUser.shopId = parseInt(params.shopId);
+        if(this.currentUser.shopId == 0) {
+          console.error('shopId 出错 ---------- this.currentUser.shopId: ', this.currentUser.shopId);
+        }
+      }
+      if (params.name) {
+        this.currentUser.username = params.name;
+      }
+      if (params.avatar) {
+        this.currentUser.avatar = params.avatar;
+      }
+
+      // 获取房间号
+      if (this.currentUser.customId && this.currentUser.shopId) {
+        this.room = "custom_id-" + this.currentUser.customId + "AND" + "shop_id-" + this.currentUser.shopId;
+      } else {
+        // 如果没有传入房间号,使用默认值或生成一个
+        this.room = "default_room";
+      }
+      // console.log("---------- this.room: ", this.room);
+
+      // 加载聊天记录
+      this.loadChatHistory();
+      // 连接WebSocket
+      this.connectWebSocket();
+    },
+    goBack() {
+      // 获取事件通道
+      const eventChannel = this.getOpenerEventChannel()
+
+      // 返回时传递数据给页面 A
+      eventChannel.emit('acceptDataFromOpenedPage', {
+        status: 'ok',
+        message: '页面 B 处理完成',
+        timestamp: Date.now()
+      })
+    },
     // 加载聊天历史记录
     loadChatHistory() {
       const userId = this.currentUser.userId;
@@ -1105,7 +1119,7 @@ export default {
               //console.log("res", res)
               if (res.code == 1) {
                 if (res.data.price != -1) {
-                  parsed.goodsPriceType = 2; // 报价类型
+                  parsed.goodsPriceType = 2; // 类型
                   parsed.goodsPrice = parseFloat(res.data.price).toFixed(2);
                 }
               }
@@ -1129,7 +1143,7 @@ export default {
     },
     // 查看商品
     toGoodsDetail(goodsInfo) {
-      this.disconnectWebSocket();
+      this.disconnectWebSocket();// 离开本页面,必须断开WebSocket连接
       // console.log("---------- goodsInfo: ", goodsInfo);
       const goodsId = parseInt(goodsInfo.goodsId);
       const categoryId = parseInt(goodsInfo.categoryId);
@@ -1155,8 +1169,8 @@ export default {
     },
     // 去购买
     toBuy(goodsInfo) {
-      this.disconnectWebSocket();
-      // console.log("---------- goodsInfo: ", goodsInfo);
+      this.disconnectWebSocket();// 离开本页面,必须断开WebSocket连接
+      console.log("---------- goodsInfo: ", goodsInfo);
       const goodsId = parseInt(goodsInfo.goodsId);
       const categoryId = parseInt(goodsInfo.categoryId);
       const hdId = parseInt(goodsInfo.hdId);
@@ -1164,6 +1178,7 @@ export default {
       const price = parseFloat(goodsInfo.goodsPrice).toFixed(2);
       const priceType = goodsInfo.goodsPriceType;
       if (isNaN(goodsId) || isNaN(categoryId) || isNaN(hdId) || isNaN(account) || isNaN(price)) {
+        console.log("商品数据异常", goodsId, categoryId, hdId, account, price)
         this.$msg("商品数据异常");
         return;
       }
@@ -1343,16 +1358,6 @@ export default {
   width: 72%;
 }
 
-.username {
-  font-size: 24upx;
-  color: $fontColor3;
-  margin-bottom: 8upx;
-
-  &.align-right {
-    text-align: right;
-  }
-}
-
 .message-bubble {
   padding: 20upx 24upx;
   border-radius: 16upx;
@@ -1622,7 +1627,7 @@ export default {
 /* #ifdef APP-PLUS */
 .input-area {
   // App端底部安全区域
-  padding-bottom: calc(20upx + env(safe-area-inset-bottom));
+  padding-bottom: calc(1upx + env(safe-area-inset-bottom));
 }
 /* #endif */
 </style>

+ 14 - 8
mallApp/src/pages/chat/list.vue

@@ -102,15 +102,21 @@ export default {
       if (item.unReadNum > 0) {
         item.unReadNum = 0;
       }
-      this.pageTo({
+
+      // 使用事件通道传递数据
+      const params = {
+        customId: item.customId,
+        shopId: item.id,
+        name: this.getLoginInfo.name,
+        avatar: this.getLoginInfo.avatar,
+        chatPerson: item.shopName != "首店" ? item.shopName : item.merchantName || item.mobile
+      };
+      // console.log("-----handleItemClick----- params: ", params);
+      uni.navigateTo({
         url: '/pages/chat/chatPage',
-        query: {
-          customId: item.customId,
-          shopId: item.id,
-          name: this.getLoginInfo.name,
-          avatar: this.getLoginInfo.avatar,
-          chatPerson: item.shopName != "首店" ? item.shopName : item.merchantName || item.mobile
-        },
+        success: function(res) {
+          res.eventChannel.emit('acceptDataFromOpenerPage', params)
+        }
       });
     },
     init() {

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

@@ -18,7 +18,6 @@
         </view> -->
         <div class="btn-right">
             <button v-if="priceType == 1" class="button-com red" @click="buy">购买</button>
-            <button v-if="priceType == 2" class="button-com red" @click="buy">购买</button>
             <button v-if="priceType == 0" class="button-com red" @click.stop="goChat">询价</button>
         </div>
     </view>

+ 28 - 25
mallApp/src/pages/goods/detail.vue

@@ -12,13 +12,6 @@
           {{ data.price ? parseFloat(data.price).toFixed(2) : 0}}
         </text>
       </view>
-      <!--报价类型-->
-      <view class="app-price app-bold" v-if="data.priceType == 2">
-        <text>¥</text>
-        <text class="app-size-34">
-          {{ data.price ? parseFloat(data.price).toFixed(2) : 0}}
-        </text>
-      </view>
       <view class="tui-pro-titbox">
         <view class="tui-pro-title app-size-32">{{ data.name }}</view>
         <button open-type="share" class="share-button" @click="shareFn">
@@ -260,25 +253,35 @@ export default {
         return;
       }
 
-      this.$util.pageTo({
+      const params = {
+        //userId: this.loginInfo.id,
+        customId: this.customId,
+        //staffId: 0,
+        shopId: this.shopInfo.shopId,
+        name: this.loginInfo.name,
+        avatar: this.loginInfo.avatar,
+        chatPerson: this.shopInfo.name,
+        goodsId: this.data.id, // 商品id
+        goodsName: this.data.name,
+        goodsPriceType: this.data.priceType,
+        goodsPrice: this.data.price,
+        goodsImg: this.data.cover,
+        account: this.shopInfo.account,
+        hdId: this.shopInfo.hdId,
+        categoryId: this.shopInfo.categoryId,
+      };
+      // console.log("-----goChat----- params: ", params);
+      uni.navigateTo({
         url: "/pages/chat/chatPage",
-        query: {
-          userId: this.loginInfo.id,
-          customId: this.customId,
-          staffId: 0,
-          shopId: this.shopInfo.shopId,
-          name: this.loginInfo.name,
-          avatar: this.loginInfo.avatar,
-          chatPerson: this.shopInfo.name,
-          goodsId: this.data.id, // 商品id
-          goodsName: this.data.name,
-          goodsPriceType: this.data.priceType,
-          goodsPrice: this.data.price,
-          goodsImg: this.data.cover,
-          account: this.shopInfo.account,
-          hdId: this.shopInfo.hdId,
-          categoryId: this.shopInfo.categoryId,
-        },
+        success: function(res) {
+          // 通过eventChannel向被打开页面传送数据
+          res.eventChannel.emit('acceptDataFromOpenerPage', params)
+
+          // 监听从聊天页返回的数据
+          res.eventChannel.on('acceptDataFromOpenedPage', (data) => {
+            console.log('页面 A 接收到返回数据:', data)
+          })
+        }
       });
     },
   },