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

recharge-pay.vue 5.4KB

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