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.

recharge.vue 22KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886
  1. <template>
  2. <view class="wrapper">
  3. <view class="account">
  4. <image :src="`${$imgUrl}common/bg-recharge.png`" class="head-bg" mode="aspectFill"></image>
  5. <view class="account-text">
  6. <view class="balance">
  7. <text class="balance-tit">账户余额</text>
  8. <text class="balance-val">0元</text>
  9. </view>
  10. <view class="right-box">
  11. <view class="no">账户编号:000100</view>
  12. <view class="btn btn-record" @click="goRecord()">账户充值记录</view>
  13. </view>
  14. </view>
  15. </view>
  16. <view class="input-box">
  17. <input v-model="state.money" placeholder="请输入金额" class="input" />
  18. <view class="tips">最低充值金额不小于10元</view>
  19. </view>
  20. <view class="tabs">
  21. <view class="tab-tit">在线充值</view>
  22. <view class="tab">
  23. <view v-for="(item,index) in state.moneryArray" @click="tableIndexAction(index)" :key="index"
  24. :class="{'item':state.moneryArray,'active':state.tableIndex===index}">{{item.name}}</view>
  25. </view>
  26. </view>
  27. <view class="btn btn-primary" @click="rechargeAction">立即充值</view>
  28. </view>
  29. <!-- <bluetooth :routeType="2" :cardId="state.cardId" v-if="state.isShowBlue" @submit="getParams"></bluetooth> -->
  30. </template>
  31. <script setup lang="ts">
  32. import {
  33. stringToJson
  34. } from "@/utils/network/encryption";
  35. import {
  36. onLoad,
  37. onShow
  38. } from "@dcloudio/uni-app";
  39. import {
  40. quanCheck,
  41. quanApply,
  42. quanXf,
  43. cardCzPayResultCheck,
  44. cardCzApply,
  45. cardCzPay,
  46. cardCzPayResult,
  47. cardCzXFCheck,
  48. quanConfirm,
  49. wechatAppID,
  50. wechatPayConfigId,
  51. wechatSecret,
  52. } from "@/utils/network/api.js";
  53. import {
  54. request
  55. } from "@/utils/network/request.js";
  56. import {
  57. reactive
  58. } from "vue";
  59. import {
  60. navTo
  61. } from "@/utils/utils"
  62. import {
  63. msg
  64. } from "@/utils/utils";
  65. import {
  66. getItem,
  67. StorageKeys,
  68. setItem
  69. } from "@/utils/storage";
  70. // const bluetooth=require("../../components/bluetooth/bluetooth")
  71. const datas = require("../../static/etcUtil/datas.js");
  72. const bluetoothUtil = require("../../static/etcUtil/index.js");
  73. const cmd = require("../../static/etcUtil/cmdConfig.js");
  74. const tools = require("../../static/etcUtil/tools.js");
  75. const NFCAPI = require('../../utils/nfc/NFCAPI.js');
  76. const state = reactive({
  77. isShowBlue: false,
  78. moneryArray: [{
  79. name: '50元',
  80. value: 50
  81. }, {
  82. name: '100元',
  83. value: 100
  84. }, {
  85. name: '200元',
  86. value: 200
  87. }, {
  88. name: '300元',
  89. value: 300
  90. }, {
  91. name: '500元',
  92. value: 500
  93. }, {
  94. name: '1000元',
  95. value: 1000
  96. }],
  97. tableIndex: 0,
  98. openid: "",
  99. connectSuccess: undefined,
  100. fee: 5000,
  101. money: 50,
  102. orderNum: "",
  103. transWay: "", //“blu”为蓝牙充值方式、“nfc”为NFC充值方式
  104. cardId: "", //卡号 需要传参
  105. mockpreBalance: 2000, //fix:模拟余额 目前没有检测状态接口,第一次会模拟圈层检测来检测状态
  106. show: false,
  107. items: [{
  108. value: '0',
  109. name: '微信',
  110. checked: 'true'
  111. },
  112. {
  113. value: '1',
  114. name: '对公账户'
  115. }
  116. ],
  117. current: 0
  118. });
  119. //读卡信息
  120. const card : any = reactive({
  121. cardId: "",
  122. netId: "",
  123. cardType: "",
  124. startTime: "",
  125. endTime: "",
  126. userName: "",
  127. idNum: "",
  128. vehiclePlate: "",
  129. vehiclePlateColor: "",
  130. color: "",
  131. version: "",
  132. type: "",
  133. favourable: "",
  134. money: undefined,
  135. v_userType: "",
  136. });
  137. // const getParams = (val: any) => {
  138. // console.log("val蓝牙完毕传过来的参数", val)
  139. // state.cardId = val.cardId;
  140. // state.connectSuccess = val.connectSuccess;
  141. // }
  142. onLoad((option) => {
  143. /*获取openId 用途:(用户支付)*/
  144. getOpenID();
  145. /*传参*/
  146. state.transWay = option.transWay; //“blu”为蓝牙充值方式、“nfc”为NFC充值方式
  147. state.cardId = option.cardId;
  148. state.connectSuccess = option.connectSuccess;
  149. state.orderNum = getItem("orderNum");
  150. // 金额回填,本来是好的,但是他跳转了,跳转过来就得刷新页面,所以就是默认的5000
  151. if (option.fee) {
  152. state.fee = option.fee
  153. state.money = option.fee / 100
  154. } else {
  155. state.fee = state.money * 100; //元换成分
  156. }
  157. console.log("state.fee", option)
  158. //跳转过来走圈存流程
  159. if (state.connectSuccess === "1") {
  160. /*读卡*/
  161. getCardId();
  162. } else {
  163. quanCheckAction().then((val : any) => {
  164. console.log("圈层检测val", val)
  165. //如果 圈层检测正常
  166. if (val.chargeStatus === 1) {
  167. console.log(`进行充值检测`);
  168. czCheckAction().then((checkResult : any) => {
  169. //判断订单逻辑如果有订单充值 则直接拿到订单去链接蓝牙
  170. if (checkResult.orders && checkResult.orders.length > 0) {
  171. //拿到订单,存起来
  172. state.orderNum = checkResult.orders[0].orderNum;
  173. setItem("orderNum", state.orderNum);
  174. // 检测用户是否存在有半条流水
  175. go()
  176. } else {
  177. console.log('没有可修复的流水')
  178. }
  179. });
  180. } else {
  181. // 检测用户是否存在有半条流水
  182. go()
  183. }
  184. });
  185. }
  186. });
  187. function go() {
  188. uni.showModal({
  189. title: '提示',
  190. content: '检测到你有一笔未充值的订单,请先进行充值!',
  191. success: () => {
  192. //走蓝牙进行修复
  193. uni.redirectTo({
  194. url: `/pages/bluetooth/bluetooth?routeType=2&&cardId=${state.cardId}&&fee=${state.fee}`,
  195. });
  196. // state.isShowBlue=true;
  197. console.log("state.isShowBlue", state.isShowBlue)
  198. },
  199. fail: () => { }
  200. })
  201. }
  202. const tableIndexAction = (val : any) => {
  203. state.tableIndex = val
  204. state.money = state.moneryArray[val].value
  205. }
  206. /*点击充值按钮*/
  207. const rechargeAction = () => {
  208. state.fee = state.money * 100; //元换成分
  209. wx.showModal({
  210. title: '圈存确认',
  211. content: '您确定要充值圈存吗',
  212. success: function (res) {
  213. if (res.confirm) {
  214. /*进行圈层检测,此处检测仅为校验圈层状态来决定去哪里*/
  215. console.log("进行圈层检测");
  216. quanCheckAction().then((val : any) => {
  217. //如果 圈层检测正常
  218. if (val.chargeStatus === 1) {
  219. console.log(`进行充值检测`);
  220. czCheckAction().then((checkResult : any) => {
  221. //判断订单逻辑如果有订单充值 则直接拿到订单去链接蓝牙
  222. if (checkResult.orders && checkResult.orders.length > 0) {
  223. //拿到订单,存起来
  224. state.orderNum = checkResult.orders[0].orderNum;
  225. setItem("orderNum", state.orderNum);
  226. //链接蓝牙
  227. go()
  228. } else {
  229. cardCzApplyAction().then((applyResult : any) => {
  230. //拿到订单 存起来
  231. state.orderNum = applyResult.orderNum;
  232. setItem("orderNum", state.orderNum);
  233. //如果订单没有支付 走支付
  234. if (applyResult.orderStatus === "ORDER_NOT_PAY") {
  235. //走支付
  236. console.log("走支付");
  237. wxPayment();
  238. }
  239. });
  240. }
  241. });
  242. } else {
  243. //走蓝牙进行修复
  244. go()
  245. }
  246. });
  247. }
  248. }
  249. });
  250. };
  251. /*读卡*/
  252. const getCardId = () => {
  253. console.log("======获取卡信息======");
  254. let cmdArr = [
  255. cmd.HOME_DIRECTORY,
  256. //选择主目
  257. cmd.APPLICATION_DIRECTORY,
  258. //选择文件1001--DF01联网收费应用目录
  259. cmd.CMD_READBINARY,
  260. //15文件--卡片发行基本数据文件
  261. cmd.CMD_GETBALANCE,
  262. //钱包
  263. ];
  264. tools.showLoadingAlert("正在执行指令");
  265. transCmd(cmdArr, function (res : any) {
  266. getCardIdReturn(res);
  267. })
  268. };
  269. function getCardIdReturn(res : any) {
  270. tools.hideLoadingAlert();
  271. //10:写卡 20:写OBU
  272. let str = res[2].substring(res[2].length - 4, res[2].length);
  273. let str3 = res[3].substring(res[3].length - 4, res[3].length);
  274. if (str == "9000" || str3 == "9000") {
  275. if (res[2].length > 86 || res[3] >= 12) {
  276. card.cardId = res[2].substring(20, 40); //卡号
  277. card.startTime = res[2].substring(40, 48);
  278. card.endTime = res[2].substring(48, 56);
  279. card.version = res[2].substring(18, 19) >= 4 ? "4x" : "2x";
  280. card.netId = res[2].substring(20, 24);
  281. card.cardType = res[2].substring(28, 29) == 23 ? 1 : 2;
  282. card.vehiclePlateColor = parseInt(res[2].substring(82, 84), 16);
  283. (card.money = parseInt(parseInt(res[3].substring(0, 8), 16), 10)),
  284. console.log("======卡信息======", card);
  285. if (card.cardId !== state.cardId) {
  286. msg("设备卡信息与当前充值卡号不匹配,请核对卡号");
  287. return;
  288. }
  289. quanCheckActionTrue().then((val) => {
  290. checkQuanCengEvent(val);
  291. });
  292. } else {
  293. console.error("CMD_READBINARY指令长度不符" + res[2]);
  294. tools.hideLoadingAlert();
  295. }
  296. }
  297. console.error("CMD_READBINARY指令长度不符" + res[2]);
  298. tools.hideLoadingAlert();
  299. }
  300. const checkQuanCengEvent = (val : any) => {
  301. if (val.chargeStatus === 1) {
  302. let cmdArr = val.command.split(",");
  303. uni.showLoading({
  304. title: "写入中",
  305. });
  306. transCmd(cmdArr, function (res : any) {
  307. let response = res.toString();
  308. var dic = {
  309. command: val.command,
  310. cosResponse: response,
  311. };
  312. uni.hideLoading();
  313. cardCzXFCheckAction().then((xfRes) => {
  314. quanApplyAction(dic).then((value : any) => {
  315. console.log("圈层申请完后的结果");
  316. console.log(value.commandType, value);
  317. //圈存初始化验证通过 , 进行圈存
  318. if (value.commandType === 2) {
  319. uanConfirmAction(value);
  320. } else {
  321. quanApplyAction(value).then((values) => {
  322. console.log("圈层申请完后的结果");
  323. uanConfirmAction(values);
  324. });
  325. // msg("圈存初始化指令验证失败, 重新初始化");
  326. }
  327. });
  328. });
  329. });
  330. } else {
  331. let cmdArr = val.command.split(",");
  332. uni.showLoading({
  333. title: "写入中",
  334. });
  335. transCmd(cmdArr, function (res : any) {
  336. var status = res[1].substring(res[1].length - 4, res[1].length);
  337. console.log("打印状态");
  338. console.log(status);
  339. if (status === "9000") {
  340. console.log("修复指令入参");
  341. let response = res.toString();
  342. var dic = {
  343. command: val.command,
  344. cosResponse: response,
  345. rechargeId: val.rechargeId,
  346. };
  347. quanFixAction(dic).then((value : any) => {
  348. console.log(value);
  349. console.log("修复结果返回");
  350. var fixStatus = value.fixStatus;
  351. //圈存修复COS指令Response信息不足,重新进行修复初始化
  352. if (fixStatus === 3) {
  353. let xfcmdArr = value.command.split(",");
  354. bluetoothUtil.transCmd(xfcmdArr, "10", function (resValueData) {
  355. var status = resValueData[1].substring(
  356. resValueData[1].length - 4,
  357. resValueData[1].length
  358. );
  359. console.log("打印状态");
  360. console.log(status);
  361. if (status === "9000") {
  362. console.log(resValueData);
  363. var valueResponse = resValueData.toString();
  364. console.log(response);
  365. var applyDic = {
  366. command: value.command,
  367. cosResponse: valueResponse,
  368. rechargeId: value.rechargeId,
  369. };
  370. console.log("消费成功");
  371. quanApplyAction(applyDic).then((applyValue) => {
  372. uanConfirmAction(applyValue);
  373. });
  374. }
  375. });
  376. } else if (fixStatus === 2) {
  377. uanConfirmSucessAction(value).then((confirmResult) => {
  378. console.log("充值成功")
  379. msg("充值成功");
  380. navTo(`/pages/recharge/result`)
  381. });
  382. } else if (fixStatus === 1) {
  383. quanCheckActionTrue().then((val) => {
  384. checkQuanCengEvent(val);
  385. });
  386. }
  387. });
  388. uni.hideLoading();
  389. }
  390. });
  391. }
  392. };
  393. /*透传*/
  394. const transCmd = (cmd : any, click : any) => {
  395. if (state.transWay == 'blu') {
  396. bluetoothUtil.transCmd(cmd, "10", function (res : any) {
  397. click(res);
  398. });
  399. } else {
  400. //nfc透传
  401. NFCAPI.transCmd(cmd, function (res : any) {
  402. tools.hideLoadingAlert();
  403. if (res.code == 0) {
  404. click(res.data);
  405. } else {
  406. //透传失败返回
  407. tools.alertF(res.msg);
  408. }
  409. });
  410. }
  411. };
  412. /*圈层检测 -假数据校验*/
  413. const quanCheckAction = () => {
  414. var data = {
  415. cardId: state.cardId, //卡号
  416. fee: state.fee,
  417. preBalance: state.mockpreBalance, //假余额
  418. tradeType: 14,
  419. };
  420. const options = {
  421. type: 2,
  422. data: data,
  423. method: "POST",
  424. showLoading: true,
  425. };
  426. return new Promise(async (resolve, reject) => {
  427. const res = await request(quanCheck, options);
  428. const data = stringToJson(res.bizContent);
  429. resolve(data);
  430. }).catch((error) => {
  431. reject(error);
  432. });
  433. };
  434. const quanCheckActionTrue = () => {
  435. console.log("进行真实圈层检测");
  436. var data = {
  437. cardId: card.cardId,
  438. fee: state.fee,
  439. preBalance: card.money,
  440. tradeType: 14,
  441. };
  442. const options = {
  443. type: 2,
  444. data: data,
  445. method: "POST",
  446. showLoading: true,
  447. };
  448. return new Promise(async (resolve, reject) => {
  449. const res = await request(quanCheck, options);
  450. const data = stringToJson(res.bizContent);
  451. resolve(data);
  452. }).catch((error) => {
  453. reject(error);
  454. });
  455. };
  456. /*充值消费*/
  457. const cardCzXFCheckAction = () => {
  458. var data = {
  459. cardId: card.cardId, //修复初始化的指令
  460. openId: getItem(StorageKeys.OpenId), //修复初始化结果
  461. orderNum: state.orderNum, //充值流水号
  462. };
  463. const options = {
  464. type: 2,
  465. data: data,
  466. method: "POST",
  467. showLoading: true,
  468. };
  469. return new Promise(async (resolve, reject) => {
  470. const res = await request(cardCzXFCheck, options);
  471. const data = stringToJson(res.bizContent);
  472. resolve(data);
  473. }).catch((error) => {
  474. reject(error);
  475. });
  476. };
  477. /*圈存修复*/
  478. const quanFixAction = (val) => {
  479. var data = {
  480. command: val.command, //修复初始化的指令
  481. cosResponse: val.cosResponse, //修复初始化结果
  482. rechargeId: val.rechargeId, //充值流水号
  483. };
  484. const options = {
  485. type: 2,
  486. data: data,
  487. method: "POST",
  488. showLoading: true,
  489. };
  490. return new Promise(async (resolve, reject) => {
  491. const res = await request(quanXf, options);
  492. const data = stringToJson(res.bizContent);
  493. resolve(data);
  494. }).catch((error) => {
  495. reject(error);
  496. });
  497. };
  498. /*圈层申请*/
  499. const quanApplyAction = (data) => {
  500. var form = {
  501. cardId: card.cardId,
  502. fee: state.fee,
  503. preBalance: card.money,
  504. tradeType: 14,
  505. command: data.command,
  506. cosResponse: data.cosResponse,
  507. orderId: state.orderNum,
  508. rechargeId: data.rechargeId,
  509. };
  510. const options = {
  511. type: 2,
  512. data: form,
  513. method: "POST",
  514. showLoading: true,
  515. };
  516. return new Promise(async (resolve, reject) => {
  517. const res = await request(quanApply, options);
  518. const data = stringToJson(res.bizContent);
  519. resolve(data);
  520. console.log("quanApplyAction", data)
  521. }).catch((error) => {
  522. reject(error);
  523. });
  524. };
  525. /*圈层确认*/
  526. const uanConfirmAction = (data : any) => {
  527. console.log("圈层确认进入");
  528. let cmdArr = data.command.split(",");
  529. console.log(cmdArr);
  530. transCmd(cmdArr, function (res : any) {
  531. console.log("圈层透传");
  532. console.log(res);
  533. var arraylenth = res.length;
  534. var status = res[arraylenth - 1].substring(
  535. res[arraylenth - 1].length - 4,
  536. res[arraylenth - 1].length
  537. );
  538. console.log("打印圈层确认指令状态");
  539. if (status === "9000") {
  540. var form = {
  541. command: data.command,
  542. cosResponse: res.toString(),
  543. rechargeId: data.rechargeId,
  544. paidAmount: state.fee,
  545. giftAmount: 0,
  546. };
  547. const options = {
  548. type: 2,
  549. data: form,
  550. method: "POST",
  551. showLoading: true,
  552. };
  553. return new Promise(async () => {
  554. const res = await request(quanConfirm, options);
  555. const data = stringToJson(res.bizContent);
  556. // resolve(data);
  557. console.log("data", data);
  558. msg("充值成功");
  559. navTo(`/pages/recharge/result`)
  560. }).catch((error) => {
  561. console.log('输出内容', error)
  562. });
  563. }
  564. });
  565. };
  566. const uanConfirmSucessAction = (data) => {
  567. var form = {
  568. command: data.command,
  569. cosResponse: "9000",
  570. rechargeId: data.rechargeId,
  571. paidAmount: state.fee,
  572. giftAmount: 0,
  573. };
  574. const options = {
  575. type: 2,
  576. data: form,
  577. method: "POST",
  578. showLoading: true,
  579. };
  580. return new Promise(async (resolve, reject) => {
  581. const res = await request(quanConfirm, options);
  582. const data = stringToJson(res.bizContent);
  583. resolve(data);
  584. console.log("uanConfirmSucessAction", data)
  585. }).catch((error) => {
  586. reject(error);
  587. });
  588. };
  589. /*充值检测*/
  590. const czCheckAction = () => {
  591. var form = {
  592. cardId: state.cardId,
  593. openId: getItem(StorageKeys.OpenId),
  594. };
  595. const options = {
  596. type: 2,
  597. data: form,
  598. method: "POST",
  599. showLoading: true,
  600. };
  601. return new Promise(async (resolve, reject) => {
  602. const res = await request(cardCzPayResultCheck, options);
  603. const data = stringToJson(res.bizContent);
  604. console.log("充值检测", data)
  605. resolve(data);
  606. }).catch((error) => {
  607. reject(error);
  608. });
  609. };
  610. /*充值申请*/
  611. const cardCzApplyAction = () => {
  612. var data = {
  613. cardId: state.cardId,
  614. openId: getItem(StorageKeys.OpenId),
  615. rechargeMoney: state.fee,
  616. };
  617. const options = {
  618. type: 2,
  619. data: data,
  620. method: "POST",
  621. showLoading: true,
  622. };
  623. return new Promise(async (resolve, reject) => {
  624. const res = await request(cardCzApply, options);
  625. const data = stringToJson(res.bizContent);
  626. resolve(data);
  627. }).catch((error) => {
  628. reject(error);
  629. });
  630. };
  631. //获取微信小程序openid
  632. const getOpenID = () => {
  633. uni.login({
  634. provider: "weixin",
  635. success: function (e) {
  636. wx.request({
  637. url: `https://api.weixin.qq.com/sns/jscode2session?appid=${wechatAppID}&secret=${wechatSecret}&js_code=${e.code}&grant_type=authorization_code`,
  638. success: (res : any) => {
  639. state.openid = res.data.openid;
  640. },
  641. });
  642. },
  643. fail: function () {
  644. msg("获取不到oppenId,请检查AppID和Secret是否争取");
  645. },
  646. });
  647. };
  648. //掉起微信支付
  649. const wxPayment = () => {
  650. // #ifdef MP-WEIXIN
  651. const options = {
  652. type: 2,
  653. data: {
  654. openId: getItem(StorageKeys.OpenId),
  655. wxOpenId: state.openid,
  656. cardId: state.cardId,
  657. orderNum: state.orderNum,
  658. payConfigId: wechatPayConfigId,
  659. body: "储值卡充值",
  660. },
  661. method: "POST",
  662. showLoading: true,
  663. };
  664. request(cardCzPay, options).then((res) => {
  665. const data = stringToJson(res.bizContent);
  666. uni.requestPayment({
  667. provider: "wxpay",
  668. orderInfo: "",
  669. timeStamp: data.timestamp,
  670. nonceStr: data.noncestr,
  671. package: data.wxPackage ? data.wxPackage : "",
  672. signType: data.signType,
  673. paySign: data.sign,
  674. success: function () {
  675. //回调订单状态
  676. console.log("回调订单状态");
  677. checkOrder();
  678. },
  679. fail: function (err) {
  680. confirm(err, () => { }, "支付失败", false);
  681. },
  682. });
  683. });
  684. // #endif
  685. };
  686. //支付成功改变订单状态
  687. const checkOrder = () => {
  688. const options = {
  689. type: 2,
  690. data: {
  691. cardId: state.cardId,
  692. openId: getItem(StorageKeys.OpenId),
  693. orderNum: state.orderNum,
  694. },
  695. method: "POST",
  696. showLoading: true,
  697. };
  698. request(cardCzPayResult, options).then((res) => {
  699. const data = stringToJson(res.bizContent);
  700. if (data.tradeState === "SUCCESS"){
  701. uni.redirectTo({
  702. url: `/pages/bluetooth/bluetooth?routeType=2&&cardId=${state.cardId}&&fee=${state.fee}`,
  703. });
  704. }
  705. // state.isShowBlue=true;
  706. console.log(data);
  707. });
  708. };
  709. const goRecord = () => {
  710. uni.navigateTo({
  711. url: `/subpackage/personal-center/consumption-record?cardId=${state.cardId}`
  712. })
  713. }
  714. </script>
  715. <style>
  716. .account {
  717. height: 224rpx;
  718. width: 690rpx;
  719. margin: 30rpx;
  720. position: relative;
  721. }
  722. .account .account-text {
  723. display: flex;
  724. justify-content: space-between;
  725. padding: 20rpx 50rpx;
  726. height: 100%;
  727. }
  728. .account .balance {
  729. display: flex;
  730. flex-direction: column;
  731. justify-content: center;
  732. align-items: flex-start;
  733. color: #ffffff;
  734. }
  735. .account .balance-tit {
  736. font-size: 26rpx;
  737. margin-bottom: 10rpx;
  738. }
  739. .account .balance-val {
  740. font-size: 56rpx;
  741. }
  742. .account .right-box {
  743. display: flex;
  744. flex-direction: column;
  745. justify-content: flex-start;
  746. align-items: flex-end;
  747. }
  748. .account .right-box .no {
  749. font-size: 26rpx;
  750. color: #ffffff;
  751. }
  752. .account .right-box .btn {
  753. font-size: 26rpx;
  754. padding: 0 20rpx;
  755. box-sizing: border-box;
  756. height: 42rpx;
  757. line-height: 42rpx;
  758. color: #28d20f;
  759. background: #ffffff;
  760. border-radius: 21rpx;
  761. display: inline-block;
  762. margin-top: 18rpx;
  763. }
  764. .account .head-bg {
  765. width: 690rpx;
  766. height: 224rpx;
  767. position: absolute;
  768. left: 0;
  769. top: 0;
  770. z-index: -99;
  771. }
  772. .input-box {
  773. display: flex;
  774. flex-direction: column;
  775. justify-content: center;
  776. align-items: center;
  777. padding: 20rpx 0;
  778. }
  779. .input-box .input {
  780. width: 430rpx;
  781. height: 98rpx;
  782. line-height: 98rpx;
  783. background: #f8f8f8;
  784. border: 1px solid #999999;
  785. border-radius: 6rpx;
  786. font-size: 30rpx;
  787. text-align: center;
  788. }
  789. .input-box .tips {
  790. color: #666666;
  791. font-size: 26rpx;
  792. margin-top: 18rpx;
  793. }
  794. .tabs {}
  795. .tabs .tab-tit {
  796. font-size: 30rpx;
  797. color: #333;
  798. padding: 45rpx 0 22rpx 30rpx;
  799. }
  800. .tabs .tab {
  801. display: flex;
  802. flex-wrap: wrap;
  803. justify-content: space-evenly;
  804. }
  805. .tabs .tab .item {
  806. width: 210rpx;
  807. height: 100rpx;
  808. background: #f6fff7;
  809. border: 1px solid #dcdde1;
  810. box-sizing: border-box;
  811. line-height: 100rpx;
  812. border-radius: 6rpx;
  813. text-align: center;
  814. margin-bottom: 24rpx;
  815. color: #333333;
  816. font-size: 32rpx;
  817. }
  818. .tabs .tab .item.active {
  819. border: 1px solid #24cc49;
  820. color: #24cc49;
  821. }
  822. .btn-primary {
  823. width: 670rpx;
  824. height: 80rpx;
  825. line-height: 80rpx;
  826. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  827. border-radius: 40rpx;
  828. font-size: 32rpx;
  829. color: #ffffff;
  830. margin: 200rpx 40rpx 0;
  831. text-align: center;
  832. }
  833. .uni-list {
  834. padding: 120rpx 10rpx 0 10rpx;
  835. font-size: 34rpx;
  836. }
  837. label {
  838. display: flex;
  839. justify-content: space-between;
  840. margin-top: 30rpx;
  841. }
  842. </style>