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

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