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.

renewal-confirm.vue 12KB

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