zhaoxiaohai 3 years ago
parent
commit
d02dc89f0e

+ 13 - 9
pages/chatRoom/dialogbox.js

@@ -41,14 +41,18 @@ Page({
             "classname": "system.im.imdialog.imdialog",
             "method": "query_imdialogMain",
             "content": {
-                "timdialogid": options.id
+                "timdialogid": this.data.timdialogid
             }
         }).then(res => {
             console.log("详情", res)
+            if (res.msg != '成功') return wx.showToast({
+                title: res.data,
+                icon: "none"
+            });
             let title = res.data[0].fimdialogname.split('-'),
                 headerTitle = (title[0] == res.data[0].fname) ? title[1] : title[0],
                 joinHands = false;
-            if (res.data[0].ownerid != 0) {
+            if (res.data[0].fimdialogtype == '供需' && res.data[0].fimuserid == this.data.userid) {
                 _Http.basic({
                     "accesstoken": wx.getStorageSync('userData').token,
                     "classname": "customer.supplyanddemand.supplyanddemand",
@@ -58,18 +62,17 @@ Page({
                         "fstatus": "对接中",
                         "timdialogid": res.data[0].timdialogid
                     }
-                }).then(res => {
+                }, false).then(res => {
                     console.log("对接中", res)
                 })
-                if (res.data[0].fimuserid != wx.getStorageSync('userData').userid) {
-                    joinHands = true;
-                }
+            } else {
+                joinHands = true
             }
             this.setData({
                 headerTitle,
-                joinHands,
                 ownerid: res.data[0].ownerid,
-                initiator: res.data[0].fimuserid
+                initiator: res.data[0].fimuserid,
+                joinHands
             })
         })
         //群历史信息
@@ -90,7 +93,8 @@ Page({
             "content": {
                 "tsupplyanddemandid": this.data.ownerid,
                 "fstatus": "已解决",
-                "tenterprise_userid": this.data.initiator
+                "tenterprise_userid": this.data.initiator,
+                "timdialogid": this.data.timdialogid
             }
         }).then(res => {
             console.log("确认合作", res)

+ 4 - 3
pages/chatRoom/dialogbox.wxml

@@ -9,12 +9,13 @@
 <!-- 聊天   bindscrolltoupper='scrolltoupper' -->
 <scroll-view class="chatFrame" refresher-default-style='none' refresher-enabled bindrefresherrefresh='scrolltoupper' refresher-triggered='{{triggered}}' scroll-y scroll-into-view="{{toView}}">
     <view style="height: 110rpx;"></view>
-    <MsgBubble wx:for="{{socketMsgQueue}}" id="item{{index}}" type='{{item.message.ftype}}' fobsurl='{{item.message.data[0].fobsurl}}' role="{{userid==item.message.sendfrom.userid?'my':'you'}}" userImg='{{item.message.sendfrom.headpic}}' content='{{item.message.data.fcontent}}' time='{{item.message.fdatetime}}' />
+    <MsgBubble wx:for="{{socketMsgQueue}}" wx:key="index" id="item{{index}}" type='{{item.message.ftype}}' fobsurl='{{item.message.data[0].fobsurl}}' role="{{userid==item.message.sendfrom.userid?'my':'you'}}" userImg='{{item.message.sendfrom.headpic}}' content='{{item.message.data.fcontent}}' time='{{item.message.fdatetime}}' />
     <view style="height: {{keyboardHeight}}px;"></view>
     <view id="bottom" style="height: {{iosX?'102':'85'}}px;"></view>
 </scroll-view>
 <!-- 底部输入 -->
-<view class="input-box" style="bottom:{{keyboardHeight}}px;"><!-- {{lineCount>1?'multi-row':''}} -->
+<view class="input-box" style="bottom:{{keyboardHeight}}px;">
+    <!-- {{lineCount>1?'multi-row':''}} -->
     <textarea class="input-text " bindfocus="textareaFocus" adjust-position='{{false}}' bindconfirm='sendMsg' show-confirm-bar='{{false}}' confirm-type='send' confirm-hold='true' cursor-spacing='45' bindinput='sendInput' value='{{sendText}}' maxlength='-1' fixed='true' type="text" bindlinechange='linechange' bindkeyboardheightchange='keyboardheightchange'></textarea>
     <view class="functionalZone" catchtap="selectionFunction">
         <image data-name='表情' mode="heightFix" src="/static/chatRoom/icon-01.png" />
@@ -28,7 +29,7 @@
 <van-popup show="{{ memePopup }}" overlay='{{false}}' position='bottom' safe-area-inset-bottom='{{false}}'>
     <view class="popup-class">
         <scroll-view scroll-y class="meme-box">
-            <view class="meme-item" wx:for="{{memeList}}" data-item="{{item}}" catchtap="sendMeme">
+            <view class="meme-item" wx:for="{{memeList}}" wx:key="index" data-item="{{item}}" catchtap="sendMeme">
                 <image src="{{item.fobsurl}}" mode="aspectFill"></image>
             </view>
         </scroll-view>

+ 19 - 9
pages/tabbar-pages/supplyAndDemand/index.js

@@ -135,21 +135,28 @@ Page({
             "content": {
                 "tsupplyanddemandid": item.tsupplyanddemandid
             }
-        }).then(res => {
+        },false).then(res => {
             console.log('沟通列表', res)
             if (res.msg != '成功') return wx.showToast({
                 title: res.data,
                 icon: "none"
             })
             imdialogs = res.data[0].imdialogs;
-            for (let i = 0; i < imdialogs.length; i++) {
-                let checkdate = imdialogs[i].createdate;
-                if (checkdate != null && checkdate != undefined) imdialogs[i].createdate = checkdate.slice(0, checkdate.lastIndexOf('.'));
+            if (imdialogs.length != 0) {
+                for (let i = 0; i < imdialogs.length; i++) {
+                    let checkdate = imdialogs[i].createdate;
+                    if (checkdate != null && checkdate != undefined) imdialogs[i].createdate = checkdate.slice(0, checkdate.lastIndexOf('.'));
+                }
+                this.setData({
+                    ifShowCommunicationOfNumber: true,
+                    imdialogs
+                })
+            } else {
+                wx.showToast({
+                    title: '暂无对话信息',
+                    icon: "none"
+                })
             }
-            this.setData({
-                ifShowCommunicationOfNumber: true,
-                imdialogs
-            })
         })
 
     },
@@ -172,7 +179,10 @@ Page({
             tsupplyanddemandid,
             tenterprise_userid
         } = e.currentTarget.dataset.item;
-        if (tenterprise_userid == wx.getStorageSync('userData').userid) return;
+        if (tenterprise_userid == wx.getStorageSync('userData').userid) return wx.showToast({
+            title: '无法与自己对话',
+            icon: "none"
+        })
         _Http.basic({
             "accesstoken": wx.getStorageSync('userData').token,
             "classname": "customer.supplyanddemand.supplyanddemand",

+ 6 - 6
pages/tabbar-pages/supplyAndDemand/index.wxml

@@ -9,7 +9,7 @@
         <van-tab title="所有信息">
             <!-- 宫格 -->
             <view class="grid_box">
-                <view class="grid_item" wx:key="index" wx:for="{{ftypeList}}" data-type="{{item.ftype}}" bindtap="switchScreenType">
+                <view class="grid_item" wx:for="{{ftypeList}}" wx:key="index" data-type="{{item.ftype}}" bindtap="switchScreenType">
                     <view class="grid_item_image" wx:if="{{ftype==item.ftype}}">
                         <image src="{{item.attinfos[1].fobsurl}}"></image>
                     </view>
@@ -20,7 +20,7 @@
                 </view>
             </view>
             <!-- 列表 -->
-            <My_SupplyAndDemandItemBox data-index="{{index}}" bindtap="jumpForDetails" wx:for="{{productList}}" title="[{{item.ftype}}]{{item.ftitle}}" time="{{item.checkdate}}" imageList="{{item.attinfos}}" type='{{item.ftype}}' content="{{item.fcontent}}" bindstopOnShow="stopOnShow">
+            <My_SupplyAndDemandItemBox data-index="{{index}}" bindtap="jumpForDetails" wx:for="{{productList}}" wx:key="index" title="[{{item.ftype}}]{{item.ftitle}}" time="{{item.checkdate}}" imageList="{{item.attinfos}}" type='{{item.ftype}}' content="{{item.fcontent}}" bindstopOnShow="stopOnShow">
                 <!-- 内容信息插槽 -->
                 <view slot="dataAndBut">
                     <view class="dataAndBut">
@@ -36,14 +36,14 @@
             </My_SupplyAndDemandItemBox>
         </van-tab>
         <van-tab title="正在对接">
-            <view class="abutting-joint-box" wx:for="{{productList}}">
+            <view class="abutting-joint-box" wx:for="{{productList}}" wx:key="index">
                 <view class="abutting-joint-titleAndMsg">
                     <view class="abutting-joint-title u-line-1">[{{item.ftype}}]{{item.ftitle}}</view>
                     <view class="abutting-joint-msg u-line-1"><text style="color: #FF0000; opacity: .5;">[23条]</text>李老板:多少钱收?多少钱收?</view>
                 </view>
                 <view class="abutting-joint-timeAndBut">
                     <view class="abutting-joint-time">{{item.checkdate}}</view>
-                    <van-button custom-class="abutting-joint-but"><text class="abutting-joint-but-text">继续沟通</text></van-button>
+                    <van-button custom-class="abutting-joint-but" data-item="{{item}}" catchtap="toLinkUpPage"><text class="abutting-joint-but-text">继续沟通</text></van-button>
                 </view>
             </view>
         </van-tab>
@@ -56,7 +56,7 @@
                 </view>
             </view>
             <!-- 列表 -->
-            <My_SupplyAndDemandItemBox wx:for="{{productList}}" title="【{{item.ftype}}】{{item.ftitle}}" time="{{item.checkdate}}" imageList="{{item.attinfos}}" data-index="{{index}}" bindtap="jumpForDetails" type='{{item.ftype}}' content="{{item.fcontent}}" bindstopOnShow="stopOnShow">
+            <My_SupplyAndDemandItemBox wx:for="{{productList}}" wx:key="index" title="【{{item.ftype}}】{{item.ftitle}}" time="{{item.checkdate}}" imageList="{{item.attinfos}}" data-index="{{index}}" bindtap="jumpForDetails" type='{{item.ftype}}' content="{{item.fcontent}}" bindstopOnShow="stopOnShow">
                 <!-- 我的需求左上状态插槽 -->
                 <view slot="myState" class="myState">
                     <view class="myShowState {{item.fstatus=='正在对接'?'myNoSoldOut':''}} {{item.fstatus=='待对接'?'myNoSoldOut':''}}">
@@ -91,7 +91,7 @@
     <view class="CommunicationOfNumber">
         <view class="CommunicationOfNumber-title">沟通列表</view>
         <view class="CommunicationOfNumber-list">
-            <view wx:for="{{imdialogs}}">{{item.createdate}}<text data-item="{{item}}" catchtap="toLinkUpPage" class="text">用户:{{item.fname}}</text><text wx:if="{{item.fdatastatus==0}}">发起联系,遗憾未达成合作</text><text wx:elif='{{item.fdatastatus==2}}'>发起联系,正在对接中</text><text wx:elif='{{item.fdatastatus==1}}'>发起联系,恭喜达成合作</text></view>
+            <view wx:for="{{imdialogs}}" wx:key="index">{{item.createdate}}<text data-item="{{item}}" catchtap="toLinkUpPage" class="text">用户:{{item.fname}}</text><text wx:if="{{item.fdatastatus==0}}">发起联系,遗憾未达成合作</text><text wx:elif='{{item.fdatastatus==2}}'>发起联系,正在对接中</text><text wx:elif='{{item.fdatastatus==1}}'>发起联系,恭喜达成合作</text></view>
         </view>
     </view>
     <view style="height: 50px;"></view>

+ 1 - 0
pages/tabbar-pages/supplyAndDemand/index.wxss

@@ -223,6 +223,7 @@
 /* 沟通列表 */
 .CommunicationOfNumber {
     padding-bottom: 30rpx;
+    max-height: 50vh;
 }
 
 .CommunicationOfNumber-title {