email.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <template>
  2. <view>
  3. <view style="padding: 20rpx;background-color: #fff;">
  4. <u-search v-model="model.mainTitle" placeholder="请输入邮件标题" :showAction="true" actionText="搜索"
  5. :animation="true" @custom="search" @clear="search">
  6. </u-search>
  7. </view>
  8. <view style="background-color: #fff;">
  9. <u-cell-group><!-- $u.timeFormat(v.sendTime, 'yyyy-mm-dd') -->
  10. <u-cell v-for="(v,i) in list" :key="v.mailId" :title="v.sendUserName" :titleStyle="{fontSize:'36rpx'}"
  11. :value="showtime($u.timeFormat(v.sendTime, 'yyyy-mm-dd'))" @click="emailInfo(v.mailId,i)">
  12. <u-badge slot="icon" :isDot="true" type="error" v-if="v.isRead=='N'"></u-badge>
  13. <view slot="label" style="width: 100%;display: flex;align-items: center;margin-top: 20rpx;">
  14. <view style="max-width: 70%;">
  15. <u--text :lines="1" size="30rpx" :text="v.mainTitle"></u--text>
  16. </view>
  17. <view style="margin-left: 10rpx;" v-if="v.isHaveFile ==1">
  18. <u-icon name="attach" size="30rpx" color="#409EFF"></u-icon>
  19. </view>
  20. </view>
  21. </u-cell>
  22. </u-cell-group>
  23. </view>
  24. <view style="padding: 20rpx;" v-if="list.length> 0">
  25. <u-loadmore :status="status" fontSize="28rpx" />
  26. </view>
  27. <div v-if="list.length == 0">
  28. <u-empty mode="list" icon="/static/list.png" text="暂无内容" textSize="30rpx"></u-empty>
  29. </div>
  30. <u-action-sheet :actions="morelist" :closeOnClickOverlay="true" :closeOnClickAction="true" cancelText="取消" title="更多" :show="show" @select="selectClick" @close="show = false"></u-action-sheet>
  31. </view>
  32. </template>
  33. <script>
  34. import {showtime} from "@/utils/wjw.js"
  35. export default {
  36. data() {
  37. return {
  38. model: {
  39. pageNum: 1,
  40. pageSize: 20,
  41. mainTitle: null
  42. },
  43. total: 0,
  44. //加载状态
  45. status: 'loadmore',
  46. //邮件列表
  47. list: [],
  48. //搜索
  49. keyword: null,
  50. showtime:showtime,
  51. //更多
  52. show:false,
  53. morelist:[
  54. {
  55. name:'发件箱'
  56. },
  57. ],
  58. index:null
  59. }
  60. },
  61. onLoad() {
  62. let that = this
  63. this.getList()
  64. },
  65. onShow() {
  66. this.getUnreadEmail()
  67. this.getdbNum()
  68. },
  69. onNavigationBarButtonTap(e) {
  70. this.show = true
  71. },
  72. onPullDownRefresh() {
  73. this.model.pageNum = 1
  74. this.list = []
  75. this.getList()
  76. },
  77. onReachBottom() {
  78. if (this.model.pageNum == this.total) {
  79. this.status = 'nomore'
  80. } else {
  81. this.model.pageNum++
  82. this.getList()
  83. }
  84. },
  85. methods: {
  86. //查询邮件列表
  87. getList() {
  88. let that = this
  89. uni.$u.http.get('/oa/mail/inbox', {
  90. params: that.model
  91. }).then(res => {
  92. uni.hideLoading()
  93. that.list = [...that.list, ...res.rows]
  94. if (res.total < this.model.pageSize) {
  95. that.status = "nomore"
  96. } else {
  97. that.status = "loadmore"
  98. }
  99. if (that.model.pageNum === 1) {
  100. that.total = Math.ceil(res.total / that.model.pageSize)
  101. uni.stopPullDownRefresh()
  102. }
  103. })
  104. },
  105. //查看邮件详细信息
  106. emailInfo(id, i) {
  107. if (this.list[i].isRead == 'N') {
  108. this.list[i].isRead = 'Y'
  109. }
  110. uni.navigateTo({
  111. url: "/pages/emailInfo/emailInfo?id=" + id+'&type=1'
  112. })
  113. },
  114. //获取未读邮件
  115. getUnreadEmail() {
  116. uni.$u.http.get('/oa/mail/count/unread').then(res => {
  117. if (res == 0) {
  118. uni.removeTabBarBadge({ //显示数字
  119. index: 2, //tabbar下标
  120. })
  121. } else {
  122. // this.model.pageNum = 1
  123. // this.list = []
  124. // uni.startPullDownRefresh()
  125. uni.setTabBarBadge({ //显示数字
  126. index: 2, //tabbar下标
  127. text: '' + res + '' //数字
  128. })
  129. }
  130. })
  131. },
  132. //查询待办数量
  133. getdbNum(){
  134. uni.$u.http.get('/jflow/restful/DB_Todolist_Num?token='+uni.getStorageSync('jtoken')).then(res=>{
  135. // console.log(res)
  136. if(res.code==200){
  137. if (res.list.length > 0) {
  138. let qwe = 0
  139. for(let i in res.list){
  140. if(res.list[i].FK_Flow != '008' && res.list[i].FK_Flow != '009'){
  141. qwe = res.list[i].Total + qwe
  142. }
  143. if(i == res.list.length-1){
  144. uni.setTabBarBadge({ //显示数字
  145. index: 1, //tabbar下标
  146. text: '' + qwe + '' //数字
  147. })
  148. }
  149. }
  150. } else {
  151. uni.removeTabBarBadge({ //显示数字
  152. index: 1, //tabbar下标
  153. })
  154. }
  155. }
  156. })
  157. },
  158. //根据标题搜索邮件内容
  159. search() {
  160. uni.showLoading({
  161. title: "搜索中...",
  162. mask: true
  163. })
  164. this.pageNum = 1
  165. this.list = []
  166. this.getList()
  167. },
  168. //点击收件箱
  169. selectClick(e){
  170. uni.navigateTo({
  171. url:"/pages/inbox/inbox"
  172. })
  173. }
  174. }
  175. }
  176. </script>
  177. <style>
  178. </style>