Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

renewal-confirm.vue 12KB

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