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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488
  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">{{orderInfos.cardStatus ==1?'卡签停用':'卡签启用'}}</button>
  72. <button class="submit" @click="toBack" v-else>返回服务中心</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">{{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. getCodeName
  101. } from "@/datas/queryKey.js";
  102. import {
  103. orderDetail,
  104. cardStopOrStart,
  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. id: "",
  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. });
  134. onLoad((option) => {
  135. //请求订单详情
  136. state.id = option.id
  137. queryOrderDetail(state.id);
  138. });
  139. onShow((option) => {
  140. uni.$on('bluetoothLink', res => {
  141. console.log(res);
  142. if (res.status) {
  143. tools.showLoadingAlert("正在执行指令");
  144. getCardStopOrStart()
  145. }
  146. })
  147. })
  148. onUnload(() => {
  149. //移除监听
  150. uni.$off('bluetoothLink')
  151. })
  152. //获取订单详情
  153. const queryOrderDetail = (id) => {
  154. const options = {
  155. type: 2,
  156. data: {
  157. id: id,
  158. },
  159. method: "POST",
  160. showLoading: true,
  161. };
  162. request(orderDetail, options).then((res) => {
  163. let orderInfo = JSON.parse(res.bizContent);
  164. console.log("获取订单详情", orderInfo);
  165. orderInfos.orderId = orderInfo.orderId;
  166. orderInfos.ownerName = orderInfo.ownerName;
  167. orderInfos.ownerIdtype = orderInfo.ownerIdtype;
  168. orderInfos.ownerIdnum = orderInfo.ownerIdnum;
  169. orderInfos.vehiclePlate = orderInfo.vehiclePlate;
  170. orderInfos.vehiclePlateColorStr = orderInfo.vehiclePlateColorStr;
  171. orderInfos.vehiclePlateColor = orderInfo.vehiclePlateColor;
  172. orderInfos.vehicleType = orderInfo.vehicleType;
  173. orderInfos.cardId = orderInfo.cardId;
  174. orderInfos.cardStatus = orderInfo.cardStatus;
  175. orderInfos.obuId = orderInfo.obuId;
  176. orderInfos.obuStatus = orderInfo.obuStatus;
  177. orderInfos.cardEnableTime = orderInfo.cardEnableTime.substring(0, 10);
  178. orderInfos.obuEnableTime = orderInfo.obuEnableTime.substring(0, 10);
  179. });
  180. };
  181. //卡停用/启用 请求
  182. const getCardStopOrStart = () => {
  183. const options = {
  184. type: 2,
  185. data: {
  186. cardId: orderInfos.cardId,
  187. orderId: orderInfos.orderId,
  188. operation: orderInfos.cardStatus == 1 ? 1 : 2, //1停用2启用
  189. },
  190. method: "POST",
  191. showLoading: true,
  192. };
  193. console.log("卡停用/启用 请求", options, orderInfos)
  194. request(cardStopOrStart, options).then((res) => {
  195. let result = stringToJson(res.bizContent);
  196. let cmdArray = result.command ? result.command.split(",") : [];
  197. console.log(result);
  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: orderInfos.cardStatus == 1 ? 3 : 2, //停用是3,启用是2 orderInfos.cardStatus==1正常
  255. cosRecordId: cosRecordId,
  256. orderId: orderInfos.orderId
  257. },
  258. method: "POST",
  259. showLoading: true,
  260. };
  261. console.log("res898", options);
  262. request(cardModifyConfirm, options).then((res) => {
  263. state.showPopup = true;
  264. })
  265. }
  266. //去连接蓝牙
  267. const toPage = () => {
  268. // getCardStopOrStart()
  269. navTo("/pages/bluetooth/bluetooth?routeType=5"); //去连接蓝牙
  270. };
  271. //返回列表
  272. const toBack = () => {
  273. // navTo("/pages/service/service")
  274. uni.navigateBack({
  275. delta: 2
  276. })
  277. }
  278. //关闭弹窗
  279. const cancel = () => {
  280. state.flag = true;
  281. state.showPopup = false;
  282. queryOrderDetail(state.id);
  283. }
  284. </script>
  285. <style>
  286. page {
  287. width: 100%;
  288. height: 100%;
  289. background-color: #fff;
  290. }
  291. </style>
  292. <style lang="scss" scoped>
  293. .mask {
  294. background: rgba(0, 0, 0, .35);
  295. position: fixed;
  296. left: 0;
  297. top: 0;
  298. bottom: 0;
  299. right: 0;
  300. }
  301. .main {
  302. width: 560rpx;
  303. padding: 25rpx 20rpx 55rpx;
  304. text-align: center;
  305. background: #fff;
  306. position: absolute;
  307. left: 50%;
  308. top: 50%;
  309. transform: translate(-50%, -50%);
  310. border-radius: 20rpx;
  311. .top {
  312. text-align: right;
  313. .icon-close {
  314. width: 48rpx;
  315. height: 48rpx;
  316. }
  317. }
  318. .icon-success {
  319. width: 500rpx;
  320. height: 320rpx;
  321. margin-top: 22rpx;
  322. }
  323. .title {
  324. color: #333333;
  325. font-size: 40rpx;
  326. font-weight: 600;
  327. text-align: center;
  328. margin-top: 55rpx;
  329. }
  330. }
  331. .selectCar-box {
  332. // width: 100%;
  333. // height: 100%;
  334. padding: 30rpx;
  335. .title {
  336. font-size: 30rpx;
  337. font-family: Microsoft YaHei UI;
  338. font-weight: 400;
  339. color: #333333;
  340. margin-bottom: 30rpx;
  341. }
  342. .details {
  343. .title {
  344. font-size: 30rpx;
  345. font-family: Microsoft YaHei UI;
  346. font-weight: 400;
  347. color: #333333;
  348. margin-bottom: 30rpx;
  349. }
  350. .details-item {
  351. display: flex;
  352. font-size: 26rpx;
  353. font-family: Noto Sans S Chinese;
  354. font-weight: 400;
  355. color: #999999;
  356. margin-bottom: 30rpx;
  357. text {
  358. font-size: 26rpx;
  359. font-family: Noto Sans S Chinese;
  360. font-weight: 400;
  361. color: #333333;
  362. }
  363. }
  364. }
  365. .card {
  366. height: 150rpx;
  367. background: #ffffff;
  368. box-shadow: 0rpx 4rpx 13rpx 3rpx rgba(223, 223, 223, 0.8);
  369. border-radius: 20rpx;
  370. padding: 30rpx;
  371. display: flex;
  372. justify-content: space-between;
  373. align-items: center;
  374. margin-bottom: 60rpx;
  375. .card-left {
  376. display: flex;
  377. align-items: center;
  378. image {
  379. width: 100rpx;
  380. height: 90rpx;
  381. }
  382. .card-center {
  383. margin-left: 30rpx;
  384. .card-center-head {
  385. font-size: 32rpx;
  386. font-family: Noto Sans S Chinese;
  387. font-weight: 400;
  388. color: #333333;
  389. }
  390. .tips {
  391. font-size: 26rpx;
  392. font-family: Noto Sans S Chinese;
  393. font-weight: 400;
  394. color: #666666;
  395. .tips-card {
  396. width: 70rpx;
  397. height: 40rpx;
  398. background: #d3f2ef;
  399. border-radius: 6rpx;
  400. font-size: 20rpx;
  401. font-family: Noto Sans S Chinese;
  402. font-weight: 400;
  403. color: #0a8f8a;
  404. padding: 5rpx 10rpx;
  405. margin-left: 20rpx;
  406. }
  407. }
  408. }
  409. }
  410. .choose-item {
  411. margin-right: 20rpx;
  412. /* width: 50rpx; */
  413. // height: 50rpx;
  414. /* border: 1rpx solid #00B38B; */
  415. border-radius: 50%;
  416. // display: flex;
  417. // justify-content: center;
  418. // align-items: center;
  419. font-size: 25rpx;
  420. // align-self: end;
  421. .active {
  422. width: 38rpx;
  423. height: 38rpx;
  424. background: #00b38b;
  425. border-radius: 50%;
  426. }
  427. }
  428. }
  429. .remark {
  430. font-size: 26rpx;
  431. font-family: Microsoft YaHei UI;
  432. font-weight: 400;
  433. color: #666666;
  434. text-indent: 30rpx;
  435. margin-bottom: 30rpx;
  436. }
  437. .submit {
  438. margin-top: 100rpx;
  439. width: 670rpx;
  440. height: 80rpx;
  441. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  442. border-radius: 40rpx;
  443. font-size: 32rpx;
  444. font-family: Noto Sans S Chinese;
  445. font-weight: 400;
  446. color: #ffffff;
  447. line-height: 80rpx;
  448. }
  449. }
  450. </style>