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.7KB

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