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

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