You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
163 lines
3.5 KiB
163 lines
3.5 KiB
<template>
|
|
<view class="system-message">
|
|
<scroll-list ref="messageRef" :option="option" @load="quotationUp" @refresh="quotationDown">
|
|
<view v-for="(item,index) in list" :key="index">
|
|
<view class="system-message-main">
|
|
<view class="system-message-main-top">
|
|
<view class="system-message-title">
|
|
<view class="">客户下单</view>
|
|
<view class="dian" v-if="item.readOrNot === 0"></view>
|
|
</view>
|
|
<view class="system-message-subtitle">{{item.createTime}}</view>
|
|
</view>
|
|
<view class="system-message-contant">{{item.content}}</view>
|
|
</view>
|
|
</view>
|
|
</scroll-list>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
import { systemMessageList,systemRead } from '@/apis/trade'
|
|
export default {
|
|
data() {
|
|
return {
|
|
option: {
|
|
size: 10,
|
|
auto: true,
|
|
emptyText: '暂无消息~',
|
|
background: '#F7F8FA',
|
|
fontSize: '40rpx'
|
|
},
|
|
pagination: {
|
|
pageNum: 0, // 初始会执行一次下拉加载
|
|
pageSize: 10
|
|
},
|
|
list:[]
|
|
}
|
|
},
|
|
onLoad(option) {
|
|
this.queryData()
|
|
},
|
|
methods: {
|
|
queryData(){
|
|
return new Promise((resolve, reject) => {
|
|
systemMessageList({...this.pagination })
|
|
.then((res) => {
|
|
if (res) {
|
|
var data= res.records
|
|
var count = 0
|
|
for(let i =0;i<data.length;i++){
|
|
if(data[i].readOrNot === 0){
|
|
count = count + 1
|
|
}
|
|
}
|
|
this.$emit('systemCount',count)
|
|
if (this.pagination.pageNum === 0) {
|
|
this.list = res.records
|
|
} else {
|
|
this.list = this.list.concat(res.records)
|
|
}
|
|
resolve({ list: this.list, total: res.total })
|
|
} else {
|
|
reject()
|
|
}
|
|
})
|
|
.catch((err) => {
|
|
reject(err)
|
|
})
|
|
})
|
|
},
|
|
//消息分页
|
|
quotationUp(page) {
|
|
this.pagination.pageNum++
|
|
this.queryData()
|
|
.then(({ list, total }) => {
|
|
this.$refs.messageRef.refreshSuccess({ list, total })
|
|
})
|
|
.catch(() => {
|
|
this.$refs.messageRef.loadFail()
|
|
})
|
|
},
|
|
//消息分页
|
|
quotationDown() {
|
|
this.pagination.pageNum = 0
|
|
this.queryData()
|
|
.then(({ list, total }) => {
|
|
this.$refs.messageRef.refreshSuccess({ list, total })
|
|
})
|
|
.catch(() => {
|
|
this.$refs.messageRef.refreshFail()
|
|
})
|
|
},
|
|
allread(){
|
|
return new Promise((resolve, reject) => {
|
|
var meesage = this.list.map(item => {return item.id})
|
|
systemRead(meesage)
|
|
.then((res) => {
|
|
if (res) {
|
|
uni.showToast({
|
|
title: '操作成功',
|
|
icon: 'success'
|
|
})
|
|
this.pagination.pageNum = 0
|
|
this.queryData()
|
|
} else {
|
|
reject()
|
|
}
|
|
})
|
|
.catch((err) => {
|
|
reject(err)
|
|
})
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.system-message {
|
|
.system-message-main {
|
|
background-color: #ffffff;
|
|
margin: 20rpx 32rpx;
|
|
border-radius: 20rpx;
|
|
}
|
|
.system-message-main-top {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
padding: 24rpx 32rpx;
|
|
}
|
|
.system-message-title {
|
|
font-size: 32rpx;
|
|
color: #333333;
|
|
letter-spacing: 0;
|
|
font-weight: 600;
|
|
display: flex;
|
|
}
|
|
.system-message-subtitle {
|
|
font-size: 24rpx;
|
|
color: #333333;
|
|
font-weight: 400;
|
|
}
|
|
.system-message-contant {
|
|
font-size: 28rpx;
|
|
color: #888888;
|
|
letter-spacing: 0;
|
|
font-weight: 400;
|
|
padding: 0rpx 32rpx;
|
|
line-height: 40rpx;
|
|
overflow: auto;
|
|
max-height: 100rpx;
|
|
height: 100rpx;
|
|
}
|
|
.dian {
|
|
background: #FF0000 ;
|
|
height: 14rpx;
|
|
width: 14rpx;
|
|
border-radius: 20rpx;
|
|
margin-left: 10rpx;
|
|
}
|
|
}
|
|
</style>
|