選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

activate.vue 12KB

11ヶ月前
11ヶ月前
8ヶ月前
8ヶ月前
1年前
8ヶ月前
1年前
1年前
1年前
11ヶ月前
11ヶ月前
10ヶ月前
8ヶ月前
10ヶ月前
11ヶ月前
8ヶ月前
11ヶ月前
10ヶ月前
11ヶ月前
8ヶ月前
11ヶ月前
8ヶ月前
11ヶ月前
8ヶ月前
11ヶ月前
8ヶ月前
11ヶ月前
11ヶ月前
11ヶ月前
11ヶ月前
11ヶ月前
10ヶ月前
11ヶ月前
8ヶ月前
1年前
8ヶ月前
11ヶ月前
11ヶ月前
11ヶ月前
11ヶ月前
1年前
1年前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505
  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 class="info_plate">
  26. <text>收费车型</text>
  27. <text>{{ fileDataStrings.vehicleClassStr }}</text>
  28. </view>
  29. </view>
  30. <view class="up_btn" v-if="state.showBtn">
  31. <button aria-disabled="true" @click="btn" v-if="!state.isSuccess" :class="state.disabled?'button':'hui'">
  32. 点击开始激活
  33. </button>
  34. <button aria-disabled="true" @click="back" v-else>
  35. 点击返回首页
  36. </button>
  37. </view>
  38. </view>
  39. <!-- 激活成功popup -->
  40. <u-popup v-model="state.showPopup" mode="center">
  41. <active-success @cancel="state.showPopup = false"></active-success>
  42. </u-popup>
  43. </template>
  44. <script setup>
  45. import {
  46. reactive,
  47. ref
  48. } from "vue";
  49. import {
  50. formatTime,
  51. formatTime2,
  52. expireDate,
  53. expireDate2,
  54. getFormatDate,
  55. msg
  56. } from "@/utils/utils";
  57. import {
  58. onLoad
  59. } from '@dcloudio/uni-app'
  60. import {
  61. getItem
  62. } from "@/utils/storage";
  63. import {
  64. request, requestNew
  65. } from "@/utils/network/request.js";
  66. import {
  67. IntegerToHexString,
  68. AsciToHexString,
  69. } from "@/utils/util/fileData.js";
  70. import {
  71. stringToJson
  72. } from "@/utils/network/encryption.js";
  73. import * as IFCODE from "@/utils/network/api.js";
  74. import {
  75. issueApply,issueCallback
  76. } from "@/utils/network/api";
  77. import {
  78. agentId
  79. } from "@/utils/network/difference";
  80. const cmd = require("../../../static/etcUtil/cmdConfig.js");
  81. const tools = require("../../../static/etcUtil/tools.js");
  82. const bluetoothUtil = require("../../../static/etcUtil/index.js");
  83. import activeSuccess from "./components/popup-device-active-success";
  84. import {
  85. getVehiclePlateColor
  86. } from "@/datas/vehiclePlateColor";
  87. import {
  88. searchVehicleInfoQuery
  89. } from "@/subpackage/after-sale/js/publicRequest";
  90. import {
  91. channelId
  92. } from "@/utils/network/difference";
  93. import {
  94. orderDetailQuery
  95. } from "@/utils/network/api.js";
  96. const state = reactive({
  97. orderId: "",
  98. id: "",
  99. cardStatus: "",
  100. obuStatus: "",
  101. isSuccess: false, //是否激活成功
  102. showPopup: false,
  103. transfer: 0, //0 是原来的激活 1 是过户激活
  104. showBtn: true,
  105. disabled: true
  106. })
  107. let snums = 0
  108. onLoad((option) => {
  109. //读取传入 存储的数据orderInfo
  110. let orderData = getItem("orderInfo");
  111. state.id = orderData.id;
  112. state.orderId = orderData.orderId;
  113. console.log(state);
  114. state.transfer = Number(option.transfer)
  115. //获取订单详情
  116. getOrderDetails(state.id);
  117. console.log("state.transfer", state.transfer, state.transfer == 0, state.transfer == 1)
  118. })
  119. const card = reactive({
  120. cardId: "",
  121. netId: "",
  122. cardType: "",
  123. startTime: "",
  124. endTime: "",
  125. userName: "",
  126. idNum: "",
  127. vehiclePlate: "",
  128. vehiclePlateColor: "",
  129. color: "",
  130. version: "",
  131. type: "",
  132. favourable: "",
  133. money: "",
  134. v_userType: "",
  135. });
  136. const obu = reactive({
  137. obuId: "",
  138. startTime: "",
  139. endTime: "",
  140. version: "",
  141. approvedCount: "",
  142. axleCount: "",
  143. axleDistance: "",
  144. engineNum: "",
  145. type: "",
  146. userType: "",
  147. contractNo: "",
  148. vehiclePlate: "",
  149. vehiclePlateColor: "",
  150. vin: "",
  151. wheelCount: 0,
  152. isJH: ""
  153. });
  154. let cmdRandNum = '';
  155. let orderInfo = {};
  156. const fileDataStrings = reactive({
  157. approvedCount: 0, //核载人数
  158. cardId: "", //卡号
  159. obuId: "", //obu号
  160. obuId: "", //obu号
  161. packageNum: "", //套餐编号
  162. axleCount: 0, //轴数
  163. axleDistance: "", //轴距
  164. engineNum: "", //发动机
  165. vehicleVin: "",
  166. vehicleEngineNum: "",
  167. cardStatus: "",
  168. obuStatus: "",
  169. type: 0, //类型
  170. userType: 0, //用户类型
  171. vehiclePlate: "", //车牌
  172. vehiclePlateColor: 0, //车牌颜色
  173. vehicleDimensions: "",
  174. wheelCount: 0, //车轮数
  175. vehicleIdNo: "", //车牌号
  176. vehiclePlateColorStr: "",
  177. customerTel: "",
  178. customerId: "",
  179. orderId: "",
  180. vehicleClassStr: ""
  181. });
  182. // 卡签版本校验接口
  183. function versionVerification(transOrderId, cmd, cmdResult, stepNo){
  184. tools.showLoadingAlert('正在激活,请等待')
  185. const options = {
  186. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  187. showLoading: false,
  188. data: {
  189. transOrderId, //步骤号
  190. cmd,
  191. cmdResult,
  192. stepNo
  193. }, //请求参数
  194. method: "POST", //提交方式(默认POST)
  195. };
  196. console.log("options2222", options)
  197. //卡签版本校验接口
  198. request(IFCODE.versionVerificationApi, options)
  199. .then((res) => {
  200. console.log(stringToJson(res.bizContent));
  201. const datas = stringToJson(res.bizContent).data;
  202. console.log("在线激活 请求", datas,datas.stepNo,datas.stepNo == 100);
  203. if (datas.stepNo == 100) {
  204. console.log("陈工")
  205. cmdResult1()
  206. } else {
  207. console.log("datas.stepNo", datas.stepNo)
  208. bluetoothUtil.transCmd(datas.cmd.split(','), datas.cmdType == 'CARD' ? '10' : '20', function(res) {
  209. versionVerification(datas.transOrderId, datas.cmd, res.toString(), datas.stepNo)
  210. }, () => {
  211. tools.hideLoadingAlert();
  212. });
  213. }
  214. })
  215. .catch((err) => {
  216. console.log(err);
  217. tools.hideLoadingAlert();
  218. });
  219. }
  220. function cmdResult1() {
  221. const options = {
  222. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  223. showLoading: false,
  224. data: {
  225. orderId: orderInfo.orderNo,
  226. issueType: state.transfer ? 2 : 1 //1正常激活 2 过户激活
  227. }, //请求参数
  228. method: "POST", //提交方式(默认POST)
  229. };
  230. console.log("options==", options)
  231. //BDS-二发指令申请
  232. requestNew(issueApply, options)
  233. .then((res) => {
  234. console.log("在线激活 请求");
  235. console.log(res);
  236. const datas =res;
  237. bluetoothUtil.transCmd(datas.cmd.split(','), datas.cmdType == 'CARD' ? '10' : '20', function(res) {
  238. implementCmd(datas.transOrderId, datas.cmd, res.toString(), datas.stepNo)
  239. }, () => {
  240. showModals('在线激活异常')
  241. tools.hideLoadingAlert();
  242. });
  243. })
  244. .catch((err) => {
  245. console.log(err);
  246. tools.hideLoadingAlert();
  247. });
  248. }
  249. function implementCmd(transOrderId, cmd, cmdResult, stepNo) {
  250. const options = {
  251. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  252. showLoading: false,
  253. data: {
  254. transOrderId, //步骤号
  255. cmd,
  256. cmdResult,
  257. stepNo
  258. }, //请求参数
  259. method: "POST", //提交方式(默认POST)
  260. };
  261. console.log("options2222", options)
  262. //BDS-二发指令回传
  263. requestNew(issueCallback, options)
  264. .then((res) => {
  265. console.log(res);
  266. const datas = res.data;
  267. console.log("在线激活 请求", datas);
  268. if (datas.stepNo == 100) {
  269. state.disabled = true
  270. tools.hideLoadingAlert();
  271. msg("激活成功", {
  272. 'icon': 'success',
  273. 'duration': 3000
  274. })
  275. setTimeout(() => {
  276. uni.navigateTo({
  277. url: "/subpackage/after-sale/deviceInfo/deviceInfo",
  278. });
  279. }, 3000)
  280. } else {
  281. console.log("datas.stepNo", datas.stepNo)
  282. bluetoothUtil.transCmd(datas.cmd.split(','), datas.cmdType == 'CARD' ? '10' : '20', function(res) {
  283. implementCmd(transOrderId, datas.cmd, res.toString(), datas.stepNo)
  284. }, () => {
  285. showModals('在线激活异常')
  286. });
  287. }
  288. })
  289. .catch((err) => {
  290. console.log(err);
  291. tools.hideLoadingAlert();
  292. });
  293. }
  294. //开始激活 按钮事件
  295. const btn = () => {
  296. state.disabled = false
  297. console.log('orderInfo参数', orderInfo, state.disabled)
  298. versionVerification('','','',1)
  299. };
  300. //获取订单详情
  301. const getOrderDetails = (id) => {
  302. console.log('======获取订单信息======')
  303. const options = {
  304. type: 2,
  305. data: {
  306. id: id,
  307. },
  308. method: "POST",
  309. showLoading: false,
  310. };
  311. state.disabled = false
  312. requestNew(orderDetailQuery, options).then((res) => {
  313. console.log("orderInfo", res);
  314. orderInfo = res.data;
  315. console.log("orderInfores", res);
  316. if (orderInfo) {
  317. fileDataStrings.userType = orderInfo.userType; //用户类型
  318. fileDataStrings.cardId = orderInfo.cardId;
  319. fileDataStrings.packageNum = orderInfo.packageNum;
  320. fileDataStrings.obuId = orderInfo.obuId;
  321. fileDataStrings.customerTel = orderInfo.customerTel;
  322. fileDataStrings.customerId = orderInfo.customerId;
  323. fileDataStrings.orderId = orderInfo.orderNo;
  324. fileDataStrings.vehiclePlateColorStr = getVehiclePlateColor(orderInfo
  325. .vehiclePlateColor);
  326. fileDataStrings.vehiclePlate = orderInfo.vehiclePlate; //车牌
  327. fileDataStrings.vehicleClassStr = orderInfo.vehicleClassStr;
  328. }
  329. });
  330. getObuId();
  331. };
  332. /**
  333. * 获取OBU号 读OBU
  334. */
  335. const getObuId = () => {
  336. console.log('======获取OBU号======')
  337. let cmdArray = [cmd.HOME_DIRECTORY, cmd.OBU_SYSTEM_FILE, cmd.RANDOM_NUMBER];
  338. // tools.showLoadingAlert("正在执行指令");
  339. bluetoothUtil.transCmd(cmdArray, "20", function(res) {
  340. // tools.hideLoadingAlert();
  341. var status = res[1].substring(res[1].length - 4, res[1].length);
  342. console.log('获取OBU号执行结果' + status, res)
  343. //第一次获取随机数
  344. if (status == "9000") {
  345. state.disabled = true
  346. obu.obuId = res[1].substring(20, 36);
  347. obu.vin = res[1].substring(18, 20);
  348. obu.version = res[1].substring(18, 19) >= 4 ? "4x" : "2x";
  349. cmdRandNum = res[2].substring(0, res[2].length - 4);
  350. state.showBtn = true
  351. } else {
  352. showModals('获取设备信息错误!')
  353. }
  354. }, () => {
  355. showModals('获取设备信息错误')
  356. });
  357. };
  358. function showModals(msg) {
  359. uni.showModal({
  360. title: '提示',
  361. content: msg,
  362. showCancel: false,
  363. success: function(res) {
  364. if (res.confirm) {
  365. uni.navigateBack()
  366. console.log('用户点击确定1');
  367. } else if (res.cancel) {
  368. console.log('用户点击取消1');
  369. }
  370. }
  371. });
  372. }
  373. const back = () => {
  374. uni.switchTab({
  375. url: "/pages/index/index"
  376. });
  377. }
  378. </script>
  379. <style>
  380. .containers {
  381. height: 100%;
  382. display: flex;
  383. flex-direction: column;
  384. align-items: center;
  385. justify-content: space-between;
  386. box-sizing: border-box;
  387. }
  388. .sec_info {
  389. width: 90%;
  390. height: auto;
  391. margin: 0 auto;
  392. box-shadow: 0rpx 6rpx 25rpx 0rpx rgba(0, 0, 0, 0.2);
  393. margin-top: 50rpx;
  394. border-radius: 20rpx;
  395. }
  396. .info_txt {
  397. width: 100%;
  398. height: 120rpx;
  399. line-height: 120rpx;
  400. text-align: center;
  401. color: #000;
  402. font-size: 36rpx;
  403. margin-bottom: 20rpx;
  404. }
  405. .info_plate {
  406. display: flex;
  407. flex-direction: row;
  408. width: 94%;
  409. height: 100rpx;
  410. margin: 0 auto;
  411. border-bottom: 2rpx solid #f2f2f2;
  412. }
  413. .info_plate text:nth-child(1) {
  414. height: 100rpx;
  415. text-align: left;
  416. line-height: 100rpx;
  417. font-size: 32rpx;
  418. color: #999;
  419. }
  420. .info_plate text:nth-child(2) {
  421. flex: 1;
  422. height: 100rpx;
  423. line-height: 100rpx;
  424. font-size: 32rpx;
  425. color: #333;
  426. margin-left: 50rpx;
  427. text-align: right;
  428. }
  429. /*提交按钮样式*/
  430. .up_btn {
  431. width: 85%;
  432. height: 100rpx;
  433. margin: 0 auto;
  434. margin-top: 50rpx;
  435. margin-bottom: 100rpx;
  436. }
  437. .up_btn button {
  438. width: 100%;
  439. height: 80rpx;
  440. line-height: 80rpx;
  441. color: white;
  442. font-size: 32rpx;
  443. text-align: center;
  444. background: linear-gradient(to left, #43a1e0 0%, #13e7c1 100%);
  445. border-radius: 40rpx;
  446. outline: none;
  447. border: #4cd95f;
  448. }
  449. .button {
  450. width: 100%;
  451. height: 80rpx;
  452. line-height: 80rpx;
  453. color: white;
  454. font-size: 32rpx;
  455. text-align: center;
  456. background: linear-gradient(to left, #43a1e0 0%, #13e7c1 100%);
  457. border-radius: 40rpx;
  458. outline: none;
  459. border: #4cd95f;
  460. }
  461. .hui {
  462. width: 100%;
  463. height: 80rpx;
  464. line-height: 80rpx;
  465. color: white;
  466. font-size: 32rpx;
  467. text-align: center;
  468. background: linear-gradient(to left, #b9b9b9 0%, #e7e7e7 100%) !important;
  469. border-radius: 40rpx;
  470. outline: none;
  471. border: #4cd95f;
  472. }
  473. .up_btn button[disabled] {
  474. background-color: rgba(0, 191, 112, 0.5);
  475. color: white;
  476. font-size: 34rpx;
  477. border-radius: 20rpx;
  478. }
  479. </style>