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.

flowingWater.vue 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694
  1. <template>
  2. <view class="wrapper" v-if="state.haveData">
  3. <!-- 背景颜色充满屏 -->
  4. <view class="bg-color"></view>
  5. <!-- 补卡额订单列表-->
  6. <view class="list-wrap">
  7. <view class="card-info" v-for="(item,index) in state.list" :key="item.id">
  8. <view class="info-wrap">
  9. <view class="info-left">
  10. <view class="info-left-text">
  11. <text class="label">车牌号:</text>
  12. <text class="val">{{item.vehiclePlate}}</text>
  13. </view>
  14. <view>
  15. <text class="label">ETC卡号:</text>
  16. <text class="val">{{item.cardId}}</text>
  17. </view>
  18. </view>
  19. <view class="info-right">
  20. <view class="price-label">
  21. 交易金额
  22. </view>
  23. <view class="price-val">
  24. <u-icon name="rmb"></u-icon>
  25. <text class="price-val-text">{{item.cardBalance/100}}</text>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="btn-wrap">
  30. <view>
  31. <text v-if="item.status === 1" class="status-wrap">审核进度:<text>已进行</text></text>
  32. <text v-if="item.status === 2" class="status-wrap">审核进度:<text
  33. class="status-text">未进行</text></text>
  34. <text v-if="item.status === -1" class="status-wrap">审核进度:<text>驳回</text></text>
  35. <text v-if="item.status === 3" class="status-wrap">审核进度:<text>待审核</text></text>
  36. </view>
  37. <view class="btn-1 btn" v-if="item.status === 2" @click="refundTypeAction(item)">圈存</view>
  38. <!-- <view class="btn-1 btn" v-if="item.status === 1" @click="toApply(item)">补卡额申请</view>
  39. <view class="btn-1 btn" v-if="item.status === 2" @click="toView(item)">查看进度</view>
  40. <view class="btn-1 btn" v-if="item.status === 3" @click="toEvaluate(item)">去评价</view> -->
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. <view class="no">暂无补卡额圈存数据</view>
  46. </template>
  47. <script lang="ts" setup>
  48. import { reactive, ref } from "vue";
  49. import { onLoad, onUnload } from "@dcloudio/uni-app";
  50. import { request } from "@/utils/network/request.js";
  51. import { queryCardLimit, quanCheck, quanApply, quanConfirm, quanXf } from "@/utils/network/api";
  52. import { stringToJson } from "@/utils/network/encryption";
  53. import { msg } from "@/utils/utils";
  54. const cmd = require("../../static/etcUtil/cmdConfig.js");
  55. const tools = require("../../static/etcUtil/tools.js");
  56. const bluetoothUtil = require("../../static/etcUtil/index.js");
  57. import { navTo } from "@/utils/utils"
  58. const card = reactive({
  59. /*卡相关信息*/
  60. cardId: "",
  61. netId: "",
  62. cardType: "",
  63. startTime: "",
  64. endTime: "",
  65. userName: "",
  66. idNum: "",
  67. vehiclePlate: "",
  68. vehiclePlateColor: "",
  69. color: "",
  70. version: "",
  71. type: "",
  72. favourable: "",
  73. money: undefined,
  74. v_userType: "",
  75. });
  76. const show = ref(false);
  77. const dataTime = reactive({
  78. startDate: "",
  79. endDate: ""
  80. })
  81. const state = reactive({
  82. vehicleId: "",//车牌号
  83. id: "",
  84. list: "",
  85. cardBalance: "",
  86. haveData: false, //是否有数据
  87. refundBalance: "",
  88. })
  89. const listData = reactive(null)
  90. onLoad((options) => {
  91. state.vehicleId = options.vehicleId
  92. //根据车牌查询信息.data
  93. queryRefundAction().then(val => {
  94. console.log("val", val)
  95. if (val.data) {
  96. state.list = val.data
  97. state.haveData = true
  98. }
  99. })
  100. /*监听蓝牙回调*/
  101. uni.$on('bluetoothLink', function (status) {
  102. getCardId()
  103. })
  104. });
  105. onUnload(() => {
  106. /*移除监听*/
  107. uni.$off('bluetoothLink')
  108. });
  109. // 补卡额列表查询接口
  110. const queryRefundAction = () => {
  111. const options = {
  112. type: 2,
  113. data: {
  114. "vehicleId": state.vehicleId,
  115. "systemType": "WX"
  116. },
  117. method: "POST",
  118. showLoading: true,
  119. };
  120. return new Promise(async (resolve, reject) => {
  121. const res = await request(queryCardLimit, options);
  122. const data = stringToJson(res.bizContent);
  123. console.log("储值卡注销退费查询接口", data)
  124. resolve(data);
  125. }).catch((error) => {
  126. reject(error);
  127. });
  128. };
  129. // 日期修改
  130. function changeHandle(e) {
  131. dataTime.startDate = e.startDate;
  132. dataTime.endDate = e.endDate;
  133. }
  134. // 补卡申请
  135. function toApply(item) {
  136. uni.navigateTo({
  137. url: `/subpackage/orders/cardAmount?id=${item.id}`
  138. });
  139. }
  140. // 去评价
  141. function toEvaluate(item) {
  142. uni.navigateTo({
  143. url: `/subpackage/orders/order-evaluate?id=${item.id}`
  144. });
  145. }
  146. // 查看进度
  147. function toView(item) {
  148. uni.navigateTo({
  149. url: `/subpackage/orders/cardAmountDetail?id=${item.id}`
  150. });
  151. }
  152. // 去圈存
  153. //功能跳转入口
  154. const refundTypeAction = (val : any) => {
  155. /*圈存*/
  156. //链接蓝牙
  157. console.log("val.id", val.id)
  158. state.id = val.id;
  159. state.cardBalance = val.cardBalance
  160. uni.navigateTo({
  161. url: `/pages/bluetooth/bluetooth?routeType=5`,
  162. });
  163. }
  164. /*读卡*/
  165. const getCardId = () => {
  166. console.log("======获取卡信息======");
  167. let cmdArr = [
  168. cmd.HOME_DIRECTORY,
  169. //选择主目
  170. cmd.APPLICATION_DIRECTORY,
  171. //选择文件1001--DF01联网收费应用目录
  172. cmd.CMD_READBINARY,
  173. //15文件--卡片发行基本数据文件
  174. cmd.CMD_GETBALANCE,
  175. //钱包
  176. ];
  177. tools.showLoadingAlert("正在执行指令");
  178. //10:写卡 20:写OBU
  179. bluetoothUtil.transCmd(cmdArr, "10", function (res) {
  180. tools.hideLoadingAlert();
  181. let str = res[2].substring(res[2].length - 4, res[2].length);
  182. let str3 = res[3].substring(res[3].length - 4, res[3].length);
  183. if (str == "9000" || str3 == "9000") {
  184. if (res[2].length > 86 || res[3] >= 12) {
  185. card.cardId = res[2].substring(20, 40); //卡号
  186. card.startTime = res[2].substring(40, 48);
  187. card.endTime = res[2].substring(48, 56);
  188. card.version = res[2].substring(18, 19) >= 4 ? "4x" : "2x";
  189. card.netId = res[2].substring(20, 24);
  190. card.cardType = res[2].substring(28, 29) == 23 ? 1 : 2;
  191. card.vehiclePlateColor = parseInt(res[2].substring(82, 84), 16);
  192. (card.money = parseInt(parseInt(res[3].substring(0, 8), 16), 10)),
  193. console.log("======卡信息======", card);
  194. quanCheckActionTrue().then((val) => {
  195. checkQuanCengEvent(val);
  196. });
  197. } else {
  198. console.error("CMD_READBINARY指令长度不符1111" + res[2]);
  199. tools.hideLoadingAlert();
  200. }
  201. }
  202. tools.hideLoadingAlert();
  203. });
  204. };
  205. const quanCheckActionTrue = () => {
  206. console.log("进行真实圈存检测");
  207. var data = {
  208. cardId: card.cardId,
  209. orderId: state.id,
  210. preBalance: card.money,
  211. fee: state.cardBalance,
  212. tradeType: 5,
  213. };
  214. const options = {
  215. type: 2,
  216. data: data,
  217. method: "POST",
  218. showLoading: true,
  219. };
  220. return new Promise(async (resolve, reject) => {
  221. const res = await request(quanCheck, options);
  222. const data = stringToJson(res.bizContent);
  223. resolve(data);
  224. }).catch((error) => {
  225. reject(error);
  226. });
  227. };
  228. const checkQuanCengEvent = (val : any) => {
  229. if (val.chargeStatus === 1) {
  230. let cmdArr = val.command.split(",");
  231. uni.showLoading({
  232. title: "写入中",
  233. });
  234. bluetoothUtil.transCmd(cmdArr, "10", function (res) {
  235. let response = res.toString();
  236. var dic = {
  237. command: val.command,
  238. cosResponse: response,
  239. };
  240. uni.hideLoading();
  241. quanApplyAction(dic).then((value) => {
  242. console.log("圈存申请完后的结果");
  243. console.log(value);
  244. //圈存初始化验证通过 , 进行圈存
  245. if (value.commandType === 2) {
  246. uanConfirmAction(value)
  247. } else {
  248. msg("圈存初始化指令验证失败, 重新初始化");
  249. }
  250. });
  251. });
  252. } else {
  253. let cmdArr = val.command.split(",");
  254. uni.showLoading({
  255. title: "写入中",
  256. });
  257. bluetoothUtil.transCmd(cmdArr, "10", function (res) {
  258. var status = res[1].substring(res[1].length - 4, res[1].length);
  259. console.log("打印状态");
  260. console.log(status);
  261. if (status === "9000") {
  262. console.log("修复指令入参");
  263. let response = res.toString();
  264. var dic = {
  265. command: val.command,
  266. cosResponse: response,
  267. rechargeId: val.rechargeId,
  268. };
  269. quanFixAction(dic).then((value) => {
  270. console.log(value);
  271. console.log("修复结果返回");
  272. var fixStatus = value.fixStatus;
  273. //圈存修复COS指令Response信息不足,重新进行修复初始化
  274. if (fixStatus === 3) {
  275. let xfcmdArr = value.command.split(",");
  276. bluetoothUtil.transCmd(xfcmdArr, "10", function (resValueData) {
  277. var status = resValueData[1].substring(
  278. resValueData[1].length - 4,
  279. resValueData[1].length
  280. );
  281. console.log("打印状态");
  282. console.log(status);
  283. if (status === "9000") {
  284. console.log(resValueData);
  285. var valueResponse = resValueData.toString();
  286. console.log(response);
  287. var applyDic = {
  288. command: value.command,
  289. cosResponse: valueResponse,
  290. rechargeId: value.rechargeId,
  291. };
  292. console.log("消费成功");
  293. quanApplyAction(applyDic).then((applyValue) => {
  294. uanConfirmAction(value)
  295. });
  296. }
  297. });
  298. } else if (fixStatus === 2) {
  299. uanConfirmSucessAction(value).then((confirmResult) => {
  300. navTo(
  301. `/subpackage/orders/flowingWater-result`)
  302. });
  303. } else if (fixStatus === 1) {
  304. quanCheckActionTrue().then((val) => {
  305. checkQuanCengEvent(val);
  306. });
  307. }
  308. });
  309. uni.hideLoading();
  310. }
  311. });
  312. }
  313. };
  314. /*圈存申请*/
  315. const quanApplyAction = (data) => {
  316. var form = {
  317. cardId: card.cardId,
  318. tradeType: 5,
  319. command: data.command,
  320. cosResponse: data.cosResponse,
  321. orderId: state.id,
  322. rechargeId: data.rechargeId,
  323. fee: state.cardBalance,
  324. preBalance: card.money,
  325. };
  326. const options = {
  327. type: 2,
  328. data: form,
  329. method: "POST",
  330. showLoading: true,
  331. };
  332. return new Promise(async (resolve, reject) => {
  333. console.log("70", options)
  334. const res = await request(quanApply, options);
  335. const data = stringToJson(res.bizContent);
  336. resolve(data);
  337. }).catch((error) => {
  338. reject(error);
  339. });
  340. };
  341. /*圈存确认*/
  342. const uanConfirmAction = (data) => {
  343. console.log("圈存确认进入");
  344. let cmdArr = data.command.split(",");
  345. console.log(cmdArr);
  346. bluetoothUtil.transCmd(cmdArr, "10", function (res) {
  347. console.log("圈存透传");
  348. console.log(res);
  349. var arraylenth = res.length;
  350. var status = res[arraylenth - 1].substring(
  351. res[arraylenth - 1].length - 4,
  352. res[arraylenth - 1].length
  353. );
  354. console.log("打印圈存确认指令状态");
  355. console.log(status);
  356. if (status === "9000") {
  357. var form = {
  358. command: data.command,
  359. cosResponse: res.toString(),
  360. rechargeId: data.rechargeId,
  361. paidAmount: state.cardBalance,
  362. giftAmount: 0,
  363. };
  364. const options = {
  365. type: 2,
  366. data: form,
  367. method: "POST",
  368. showLoading: true,
  369. };
  370. request(quanConfirm, options).then((res) => {
  371. const result = stringToJson(res.bizContent);
  372. navTo(`/subpackage/orders/flowingWater-result`)
  373. });
  374. }
  375. });
  376. };
  377. const uanConfirmSucessAction = (data) => {
  378. var form = {
  379. command: data.command,
  380. cosResponse: "9000",
  381. rechargeId: data.rechargeId,
  382. paidAmount: data.fee,
  383. giftAmount: 0,
  384. };
  385. const options = {
  386. type: 2,
  387. data: form,
  388. method: "POST",
  389. showLoading: true,
  390. };
  391. return new Promise(async (resolve, reject) => {
  392. const res = await request(quanConfirm, options);
  393. const data = stringToJson(res.bizContent);
  394. resolve(data);
  395. }).catch((error) => {
  396. reject(error);
  397. });
  398. };
  399. /*圈存修复*/
  400. const quanFixAction = (val) => {
  401. var data = {
  402. command: val.command, //修复初始化的指令
  403. cosResponse: val.cosResponse, //修复初始化结果
  404. rechargeId: val.rechargeId, //充值流水号
  405. };
  406. const options = {
  407. type: 2,
  408. data: data,
  409. method: "POST",
  410. showLoading: true,
  411. };
  412. return new Promise(async (resolve, reject) => {
  413. const res = await request(quanXf, options);
  414. const data = stringToJson(res.bizContent);
  415. resolve(data);
  416. }).catch((error) => {
  417. reject(error);
  418. });
  419. };
  420. </script>
  421. <style lang="scss" scoped>
  422. .no {
  423. text-align: center;
  424. font-size: 32rpx;
  425. margin: 20rpx auto;
  426. }
  427. .bg-color {
  428. position: fixed;
  429. top: 0;
  430. left: 0;
  431. right: 0;
  432. bottom: 0;
  433. background: #EEF7F7;
  434. z-index: -1;
  435. }
  436. .search-box {
  437. margin: 30rpx 30rpx 20rpx 30rpx;
  438. height: 72rpx;
  439. height: 81rpx;
  440. background: #FFFFFF;
  441. border: 1px solid #DCDCDC;
  442. border-radius: 40rpx;
  443. display: flex;
  444. justify-content: center;
  445. align-items: center;
  446. box-sizing: border-box;
  447. }
  448. .search-box .icon {
  449. width: 48rpx;
  450. height: 48rpx;
  451. margin: 0 20rpx;
  452. }
  453. .search-box .search {
  454. flex: 1;
  455. margin-right: 20rpx;
  456. height: 100%;
  457. padding: 0 10rpx;
  458. font-size: 28rpx;
  459. color: #00b38b;
  460. }
  461. .scroll-view {
  462. white-space: nowrap;
  463. position: sticky;
  464. top: 0;
  465. background: #ffffff;
  466. box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(223, 223, 223, 0.8);
  467. }
  468. .search-time {
  469. // width: 100%;
  470. display: flex;
  471. padding: 10rpx 30rpx 30rpx;
  472. .search-time-box {
  473. flex: 1;
  474. }
  475. .time-btn {
  476. width: 130rpx;
  477. height: 80rpx;
  478. background: #00B38B;
  479. border-radius: 40rpx;
  480. color: #FFFFFF;
  481. font-size: 32rpx;
  482. line-height: 80rpx;
  483. text-align: center;
  484. margin-left: 20rpx;
  485. }
  486. .show-info {
  487. // width: 541rpx;
  488. width: 85%;
  489. height: 81rpx;
  490. padding: 0 31rpx;
  491. background: #FFFFFF;
  492. border: 1px solid #DCDCDC;
  493. border-radius: 40rpx;
  494. display: flex;
  495. justify-content: space-between;
  496. align-items: center;
  497. .show-text {
  498. display: flex;
  499. align-items: center;
  500. }
  501. .date-text {
  502. color: #999999;
  503. font-size: 28rpx;
  504. }
  505. .text-val {
  506. color: #333
  507. }
  508. .line {
  509. width: 25rpx;
  510. height: 1rpx;
  511. background: #999999;
  512. margin: 0 24rpx;
  513. }
  514. }
  515. }
  516. .total-num {
  517. font-size: 28rpx;
  518. color: #999999;
  519. margin-left: 30rpx;
  520. }
  521. .list-wrap {
  522. margin: 30rpx;
  523. padding-bottom: 20rpx;
  524. }
  525. .card-info {
  526. background: #FFFFFF;
  527. box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(223, 223, 223, 0.8);
  528. border-radius: 20rpx;
  529. margin-bottom: 30rpx;
  530. padding: 30rpx 30px 13rpx 30rpx;
  531. .info-wrap {
  532. display: flex;
  533. justify-content: space-between;
  534. align-items: center;
  535. border-bottom: 1px solid #dcdcdc;
  536. padding-bottom: 30rpx;
  537. .info-left-text {
  538. margin-bottom: 20rpx;
  539. }
  540. .label {
  541. color: #999999;
  542. font-size: 26rpx;
  543. font-weight: 400;
  544. }
  545. .val {
  546. color: #333333;
  547. font-size: 26rpx;
  548. font-weight: 400;
  549. }
  550. .price-label {
  551. color: #999999;
  552. font-size: 24rpx;
  553. font-weight: 400;
  554. margin-bottom: 22rpx;
  555. text-align: center;
  556. }
  557. .price-val-text {
  558. font-size: 36rpx;
  559. font-weight: 700;
  560. color: #333333;
  561. margin-left: 9rpx;
  562. }
  563. .price-val {
  564. font-size: 26rpx;
  565. color: #333333;
  566. }
  567. }
  568. .card-text-wrap {
  569. display: flex;
  570. justify-content: space-between;
  571. align-items: center;
  572. margin: 38rpx 0 46rpx 0;
  573. .text-box {
  574. display: flex;
  575. flex-direction: column;
  576. align-items: center;
  577. .name-text {
  578. font-size: 30rpx;
  579. font-weight: 400;
  580. color: #333333;
  581. }
  582. .time-text {
  583. font-size: 30rpx;
  584. color: #333333;
  585. font-weight: 400;
  586. margin-top: 8rpx;
  587. }
  588. .date-text {
  589. font-size: 24rpx;
  590. color: #999999;
  591. font-weight: 400;
  592. margin-top: 8rpx;
  593. }
  594. }
  595. .arrow-wrap {
  596. display: flex;
  597. flex-direction: column;
  598. align-items: center;
  599. .d-img {
  600. width: 186rpx;
  601. height: 12rpx;
  602. }
  603. .arrow-text {
  604. color: #666666;
  605. font-size: 26rpx;
  606. }
  607. }
  608. }
  609. .btn-wrap {
  610. margin-top: 30rpx;
  611. display: flex;
  612. justify-content: space-between;
  613. align-items: center;
  614. .status-wrap {
  615. color: #999999;
  616. font-size: 26rpx;
  617. margin-right: 23rpx;
  618. }
  619. .status-text {
  620. color: #00B38B;
  621. }
  622. .btn {
  623. background: #FFFFFF;
  624. border: 1px solid #00B38B;
  625. border-radius: 30rpx;
  626. line-height: 50rpx;
  627. text-align: center;
  628. color: #00B38B;
  629. font-size: 26rpx;
  630. }
  631. .btn-1 {
  632. width: 140rpx;
  633. height: 50rpx;
  634. }
  635. .btn-2 {
  636. width: 141rpx;
  637. height: 50rpx;
  638. }
  639. .btn-3 {
  640. width: 121rpx;
  641. height: 50rpx;
  642. }
  643. }
  644. }
  645. </style>