選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

recharge-weixin.vue 20KB

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