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.

deactivation-activation-confirm.vue 11KB

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