Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

refund-order-balance.vue 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571
  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.cardBalance / 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. cardBalance:"",
  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.cardBalance=val.cardBalance
  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. if (val.chargeStatus === 1) {
  228. let cmdArr = val.command.split(",");
  229. uni.showLoading({
  230. title: "写入中",
  231. });
  232. bluetoothUtil.transCmd(cmdArr, "10", function(res) {
  233. let response = res.toString();
  234. var dic = {
  235. command: val.command,
  236. cosResponse: response,
  237. };
  238. uni.hideLoading();
  239. quanApplyAction(dic).then((value) => {
  240. console.log("圈层申请完后的结果");
  241. console.log(value);
  242. //圈存初始化验证通过 , 进行圈存
  243. if (value.commandType === 2) {
  244. uanConfirmAction(value).then((confirmResult) => {
  245. navTo(
  246. `/subpackage/after-sale/refund-order-balance/result`)
  247. });
  248. } else {
  249. msg("圈存初始化指令验证失败, 重新初始化");
  250. }
  251. });
  252. });
  253. } else {
  254. let cmdArr = val.command.split(",");
  255. uni.showLoading({
  256. title: "写入中",
  257. });
  258. bluetoothUtil.transCmd(cmdArr, "10", function(res) {
  259. var status = res[1].substring(res[1].length - 4, res[1].length);
  260. console.log("打印状态");
  261. console.log(status);
  262. if (status === "9000") {
  263. console.log("修复指令入参");
  264. let response = res.toString();
  265. var dic = {
  266. command: val.command,
  267. cosResponse: response,
  268. rechargeId: val.rechargeId,
  269. };
  270. quanFixAction(dic).then((value) => {
  271. console.log(value);
  272. console.log("修复结果返回");
  273. var fixStatus = value.fixStatus;
  274. //圈存修复COS指令Response信息不足,重新进行修复初始化
  275. if (fixStatus === 3) {
  276. let xfcmdArr = value.command.split(",");
  277. bluetoothUtil.transCmd(xfcmdArr, "10", function(resValueData) {
  278. var status = resValueData[1].substring(
  279. resValueData[1].length - 4,
  280. resValueData[1].length
  281. );
  282. console.log("打印状态");
  283. console.log(status);
  284. if (status === "9000") {
  285. console.log(resValueData);
  286. var valueResponse = resValueData.toString();
  287. console.log(response);
  288. var applyDic = {
  289. command: value.command,
  290. cosResponse: valueResponse,
  291. rechargeId: value.rechargeId,
  292. };
  293. console.log("消费成功");
  294. quanApplyAction(applyDic).then((applyValue) => {
  295. uanConfirmAction(applyValue).then((
  296. confirmResult) => {
  297. navTo(
  298. `/subpackage/after-sale/refund-order-balance/result`)
  299. });
  300. });
  301. }
  302. });
  303. } else if (fixStatus === 2) {
  304. uanConfirmSucessAction(value).then((confirmResult) => {
  305. navTo(
  306. `/subpackage/after-sale/refund-order-balance/result`)
  307. });
  308. } else if (fixStatus === 1) {
  309. quanCheckActionTrue().then((val) => {
  310. checkQuanCengEvent(val);
  311. });
  312. }
  313. });
  314. uni.hideLoading();
  315. }
  316. });
  317. }
  318. };
  319. const uanConfirmSucessAction = (data) => {
  320. var form = {
  321. command: data.command,
  322. cosResponse: "9000",
  323. rechargeId: data.rechargeId,
  324. paidAmount: data.fee,
  325. giftAmount: 0,
  326. };
  327. const options = {
  328. type: 2,
  329. data: form,
  330. method: "POST",
  331. showLoading: true,
  332. };
  333. return new Promise(async (resolve, reject) => {
  334. const res = await request(quanConfirm, options);
  335. const data = stringToJson(res.bizContent);
  336. resolve(data);
  337. }).catch((error) => {
  338. reject(error);
  339. });
  340. };
  341. const quanCheckActionTrue = () => {
  342. console.log("进行真实圈层检测");
  343. // msg(card.money)
  344. // msg(state.list[0].cardBalance)
  345. var data = {
  346. cardId: card.cardId,
  347. orderId: state.id,
  348. preBalance: card.money,
  349. fee: state.cardBalance,
  350. tradeType: 4,
  351. };
  352. const options = {
  353. type: 2,
  354. data: data,
  355. method: "POST",
  356. showLoading: true,
  357. };
  358. return new Promise(async (resolve, reject) => {
  359. const res = await request(quanCheck, options);
  360. const data = stringToJson(res.bizContent);
  361. resolve(data);
  362. }).catch((error) => {
  363. reject(error);
  364. });
  365. };
  366. /*圈层申请*/
  367. const quanApplyAction = (data) => {
  368. var form = {
  369. cardId: card.cardId,
  370. tradeType: 4,
  371. command: data.command,
  372. cosResponse: data.cosResponse,
  373. orderId: state.id,
  374. rechargeId: data.rechargeId,
  375. fee: state.cardBalance,
  376. preBalance: card.money,
  377. };
  378. const options = {
  379. type: 2,
  380. data: form,
  381. method: "POST",
  382. showLoading: true,
  383. };
  384. return new Promise(async (resolve, reject) => {
  385. console.log("70",options)
  386. const res = await request(quanApply, options);
  387. const data = stringToJson(res.bizContent);
  388. resolve(data);
  389. }).catch((error) => {
  390. reject(error);
  391. });
  392. };
  393. /*圈层确认*/
  394. const uanConfirmAction = (data) => {
  395. console.log("圈层确认进入");
  396. let cmdArr = data.command.split(",");
  397. console.log(cmdArr);
  398. bluetoothUtil.transCmd(cmdArr, "10", function(res) {
  399. console.log("圈层透传");
  400. console.log(res);
  401. var arraylenth = res.length;
  402. var status = res[arraylenth - 1].substring(
  403. res[arraylenth - 1].length - 4,
  404. res[arraylenth - 1].length
  405. );
  406. console.log("打印圈层确认指令状态");
  407. console.log(status);
  408. if (status === "9000") {
  409. var form = {
  410. command: data.command,
  411. cosResponse: res.toString(),
  412. rechargeId: data.rechargeId,
  413. paidAmount:data.fee,
  414. giftAmount: 0,
  415. };
  416. const options = {
  417. type: 2,
  418. data: form,
  419. method: "POST",
  420. showLoading: true,
  421. };
  422. return new Promise(async (resolve, reject) => {
  423. const res = await request(quanConfirm, options);
  424. const data = stringToJson(res.bizContent);
  425. resolve(data);
  426. }).catch((error) => {
  427. reject(error);
  428. });
  429. }
  430. });
  431. };
  432. /*圈存修复*/
  433. const quanFixAction = (val) => {
  434. var data = {
  435. command: val.command, //修复初始化的指令
  436. cosResponse: val.cosResponse, //修复初始化结果
  437. rechargeId: val.rechargeId, //充值流水号
  438. };
  439. const options = {
  440. type: 2,
  441. data: data,
  442. method: "POST",
  443. showLoading: true,
  444. };
  445. return new Promise(async (resolve, reject) => {
  446. const res = await request(quanXf, options);
  447. const data = stringToJson(res.bizContent);
  448. resolve(data);
  449. }).catch((error) => {
  450. reject(error);
  451. });
  452. };
  453. </script>
  454. <style>
  455. page {
  456. width: 100%;
  457. height: 100%;
  458. display: flex;
  459. flex-direction: column;
  460. background-color: #EEF7F7;
  461. box-sizing: border-box;
  462. }
  463. </style>
  464. <style lang="scss" scoped>
  465. .oderPage {
  466. .details {
  467. margin: 30rpx;
  468. position: relative;
  469. background: #fff;
  470. border-radius: 20rpx;
  471. padding: 30rpx;
  472. height: 370rpx;
  473. background: #FFFFFF;
  474. box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(223, 223, 223, 0.8);
  475. border-radius: 20rpx;
  476. .header {
  477. align-items: center;
  478. display: flex;
  479. padding-bottom: 30rpx;
  480. // border-bottom: 1px solid #DCDCDC;
  481. image {
  482. width: 51rpx;
  483. height: 31rpx;
  484. }
  485. text {
  486. font-size: 30rpx;
  487. margin-left: 20rpx;
  488. font-weight: 600;
  489. }
  490. }
  491. .hr {
  492. height: 1rpx;
  493. background: #DCDCDC;
  494. width: 100%;
  495. position: absolute;
  496. left: 50%;
  497. transform: translate(-50%);
  498. }
  499. .row {
  500. display: flex;
  501. margin: 34rpx 0;
  502. font-size: 26rpx;
  503. font-family: Noto Sans S Chinese;
  504. font-weight: 400;
  505. color: #333333;
  506. line-height: 30rpx;
  507. view {
  508. font-size: 26rpx;
  509. font-family: Noto Sans S Chinese;
  510. font-weight: 400;
  511. color: #999999;
  512. line-height: 30rpx;
  513. }
  514. }
  515. .line {
  516. width: 100%;
  517. height: 1rpx;
  518. background: #DCDCDC;
  519. }
  520. button {
  521. // width: 141rpx;
  522. height: 61rpx;
  523. background: #FFFFFF;
  524. border: 1px solid #00B38B;
  525. border-radius: 30rpx;
  526. font-size: 26rpx;
  527. font-family: Noto Sans S Chinese;
  528. font-weight: 400;
  529. color: #00B38B;
  530. line-height: 50rpx;
  531. position: absolute;
  532. right: 30rpx;
  533. bottom: 20rpx;
  534. padding: 6rpx 10rpx;
  535. }
  536. }
  537. }
  538. </style>