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.

activation-once-again.vue 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563
  1. <template>
  2. <view class="selectCar-box">
  3. <view class="details">
  4. <view class="title"> 基础信息 </view>
  5. <view class="details-item">
  6. <view> 订单编号: </view>
  7. <text>{{ orderInfos.orderId }}</text>
  8. </view>
  9. <view class="details-item">
  10. <view> 用户名称: </view>
  11. <text>{{ orderInfos.ownerName }}</text>
  12. </view>
  13. <view class="details-item">
  14. <view> 用户证件类型: </view>
  15. <text>{{ getCredentialType(orderInfos.ownerIdtype) }}</text>
  16. </view>
  17. <view class="details-item">
  18. <view> 用户证件号: </view>
  19. <text>{{ orderInfos.ownerIdnum }}</text>
  20. </view>
  21. <view class="details-item">
  22. <view> 订单车牌号: </view>
  23. <text style="color: #00b38b">{{ orderInfos.vehiclePlate }}</text>
  24. </view>
  25. <view class="details-item">
  26. <view> 车牌颜色: </view>
  27. <text style="color: #00b38b">{{
  28. orderInfos.vehiclePlateColorStr
  29. }}</text>
  30. </view>
  31. <view class="details-item">
  32. <view> 收费车型: </view>
  33. <text>{{ orderInfos.vehicleType }}</text>
  34. </view>
  35. </view>
  36. <view class="title"> 卡信息 </view>
  37. <view class="card">
  38. <view class="card-left">
  39. <image :src="`${$imgUrl}card2.png`" mode=""></image>
  40. <view class="card-center">
  41. <view class="card-center-head"> {{orderInfos.cardId}} </view>
  42. <view class="tips">
  43. <text>储蓄卡</text>
  44. <text class="tips-card">{{getEtcCardStatus(orderInfos.cardStatus)}}</text>
  45. </view>
  46. <view class="choose-item"> 有效期:xxxx-xx-xx </view>
  47. </view>
  48. </view>
  49. </view>
  50. <view class="title"> OBU设备信息 </view>
  51. <view class="card">
  52. <view class="card-left">
  53. <image :src="`${$imgUrl}card1.png`" mode=""></image>
  54. <view class="card-center">
  55. <view class="card-center-head"> {{orderInfos.obuId}} </view>
  56. <view class="tips">
  57. <!-- <text>储蓄卡</text> -->
  58. <text class="tips-card">{{getObuStatus(orderInfos.obuStatus)}}</text>
  59. </view>
  60. <view class="choose-item"> 有效期:xxxx-xx-xx </view>
  61. </view>
  62. </view>
  63. </view>
  64. <button class="submit" @click="toPage">再次激活</button>
  65. <view class="mask" v-show="state.showPopup">
  66. <view class="main">
  67. <view class="top">
  68. <image class="icon-close" :src="`${$imgUrl}common/icon-close.png`" @click="cancel"></image>
  69. </view>
  70. <image class="icon-success" :src="`${$imgUrl}bluetooth/device-active-success.png`"></image>
  71. <view class="title">设备激活成功!</view>
  72. </view>
  73. </view>
  74. </view>
  75. </template>
  76. <script lang="ts" setup>
  77. import {
  78. reactive,
  79. ref
  80. } from "vue";
  81. import {
  82. formatTime,
  83. expireDate,
  84. expireDate2,
  85. getFormatDate,
  86. msg,
  87. navTo
  88. } from "../../utils/utils";
  89. import {
  90. onLoad,onShow
  91. } from '@dcloudio/uni-app'
  92. // import {
  93. // getItem
  94. // } from "../../utils/storage";
  95. import {
  96. request
  97. } from "../../utils/network/request.js";
  98. // import {
  99. // IntegerToHexString,
  100. // AsciToHexString,
  101. // } from "../../utils/util/fileData.js";
  102. import {
  103. stringToJson
  104. } from "../../utils/network/encryption.js";
  105. import activeSuccess from "./components/popup-device-active-success";
  106. import * as IFCODE from "../../utils/network/api.js";
  107. const cmd = require("../../static/etcUtil/cmdConfig.js");
  108. const tools = require("../../static/etcUtil/tools.js");
  109. const bluetoothUtil = require("../../static/etcUtil/index.js");
  110. import {
  111. getCredentialType
  112. } from "@/datas/credentialType.js";
  113. import {
  114. getEtcCardStatus
  115. } from "@/datas/etcCardStatus.js";
  116. import {
  117. getObuStatus
  118. } from "@/datas/obuStatus.js";
  119. const state = reactive({
  120. showPopup:false
  121. })
  122. //订单
  123. const orderInfos = reactive({
  124. orderId: "",
  125. ownerName: "",
  126. ownerIdtype: "",
  127. ownerIdnum: "",
  128. vehiclePlate: "",
  129. vehiclePlateColorStr: "",
  130. vehiclePlateColor:"",
  131. vehicleType: "",
  132. cardId: "",
  133. cardStatus: "",
  134. obuId: "",
  135. obuStatus: "",
  136. outlineL:0,
  137. outlineW:0,
  138. outlineH:0,
  139. type:0,
  140. axleCount:0,
  141. approvedCount:0,
  142. vehicleVin:"",
  143. vehicleEngineNum:"",
  144. });
  145. //OBU
  146. const obu = reactive({
  147. obuId: "",
  148. startTime: "",
  149. endTime: "",
  150. version: "",
  151. approvedCount: "",
  152. axleCount: "",
  153. axleDistance: "",
  154. engineNum: "",
  155. type: "",
  156. userType: "",
  157. contractNo: "",
  158. vehiclePlate: "",
  159. vehiclePlateColor: "",
  160. vin: "",
  161. wheelCount: "",
  162. isJH: ""
  163. });
  164. onLoad((option) => {
  165. //请求订单详情
  166. queryOrderDetail(option.id);
  167. });
  168. onShow((option) => {
  169. uni.$on('bluetoothLink', res => {
  170. console.log(res);
  171. if (res.status) {
  172. // getCardRenewal()
  173. getObuId()
  174. }
  175. //移除监听
  176. uni.$off('bluetoothLink')
  177. })
  178. })
  179. const cancel = ()=>{
  180. state.showPopup = false;
  181. // navTo("/pages/service/service")
  182. uni.navigateBack({
  183. delta:2
  184. })
  185. };
  186. const toPage = () => {
  187. navTo("/pages/bluetooth/bluetooth?routeType=5");
  188. };
  189. //获取订单详情
  190. const queryOrderDetail = (id: string) => {
  191. const options = {
  192. type: 2,
  193. data: {
  194. id: id,
  195. },
  196. method: "POST",
  197. showLoading: true,
  198. };
  199. request(IFCODE.orderDetail, options).then((res) => {
  200. let orderInfo = JSON.parse(res.bizContent);
  201. console.log(orderInfo);
  202. orderInfos.orderId = orderInfo.orderId;
  203. orderInfos.ownerName = orderInfo.ownerName;
  204. orderInfos.ownerIdtype = orderInfo.ownerIdtype;
  205. orderInfos.ownerIdnum = orderInfo.ownerIdnum;
  206. orderInfos.vehiclePlate = orderInfo.vehiclePlate;
  207. orderInfos.vehiclePlateColorStr = orderInfo.vehiclePlateColorStr;
  208. orderInfos.vehiclePlateColor = orderInfo.vehiclePlateColor;
  209. orderInfos.vehicleType = orderInfo.vehicleType;
  210. orderInfos.cardId = orderInfo.cardId;
  211. orderInfos.cardStatus = orderInfo.cardStatus;
  212. orderInfos.obuId = orderInfo.obuId;
  213. orderInfos.obuStatus = orderInfo.obuStatus;
  214. let arr = orderInfo.vehicleDimensions.split("x");
  215. orderInfos.outlineL = parseInt(arr[0]); //外廓 长
  216. orderInfos.outlineW = parseInt(arr[1]); //外廓 宽
  217. orderInfos.outlineH = parseInt(arr[2].substring(0, arr[2].length - 2)); //外廓 高
  218. orderInfos.type=orderInfo.type;
  219. orderInfos.axleCount=orderInfo.vehicleAxleCount;
  220. orderInfos.approvedCount=orderInfo.vehicleApprovedCount;
  221. orderInfos.vehicleVin=orderInfo.vehicleVin;
  222. orderInfos.vehicleEngineNum=orderInfo.vehicleEngineNum;
  223. });
  224. };
  225. /**
  226. * 获取OBU号 读OBU
  227. */
  228. const getObuId = () => {
  229. console.log('======获取OBU号======')
  230. let cmdArray = [cmd.HOME_DIRECTORY, cmd.OBU_SYSTEM_FILE, cmd.RANDOM_NUMBER];
  231. tools.showLoadingAlert("正在执行指令");
  232. bluetoothUtil.transCmd(cmdArray, "20", function(res) {
  233. tools.hideLoadingAlert();
  234. var status = res[1].substring(res[1].length - 4, res[1].length);
  235. console.log('获取OBU号执行结果' + status)
  236. //第一次获取随机数
  237. if (status == "9000") {
  238. obu.obuId = res[1].substring(20, 36);
  239. obu.vin = res[1].substring(18, 20);
  240. obu.version = res[1].substring(18, 19) >= 4 ? "4x" : "2x";
  241. getInstallApply()
  242. // cmdRandNum = res[2].substring(0, res[2].length - 4);
  243. }
  244. });
  245. };
  246. /**
  247. * BDS-安装申请 请求
  248. */
  249. const getInstallApply = () => {
  250. console.log('======安装申请======')
  251. tools.showLoadingAlert("加载中");
  252. let options = {
  253. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  254. data: {
  255. obuId: obu.obuId,
  256. vehicleId: orderInfos.vehiclePlate + "_" + orderInfos.vehiclePlateColor,
  257. orderId: orderInfos.orderId,
  258. agentId: "52010106004",
  259. channelId: "5201010200601130001",
  260. channelType: "1",
  261. staffId: "opId",
  262. terminalId: "999999999",
  263. }, //请求参数
  264. method: "POST", //提交方式(默认POST)
  265. showLoading: true, //是否显示加载中(默认显示)
  266. };
  267. //调用方式
  268. request(IFCODE.installApply, options)
  269. .then(() => {
  270. tools.hideLoadingAlert();
  271. // //再次获取随机数
  272. // let cmdArr = [cmd.HOME_DIRECTORY, cmd.RANDOM_NUMBER];
  273. // bluetoothUtil.transCmd(cmdArr, '20', function(res) {
  274. // var str = res[1].substring(res[1].length - 4, res[1].length);
  275. // if (str == "9000") {
  276. // cmdRandNum = res[1].substring(0, res[1].length - 4);
  277. // getObuActivation(cmdRandNum);
  278. // } else {
  279. // tools.alertF("RANDOM_NUMBER指令长度不符" + res[1]);
  280. // }
  281. // })
  282. //再次获取随机数
  283. let cmdArr = [cmd.HOME_DIRECTORY, cmd.RANDOM_NUMBER];
  284. bluetoothUtil.transCmd(cmdArr, '20', function(res) {
  285. var str = res[1].substring(res[1].length - 4, res[1].length);
  286. if (str == "9000") {
  287. let cmdRandNum = res[1].substring(0, res[1].length - 4);
  288. getObuActivation(cmdRandNum);
  289. } else {
  290. tools.alertF("RANDOM_NUMBER指令长度不符" + res[1]);
  291. }
  292. })
  293. })
  294. };
  295. /**
  296. * VFJ-OBU在线激活 请求
  297. */
  298. const getObuActivation = (cmdRandNum:string) => {
  299. console.log('======VFJ-OBU在线激活======')
  300. tools.showLoadingAlert("加载中");
  301. let options = {
  302. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  303. data: {
  304. random: cmdRandNum,
  305. obuSerailNo: obu.obuId,
  306. orderId: orderInfos.orderId,
  307. }, //请求参数
  308. method: "POST", //提交方式(默认POST)
  309. showLoading: true, //是否显示加载中(默认显示)
  310. };
  311. //调用方式
  312. request(IFCODE.obuActivation, options)
  313. .then((res) => {
  314. tools.hideLoadingAlert();
  315. console.log("在线激活 请求");
  316. console.log(stringToJson(res.bizContent));
  317. const datas = stringToJson(res.bizContent);
  318. tools.showLoadingAlert("执行指令");
  319. bluetoothUtil.transCmd([datas.data.APDU], "20", function(res) {
  320. tools.hideLoadingAlert();
  321. console.log(res);
  322. if (res[0] == "9000") {
  323. console.log("在线激活执行指令88888 请求", res);
  324. getObuInstall(0, ""); //status 0 - 安装成功 || 1 - 安装失败
  325. }
  326. });
  327. })
  328. .catch((err) => {
  329. console.log(err);
  330. });
  331. };
  332. /**
  333. * BDS-安装确认 请求
  334. */
  335. const getObuInstall = (status:number, reason:string) => {
  336. console.log('======OBU安装确认======')
  337. tools.showLoadingAlert("加载中");
  338. let options = {
  339. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  340. data: {
  341. installStatus: status,
  342. failReason: reason,
  343. installType: "1",
  344. installChannelId: "5201010200601130001",
  345. obuId: obu.obuId,
  346. orderId: orderInfos.orderId
  347. }, //请求参数
  348. method: "POST", //提交方式(默认POST)
  349. showLoading: true, //是否显示加载中(默认显示)
  350. };
  351. //调用方式
  352. request(IFCODE.obuInstall, options)
  353. .then(() => {
  354. tools.hideLoadingAlert();
  355. state.showPopup = true;
  356. });
  357. };
  358. </script>
  359. <style>
  360. page {
  361. width: 100%;
  362. height: 100%;
  363. background-color: #fff;
  364. }
  365. </style>
  366. <style lang="scss" scoped>
  367. .mask{
  368. background: rgba(0, 0, 0, .35);
  369. position: fixed;
  370. left: 0;
  371. top: 0;
  372. bottom: 0;
  373. right: 0;
  374. }
  375. .main{
  376. width: 560rpx;
  377. padding: 25rpx 20rpx 55rpx;
  378. text-align: center;
  379. background: #fff;
  380. position: absolute;
  381. left: 50%;
  382. top: 50%;
  383. transform: translate(-50%,-50%);
  384. border-radius: 20rpx;
  385. .top{
  386. text-align: right;
  387. .icon-close{
  388. width: 48rpx;
  389. height: 48rpx;
  390. }
  391. }
  392. .icon-success{
  393. width: 500rpx;
  394. height: 320rpx;
  395. margin-top: 22rpx;
  396. }
  397. .title{
  398. color: #333333;
  399. font-size: 40rpx;
  400. font-weight: 600;
  401. text-align: center;
  402. margin-top: 55rpx;
  403. }
  404. }
  405. .selectCar-box {
  406. // width: 100%;
  407. // height: 100%;
  408. padding: 30rpx;
  409. .title {
  410. font-size: 30rpx;
  411. font-family: Microsoft YaHei UI;
  412. font-weight: 400;
  413. color: #333333;
  414. margin-bottom: 30rpx;
  415. }
  416. .details {
  417. .title {
  418. font-size: 30rpx;
  419. font-family: Microsoft YaHei UI;
  420. font-weight: 400;
  421. color: #333333;
  422. margin-bottom: 30rpx;
  423. }
  424. .details-item {
  425. display: flex;
  426. font-size: 26rpx;
  427. font-family: Noto Sans S Chinese;
  428. font-weight: 400;
  429. color: #999999;
  430. margin-bottom: 30rpx;
  431. text {
  432. font-size: 26rpx;
  433. font-family: Noto Sans S Chinese;
  434. font-weight: 400;
  435. color: #333333;
  436. }
  437. }
  438. }
  439. .card {
  440. height: 150rpx;
  441. background: #ffffff;
  442. box-shadow: 0rpx 4rpx 13rpx 3rpx rgba(223, 223, 223, 0.8);
  443. border-radius: 20rpx;
  444. padding: 30rpx;
  445. display: flex;
  446. justify-content: space-between;
  447. align-items: center;
  448. margin-bottom: 60rpx;
  449. .card-left {
  450. display: flex;
  451. align-items: center;
  452. image {
  453. width: 100rpx;
  454. height: 90rpx;
  455. }
  456. .card-center {
  457. margin-left: 30rpx;
  458. .card-center-head {
  459. font-size: 32rpx;
  460. font-family: Noto Sans S Chinese;
  461. font-weight: 400;
  462. color: #333333;
  463. }
  464. .tips {
  465. font-size: 26rpx;
  466. font-family: Noto Sans S Chinese;
  467. font-weight: 400;
  468. color: #666666;
  469. .tips-card {
  470. width: 70rpx;
  471. height: 40rpx;
  472. background: #d3f2ef;
  473. border-radius: 6rpx;
  474. font-size: 20rpx;
  475. font-family: Noto Sans S Chinese;
  476. font-weight: 400;
  477. color: #0a8f8a;
  478. padding: 5rpx 10rpx;
  479. margin-left: 20rpx;
  480. }
  481. }
  482. }
  483. }
  484. .choose-item {
  485. margin-right: 20rpx;
  486. /* width: 50rpx; */
  487. // height: 50rpx;
  488. /* border: 1rpx solid #00B38B; */
  489. border-radius: 50%;
  490. // display: flex;
  491. // justify-content: center;
  492. // align-items: center;
  493. font-size: 25rpx;
  494. // align-self: end;
  495. .active {
  496. width: 38rpx;
  497. height: 38rpx;
  498. background: #00b38b;
  499. border-radius: 50%;
  500. }
  501. }
  502. }
  503. .remark {
  504. font-size: 26rpx;
  505. font-family: Microsoft YaHei UI;
  506. font-weight: 400;
  507. color: #666666;
  508. text-indent: 30rpx;
  509. margin-bottom: 30rpx;
  510. }
  511. .submit {
  512. margin-top: 100rpx;
  513. width: 670rpx;
  514. height: 80rpx;
  515. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  516. border-radius: 40rpx;
  517. font-size: 32rpx;
  518. font-family: Noto Sans S Chinese;
  519. font-weight: 400;
  520. color: #ffffff;
  521. line-height: 80rpx;
  522. }
  523. }
  524. </style>