Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

pin-code-confirm.vue 10KB

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