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.

pin-code-confirm.vue 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512
  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"> 有效期:{{orderInfos.cardEnableTime }}</view>
  47. </view>
  48. </view>
  49. </view>
  50. <button class="submit" @click="toPage" v-show="!state.flag" :disabled="state.disabled">卡PIN码解锁</button>
  51. <button class="submit" @click="toBack" v-show="state.flag">返回服务中心</button>
  52. <view class="mask" v-show="state.showPopup">
  53. <view class="main">
  54. <view class="top">
  55. <image class="icon-close" :src="`${$imgUrl}common/icon-close.png`" @click="cancel"></image>
  56. </view>
  57. <image class="icon-success" :src="`${$imgUrl}bluetooth/device-active-success.png`"></image>
  58. <view class="title">设备升级成功!</view>
  59. </view>
  60. </view>
  61. </view>
  62. </template>
  63. <script setup>
  64. import {
  65. reactive
  66. } from "vue";
  67. import {
  68. navTo,
  69. getFormatDate
  70. } from "@/utils/utils";
  71. import {
  72. onLoad,
  73. onUnload,
  74. onShow
  75. } from "@dcloudio/uni-app";
  76. import {
  77. request
  78. } from "@/utils/network/request.js";
  79. import {
  80. orderDetail,
  81. pinCodeUnlock,
  82. writeCardBack,
  83. cardModifyConfirm
  84. } from "@/utils/network/api.js";
  85. import {
  86. getCredentialType
  87. } from "@/datas/credentialType.js";
  88. import {
  89. getEtcCardStatus
  90. } from "@/datas/etcCardStatus.js";
  91. import {
  92. getObuStatus
  93. } from "@/datas/obuStatus.js";
  94. import {
  95. stringToJson
  96. } from "@/utils/network/encryption";
  97. const tools = require("../../static/etcUtil/tools.js");
  98. const bluetoothUtil = require("../../static/etcUtil/index.js");
  99. const state = reactive({
  100. showPopup: false,
  101. flag: false,
  102. disabled:false,
  103. })
  104. const orderInfos = reactive({
  105. orderId: "",
  106. ownerName: "",
  107. ownerIdtype: "",
  108. ownerIdnum: "",
  109. vehiclePlate: "",
  110. vehiclePlateColorStr: "",
  111. vehiclePlateColor: "",
  112. vehicleType: "",
  113. cardId: "",
  114. cardStatus: "",
  115. obuId: "",
  116. obuStatus: "",
  117. cardEnableTime: "",
  118. obuEnableTime: "",
  119. });
  120. onLoad((option) => {
  121. //请求订单详情
  122. queryOrderDetail(option.id);
  123. });
  124. onShow((option) => {
  125. uni.$on('bluetoothLink', res => {
  126. console.log(res);
  127. if (res.status) {
  128. tools.showLoadingAlert("正在执行指令");
  129. state.disabled = true;
  130. getPinCodeUnlock()
  131. }
  132. })
  133. })
  134. onUnload(() => {
  135. //移除监听
  136. uni.$off('bluetoothLink')
  137. })
  138. //获取订单详情
  139. const queryOrderDetail = (id) => {
  140. const options = {
  141. type: 2,
  142. data: {
  143. id: id,
  144. },
  145. method: "POST",
  146. showLoading: true,
  147. };
  148. request(orderDetail, options).then((res) => {
  149. let orderInfo = JSON.parse(res.bizContent);
  150. console.log(orderInfo);
  151. orderInfos.orderId = orderInfo.orderId;
  152. orderInfos.ownerName = orderInfo.ownerName;
  153. orderInfos.ownerIdtype = orderInfo.ownerIdtype;
  154. orderInfos.ownerIdnum = orderInfo.ownerIdnum;
  155. orderInfos.vehiclePlate = orderInfo.vehiclePlate;
  156. orderInfos.vehiclePlateColorStr = orderInfo.vehiclePlateColorStr;
  157. orderInfos.vehiclePlateColor = orderInfo.vehiclePlateColor;
  158. orderInfos.vehicleType = orderInfo.vehicleType;
  159. orderInfos.cardId = orderInfo.cardId;
  160. orderInfos.cardStatus = orderInfo.cardStatus;
  161. orderInfos.obuId = orderInfo.obuId;
  162. orderInfos.obuStatus = orderInfo.obuStatus;
  163. orderInfos.cardEnableTime = orderInfo.cardEnableTime.substring(0, 10);
  164. orderInfos.obuEnableTime = orderInfo.obuEnableTime.substring(0, 10);
  165. });
  166. };
  167. //PIN解锁 请求
  168. const getPinCodeUnlock = (command=null,cosResponse=null,pinType=null) => {
  169. const options = {
  170. type: 2,
  171. data: {
  172. cardId: orderInfos.cardId,
  173. command:command,
  174. cosResponse:cosResponse,
  175. pinType: pinType,
  176. },
  177. method: "POST",
  178. showLoading: true,
  179. };
  180. request(pinCodeUnlock, options).then((res) => {
  181. tools.hideLoadingAlert();
  182. let result = stringToJson(res.bizContent);
  183. console.log("&&&&&&&&&&&&",result);
  184. let cmdArray = result.command ? result.command.split(",") : "";
  185. if (cmdArray.length > 0) {
  186. tools.showLoadingAlert("正在执行指令");
  187. bluetoothUtil.transCmd(cmdArray, "10", function(res) {
  188. tools.hideLoadingAlert();
  189. let status = res[cmdArray.length - 1].substring(res[cmdArray.length - 1].length -
  190. 4, res[cmdArray.length - 1].length);
  191. if (status == "9000") {
  192. getCommandBack(result.command, result.cosRecordId, res.toString());
  193. }
  194. })
  195. }
  196. })
  197. };
  198. const getCommandBack = (command=null,cosResponse=null,pinType=null) => {
  199. const options = {
  200. type: 2,
  201. data: {
  202. cardId: orderInfos.cardId,
  203. command:command,
  204. cosResponse:cosResponse,
  205. pinType: pinType,
  206. },
  207. method: "POST",
  208. showLoading: true,
  209. };
  210. request(pinCodeUnlock, options).then((res) => {
  211. tools.hideLoadingAlert();
  212. let result = stringToJson(res.bizContent);
  213. console.log("&&&&&&&&&&&&",result);
  214. let cmdArray = result.command ? result.command.split(",") : "";
  215. if (cmdArray.length > 0) {
  216. tools.showLoadingAlert("正在执行指令");
  217. bluetoothUtil.transCmd(cmdArray, "10", function(res) {
  218. tools.hideLoadingAlert();
  219. let status = res[cmdArray.length - 1].substring(res[cmdArray.length - 1].length -
  220. 4, res[cmdArray.length - 1].length);
  221. if (status == "9000") {
  222. state.showPopup = true;
  223. // getCommandBack(result.command, result.cosRecordId, res.toString());
  224. }
  225. })
  226. }
  227. })
  228. };
  229. /**
  230. * 写卡指令返回 请求
  231. */
  232. // const getCommandBack = (command, cosRecordId, response) => {
  233. // console.log('======循环写卡指令中======')
  234. // tools.showLoadingAlert("加载中");
  235. // let options = {
  236. // type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  237. // data: {
  238. // cardId: orderInfos.cardId,
  239. // orderId: orderInfos.orderId,
  240. // command: command,
  241. // response: response,
  242. // cosRecordId: cosRecordId,
  243. // cosType: 2
  244. // }, //请求参数
  245. // method: "POST", //提交方式(默认POST)
  246. // showLoading: true, //是否显示加载中(默认显示)
  247. // };
  248. // //调用方式
  249. // request(writeCardBack, options)
  250. // .then((res) => {
  251. // tools.hideLoadingAlert();
  252. // let result = JSON.parse(res.bizContent);
  253. // if (result.orderStatus == 1 || result.orderStatus == "1") {
  254. // tools.showLoadingAlert("执行指令中");
  255. // bluetoothUtil.transCmd(result.command.split(","), "10", function(res) {
  256. // tools.hideLoadingAlert();
  257. // let response = res.toString();
  258. // getCommandBack(result.command, cosRecordId, response);
  259. // });
  260. // } else {
  261. // getCardModifyConfirm(cosRecordId);
  262. // }
  263. // })
  264. // };
  265. // //卡信息变更确认
  266. // const getCardModifyConfirm = (cosRecordId) => {
  267. // const options = {
  268. // type: 2,
  269. // data: {
  270. // cardId: orderInfos.cardId,
  271. // operation: 4,
  272. // cosRecordId: cosRecordId
  273. // },
  274. // method: "POST",
  275. // showLoading: true,
  276. // };
  277. // request(cardModifyConfirm, options).then((res) => {
  278. // console.log(res);
  279. // state.showPopup = true;
  280. // })
  281. // };
  282. //去连接蓝牙
  283. const toPage = () => {
  284. // getPinCodeUnlock()
  285. navTo("/pages/bluetooth/bluetooth?routeType=5"); //去连接蓝牙
  286. };
  287. //返回列表
  288. const toBack = () => {
  289. // navTo("/pages/service/service")
  290. uni.navigateBack({
  291. delta:2
  292. })
  293. }
  294. //关闭弹窗
  295. const cancel = () => {
  296. state.flag = true;
  297. state.showPopup = false;
  298. }
  299. </script>
  300. <style>
  301. page {
  302. width: 100%;
  303. height: 100%;
  304. background-color: #fff;
  305. }
  306. </style>
  307. <style lang="scss" scoped>
  308. .mask {
  309. background: rgba(0, 0, 0, .35);
  310. position: fixed;
  311. left: 0;
  312. top: 0;
  313. bottom: 0;
  314. right: 0;
  315. }
  316. .main {
  317. width: 560rpx;
  318. padding: 25rpx 20rpx 55rpx;
  319. text-align: center;
  320. background: #fff;
  321. position: absolute;
  322. left: 50%;
  323. top: 50%;
  324. transform: translate(-50%, -50%);
  325. border-radius: 20rpx;
  326. .top {
  327. text-align: right;
  328. .icon-close {
  329. width: 48rpx;
  330. height: 48rpx;
  331. }
  332. }
  333. .icon-success {
  334. width: 500rpx;
  335. height: 320rpx;
  336. margin-top: 22rpx;
  337. }
  338. .title {
  339. color: #333333;
  340. font-size: 40rpx;
  341. font-weight: 600;
  342. text-align: center;
  343. margin-top: 55rpx;
  344. }
  345. }
  346. .selectCar-box {
  347. // width: 100%;
  348. // height: 100%;
  349. padding: 30rpx;
  350. .title {
  351. font-size: 30rpx;
  352. font-family: Microsoft YaHei UI;
  353. font-weight: 400;
  354. color: #333333;
  355. margin-bottom: 30rpx;
  356. }
  357. .details {
  358. .title {
  359. font-size: 30rpx;
  360. font-family: Microsoft YaHei UI;
  361. font-weight: 400;
  362. color: #333333;
  363. margin-bottom: 30rpx;
  364. }
  365. .details-item {
  366. display: flex;
  367. font-size: 26rpx;
  368. font-family: Noto Sans S Chinese;
  369. font-weight: 400;
  370. color: #999999;
  371. margin-bottom: 30rpx;
  372. text {
  373. font-size: 26rpx;
  374. font-family: Noto Sans S Chinese;
  375. font-weight: 400;
  376. color: #333333;
  377. }
  378. }
  379. }
  380. .card {
  381. height: 150rpx;
  382. background: #ffffff;
  383. box-shadow: 0rpx 4rpx 13rpx 3rpx rgba(223, 223, 223, 0.8);
  384. border-radius: 20rpx;
  385. padding: 30rpx;
  386. display: flex;
  387. justify-content: space-between;
  388. align-items: center;
  389. margin-bottom: 60rpx;
  390. .card-left {
  391. display: flex;
  392. align-items: center;
  393. image {
  394. width: 100rpx;
  395. height: 90rpx;
  396. }
  397. .card-center {
  398. margin-left: 30rpx;
  399. .card-center-head {
  400. font-size: 32rpx;
  401. font-family: Noto Sans S Chinese;
  402. font-weight: 400;
  403. color: #333333;
  404. }
  405. .tips {
  406. font-size: 26rpx;
  407. font-family: Noto Sans S Chinese;
  408. font-weight: 400;
  409. color: #666666;
  410. .tips-card {
  411. width: 70rpx;
  412. height: 40rpx;
  413. background: #d3f2ef;
  414. border-radius: 6rpx;
  415. font-size: 20rpx;
  416. font-family: Noto Sans S Chinese;
  417. font-weight: 400;
  418. color: #0a8f8a;
  419. padding: 5rpx 10rpx;
  420. margin-left: 20rpx;
  421. }
  422. }
  423. }
  424. }
  425. .choose-item {
  426. margin-right: 20rpx;
  427. /* width: 50rpx; */
  428. height: 50rpx;
  429. /* border: 1rpx solid #00B38B; */
  430. border-radius: 50%;
  431. display: flex;
  432. justify-content: start;
  433. align-items: center;
  434. font-size: 25rpx;
  435. align-self: end;
  436. .active {
  437. width: 38rpx;
  438. height: 38rpx;
  439. background: #00b38b;
  440. border-radius: 50%;
  441. }
  442. }
  443. }
  444. .remark {
  445. font-size: 26rpx;
  446. font-family: Microsoft YaHei UI;
  447. font-weight: 400;
  448. color: #666666;
  449. text-indent: 30rpx;
  450. margin-bottom: 30rpx;
  451. }
  452. .submit {
  453. margin-top: 100rpx;
  454. width: 670rpx;
  455. height: 80rpx;
  456. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  457. border-radius: 40rpx;
  458. font-size: 32rpx;
  459. font-family: Noto Sans S Chinese;
  460. font-weight: 400;
  461. color: #ffffff;
  462. line-height: 80rpx;
  463. }
  464. .submit::after{
  465. border: 0;
  466. }
  467. .submit[disabled] {
  468. background: #f0f0f0;
  469. color: #333;
  470. }
  471. }
  472. </style>