Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

flowingWater.vue 17KB

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