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.

refund-order-balance.vue 7.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  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}}</text>
  27. </view>
  28. <view class="line">
  29. </view>
  30. <button v-if="item.refundType === 'GLYQR'" @click="refundTypeAction(item)"> 补领申请</button>
  31. <button v-if="item.refundType === 'BALSUP'" @click="refundTypeAction(item)"> 圈层</button>
  32. </view>
  33. <view v-else>
  34. <empty title='暂无找到该车牌相关余额补领信息' />
  35. </view>
  36. </view>
  37. </template>
  38. <script setup lang="ts">
  39. import {
  40. reactive,
  41. ref
  42. } from "vue"
  43. import {
  44. navTo
  45. } from "@/utils/utils"
  46. import {
  47. onLoad,
  48. onShow,
  49. onUnload
  50. } from "@dcloudio/uni-app";
  51. import {
  52. queryRefund,
  53. queryRefundApply
  54. } from "@/utils/network/api.js";
  55. import {
  56. request
  57. } from "@/utils/network/request.js";
  58. import {
  59. msg
  60. } from "@/utils/utils";
  61. import {
  62. stringToJson
  63. } from "@/utils/network/encryption";
  64. //-----蓝牙模块
  65. const bluetoothUtil = require("../../static/etcUtil/index.js");
  66. const cmd = require("../../static/etcUtil/cmdConfig.js");
  67. const tools = require("../../static/etcUtil/tools.js");
  68. const card = reactive({
  69. /*卡相关信息*/
  70. cardId: "",
  71. netId: "",
  72. cardType: "",
  73. startTime: "",
  74. endTime: "",
  75. userName: "",
  76. idNum: "",
  77. vehiclePlate: "",
  78. vehiclePlateColor: "",
  79. color: "",
  80. version: "",
  81. type: "",
  82. favourable: "",
  83. money: undefined,
  84. v_userType: "",
  85. });
  86. const state = reactive({
  87. vehicleId: '',
  88. list: [],
  89. id: ''
  90. });
  91. /*视图进入后操作*/
  92. onLoad((option) => {
  93. state.vehicleId = option.vehicleId
  94. //根据车牌查询信息
  95. queryRefundAction().then(val => {
  96. state.list = val.data
  97. })
  98. /*监听蓝牙回调*/
  99. uni.$on('bluetoothLink', function(status) {
  100. getCardId()
  101. })
  102. });
  103. onUnload(() => {
  104. /*移除监听*/
  105. uni.$off('bluetoothLink')
  106. });
  107. //功能跳转入口
  108. const refundTypeAction = (val: any) => {
  109. if (val.refundType === 'GLYQR') {
  110. /*余额补领申请*/
  111. queryRefundApplyAction(val.id).then((value: any) => {
  112. state.id = value.id
  113. /*查询完刷新状态*/
  114. queryRefundAction().then((result: any) => {
  115. state.list = result.data
  116. })
  117. })
  118. } else if (val.refundType === 'BALSUP') {
  119. /*圈层*/
  120. //链接蓝牙
  121. uni.navigateTo({
  122. url: `/pages/bluetooth/bluetooth?routeType=5`,
  123. });
  124. }
  125. }
  126. //储值卡注销退费查询接口
  127. const queryRefundAction = () => {
  128. var data = {
  129. vehicleId: state.vehicleId
  130. };
  131. const options = {
  132. type: 2,
  133. data: data,
  134. method: "POST",
  135. showLoading: true,
  136. };
  137. return new Promise(async (resolve, reject) => {
  138. const res = await request(queryRefund, options);
  139. const data = stringToJson(res.bizContent);
  140. resolve(data);
  141. }).catch((error) => {
  142. reject(error);
  143. });
  144. }
  145. //储值卡注销余额补领申请接口
  146. const queryRefundApplyAction = (id) => {
  147. var data = {
  148. id: id
  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(queryRefundApply, options);
  158. const data = stringToJson(res.bizContent);
  159. resolve(data);
  160. }).catch((error) => {
  161. reject(error);
  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. if (card.cardId !== state.cardId) {
  195. msg("设备卡信息与当前充值卡号不匹配,请核对卡号");
  196. return;
  197. }
  198. quanCheckActionTrue().then((val) => {
  199. checkQuanCengEvent(val);
  200. });
  201. } else {
  202. console.error("CMD_READBINARY指令长度不符" + res[2]);
  203. tools.hideLoadingAlert();
  204. }
  205. }
  206. console.error("CMD_READBINARY指令长度不符" + res[2]);
  207. tools.hideLoadingAlert();
  208. });
  209. };
  210. </script>
  211. <style>
  212. page {
  213. width: 100%;
  214. height: 100%;
  215. display: flex;
  216. flex-direction: column;
  217. background-color: #EEF7F7;
  218. box-sizing: border-box;
  219. }
  220. </style>
  221. <style lang="scss" scoped>
  222. .oderPage {
  223. .details {
  224. margin: 30rpx;
  225. position: relative;
  226. background: #fff;
  227. border-radius: 20rpx;
  228. padding: 30rpx;
  229. height: 370rpx;
  230. background: #FFFFFF;
  231. box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(223, 223, 223, 0.8);
  232. border-radius: 20rpx;
  233. .header {
  234. align-items: center;
  235. display: flex;
  236. padding-bottom: 30rpx;
  237. // border-bottom: 1px solid #DCDCDC;
  238. image {
  239. width: 51rpx;
  240. height: 31rpx;
  241. }
  242. text {
  243. font-size: 30rpx;
  244. margin-left: 20rpx;
  245. font-weight: 600;
  246. }
  247. }
  248. .hr {
  249. height: 1rpx;
  250. background: #DCDCDC;
  251. width: 100%;
  252. position: absolute;
  253. left: 50%;
  254. transform: translate(-50%);
  255. }
  256. .row {
  257. display: flex;
  258. margin: 34rpx 0;
  259. font-size: 26rpx;
  260. font-family: Noto Sans S Chinese;
  261. font-weight: 400;
  262. color: #333333;
  263. line-height: 30rpx;
  264. view {
  265. font-size: 26rpx;
  266. font-family: Noto Sans S Chinese;
  267. font-weight: 400;
  268. color: #999999;
  269. line-height: 30rpx;
  270. }
  271. }
  272. .line {
  273. width: 100%;
  274. height: 1rpx;
  275. background: #DCDCDC;
  276. }
  277. button {
  278. width: 141rpx;
  279. height: 61rpx;
  280. background: #FFFFFF;
  281. border: 1px solid #00B38B;
  282. border-radius: 30rpx;
  283. font-size: 26rpx;
  284. font-family: Noto Sans S Chinese;
  285. font-weight: 400;
  286. color: #00B38B;
  287. line-height: 61rpx;
  288. position: absolute;
  289. right: 30rpx;
  290. bottom: 20rpx;
  291. padding: 0;
  292. }
  293. }
  294. }
  295. </style>