Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

car-manage.vue 8.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  1. <template>
  2. <view class="main" :style="{height: height+'px'}">
  3. <view class="createbox">
  4. <view class="createBtn" @click="toPage">
  5. 添加
  6. </view>
  7. </view>
  8. <view class="listbox">
  9. <view class="item-row" v-for="(item,i) in state.listArr" :key="i">
  10. <view class="item-left">
  11. <image :src="`${$imgUrl}/che.png`" mode=""></image>
  12. <view class="content">
  13. <view class="title">车牌号</view>
  14. <view class="desc">{{item.vehiclePlate}}</view>
  15. </view>
  16. </view>
  17. <view class="item-right">
  18. <view class="flag"><text>{{item.status}}</text> </view>
  19. <!-- <view class="title">
  20. 车牌号:{{item.vehiclePlate}}
  21. </view> -->
  22. <view class="btns" v-if="item.status=='未使用'">
  23. <view class="edit" @click="edit(item)">编辑</view>
  24. <view class="del" @click="del(item.vehicleId)">删除</view>
  25. </view>
  26. </view>
  27. </view>
  28. <!-- 暂无数据 -->
  29. <view class="tips">
  30. ~暂无数据了,请添加!~
  31. </view>
  32. </view>
  33. <!-- <view class="item-row">
  34. <view class="item-left">
  35. <view class="title">ETC卡号</view>
  36. <view class="desc">520111111111111111</view>
  37. <view class="title">OBU序列号</view>
  38. <view class="desc">520111111111111111</view>
  39. </view>
  40. <view class="item-right">
  41. <view class="flag"><text>未使用</text> </view>
  42. <view class="title">
  43. 车牌号:贵Z111111
  44. </view>
  45. <view class="btns">
  46. <view class="edit">编辑</view>
  47. <view class="del">删除</view>
  48. </view>
  49. </view>
  50. </view> -->
  51. <!-- <view class="item-row">
  52. <view class="item-left">
  53. <view class="title">行驶证副面</view>
  54. <view class="desc">补传行驶证副面</view>
  55. <view class="flag"><text>拍摄示例</text> </view>
  56. </view>
  57. <view class="item-right">
  58. <view class="empty-node"></view>
  59. <image :src="state.installImg ?state.installImg: defInstallImg"></image>
  60. </view>
  61. </view> -->
  62. <!-- <view class="btn">
  63. <submit-button @submit="saveHandle" title="保存"></submit-button>
  64. </view> -->
  65. </view>
  66. </template>
  67. <script lang="ts" setup>
  68. import {
  69. reactive
  70. } from "vue";
  71. import {
  72. msg,
  73. navTo
  74. } from '@/utils/utils';
  75. import {
  76. fileURL
  77. } from "@/datas/fileURL.js";
  78. import {
  79. getItem
  80. } from "@/utils/storage.ts"
  81. import {
  82. selectCarInfo,
  83. delCarInfo
  84. } from "@/utils/network/api.js";
  85. import {
  86. request
  87. } from "@/utils/network/request.js";
  88. import {
  89. stringToJson
  90. } from "@/utils/network/encryption";
  91. import {
  92. onLoad,
  93. onShow
  94. } from "@dcloudio/uni-app";
  95. const height = uni.getSystemInfoSync().windowHeight
  96. const defHeadstockImg = `${fileURL}image/applyCard/car-zhu.png`;
  97. const defInstallImg = `${fileURL}image/applyCard/car-fu.png`;
  98. const toPage = () => {
  99. navTo('/subpackage/personal-center/setting/car-information/car-create')
  100. }
  101. const data = reactive({
  102. openId: getItem('openId'),
  103. vehicleId: ''
  104. })
  105. const state = reactive({
  106. listArr: []
  107. })
  108. // 获取列表数据
  109. const getDataList = () => {
  110. const options = {
  111. type: 2,
  112. data: data,
  113. method: "POST",
  114. showLoading: true,
  115. };
  116. request(selectCarInfo, options).then((res) => {
  117. const data = stringToJson(res.bizContent);
  118. console.log(data)
  119. state.listArr = data.vehicleManages
  120. });
  121. }
  122. // 删除
  123. const del = (id) => {
  124. uni.showModal({
  125. title: '提示',
  126. content: '是否删除该条车辆信息',
  127. success: function (res) {
  128. if (res.confirm) {
  129. console.log('用户点击确定');
  130. let data = {
  131. vehicleId: id,
  132. openId: getItem('openId')
  133. }
  134. const options = {
  135. type: 2,
  136. data: data,
  137. method: "POST",
  138. showLoading: true,
  139. };
  140. request(delCarInfo, options).then((res) => {
  141. const data = stringToJson(res.bizContent);
  142. console.log(data)
  143. state.listArr = data.vehicleManages
  144. if (data.info == '成功.') {
  145. uni.showToast({
  146. title: "删除成功",
  147. icon: "none"
  148. })
  149. getDataList()
  150. }
  151. });
  152. } else if (res.cancel) {
  153. console.log('用户点击取消');
  154. }
  155. }
  156. });
  157. }
  158. // 编辑
  159. const edit = (item) => {
  160. let data = JSON.stringify(item)
  161. navTo(`/subpackage/personal-center/setting/car-information/car-change?data=${data}`)
  162. }
  163. onShow(() => {
  164. getDataList()
  165. })
  166. </script>
  167. <style>
  168. page {
  169. background: #F3F3F3;
  170. }
  171. </style>
  172. <style lang="scss" scoped>
  173. .main {
  174. overflow: hidden;
  175. .createbox {
  176. justify-content: flex-end;
  177. display: flex;
  178. padding: 0rpx 30rpx;
  179. margin: 20rpx 0;
  180. .createBtn {
  181. padding: 6rpx 27rpx;
  182. border: 1rpx solid #0A8F8A;
  183. border-radius: 10rpx;
  184. font-size: 30rpx;
  185. background: #D9F8F1;
  186. }
  187. }
  188. .listbox {
  189. overflow: auto;
  190. height: calc(100vh - 90rpx);
  191. .tips {
  192. text-align: center;
  193. font-size: 28rpx;
  194. margin-top: 30rpx;
  195. }
  196. .item-row {
  197. display: flex;
  198. justify-content: space-between;
  199. margin-top: 30rpx;
  200. background: white;
  201. padding: 30rpx;
  202. border-radius: 20rpx;
  203. box-shadow: 0rpx 4rpx 13rpx 3rpx rgba(223, 223, 223, 0.8);
  204. margin: 30rpx;
  205. .item-left {
  206. display: flex;
  207. // flex-direction: column;
  208. justify-content: center;
  209. image {
  210. width: 190rpx;
  211. height: 110rpx;
  212. }
  213. .content {
  214. display: flex;
  215. flex-direction: column;
  216. margin-left: 30rpx;
  217. .title {
  218. font-size: 34rpx;
  219. color: #333;
  220. font-weight: bold;
  221. }
  222. .desc {
  223. font-size: 24rpx;
  224. color: #999;
  225. margin: 10rpx 0;
  226. }
  227. }
  228. .flag {
  229. width: 110rpx;
  230. height: 45rpx;
  231. line-height: 42rpx;
  232. color: #0A8F8A;
  233. margin-top: 16rpx;
  234. border-radius: 6rpx;
  235. text-align: center;
  236. font-size: 20rpx;
  237. background: #D9F8F1;
  238. }
  239. }
  240. .item-right {
  241. width: 295rpx;
  242. // height: 188rpx;
  243. position: relative;
  244. image {
  245. position: relative;
  246. z-index: 10;
  247. width: 100%;
  248. height: 188rpx;
  249. }
  250. // &::before {
  251. // content: '';
  252. // position: absolute;
  253. // width: 22rpx;
  254. // height: 22rpx;
  255. // border: 4rpx solid #21BEB1;
  256. // border-bottom: none;
  257. // border-right: none;
  258. // z-index: 0;
  259. // left: -4rpx;
  260. // top: -4rpx;
  261. // }
  262. // &::after {
  263. // content: '';
  264. // position: absolute;
  265. // width: 22rpx;
  266. // height: 22rpx;
  267. // border: 4rpx solid #21BEB1;
  268. // border-top: none;
  269. // border-right: none;
  270. // z-index: 0;
  271. // left: -4rpx;
  272. // bottom: -4rpx;
  273. // }
  274. .flag {
  275. width: 110rpx;
  276. height: 45rpx;
  277. line-height: 42rpx;
  278. color: #0A8F8A;
  279. margin-top: 16rpx;
  280. border-radius: 6rpx;
  281. text-align: center;
  282. font-size: 20rpx;
  283. background: #D9F8F1;
  284. position: relative;
  285. right: -180rpx;
  286. }
  287. .title {
  288. text-align: right;
  289. margin: 20rpx 0;
  290. font-size: 28rpx;
  291. }
  292. .btns {
  293. display: flex;
  294. justify-content: space-around;
  295. align-items: center;
  296. margin-top: 20rpx;
  297. .edit {
  298. padding: 6rpx 27rpx;
  299. border: 1rpx solid #0A8F8A;
  300. border-radius: 30rpx;
  301. font-size: 30rpx;
  302. color: #0A8F8A;
  303. }
  304. .del {
  305. padding: 6rpx 27rpx;
  306. border: 1rpx solid red;
  307. border-radius: 30rpx;
  308. font-size: 30rpx;
  309. color: red;
  310. }
  311. }
  312. }
  313. .empty-node {
  314. position: absolute;
  315. z-index: 0;
  316. width: 100%;
  317. height: 100%;
  318. &::before {
  319. content: '';
  320. position: absolute;
  321. width: 22rpx;
  322. height: 22rpx;
  323. border: 4rpx solid #21BEB1;
  324. border-left: none;
  325. border-bottom: none;
  326. z-index: 0;
  327. right: -4rpx;
  328. top: -4rpx;
  329. }
  330. &::after {
  331. content: '';
  332. position: absolute;
  333. width: 22rpx;
  334. height: 22rpx;
  335. border: 4rpx solid #21BEB1;
  336. border-top: none;
  337. border-left: none;
  338. z-index: 0;
  339. right: -4rpx;
  340. bottom: -4rpx;
  341. }
  342. }
  343. }
  344. }
  345. .hint {
  346. display: flex;
  347. flex-direction: row;
  348. justify-content: center;
  349. font-size: 26rpx;
  350. color: #666666;
  351. padding: 0px 30rpx;
  352. margin-top: 60rpx;
  353. .icon {
  354. width: 36rpx;
  355. height: 36rpx;
  356. margin-right: 10rpx;
  357. }
  358. view {
  359. width: calc(100% - 36rpx);
  360. }
  361. }
  362. .btn {
  363. margin: 470rpx 40rpx 30rpx;
  364. }
  365. }
  366. </style>