recharge.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <template>
  2. <view v-if="isshow>0" class="container">
  3. <image class="tui-bg__img" src="/static/images/mall/wallet/bg_balance_detail.png" ></image>
  4. <view class="tui-content__box">
  5. <form @submit="bindSave">
  6. <view class="tui-amount__box">
  7. <image class="tui-amount__img" src="/static/images/mall/wallet/bg_balance_amount.png" mode="widthFix">
  8. </image>
  9. <view class="tui-amount">
  10. <view><input v-model="amount" placeholder="充值金额" placeholder-class="tui-phcolor" type="text"
  11. maxlength="40" /></view>
  12. </view>
  13. </view>
  14. <!--<view class="tui-badge__box">
  15. <view class="tui-badge__title">活动</view>
  16. <view class="tui-badge__desc">充5000送2000</view>
  17. </view>-->
  18. <view class="tui-btn__box">
  19. <tui-button formType="submit" type="danger" height="88rpx" shape="circle">立即充值</tui-button>
  20. </view>
  21. </form>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. import pay from '@/common/pay.js'
  27. export default {
  28. data() {
  29. return {
  30. amount: '',
  31. isshow:0,
  32. }
  33. },
  34. onLoad: function(e) {
  35. const _this = this
  36. _this.isshow = e.isshow;
  37. },
  38. methods: {
  39. async bindSave(e) {
  40. const _this = this
  41. const amount = _this.amount;
  42. if (amount == "" || amount * 1 < 0) {
  43. wx.showToast({
  44. title: '请填写正确的金额',
  45. icon: 'none'
  46. })
  47. return
  48. }
  49. wx.showModal({
  50. title: '请确认充值金额',
  51. content: '您本次充值 ' + amount + ' 元',
  52. confirmText: "确认支付",
  53. cancelText: "取消支付",
  54. success: function(res) {
  55. //console.log(res);
  56. if (res.confirm) {
  57. const redirectUrl = "/pagesA/my/recharge/success";
  58. pay.wxpay('recharge', amount, 0, redirectUrl);
  59. }
  60. }
  61. });
  62. }
  63. },
  64. /**
  65. * 页面相关事件处理函数--监听用户下拉动作
  66. */
  67. onPullDownRefresh: function() {
  68. setTimeout(() => {
  69. uni.stopPullDownRefresh()
  70. }, 200);
  71. },
  72. }
  73. </script>
  74. <style>
  75. .container {
  76. width: 100%;
  77. padding-bottom: 48rpx;
  78. }
  79. .tui-bg__img {
  80. width: 100%;
  81. height: 230rpx;
  82. }
  83. .tui-content__box {
  84. width: 100%;
  85. padding: 0 30rpx;
  86. box-sizing: border-box;
  87. position: relative;
  88. margin-top: -150rpx;
  89. z-index: 2;
  90. }
  91. .tui-amount__box {
  92. width: 100%;
  93. height: 280rpx;
  94. background: #FFFFFF;
  95. box-shadow: 0 10rpx 14rpx 0 rgba(0, 0, 0, 0.06);
  96. border-radius: 10rpx;
  97. position: relative;
  98. display: flex;
  99. justify-content: center;
  100. flex-direction: column;
  101. padding-left: 52rpx;
  102. box-sizing: border-box;
  103. }
  104. .tui-amount__img {
  105. width: 342rpx;
  106. height: 248rpx;
  107. position: absolute;
  108. right: 0;
  109. bottom: 0;
  110. z-index: 1;
  111. }
  112. .tui-amount {
  113. font-size: 56rpx;
  114. font-weight: 500;
  115. color: #333333;
  116. display: flex;
  117. align-items: center;
  118. position: relative;
  119. z-index: 10;
  120. }
  121. .tui-badge {
  122. height: 34rpx;
  123. background: #FFE5E5;
  124. border-radius: 6rpx;
  125. font-size: 25rpx;
  126. font-weight: 400;
  127. color: #EB0909;
  128. display: flex;
  129. align-items: center;
  130. justify-content: center;
  131. margin-left: 12rpx;
  132. }
  133. .tui-scale__text {
  134. transform: scale(0.8);
  135. transform-origin: center center;
  136. }
  137. .tui-recharge__text {
  138. font-size: 28rpx;
  139. font-weight: 400;
  140. color: #888888;
  141. padding-top: 16rpx;
  142. padding-left: 12rpx;
  143. box-sizing: border-box;
  144. }
  145. .tui-badge__box {
  146. display: inline-flex;
  147. align-items: center;
  148. height: 42rpx;
  149. background-color: #FFDBDB;
  150. border-radius: 6rpx;
  151. overflow: hidden;
  152. margin-top: 50rpx;
  153. }
  154. .tui-badge__title {
  155. height: 42rpx;
  156. color: #fff;
  157. background-color: #EB0909;
  158. font-size: 24rpx;
  159. display: flex;
  160. align-items: center;
  161. justify-content: center;
  162. padding: 0 10rpx;
  163. }
  164. .tui-badge__desc {
  165. display: flex;
  166. align-items: center;
  167. justify-content: center;
  168. font-size: 28rpx;
  169. font-weight: 400;
  170. color: #EB0909;
  171. padding: 0 10rpx;
  172. }
  173. .tui-explain__box {
  174. padding-top: 60rpx;
  175. font-weight: 400;
  176. color: #333333;
  177. }
  178. .tui-title {
  179. font-size: 30rpx;
  180. padding-bottom: 8rpx;
  181. }
  182. .tui-desc {
  183. font-size: 26rpx;
  184. padding-top: 12rpx;
  185. }
  186. .tui-btn__box {
  187. padding-top: 80rpx;
  188. }
  189. </style>