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.

activation-once-again.vue 14KB

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