recharge.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <template>
  2. <view :class="[AppTheme]" id="withdraw">
  3. <view class="block">
  4. <view class="zh">充值金额</view>
  5. <view class="money">
  6. <u--input placeholder="请输入充值金额" fontSize="25" color="#000000" prefixIcon="rmb" v-model="money"
  7. border="bottom" prefixIconStyle="font-size: 20px;color: #909399"></u--input>
  8. </view>
  9. </view>
  10. <view class="btn">
  11. <view class="save bg-linear-gradient" @click="goTransfer">线下汇款</view>
  12. <view class="save bg-linear-gradient" @click="doSve">在线充值</view>
  13. </view>
  14. <payment ref="payment" :channel="3" :alipay="true" :weixinpay="true" :zhtpay="false"></payment>
  15. </view>
  16. </template>
  17. <script>
  18. import txApi from '@/api/wall/index.js';
  19. export default {
  20. name: 'Recharge',
  21. data() {
  22. return {
  23. primary:this.$theme.primary,
  24. payType: 1,
  25. settingFile: getApp().globalData.siteinfo,
  26. money: 0,
  27. items: [{
  28. value: 'BRA',
  29. name: '微信',
  30. img: getApp().globalData.siteinfo.root_img + '/static/app/imgs/mine/9.png'
  31. }],
  32. current: 0,
  33. params: {
  34. // 支付方式
  35. paytype: 1, //为1是微信支付 2是支付宝支付
  36. rid: '',
  37. systype: '', //h5 或 app
  38. money: 0
  39. }
  40. };
  41. },
  42. methods: {
  43. // #ifdef H5
  44. wxPay(paydata) {
  45. WeixinJSBridge.invoke(
  46. 'getBrandWCPayRequest', {
  47. 'appId': paydata.appId, //公众号id名称,由商户传入
  48. 'timeStamp': paydata.timeStamp, //时间戳
  49. 'nonceStr': paydata.nonceStr, //随机串
  50. 'package': paydata.package,
  51. 'signType': paydata.signType, //微信签名方式:
  52. 'paySign': paydata.paySign //微信签名
  53. },
  54. function(res) {
  55. if (res.err_msg === 'get_brand_wcpay_request:ok') {
  56. uni.showToast({
  57. title: '购买会员成功',
  58. icon: 'none'
  59. })
  60. setTimeout(() => {
  61. uni.navigateBack({
  62. delta: 1
  63. })
  64. }, 1000)
  65. } else if (res.err_msg === 'get_brand_wcpay_request:cancel') {
  66. uni.showToast({
  67. icon: 'none',
  68. title: '已取消支付'
  69. })
  70. } else {
  71. uni.showToast({
  72. icon: 'none',
  73. title: '支付失败'
  74. })
  75. }
  76. })
  77. },
  78. // #endif
  79. goTransfer() {
  80. uni.navigateTo({
  81. url: '/pagesA/pages/mypurse/transfer/transfer'
  82. });
  83. },
  84. radioChange: function(evt) {
  85. for (let i = 0; i < this.items.length; i++) {
  86. if (this.items[i].value === evt.target.value) {
  87. this.current = i;
  88. break;
  89. }
  90. }
  91. },
  92. doSve() {
  93. this.money = parseFloat(this.money);
  94. if (!this.money) {
  95. this.$api.msg('请填写金额');
  96. return;
  97. } else if (isNaN(this.money) || this.money <= 0) {
  98. this.$api.msg('请填写正确的充值金额');
  99. return;
  100. }
  101. this.$refs.payment.payopen({
  102. money: this.money
  103. });
  104. }
  105. }
  106. };
  107. </script>
  108. <style lang="scss">
  109. page {
  110. background-color: #f2f2f2;
  111. }
  112. #withdraw {
  113. width: 100%;
  114. background-color: #ffffff;
  115. .block {
  116. overflow: hidden;
  117. border-bottom: 4rpx solid #f2f2f2;
  118. .zh {
  119. margin: 30rpx 0 30rpx 36rpx;
  120. font-size: 30rpx;
  121. font-family: PingFang SC;
  122. font-weight: bold;
  123. color: #333333;
  124. }
  125. .money {
  126. display: flex;
  127. font-size: 50rpx;
  128. font-family: PingFang SC;
  129. font-weight: bold;
  130. align-items: center;
  131. color: #000000;
  132. padding: 20rpx;
  133. input {
  134. margin-left: 5rpx;
  135. font-size: 52rpx;
  136. font-family: PingFang SC;
  137. font-weight: 800;
  138. }
  139. }
  140. .tj {
  141. font-size: 34rpx;
  142. width: 147rpx;
  143. height: 60rpx;
  144. background: $tab-color;
  145. text-align: center;
  146. border-radius: 30px;
  147. color: #ffffff;
  148. line-height: 55rpx;
  149. }
  150. }
  151. .tx {
  152. width: 100%;
  153. background-color: #ffffff;
  154. padding-bottom: 35rpx;
  155. .title {
  156. font-size: 30rpx;
  157. font-family: PingFang SC;
  158. font-weight: bold;
  159. color: #333333;
  160. margin: 33rpx 0 33rpx 36rpx;
  161. }
  162. .flex {
  163. display: flex;
  164. }
  165. .uni-list-cell.uni-list-cell-pd {
  166. position: relative;
  167. display: flex;
  168. font-size: 30rpx;
  169. font-family: PingFang SC;
  170. font-weight: 500;
  171. color: #333333;
  172. margin-bottom: 30rpx;
  173. align-items: center;
  174. image {
  175. width: 46rpx;
  176. height: 41rpx;
  177. margin-right: 25rpx;
  178. margin-left: 37rpx;
  179. }
  180. radio {
  181. position: absolute;
  182. top: 0;
  183. right: 20rpx;
  184. }
  185. }
  186. }
  187. .btn {
  188. height: 210rpx;
  189. display: flex;
  190. justify-content: center;
  191. align-items: center;
  192. background-color: #ffffff;
  193. border-top: 20rpx solid #f2f2f2;
  194. .save {
  195. margin: 0 auto;
  196. width: 40%;
  197. height: 80rpx;
  198. font-size: 30rpx;
  199. color: #ffffff;
  200. text-align: center;
  201. line-height: 80rpx;
  202. border-radius: 45rpx;
  203. }
  204. }
  205. }
  206. </style>