Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

activation-once-again.vue 13KB

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