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.

refund-order-balance.vue 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  1. <template>
  2. <view class="oderPage">
  3. <view v-if="state.list&&state.list.length>0" v-for="(item,index) in state.list" class="details">
  4. <view class="header">
  5. <image :src="`${$imgUrl}order/no1.png`" mode=""></image>
  6. <text>{{item.orderId}}</text>
  7. </view>
  8. <view class="hr">
  9. </view>
  10. <view class="row">
  11. <view class="">
  12. 订单车牌号:
  13. </view>
  14. <text>{{item.vehiclePlate}}</text>
  15. </view>
  16. <view class="row">
  17. <view class="">
  18. 旧卡号:
  19. </view>
  20. <text>{{item.cardId}}</text>
  21. </view>
  22. <view class="row">
  23. <view class="">
  24. 可退费金额:
  25. </view>
  26. <text>{{item.refundBalance / 100}}</text>
  27. </view>
  28. <view class="line">
  29. </view>
  30. <button v-if="item.refundType === 'WTJTF'">未提交退费</button>
  31. <button v-if="item.refundType === 'YTJTF'">已提交退费</button>
  32. <button v-if="item.refundType === 'GLYQR'" @click="refundTypeAction(item)"> 补领申请</button>
  33. <button v-if="item.refundType === 'YWCTF'">已完成退费</button>
  34. <button v-if="item.refundType === 'TFYDC'">已导出退费</button>
  35. <button v-if="item.refundType === 'ECHDTF'">二次核定退费</button>
  36. <button v-if="item.refundType === 'RFFL'">退费失败</button>
  37. <button v-if="item.refundType === 'ALRS'">已拒付</button>
  38. <button v-if="item.refundType === 'FJWQR'">附件未确认</button>
  39. <button v-if="item.refundType === 'WGZYQ'">未过争议期</button>
  40. <button v-if="item.refundType === 'REQUESTED'">已申请</button>
  41. <!-- <button v-if="item.refundType === 'BALSUP'">余额补领</button> -->
  42. <button v-if="item.refundType === 'BALSUP'" @click="refundTypeAction(item)"> 圈存</button>
  43. <button v-if="item.refundType === 'BALSUPCOS'"> 余额补领已圈存</button>
  44. </view>
  45. <view v-else>
  46. <empty title='暂无找到该车牌相关余额补领信息' />
  47. </view>
  48. </view>
  49. </template>
  50. <script setup lang="ts">
  51. import {
  52. reactive,
  53. ref
  54. } from "vue"
  55. import {
  56. navTo
  57. } from "@/utils/utils"
  58. import {
  59. onLoad,
  60. onUnload
  61. } from "@dcloudio/uni-app";
  62. import {
  63. queryRefund,
  64. queryRefundApply,
  65. quanApply,
  66. quanCheck,
  67. quanConfirm,
  68. quanXf
  69. } from "@/utils/network/api.js";
  70. import {
  71. request
  72. } from "@/utils/network/request.js";
  73. import {
  74. msg
  75. } from "@/utils/utils";
  76. import {
  77. stringToJson
  78. } from "@/utils/network/encryption";
  79. //-----蓝牙模块
  80. const bluetoothUtil = require("../../../static/etcUtil/index.js");
  81. const cmd = require("../../../static/etcUtil/cmdConfig.js");
  82. const tools = require("../../../static/etcUtil/tools.js");
  83. const card = reactive({
  84. /*卡相关信息*/
  85. cardId: "",
  86. netId: "",
  87. cardType: "",
  88. startTime: "",
  89. endTime: "",
  90. userName: "",
  91. idNum: "",
  92. vehiclePlate: "",
  93. vehiclePlateColor: "",
  94. color: "",
  95. version: "",
  96. type: "",
  97. favourable: "",
  98. money: undefined,
  99. v_userType: "",
  100. });
  101. const state = reactive({
  102. vehicleId: '',
  103. list: [],
  104. id: '',//退费信息编号
  105. refundBalance: "",
  106. });
  107. /*视图进入后操作*/
  108. onLoad((option) => {
  109. state.vehicleId = option.vehicleId
  110. //根据车牌查询信息
  111. queryRefundAction().then(val => {
  112. state.list = val.data
  113. })
  114. /*监听蓝牙回调*/
  115. uni.$on('bluetoothLink', function (status) {
  116. getCardId()
  117. })
  118. });
  119. onUnload(() => {
  120. /*移除监听*/
  121. uni.$off('bluetoothLink')
  122. });
  123. //功能跳转入口
  124. const refundTypeAction = (val : any) => {
  125. state.refundBalance = val.refundBalance
  126. if (val.refundType === 'GLYQR') {
  127. /*余额补领申请*/
  128. queryRefundApplyAction(val.orderId).then((value : any) => {
  129. state.id = value.id
  130. msg('圈存退费申请成功')
  131. /*查询完刷新状态*/
  132. queryRefundAction().then((result : any) => {
  133. state.list = result.data
  134. })
  135. })
  136. } else if (val.refundType === 'BALSUP') {
  137. /*圈存*/
  138. //链接蓝牙
  139. state.id = val.orderId
  140. uni.navigateTo({
  141. url: `/pages/bluetooth/bluetooth?routeType=5`,
  142. });
  143. }
  144. }
  145. //储值卡注销退费查询接口
  146. const queryRefundAction = () => {
  147. var data = {
  148. vehicleId: state.vehicleId
  149. };
  150. const options = {
  151. type: 2,
  152. data: data,
  153. method: "POST",
  154. showLoading: true,
  155. };
  156. return new Promise(async (resolve, reject) => {
  157. const res = await request(queryRefund, options);
  158. const data = stringToJson(res.bizContent);
  159. console.log("储值卡注销退费查询接口", data)
  160. resolve(data);
  161. }).catch((error) => {
  162. reject(error);
  163. });
  164. }
  165. //储值卡注销余额补领申请接口
  166. const queryRefundApplyAction = (id) => {
  167. var data = {
  168. orderId: id
  169. };
  170. const options = {
  171. type: 2,
  172. data: data,
  173. method: "POST",
  174. showLoading: true,
  175. };
  176. return new Promise(async (resolve, reject) => {
  177. const res = await request(queryRefundApply, options);
  178. const data = stringToJson(res.bizContent);
  179. resolve(data);
  180. }).catch((error) => {
  181. reject(error);
  182. });
  183. }
  184. /*读卡*/
  185. const getCardId = () => {
  186. console.log("======获取卡信息======");
  187. let cmdArr = [
  188. cmd.HOME_DIRECTORY,
  189. //选择主目
  190. cmd.APPLICATION_DIRECTORY,
  191. //选择文件1001--DF01联网收费应用目录
  192. cmd.CMD_READBINARY,
  193. //15文件--卡片发行基本数据文件
  194. cmd.CMD_GETBALANCE,
  195. //钱包
  196. ];
  197. tools.showLoadingAlert("正在执行指令");
  198. //10:写卡 20:写OBU
  199. bluetoothUtil.transCmd(cmdArr, "10", function (res) {
  200. tools.hideLoadingAlert();
  201. let str = res[2].substring(res[2].length - 4, res[2].length);
  202. let str3 = res[3].substring(res[3].length - 4, res[3].length);
  203. if (str == "9000" || str3 == "9000") {
  204. if (res[2].length > 86 || res[3] >= 12) {
  205. card.cardId = res[2].substring(20, 40); //卡号
  206. card.startTime = res[2].substring(40, 48);
  207. card.endTime = res[2].substring(48, 56);
  208. card.version = res[2].substring(18, 19) >= 4 ? "4x" : "2x";
  209. card.netId = res[2].substring(20, 24);
  210. card.cardType = res[2].substring(28, 29) == 23 ? 1 : 2;
  211. card.vehiclePlateColor = parseInt(res[2].substring(82, 84), 16);
  212. (card.money = parseInt(parseInt(res[3].substring(0, 8), 16), 10)),
  213. console.log("======卡信息======", card);
  214. quanCheckActionTrue().then((val) => {
  215. checkQuanCengEvent(val);
  216. });
  217. } else {
  218. console.error("CMD_READBINARY指令长度不符" + res[2]);
  219. tools.hideLoadingAlert();
  220. }
  221. }
  222. console.error("CMD_READBINARY指令长度不符" + res[2]);
  223. tools.hideLoadingAlert();
  224. });
  225. };
  226. const checkQuanCengEvent = (val : any) => {
  227. console.log("val========", val)
  228. if (val.chargeStatus === 1) {
  229. let cmdArr = val.command.split(",");
  230. uni.showLoading({
  231. title: "写入中",
  232. });
  233. bluetoothUtil.transCmd(cmdArr, "10", function (res) {
  234. let response = res.toString();
  235. var dic = {
  236. command: val.command,
  237. cosResponse: response,
  238. };
  239. uni.hideLoading();
  240. quanApplyAction(dic).then((value) => {
  241. console.log("圈存申请完后的结果");
  242. console.log(value);
  243. //圈存初始化验证通过 , 进行圈存
  244. if (value.commandType === 2) {
  245. console.log("value============", value)
  246. uanConfirmAction(value)
  247. // uanConfirmAction(value).then((confirmResult) => {
  248. // console.log("成功333333333333", confirmResult)
  249. // navTo(
  250. // `/subpackage/after-sale/refund-order-balance/result`)
  251. // });
  252. } else {
  253. msg("圈存初始化指令验证失败, 重新初始化");
  254. }
  255. });
  256. });
  257. } else {
  258. let cmdArr = val.command.split(",");
  259. uni.showLoading({
  260. title: "写入中",
  261. });
  262. bluetoothUtil.transCmd(cmdArr, "10", function (res) {
  263. var status = res[1].substring(res[1].length - 4, res[1].length);
  264. console.log("打印状态");
  265. console.log(status);
  266. if (status === "9000") {
  267. console.log("修复指令入参");
  268. let response = res.toString();
  269. var dic = {
  270. command: val.command,
  271. cosResponse: response,
  272. rechargeId: val.rechargeId,
  273. };
  274. quanFixAction(dic).then((value) => {
  275. console.log(value);
  276. console.log("修复结果返回");
  277. var fixStatus = value.fixStatus;
  278. //圈存修复COS指令Response信息不足,重新进行修复初始化
  279. if (fixStatus === 3) {
  280. let xfcmdArr = value.command.split(",");
  281. bluetoothUtil.transCmd(xfcmdArr, "10", function (resValueData) {
  282. var status = resValueData[1].substring(
  283. resValueData[1].length - 4,
  284. resValueData[1].length
  285. );
  286. console.log("打印状态");
  287. console.log(status);
  288. if (status === "9000") {
  289. console.log(resValueData);
  290. var valueResponse = resValueData.toString();
  291. console.log(response);
  292. var applyDic = {
  293. command: value.command,
  294. cosResponse: valueResponse,
  295. rechargeId: value.rechargeId,
  296. };
  297. console.log("消费成功");
  298. quanApplyAction(applyDic).then((applyValue) => {
  299. uanConfirmAction(value)
  300. // uanConfirmAction(applyValue).then((
  301. // confirmResult) => {
  302. // console.log("成功111111111111", confirmResult)
  303. // navTo(
  304. // `/subpackage/after-sale/refund-order-balance/result`)
  305. // });
  306. });
  307. }
  308. });
  309. } else if (fixStatus === 2) {
  310. uanConfirmSucessAction(value).then((confirmResult) => {
  311. console.log("成功222222222222", confirmResult)
  312. navTo(
  313. `/subpackage/after-sale/refund-order-balance/result`)
  314. });
  315. } else if (fixStatus === 1) {
  316. quanCheckActionTrue().then((val) => {
  317. checkQuanCengEvent(val);
  318. });
  319. }
  320. });
  321. uni.hideLoading();
  322. }
  323. });
  324. }
  325. };
  326. const uanConfirmSucessAction = (data) => {
  327. var form = {
  328. command: data.command,
  329. cosResponse: "9000",
  330. rechargeId: data.rechargeId,
  331. paidAmount: data.fee,
  332. giftAmount: 0,
  333. };
  334. const options = {
  335. type: 2,
  336. data: form,
  337. method: "POST",
  338. showLoading: true,
  339. };
  340. return new Promise(async (resolve, reject) => {
  341. const res = await request(quanConfirm, options);
  342. const data = stringToJson(res.bizContent);
  343. resolve(data);
  344. }).catch((error) => {
  345. reject(error);
  346. });
  347. };
  348. const quanCheckActionTrue = () => {
  349. console.log("进行真实圈存检测");
  350. var data = {
  351. cardId: card.cardId,
  352. orderId: state.id,
  353. preBalance: card.money,
  354. fee: state.refundBalance,
  355. tradeType: 4,
  356. };
  357. const options = {
  358. type: 2,
  359. data: data,
  360. method: "POST",
  361. showLoading: true,
  362. };
  363. return new Promise(async (resolve, reject) => {
  364. const res = await request(quanCheck, options);
  365. const data = stringToJson(res.bizContent);
  366. resolve(data);
  367. }).catch((error) => {
  368. reject(error);
  369. });
  370. };
  371. /*圈存申请*/
  372. const quanApplyAction = (data) => {
  373. var form = {
  374. cardId: card.cardId,
  375. tradeType: 4,
  376. command: data.command,
  377. cosResponse: data.cosResponse,
  378. orderId: state.id,
  379. rechargeId: data.rechargeId,
  380. fee: state.refundBalance,
  381. preBalance: card.money,
  382. };
  383. const options = {
  384. type: 2,
  385. data: form,
  386. method: "POST",
  387. showLoading: true,
  388. };
  389. return new Promise(async (resolve, reject) => {
  390. console.log("70", options)
  391. const res = await request(quanApply, options);
  392. const data = stringToJson(res.bizContent);
  393. resolve(data);
  394. }).catch((error) => {
  395. reject(error);
  396. });
  397. };
  398. /*圈存确认*/
  399. const uanConfirmAction = (data) => {
  400. console.log("圈存确认进入", data);
  401. console.log("applyValue===========", data)
  402. let cmdArr = data.command.split(",");
  403. console.log(cmdArr);
  404. bluetoothUtil.transCmd(cmdArr, "10", function (res) {
  405. console.log("圈存透传");
  406. console.log(res);
  407. var arraylenth = res.length;
  408. var status = res[arraylenth - 1].substring(
  409. res[arraylenth - 1].length - 4,
  410. res[arraylenth - 1].length
  411. );
  412. console.log("打印圈存确认指令状态");
  413. console.log(status);
  414. if (status === "9000") {
  415. var form = {
  416. command: data.command,
  417. cosResponse: res.toString(),
  418. rechargeId: data.rechargeId,
  419. paidAmount: state.refundBalance,
  420. giftAmount: 0,
  421. };
  422. const options = {
  423. type: 2,
  424. data: form,
  425. method: "POST",
  426. showLoading: true,
  427. };
  428. request(quanConfirm, options).then((res) => {
  429. const result = stringToJson(res.bizContent);
  430. navTo(
  431. `/subpackage/after-sale/refund-order-balance/result`)
  432. });
  433. }
  434. });
  435. // return new Promise(async (resolve, reject) => {
  436. // uni.hideLoading();
  437. // const res = await request(quanConfirm, options);
  438. // const data = stringToJson(res.bizContent);
  439. // console.log("data=========", data)
  440. // resolve(data);
  441. // }).catch((error) => {
  442. // reject(error);
  443. // });
  444. // }
  445. // });
  446. };
  447. /*圈存修复*/
  448. const quanFixAction = (val) => {
  449. var data = {
  450. command: val.command, //修复初始化的指令
  451. cosResponse: val.cosResponse, //修复初始化结果
  452. rechargeId: val.rechargeId, //充值流水号
  453. };
  454. const options = {
  455. type: 2,
  456. data: data,
  457. method: "POST",
  458. showLoading: true,
  459. };
  460. return new Promise(async (resolve, reject) => {
  461. const res = await request(quanXf, options);
  462. const data = stringToJson(res.bizContent);
  463. resolve(data);
  464. }).catch((error) => {
  465. reject(error);
  466. });
  467. };
  468. </script>
  469. <style>
  470. page {
  471. width: 100%;
  472. height: 100%;
  473. display: flex;
  474. flex-direction: column;
  475. background-color: #EEF7F7;
  476. box-sizing: border-box;
  477. }
  478. </style>
  479. <style lang="scss" scoped>
  480. .oderPage {
  481. .details {
  482. margin: 30rpx;
  483. position: relative;
  484. background: #fff;
  485. border-radius: 20rpx;
  486. padding: 30rpx;
  487. height: 370rpx;
  488. background: #FFFFFF;
  489. box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(223, 223, 223, 0.8);
  490. border-radius: 20rpx;
  491. .header {
  492. align-items: center;
  493. display: flex;
  494. padding-bottom: 30rpx;
  495. // border-bottom: 1px solid #DCDCDC;
  496. image {
  497. width: 51rpx;
  498. height: 31rpx;
  499. }
  500. text {
  501. font-size: 30rpx;
  502. margin-left: 20rpx;
  503. font-weight: 600;
  504. }
  505. }
  506. .hr {
  507. height: 1rpx;
  508. background: #DCDCDC;
  509. width: 100%;
  510. position: absolute;
  511. left: 50%;
  512. transform: translate(-50%);
  513. }
  514. .row {
  515. display: flex;
  516. margin: 34rpx 0;
  517. font-size: 26rpx;
  518. font-family: Noto Sans S Chinese;
  519. font-weight: 400;
  520. color: #333333;
  521. line-height: 30rpx;
  522. view {
  523. font-size: 26rpx;
  524. font-family: Noto Sans S Chinese;
  525. font-weight: 400;
  526. color: #999999;
  527. line-height: 30rpx;
  528. }
  529. }
  530. .line {
  531. width: 100%;
  532. height: 1rpx;
  533. background: #DCDCDC;
  534. }
  535. button {
  536. height: 61rpx;
  537. background: #FFFFFF;
  538. border: 1px solid #00B38B;
  539. border-radius: 30rpx;
  540. font-size: 26rpx;
  541. font-family: Noto Sans S Chinese;
  542. font-weight: 400;
  543. color: #00B38B;
  544. line-height: 32rpx;
  545. position: absolute;
  546. right: 30rpx;
  547. bottom: 20rpx;
  548. padding: 16rpx 28rpx;
  549. }
  550. }
  551. }
  552. </style>