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ů.

activation-once-again.vue 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548
  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>{{ getCodeName('CERTIFICATE_TYPE',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">{{getCodeName('CARD_STATE_TYPE',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">{{getCodeName('OBU_STATE_TYPE',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. request
  94. } from "@/utils/network/request.js";
  95. import {
  96. stringToJson
  97. } from "@/utils/network/encryption.js";
  98. import activeSuccess from "./components/popup-device-active-success";
  99. import * as IFCODE from "@/utils/network/api.js";
  100. import {
  101. channelId
  102. } from "@/utils/network/difference";
  103. const cmd = require("../../../static/etcUtil/cmdConfig.js");
  104. const tools = require("../../../static/etcUtil/tools.js");
  105. const bluetoothUtil = require("../../../static/etcUtil/index.js");
  106. import {
  107. getCodeName
  108. } from "@/datas/queryKey.js";
  109. import { agentId } from "@/utils/network/difference";
  110. const state = reactive({
  111. showPopup: false
  112. })
  113. //订单
  114. const orderInfos = reactive({
  115. orderId: "",
  116. ownerName: "",
  117. ownerIdtype: "",
  118. ownerIdnum: "",
  119. vehiclePlate: "",
  120. vehiclePlateColorStr: "",
  121. vehiclePlateColor: "",
  122. vehicleType: "",
  123. cardId: "",
  124. cardStatus: "",
  125. obuId: "",
  126. obuStatus: "",
  127. outlineL: 0,
  128. outlineW: 0,
  129. outlineH: 0,
  130. type: 0,
  131. axleCount: 0,
  132. approvedCount: 0,
  133. vehicleVin: "",
  134. vehicleEngineNum: "",
  135. });
  136. //OBU
  137. const obu = reactive({
  138. obuId: "",
  139. startTime: "",
  140. endTime: "",
  141. version: "",
  142. approvedCount: "",
  143. axleCount: "",
  144. axleDistance: "",
  145. engineNum: "",
  146. type: "",
  147. userType: "",
  148. contractNo: "",
  149. vehiclePlate: "",
  150. vehiclePlateColor: "",
  151. vin: "",
  152. wheelCount: "",
  153. isJH: ""
  154. });
  155. onLoad((option) => {
  156. console.log('======重新激活开始======', option);
  157. //请求订单详情
  158. queryOrderDetail(option.id);
  159. });
  160. onShow((option) => {
  161. uni.$on('bluetoothLink', res => {
  162. console.log(res);
  163. if (res.status) {
  164. // getCardRenewal()
  165. getObuId()
  166. }
  167. //移除监听
  168. console.log('======移除监听======', res)
  169. // uni.$off('bluetoothLink')
  170. })
  171. })
  172. const cancel = () => {
  173. state.showPopup = false;
  174. uni.navigateBack({
  175. delta: 2
  176. })
  177. };
  178. const toPage = () => {
  179. navTo("/pages/bluetooth/bluetooth?routeType=5");
  180. };
  181. //获取订单详情
  182. const queryOrderDetail = (id : string) => {
  183. const options = {
  184. type: 2,
  185. data: {
  186. id: id,
  187. },
  188. method: "POST",
  189. showLoading: true,
  190. };
  191. request(IFCODE.orderDetail, options).then((res) => {
  192. let orderInfo = JSON.parse(res.bizContent);
  193. console.log(orderInfo);
  194. orderInfos.orderId = orderInfo.orderId;
  195. orderInfos.ownerName = orderInfo.ownerName;
  196. orderInfos.ownerIdtype = orderInfo.ownerIdtype;
  197. orderInfos.ownerIdnum = orderInfo.ownerIdnum;
  198. orderInfos.vehiclePlate = orderInfo.vehiclePlate;
  199. orderInfos.vehiclePlateColorStr = orderInfo.vehiclePlateColorStr;
  200. orderInfos.vehiclePlateColor = orderInfo.vehiclePlateColor;
  201. orderInfos.vehicleType = orderInfo.vehicleType;
  202. orderInfos.cardId = orderInfo.cardId;
  203. orderInfos.cardStatus = orderInfo.cardStatus;
  204. orderInfos.obuId = orderInfo.obuId;
  205. orderInfos.obuStatus = orderInfo.obuStatus;
  206. let arr = orderInfo.vehicleDimensions.split("x");
  207. orderInfos.outlineL = parseInt(arr[0]); //外廓 长
  208. orderInfos.outlineW = parseInt(arr[1]); //外廓 宽
  209. orderInfos.outlineH = parseInt(arr[2].substring(0, arr[2].length - 2)); //外廓 高
  210. orderInfos.type = orderInfo.type;
  211. orderInfos.axleCount = orderInfo.vehicleAxleCount;
  212. orderInfos.approvedCount = orderInfo.vehicleApprovedCount;
  213. orderInfos.vehicleVin = orderInfo.vehicleVin;
  214. orderInfos.vehicleEngineNum = orderInfo.vehicleEngineNum;
  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. getInstallApply()
  234. // cmdRandNum = res[2].substring(0, res[2].length - 4);
  235. }
  236. });
  237. };
  238. /**
  239. * BDS-安装申请 请求
  240. */
  241. const getInstallApply = () => {
  242. console.log('======安装申请======')
  243. tools.showLoadingAlert("加载中");
  244. let options = {
  245. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  246. data: {
  247. obuId: obu.obuId,
  248. vehicleId: orderInfos.vehiclePlate + "_" + orderInfos.vehiclePlateColor,
  249. orderId: orderInfos.orderId,
  250. agentId: agentId,
  251. channelId: channelId,
  252. channelType: "1",
  253. staffId: "opId",
  254. terminalId: "999999999",
  255. }, //请求参数
  256. method: "POST", //提交方式(默认POST)
  257. showLoading: true, //是否显示加载中(默认显示)
  258. };
  259. //调用方式
  260. request(IFCODE.installApply, options)
  261. .then(() => {
  262. tools.hideLoadingAlert();
  263. //再次获取随机数
  264. let cmdArr = [cmd.HOME_DIRECTORY, cmd.RANDOM_NUMBER];
  265. bluetoothUtil.transCmd(cmdArr, '20', function (res) {
  266. var str = res[1].substring(res[1].length - 4, res[1].length);
  267. if (str == "9000") {
  268. let cmdRandNum = res[1].substring(0, res[1].length - 4);
  269. getObuActivation(cmdRandNum);
  270. } else {
  271. tools.alertF("RANDOM_NUMBER指令长度不符" + res[1]);
  272. }
  273. })
  274. })
  275. };
  276. /**
  277. * VFJ-OBU在线激活 请求
  278. */
  279. const getObuActivation = (cmdRandNum : string) => {
  280. console.log('======VFJ-OBU在线激活======')
  281. tools.showLoadingAlert("加载中");
  282. let options = {
  283. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  284. data: {
  285. random: cmdRandNum,
  286. obuSerailNo: obu.obuId,
  287. orderId: orderInfos.orderId,
  288. }, //请求参数
  289. method: "POST", //提交方式(默认POST)
  290. showLoading: true, //是否显示加载中(默认显示)
  291. };
  292. //调用方式
  293. request(IFCODE.obuActivation, options)
  294. .then((res) => {
  295. tools.hideLoadingAlert();
  296. console.log("在线激活 请求");
  297. console.log(stringToJson(res.bizContent));
  298. const datas = stringToJson(res.bizContent);
  299. tools.showLoadingAlert("执行指令");
  300. bluetoothUtil.transCmd([datas.data.APDU], "20", function (res) {
  301. tools.hideLoadingAlert();
  302. console.log(res);
  303. if (res[0] == "9000") {
  304. console.log("在线激活执行指令88888 请求", res);
  305. getObuInstall(0, ""); //status 0 - 安装成功 || 1 - 安装失败
  306. }
  307. });
  308. })
  309. .catch((err) => {
  310. console.log(err);
  311. });
  312. };
  313. /**
  314. * BDS-安装确认 请求
  315. */
  316. const getObuInstall = (status : number, reason : string) => {
  317. console.log('======OBU安装确认======')
  318. tools.showLoadingAlert("加载中");
  319. let options = {
  320. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  321. data: {
  322. installStatus: status,
  323. failReason: reason,
  324. installType: "1",
  325. installChannelId: channelId,
  326. obuId: obu.obuId,
  327. orderId: orderInfos.orderId
  328. }, //请求参数
  329. method: "POST", //提交方式(默认POST)
  330. showLoading: true, //是否显示加载中(默认显示)
  331. };
  332. //调用方式
  333. request(IFCODE.obuInstall, options)
  334. .then(() => {
  335. tools.hideLoadingAlert();
  336. state.showPopup = true;
  337. });
  338. };
  339. </script>
  340. <style>
  341. page {
  342. width: 100%;
  343. height: 100%;
  344. background-color: #fff;
  345. }
  346. </style>
  347. <style lang="scss" scoped>
  348. .mask {
  349. background: rgba(0, 0, 0, .35);
  350. position: fixed;
  351. left: 0;
  352. top: 0;
  353. bottom: 0;
  354. right: 0;
  355. }
  356. .main {
  357. width: 560rpx;
  358. padding: 25rpx 20rpx 55rpx;
  359. text-align: center;
  360. background: #fff;
  361. position: absolute;
  362. left: 50%;
  363. top: 50%;
  364. transform: translate(-50%, -50%);
  365. border-radius: 20rpx;
  366. .top {
  367. text-align: right;
  368. .icon-close {
  369. width: 48rpx;
  370. height: 48rpx;
  371. }
  372. }
  373. .icon-success {
  374. width: 500rpx;
  375. height: 320rpx;
  376. margin-top: 22rpx;
  377. }
  378. .title {
  379. color: #333333;
  380. font-size: 40rpx;
  381. font-weight: 600;
  382. text-align: center;
  383. margin-top: 55rpx;
  384. }
  385. }
  386. .selectCar-box {
  387. // width: 100%;
  388. // height: 100%;
  389. padding: 30rpx;
  390. .title {
  391. font-size: 30rpx;
  392. font-family: Microsoft YaHei UI;
  393. font-weight: 400;
  394. color: #333333;
  395. margin-bottom: 30rpx;
  396. }
  397. .details {
  398. .title {
  399. font-size: 30rpx;
  400. font-family: Microsoft YaHei UI;
  401. font-weight: 400;
  402. color: #333333;
  403. margin-bottom: 30rpx;
  404. }
  405. .details-item {
  406. display: flex;
  407. font-size: 26rpx;
  408. font-family: Noto Sans S Chinese;
  409. font-weight: 400;
  410. color: #999999;
  411. margin-bottom: 30rpx;
  412. text {
  413. font-size: 26rpx;
  414. font-family: Noto Sans S Chinese;
  415. font-weight: 400;
  416. color: #333333;
  417. }
  418. }
  419. }
  420. .card {
  421. height: 150rpx;
  422. background: #ffffff;
  423. box-shadow: 0rpx 4rpx 13rpx 3rpx rgba(223, 223, 223, 0.8);
  424. border-radius: 20rpx;
  425. padding: 30rpx;
  426. display: flex;
  427. justify-content: space-between;
  428. align-items: center;
  429. margin-bottom: 60rpx;
  430. .card-left {
  431. display: flex;
  432. align-items: center;
  433. image {
  434. width: 100rpx;
  435. height: 90rpx;
  436. }
  437. .card-center {
  438. margin-left: 30rpx;
  439. .card-center-head {
  440. font-size: 32rpx;
  441. font-family: Noto Sans S Chinese;
  442. font-weight: 400;
  443. color: #333333;
  444. }
  445. .tips {
  446. font-size: 26rpx;
  447. font-family: Noto Sans S Chinese;
  448. font-weight: 400;
  449. color: #666666;
  450. .tips-card {
  451. width: 70rpx;
  452. height: 40rpx;
  453. background: #d3f2ef;
  454. border-radius: 6rpx;
  455. font-size: 20rpx;
  456. font-family: Noto Sans S Chinese;
  457. font-weight: 400;
  458. color: #0a8f8a;
  459. padding: 5rpx 10rpx;
  460. margin-left: 20rpx;
  461. }
  462. }
  463. }
  464. }
  465. .choose-item {
  466. margin-right: 20rpx;
  467. /* width: 50rpx; */
  468. // height: 50rpx;
  469. /* border: 1rpx solid #00B38B; */
  470. border-radius: 50%;
  471. // display: flex;
  472. // justify-content: center;
  473. // align-items: center;
  474. font-size: 25rpx;
  475. // align-self: end;
  476. .active {
  477. width: 38rpx;
  478. height: 38rpx;
  479. background: #00b38b;
  480. border-radius: 50%;
  481. }
  482. }
  483. }
  484. .remark {
  485. font-size: 26rpx;
  486. font-family: Microsoft YaHei UI;
  487. font-weight: 400;
  488. color: #666666;
  489. text-indent: 30rpx;
  490. margin-bottom: 30rpx;
  491. }
  492. .submit {
  493. margin-top: 100rpx;
  494. width: 670rpx;
  495. height: 80rpx;
  496. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  497. border-radius: 40rpx;
  498. font-size: 32rpx;
  499. font-family: Noto Sans S Chinese;
  500. font-weight: 400;
  501. color: #ffffff;
  502. line-height: 80rpx;
  503. }
  504. }
  505. </style>