123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- <template>
- <view>
- <view style="padding: 20rpx;background-color: #fff;">
- <u-search v-model="model.mainTitle" placeholder="请输入邮件标题" :showAction="true" actionText="搜索"
- :animation="true" @custom="search" @clear="search">
- </u-search>
- </view>
- <view style="background-color: #fff;">
- <u-cell-group><!-- $u.timeFormat(v.sendTime, 'yyyy-mm-dd') -->
- <u-cell v-for="(v,i) in list" :key="v.mailId" :title="v.sendUserName" :titleStyle="{fontSize:'36rpx'}"
- :value="showtime($u.timeFormat(v.sendTime, 'yyyy-mm-dd'))" @click="emailInfo(v.mailId,i)">
- <u-badge slot="icon" :isDot="true" type="error" v-if="v.isRead=='N'"></u-badge>
- <view slot="label" style="width: 100%;display: flex;align-items: center;margin-top: 20rpx;">
- <view style="max-width: 70%;">
- <u--text :lines="1" size="30rpx" :text="v.mainTitle"></u--text>
- </view>
- <view style="margin-left: 10rpx;" v-if="v.isHaveFile ==1">
- <u-icon name="attach" size="30rpx" color="#409EFF"></u-icon>
- </view>
- </view>
- </u-cell>
- </u-cell-group>
- </view>
-
- <view style="padding: 20rpx;" v-if="list.length> 0">
- <u-loadmore :status="status" fontSize="28rpx" />
- </view>
- <div v-if="list.length == 0">
- <u-empty mode="list" icon="/static/list.png" text="暂无内容" textSize="30rpx"></u-empty>
- </div>
- <u-action-sheet :actions="morelist" :closeOnClickOverlay="true" :closeOnClickAction="true" cancelText="取消" title="更多" :show="show" @select="selectClick" @close="show = false"></u-action-sheet>
- </view>
- </template>
- <script>
- import {showtime} from "@/utils/wjw.js"
- export default {
- data() {
- return {
- model: {
- pageNum: 1,
- pageSize: 20,
- mainTitle: null
- },
- total: 0,
- //加载状态
- status: 'loadmore',
- //邮件列表
- list: [],
- //搜索
- keyword: null,
- showtime:showtime,
- //更多
- show:false,
- morelist:[
- {
- name:'发件箱'
- },
- ],
- index:null
- }
- },
- onLoad() {
- let that = this
- this.getList()
- },
- onShow() {
- this.getUnreadEmail()
- this.getdbNum()
- },
- onNavigationBarButtonTap(e) {
- this.show = true
- },
- onPullDownRefresh() {
- this.model.pageNum = 1
- this.list = []
- this.getList()
- },
- onReachBottom() {
- if (this.model.pageNum == this.total) {
- this.status = 'nomore'
- } else {
- this.model.pageNum++
- this.getList()
- }
- },
- methods: {
- //查询邮件列表
- getList() {
- let that = this
- uni.$u.http.get('/oa/mail/inbox', {
- params: that.model
- }).then(res => {
- uni.hideLoading()
- that.list = [...that.list, ...res.rows]
- if (res.total < this.model.pageSize) {
- that.status = "nomore"
- } else {
- that.status = "loadmore"
- }
- if (that.model.pageNum === 1) {
- that.total = Math.ceil(res.total / that.model.pageSize)
- uni.stopPullDownRefresh()
- }
- })
- },
- //查看邮件详细信息
- emailInfo(id, i) {
- if (this.list[i].isRead == 'N') {
- this.list[i].isRead = 'Y'
- }
- uni.navigateTo({
- url: "/pages/emailInfo/emailInfo?id=" + id+'&type=1'
- })
- },
- //获取未读邮件
- getUnreadEmail() {
- uni.$u.http.get('/oa/mail/count/unread').then(res => {
- if (res == 0) {
- uni.removeTabBarBadge({ //显示数字
- index: 2, //tabbar下标
- })
- } else {
- // this.model.pageNum = 1
- // this.list = []
- // uni.startPullDownRefresh()
- uni.setTabBarBadge({ //显示数字
- index: 2, //tabbar下标
- text: '' + res + '' //数字
- })
- }
- })
- },
- //查询待办数量
- getdbNum(){
- uni.$u.http.get('/jflow/restful/DB_Todolist_Num?token='+uni.getStorageSync('jtoken')).then(res=>{
- // console.log(res)
- if(res.code==200){
- if (res.list.length > 0) {
- let qwe = 0
- for(let i in res.list){
- if(res.list[i].FK_Flow != '008' && res.list[i].FK_Flow != '009'){
- qwe = res.list[i].Total + qwe
- }
- if(i == res.list.length-1){
- uni.setTabBarBadge({ //显示数字
- index: 1, //tabbar下标
- text: '' + qwe + '' //数字
- })
- }
- }
- } else {
- uni.removeTabBarBadge({ //显示数字
- index: 1, //tabbar下标
- })
- }
- }
-
- })
- },
- //根据标题搜索邮件内容
- search() {
- uni.showLoading({
- title: "搜索中...",
- mask: true
- })
- this.pageNum = 1
- this.list = []
- this.getList()
- },
- //点击收件箱
- selectClick(e){
- uni.navigateTo({
- url:"/pages/inbox/inbox"
- })
- }
- }
- }
- </script>
- <style>
- </style>
|