145 lines
3.5 KiB
Vue
145 lines
3.5 KiB
Vue
<template>
|
|
<view class="common-roomLogs">
|
|
<view v-if="list.length > 0">
|
|
<view
|
|
v-for="(item,index) in list"
|
|
:key="index"
|
|
class="item"
|
|
>
|
|
<u-swipe-action
|
|
class="v12-mt-3"
|
|
>
|
|
<u-swipe-action-item
|
|
:options="options1"
|
|
:key="index"
|
|
@click.stop="removeRoom(item.room_id)"
|
|
>
|
|
<view>
|
|
<view class="v12-justify-between v12-pa-3 flex" @click="goRoom(item)">
|
|
<image class="cover flex-0" :src="item.store_avatar || webUrl+'/20221114155314348118.png'"/>
|
|
<view>
|
|
<view class="flex jc-between ai-center">
|
|
<view class="name more-t">{{ item.store_name }}</view>
|
|
<view class="datetime" v-if="item.last_msg">{{ item.last_msg.created_at }}</view>
|
|
</view>
|
|
<view class="sub one-t" v-if="item.last_msg">{{ item.last_msg.msg_type===0?item.last_msg.msg_content:'[图片]' }}</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</u-swipe-action-item>
|
|
</u-swipe-action>
|
|
</view>
|
|
</view>
|
|
<view class="v4-nodata" v-if="list.length===0">
|
|
<image src="@/static/images/img_nodata.png" mode="scaleToFill"/>
|
|
<view class="text">暂无数据</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import { mapGetters } from 'vuex'
|
|
|
|
export default {
|
|
name: 'RoomLogs',
|
|
data() {
|
|
return {
|
|
webUrl:this.$VUE_APP_RESOURCES_URL,
|
|
uid: null,
|
|
list: [],
|
|
options1: [{text: '删除', style: {color: '#fff', backgroundColor: '#C52733'} }]
|
|
}
|
|
},
|
|
computed: mapGetters(['userInfo']),
|
|
onShow() {
|
|
this.uid = this.userInfo.uid
|
|
this.fetchList()
|
|
},
|
|
methods: {
|
|
goRoom(item) {
|
|
uni.navigateTo({url: `/pkg_common/views/room?id=${item.store_id}&name=${item.store_name}`})
|
|
},
|
|
fetchList() {
|
|
const _this = this
|
|
uni.request({
|
|
url: _this.$SERVICE_API_URL + '/customer-chat-list',
|
|
method: 'POST',
|
|
data: {uid: _this.uid},
|
|
success: res => {
|
|
if (res.data.status_code === 200) {
|
|
_this.list = res.data.content
|
|
}
|
|
}
|
|
})
|
|
},
|
|
removeRoom(id) {
|
|
const _this = this
|
|
uni.showModal({
|
|
title:'确定删除消息?',
|
|
success:(res)=>{
|
|
if(res.confirm) {
|
|
uni.request({
|
|
url: _this.$SERVICE_API_URL + '//chat-remove',
|
|
method: 'POST',
|
|
data: {room_id: id},
|
|
success:(res)=>{
|
|
if(res.data.status_code === 200) {
|
|
_this.fetchList()
|
|
}
|
|
},
|
|
})
|
|
}
|
|
},
|
|
})
|
|
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="less">
|
|
.common-roomLogs {
|
|
min-height: 100vh;
|
|
box-sizing: border-box;
|
|
padding: 32rpx;
|
|
background: #F5F5F5;
|
|
|
|
.item {
|
|
margin-bottom: 24rpx;
|
|
border-radius: 8rpx;
|
|
background: #FFFFFF;
|
|
|
|
.cover {
|
|
width: 80rpx;
|
|
height: 80rpx;
|
|
margin-right: 18rpx;
|
|
border-radius: 50%;
|
|
}
|
|
|
|
.name {
|
|
font-size: 26rpx;
|
|
font-weight: bold;
|
|
line-height: 38rpx;
|
|
color: #333333;
|
|
}
|
|
|
|
.datetime {
|
|
font-size: 22rpx;
|
|
line-height: 32rpx;
|
|
color: #999999;
|
|
width: 240rpx;
|
|
flex-wrap: nowrap;
|
|
white-space: nowrap;
|
|
text-align: center;
|
|
}
|
|
|
|
.sub {
|
|
width: 548rpx;
|
|
margin-top: 12rpx;
|
|
font-size: 24rpx;
|
|
line-height: 34rpx;
|
|
color: #666666;
|
|
}
|
|
}
|
|
}
|
|
</style> |