recharge.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <template>
  2. <view>
  3. <u-navbar title="充值"></u-navbar>
  4. <view class="recharge">
  5. <view class="title">选择充值金额</view>
  6. <p>当前余额¥0.00</p>
  7. <view class="rechargeMain">
  8. <view class="recharge-item" :class="moneyActiveClass == index ? 'active' : ''"
  9. v-for="(item,index) in moneyList" :key="item.id" @click="moneyClick(item,index)">{{item.name}}</view>
  10. </view>
  11. <p>其他充值金额</p>
  12. <view class="recharge-input">
  13. <u-input v-model="value1" type="text" :border="true" />
  14. </view>
  15. <view class="title">选择支付方式</view>
  16. <view class="recharge-radio">
  17. <u-radio-group v-model="value2" @change="radioGroupChange" :wrap="true" width="100%">
  18. <u-radio active-color="#00B962" @change="radioChange" v-for="(item, index) in list" :key="index" :name="item.name"
  19. :disabled="item.disabled" width="100%">
  20. <view class="recharge-radio-item">
  21. <u-icon :name="item.icon" custom-prefix="custom-icon" :color="item.color" size="48"></u-icon>
  22. <view class="recharge-radio-name">
  23. {{item.name}}
  24. </view>
  25. </view>
  26. </u-radio>
  27. </u-radio-group>
  28. </view>
  29. <view class="recharge-btn">
  30. <u-checkbox-group>
  31. <u-checkbox v-model="checked" shape="circle" @change="checkboxChange()">我已阅读并同意《充值协议》</u-checkbox>
  32. </u-checkbox-group>
  33. <u-button class="success-btn" shape="circle" type="success" @click="rechargeNow">
  34. <span>立即充值</span>
  35. </u-button>
  36. </view>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. export default {
  42. data() {
  43. return {
  44. moneyActiveClass: 1,
  45. moneyList: [
  46. {id: '1',name: '10'},
  47. {id: '2',name: '20'},
  48. {id: '3',name: '50'},
  49. {id: '4',name: '100'},
  50. {id: '5',name: '200'},
  51. {id: '6',name: '500'},
  52. ],
  53. list: [{
  54. name: '微信支付',
  55. icon:'wechat-pay-fill',
  56. color:'#22ac38',
  57. },
  58. {
  59. name: '支付宝支付',
  60. icon:'alipay-fill',
  61. color:'#1677ff',
  62. },
  63. ],
  64. // u-radio-group的v-model绑定的值如果设置为某个radio的name,就会被默认选中
  65. value2: '微信支付',
  66. value1:'',
  67. checked: true,
  68. }
  69. },
  70. methods: {
  71. moneyClick(item,index) {
  72. this.moneyActiveClass = index;
  73. },
  74. // 选中某个单选框时,由radio时触发
  75. radioChange(e) {
  76. // console.log(e);
  77. },
  78. // 选中任一radio时,由radio-group触发
  79. radioGroupChange(e) {
  80. // console.log(e);
  81. },
  82. checkboxChange() {
  83. this.checked = !this.checked;
  84. },
  85. rechargeNow() {
  86. uni.redirectTo({
  87. url: '/pages/user/finance/rechargeRes'
  88. })
  89. }
  90. }
  91. }
  92. </script>
  93. <style>
  94. page{
  95. background-color: #fff;
  96. }
  97. </style>
  98. <style lang="scss" scoped>
  99. /deep/.u-radio-group{
  100. width: 100%;
  101. }
  102. /deep/.u-radio{
  103. position: relative;
  104. }
  105. /deep/.u-radio__icon-wrap{
  106. position: absolute;
  107. right: 0;
  108. }
  109. .recharge{
  110. padding: 16px;
  111. .title{
  112. font-size: 16px;
  113. }
  114. p{
  115. color:#666;
  116. margin-top: 4px;
  117. }
  118. .rechargeMain{
  119. display: flex;
  120. flex-wrap: wrap;
  121. justify-content: space-between;
  122. margin-top: 12px;
  123. margin-bottom: 20px;
  124. .recharge-item{
  125. width: 31%;
  126. border: 1px solid #e3e3e3;
  127. padding: 15px 0;
  128. border-radius: 4px;
  129. text-align: center;
  130. margin-bottom: 10px;
  131. font-size: 16px;
  132. }
  133. .active{
  134. background-color: #EFFFF7;
  135. border-color: #00B962;
  136. color:#00B962;
  137. }
  138. }
  139. }
  140. .recharge-input{
  141. margin-top: 8px;
  142. margin-bottom: 32px;
  143. }
  144. .recharge-radio{
  145. margin-top: 10px;
  146. .recharge-radio-item{
  147. display: flex;
  148. align-items: center;
  149. }
  150. .recharge-radio-name{
  151. margin-left: 8px;
  152. }
  153. }
  154. .recharge-btn{
  155. position: fixed;
  156. left: 16px;
  157. right: 16px;
  158. bottom: 16px;
  159. }
  160. .success-btn{
  161. margin-top: 10px;
  162. background-color:#00B962!important;
  163. flex: 1;
  164. border-color: #00B962!important;
  165. color:#fff!important;
  166. }
  167. </style>