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.

flowingWater.vue 17KB

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