您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

recharge-pay.vue 5.2KB

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