index.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <template>
  2. <view class="my-fillin-container">
  3. <title-status />
  4. <h-navbar title="我的填报" />
  5. <scroll-view class="type-layout" scroll-x>
  6. <view :class="['type-item', currentType === index ? 'active' : '']" v-for="(item, index) in typeList" :key="index" @click="typeItemClick(index)">
  7. {{ item.value }}
  8. </view>
  9. </scroll-view>
  10. <view class="content-layout">
  11. <view v-for="(item, index) in listData" :key="index" class="content-item" @click="itemClick(item)">
  12. <view class="item-head">
  13. <view class="item-address text-one">{{ item.safeThingsAddressId || '' }}</view>
  14. <view class="item-date">{{ item.queryTime || '' }}</view>
  15. </view>
  16. <view style="display: flex;padding: 24rpx 20rpx;">
  17. <view class="item-left">
  18. <view class="item-title text-one">{{ item.thingTitle || '' }}</view>
  19. <view class="item-type text-one">事件类型:{{ item.safeThingsTypeName || '' }}</view>
  20. <view class="item-type text-one">违规所属:{{ item.violationType | violationTypeFormat }}</view>
  21. </view>
  22. <view class="item-right" v-if="item.status && item.status > 0">
  23. <u-image :src="`/static/images/${typeIcon[item.status - 1] || null}`" width="120rpx" height="120rpx" loadingIcon="" lazy-load />
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. import { list } from '@/network/module/my-fillin.api.js'
  32. import TitleStatus from '@/components/title-status/title-status'
  33. import HNavbar from '@/components/h-navbar/h-navbar.vue'
  34. export default {
  35. components: {
  36. TitleStatus,
  37. HNavbar
  38. },
  39. data() {
  40. return {
  41. page: {
  42. pageNum: 0,
  43. pageSize: 10,
  44. total: 0
  45. },
  46. // 类型列表
  47. typeList: [
  48. {
  49. key: null,
  50. value: '全部'
  51. },
  52. {
  53. key: 1,
  54. value: '待确认'
  55. },
  56. {
  57. key: 2,
  58. value: '待受案'
  59. },
  60. {
  61. key: 3,
  62. value: '已受案'
  63. },
  64. {
  65. key: 4,
  66. value: '已完成'
  67. }
  68. ],
  69. // 选中的类型
  70. currentType: 0,
  71. typeIcon: ['progress1.png','progress2.png','progress3.png','progress4.png'],
  72. listData: []
  73. }
  74. },
  75. filters: {
  76. violationTypeFormat(value) {
  77. if(!value) {
  78. return ''
  79. }
  80. if(value === 1) {
  81. return '旅客'
  82. } else if(value === 2) {
  83. return '货代'
  84. } else if(value === 3) {
  85. return '工作人员'
  86. }
  87. return ''
  88. }
  89. },
  90. watch: {
  91. currentType(newVal, oldVal) {
  92. this.getPageList(true)
  93. }
  94. },
  95. onLoad() {
  96. this.getPageList()
  97. },
  98. // page时下拉刷新,需要在 pages.json 里,找到的当前页面的pages节点,并在 style 选项中开启 enablePullDownRefresh
  99. onPullDownRefresh() {
  100. this.getPageList(true)
  101. },
  102. // page时上拉加载更多
  103. onReachBottom() {
  104. this.getPageList()
  105. },
  106. methods: {
  107. typeItemClick(index) {
  108. if(index === this.currentType) {
  109. return
  110. }
  111. this.currentType = index
  112. },
  113. async getPageList(isRefresh = false) {
  114. if(isRefresh) {
  115. this.page.pageNum = 0
  116. }
  117. this.page.pageNum++
  118. const result = await list({pageNum: this.page.pageNum, pageSize: this.page.pageSize, data: {status: this.typeList[this.currentType].key}})
  119. if(isRefresh) {
  120. this.listData = []
  121. }
  122. this.page.total = result.data.total
  123. if(result.data.records) {
  124. this.listData = this.listData.concat(result.data.records)
  125. } else {
  126. this.page.pageNum = this.page.pageNum === 1 ? 1 : (this.page.pageNum - 1)
  127. }
  128. uni.stopPullDownRefresh()
  129. },
  130. itemClick(value) {
  131. if(!value) {
  132. return
  133. }
  134. this.$navigate.navigateToPage(this.$config.route.myFillinDetail,{obj: encodeURIComponent(JSON.stringify(value))})
  135. }
  136. }
  137. }
  138. </script>
  139. <style>
  140. page {
  141. background-color: #F3F4F6;
  142. }
  143. </style>
  144. <style lang="scss" scoped>
  145. .my-fillin-container {
  146. display: flex;
  147. flex-direction: column;
  148. .type-layout {
  149. width: 100%;
  150. // height: 122rpx;
  151. white-space: nowrap;
  152. background-color: #fff;
  153. padding: 24rpx 0;
  154. .type-item {
  155. text-align: center;
  156. display: inline-block;
  157. width: 140rpx;
  158. height: 74rpx;
  159. line-height: 74rpx;
  160. margin-left: 24rpx;
  161. color: #909399;
  162. font-size: 28rpx;
  163. font-weight: 400;
  164. background: #F3F4F6;
  165. border-radius: 46rpx;
  166. &:first-of-type {
  167. margin-left: 30rpx;
  168. }
  169. &:last-of-type {
  170. margin-right: 30rpx;
  171. }
  172. }
  173. .active {
  174. color: #fff;
  175. background: #4583FD;
  176. }
  177. }
  178. .content-layout {
  179. display: flex;
  180. flex-direction: column;
  181. align-items: center;
  182. .content-item {
  183. width: 660rpx;
  184. // height: 264rpx;
  185. border-radius: 20rpx;
  186. background-color: #fff;
  187. display: flex;
  188. flex-direction: column;
  189. margin-bottom: 24rpx;
  190. &:first-of-type {
  191. margin-top: 24rpx;
  192. }
  193. .item-head {
  194. display: flex;
  195. align-items: center;
  196. justify-content: space-between;
  197. padding: 20rpx 24rpx;
  198. border-bottom: 2rpx solid #F3F4F6;
  199. .item-address {
  200. font-weight: 400;
  201. font-size: 28rpx;
  202. color: #333333;
  203. }
  204. .item-date {
  205. font-weight: 400;
  206. font-size: 28rpx;
  207. color: #909399;
  208. }
  209. }
  210. .item-left {
  211. display: flex;
  212. flex-direction: column;
  213. flex: auto;
  214. .item-title {
  215. font-size: 34rpx;
  216. font-weight: 500;
  217. color: #333333;
  218. }
  219. .item-type {
  220. font-size: 30rpx;
  221. font-weight: 400;
  222. color: #333333;
  223. margin-top: 2rpx;
  224. }
  225. }
  226. .item-right {
  227. flex: none;
  228. width: 120rpx;
  229. margin-left: 20rpx;
  230. display: flex;
  231. flex-direction: column;
  232. justify-content: center;
  233. }
  234. }
  235. }
  236. }
  237. </style>