Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

result.vue 22KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800
  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">
  18. <text>卡号</text>
  19. <text>{{ fileDataStrings.cardId }}</text>
  20. </view>
  21. <view class="info_plate">
  22. <text>OBU号</text>
  23. <text>{{ fileDataStrings.obuId }}</text>
  24. </view>
  25. </view>
  26. <view class="up_btn">
  27. <button aria-disabled="true" @click="btn" :disabled="disabled">
  28. 点击开始激活
  29. </button>
  30. </view>
  31. </view>
  32. </template>
  33. <script setup>
  34. import {
  35. reactive,
  36. ref
  37. } from "vue";
  38. import {
  39. formatTime,
  40. expireDate,
  41. expireDate2,
  42. getFormatDate
  43. } from "../../utils/utils";
  44. import {
  45. onLoad
  46. } from '@dcloudio/uni-app'
  47. import {
  48. getItem
  49. } from "../../utils/storage";
  50. import {
  51. request
  52. } from "../../utils/network/request.js";
  53. import {
  54. IntegerToHexString,
  55. AsciToHexString,
  56. } from "../../utils/util/fileData.js";
  57. import {
  58. stringToJson
  59. } from "../../utils/network/encryption.js";
  60. import * as IFCODE from "../../utils/network/api.js";
  61. const cmd = require("../../static/etcUtil/cmdConfig.js");
  62. const tools = require("../../static/etcUtil/tools.js");
  63. const bluetoothUtil = require("../../static/etcUtil/index.js");
  64. const state =reactive({
  65. orderId:"",
  66. id:"",
  67. cardStatus:"",
  68. obuStatus:""
  69. })
  70. onLoad(() => {
  71. //读取传入 存储的数据orderInfo
  72. let orderData= getItem("orderInfo");
  73. state.id = orderData.id;
  74. state.orderId = orderData.orderId;
  75. console.log(state);
  76. //获取订单详情
  77. getOrderDetails(state.id);
  78. })
  79. const card = reactive({
  80. cardId: "",
  81. netId: "",
  82. cardType: "",
  83. startTime: "",
  84. endTime: "",
  85. userName: "",
  86. idNum: "",
  87. vehiclePlate: "",
  88. vehiclePlateColor: "",
  89. color: "",
  90. version: "",
  91. type: "",
  92. favourable: "",
  93. money: "",
  94. v_userType: "",
  95. });
  96. const obu = reactive({
  97. obuId: "",
  98. startTime: "",
  99. endTime: "",
  100. version: "",
  101. approvedCount: "",
  102. axleCount: "",
  103. axleDistance: "",
  104. engineNum: "",
  105. type: "",
  106. userType: "",
  107. contractNo: "",
  108. vehiclePlate: "",
  109. vehiclePlateColor: "",
  110. vin: "",
  111. wheelCount: "",
  112. isJH: ""
  113. });
  114. const disabled = ref(false);
  115. let cmdRandNum = '';
  116. let orderInfo = {};
  117. const fileDataStrings = reactive({
  118. approvedCount: "", //核载人数
  119. cardId: "", //卡号
  120. obuId: "", //obu号
  121. obuId: "", //obu号
  122. packageNum: "", //套餐编号
  123. axleCount: "", //轴数
  124. axleDistance: "", //轴距
  125. engineNum: "", //发动机
  126. vehicleVin: "",
  127. vehicleEngineNum: "",
  128. cardStatus: "",
  129. obuStatus: "",
  130. type: "", //类型
  131. userType: "", //用户类型
  132. vehiclePlate: "", //车牌
  133. vehiclePlateColor: "", //车牌颜色
  134. vehicleDimensions: "",
  135. outlineL: "", //外廓 长
  136. outlineW: "", //外廓 宽
  137. outlineH: "", //外廓 高
  138. wheelCount: "", //车轮数
  139. vehicleIdNo: "", //车牌号
  140. vehiclePlateColorStr: "",
  141. customerTel: "",
  142. customerId: "",
  143. orderId: ""
  144. });
  145. //开始激活 按钮事件
  146. const btn = () => {
  147. console.log('orderInfo参数', orderInfo)
  148. if (orderInfo) {
  149. //根据订单详情走相应的断步功能
  150. const cardId = orderInfo.cardId;
  151. const cardStatus = orderInfo.cardStatus != null ? orderInfo.cardStatus : '0'
  152. const obuId = orderInfo.obuId;
  153. const obuStatus = orderInfo.obuStatus != null ? orderInfo.obuStatus : '9'
  154. console.log('当前卡签状态', cardId, obuId, cardStatus, obuStatus)
  155. if (obu.obuId != fileDataStrings.obuId) {
  156. tools.showModalAlert("订单设备号信息与当前设备号信息不符!");
  157. return
  158. }
  159. if (!cardId) { //卡发行
  160. getCardId()
  161. } else if (cardId && cardStatus == '0') { //卡发行
  162. getCardId()
  163. } else if (!obuId) { //OBU发行
  164. getObuApply();
  165. } else if (obuId && obuStatus == '9') { //OBU发行
  166. getObuApply();
  167. } else if (cardId && obuId && (obuStatus == '1' || obuStatus == '11' || obuStatus ==
  168. '0')) {
  169. getInstallApply(); //激活
  170. } else {
  171. getCardId()
  172. }
  173. }
  174. };
  175. //获取订单详情
  176. const getOrderDetails = (id) => {
  177. console.log('======获取订单信息======')
  178. const options = {
  179. type: 2,
  180. data: {
  181. id: id,
  182. },
  183. method: "POST",
  184. showLoading: true,
  185. };
  186. request(IFCODE.orderDetail, options).then((res) => {
  187. orderInfo = JSON.parse(res.bizContent);
  188. if (orderInfo) {
  189. fileDataStrings.userType = orderInfo.userType; //用户类型
  190. fileDataStrings.approvedCount = orderInfo.vehicleApprovedCount; //核载人数
  191. fileDataStrings.cardId = orderInfo.cardId;
  192. fileDataStrings.packageNum = orderInfo.packageNum;
  193. fileDataStrings.obuId = orderInfo.obuId;
  194. fileDataStrings.vehicleVin = orderInfo.vehicleVin;
  195. fileDataStrings.vehicleEngineNum = orderInfo.vehicleEngineNum;
  196. fileDataStrings.axleCount = orderInfo.vehicleAxleCount; //轴数
  197. fileDataStrings.engineNum = orderInfo.vehicleVin; //发动机
  198. fileDataStrings.type = orderInfo.vehicleType; //类型
  199. fileDataStrings.vehiclePlate = orderInfo.vehiclePlate; //车牌
  200. fileDataStrings.vehiclePlateColor = orderInfo.vehiclePlateColor; //车牌颜色
  201. fileDataStrings.vehicleDimensions = orderInfo.vehicleDimensions;
  202. let arr = orderInfo.vehicleDimensions.split("x");
  203. fileDataStrings.outlineL = parseInt(arr[0]); //外廓 长
  204. fileDataStrings.outlineW = parseInt(arr[1]); //外廓 宽
  205. fileDataStrings.outlineH = parseInt(
  206. arr[2].substring(0, arr[2].length - 2)
  207. ); //外廓 高
  208. fileDataStrings.vehicleIdNo = orderInfo.vehicleEngineNum; //车编号
  209. fileDataStrings.vehiclePlateColorStr = orderInfo.vehiclePlateColorStr;
  210. fileDataStrings.customerTel = orderInfo.customerTel;
  211. fileDataStrings.customerId = orderInfo.customerId;
  212. fileDataStrings.orderId = orderInfo.orderId;
  213. getObuId();
  214. }
  215. });
  216. };
  217. /**
  218. * 获取OBU号 读OBU
  219. */
  220. const getObuId = () => {
  221. console.log('======获取OBU号======')
  222. let cmdArray = [cmd.HOME_DIRECTORY, cmd.OBU_SYSTEM_FILE, cmd.RANDOM_NUMBER];
  223. tools.showLoadingAlert("正在执行指令");
  224. bluetoothUtil.transCmd(cmdArray, "20", function(res) {
  225. tools.hideLoadingAlert();
  226. var status = res[1].substring(res[1].length - 4, res[1].length);
  227. console.log('获取OBU号执行结果' + status)
  228. //第一次获取随机数
  229. if (status == "9000") {
  230. obu.obuId = res[1].substring(20, 36);
  231. obu.vin = res[1].substring(18, 20);
  232. obu.version = res[1].substring(18, 19) >= 4 ? "4x" : "2x";
  233. cmdRandNum = res[2].substring(0, res[2].length - 4);
  234. }
  235. });
  236. };
  237. //获取fileData
  238. const getFileData = () => {
  239. //获取fileData 拼接字符串
  240. let res1 = AsciToHexString(fileDataStrings.vehiclePlate, 24); //车牌号
  241. let res2 = IntegerToHexString(fileDataStrings.vehiclePlateColor, 4); //车牌颜色
  242. let res3 = IntegerToHexString(1, 2); //类型
  243. let res4 = IntegerToHexString(1, 2); //用户类型
  244. let res5 = IntegerToHexString(123, 4); //车辆尺寸 长
  245. let res6 = IntegerToHexString(123, 2); //车辆尺寸 宽
  246. let res7 = IntegerToHexString(123, 2); //车辆尺寸 高
  247. let res8 = IntegerToHexString(4, 2); //获取轮数
  248. let res9 = IntegerToHexString(4, 2); //轴数
  249. let res10 = IntegerToHexString(null, 4); //轴距
  250. let res11 = IntegerToHexString(5, 6); //核载人数
  251. let res12 = AsciToHexString(fileDataStrings.vehicleVin, 32); //车编号
  252. let res13 = AsciToHexString(fileDataStrings.vehicleEngineNum, 32); //发动机
  253. return res1 + res2 + res3 + res4 + res5 + res6 + res7 + res8 + res9 + res10 + res11 + res12 + res13;
  254. };
  255. /**
  256. * 获取卡号 读卡
  257. */
  258. const getCardId = () => {
  259. console.log('======获取卡信息======')
  260. let cmdArr = [
  261. cmd.HOME_DIRECTORY,
  262. //选择主目
  263. cmd.APPLICATION_DIRECTORY,
  264. //选择文件1001--DF01联网收费应用目录
  265. cmd.CMD_READBINARY,
  266. //15文件--卡片发行基本数据文件
  267. cmd.CMD_GETBALANCE
  268. //钱包
  269. ];
  270. tools.showLoadingAlert("正在执行指令");
  271. bluetoothUtil.transCmd(cmdArr, "10", function(res) {
  272. tools.hideLoadingAlert();
  273. //10:写卡 20:写OBU
  274. let str = res[2].substring(res[2].length - 4, res[2].length);
  275. let str3 = res[3].substring(res[3].length - 4, res[3].length);
  276. if (str == "9000" || str3 == "9000") {
  277. if (res[2].length > 86 || res[3] >= 12) {
  278. card.cardId = res[2].substring(20, 40); //卡号
  279. card.startTime = res[2].substring(40, 48); //启用
  280. card.endTime = res[2].substring(48, 56);
  281. card.version = res[2].substring(18, 19) >= 4 ? "4x" : "2x";
  282. card.netId = res[2].substring(20, 24);
  283. card.cardType = res[2].substring(28, 30) == 23 ? 1 : 2; //23记账卡 非 23储值卡 1:记账卡 2:储值卡
  284. card.vehiclePlateColor = parseInt(res[2].substring(82, 84), 16);
  285. console.log('======卡信息======', card)
  286. if (card.cardId != fileDataStrings.cardId) {
  287. tools.showModalAlert("订单卡号与当前设备卡号信息不符!");
  288. return
  289. }
  290. getCardApply()
  291. } else {
  292. console.error("CMD_READBINARY指令长度不符" + res[2])
  293. tools.hideLoadingAlert();
  294. }
  295. }
  296. console.error("CMD_READBINARY指令长度不符" + res[2])
  297. tools.hideLoadingAlert();
  298. });
  299. };
  300. // *------------------------------------*
  301. // OBU开卡模块
  302. // *------------------------------------*
  303. /**
  304. * 写卡指令申请 请求
  305. */
  306. const getCardApply = () => {
  307. console.log('======写卡指令申请======')
  308. tools.showLoadingAlert("加载中");
  309. let options = {
  310. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  311. data: {
  312. cardId: card.cardId,
  313. orderId: fileDataStrings.orderId,
  314. cardType: card.cardType,
  315. userId: fileDataStrings.customerId,
  316. vehicleId: fileDataStrings.vehiclePlate + "_" + fileDataStrings.vehiclePlateColor,
  317. cosProvider: "1",
  318. enableTime: getFormatDate(new Date(), "yyyyMMdd"),
  319. expireTime: expireDate2(new Date())
  320. }, //请求参数
  321. method: "POST", //提交方式(默认POST)
  322. showLoading: true, //是否显示加载中(默认显示)
  323. };
  324. //调用方式
  325. request(IFCODE.writeCardApply, options)
  326. .then((res) => {
  327. tools.hideLoadingAlert();
  328. let result = stringToJson(res.bizContent);
  329. tools.showLoadingAlert("执行指令中");
  330. bluetoothUtil.transCmd(result.command.split(","), "10", function(res) {
  331. tools.hideLoadingAlert();
  332. getCommandBack(result.command, result.cosRecordId, res.toString());
  333. });
  334. })
  335. };
  336. /**
  337. * 写卡指令返回 请求
  338. */
  339. const getCommandBack = (command, cosRecordId, response) => {
  340. console.log('======循环写卡指令中======')
  341. tools.showLoadingAlert("加载中");
  342. let options = {
  343. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  344. data: {
  345. cardId: card.cardId,
  346. orderId: fileDataStrings.orderId,
  347. command: command,
  348. response: response,
  349. cosRecordId: cosRecordId,
  350. cosType: "1"
  351. }, //请求参数
  352. method: "POST", //提交方式(默认POST)
  353. showLoading: true, //是否显示加载中(默认显示)
  354. };
  355. //调用方式
  356. request(IFCODE.writeCardBack, options)
  357. .then((res) => {
  358. tools.hideLoadingAlert();
  359. let result = JSON.parse(res.bizContent);
  360. if (result.orderStatus == 1 || result.orderStatus == "1") {
  361. tools.showLoadingAlert("执行指令中");
  362. bluetoothUtil.transCmd(result.command.split(","), "10", function(res) {
  363. tools.hideLoadingAlert();
  364. let response = res.toString();
  365. getCommandBack(result.command, cosRecordId, response);
  366. });
  367. } else {
  368. getWriteCard();
  369. }
  370. })
  371. };
  372. /**
  373. * 写卡确认 请求
  374. */
  375. const getWriteCard = () => {
  376. tools.showLoadingAlert("请求中");
  377. console.log('======写卡确认======')
  378. let options = {
  379. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  380. data: {
  381. cardId: card.cardId,
  382. orderId: fileDataStrings.orderId,
  383. netId: card.netId,
  384. packageNum: fileDataStrings.packageNum,
  385. cardType: card.cardType == 1 ? "111" : "211",
  386. brand: "3",
  387. model: "0",
  388. enableTime: formatTime(new Date()),
  389. expireTime: formatTime(new Date()),
  390. accountOrganization: "",
  391. accountCardNo: "",
  392. cosRecordId: ""
  393. }, //请求参数
  394. method: "POST", //提交方式(默认POST)
  395. showLoading: true, //是否显示加载中(默认显示)
  396. };
  397. //调用方式
  398. request(IFCODE.writeCardConfirm, options)
  399. .then((res) => {
  400. tools.hideLoadingAlert();
  401. console.log(stringToJson(res.bizContent));
  402. //OBU发行申请 请求
  403. getObuApply()
  404. })
  405. .catch((err) => {
  406. console.log(err);
  407. });
  408. };
  409. // *------------------------------------*
  410. // OBU 发行模块
  411. // *------------------------------------*
  412. /**
  413. * OBU发行申请 请求
  414. */
  415. const getObuApply = () => {
  416. console.log('======OBU发行申请======')
  417. tools.showLoadingAlert("加载中");
  418. let options = {
  419. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  420. data: {
  421. obuId: obu.obuId,
  422. userId: fileDataStrings.customerId,
  423. vehicleId: fileDataStrings.vehiclePlate + "_" + fileDataStrings.vehiclePlateColor
  424. }, //请求参数
  425. method: "POST", //提交方式(默认POST)
  426. showLoading: true, //是否显示加载中(默认显示)
  427. };
  428. //调用方式
  429. request(IFCODE.writeObuApply, options)
  430. .then(() => {
  431. tools.hideLoadingAlert();
  432. modifyFileInfo()
  433. })
  434. };
  435. /**
  436. * 修改系统信息 请求
  437. */
  438. const modifyFileInfo = () => {
  439. console.log('======修改系统信息请求======')
  440. var datetime = new Date();
  441. var year = datetime.getFullYear();
  442. var year1 = datetime.getFullYear() + 10;
  443. var month = datetime.getMonth() + 1 < 10 ? "0" + (datetime.getMonth() + 1) : datetime.getMonth() + 1;
  444. var date = datetime.getDate() < 10 ? "0" + datetime.getDate() : datetime.getDate();
  445. tools.showLoadingAlert("加载中");
  446. let options = {
  447. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  448. data: {
  449. obuSerailNo: obu.obuId, //OBU号
  450. obuVersion: obu.vin, //OBU版本号
  451. effTime: year + "" + month + "" + date, //启用时间
  452. expIime: year1 + "" + month + "" + date, //结束时间
  453. plateNo: fileDataStrings.vehiclePlate,
  454. pColor: fileDataStrings.vehiclePlateColor,
  455. random: cmdRandNum
  456. }, //请求参数
  457. method: "POST", //提交方式(默认POST)
  458. showLoading: true, //是否显示加载中(默认显示)
  459. };
  460. //调用方式
  461. request(IFCODE.modifyObuSysInfo, options)
  462. .then((res) => {
  463. tools.hideLoadingAlert();
  464. const datas = stringToJson(res.bizContent);
  465. tools.showLoadingAlert("执行指令");
  466. //如果存在APDU->穿透指令
  467. if (datas.data.APDU) {
  468. bluetoothUtil.transCmd([datas.data.APDU], "20", function(res) {
  469. tools.hideLoadingAlert();
  470. if (res[0] == "9000") {
  471. tools.showLoadingAlert("执行指令");
  472. //再次获取随机数
  473. let cmdArr = [cmd.HOME_DIRECTORY, cmd.OBU_DF01, cmd.OBU_EF01, cmd
  474. .RANDOM_NUMBER
  475. ];
  476. bluetoothUtil.transCmd(cmdArr, '20', function(res) {
  477. var str = res[3].substring(res[3].length - 4, res[3].length);
  478. if (str == "9000") {
  479. cmdRandNum = res[3].substring(0, res[3].length - 4);
  480. modifyVehicle();
  481. } else {
  482. tools.alertF("RANDOM_NUMBER指令长度不符" + res[1]);
  483. }
  484. })
  485. }
  486. });
  487. }
  488. })
  489. .catch((err) => {
  490. console.log(err);
  491. });
  492. };
  493. /**
  494. * 修改车辆信息 请求
  495. */
  496. const modifyVehicle = () => {
  497. tools.showLoadingAlert("加载中");
  498. console.log('======修改车辆信息======')
  499. let options = {
  500. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  501. data: {
  502. Status: "0",
  503. random: cmdRandNum, //5202192509222239
  504. obuSerailNo: obu.obuId, //5202192509551922
  505. fileData: getFileData(),
  506. orderId: fileDataStrings.orderId,
  507. }, //请求参数
  508. method: "POST", //提交方式(默认POST)
  509. showLoading: true, //是否显示加载中(默认显示)
  510. };
  511. //调用方式
  512. request(IFCODE.modifyObuVehicleInfo, options)
  513. .then((res) => {
  514. tools.hideLoadingAlert();
  515. const datas = stringToJson(res.bizContent);
  516. tools.showLoadingAlert("正在执行指令");
  517. if (datas.data.APDU) {
  518. bluetoothUtil.transCmd([datas.data.APDU], "20", function(res) {
  519. console.log('执行指令结果', res)
  520. tools.hideLoadingAlert();
  521. if (res[0] == "9000") {
  522. getObuConfirm();
  523. }
  524. });
  525. }
  526. })
  527. };
  528. /**
  529. * OBU确认发行 请求
  530. */
  531. const getObuConfirm = () => {
  532. console.log('======OBU确认发行======')
  533. tools.showLoadingAlert("加载中");
  534. let options = {
  535. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  536. data: {
  537. obuId: obu.obuId,
  538. orderId: fileDataStrings.orderId,
  539. netId: obu.obuId.substring(0, 4),
  540. brand: obu.brand,
  541. model: obu.version,
  542. enableTime: formatTime(new Date()),
  543. expireTime: expireDate(new Date())
  544. }, //请求参数
  545. method: "POST", //提交方式(默认POST)
  546. showLoading: true, //是否显示加载中(默认显示)
  547. };
  548. //调用方式
  549. request(IFCODE.obuConfirm, options)
  550. .then((res) => {
  551. tools.hideLoadingAlert();
  552. let datas = stringToJson(res.bizContent);
  553. if (datas.obuId) {
  554. getInstallApply()
  555. }
  556. })
  557. .catch((err) => {
  558. console.log(err);
  559. });
  560. };
  561. // *------------------------------------*
  562. // 设备发行模块
  563. // *------------------------------------*
  564. /**
  565. * BDS-安装申请 请求
  566. */
  567. const getInstallApply = () => {
  568. console.log('======安装申请======')
  569. tools.showLoadingAlert("加载中");
  570. let options = {
  571. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  572. data: {
  573. obuId: obu.obuId,
  574. vehicleId: fileDataStrings.vehiclePlate + "_" + fileDataStrings.vehiclePlateColor,
  575. orderId: fileDataStrings.orderId,
  576. agentId: "52010106004",
  577. channelId: "5201010200601130001",
  578. channelType: "1",
  579. staffId: "opId",
  580. terminalId: "999999999",
  581. }, //请求参数
  582. method: "POST", //提交方式(默认POST)
  583. showLoading: true, //是否显示加载中(默认显示)
  584. };
  585. //调用方式
  586. request(IFCODE.installApply, options)
  587. .then(() => {
  588. tools.hideLoadingAlert();
  589. // //再次获取随机数
  590. // let cmdArr = [cmd.HOME_DIRECTORY, cmd.RANDOM_NUMBER];
  591. // bluetoothUtil.transCmd(cmdArr, '20', function(res) {
  592. // var str = res[1].substring(res[1].length - 4, res[1].length);
  593. // if (str == "9000") {
  594. // cmdRandNum = res[1].substring(0, res[1].length - 4);
  595. // getObuActivation(cmdRandNum);
  596. // } else {
  597. // tools.alertF("RANDOM_NUMBER指令长度不符" + res[1]);
  598. // }
  599. // })
  600. //再次获取随机数
  601. let cmdArr = [cmd.HOME_DIRECTORY, cmd.RANDOM_NUMBER];
  602. bluetoothUtil.transCmd(cmdArr, '20', function(res) {
  603. var str = res[1].substring(res[1].length - 4, res[1].length);
  604. if (str == "9000") {
  605. cmdRandNum = res[1].substring(0, res[1].length - 4);
  606. getObuActivation();
  607. } else {
  608. tools.alertF("RANDOM_NUMBER指令长度不符" + res[1]);
  609. }
  610. })
  611. })
  612. };
  613. /**
  614. * VFJ-OBU在线激活 请求
  615. */
  616. const getObuActivation = () => {
  617. console.log('======VFJ-OBU在线激活======')
  618. tools.showLoadingAlert("加载中");
  619. let options = {
  620. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  621. data: {
  622. random: cmdRandNum,
  623. obuSerailNo: obu.obuId,
  624. orderId: fileDataStrings.orderId,
  625. }, //请求参数
  626. method: "POST", //提交方式(默认POST)
  627. showLoading: true, //是否显示加载中(默认显示)
  628. };
  629. //调用方式
  630. request(IFCODE.obuActivation, options)
  631. .then((res) => {
  632. tools.hideLoadingAlert();
  633. console.log("在线激活 请求");
  634. console.log(stringToJson(res.bizContent));
  635. const datas = stringToJson(res.bizContent);
  636. tools.showLoadingAlert("执行指令");
  637. bluetoothUtil.transCmd([datas.data.APDU], "20", function(res) {
  638. tools.hideLoadingAlert();
  639. console.log(res);
  640. if (res[0] == "9000") {
  641. console.log("在线激活执行指令88888 请求", res);
  642. getObuInstall(0, ""); //status 0 - 安装成功 || 1 - 安装失败
  643. }
  644. });
  645. })
  646. .catch((err) => {
  647. console.log(err);
  648. });
  649. };
  650. /**
  651. * BDS-安装确认 请求
  652. */
  653. const getObuInstall = (status, reason) => {
  654. console.log('======OBU安装确认======')
  655. tools.showLoadingAlert("加载中");
  656. let options = {
  657. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  658. data: {
  659. installStatus: status,
  660. failReason: reason,
  661. installType: "1",
  662. installChannelId: "5201010200601130001",
  663. obuId: obu.obuId,
  664. orderId: fileDataStrings.orderId
  665. }, //请求参数
  666. method: "POST", //提交方式(默认POST)
  667. showLoading: true, //是否显示加载中(默认显示)
  668. };
  669. //调用方式
  670. request(IFCODE.obuInstall, options)
  671. .then(() => {
  672. tools.hideLoadingAlert();
  673. // uni.navigateTo({
  674. // url: "/orders/order-details-new?id=" +
  675. // state.id +
  676. // "&orderId=" +
  677. // state.orderId,
  678. // });
  679. uni.navigateTo({
  680. url: "/pages/bluetooth/info?id=" +
  681. state.id +
  682. "&orderId=" +
  683. state.orderId,
  684. });
  685. });
  686. };
  687. </script>
  688. <style>
  689. .containers {
  690. height: 100%;
  691. display: flex;
  692. flex-direction: column;
  693. align-items: center;
  694. justify-content: space-between;
  695. box-sizing: border-box;
  696. }
  697. .sec_info {
  698. width: 90%;
  699. height: auto;
  700. margin: 0 auto;
  701. box-shadow: 0rpx 6rpx 25rpx 0rpx rgba(0, 0, 0, 0.2);
  702. margin-top: 50rpx;
  703. border-radius: 20rpx;
  704. }
  705. .info_txt {
  706. width: 100%;
  707. height: 120rpx;
  708. line-height: 120rpx;
  709. text-align: center;
  710. color: #000;
  711. font-size: 36rpx;
  712. margin-bottom: 20rpx;
  713. }
  714. .info_plate {
  715. display: flex;
  716. flex-direction: row;
  717. width: 94%;
  718. height: 100rpx;
  719. margin: 0 auto;
  720. border-bottom: 2rpx solid #f2f2f2;
  721. }
  722. .info_plate text:nth-child(1) {
  723. height: 100rpx;
  724. text-align: left;
  725. line-height: 100rpx;
  726. font-size: 32rpx;
  727. color: #999;
  728. }
  729. .info_plate text:nth-child(2) {
  730. flex: 1;
  731. height: 100rpx;
  732. line-height: 100rpx;
  733. font-size: 32rpx;
  734. color: #333;
  735. margin-left: 50rpx;
  736. text-align: right;
  737. }
  738. /*提交按钮样式*/
  739. .up_btn {
  740. width: 85%;
  741. height: 100rpx;
  742. margin: 0 auto;
  743. margin-top: 50rpx;
  744. margin-bottom: 100rpx;
  745. }
  746. .up_btn 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. .up_btn button[disabled] {
  759. background-color: rgba(0, 191, 112, 0.5);
  760. color: white;
  761. font-size: 34rpx;
  762. border-radius: 20rpx;
  763. }
  764. </style>