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 5.3KB

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