選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

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>{{ 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-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. } 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. console.log("getCurrentPages()", getCurrentPages())
  262. navTo("/pages/bluetooth/bluetooth?routeType=5"); //去连接蓝牙
  263. };
  264. //返回列表
  265. const toBack = () => {
  266. uni.redirectTo({
  267. url: "/pages/service/service"
  268. })
  269. // navTo("/pages/service/service")
  270. }
  271. //关闭弹窗
  272. const cancel = () => {
  273. state.flag = true;
  274. state.showPopup = false;
  275. }
  276. //卡停用/启用 请求
  277. // const getCardStopOrStart = () => {
  278. // const options = {
  279. // type: 2,
  280. // data: {
  281. // cardId: orderInfos.cardId,
  282. // operation: 1,//1停用2启用
  283. // },
  284. // method: "POST",
  285. // showLoading: true,
  286. // };
  287. // request(cardStopOrStart, options).then((res) => {
  288. // let result = stringToJson(res.bizContent);
  289. // console.log(result);
  290. // // let cmdArray = [];
  291. // // tools.showLoadingAlert("正在执行指令");
  292. // // bluetoothUtil.transCmd(cmdArray, "10", function(res: any) {
  293. // // tools.hideLoadingAlert();
  294. // // console.log(res);
  295. // // })
  296. // })
  297. // };
  298. //设备升级 请求
  299. // const getDeviceUpgrade = () => {
  300. // const options = {
  301. // type: 2,
  302. // data: {
  303. // cardId: orderInfos.cardId,
  304. // vehiclePlate: orderInfos.vehiclePlate,
  305. // expireTime:"",
  306. // customerName:orderInfos.ownerName,
  307. // customerIdNum:orderInfos.ownerIdnum,
  308. // vehiclePlateColor:orderInfos.vehiclePlateColor,
  309. // },
  310. // method: "POST",
  311. // showLoading: true,
  312. // };
  313. // request(deviceUpgrade, options).then((res) => {
  314. // let result = stringToJson(res.bizContent);
  315. // console.log(result);
  316. // // let cmdArray = [];
  317. // // tools.showLoadingAlert("正在执行指令");
  318. // // bluetoothUtil.transCmd(cmdArray, "10", function(res: any) {
  319. // // tools.hideLoadingAlert();
  320. // // console.log(res);
  321. // // })
  322. // })
  323. // }
  324. </script>
  325. <style>
  326. page {
  327. width: 100%;
  328. height: 100%;
  329. background-color: #fff;
  330. }
  331. </style>
  332. <style lang="scss" scoped>
  333. .mask {
  334. background: rgba(0, 0, 0, .35);
  335. position: fixed;
  336. left: 0;
  337. top: 0;
  338. bottom: 0;
  339. right: 0;
  340. }
  341. .main {
  342. width: 560rpx;
  343. padding: 25rpx 20rpx 55rpx;
  344. text-align: center;
  345. background: #fff;
  346. position: absolute;
  347. left: 50%;
  348. top: 50%;
  349. transform: translate(-50%, -50%);
  350. border-radius: 20rpx;
  351. .top {
  352. text-align: right;
  353. .icon-close {
  354. width: 48rpx;
  355. height: 48rpx;
  356. }
  357. }
  358. .icon-success {
  359. width: 500rpx;
  360. height: 320rpx;
  361. margin-top: 22rpx;
  362. }
  363. .title {
  364. color: #333333;
  365. font-size: 40rpx;
  366. font-weight: 600;
  367. text-align: center;
  368. margin-top: 55rpx;
  369. }
  370. }
  371. .selectCar-box {
  372. // width: 100%;
  373. // height: 100%;
  374. padding: 30rpx;
  375. .title {
  376. font-size: 30rpx;
  377. font-family: Microsoft YaHei UI;
  378. font-weight: 400;
  379. color: #333333;
  380. margin-bottom: 30rpx;
  381. }
  382. .details {
  383. .title {
  384. font-size: 30rpx;
  385. font-family: Microsoft YaHei UI;
  386. font-weight: 400;
  387. color: #333333;
  388. margin-bottom: 30rpx;
  389. }
  390. .details-item {
  391. display: flex;
  392. font-size: 26rpx;
  393. font-family: Noto Sans S Chinese;
  394. font-weight: 400;
  395. color: #999999;
  396. margin-bottom: 30rpx;
  397. text {
  398. font-size: 26rpx;
  399. font-family: Noto Sans S Chinese;
  400. font-weight: 400;
  401. color: #333333;
  402. }
  403. }
  404. }
  405. .card {
  406. height: 150rpx;
  407. background: #ffffff;
  408. box-shadow: 0rpx 4rpx 13rpx 3rpx rgba(223, 223, 223, 0.8);
  409. border-radius: 20rpx;
  410. padding: 30rpx;
  411. display: flex;
  412. justify-content: space-between;
  413. align-items: center;
  414. margin-bottom: 60rpx;
  415. .card-left {
  416. display: flex;
  417. align-items: center;
  418. image {
  419. width: 100rpx;
  420. height: 90rpx;
  421. }
  422. .card-center {
  423. margin-left: 30rpx;
  424. .card-center-head {
  425. font-size: 32rpx;
  426. font-family: Noto Sans S Chinese;
  427. font-weight: 400;
  428. color: #333333;
  429. }
  430. .tips {
  431. font-size: 26rpx;
  432. font-family: Noto Sans S Chinese;
  433. font-weight: 400;
  434. color: #666666;
  435. .tips-card {
  436. width: 70rpx;
  437. height: 40rpx;
  438. background: #d3f2ef;
  439. border-radius: 6rpx;
  440. font-size: 20rpx;
  441. font-family: Noto Sans S Chinese;
  442. font-weight: 400;
  443. color: #0a8f8a;
  444. padding: 5rpx 10rpx;
  445. margin-left: 20rpx;
  446. }
  447. }
  448. }
  449. }
  450. .choose-item {
  451. margin-right: 20rpx;
  452. /* width: 50rpx; */
  453. // height: 50rpx;
  454. /* border: 1rpx solid #00B38B; */
  455. border-radius: 50%;
  456. // display: flex;
  457. // justify-content: center;
  458. // align-items: center;
  459. font-size: 25rpx;
  460. // align-self: end;
  461. .active {
  462. width: 38rpx;
  463. height: 38rpx;
  464. background: #00b38b;
  465. border-radius: 50%;
  466. }
  467. }
  468. }
  469. .remark {
  470. font-size: 26rpx;
  471. font-family: Microsoft YaHei UI;
  472. font-weight: 400;
  473. color: #666666;
  474. text-indent: 30rpx;
  475. margin-bottom: 30rpx;
  476. }
  477. .submit {
  478. margin-top: 100rpx;
  479. width: 670rpx;
  480. height: 80rpx;
  481. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  482. border-radius: 40rpx;
  483. font-size: 32rpx;
  484. font-family: Noto Sans S Chinese;
  485. font-weight: 400;
  486. color: #ffffff;
  487. line-height: 80rpx;
  488. }
  489. }
  490. </style>