recharge.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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. id: '',
  45. moneyActiveClass: 1,
  46. moneyList: [
  47. {id: '1',name: '10'},
  48. {id: '2',name: '20'},
  49. {id: '3',name: '50'},
  50. {id: '4',name: '100'},
  51. {id: '5',name: '200'},
  52. {id: '6',name: '500'},
  53. ],
  54. list: [{
  55. name: '微信支付',
  56. icon:'wechat-pay-fill',
  57. color:'#22ac38',
  58. },
  59. {
  60. name: '支付宝支付',
  61. icon:'alipay-fill',
  62. color:'#1677ff',
  63. },
  64. ],
  65. // u-radio-group的v-model绑定的值如果设置为某个radio的name,就会被默认选中
  66. value2: '微信支付',
  67. value1:'',
  68. checked: true,
  69. }
  70. },
  71. onLoad(op) {
  72. if(op.id){
  73. this.id =op.id;
  74. }
  75. console.log(op)
  76. console.log(this.id)
  77. },
  78. methods: {
  79. moneyClick(item,index) {
  80. this.moneyActiveClass = index;
  81. },
  82. // 选中某个单选框时,由radio时触发
  83. radioChange(e) {
  84. // console.log(e);
  85. },
  86. // 选中任一radio时,由radio-group触发
  87. radioGroupChange(e) {
  88. // console.log(e);
  89. },
  90. checkboxChange() {
  91. this.checked = !this.checked;
  92. },
  93. rechargeNow() {
  94. uni.redirectTo({
  95. url: '/pages/user/finance/rechargeRes'
  96. })
  97. }
  98. }
  99. }
  100. </script>
  101. <style>
  102. page{
  103. background-color: #fff;
  104. }
  105. </style>
  106. <style lang="scss" scoped>
  107. /deep/.u-radio-group{
  108. width: 100%;
  109. }
  110. /deep/.u-radio{
  111. position: relative;
  112. }
  113. /deep/.u-radio__icon-wrap{
  114. position: absolute;
  115. right: 0;
  116. }
  117. .recharge{
  118. padding: 16px;
  119. .title{
  120. font-size: 16px;
  121. }
  122. p{
  123. color:#666;
  124. margin-top: 4px;
  125. }
  126. .rechargeMain{
  127. display: flex;
  128. flex-wrap: wrap;
  129. justify-content: space-between;
  130. margin-top: 12px;
  131. margin-bottom: 20px;
  132. .recharge-item{
  133. width: 31%;
  134. border: 1px solid #e3e3e3;
  135. padding: 15px 0;
  136. border-radius: 4px;
  137. text-align: center;
  138. margin-bottom: 10px;
  139. font-size: 16px;
  140. }
  141. .active{
  142. background-color: #EFFFF7;
  143. border-color: #00B962;
  144. color:#00B962;
  145. }
  146. }
  147. }
  148. .recharge-input{
  149. margin-top: 8px;
  150. margin-bottom: 32px;
  151. }
  152. .recharge-radio{
  153. margin-top: 10px;
  154. .recharge-radio-item{
  155. display: flex;
  156. align-items: center;
  157. }
  158. .recharge-radio-name{
  159. margin-left: 8px;
  160. }
  161. }
  162. .recharge-btn{
  163. position: fixed;
  164. left: 16px;
  165. right: 16px;
  166. bottom: 16px;
  167. }
  168. .success-btn{
  169. margin-top: 10px;
  170. background-color:#00B962!important;
  171. flex: 1;
  172. border-color: #00B962!important;
  173. color:#fff!important;
  174. }
  175. </style>