Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

deviceInfo.vue 15KB

il y a 2 ans
il y a 1 an
il y a 2 ans
il y a 1 an
il y a 2 ans
il y a 1 an
il y a 2 ans
il y a 1 an
il y a 2 ans
il y a 1 an
il y a 2 ans
il y a 1 an
il y a 2 ans
il y a 1 an
il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 1 an
il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 1 an
il y a 1 an
il y a 1 an
il y a 2 ans
il y a 2 ans
il y a 1 an
il y a 1 an
il y a 1 an
il y a 2 ans
il y a 1 an
il y a 1 an
il y a 1 an
il y a 1 an
il y a 1 an
il y a 2 ans
il y a 2 ans
il y a 1 an
il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 1 an
il y a 2 ans
il y a 1 an
il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 1 an
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517
  1. <template>
  2. <view class="wrapper">
  3. <view class="info-card">
  4. <view class="title">卡信息</view>
  5. <view class="cell">
  6. <view class="cell-left">卡号</view>
  7. <view class="cell-right">{{ card.cardNo }}</view>
  8. </view>
  9. <view class="cell">
  10. <view class="cell-left">用户姓名</view>
  11. <view class="cell-right">{{ card.userName }}</view>
  12. </view>
  13. <view class="cell">
  14. <view class="cell-left">身份证号</view>
  15. <view class="cell-right">{{ card.idNum }}</view>
  16. </view>
  17. <view class="cell">
  18. <view class="cell-left">车辆类型</view>
  19. <view class="cell-right">{{ card.type }}</view>
  20. </view>
  21. <!-- <view class="cell">
  22. <view class="cell-left">车辆用户类型</view>
  23. <view class="cell-right">{{ card.v_userType }}</view>
  24. </view> -->
  25. <view class="cell">
  26. <view class="cell-left">车牌号</view>
  27. <view class="cell-right">{{ card.vehiclePlate }}</view>
  28. </view>
  29. <view class="cell">
  30. <view class="cell-left">车牌颜色</view>
  31. <view class="cell-right">{{ card.color }}</view>
  32. </view>
  33. <view class="cell">
  34. <view class="cell-left">启用时间</view>
  35. <view class="cell-right">{{ card.startTime }}</view>
  36. </view>
  37. <view class="cell">
  38. <view class="cell-left">结束时间</view>
  39. <view class="cell-right">{{ card.endTime }}</view>
  40. </view>
  41. <view class="cell">
  42. <view class="cell-left">卡签绑定</view>
  43. <view class="cell-right">{{ card.favourable }}</view>
  44. </view>
  45. <view class="cell">
  46. <view class="cell-left">校验值</view>
  47. <view class="cell-right">{{ card.money }}</view>
  48. </view>
  49. <view class="cell">
  50. <view class="cell-left">版本号</view>
  51. <view class="cell-right">{{ card.version }}</view>
  52. </view>
  53. <view class="cell">
  54. <view class="cell-left">卡状态</view>
  55. <view class="cell-right">{{getCodeName('CARD_STATE_TYPE',state.cardStatus)}}</view>
  56. </view>
  57. <view class="cell">
  58. <view class="cell-left">卡类型</view>
  59. <view class="cell-right">{{state.cardTypeName}}</view>
  60. </view>
  61. </view>
  62. <view class="info-card">
  63. <view class="title">OBU信息</view>
  64. <view class="cell">
  65. <view class="cell-left">序列号</view>
  66. <view class="cell-right">{{ obu.num }}</view>
  67. </view>
  68. <view class="cell">
  69. <view class="cell-left">车辆类型</view>
  70. <view class="cell-right">{{ obu.type }}</view>
  71. </view>
  72. <view class="cell">
  73. <view class="cell-left">车辆用户类型</view>
  74. <view class="cell-right">{{ obu.userType }}</view>
  75. </view>
  76. <view class="cell">
  77. <view class="cell-left">车牌号</view>
  78. <view class="cell-right">{{ obu.vehiclePlate }}</view>
  79. </view>
  80. <view class="cell">
  81. <view class="cell-left">车牌颜色</view>
  82. <view class="cell-right">{{ obu.vehiclePlateColor }}</view>
  83. </view>
  84. <view class="cell">
  85. <view class="cell-left">核定载人数</view>
  86. <view class="cell-right">{{ obu.approvedCount }}</view>
  87. </view>
  88. <view class="cell">
  89. <view class="cell-left">车辆识别代号</view>
  90. <view class="cell-right">{{ obu.vin }}</view>
  91. </view>
  92. <view class="cell">
  93. <view class="cell-left">车牌发动机号</view>
  94. <view class="cell-right">{{ obu.engineNum }}</view>
  95. </view>
  96. <view class="cell">
  97. <view class="cell-left">车轴数</view>
  98. <view class="cell-right">{{ obu.axleCount }}</view>
  99. </view>
  100. <view class="cell">
  101. <view class="cell-left">车轮数</view>
  102. <view class="cell-right">{{ obu.wheelCount }}</view>
  103. </view>
  104. <view class="cell">
  105. <view class="cell-left">轴距</view>
  106. <view class="cell-right">{{ obu.axleDistance }}</view>
  107. </view>
  108. <view class="cell">
  109. <view class="cell-left">外廓尺寸</view>
  110. <view class="cell-right">{{ obu.outsideDimensions }}mm</view>
  111. </view>
  112. <view class="cell">
  113. <view class="cell-left">启用时间</view>
  114. <view class="cell-right">{{ obu.startTime }}</view>
  115. </view>
  116. <view class="cell">
  117. <view class="cell-left">结束时间</view>
  118. <view class="cell-right">{{ obu.endTime }}</view>
  119. </view>
  120. <view class="cell">
  121. <view class="cell-left">是否激活</view>
  122. <view class="cell-right">{{ obu.isJH }}</view>
  123. </view>
  124. <view class="cell">
  125. <view class="cell-left">版本号</view>
  126. <view class="cell-right">{{ obu.version }}</view>
  127. </view>
  128. <view class="cell">
  129. <view class="cell-left">签状态</view>
  130. <view class="cell-right">{{getCodeName('OBU_STATE_TYPE',state.obuStatus)}}</view>
  131. </view>
  132. </view>
  133. <view class="btn" @click="back">返回订单列表</view>
  134. </view>
  135. </template>
  136. <script setup>
  137. import {
  138. getCodeName
  139. } from "@/datas/queryKey.js";
  140. import {
  141. reactive
  142. } from "vue";
  143. import {
  144. onLoad,
  145. onUnload
  146. } from "@dcloudio/uni-app";
  147. import {
  148. request
  149. } from "@/utils/network/request";
  150. import {
  151. obuDecrypt,
  152. orderDetail,
  153. cardList,
  154. searchObuInfo
  155. } from "@/utils/network/api";
  156. import {
  157. stringToJson
  158. } from "@/utils/network/encryption";
  159. import {
  160. HexToStrig,
  161. hexStringToByteArray,
  162. HexToInt
  163. } from "@/utils/util/fileData.js";
  164. import {
  165. getVehicleType
  166. } from "@/datas/vehicleType.js"
  167. import {
  168. getVehiclePlateColor
  169. } from "@/datas/vehiclePlateColor.js"
  170. const cmd = require("../../../static/etcUtil/cmdConfig.js");
  171. const tools = require("../../../static/etcUtil/tools.js");
  172. const datas = require("../../../static/etcUtil/datas.js");
  173. const bluetoothUtil = require("../../../static/etcUtil/index.js");
  174. const card = reactive({
  175. cardNo: "",
  176. startTime: "",
  177. endTime: "",
  178. userName: "",
  179. idNum: "",
  180. vehiclePlate: "",
  181. vehiclePlateColor: "",
  182. color: "",
  183. version: "",
  184. type: "",
  185. favourable: "",
  186. money: "",
  187. v_userType: "",
  188. })
  189. const obu = reactive({
  190. num: "",
  191. startTime: "",
  192. endTime: "",
  193. version: "",
  194. approvedCount: "",
  195. axleCount: "",
  196. axleDistance: "",
  197. engineNum: "",
  198. type: "",
  199. userType: "",
  200. vehiclePlate: "",
  201. vehiclePlateColor: "",
  202. vin: "",
  203. wheelCount: "",
  204. isJH: "",
  205. outsideDimensions: "",
  206. })
  207. const state = reactive({
  208. vehicleId: "",
  209. obuStatus: "",
  210. cardStatus: "",
  211. cardTypeName: ""
  212. })
  213. onLoad((option) => {
  214. getCardId()
  215. })
  216. /**
  217. * 获取卡号
  218. */
  219. const getCardId = () => {
  220. //执行0015文件
  221. tools.showLoadingAlert("执行指令");
  222. let cmdArr = [cmd.HOME_DIRECTORY, cmd.APPLICATION_DIRECTORY, cmd.CMD_READBINARY, cmd.CMD_GETBALANCE];
  223. console.log(cmdArr);
  224. console.log(bluetoothUtil);
  225. bluetoothUtil.transCmd(cmdArr, '10', function(res) { //10:写卡 20:写OBU
  226. let str = res[2].substring(res[2].length - 4, res[2].length); //判断是否为9000
  227. let str3 = res[3].substring(res[3].length - 4, res[3].length); //判断是否为9000
  228. if (str == "9000" || str3 == "9000") {
  229. if (res[2].length > 86 || res[3] >= 12) {
  230. console.log("res[2]", res[2], res[2].substring(18, 19))
  231. card.cardNo = res[2].substring(20, 40);
  232. card.startTime = res[2].substring(40, 48);
  233. card.endTime = res[2].substring(48, 56);
  234. card.version = res[2].substring(18, 19) >= 4 ? "4x" : "2x";
  235. card.money = res[3].substring(0, 8);
  236. card.v_userType = parseInt(res[2].substring(80, 82), 16);
  237. console.log("card.v_userType", card.v_userType)
  238. card.vehiclePlate = HexToStrig(res[2].substring(56, 80));
  239. if (res[2].substring(18, 19) >= 4) {
  240. card.type = getVehicleType(parseInt(res[2].substring(84, 86), 16));
  241. // card.vehiclePlateColor = parseInt(res[2].substring(82, 84), 16);
  242. card.color = getVehiclePlateColor(parseInt(res[2].substring(82, 84), 16))
  243. } else {
  244. card.type = "--";
  245. // card.vehiclePlateColor = parseInt(res[2].substring(82, 84), 16);
  246. card.color = getVehiclePlateColor(parseInt(res[2].substring(82, 84), 16))
  247. }
  248. state.vehicleId = card.vehiclePlate + "_" + parseInt(res[2].substring(82, 84), 16)
  249. console.log("card.color===========", card.vehiclePlate, parseInt(res[2].substring(82, 84),
  250. 16))
  251. // 读卡信息
  252. getCardList()
  253. //执行0016文件
  254. let arr = [cmd.HOME_DIRECTORY, cmd.PERSONAL_INFORMATION]
  255. bluetoothUtil.transCmd(arr, '10', function(res) {
  256. let str2 = res[1].substring(res[1].length - 4, res[1].length);
  257. if (str2 == "9000") {
  258. if (res[1].length > 108) {
  259. card.userName = HexToStrig(res[1].substring(4, 44)); //姓名
  260. card.idNum = HexToStrig(res[1].substring(44, 108)); //身份证号码
  261. //获取是否有优惠
  262. let cmdArr3 = [cmd.HOME_DIRECTORY, cmd.APPLICATION_DIRECTORY, cmd
  263. .CMD_00B08E0000
  264. ];
  265. bluetoothUtil.transCmd(cmdArr3, '10', function(res) {
  266. let str3 = res[2].substring(res[2].length - 4, res[2]
  267. .length);
  268. if (str3 == "9000") {
  269. if (res[2].length > 131) {
  270. let _str = parseInt(res[2].substring(129, 130),
  271. 16);
  272. switch (_str) {
  273. case 0:
  274. card.favourable = "否";
  275. break;
  276. case 1:
  277. card.favourable = "是";
  278. break;
  279. default:
  280. card.favourable = '未知' + "_" + _str;
  281. break;
  282. }
  283. //回调读取OBU指令
  284. getObuId()
  285. tools.hideLoadingAlert();
  286. } else {
  287. alertF("CMD_00B08E0000指令长度不符" + res[2]);
  288. }
  289. return;
  290. }
  291. alertF(cmd.PERSONAL_INFORMATION + "_" + str);
  292. })
  293. } else {
  294. alertF("PERSONAL_INFORMATION指令长度不符" + res[1]);
  295. }
  296. return;
  297. }
  298. alertF("PERSONAL_INFORMATION指令长度不符" + res[1]);
  299. })
  300. } else {
  301. alertF("CMD_READBINARY指令长度不符" + res[2]);
  302. }
  303. return;
  304. }
  305. alertF("CMD_READBINARY指令长度不符" + res[2]);
  306. })
  307. };
  308. /**
  309. * 获取OBU号
  310. */
  311. const getObuId = () => {
  312. tools.showLoadingAlert("执行指令");
  313. let cmdArr = [cmd.HOME_DIRECTORY, cmd.OBU_SYSTEM_FILE];
  314. bluetoothUtil.transCmd(cmdArr, '20', function(res) {
  315. let str = res[1].substring(res[1].length - 4, res[1].length);
  316. if (str == "9000") {
  317. if (res[1].length > 52) {
  318. obu.num = res[1].substring(20, 36);
  319. obu.startTime = res[1].substring(36, 44);
  320. obu.endTime = res[1].substring(44, 52);
  321. obu.version = res[1].substring(18, 19) >= 4 ? "4x" : "2x";
  322. obu.isJH = res[1].substring(53, 54) == "1" ? "是" : res[1].substring(53, 54) == "0" ?
  323. "否" : "其他:" + res[1].substring(53, 54);
  324. let rand = datas.generateMixed(16);
  325. let arr = [cmd.OBU_DF01, cmd.OBU_00B400000A + rand + cmd.OBU_4F00];
  326. bluetoothUtil.transCmd(arr, '20', function(res) {
  327. console.log(res);
  328. let str2 = res[1].substring(res[1].length - 4, res[1].length);
  329. if (str2 == "9000") {
  330. console.log("===========", obu.num, res[1].substring(0, res[1].length - 4))
  331. decryptObuVehicleInfo(obu.num, res[1].substring(0, res[1].length - 4),
  332. function(res) {
  333. console.log("obu信息", res, res.substring(44, 48), "车轴数", res
  334. .substring(42, 44));
  335. obu.approvedCount = HexToInt(res.substring(48, 54));
  336. obu.axleCount = HexToInt(res.substring(42, 44));
  337. obu.axleDistance = HexToInt(res.substring(44, 48));
  338. obu.engineNum = HexToStrig(res.substring(86, 118));
  339. obu.type = getVehicleType(HexToInt(res.substring(28, 30)));
  340. obu.userType = HexToInt(res.substring(30, 32)) == 1 ? "个人用户" :
  341. "单位用户";
  342. obu.vehiclePlate = HexToStrig(res.substring(0, 24), 2);
  343. //获取车牌颜色
  344. obu.vehiclePlateColor = getVehiclePlateColor(HexToInt(res
  345. .substring(24, 28)));
  346. obu.vin = HexToStrig(res.substring(54, 86));
  347. obu.wheelCount = HexToInt(res.substring(40, 42));
  348. obu.outsideDimensions = HexToInt(res.substring(32, 36)) + "x" +
  349. HexToInt(res.substring(36, 38)) + "x" + HexToInt(res
  350. .substring(38, 40))
  351. getObuList();
  352. tools.hideLoadingAlert();
  353. //提交设备信息
  354. // that.submitDeviceInfo();
  355. });
  356. //断开蓝牙
  357. bluetoothUtil.disconnectDevice();
  358. tools.showToastAlert("蓝牙已断开");
  359. console.log('蓝牙已断开=========')
  360. return;
  361. }
  362. alertF("OBU_00B400000A+rand+OBU_4F00指令长度不符" + res[1]);
  363. })
  364. } else {
  365. alertF("OBU_SYSTEM_FILE指令长度不符" + res[1]);
  366. }
  367. return;
  368. }
  369. alertF("OBU_SYSTEM_FILE指令长度不符" + res[1]);
  370. })
  371. };
  372. /**
  373. * 解密OBU车辆信息
  374. */
  375. const decryptObuVehicleInfo = (num, data, func) => {
  376. const options = {
  377. type: 2,
  378. data: {
  379. obuSerailNo: num,
  380. fileData: data
  381. },
  382. method: "POST",
  383. showLoading: true,
  384. };
  385. request(obuDecrypt, options).then((res) => {
  386. const data = stringToJson(res.bizContent)
  387. const FileData = data.data.FileData
  388. func(FileData)
  389. });
  390. };
  391. //返回按钮
  392. const back = () => {
  393. uni.$emit("refreshOrder");
  394. uni.switchTab({
  395. url: "/pages/order/order"
  396. })
  397. }
  398. //提示对话框
  399. const alertF = (msg) => {
  400. //隐藏加载框
  401. tools.hideLoadingAlert();
  402. //提示对话框
  403. tools.showModalAlert(msg);
  404. }
  405. const getCardList = () => {
  406. var data = {
  407. vehicleId: state.vehicleId
  408. };
  409. const options = {
  410. type: 2,
  411. data: data,
  412. method: "POST",
  413. showLoading: true,
  414. };
  415. request(cardList, options).then((res) => {
  416. let result = stringToJson(res.bizContent);
  417. state.cardStatus = result.data[0].cardStatus
  418. if (result.data[0].cardType == 1 && result.data[0].debitType == 1) {
  419. state.cardTypeName = "预存卡"
  420. } else if (result.data[0].cardType == 2) {
  421. state.cardTypeName = "储值卡"
  422. } else {
  423. state.cardTypeName = "记账卡"
  424. }
  425. console.log("152", result)
  426. })
  427. }
  428. const getObuList = () => {
  429. var data = {
  430. obuId: obu.num
  431. };
  432. const options = {
  433. type: 2,
  434. data: data,
  435. method: "POST",
  436. showLoading: true,
  437. };
  438. request(searchObuInfo, options).then((res) => {
  439. let result = stringToJson(res.bizContent);
  440. state.obuStatus = result.data[0].obuStatus
  441. console.log("153", result)
  442. })
  443. }
  444. </script>
  445. <style scoped>
  446. .wrapper {
  447. padding-bottom: 50rpx;
  448. }
  449. .info-card {
  450. margin: 30rpx;
  451. border-radius: 16rpx;
  452. padding-bottom: 40rpx;
  453. box-shadow: 0rpx 6rpx 25rpx 0rpx rgba(0, 0, 0, 0.3);
  454. }
  455. .info-card .title {
  456. padding: 30rpx 0;
  457. font-size: 36rpx;
  458. text-align: center;
  459. color: #13E7C1;
  460. }
  461. .info-card .cell {
  462. display: flex;
  463. flex-direction: row;
  464. padding: 15rpx 40rpx;
  465. font-size: 30rpx;
  466. }
  467. .cell-left {
  468. flex: 1;
  469. text-align: left;
  470. color: #666;
  471. }
  472. .cell-right {
  473. margin-left: 30rpx;
  474. text-align: right;
  475. color: #333;
  476. overflow: hidden;
  477. }
  478. .btn {
  479. background: linear-gradient(to right, #13E7C1, #43A1E0);
  480. opacity: 1;
  481. border-radius: 100rpx;
  482. color: #fff;
  483. font-size: 30rpx;
  484. height: 80rpx;
  485. line-height: 80rpx;
  486. box-shadow: 0rpx 4rpx 11rpx 1rpx rgba(223, 223, 223, 0.5);
  487. width: 670rpx;
  488. margin: 40rpx;
  489. text-align: center;
  490. }
  491. </style>