email.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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. }
  59. },
  60. onLoad() {
  61. let that = this
  62. this.getList()
  63. },
  64. onShow() {
  65. this.getUnreadEmail()
  66. this.getdbNum()
  67. },
  68. onNavigationBarButtonTap(e) {
  69. this.show = true
  70. },
  71. onPullDownRefresh() {
  72. this.model.pageNum = 1
  73. this.list = []
  74. this.getList()
  75. },
  76. onReachBottom() {
  77. if (this.model.pageNum == this.total) {
  78. this.status = 'nomore'
  79. } else {
  80. this.model.pageNum++
  81. this.getList()
  82. }
  83. },
  84. methods: {
  85. //查询邮件列表
  86. getList() {
  87. let that = this
  88. uni.$u.http.get('/oa/mail/inbox', {
  89. params: that.model
  90. }).then(res => {
  91. uni.hideLoading()
  92. that.list = [...that.list, ...res.rows]
  93. if (res.total < this.model.pageSize) {
  94. that.status = "nomore"
  95. } else {
  96. that.status = "loadmore"
  97. }
  98. if (that.model.pageNum === 1) {
  99. that.total = Math.ceil(res.total / that.model.pageSize)
  100. uni.stopPullDownRefresh()
  101. }
  102. })
  103. },
  104. //查看邮件详细信息
  105. emailInfo(id, i) {
  106. if (this.list[i].isRead == 'N') {
  107. this.list[i].isRead = 'Y'
  108. }
  109. uni.navigateTo({
  110. url: "/pages/emailInfo/emailInfo?id=" + id+'&type=1'
  111. })
  112. },
  113. //获取未读邮件
  114. getUnreadEmail() {
  115. uni.$u.http.get('/oa/mail/count/unread').then(res => {
  116. if (res == 0) {
  117. uni.removeTabBarBadge({ //显示数字
  118. index: 2, //tabbar下标
  119. })
  120. } else {
  121. this.model.pageNum = 1
  122. this.list = []
  123. uni.startPullDownRefresh()
  124. uni.setTabBarBadge({ //显示数字
  125. index: 2, //tabbar下标
  126. text: '' + res + '' //数字
  127. })
  128. }
  129. })
  130. },
  131. //查询待办数量
  132. getdbNum(){
  133. uni.$u.http.get('/jflow/restful/DB_Todolist_Num?token='+uni.getStorageSync('jtoken')).then(res=>{
  134. // console.log(res)
  135. if(res.code==200){
  136. if (res.list.length > 0) {
  137. let qwe = 0
  138. for(let i in res.list){
  139. if(res.list[i].FK_Flow != '008' && res.list[i].FK_Flow != '009'){
  140. qwe = res.list[i].Total + qwe
  141. }
  142. if(i == res.list.length-1){
  143. uni.setTabBarBadge({ //显示数字
  144. index: 1, //tabbar下标
  145. text: '' + qwe + '' //数字
  146. })
  147. }
  148. }
  149. } else {
  150. uni.removeTabBarBadge({ //显示数字
  151. index: 1, //tabbar下标
  152. })
  153. }
  154. }
  155. })
  156. },
  157. //根据标题搜索邮件内容
  158. search() {
  159. uni.showLoading({
  160. title: "搜索中...",
  161. mask: true
  162. })
  163. this.pageNum = 1
  164. this.list = []
  165. this.getList()
  166. },
  167. //点击收件箱
  168. selectClick(e){
  169. uni.navigateTo({
  170. url:"/pages/inbox/inbox"
  171. })
  172. }
  173. }
  174. }
  175. </script>
  176. <style>
  177. </style>