您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

pin-code-confirm.vue 11KB

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