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.

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