index.vue 6.7 KB

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