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.

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