index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <template>
  2. <view style="height: 100vh;">
  3. <uni-nav-bar title="注册列表" backgroundColor='#03803B' color="#fff" left-icon="left" fixed statusBar
  4. @clickLeft='goBack()' @clickRight="addDetails">
  5. <block slot="right">
  6. <view>
  7. <image class="nav-right" src="@/static/images/home/insurance/add.png" />
  8. </view>
  9. </block>
  10. </uni-nav-bar>
  11. <scroll-view scroll-y="true" :refresher-enabled="true" :refresher-triggered="triggered"
  12. @refresherrefresh="onRefresh" class="scroll-view">
  13. <view class="list">
  14. <u-empty v-if='dataList.length==0' mode="list">
  15. </u-empty>
  16. <view class="tab-bar-item" v-for="(item, index) in dataList" :key="index" @click="inEdit(item)">
  17. <view class="list-item">
  18. <view style="font-weight: 800;">
  19. {{item.insuranceNo}}
  20. </view>
  21. <view style="color: #B5B4B4;">
  22. {{item.createTime}}
  23. </view>
  24. </view>
  25. <view class="list-item">
  26. <view style="font-weight: 800;color: #03803B;">
  27. {{item.vehicleNumber||'暂无车牌'}}
  28. </view>
  29. <view class="">
  30. 轮胎规格: {{item.tyreSpecs||'-'}}
  31. </view>
  32. </view>
  33. <view class="list-item">
  34. <view class="">
  35. 轮胎:{{item.tireQuantity||0}}条
  36. </view>
  37. <view style="display: flex;align-items: center;color: #03803B;">
  38. <image style="width: 32rpx;height: 32rpx;margin-right: 18rpx;"
  39. src="@/static/images/home/insurance/ap.png" />
  40. <text v-if="item.status==0" style="color:#e6a23c">
  41. 录入
  42. </text>
  43. <text v-if="item.status==1" style="color:#e6a23c">
  44. 在保
  45. </text>
  46. <text v-if="item.status==2" style="color:#409EFF">
  47. 受理中
  48. </text>
  49. <text v-if="item.status==3" style="color:#67c23a">
  50. 已通过
  51. </text>
  52. <text v-if="item.status==4" style="color:#f56c6c">
  53. 已拒绝
  54. </text>
  55. </view>
  56. </view>
  57. <view class="list-item-end">
  58. <view style="color: #B5B4B4;">
  59. 有效截至日期:{{item.insuranceTime||'暂无日期'}}
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. <view v-if="loading" class="loading">加载中...</view>
  65. <view v-if="noMore" class="no-more">没有更多数据了</view>
  66. </scroll-view>
  67. </view>
  68. </template>
  69. <script>
  70. import {
  71. getList
  72. } from '@/api/home/insurance.js'
  73. export default {
  74. data() {
  75. return {
  76. triggered: false,
  77. searchValue: null,
  78. page: {
  79. current: 1,
  80. size: 10,
  81. total: 0,
  82. },
  83. dataList: [],
  84. loading: false,
  85. noMore: false
  86. }
  87. },
  88. onLoad() {
  89. this.getList()
  90. },
  91. onReachBottom() {
  92. if (!this.noMore) {
  93. this.page.current += 1
  94. this.getList()
  95. }
  96. },
  97. filters: {
  98. statusMap(value) {
  99. // 状态 0录入,1已提交(在保),2受理中(理赔提交),3已通过(工厂审核通过)
  100. const statusList = ['录入', '在保', '受理中', '已通过']
  101. return statusList[value] || '未知状态'
  102. }
  103. },
  104. methods: {
  105. onRefresh() {
  106. this.triggered = true;
  107. this.noMore = false;
  108. // 模拟异步请求
  109. setTimeout(() => {
  110. this.page.current = 1
  111. this.dataList = []
  112. this.getList()
  113. }, 500);
  114. },
  115. addDetails() {
  116. uni.navigateTo({
  117. url: '/pages/home/insurance/rules'
  118. });
  119. },
  120. inEdit(row) {
  121. uni.navigateTo({
  122. url: '/pages/home/insurance/details?id=' + row.id,
  123. });
  124. },
  125. getList() {
  126. const obj = {
  127. current: this.page.current,
  128. size: this.page.size
  129. }
  130. this.loading = true
  131. uni.showLoading({
  132. title: '加载中',
  133. mask: true
  134. });
  135. getList(obj).then(res => {
  136. this.dataList = [...this.dataList, ...res.data.records]
  137. console.log(this.dataList.length)
  138. if (res.data.total <= this.dataList.length) {
  139. this.noMore = true
  140. }
  141. })
  142. .finally(() => {
  143. uni.hideLoading()
  144. this.loading = false
  145. this.triggered = false
  146. });
  147. },
  148. goBack() {
  149. uni.navigateBack({
  150. delta: 1,
  151. });
  152. }
  153. }
  154. }
  155. </script>
  156. <style lang="scss" scoped>
  157. .scroll-view {
  158. height: 100%;
  159. }
  160. .loading,
  161. .no-more {
  162. text-align: center;
  163. padding: 20px;
  164. color: #999;
  165. }
  166. .uni-lastmsg {
  167. width: 80rpx;
  168. white-space: nowrap;
  169. overflow: hidden;
  170. text-overflow: ellipsis;
  171. display: block;
  172. /* 需明确设置display */
  173. }
  174. .uni-lastmsg2 {
  175. width: 140rpx;
  176. white-space: nowrap;
  177. overflow: hidden;
  178. text-overflow: ellipsis;
  179. display: block;
  180. /* 需明确设置display */
  181. }
  182. .nav-right {
  183. width: 37rpx;
  184. height: 42rpx;
  185. }
  186. .list {
  187. width: 100%;
  188. .tab-bar-item {
  189. background-color: #fff;
  190. margin-top: 30rpx;
  191. padding: 0rpx 62rpx;
  192. font-size: 28rpx;
  193. line-height: 32rpx;
  194. color: #5F5F5F;
  195. font-weight: 400;
  196. .list-item {
  197. display: flex;
  198. justify-content: space-between;
  199. align-items: center;
  200. width: 100%;
  201. height: 100rpx;
  202. border-bottom: 2px solid #F6F6F6;
  203. }
  204. .list-item-end {
  205. display: flex;
  206. justify-content: space-between;
  207. align-items: center;
  208. width: 100%;
  209. height: 100rpx;
  210. }
  211. }
  212. }
  213. </style>