Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

car-manage.vue 8.5KB

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