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-pay.vue 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <view class="wrapper">
  3. <view class="tabs">
  4. <view class="tab-tit as-gravity-center-start">充值方式
  5. <u-input @click="state.transWayTypeShow = true" inputAlign="center" v-model="state.transWayName"
  6. type="select" />
  7. </view>
  8. </view>
  9. <view class="btn btn-primary" @click="rechargeAction">立即充值</view>
  10. </view>
  11. <u-select v-model="state.transWayTypeShow" :list="state.transWayTypeList" @confirm="selectConfirm"></u-select>
  12. </template>
  13. <script setup lang="ts">
  14. import {
  15. stringToJson
  16. } from "@/utils/network/encryption";
  17. import {
  18. onLoad,
  19. onShow
  20. } from "@dcloudio/uni-app";
  21. import {
  22. request
  23. } from "@/utils/network/request.js";
  24. import {
  25. reactive
  26. } from "vue";
  27. import {
  28. navTo
  29. } from "@/utils/utils"
  30. import {
  31. msg
  32. } from "@/utils/utils";
  33. const datas = require("../../static/etcUtil/datas.js");
  34. const bluetoothUtil = require("../../static/etcUtil/index.js");
  35. const cmd = require("../../static/etcUtil/cmdConfig.js");
  36. const tools = require("../../static/etcUtil/tools.js");
  37. const NFCAPI = require('../../static/nfc/NFCAPI.js');
  38. const state = reactive({
  39. transWayTypeShow: false,
  40. transWayTypeList: [{
  41. label: "蓝牙",
  42. value: "blu",
  43. }, {
  44. label: "NFC",
  45. value: "nfc",
  46. }
  47. ],
  48. isShowBlue: false,
  49. tableIndex: 0,
  50. openid: "",
  51. connectSuccess: undefined,
  52. fee: 5000,
  53. money: 50,
  54. orderNum: "",
  55. transWayName: "蓝牙",
  56. transWay: "blu", //“blu”为蓝牙充值方式、“nfc”为NFC充值方式
  57. cardId: "", //卡号 需要传参
  58. mockpreBalance: 2000, //fix:模拟余额 目前没有检测状态接口,第一次会模拟圈层检测来检测状态
  59. show: false,
  60. current: 0
  61. });
  62. const selectConfirm = (item : any) => {
  63. state.transWayName = item[0].label
  64. state.transWay = item[0].value
  65. };
  66. onLoad((option) => {
  67. });
  68. function radioChange(evt) {
  69. console.log('输出内容', evt)
  70. state.transWay = evt.detail.value; //“blu”为蓝牙充值方式、“nfc”为NFC充值方式
  71. }
  72. /*点击充值按钮*/
  73. const rechargeAction = () => {
  74. if (state.transWay == 'blu') {
  75. uni.redirectTo({
  76. url: `/pages/bluetooth/bluetooth?routeType=2`,
  77. });
  78. } else {
  79. uni.redirectTo({
  80. url: `/pages/nfc/nfc?routeType=2`,
  81. });
  82. }
  83. };
  84. const goRecord = () => {
  85. uni.navigateTo({
  86. url: `/subpackage/personal-center/consumption-record?cardId=${state.cardId}`
  87. })
  88. }
  89. </script>
  90. <style>
  91. .record {
  92. width: 90%;
  93. display: flex;
  94. justify-content: space-between;
  95. margin: 0 auto;
  96. align-items: center;
  97. }
  98. .arrow {
  99. width: 14rpx;
  100. height: 26rpx;
  101. }
  102. .tabs .tab-tit {
  103. font-size: 30rpx;
  104. color: #333;
  105. padding: 45rpx 0 22rpx 30rpx;
  106. }
  107. .tabs .tab {
  108. display: flex;
  109. flex-wrap: wrap;
  110. justify-content: space-evenly;
  111. }
  112. .tabs .tab .item {
  113. width: 210rpx;
  114. height: 100rpx;
  115. background: #f6fff7;
  116. border: 1px solid #dcdde1;
  117. box-sizing: border-box;
  118. line-height: 100rpx;
  119. border-radius: 6rpx;
  120. text-align: center;
  121. margin-bottom: 24rpx;
  122. color: #333333;
  123. font-size: 32rpx;
  124. }
  125. .tabs .tab .item.active {
  126. border: 1px solid #24cc49;
  127. color: #24cc49;
  128. }
  129. .btn-primary {
  130. width: 670rpx;
  131. height: 80rpx;
  132. line-height: 80rpx;
  133. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  134. border-radius: 40rpx;
  135. font-size: 32rpx;
  136. color: #ffffff;
  137. margin: 200rpx 40rpx 0;
  138. text-align: center;
  139. }
  140. label {
  141. display: flex;
  142. justify-content: space-between;
  143. margin-top: 30rpx;
  144. }
  145. </style>