index.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. <template>
  2. <view class="container">
  3. <uni-nav-bar title="注册列表" backgroundColor='#03803B' color="#fff" left-icon="left" fixed statusBar
  4. @clickLeft='goBack()' @clickRight="addDetails" rightWidth="150rpx">
  5. <block slot="right">
  6. <view style="font-size: 26rpx;">
  7. +注册轮胎保
  8. </view>
  9. </block>
  10. </uni-nav-bar>
  11. <view style="background-color: #fff;">
  12. <uni-search-bar bgColor="#F6F6F6 " v-model="searchValue" placeholder="请输入轮胎保信息" @confirm="searchChange"
  13. cancelButton="none" @clear="searchChange">
  14. </uni-search-bar>
  15. </view>
  16. <z-paging ref="paging" v-model="dataList" @query="getList" :fixed="false" :auto-show-back-to-top="true"
  17. empty-view-text="暂无数据" :hide-empty-view="false" :auto-show-system-loading="true">
  18. <view class="list" v-for="(item, index) in dataList" :key="index">
  19. <uni-swipe-action style="margin-top: 30rpx;">
  20. <uni-swipe-action-item>
  21. <view class="tab-bar-item" @click="inEdit(item)">
  22. <view class="list-item">
  23. <view style="font-weight: 800;">
  24. {{item.insuranceNo}}
  25. </view>
  26. <view style="color: #B5B4B4;">
  27. {{item.createTime}}
  28. </view>
  29. </view>
  30. <view class="list-item">
  31. <view style="font-weight: 800;color: #03803B;">
  32. {{item.vehicleNumber||'暂无车牌'}}
  33. </view>
  34. <view class="">
  35. 轮胎规格: {{item.tyreSpecs||'-'}}
  36. </view>
  37. </view>
  38. <view class="list-item">
  39. <view class="">
  40. 轮胎:{{item.tireQuantity||0}}条
  41. </view>
  42. <view style="display: flex;align-items: center;color: #03803B;">
  43. <image style="width: 32rpx;height: 32rpx;margin-right: 18rpx;"
  44. src="@/static/images/home/insurance/ap.png" />
  45. <text v-if="item.status==0" style="color:#e6a23c">
  46. 录入
  47. </text>
  48. <text v-if="item.status==1" style="color:#e6a23c">
  49. 在保
  50. </text>
  51. <text v-if="item.status==2" style="color:#409EFF">
  52. 受理中
  53. </text>
  54. <text v-if="item.status==3" style="color:#67c23a">
  55. 已通过
  56. </text>
  57. <text v-if="item.status==4" style="color:#f56c6c">
  58. 已拒绝
  59. </text>
  60. </view>
  61. </view>
  62. <view class="list-item-end">
  63. <view style="color: #B5B4B4;">
  64. 有效截至日期:{{item.insuranceTime||'暂无日期'}}
  65. </view>
  66. </view>
  67. </view>
  68. <template v-slot:right>
  69. <view @click.stop="onClick(item)"
  70. style="width: 120rpx;background-color:#e43d33;display: flex;justify-content: center;align-items: center;color: #fff;">
  71. <text>删除</text>
  72. </view>
  73. </template>
  74. </uni-swipe-action-item>
  75. </uni-swipe-action>
  76. </view>
  77. </z-paging>
  78. </view>
  79. </template>
  80. <script>
  81. import {
  82. getList,
  83. remove
  84. } from '@/api/home/insurance.js'
  85. export default {
  86. data() {
  87. return {
  88. searchValue:null,
  89. dataList: [],
  90. }
  91. },
  92. onLoad() {},
  93. onShow() {
  94. if (uni.getStorageSync('isUpdate')) {
  95. this.$nextTick(() => {
  96. if (this.$refs.paging) {
  97. this.$refs.paging.reload();
  98. }
  99. });
  100. uni.removeStorageSync('isUpdate')
  101. }
  102. },
  103. filters: {
  104. statusMap(value) {
  105. // 状态 0录入,1已提交(在保),2受理中(理赔提交),3已通过(工厂审核通过)
  106. const statusList = ['录入', '在保', '受理中', '已通过']
  107. return statusList[value] || '未知状态'
  108. }
  109. },
  110. methods: {
  111. onClick(row) {
  112. if(row.status!=0){
  113. uni.showToast({
  114. title: '非录入状态不允许删除',
  115. icon: 'none',
  116. duration: 2000
  117. });
  118. return
  119. }
  120. let _this = this
  121. uni.showModal({
  122. title: '提示',
  123. content: '是否确认删除?',
  124. success: function(res) {
  125. if (res.confirm) {
  126. uni.showLoading({
  127. title: '加载中',
  128. mask: true
  129. });
  130. remove(row.id).then(res => {
  131. uni.showToast({
  132. title: '操作成功',
  133. icon: 'none',
  134. duration: 2000
  135. });
  136. _this.$refs.paging.reload();
  137. })
  138. .finally(() => {
  139. uni.hideLoading()
  140. });
  141. }
  142. }
  143. });
  144. },
  145. addDetails() {
  146. uni.navigateTo({
  147. url: '/pages/home/insurance/rules'
  148. });
  149. },
  150. inEdit(row) {
  151. uni.navigateTo({
  152. url: '/pages/home/insurance/details?id=' + row.id,
  153. });
  154. },
  155. searchChange() {
  156. this.$refs.paging.reload()
  157. },
  158. async getList(pageNo, pageSize) {
  159. try {
  160. const obj = {
  161. current: pageNo,
  162. size: pageSize
  163. }
  164. const res = await getList(obj)
  165. this.$refs.paging.complete(res.data.records)
  166. } catch (e) {
  167. this.$refs.paging.complete(false)
  168. uni.showToast({
  169. title: '加载失败',
  170. icon: 'none'
  171. })
  172. }
  173. },
  174. goBack() {
  175. uni.navigateBack({
  176. delta: 1,
  177. });
  178. }
  179. }
  180. }
  181. </script>
  182. <style lang="scss" scoped>
  183. .scroll-view {
  184. flex: 1;
  185. height: 100%;
  186. /* 关键样式:防止内容被裁剪 */
  187. overflow-anchor: none;
  188. }
  189. .container {
  190. height: 100vh;
  191. display: flex;
  192. flex-direction: column;
  193. }
  194. .loading,
  195. .no-more {
  196. text-align: center;
  197. padding: 20px;
  198. color: #999;
  199. }
  200. .uni-lastmsg {
  201. width: 80rpx;
  202. white-space: nowrap;
  203. overflow: hidden;
  204. text-overflow: ellipsis;
  205. display: block;
  206. /* 需明确设置display */
  207. }
  208. .uni-lastmsg2 {
  209. width: 140rpx;
  210. white-space: nowrap;
  211. overflow: hidden;
  212. text-overflow: ellipsis;
  213. display: block;
  214. /* 需明确设置display */
  215. }
  216. .nav-right {
  217. width: 37rpx;
  218. height: 42rpx;
  219. }
  220. .list {
  221. width: 100%;
  222. .tab-bar-item {
  223. background-color: #fff;
  224. padding: 0rpx 62rpx;
  225. font-size: 28rpx;
  226. line-height: 32rpx;
  227. color: #5F5F5F;
  228. font-weight: 400;
  229. .list-item {
  230. display: flex;
  231. justify-content: space-between;
  232. align-items: center;
  233. width: 100%;
  234. height: 100rpx;
  235. border-bottom: 2px solid #F6F6F6;
  236. }
  237. .list-item-end {
  238. display: flex;
  239. justify-content: space-between;
  240. align-items: center;
  241. width: 100%;
  242. height: 100rpx;
  243. }
  244. }
  245. }
  246. </style>