You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

car-manage.vue 8.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  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. // //选择图片
  167. // const chooseImage = (type: number) => {
  168. // uni.chooseImage({
  169. // count: 1,
  170. // sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  171. // //sourceType: ['album','camera'],
  172. // success: function(res) {
  173. // console.log(res.tempFilePaths);
  174. // if (type === 1) {
  175. // state.headstockImg = res.tempFilePaths[0];
  176. // } else {
  177. // state.installImg = res.tempFilePaths[0];
  178. // }
  179. // }
  180. // });
  181. // }
  182. // //下一步
  183. // const saveHandle = () => {
  184. // if (!state.headstockImg || !state.installImg) {
  185. // msg('请按照要求上传图片!');
  186. // return;
  187. // }
  188. // msg('保存成功')
  189. // }
  190. </script>
  191. <style>
  192. page {
  193. background: #F3F3F3;
  194. }
  195. </style>
  196. <style lang="scss" scoped>
  197. .main {
  198. overflow: hidden;
  199. .createbox {
  200. justify-content: flex-end;
  201. display: flex;
  202. padding: 0rpx 30rpx;
  203. margin: 20rpx 0;
  204. .createBtn {
  205. padding: 6rpx 27rpx;
  206. border: 1rpx solid #0A8F8A;
  207. border-radius: 10rpx;
  208. font-size: 30rpx;
  209. background: #D9F8F1;
  210. }
  211. }
  212. .listbox {
  213. overflow: auto;
  214. height: calc(100vh - 90rpx);
  215. .tips {
  216. text-align: center;
  217. font-size: 28rpx;
  218. margin-top: 30rpx;
  219. }
  220. .item-row {
  221. display: flex;
  222. justify-content: space-between;
  223. margin-top: 30rpx;
  224. background: white;
  225. padding: 30rpx;
  226. border-radius: 20rpx;
  227. box-shadow: 0rpx 4rpx 13rpx 3rpx rgba(223, 223, 223, 0.8);
  228. margin: 30rpx;
  229. .item-left {
  230. display: flex;
  231. // flex-direction: column;
  232. justify-content: center;
  233. image {
  234. width: 190rpx;
  235. height: 110rpx;
  236. }
  237. .content {
  238. display: flex;
  239. flex-direction: column;
  240. margin-left: 30rpx;
  241. .title {
  242. font-size: 34rpx;
  243. color: #333;
  244. font-weight: bold;
  245. }
  246. .desc {
  247. font-size: 24rpx;
  248. color: #999;
  249. margin: 10rpx 0;
  250. }
  251. }
  252. .flag {
  253. width: 110rpx;
  254. height: 45rpx;
  255. line-height: 42rpx;
  256. color: #0A8F8A;
  257. margin-top: 16rpx;
  258. border-radius: 6rpx;
  259. text-align: center;
  260. font-size: 20rpx;
  261. background: #D9F8F1;
  262. }
  263. }
  264. .item-right {
  265. width: 295rpx;
  266. // height: 188rpx;
  267. position: relative;
  268. image {
  269. position: relative;
  270. z-index: 10;
  271. width: 100%;
  272. height: 188rpx;
  273. }
  274. // &::before {
  275. // content: '';
  276. // position: absolute;
  277. // width: 22rpx;
  278. // height: 22rpx;
  279. // border: 4rpx solid #21BEB1;
  280. // border-bottom: none;
  281. // border-right: none;
  282. // z-index: 0;
  283. // left: -4rpx;
  284. // top: -4rpx;
  285. // }
  286. // &::after {
  287. // content: '';
  288. // position: absolute;
  289. // width: 22rpx;
  290. // height: 22rpx;
  291. // border: 4rpx solid #21BEB1;
  292. // border-top: none;
  293. // border-right: none;
  294. // z-index: 0;
  295. // left: -4rpx;
  296. // bottom: -4rpx;
  297. // }
  298. .flag {
  299. width: 110rpx;
  300. height: 45rpx;
  301. line-height: 42rpx;
  302. color: #0A8F8A;
  303. margin-top: 16rpx;
  304. border-radius: 6rpx;
  305. text-align: center;
  306. font-size: 20rpx;
  307. background: #D9F8F1;
  308. position: relative;
  309. right: -180rpx;
  310. }
  311. .title {
  312. text-align: right;
  313. margin: 20rpx 0;
  314. font-size: 28rpx;
  315. }
  316. .btns {
  317. display: flex;
  318. justify-content: space-around;
  319. align-items: center;
  320. margin-top: 20rpx;
  321. .edit {
  322. padding: 6rpx 27rpx;
  323. border: 1rpx solid #0A8F8A;
  324. border-radius: 30rpx;
  325. font-size: 30rpx;
  326. color: #0A8F8A;
  327. }
  328. .del {
  329. padding: 6rpx 27rpx;
  330. border: 1rpx solid red;
  331. border-radius: 30rpx;
  332. font-size: 30rpx;
  333. color: red;
  334. }
  335. }
  336. }
  337. .empty-node {
  338. position: absolute;
  339. z-index: 0;
  340. width: 100%;
  341. height: 100%;
  342. &::before {
  343. content: '';
  344. position: absolute;
  345. width: 22rpx;
  346. height: 22rpx;
  347. border: 4rpx solid #21BEB1;
  348. border-left: none;
  349. border-bottom: none;
  350. z-index: 0;
  351. right: -4rpx;
  352. top: -4rpx;
  353. }
  354. &::after {
  355. content: '';
  356. position: absolute;
  357. width: 22rpx;
  358. height: 22rpx;
  359. border: 4rpx solid #21BEB1;
  360. border-top: none;
  361. border-left: none;
  362. z-index: 0;
  363. right: -4rpx;
  364. bottom: -4rpx;
  365. }
  366. }
  367. }
  368. }
  369. .hint {
  370. display: flex;
  371. flex-direction: row;
  372. justify-content: center;
  373. font-size: 26rpx;
  374. color: #666666;
  375. padding: 0px 30rpx;
  376. margin-top: 60rpx;
  377. .icon {
  378. width: 36rpx;
  379. height: 36rpx;
  380. margin-right: 10rpx;
  381. }
  382. view {
  383. width: calc(100% - 36rpx);
  384. }
  385. }
  386. .btn {
  387. margin: 470rpx 40rpx 30rpx;
  388. }
  389. }
  390. </style>