Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

recharge-pay.vue 4.9KB

1 år sedan
1 år sedan
1 år sedan
1 år sedan
1 år sedan
1 år sedan
1 år sedan
1 år sedan
1 år sedan
1 år sedan
1 år sedan
1 år sedan
1 år sedan
1 år sedan
1 år sedan
1 år sedan
1 år sedan
1 år sedan
1 år sedan
1 år sedan
1 år sedan
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <template>
  2. <view class="content">
  3. <view @click="rechargeAction">
  4. <view style="display: flex;align-items: center;">
  5. <image class="photo" :src="fileURL + 'image/index/goRecharge.png'"></image>去充值
  6. </view>
  7. <image class="photo1" src="../../static/image/icon-back.png" mode="widthFix"></image>
  8. </view>
  9. <view>
  10. <view>选择充值方式:</view>
  11. <view style="width: 67%;display: flex;align-items: center;">
  12. <radio-group @change="radioChange" style="display: flex;align-items: center;">
  13. <label style="align-items: center;margin-right: 40rpx;margin-top: 0;"
  14. class="uni-list-cell uni-list-cell-pd" v-for="(item, index) in state.transWayTypeList"
  15. :key="item.value">
  16. <view>
  17. <radio :value="item.value" :checked="index === state.current" />
  18. </view>
  19. <view>{{item.name}}</view>
  20. </label>
  21. </radio-group>
  22. </view>
  23. </view>
  24. </view>
  25. <view class="tips" v-if="source=='WECHAT'">温馨提示: <text class="red">NFC充值</text>仅支持在<text
  26. class="red">安卓手机</text>进行ETC储值卡充值!</view>
  27. </template>
  28. <script setup lang="ts">
  29. import {
  30. stringToJson
  31. } from "@/utils/network/encryption";
  32. import {
  33. onLoad,
  34. onShow
  35. } from "@dcloudio/uni-app";
  36. import {
  37. request
  38. } from "@/utils/network/request.js";
  39. import {
  40. reactive
  41. } from "vue";
  42. import {
  43. navTo
  44. } from "@/utils/utils"
  45. import {
  46. msg
  47. } from "@/utils/utils";
  48. import {
  49. fileURL
  50. } from "@/datas/fileURL.js";
  51. import { source } from "@/utils/network/difference";
  52. const datas = require("../../static/etcUtil/datas.js");
  53. const bluetoothUtil = require("../../static/etcUtil/index.js");
  54. const cmd = require("../../static/etcUtil/cmdConfig.js");
  55. const tools = require("../../static/etcUtil/tools.js");
  56. const NFCAPI = require('../../static/nfc/NFCAPI.js');
  57. const state = reactive({
  58. transWayTypeShow: false,
  59. // #ifdef MP-ALIPAY
  60. transWayTypeList: [{
  61. name: "蓝牙",
  62. value: "blu",
  63. }],
  64. // #endif
  65. // #ifdef MP-WEIXIN
  66. transWayTypeList: [],
  67. // #endif
  68. tableIndex: 0,
  69. transWayName: "蓝牙",
  70. transWay: "blu", //“blu”为蓝牙充值方式、“nfc”为NFC充值方式
  71. cardId: "", //卡号 需要传参
  72. current: 0,
  73. });
  74. const selectConfirm = (item : any) => {
  75. state.transWayName = item[0].label
  76. state.transWay = item[0].value
  77. };
  78. onLoad((option) => {
  79. // #ifdef MP-WEIXIN
  80. uni.getSystemInfo({
  81. success: (res) => {
  82. console.log("res", res['osName'])
  83. // ios
  84. if (res['osName'] == 'ios') {
  85. state.transWayTypeList = [{
  86. name: "蓝牙",
  87. value: "blu",
  88. }]
  89. } else {
  90. // 安卓
  91. state.transWayTypeList = [{
  92. name: "蓝牙",
  93. value: "blu",
  94. }, {
  95. name: "NFC",
  96. value: "nfc",
  97. }]
  98. }
  99. }
  100. });
  101. // #endif
  102. });
  103. function radioChange(evt) {
  104. console.log('输出内容', evt)
  105. state.transWay = evt.detail.value; //“blu”为蓝牙充值方式、“nfc”为NFC充值方式
  106. for (var k = 0; k < state.transWayTypeList.length; k++) {
  107. if (state.transWayTypeList[k]['value'] == evt.detail.value) {
  108. state.transWayName = state.transWayTypeList[k]['name']
  109. return;
  110. }
  111. }
  112. }
  113. /*点击充值按钮*/
  114. const rechargeAction = () => {
  115. if (state.transWay == 'blu') {
  116. uni.redirectTo({
  117. url: `/pages/bluetooth/bluetooth?routeType=2`,
  118. });
  119. } else {
  120. uni.redirectTo({
  121. url: `/pages/nfc/nfc?routeType=2`,
  122. });
  123. }
  124. };
  125. const goRecord = () => {
  126. uni.navigateTo({
  127. url: `/subpackage/personal-center/consumption-record?cardId=${state.cardId}`
  128. })
  129. }
  130. </script>
  131. <style>
  132. .record {
  133. width: 90%;
  134. display: flex;
  135. justify-content: space-between;
  136. margin: 0 auto;
  137. align-items: center;
  138. }
  139. .arrow {
  140. width: 14rpx;
  141. height: 26rpx;
  142. }
  143. .tabs .tab-tit {
  144. font-size: 30rpx;
  145. color: #333;
  146. padding: 45rpx 0 22rpx 30rpx;
  147. }
  148. .tabs .tab {
  149. display: flex;
  150. flex-wrap: wrap;
  151. justify-content: space-evenly;
  152. }
  153. .tabs .tab .item {
  154. width: 210rpx;
  155. height: 100rpx;
  156. background: #f6fff7;
  157. border: 1px solid #dcdde1;
  158. box-sizing: border-box;
  159. line-height: 100rpx;
  160. border-radius: 6rpx;
  161. text-align: center;
  162. margin-bottom: 24rpx;
  163. color: #333333;
  164. font-size: 32rpx;
  165. }
  166. .tabs .tab .item.active {
  167. border: 1px solid #24cc49;
  168. color: #24cc49;
  169. }
  170. .btn-primary {
  171. width: 670rpx;
  172. height: 80rpx;
  173. line-height: 80rpx;
  174. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  175. border-radius: 40rpx;
  176. font-size: 32rpx;
  177. color: #ffffff;
  178. margin: 200rpx 40rpx 0;
  179. text-align: center;
  180. }
  181. label {
  182. display: flex;
  183. justify-content: space-between;
  184. margin-top: 30rpx;
  185. }
  186. .photo {
  187. width: 40rpx;
  188. height: 40rpx;
  189. margin-right: 40rpx;
  190. }
  191. .photo1 {
  192. width: 40rpx;
  193. transform: rotateY(180deg);
  194. }
  195. .content {
  196. font-size: 32rpx;
  197. }
  198. .content>view {
  199. border-bottom: 1rpx solid #c1c1c1;
  200. display: flex;
  201. padding: 16rpx 20rpx;
  202. align-items: center;
  203. justify-content: space-between;
  204. height: 60rpx;
  205. }
  206. .red {
  207. color: red;
  208. }
  209. .tips {
  210. font-size: 32rpx;
  211. padding: 20rpx;
  212. }
  213. </style>