|
|
@ -2,7 +2,7 @@
|
|
|
|
* @Author: ch
|
|
|
|
* @Author: ch
|
|
|
|
* @Date: 2022-03-26 14:32:03
|
|
|
|
* @Date: 2022-03-26 14:32:03
|
|
|
|
* @LastEditors: ch
|
|
|
|
* @LastEditors: ch
|
|
|
|
* @LastEditTime: 2022-05-21 14:19:38
|
|
|
|
* @LastEditTime: 2022-05-21 15:43:32
|
|
|
|
* @Description: file content
|
|
|
|
* @Description: file content
|
|
|
|
-->
|
|
|
|
-->
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
@ -47,7 +47,7 @@
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
<script>
|
|
|
|
import {MSG_TYPE} from '@/common/dicts/im';
|
|
|
|
import {MSG_TYPE} from '@/common/dicts/im';
|
|
|
|
import {Im} from '@/common/utils';
|
|
|
|
import {Im, ToAsyncAwait} from '@/common/utils';
|
|
|
|
import {ApiGetOrderDetail} from '@/common/api/order';
|
|
|
|
import {ApiGetOrderDetail} from '@/common/api/order';
|
|
|
|
import {ApiGetGoodsDetail} from '@/common/api/goods';
|
|
|
|
import {ApiGetGoodsDetail} from '@/common/api/goods';
|
|
|
|
import UiButton from '@/components/UiButton.vue';
|
|
|
|
import UiButton from '@/components/UiButton.vue';
|
|
|
@ -68,7 +68,10 @@ export default {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
computed:{
|
|
|
|
computed:{
|
|
|
|
curSessionData(){
|
|
|
|
curSessionData(){
|
|
|
|
const data = this.$store.state.imData.find(i =>i.id == this.$Route.query.sessionId) || {}
|
|
|
|
const data = this.$store.state.imData.find(i =>{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return i.id == this.sessionId
|
|
|
|
|
|
|
|
}) || {};
|
|
|
|
if(data.id){
|
|
|
|
if(data.id){
|
|
|
|
Im.setCurSessionId(data.id);
|
|
|
|
Im.setCurSessionId(data.id);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -130,15 +133,16 @@ export default {
|
|
|
|
* 如果是从商品或订单进来,需要创建会话
|
|
|
|
* 如果是从商品或订单进来,需要创建会话
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
async createSessionMain(){
|
|
|
|
async createSessionMain(){
|
|
|
|
const {error, result} = await Im.createSession({
|
|
|
|
const {error, result} = await ToAsyncAwait(Im.createSession({
|
|
|
|
content : {
|
|
|
|
content : {
|
|
|
|
storeId : 1
|
|
|
|
storeId : 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
if(error){
|
|
|
|
if(error){
|
|
|
|
uni.$u.toast(error);
|
|
|
|
uni.$u.toast(error);
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
this.sessionId = result.content.id
|
|
|
|
this.getHistoryMsg();
|
|
|
|
this.getHistoryMsg();
|
|
|
|
this.readMsg();
|
|
|
|
this.readMsg();
|
|
|
|
|
|
|
|
|
|
|
@ -151,7 +155,7 @@ export default {
|
|
|
|
const lastMsg = this.msgData?.length ? this.msgData[0] : {};
|
|
|
|
const lastMsg = this.msgData?.length ? this.msgData[0] : {};
|
|
|
|
await Im.getHistoryMsg({
|
|
|
|
await Im.getHistoryMsg({
|
|
|
|
content : {
|
|
|
|
content : {
|
|
|
|
sessionId : this.$Route.query.sessionId,
|
|
|
|
sessionId : this.sessionId,
|
|
|
|
topMessageId : lastMsg.id || null
|
|
|
|
topMessageId : lastMsg.id || null
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -163,7 +167,7 @@ export default {
|
|
|
|
readMsg(){
|
|
|
|
readMsg(){
|
|
|
|
Im.setRead({
|
|
|
|
Im.setRead({
|
|
|
|
content: {
|
|
|
|
content: {
|
|
|
|
sessionId : this.$Route.query.sessionId
|
|
|
|
sessionId : this.sessionId
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|