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 11KB

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