|
@@ -4,7 +4,6 @@ import {
|
|
|
} from "../../utils/api";
|
|
|
const _Http = new ApiModel();
|
|
|
Page({
|
|
|
-
|
|
|
/**
|
|
|
* 页面的初始数据
|
|
|
*/
|
|
@@ -22,13 +21,15 @@ Page({
|
|
|
pageTotal: 1,
|
|
|
triggered: false, //下拉状态
|
|
|
unreadCount: 0, //对方发送未读信息
|
|
|
+ joinHands: false, //是否显示合作按钮
|
|
|
+ ownerid: 0, //供需id
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function (options) {
|
|
|
- app.initSocket(); //链接websocket 用于测试
|
|
|
+ //app.initSocket(); 链接websocket 用于测试
|
|
|
const that = this;
|
|
|
this.setData({
|
|
|
timdialogid: options.id,
|
|
@@ -44,9 +45,31 @@ Page({
|
|
|
}
|
|
|
}).then(res => {
|
|
|
console.log("详情", res)
|
|
|
- let title = res.data[0].fimdialogname.split('-');
|
|
|
+ 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) {
|
|
|
+ _Http.basic({
|
|
|
+ "accesstoken": wx.getStorageSync('userData').token,
|
|
|
+ "classname": "customer.supplyanddemand.supplyanddemand",
|
|
|
+ "method": "updatesupplyanddemandstatus",
|
|
|
+ "content": {
|
|
|
+ "tsupplyanddemandid": res.data[0].ownerid,
|
|
|
+ "fstatus": "对接中",
|
|
|
+ "timdialogid": res.data[0].timdialogid
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ console.log("对接中", res)
|
|
|
+ })
|
|
|
+ if (res.data[0].fimuserid != wx.getStorageSync('userData').userid) {
|
|
|
+ joinHands = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
this.setData({
|
|
|
- headerTitle: title[0]
|
|
|
+ headerTitle,
|
|
|
+ joinHands,
|
|
|
+ ownerid: res.data[0].ownerid,
|
|
|
+ initiator: res.data[0].fimuserid
|
|
|
})
|
|
|
})
|
|
|
//群历史信息
|
|
@@ -58,6 +81,36 @@ Page({
|
|
|
//获取表情包
|
|
|
this.getMeme()
|
|
|
},
|
|
|
+ /* 确认合作 */
|
|
|
+ confirmTheCooperation() {
|
|
|
+ _Http.basic({
|
|
|
+ "accesstoken": wx.getStorageSync('userData').token,
|
|
|
+ "classname": "customer.supplyanddemand.supplyanddemand",
|
|
|
+ "method": "updatesupplyanddemandstatus",
|
|
|
+ "content": {
|
|
|
+ "tsupplyanddemandid": this.data.ownerid,
|
|
|
+ "fstatus": "已解决",
|
|
|
+ "tenterprise_userid": this.data.initiator
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ console.log("确认合作", res)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /* 拒绝合作 */
|
|
|
+ refuseToCooperate() {
|
|
|
+ _Http.basic({
|
|
|
+ "accesstoken": wx.getStorageSync('userData').token,
|
|
|
+ "classname": "customer.supplyanddemand.supplyanddemand",
|
|
|
+ "method": "updatesupplyanddemandstatus",
|
|
|
+ "content": {
|
|
|
+ "tsupplyanddemandid": this.data.ownerid,
|
|
|
+ "fstatus": "待对接",
|
|
|
+ "timdialogid": this.data.timdialogid
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ console.log("拒绝合作", res)
|
|
|
+ })
|
|
|
+ },
|
|
|
//历史信息查询
|
|
|
query_imdialogMessage() {
|
|
|
_Http.basic({
|
|
@@ -74,9 +127,9 @@ Page({
|
|
|
title: res.data,
|
|
|
icon: "none"
|
|
|
})
|
|
|
- console.log(res)
|
|
|
if (res.pageNumber != 1) {
|
|
|
let list = res.data;
|
|
|
+ list = list.reverse();
|
|
|
list = list.concat(this.data.socketMsgQueue);
|
|
|
this.setData({
|
|
|
socketMsgQueue: list,
|
|
@@ -84,11 +137,18 @@ Page({
|
|
|
triggered: false
|
|
|
})
|
|
|
} else {
|
|
|
+ let list = res.data;
|
|
|
+ list = list.reverse();
|
|
|
this.setData({
|
|
|
- socketMsgQueue: res.data,
|
|
|
+ socketMsgQueue: list,
|
|
|
toView: `item${res.data.length - 1}`,
|
|
|
pageTotal: res.pageTotal
|
|
|
})
|
|
|
+ setTimeout(() => {
|
|
|
+ this.setData({
|
|
|
+ toView: 'bottom'
|
|
|
+ })
|
|
|
+ }, 500)
|
|
|
}
|
|
|
|
|
|
})
|
|
@@ -100,6 +160,10 @@ Page({
|
|
|
triggered: true
|
|
|
})
|
|
|
this.query_imdialogMessage();
|
|
|
+ } else {
|
|
|
+ this.setData({
|
|
|
+ triggered: true
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
//键盘弹出高度
|
|
@@ -169,7 +233,6 @@ Page({
|
|
|
} = e.target.dataset,
|
|
|
that = this;
|
|
|
if (name == undefined || name == "") return;
|
|
|
- console.log(name)
|
|
|
if (name == '表情') {
|
|
|
let keyboardHeight = (this.data.iosX == true) ? 220 : 200;
|
|
|
this.setData({
|
|
@@ -198,6 +261,10 @@ Page({
|
|
|
that.afterRead(data)
|
|
|
}
|
|
|
})
|
|
|
+ } else if (name == '历史') {
|
|
|
+ wx.navigateTo({
|
|
|
+ url: './history?id=' + that.data.timdialogid,
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
textareaFocus() {
|
|
@@ -215,9 +282,11 @@ Page({
|
|
|
},
|
|
|
/* 文本域行数变化 */
|
|
|
linechange(e) {
|
|
|
+ console.log(e)
|
|
|
const {
|
|
|
lineCount
|
|
|
} = e.detail;
|
|
|
+ if (lineCount == this.data.lineCount) return;
|
|
|
this.setData({
|
|
|
lineCount
|
|
|
})
|