Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

deactivation-activation-confirm.vue 11KB

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