選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

deviceInfo.vue 15KB

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