outbox.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <template>
  2. <view>
  3. <uni-fab
  4. horizontal="right"
  5. vertical="bottom"
  6. @fabClick="toAdd"
  7. ></uni-fab>
  8. <u-search :show-action="false" v-model="searchForm.mailDTO.title" @change="inputWord" margin="20rpx 50rpx"></u-search>
  9. <view>
  10. <u-swipe-action>
  11. <view
  12. v-for="(obj, index) in dataList"
  13. :key="index">
  14. <u-swipe-action-item @click="del(obj.id)" :key="obj.id" :threshold="60" duration="500"
  15. :options="options">
  16. <u-cell-group>
  17. <u-cell @click="toDetail(obj)">
  18. <u-avatar slot="icon" size="32" randomBgColor :src="obj.sender.photo"></u-avatar>
  19. <view slot="title" class="content">
  20. <view class="text-bold text-grey">
  21. <view class="ellipsis-description">
  22. 标题:{{obj.mailDTO.title}}
  23. </view>
  24. </view>
  25. <view class="text-grey text-sm">
  26. <view class="ellipsis-description">
  27. 发件人:{{obj.sender.name}}, {{obj.sendTime}}
  28. </view>
  29. </view>
  30. <view class="text-sm">
  31. <view class="ellipsis-description" v-html="`内容:${obj.mailDTO && obj.mailDTO.content || ''}`"></view>
  32. </view>
  33. </view>
  34. <view slot="right-icon">
  35. <u-tag text="已发送" plain shape="circle" type="success"></u-tag>
  36. </view>
  37. </u-cell>
  38. </u-cell-group>
  39. </u-swipe-action-item>
  40. </view>
  41. </u-swipe-action>
  42. </view>
  43. <u-loadmore :status="status" @loadmore="loadmore" :line="true" />
  44. <u-gap height="20" bgColor="#fff"></u-gap>
  45. </view>
  46. </template>
  47. <script>
  48. import mailComposeService from "@/api/mail/mailComposeService";
  49. export default {
  50. data() {
  51. return {
  52. status: 'loadmore',
  53. searchForm: {
  54. mailDTO: {
  55. title: "",
  56. }
  57. },
  58. dataList: [],
  59. tablePage: {
  60. pages: 0,
  61. currentPage: 0,
  62. pageSize: 10,
  63. orders: [{ column: "a.create_time", asc: false }],
  64. },
  65. loading: false,
  66. options: [ {
  67. text: '删除',
  68. style: {
  69. backgroundColor: '#f56c6c'
  70. }
  71. }]
  72. }
  73. },
  74. onLoad() {
  75. this.loadmore()
  76. },
  77. methods: {
  78. // 跳转到详细页面
  79. toDetail (mail) {
  80. uni.navigateTo({
  81. url: '/pages/apps/mail/sendEmailDetail?id='+mail.id
  82. })
  83. },
  84. toAdd (){
  85. uni.navigateTo({
  86. url: '/pages/apps/mail/sendEmailForm'
  87. })
  88. },
  89. // 输入监听
  90. inputWord(e){
  91. this.searchTimer && clearTimeout(this.searchTimer)
  92. this.searchTimer = setTimeout(()=>{
  93. this.doSearch()
  94. },300)
  95. },
  96. // 搜索
  97. doSearch(){
  98. this.dataList = [];
  99. this.tablePage.currentPage = 0;
  100. this.tablePage.pageSize = 10;
  101. this.tablePage.pages = 0;
  102. this.loadmore()
  103. },
  104. onReachBottom() {
  105. this.loadmore()
  106. },
  107. loadmore() {
  108. if(this.tablePage.currentPage!==0 && this.tablePage.pages <= this.tablePage.currentPage ) {
  109. this.status = 'nomore';
  110. return;
  111. }
  112. this.tablePage.currentPage = ++ this.tablePage.currentPage;
  113. //联网加载数据
  114. this.status = 'loading';
  115. mailComposeService.list({
  116. current: this.tablePage.currentPage,
  117. size: this.tablePage.pageSize,
  118. orders: this.tablePage.orders,
  119. status: '1',
  120. ...this.searchForm
  121. }).then((data)=>{
  122. //追加新数据
  123. this.dataList=this.dataList.concat(data.records);
  124. this.tablePage.pages = data.pages;
  125. if(this.tablePage.pages <= this.tablePage.currentPage){
  126. this.status = 'nomore'
  127. } else {
  128. this.status = 'loadmore'
  129. }
  130. })
  131. },
  132. del (id) {
  133. mailComposeService.delete(id).then((data)=>{
  134. this.doSearch()
  135. uni.showToast({
  136. title: data,
  137. icon:"success"
  138. })
  139. })
  140. },
  141. }
  142. }
  143. </script>