Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

renewal-confirm.vue 12KB

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