ensureRecharge.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <template>
  2. <view class="withdrawal">
  3. <!-- 头部 -->
  4. <view class="withdrawal-top">
  5. <view class="title"> 支付方式 </view>
  6. <view class="wx">
  7. <image src="../../static/mine/323.png" class="wx-logo" mode=""></image>
  8. <text>微信余额</text>
  9. </view>
  10. </view>
  11. <!-- 充值头部 -->
  12. <view class="content">
  13. <view class="money"> 充值金额 </view>
  14. <view class="inp">
  15. <text>¥</text>
  16. <input type="text" v-model="mon" />
  17. </view>
  18. <button class="immediately" @click="recharge">立即充值</button>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. export default {
  24. data() {
  25. return {
  26. mon: ''
  27. };
  28. },
  29. methods: {
  30. //充值
  31. recharge() {
  32. uni.$u.http
  33. .post(`/api/recharge`, {
  34. account_type: "deposit",
  35. amount: this.mon,
  36. })
  37. .then((res) => {
  38. uni.requestPayment({
  39. provider: 'wxpay',
  40. timeStamp:String(res.timeStamp),
  41. nonceStr: res.nonceStr,
  42. package: res.package,
  43. signType: res.signType,
  44. paySign: res.paySign,
  45. success: function(res) {
  46. console.log('success:' + JSON.stringify(res));
  47. uni.navigateBack()
  48. },
  49. fail: function(err) {
  50. console.log('fail:' + JSON.stringify(err));
  51. }
  52. });
  53. console.log(res);
  54. });
  55. },
  56. toWithdrawalDetail() {
  57. uni.navigateTo({
  58. url: "/pageC/withdrawalDetail/withdrawalDetail",
  59. });
  60. },
  61. },
  62. mounted() {
  63. uni.setNavigationBarTitle({
  64. title: "保证金充值",
  65. });
  66. },
  67. };
  68. </script>
  69. <style scoped lang="scss">
  70. .withdrawal {
  71. padding: 20rpx 24rpx 0;
  72. .withdrawal-top {
  73. display: flex;
  74. justify-content: space-between;
  75. align-items: center;
  76. height: 104rpx;
  77. background-color: #fff;
  78. border-radius: 16rpx;
  79. padding: 0 24rpx;
  80. .title {
  81. font-size: 30rpx;
  82. }
  83. .wx {
  84. display: flex;
  85. align-items: center;
  86. height: 50rpx;
  87. .wx-logo {
  88. width: 40rpx;
  89. height: 40rpx;
  90. margin-right: 10rpx;
  91. }
  92. }
  93. }
  94. .content {
  95. background-color: #fff;
  96. border-radius: 16rpx;
  97. margin-top: 16rpx;
  98. padding: 32rpx 24rpx 46rpx;
  99. .money {
  100. font-size: 30rpx;
  101. }
  102. .inp {
  103. display: flex;
  104. height: 110rpx;
  105. align-items: center;
  106. border-bottom: 2rpx solid rgba(151, 151, 151, 0.3);
  107. margin-bottom: 18rpx;
  108. }
  109. .all-money {
  110. font-size: 24rpx;
  111. color: #555;
  112. }
  113. .immediately {
  114. box-shadow: 0rpx 12rpx 28rpx -12rpx #f83224;
  115. border-radius: 44rpx;
  116. background-color: #f83224;
  117. color: #fff;
  118. margin-top: 60rpx;
  119. margin-bottom: 60rpx;
  120. }
  121. .detail {
  122. text-align: center;
  123. font-size: 26rpx;
  124. opacity: 0.6;
  125. color: #131415;
  126. }
  127. }
  128. }
  129. </style>