recharge.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <template>
  2. <view class="recharge">
  3. <view class="mine"> 我的余额(元) </view>
  4. <view class="money">{{ userInformation.balance }}</view>
  5. <view class="to-withdrawal">
  6. <AllRight name="去提现" :withdrawal="true" @toDetail="toWithdrawal" />
  7. </view>
  8. <view class="select-money">
  9. <view class="title"> 余额账户充值 </view>
  10. <!-- 选择充值金额 -->
  11. <view class="select-recharge">
  12. <view
  13. class="recharge-money"
  14. :class="{ 'back-red': backgroundRed == 100 }"
  15. @click="selectMoney(100)"
  16. >
  17. <text>¥</text>100
  18. </view>
  19. <view
  20. class="recharge-money"
  21. :class="{ 'back-red': backgroundRed == 200 }"
  22. @click="selectMoney(200)"
  23. >
  24. <text>¥</text>200
  25. </view>
  26. <view
  27. class="recharge-money"
  28. :class="{ 'back-red': backgroundRed == 300 }"
  29. @click="selectMoney(300)"
  30. >
  31. <text>¥</text>300
  32. </view>
  33. <view
  34. class="recharge-money"
  35. :class="{ 'back-red': backgroundRed == 600 }"
  36. @click="selectMoney(600)"
  37. >
  38. <text>¥</text>600
  39. </view>
  40. <view
  41. class="recharge-money"
  42. :class="{ 'back-red': backgroundRed == 800 }"
  43. @click="selectMoney(800)"
  44. >
  45. <text>¥</text>800
  46. </view>
  47. <view
  48. class="recharge-money"
  49. :class="{ 'back-red': backgroundRed == 1000 }"
  50. @click="selectMoney(1000)"
  51. >
  52. <text>¥</text>1000
  53. </view>
  54. </view>
  55. <!-- 选择充值金额 -->
  56. <u--input
  57. placeholder="输入自定义金额"
  58. prefixIcon="rmb"
  59. v-model="rmb"
  60. prefixIconStyle="font-size: 36rpx;color: #000;font-weight:600"
  61. ></u--input>
  62. <view class="payment">
  63. <view class="title"> 支付方式 </view>
  64. <view class="wx-pay">
  65. <view class="logo">
  66. <image
  67. src="../../static/mine/323.png"
  68. class="wx-logo"
  69. mode=""
  70. ></image>
  71. 微信支付
  72. </view>
  73. <image
  74. src="../../static/mine/330.png"
  75. mode="scaleToFill"
  76. class="wx-logo"
  77. />
  78. </view>
  79. </view>
  80. <button class="recharge-btn" @click="recharge">充值</button>
  81. </view>
  82. </view>
  83. </template>
  84. <script>
  85. import AllRight from "../mineComponent/allRight/allRight.vue";
  86. export default {
  87. components: {
  88. AllRight,
  89. },
  90. data() {
  91. return {
  92. backgroundRed: 0,
  93. rmb: "",
  94. userInformation: {},
  95. };
  96. },
  97. onShow() {
  98. this.getBalance();
  99. },
  100. methods: {
  101. selectMoney(num) {
  102. this.backgroundRed = num;
  103. },
  104. toWithdrawal() {
  105. uni.navigateTo({
  106. url: "/pageC/withdrawal/withdrawal?type=balance",
  107. });
  108. },
  109. //充值
  110. recharge() {
  111. let num = this.rmb == "" ? this.backgroundRed : this.rmb;
  112. uni.$u.http
  113. .post(`/api/recharge`, {
  114. account_type: "balance",
  115. amount: num,
  116. })
  117. .then((res) => {
  118. console.log(res);
  119. });
  120. },
  121. //获取账户余额
  122. getBalance() {
  123. uni.$u.http.get(`/api/member/info`).then((res) => {
  124. this.userInformation = res;
  125. });
  126. },
  127. },
  128. };
  129. </script>
  130. <style lang="scss" scoped>
  131. .recharge {
  132. height: 100vh;
  133. background-color: #fff;
  134. .mine {
  135. padding-top: 63rpx;
  136. text-align: center;
  137. color: #222;
  138. font-size: 28rpx;
  139. border-top: 1px solid #ccc;
  140. }
  141. .money {
  142. font-size: 84rpx;
  143. text-align: center;
  144. color: #222;
  145. font-weight: 600;
  146. margin-top: 28rpx;
  147. margin-bottom: 20rpx;
  148. }
  149. .to-withdrawal {
  150. display: flex;
  151. justify-content: center;
  152. }
  153. .select-money {
  154. padding-top: 42rpx;
  155. border-top: 1px solid #ccc;
  156. margin: 0 auto;
  157. margin-top: 64rpx;
  158. width: 94%;
  159. .title {
  160. font-size: 32rpx;
  161. color: #222;
  162. font-weight: 500;
  163. margin-bottom: 36rpx;
  164. }
  165. .payment {
  166. margin-top: 46rpx;
  167. .wx-pay {
  168. height: 100rpx;
  169. background-color: #f4f4f4;
  170. width: 94%;
  171. display: flex;
  172. justify-content: space-between;
  173. align-items: center;
  174. padding: 0 20rpx;
  175. font-size: 32rpx;
  176. .logo {
  177. display: flex;
  178. align-items: center;
  179. }
  180. .wx-logo {
  181. width: 39rpx;
  182. height: 34rpx;
  183. margin-right: 18rpx;
  184. }
  185. }
  186. }
  187. .recharge-btn {
  188. background-color: #f83224;
  189. border-radius: 44rpx;
  190. color: #fff;
  191. margin-top: 150rpx;
  192. }
  193. .select-recharge {
  194. display: flex;
  195. justify-content: space-between;
  196. flex-wrap: wrap;
  197. .recharge-money {
  198. width: 210rpx;
  199. height: 120rpx;
  200. border: 1px solid #f83224;
  201. border-radius: 16rpx;
  202. text-align: center;
  203. line-height: 120rpx;
  204. font-size: 40rpx;
  205. font-weight: 600;
  206. margin-bottom: 26rpx;
  207. text {
  208. font-size: 24rpx;
  209. }
  210. }
  211. .back-red {
  212. background-color: #f83224;
  213. color: #fff;
  214. }
  215. }
  216. }
  217. }
  218. /deep/.u-input {
  219. background-color: #f4f4f4;
  220. height: 80rpx;
  221. }
  222. </style>