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

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