throughTrain.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <template>
  2. <view class="container">
  3. <view style="position: fixed;z-index: 2;width: 100%;background: #ffffff;top: 0;left: 0;">
  4. <view class="top_search">
  5. <u-search width="75%" shape="round" :action-style="styobj" bgColor='#f7f7f7' searchIconColor='#ccc'
  6. searchIconSize="28" placeholderColor="#BDBDBD" height="72" clearabled placeholder="请输入关键字搜索"
  7. v-model="form.content" @custom="custom" @search="search" @clear="clear" />
  8. </view>
  9. <view style="margin-top: 24rpx;">
  10. <u-tabs :list="typeList" :is-scroll="true" :current="current" @change="change" inactive-color="#999999"
  11. font-size='32' gutter='26' height="88" active-color="#DE2E27" bar-height="4" bar-width="64"
  12. :offset="offset" :bold='true'></u-tabs>
  13. </view>
  14. </view>
  15. <view class="list" v-if="list.length">
  16. <view class="mim-view" v-for="(item) in list" :key="item.id" @click="goComplaintDetails(item.id)">
  17. <view class="p1 mim-font-14 mim-multi-line">{{item.content || '--' }}</view>
  18. <view class="mim-flex-wrap-space-between" style="margin-top: 32rpx;">
  19. <view class="t mim-font-14">投诉人</view>
  20. <view class="t mim-font-14">{{item.complaint_name}}</view>
  21. </view>
  22. <view class="mim-flex-wrap-space-between" style="margin-top: 16rpx;">
  23. <view class="t mim-font-14">投诉时间</view>
  24. <view class="t mim-font-14">{{item.created_at}}</view>
  25. </view>
  26. </view>
  27. <u-divider bg-color='#f7f7f7' fontSize='24'>{{divider}}</u-divider>
  28. </view>
  29. <view v-else style="margin-top: 350rpx;">
  30. <u-empty></u-empty>
  31. </view>
  32. <view class="mim-view-list"></view>
  33. </view>
  34. </template>
  35. <script>
  36. export default {
  37. data() {
  38. return {
  39. type: '1',
  40. styobj: {
  41. 'width': '104rpx',
  42. 'height': '56rpx',
  43. 'background': '#de2e27',
  44. 'border-radius': '32rpx',
  45. 'line-height': '32px',
  46. 'opacity': '1',
  47. 'display': 'flex',
  48. 'align-items': 'center',
  49. 'justify-content': 'center',
  50. 'color': '#ffffff',
  51. 'font-size': '28rpx',
  52. 'z-index': '2'
  53. },
  54. typeList: [],
  55. current: 0,
  56. offset: [10, -2],
  57. form: {
  58. deal_status: '',
  59. page: 1,
  60. per_page: 10,
  61. content: ''
  62. },
  63. list: [],
  64. page: '',
  65. divider: '没有更多数据啦~',
  66. }
  67. },
  68. // onLoad(e) {
  69. // this.form.deal_status = e.current || ''
  70. // },
  71. onShow() {
  72. this.throughTrainListFn()
  73. this.throughTrainNumFn()
  74. },
  75. onPullDownRefresh() {
  76. //下拉刷新
  77. this.throughTrainListFn()
  78. this.throughTrainNumFn()
  79. },
  80. onReachBottom() {
  81. //触底加载
  82. console.log('触底加载')
  83. this.divider = '加载中。。。'
  84. if (this.page > this.form.page) {
  85. this.form.page++
  86. this.throughTrainListFn(false)
  87. } else {
  88. this.divider = '没有更多数据啦~'
  89. this.$u.toast('没有更多数据啦~')
  90. }
  91. },
  92. methods: {
  93. async throughTrainListFn(empty) {
  94. try {
  95. uni.showNavigationBarLoading();
  96. if (empty !== false) {
  97. this.form.page = 1
  98. this.list = [];
  99. }
  100. const {
  101. data: {
  102. data,
  103. meta
  104. },
  105. } = await this.$u.api.throughTrainList(this.form);
  106. this.page = meta.pagination.total_pages;
  107. this.list = this.page > 1 ? [...this.list, ...data] : data;
  108. this.divider = '没有更多数据啦~';
  109. } catch (error) {
  110. console.error(error);
  111. } finally {
  112. uni.hideNavigationBarLoading();
  113. uni.stopPullDownRefresh();
  114. }
  115. },
  116. //社情民意直通车数量查询
  117. async throughTrainNumFn() {
  118. const res = await this.$u.api.throughTrainNum()
  119. if (res.status === "success") {
  120. this.typeList = res.data
  121. }
  122. if (this.form.deal_status) {
  123. this.current = this.form.deal_status
  124. }
  125. },
  126. //切换
  127. change(index) {
  128. this.current = index;
  129. if (index == 0) {
  130. this.form.deal_status = ''
  131. } else {
  132. this.form.deal_status = index
  133. }
  134. this.throughTrainListFn()
  135. },
  136. search() {
  137. //搜索输入框内容
  138. this.throughTrainListFn()
  139. },
  140. custom() {
  141. //搜索输入框内容
  142. this.throughTrainListFn()
  143. },
  144. clear() {
  145. //清空输入框内容
  146. this.form.content = ''
  147. this.throughTrainListFn()
  148. },
  149. goComplaintDetails(e) {
  150. this.$u.route('/pages/throughTrain/throughTrainDetails', {
  151. id: e
  152. });
  153. }
  154. }
  155. }
  156. </script>
  157. <style lang="scss">
  158. page {
  159. background-color: #f7f7f7;
  160. .container {
  161. /deep/.u-badge {
  162. min-width: 36rpx;
  163. height: 36rpx;
  164. padding: 0;
  165. }
  166. .top_search {
  167. background: #f7f7f7;
  168. border-radius: 50rpx;
  169. margin: 24rpx;
  170. padding-right: 16rpx
  171. }
  172. .list {
  173. padding-top: 220rpx;
  174. .mim-view {
  175. overflow: hidden;
  176. .p1 {
  177. color: #333;
  178. }
  179. .t {
  180. color: #999999;
  181. }
  182. .img_type {
  183. position: absolute;
  184. bottom: -80rpx;
  185. right: -60rpx;
  186. border-bottom: none;
  187. }
  188. }
  189. }
  190. }
  191. }
  192. </style>