email.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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="取消"
  31. title="更多" :show="show" @select="selectClick" @close="show = false"></u-action-sheet>
  32. </view>
  33. </template>
  34. <script>
  35. import {
  36. showtime
  37. } from "@/utils/wjw.js"
  38. export default {
  39. data() {
  40. return {
  41. model: {
  42. pageNum: 1,
  43. pageSize: 20,
  44. mainTitle: null
  45. },
  46. total: 0,
  47. //加载状态
  48. status: 'loadmore',
  49. //邮件列表
  50. list: [],
  51. //搜索
  52. keyword: null,
  53. showtime: showtime,
  54. //更多
  55. show: false,
  56. morelist: [{
  57. name: '发件箱'
  58. }, ],
  59. index: null
  60. }
  61. },
  62. onLoad() {
  63. let that = this
  64. this.getList()
  65. },
  66. onShow() {
  67. this.getUnreadEmail()
  68. this.getdbNum()
  69. },
  70. onNavigationBarButtonTap(e) {
  71. this.show = true
  72. },
  73. onPullDownRefresh() {
  74. this.model.pageNum = 1
  75. this.list = []
  76. this.getList()
  77. },
  78. onReachBottom() {
  79. if (this.model.pageNum == this.total) {
  80. this.status = 'nomore'
  81. } else {
  82. this.model.pageNum++
  83. this.getList()
  84. }
  85. },
  86. methods: {
  87. //查询邮件列表
  88. getList() {
  89. let that = this
  90. uni.$u.http.get('/oa/mail/inbox', {
  91. params: that.model
  92. }).then(res => {
  93. uni.hideLoading()
  94. that.list = [...that.list, ...res.rows]
  95. if (res.total < this.model.pageSize) {
  96. that.status = "nomore"
  97. } else {
  98. that.status = "loadmore"
  99. }
  100. if (that.model.pageNum === 1) {
  101. that.total = Math.ceil(res.total / that.model.pageSize)
  102. uni.stopPullDownRefresh()
  103. }
  104. })
  105. },
  106. //查看邮件详细信息
  107. emailInfo(id, i) {
  108. if (this.list[i].isRead == 'N') {
  109. this.list[i].isRead = 'Y'
  110. }
  111. uni.navigateTo({
  112. url: "/pages/emailInfo/emailInfo?id=" + id + '&type=1'
  113. })
  114. },
  115. //获取未读邮件
  116. getUnreadEmail() {
  117. uni.$u.http.get('/oa/mail/count/unread').then(res => {
  118. if (res == 0) {
  119. this.$forceUpdate()
  120. uni.removeTabBarBadge({ //显示数字
  121. index: 1, //tabbar下标
  122. })
  123. } else {
  124. this.$forceUpdate()
  125. // this.model.pageNum = 1
  126. // this.list = []
  127. // uni.startPullDownRefresh()
  128. uni.setTabBarBadge({ //显示数字
  129. index: 1, //tabbar下标
  130. text: '' + res + '' //数字
  131. })
  132. }
  133. })
  134. },
  135. //查询待办数量
  136. getdbNum() {
  137. uni.$u.http.get('/jflow/restful/DB_Todolist_Num?token=' + uni.getStorageSync('jtoken')).then(res => {
  138. // console.log(res)
  139. if (res.code == 200) {
  140. if (res.list.length > 0) {
  141. let qwe = 0
  142. for (let i in res.list) {
  143. if (res.list[i].FK_Flow != '008' && res.list[i].FK_Flow != '021') {
  144. qwe = res.list[i].Total + qwe
  145. }
  146. if (i == res.list.length - 1) {
  147. uni.setTabBarBadge({ //显示数字
  148. index: 0, //tabbar下标
  149. text: '' + qwe + '' //数字
  150. })
  151. }
  152. }
  153. } else {
  154. uni.removeTabBarBadge({ //显示数字
  155. index: 0, //tabbar下标
  156. })
  157. }
  158. }
  159. })
  160. },
  161. //根据标题搜索邮件内容
  162. search() {
  163. uni.showLoading({
  164. title: "搜索中...",
  165. mask: true
  166. })
  167. this.pageNum = 1
  168. this.list = []
  169. this.getList()
  170. },
  171. //点击收件箱
  172. selectClick(e) {
  173. uni.navigateTo({
  174. url: "/pages/inbox/inbox"
  175. })
  176. }
  177. }
  178. }
  179. </script>
  180. <style>
  181. </style>