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.

activate.vue 22KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830
  1. <template>
  2. <view class="containers">
  3. <view class="sec_info">
  4. <view class="info_txt">信息确认</view>
  5. <view class="info_plate">
  6. <text>车牌号码</text>
  7. <text>{{ fileDataStrings.vehiclePlate }}</text>
  8. </view>
  9. <view class="info_plate">
  10. <text>车牌颜色</text>
  11. <text>{{ fileDataStrings.vehiclePlateColorStr }}</text>
  12. </view>
  13. <view class="info_plate">
  14. <text>手机号码</text>
  15. <text>{{ fileDataStrings.customerTel }}</text>
  16. </view>
  17. <view class="info_plate" style="border: none" v-if="fileDataStrings.cardId">
  18. <text>卡号</text>
  19. <text>{{ fileDataStrings.cardId }}</text>
  20. </view>
  21. <view class="info_plate" v-if="fileDataStrings.obuId">
  22. <text>OBU号</text>
  23. <text>{{ fileDataStrings.obuId }}</text>
  24. </view>
  25. <view class="info_plate">
  26. <text>收费车型</text>
  27. <text>{{ fileDataStrings.vehicleClassStr }}</text>
  28. </view>
  29. </view>
  30. <view class="up_btn" v-if="state.showBtn">
  31. <button aria-disabled="true" @click="btn" v-if="!state.isSuccess" :class="state.disabled?'button':'hui'">
  32. 点击开始激活
  33. </button>
  34. <button aria-disabled="true" @click="back" v-else>
  35. 点击返回首页
  36. </button>
  37. </view>
  38. </view>
  39. <!-- 激活成功popup -->
  40. <view v-if="state.showPopup" class="mask">
  41. <piaoyi-progress-bar canvasId="progressCanvas4" :progress="state.progressNum"
  42. progressBackgroundColor="#07C160" :showText="true" textColor="#fff" :textSize="28" :height="22"
  43. :isCircular="true" :diameter="300"></piaoyi-progress-bar>
  44. </view>
  45. </template>
  46. <script setup>
  47. import {
  48. reactive,
  49. ref
  50. } from "vue";
  51. import {
  52. formatTime,
  53. formatTime2,
  54. expireDate,
  55. expireDate2,
  56. getFormatDate,
  57. msg,
  58. navTo
  59. } from "@/utils/utils";
  60. import {
  61. onLoad
  62. } from '@dcloudio/uni-app'
  63. import {
  64. getItem
  65. } from "@/utils/storage";
  66. import {requestNew} from "@/utils/network/request.js";
  67. import {
  68. IntegerToHexString,
  69. } from "@/utils/util/fileData.js";
  70. import {
  71. issueApply,issueCallback,orderDetailQuery,errorLogAdd,cardObuQuery,cardObuQueryinLog,obuFileDataDecrypt
  72. } from "@/utils/network/api";
  73. import {
  74. agentId
  75. } from "@/utils/network/difference";
  76. const cmd = require("../../../static/etcUtil/cmdConfig.js");
  77. const tools = require("../../../static/etcUtil/tools.js");
  78. const bluetoothUtil = require("../../../static/etcUtil/index.js");
  79. import activeSuccess from "./components/popup-device-active-success";
  80. const datas = require("../../../static/etcUtil/datas.js");
  81. import {
  82. getVehicleType
  83. } from "@/subpackage/after-sale/js/vehicleType.js"
  84. import {
  85. getVehiclePlateColor
  86. } from "@/datas/vehiclePlateColor";
  87. import {
  88. searchVehicleInfoQuery
  89. } from "@/subpackage/after-sale/js/publicRequest";
  90. import {
  91. decryptCardVehicleInformation
  92. } from "@/datas/publicRequest";
  93. import {
  94. channelId
  95. } from "@/utils/network/difference";
  96. const state = reactive({
  97. orderId: "",
  98. id: "",
  99. cardStatus: "",
  100. obuStatus: "",
  101. isSuccess: false, //是否激活成功
  102. showPopup: false,
  103. transfer: 0, //0 是原来的激活 1 是过户激活
  104. showBtn: true,
  105. disabled: true,
  106. progressNum:0
  107. })
  108. onLoad((option) => {
  109. //读取传入 存储的数据orderInfo
  110. let orderData = getItem("orderInfo");
  111. state.id = orderData.id;
  112. console.log(state);
  113. state.transfer = Number(option.transfer)
  114. //获取订单详情
  115. getOrderDetails(orderData.orderId);
  116. console.log("state.transfer", state.transfer, state.transfer == 0, state.transfer == 1,getItem("orderInfo"))
  117. })
  118. const card = reactive({
  119. cardId: "",
  120. cardNo: "",
  121. startTime: "",
  122. endTime: "",
  123. userName: "",
  124. userNameStr:"",
  125. idNum: "",
  126. idNumStr:"",
  127. vehiclePlate: "",
  128. vehiclePlateColor: "",
  129. color: "",
  130. colorStr:"",
  131. version: "",
  132. type: "",
  133. typeStr:"",
  134. favourable: "",
  135. favourableStr:"",
  136. money: "",
  137. v_userType: ""
  138. });
  139. const obu = reactive({
  140. obuId: "",
  141. num: "",
  142. startTime: "",
  143. endTime: "",
  144. version: "",
  145. approvedCount: "",
  146. axleCount: "",
  147. axleDistance: "",
  148. engineNum: "",
  149. type: "",
  150. typeStr:"",
  151. userType: "",
  152. userTypeStr:"",
  153. vehiclePlate: "",
  154. vehiclePlateColor: "",
  155. vehiclePlateColorStr:"",
  156. vin: "",
  157. wheelCount: "",
  158. isJH: "",
  159. isJHStr: "",
  160. outsideDimensions: "",
  161. loadStatus:""
  162. });
  163. let cmdRandNum = '';
  164. let orderInfo = {};
  165. const fileDataStrings = reactive({
  166. approvedCount: 0, //核载人数
  167. cardId: "", //卡号
  168. obuId: "", //obu号
  169. packageNum: "", //套餐编号
  170. axleCount: 0, //轴数
  171. axleDistance: "", //轴距
  172. engineNum: "", //发动机
  173. vehicleVin: "",
  174. vehicleEngineNum: "",
  175. cardStatus: "",
  176. obuStatus: "",
  177. type: 0, //类型
  178. userType: 0, //用户类型
  179. vehiclePlate: "", //车牌
  180. vehiclePlateColor: 0, //车牌颜色
  181. vehicleDimensions: "",
  182. wheelCount: 0, //车轮数
  183. vehicleIdNo: "", //车牌号
  184. vehiclePlateColorStr: "",
  185. customerTel: "",
  186. customerId: "",
  187. orderId: "",
  188. vehicleClassStr: ""
  189. });
  190. function cmdResult1() {
  191. // tools.showLoadingAlert('正在激活,请等待')
  192. state.progressNum=10
  193. const options = {
  194. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  195. showLoading: false,
  196. data: {
  197. orderId: orderInfo.orderNo,
  198. issueType: state.transfer ? 2 : 1, //1正常激活 2 过户激活
  199. cardId:card.cardId,
  200. obuId:obu.obuId
  201. }, //请求参数
  202. method: "POST", //提交方式(默认POST)
  203. };
  204. console.log("options==", options)
  205. //BDS-二发指令申请
  206. requestNew(issueApply, options)
  207. .then((res) => {
  208. console.log("在线激活 请求");
  209. console.log(res);
  210. const datas =res;
  211. bluetoothUtil.transCmd(datas.cmd.split(','), datas.cmdType == 'CARD' ? '10' : '20', function(res) {
  212. implementCmd(datas.transOrderId, datas.cmd, res.toString(), datas.stepNo)
  213. }, (err) => {
  214. showModals('在线激活异常')
  215. console.log("err",err)
  216. errorLog(datas.cmd,JSON.stringify(err),datas.stepNo)
  217. tools.hideLoadingAlert();
  218. state.showPopup=false
  219. state.disabled = true
  220. });
  221. })
  222. .catch((err) => {
  223. console.log(err);
  224. tools.hideLoadingAlert();
  225. state.showPopup=false
  226. state.disabled = true
  227. });
  228. }
  229. function implementCmd(transOrderId, cmd, cmdResult, stepNo) {
  230. console.log("datas.stepNo1",stepNo)
  231. state.progressNum=Number(stepNo)*10+10
  232. const options = {
  233. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  234. showLoading: false,
  235. data: {
  236. transOrderId, //步骤号
  237. cmd,
  238. cmdResult,
  239. stepNo,
  240. mpOpenId:getItem('mpOpenId')//公众号openid
  241. }, //请求参数
  242. method: "POST", //提交方式(默认POST)
  243. };
  244. console.log("options2222", options)
  245. //BDS-二发指令回传
  246. requestNew(issueCallback, options)
  247. .then((res) => {
  248. console.log("BDS-二发指令回传 ",res);
  249. const datas = res;
  250. console.log("在线激活 请求", datas);
  251. if (datas.stepNo == 100) {
  252. state.disabled = true
  253. tools.hideLoadingAlert();
  254. state.progressNum=100
  255. setTimeout(() => {
  256. state.showPopup=false
  257. },1000)
  258. setTimeout(() => {
  259. msg("激活成功", {
  260. 'icon': 'success',
  261. 'duration': 3000
  262. })
  263. },2000)
  264. setTimeout(() => {
  265. getCardIdCommit()
  266. },5000)
  267. } else {
  268. console.log("datas.stepNo", datas.stepNo)
  269. bluetoothUtil.transCmd(datas.cmd.split(','), datas.cmdType == 'CARD' ? '10' : '20', function(res) {
  270. implementCmd(transOrderId, datas.cmd, res.toString(), datas.stepNo)
  271. }, (err) => {
  272. console.log("err",err)
  273. state.showPopup=false
  274. state.disabled = true
  275. errorLog(datas.cmd,JSON.stringify(err),datas.stepNo)
  276. showModals('在线激活异常')
  277. });
  278. }
  279. })
  280. .catch((err) => {
  281. console.log(err);
  282. tools.hideLoadingAlert();
  283. state.showPopup=false
  284. state.disabled = true
  285. });
  286. }
  287. //开始激活 按钮事件
  288. const btn = () => {
  289. if(!state.disabled){
  290. return;
  291. }
  292. state.disabled = false
  293. state.showPopup=true
  294. console.log('orderInfo参数', orderInfo, state.disabled)
  295. cmdResult1()
  296. };
  297. //获取订单详情
  298. const getOrderDetails = (orderId) => {
  299. console.log('======获取订单信息======')
  300. const options = {
  301. type: 2,
  302. data: {
  303. orderId
  304. },
  305. method: "POST",
  306. showLoading: false,
  307. };
  308. state.disabled = false
  309. requestNew(orderDetailQuery, options).then((res) => {
  310. console.log("orderInfo", res);
  311. orderInfo = res.data;
  312. console.log("orderInfores", res);
  313. if (orderInfo) {
  314. fileDataStrings.userType = orderInfo.userType; //用户类型
  315. fileDataStrings.cardId = orderInfo.cardId;
  316. fileDataStrings.packageNum = orderInfo.packageNum;
  317. fileDataStrings.obuId = orderInfo.obuId;
  318. fileDataStrings.customerTel = orderInfo.customerTel;
  319. fileDataStrings.customerId = orderInfo.customerId;
  320. fileDataStrings.orderId = orderInfo.orderNo;
  321. fileDataStrings.vehiclePlateColorStr = getVehiclePlateColor(orderInfo
  322. .vehiclePlateColor);
  323. fileDataStrings.vehiclePlate = orderInfo.vehiclePlate; //车牌
  324. fileDataStrings.vehicleClassStr = orderInfo.vehicleClassStr;
  325. }
  326. });
  327. getObuId();
  328. };
  329. /**
  330. * 获取OBU号 读OBU
  331. */
  332. const getObuId = () => {
  333. console.log('======获取OBU号======')
  334. let cmdArray = [cmd.HOME_DIRECTORY, cmd.OBU_SYSTEM_FILE, cmd.RANDOM_NUMBER];
  335. bluetoothUtil.transCmd(cmdArray, "20", function(res) {
  336. var status = res[1].substring(res[1].length - 4, res[1].length);
  337. console.log('获取OBU号执行结果' + status, res)
  338. //第一次获取随机数
  339. if (status == "9000") {
  340. state.disabled = true
  341. obu.obuId = res[1].substring(20, 36);
  342. obu.vin = res[1].substring(18, 20);
  343. obu.version = res[1].substring(18, 19) >= 4 ? "4x" : "2x";
  344. cmdRandNum = res[2].substring(0, res[2].length - 4);
  345. getCardId()
  346. } else {
  347. showModals('获取设备信息错误!')
  348. }
  349. }, () => {
  350. showModals('获取设备信息错误')
  351. });
  352. };
  353. function showModals(msg) {
  354. uni.showModal({
  355. title: '提示',
  356. content: msg,
  357. showCancel: false,
  358. success: function(res) {
  359. if (res.confirm) {
  360. uni.navigateBack()
  361. console.log('用户点击确定1');
  362. } else if (res.cancel) {
  363. console.log('用户点击取消1');
  364. }
  365. }
  366. });
  367. }
  368. const back = () => {
  369. uni.switchTab({
  370. url: "/pages/index/index"
  371. });
  372. }
  373. const getCardId = () => {
  374. //执行0015文件
  375. tools.showLoadingAlert("执行指令");
  376. let cmdArr = [cmd.HOME_DIRECTORY, cmd.APPLICATION_DIRECTORY, cmd.CMD_READBINARY, cmd.CMD_GETBALANCE];
  377. console.log(cmdArr);
  378. console.log(bluetoothUtil);
  379. bluetoothUtil.transCmd(cmdArr, '10', function(res) { //10:写卡 20:写OBU
  380. console.log("5201",res)
  381. let str = res[2].substring(res[2].length - 4, res[2].length); //判断是否为9000
  382. let str3 = res[3].substring(res[3].length - 4, res[3].length); //判断是否为9000
  383. if (str == "9000" || str3 == "9000") {
  384. if (res[2].length > 86 || res[3] >= 12) {
  385. card.cardId = res[2].substring(20, 40);
  386. tools.hideLoadingAlert();
  387. state.showBtn = true
  388. } else {
  389. alertF("CMD_READBINARY指令长度不符" + res[2]);
  390. }
  391. return;
  392. }
  393. alertF("CMD_READBINARY指令长度不符" + res[2]);
  394. })
  395. };
  396. const errorLog = (cmd,error,step) => {
  397. console.log('激活异常提交')
  398. const options = {
  399. type: 2,
  400. data: {
  401. cardId:card.cardId,
  402. obuId:obu.obuId,
  403. orderType:"1",
  404. factory:datas.getData("deviceName")+"_"+datas.getData("deviceNameZW"),
  405. orderNo:orderInfo.orderNo,
  406. cmd,
  407. error,
  408. step
  409. },
  410. method: "POST",
  411. showLoading: false,
  412. };
  413. requestNew(errorLogAdd, options).then((res) => {
  414. console.log("错误提交成功", res);
  415. });
  416. };
  417. /**
  418. * 获取卡号
  419. */
  420. const getCardIdCommit = () => {
  421. //执行0015文件
  422. tools.showLoadingAlert("执行指令");
  423. let cmdArr = [cmd.HOME_DIRECTORY, cmd.APPLICATION_DIRECTORY, cmd.CMD_READBINARY, cmd.CMD_GETBALANCE];
  424. console.log(cmdArr);
  425. console.log(bluetoothUtil);
  426. bluetoothUtil.transCmd(cmdArr, '10', function(res) { //10:写卡 20:写OBU
  427. console.log("5201",res)
  428. let str = res[2].substring(res[2].length - 4, res[2].length); //判断是否为9000
  429. let str3 = res[3].substring(res[3].length - 4, res[3].length); //判断是否为9000
  430. if (str == "9000" || str3 == "9000") {
  431. if (res[2].length > 86 || res[3] >= 12) {
  432. console.log("res[2]", res[2].substring(84, 86), getVehiclePlateColor(parseInt(res[2]
  433. .substring(82, 84), 16)), res[2].substring(18, 19))
  434. card.cardNo = res[2].substring(20, 40);
  435. card.startTime = res[2].substring(40, 48);
  436. card.endTime = res[2].substring(48, 56);
  437. card.version = res[2].substring(18, 20);
  438. card.money = res[3].substring(0, 8);
  439. card.v_userType = parseInt(res[2].substring(80, 82), 16);
  440. console.log("card.v_userType", card.v_userType)
  441. decryptCardVehicleInformation(res[2].substring(56, 80), function (res) {
  442. card.vehiclePlate =res;
  443. });
  444. console.log("res[2].substring(18, 19)",res[2].substring(18, 20))
  445. if (res[2].substring(18, 19) >= 4) {
  446. //4x卡
  447. card.type = parseInt(res[2].substring(84, 86), 16);
  448. card.typeStr = getVehicleType(parseInt(res[2].substring(84, 86), 16));
  449. card.color = parseInt(res[2].substring(82, 84), 16)
  450. card.colorStr = getVehiclePlateColor(parseInt(res[2].substring(82, 84), 16))
  451. } else {
  452. //2x卡--获取车牌颜色
  453. card.type = "--";
  454. card.color =parseInt(res[2].substring(82, 84), 16)
  455. card.colorStr = getVehiclePlateColor(parseInt(res[2].substring(82, 84), 16))
  456. card.typeStr = getVehicleType(parseInt(res[2].substring(84, 86), 16));
  457. }
  458. state.vehicleId = card.vehiclePlate + "_" + parseInt(res[2].substring(82, 84), 16)
  459. // 读卡信息
  460. //执行0016文件
  461. let arr = [cmd.HOME_DIRECTORY, cmd.PERSONAL_INFORMATION]
  462. bluetoothUtil.transCmd(arr, '10', function(res) {
  463. let str2 = res[1].substring(res[1].length - 4, res[1].length);
  464. if (str2 == "9000") {
  465. if (res[1].length > 108) {
  466. console.log("res====",res)
  467. decryptCardVehicleInformation(res[1].substring(4, 44), function (res) {
  468. card.userName = res; //姓名
  469. card.userNameStr = card.userName[0] + '*'.repeat(card.userName.length - 1)
  470. });
  471. decryptCardVehicleInformation(res[1].substring(44, 108), function (res) {
  472. card.idNum = res; //身份证号码
  473. card.idNumStr=res.replace(/^\d{14}/,'**************')
  474. });
  475. //获取是否有优惠
  476. let cmdArr3 = [cmd.HOME_DIRECTORY, cmd.APPLICATION_DIRECTORY, cmd
  477. .CMD_00B08E0000
  478. ];
  479. bluetoothUtil.transCmd(cmdArr3, '10', function(res) {
  480. let str3 = res[2].substring(res[2].length - 4, res[2]
  481. .length);
  482. if (str3 == "9000") {
  483. if (res[2].length > 131) {
  484. let _str = parseInt(res[2].substring(129, 130),
  485. 16);
  486. card.favourable=_str
  487. switch (_str) {
  488. case 0:
  489. card.favourableStr = "否";
  490. break;
  491. case 1:
  492. card.favourableStr = "是";
  493. break;
  494. default:
  495. card.favourableStr = '未知' + "_" + _str;
  496. break;
  497. }
  498. //回调读取OBU指令
  499. getObuIdCommit()
  500. tools.hideLoadingAlert();
  501. } else {
  502. alertF("CMD_00B08E0000指令长度不符" + res[2]);
  503. }
  504. return;
  505. }
  506. alertF(cmd.PERSONAL_INFORMATION + "_" + str);
  507. })
  508. } else {
  509. alertF("PERSONAL_INFORMATION指令长度不符" + res[1]);
  510. }
  511. return;
  512. }
  513. alertF("PERSONAL_INFORMATION指令长度不符" + res[1]);
  514. })
  515. } else {
  516. alertF("CMD_READBINARY指令长度不符" + res[2]);
  517. }
  518. return;
  519. }
  520. alertF("CMD_READBINARY指令长度不符" + res[2]);
  521. })
  522. };
  523. /**
  524. * 获取OBU号
  525. */
  526. const getObuIdCommit = () => {
  527. tools.showLoadingAlert("执行指令");
  528. let cmdArr = [cmd.HOME_DIRECTORY, cmd.OBU_SYSTEM_FILE];
  529. bluetoothUtil.transCmd(cmdArr, '20', function(res) {
  530. let str = res[1].substring(res[1].length - 4, res[1].length);
  531. if (str == "9000") {
  532. if (res[1].length > 52) {
  533. obu.num = res[1].substring(20, 36);
  534. obu.startTime = res[1].substring(36, 44);
  535. obu.endTime = res[1].substring(44, 52);
  536. obu.version = res[1].substring(18, 20);
  537. obu.isJH = res[1].substring(53, 54)
  538. obu.isJHStr = res[1].substring(53, 54) == "1" ? "是" : res[1].substring(53, 54) == "0" ?
  539. "否" : "其他:" + res[1].substring(53, 54);
  540. obu.loadStatus=res[1].substring(52, 54)=='01'?'正常':'已拆卸',
  541. console.log("开始执行车辆信息识读");
  542. let rand = res[1].substring(18, 20) >= 50?'40':'00';
  543. var arr = [cmd.OBU_DF01, '00B400000A000000000000000045'+ rand];
  544. bluetoothUtil.transCmd(arr, '20', function(res) {
  545. console.log(res);
  546. console.log("开始执行车辆信息识读成功");
  547. let str2 = res[1].substring(res[1].length - 4, res[1].length);
  548. let obuVersion = res[1].substring(18, 20);
  549. let keyIndex = obuVersion > 50 ? '40' : '00';
  550. let reqType = '00';
  551. let proviceCode = '5201';
  552. if (str2 == "9000") {
  553. console.log("===========", obu.num, res[1].substring(0, res[1].length - 4))
  554. decryptObuVehicleInfo(obu.num, res[1].substring(0, res[1].length - 4),
  555. obuVersion, rand, reqType, proviceCode,
  556. function(res) {
  557. obu.approvedCount = res.approvedCount;
  558. obu.axleCount = res.axleCount;
  559. obu.axleDistance = res.axleDistance;
  560. obu.engineNum = res.engineNumber.replace(/\u0000/g, '');
  561. obu.type = res.collectionType;
  562. obu.typeStr = getVehicleType(res.collectionType);
  563. obu.userType = res.userType;
  564. if(res.userType == 0){
  565. obu.userTypeStr = "普通车" ;
  566. }else if(res.userType == 6){
  567. obu.userTypeStr = "公务车" ;
  568. }
  569. obu.vehiclePlate = res.vehiclePlate.replace(/\u0000/g, '');
  570. //获取车牌颜色
  571. obu.vehiclePlateColor = res.vehiclePlateColor;
  572. obu.vehiclePlateColorStr = getVehiclePlateColor(res.vehiclePlateColor);
  573. obu.vin = res.vin.replace(/\u0000/g, '');
  574. obu.wheelCount = res.wheelsCount;
  575. obu.outsideDimensions = res.carLong + "x" + res.carWidth + "x" + res.carHeight
  576. getObuList();
  577. tools.hideLoadingAlert();
  578. });
  579. //断开蓝牙
  580. bluetoothUtil.disconnectDevice();
  581. tools.showToastAlert("蓝牙已断开");
  582. console.log('蓝牙已断开=========')
  583. return;
  584. }
  585. alertF("OBU_00B400000A+rand+OBU_4F00指令长度不符" + res[1]);
  586. })
  587. } else {
  588. alertF("OBU_SYSTEM_FILE指令长度不符" + res[1]);
  589. }
  590. return;
  591. }
  592. alertF("OBU_SYSTEM_FILE指令长度不符" + res[1]);
  593. })
  594. };
  595. const getObuList = () => {
  596. var data = {
  597. obuId: obu.num,
  598. cardId:card.cardNo,
  599. };
  600. const options = {
  601. type: 2,
  602. data: data,
  603. method: "POST",
  604. showLoading: true,
  605. };
  606. requestNew(cardObuQuery, options).then((res) => {
  607. tools.hideLoadingAlert();
  608. let result = res;
  609. state.obuStatus = result.obuStatus?result.obuStatus:""
  610. state.cardStatus = result.cardStatus
  611. if (result.cardType == 1 && result.debitType == 1) {
  612. state.cardTypeName = "预存卡"
  613. card['cardTypeName']=3
  614. } else if (result.cardType == 2) {
  615. state.cardTypeName = "储值卡"
  616. card['cardTypeName']=2
  617. } else {
  618. state.cardTypeName = "记账卡"
  619. card['cardTypeName']=1
  620. }
  621. // 卡签提交得信息
  622. card['cardStatus']=result.cardStatus
  623. obu['obuStatus']=result.obuStatus?result.obuStatus:""
  624. cardObuMsgUp()
  625. })
  626. }
  627. // 签信息提交日志记录
  628. const cardObuMsgUp = () => {
  629. var data = {
  630. cardLogInfo: card,
  631. obuLogInfo:obu,
  632. type:"active"
  633. };
  634. const options = {
  635. type: 2,
  636. data: data,
  637. method: "POST",
  638. showLoading: true,
  639. };
  640. requestNew(cardObuQueryinLog, options).then((res) => {
  641. tools.hideLoadingAlert();
  642. navTo(`/subpackage/after-sale/activation/result`)
  643. console.log("提交成功")
  644. })
  645. }
  646. /**
  647. * 解密OBU车辆信息
  648. */
  649. const decryptObuVehicleInfo = (num, data,obuVersion, keyIndex, reqType, proviceCode, func) => {
  650. const options = {
  651. type: 2,
  652. data: {
  653. contractSN: num,
  654. cipherData: data,
  655. reqType: reqType,
  656. keyIndex: keyIndex,
  657. proviceCode: proviceCode
  658. },
  659. method: "POST",
  660. showLoading: true,
  661. };
  662. requestNew(obuFileDataDecrypt, options).then((res) => {
  663. console.log("obuFileDataDecrypt",res)
  664. const data =res
  665. func(data)
  666. });
  667. };
  668. //提示对话框
  669. const alertF = (msg) => {
  670. //隐藏加载框
  671. tools.hideLoadingAlert();
  672. //提示对话框
  673. tools.showModalAlert(msg);
  674. }
  675. </script>
  676. <style>
  677. .containers {
  678. height: 100%;
  679. display: flex;
  680. flex-direction: column;
  681. align-items: center;
  682. justify-content: space-between;
  683. box-sizing: border-box;
  684. }
  685. .sec_info {
  686. width: 90%;
  687. height: auto;
  688. margin: 0 auto;
  689. box-shadow: 0rpx 6rpx 25rpx 0rpx rgba(0, 0, 0, 0.2);
  690. margin-top: 50rpx;
  691. border-radius: 20rpx;
  692. }
  693. .info_txt {
  694. width: 100%;
  695. height: 120rpx;
  696. line-height: 120rpx;
  697. text-align: center;
  698. color: #000;
  699. font-size: 36rpx;
  700. margin-bottom: 20rpx;
  701. }
  702. .info_plate {
  703. display: flex;
  704. flex-direction: row;
  705. width: 94%;
  706. height: 100rpx;
  707. margin: 0 auto;
  708. border-bottom: 2rpx solid #f2f2f2;
  709. }
  710. .info_plate text:nth-child(1) {
  711. height: 100rpx;
  712. text-align: left;
  713. line-height: 100rpx;
  714. font-size: 32rpx;
  715. color: #999;
  716. }
  717. .info_plate text:nth-child(2) {
  718. flex: 1;
  719. height: 100rpx;
  720. line-height: 100rpx;
  721. font-size: 32rpx;
  722. color: #333;
  723. margin-left: 50rpx;
  724. text-align: right;
  725. }
  726. /*提交按钮样式*/
  727. .up_btn {
  728. width: 85%;
  729. height: 100rpx;
  730. margin: 0 auto;
  731. margin-top: 50rpx;
  732. margin-bottom: 100rpx;
  733. }
  734. .up_btn button {
  735. width: 100%;
  736. height: 80rpx;
  737. line-height: 80rpx;
  738. color: white;
  739. font-size: 32rpx;
  740. text-align: center;
  741. background: linear-gradient(to right,#01243A,#004576);
  742. border-radius: 40rpx;
  743. outline: none;
  744. border: #4cd95f;
  745. }
  746. .button {
  747. width: 100%;
  748. height: 80rpx;
  749. line-height: 80rpx;
  750. color: white;
  751. font-size: 32rpx;
  752. text-align: center;
  753. background: linear-gradient(to left, #43a1e0 0%, #13e7c1 100%);
  754. border-radius: 40rpx;
  755. outline: none;
  756. border: #4cd95f;
  757. }
  758. .hui {
  759. width: 100%;
  760. height: 80rpx;
  761. line-height: 80rpx;
  762. color: white;
  763. font-size: 32rpx;
  764. text-align: center;
  765. background: linear-gradient(to left, #b9b9b9 0%, #e7e7e7 100%) !important;
  766. border-radius: 40rpx;
  767. outline: none;
  768. border: #4cd95f;
  769. }
  770. .up_btn button[disabled] {
  771. background-color: rgba(0, 191, 112, 0.5);
  772. color: white;
  773. font-size: 34rpx;
  774. border-radius: 20rpx;
  775. }
  776. .mask{
  777. width: 100%;
  778. height:100vh;
  779. background:rgba(0,0,0,0.63);
  780. position: fixed;
  781. left: 0;
  782. top: 0;
  783. right: 0;
  784. bottom: 0;
  785. z-index: 999;
  786. display: flex;
  787. align-items: center;
  788. justify-content: center;
  789. }
  790. </style>