250 lines
8.5 KiB
Vue
250 lines
8.5 KiB
Vue
<template>
|
|
<el-card class="box-card">
|
|
<div slot="header" class="flex justify-between items-start">
|
|
<div class="flex flex-col justify-start items-start">
|
|
<span>您有<em style="color: #bf2b28;padding: 0 3px;font-weight: 500">{{
|
|
unreadNum
|
|
}}</em>条未读消息</span>
|
|
<span class="text-main pointer" @click="allRead">全部已读</span>
|
|
</div>
|
|
<el-button style="float: right; padding: 3px 0; color: #666" type="text" @click="onSetting"
|
|
v-if="userInfo && parseInt(userInfo.userLevel) > 0"><i
|
|
class="el-icon-setting"></i> 消息推送设置
|
|
</el-button>
|
|
</div>
|
|
<!-- 消息列表 -->
|
|
<div class="notice-list">
|
|
<div class="item" v-for="(item,index) in noticeList" :key="index">
|
|
<div class="flex justify-between items-start">
|
|
<div class="title-box" @click="toDetail(item, index)">
|
|
<div class="flex justify-start items-start">
|
|
<el-badge is-dot class="badge" v-if="!item.hasRead"></el-badge>
|
|
<div class="title">{{ item.title }}</div>
|
|
</div>
|
|
<div class="time">{{ item._add_time_str }}</div>
|
|
</div>
|
|
<div class="right">
|
|
<div class="btn" @click="setRead(index)" v-if="!item.hasRead">
|
|
<i class="el-icon-sunset"></i>已读
|
|
</div>
|
|
<div class="btn" @click="del(index)">
|
|
<i class="el-icon-delete"></i>删除
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="desc pointer" @click="toDetail(item, index)">
|
|
{{ item.content }}
|
|
</div>
|
|
</div>
|
|
<div class="text-center mt-20">
|
|
<el-pagination @current-change="getList" background layout="prev, pager, next"
|
|
:total="total"></el-pagination>
|
|
</div>
|
|
</div>
|
|
|
|
<el-dialog title="提示" :visible.sync="dialogVisible" width="70%">
|
|
<el-descriptions title="报价详情" v-if="sheet && dialogVisible" border :column="1">
|
|
<el-descriptions-item label="公司">{{ sheet.user.company.companyName }}</el-descriptions-item>
|
|
<el-descriptions-item label="联系人">{{ sheet.user.manager.personName }}</el-descriptions-item>
|
|
<el-descriptions-item label="联系方式">{{
|
|
sheet.user.businessCard.companyMobile
|
|
}}
|
|
</el-descriptions-item>
|
|
<el-descriptions-item label="价格">{{ sheet.amount }}元</el-descriptions-item>
|
|
<el-descriptions-item label="附件">
|
|
<p v-for="(item, index) in sheet.files" :key="index">
|
|
<a :href="item" target="_blank">预览:文件{{ index + 1 }}</a>
|
|
</p>
|
|
</el-descriptions-item>
|
|
<el-descriptions-item label="备注">{{ sheet.remark }}</el-descriptions-item>
|
|
</el-descriptions>
|
|
<div slot="footer" class="dialog-footer">
|
|
<el-button @click="toContract" type="primary">去签合同</el-button>
|
|
<el-button @click="dialogVisible = false">关闭</el-button>
|
|
</div>
|
|
</el-dialog>
|
|
</el-card>
|
|
</template>
|
|
|
|
<script>
|
|
let that;
|
|
export default {
|
|
data() {
|
|
return {
|
|
unreadNum: 0,
|
|
noticeList: [],
|
|
pageSize: 10,
|
|
total: 0,
|
|
dialogVisible: false,
|
|
sheet: null,
|
|
userInfo: null,
|
|
}
|
|
},
|
|
onShow() {
|
|
this.getUserInfo()
|
|
this.getList()
|
|
this.getUnreadNum()
|
|
},
|
|
methods: {
|
|
async getUserInfo() {
|
|
const {userInfo} = await vk.callFunction({
|
|
url: 'user/kh/getMyUserInfo'
|
|
})
|
|
this.userInfo = userInfo
|
|
},
|
|
async getList(pageIndex = 1) {
|
|
const {rows, total} = await vk.callFunction({
|
|
url: 'client/message/kh/getList',
|
|
data: {
|
|
pageIndex,
|
|
pageSize: this.pageSize,
|
|
}
|
|
})
|
|
this.total = total
|
|
this.noticeList = rows
|
|
},
|
|
async getUnreadNum() {
|
|
const {data} = await vk.callFunction({
|
|
url: 'client/message/kh/getUnreadCount',
|
|
});
|
|
this.unreadNum = data
|
|
},
|
|
async setRead(index) {
|
|
this.noticeList[index].hasRead = true
|
|
await vk.callFunction({
|
|
url: 'client/message/kh/setRead',
|
|
data: {
|
|
id: this.noticeList[index]._id
|
|
}
|
|
})
|
|
},
|
|
del(index) {
|
|
this.$confirm('确认删除吗?', '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
}).then(async () => {
|
|
await vk.callFunction({
|
|
url: 'client/message/kh/delete',
|
|
data: {
|
|
id: this.noticeList[index]._id
|
|
}
|
|
})
|
|
this.$message({
|
|
type: 'success',
|
|
message: '删除成功'
|
|
})
|
|
await this.getList()
|
|
await this.getUnreadNum()
|
|
})
|
|
|
|
},
|
|
onSetting() {
|
|
uni.setStorageSync('user_tab', 3)
|
|
vk.navigateTo('/pages/user/user')
|
|
},
|
|
toDetail(item, index) {
|
|
if (!item.hasRead) this.setRead(index)
|
|
let url = null
|
|
if (item.type === 'old') url = `/pages/junk/detail?id=${item.pk}`
|
|
else if (item.type === 'enquiry') url = `/pages/price/detail?id=${item.pk}`
|
|
else if (item.type === 'process') url = `/pages/work/detail?id=${item.pk}`
|
|
else if (item.type === 'contract') url = `/pages/public/contract?tab=1`
|
|
else if (item.type === 'self-support') url = `/pages/self/makeQuote?id=${item.pk}`
|
|
else if (item.type === 'self-product') url = `/pages/user/seller`
|
|
else if (item.type === 'spot') url = `/pages/goods/detail?id=${item.pk}`
|
|
else if (item.type === 'self-support-quote') {
|
|
this.getQuoteDetail(item.pk)
|
|
}
|
|
if (url) vk.navigateTo({url})
|
|
},
|
|
async allRead() {
|
|
await vk.callFunction({
|
|
url: 'client/message/kh/setAllRead'
|
|
})
|
|
await this.getList(1)
|
|
await this.getUnreadNum()
|
|
},
|
|
async getQuoteDetail(_id) {
|
|
await vk.callFunction({
|
|
url: 'client/selfSupport/kh/getQuoteDetail',
|
|
data: {
|
|
_id
|
|
},
|
|
success: ({rows}) => {
|
|
this.sheet = rows
|
|
this.dialogVisible = true
|
|
}
|
|
});
|
|
},
|
|
toContract() {
|
|
this.dialogVisible = false
|
|
vk.navigateTo({url: '/pages/public/contract?tab=1'})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="less">
|
|
.el-icon-setting {
|
|
padding: 0 5px;
|
|
}
|
|
|
|
.notice-list {
|
|
.item {
|
|
font-size: 25rpx;
|
|
display: flex;
|
|
flex-direction: column;
|
|
padding: 10rpx 0;
|
|
border-bottom: 1px solid #ddd;
|
|
|
|
.title-box {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: flex-start;
|
|
justify-content: flex-start;
|
|
|
|
.title {
|
|
font-size: 14px;
|
|
}
|
|
|
|
.time {
|
|
margin-left: 10px;
|
|
color: #999999;
|
|
}
|
|
|
|
.badge {
|
|
display: flex;
|
|
flex-direction: column;
|
|
margin-top: 12rpx;
|
|
//margin-right: 10px;
|
|
}
|
|
}
|
|
|
|
.desc {
|
|
color: #999999;
|
|
line-height: 2em;
|
|
}
|
|
|
|
.right {
|
|
width: 45%;
|
|
display: flex;
|
|
justify-content: flex-end;
|
|
|
|
.btn {
|
|
color: #bf2b28;
|
|
cursor: pointer;
|
|
|
|
i {
|
|
padding: 0 5px;
|
|
margin-left: 10px;
|
|
}
|
|
}
|
|
|
|
.active {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style>
|