|
@@ -64,6 +64,7 @@
|
|
id: '',
|
|
id: '',
|
|
// 店铺信息
|
|
// 店铺信息
|
|
shop: {},
|
|
shop: {},
|
|
|
|
+ shop_id: "",
|
|
// 历史记录
|
|
// 历史记录
|
|
msgList: [],
|
|
msgList: [],
|
|
total: 0,
|
|
total: 0,
|
|
@@ -91,6 +92,7 @@
|
|
onLoad: async function(e) {
|
|
onLoad: async function(e) {
|
|
const that = this;
|
|
const that = this;
|
|
that.$set(that, `id`, e.id);
|
|
that.$set(that, `id`, e.id);
|
|
|
|
+ that.$set(that, `shop_id`, e.shop);
|
|
that.watchlogin();
|
|
that.watchlogin();
|
|
},
|
|
},
|
|
beforeDestroy() {
|
|
beforeDestroy() {
|
|
@@ -161,17 +163,19 @@
|
|
let ids = id.map(i => {
|
|
let ids = id.map(i => {
|
|
return i._id
|
|
return i._id
|
|
})
|
|
})
|
|
- // 信息已读
|
|
|
|
- res = await that.$api(`/chatRecord/read`, `POST`, {
|
|
|
|
- ids
|
|
|
|
- }, 'chat')
|
|
|
|
- if (res.errcode == '0') {
|
|
|
|
- console.log(res);
|
|
|
|
- } else {
|
|
|
|
- uni.showToast({
|
|
|
|
- title: res.errmsg,
|
|
|
|
- icon: 'none'
|
|
|
|
- })
|
|
|
|
|
|
+ if (ids.length > 0) {
|
|
|
|
+ // 信息已读
|
|
|
|
+ res = await that.$api(`/chatRecord/read`, `POST`, {
|
|
|
|
+ ids
|
|
|
|
+ }, 'chat')
|
|
|
|
+ if (res.errcode == '0') {
|
|
|
|
+ console.log(res);
|
|
|
|
+ } else {
|
|
|
|
+ uni.showToast({
|
|
|
|
+ title: res.errmsg,
|
|
|
|
+ icon: 'none'
|
|
|
|
+ })
|
|
|
|
+ }
|
|
}
|
|
}
|
|
// 跳转到最后一条数据 与前面的:id进行对照
|
|
// 跳转到最后一条数据 与前面的:id进行对照
|
|
// 如果是下拉刷新聊天记录不跳到最后一条
|
|
// 如果是下拉刷新聊天记录不跳到最后一条
|
|
@@ -283,6 +287,7 @@
|
|
};
|
|
};
|
|
// 发送给服务器消息
|
|
// 发送给服务器消息
|
|
// if (that.isSocketOpen) { //socket连接正常
|
|
// if (that.isSocketOpen) { //socket连接正常
|
|
|
|
+ if (!that.id) data.shop = that.shop_id
|
|
let res = await that.$api(`/chatRecord`, `POST`, data, 'chat');
|
|
let res = await that.$api(`/chatRecord`, `POST`, data, 'chat');
|
|
if (res.errcode == '0') {
|
|
if (res.errcode == '0') {
|
|
that.msgList.push(res.data);
|
|
that.msgList.push(res.data);
|
|
@@ -398,7 +403,7 @@
|
|
.scroll-view {
|
|
.scroll-view {
|
|
|
|
|
|
.chat-ls {
|
|
.chat-ls {
|
|
- padding: 0 2vw;
|
|
|
|
|
|
+ padding: 2vw 2vw 0 2vw;
|
|
|
|
|
|
.chat-time {
|
|
.chat-time {
|
|
font-size: 24rpx;
|
|
font-size: 24rpx;
|