recharge.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. <template>
  2. <div class="recharge">
  3. <scroller>
  4. <img class="ad-hide" src="http://odulvej8l.bkt.clouddn.com/%E5%85%85%E5%80%BC%E5%8D%A1.jpg" style="width: 100%;">
  5. <div class="recharge-title">充值余额</div>
  6. <group>
  7. <cell
  8. :title="('充值有好礼')"
  9. is-link
  10. value-align="left"
  11. :border-intent="false"
  12. :arrow-direction="isActive ? 'up' : 'down'"
  13. @click.native="isActive = !isActive"></cell>
  14. <p class="slide" :class="isActive?'animate':''">
  15. <span>充值1000--赠送:一挂式空调清洗</span>
  16. <span>充值3000--赠送:一床一沙发除螨</span>
  17. <span>充值5000--赠送:二床一沙发除螨</span>
  18. <span>充值10000--赠送:一冰箱清洗一挂式空调清洗一洗衣机清洗二床一沙发除螨</span>
  19. </p>
  20. </group>
  21. <ul class="ad-hide list-content list-recharge" style="padding-top: 5px;padding-bottom: 5px;padding-left: 10%;">
  22. <li v-for="(item,index) in rechargeLists" class="media" @click="btnRechargeList(item, index)"
  23. v-bind:class="{on: index === isShow}">
  24. <div v-if="item.denomination ===1 ">
  25. <div class="input-title">其他数额</div>
  26. <div class="input-rmb">RMB:</div>
  27. <input type="text" maxlength="8" name="" v-model="otherAmount" value="otherAmount" class="rechange-input">
  28. </div>
  29. <div v-else>
  30. <div>RMB:{{ item.denomination }}</div>
  31. </div>
  32. </li>
  33. </ul>
  34. <div class="ad-hide" style="text-align: center;clear: both;margin-top: 9rem;"><span style="font-size: 0.6rem">点击立即充值,即表示您已经同意壹管家</span><span
  35. style="font-size: 0.6rem;font-weight: 600;display: block;"></span><span style="font-size: 0.6rem;">《<span
  36. class="pay-agreement" style="text-decoration: underline;color: #0A246A" @click="activity">充返活动协议</span>》</span>
  37. </div>
  38. <div class="btn-add-recharge" @click="btnRecharge">立即去充值</div>
  39. <div style="width: 100%;padding-bottom: 13%;"></div>
  40. </scroller>
  41. </div>
  42. </template>
  43. <script type="es6">
  44. import {Group, Cell} from 'vux'
  45. import axios from 'axios'
  46. export default {
  47. data () {
  48. return {
  49. isActive: false,
  50. isShow: -1,
  51. rechargeLists: this.$store.state.recharge.rechargeList,
  52. rechargeItem: {},
  53. otherAmount: ''
  54. }
  55. },
  56. components: {
  57. Group, Cell
  58. },
  59. beforeCreate () {},
  60. created () {
  61. // console.log(this.rechargeLists)
  62. },
  63. watch: {
  64. 'otherAmount': function (val) {
  65. if (val !== undefined) {
  66. if (isNaN(val)) {
  67. // 弹出提示框
  68. this.otherAmount = ''
  69. this.$vux.alert.show({
  70. title: '输入错误',
  71. content: '请输入数字',
  72. onShow () {
  73. },
  74. onHide () {
  75. }
  76. })
  77. }
  78. }
  79. }
  80. },
  81. methods: {
  82. btnRechargeList (item, index) {
  83. if (index !== 4) {
  84. this.otherAmount = ''
  85. }
  86. if (this.isShow === index) {
  87. this.isShow = -1
  88. } else {
  89. this.isShow = index
  90. }
  91. this.rechargeItem = item
  92. },
  93. btnRecharge () {
  94. axios.post('o2o/recharge/addRechargeorder').then(res => {
  95. console.log(res)
  96. })
  97. // axios 1.创建充值卡订单 user_id: user.id, value:inputVal,
  98. // 第二步
  99. },
  100. show (e) {
  101. if (this.index !== e) {
  102. this.isActive = e
  103. this.index = e
  104. } else {
  105. this.isActive = -1
  106. this.index = -1
  107. }
  108. },
  109. activity () {
  110. this.$router.push({path: '/activityText'})
  111. }
  112. }
  113. }
  114. </script>
  115. <style lang="less" scoped>
  116. img {
  117. display: block;
  118. }
  119. .recharge-title {
  120. padding-left: 15px;
  121. font-size: 20px;
  122. border-bottom: 1px solid rgba(0, 0, 0, 0.4);
  123. padding-bottom: 10px;
  124. padding-top: 11px;
  125. text-align: left;
  126. margin-bottom: -20px;
  127. }
  128. ul {
  129. padding-top: 5px;
  130. padding-bottom: 5px;
  131. padding-left: 10%;
  132. align-content: flex-start;
  133. li.media.on {
  134. border: 2px solid rgba(146, 118, 3, 1);
  135. font-size: 12px;
  136. }
  137. li.media {
  138. margin: 2%;
  139. float: left;
  140. height: 2.5rem;
  141. padding: 10px 0;
  142. width: 25.33%;
  143. cursor: pointer;
  144. font-size: 13px;
  145. border: 1px solid;
  146. text-align: center;
  147. div {
  148. line-height: 1.5rem;
  149. }
  150. &:nth-child(5) {
  151. padding: 15px;
  152. width: 55%;
  153. padding-top: 0.4rem;
  154. }
  155. .input-title {
  156. line-height: 1.5rem;
  157. font-size: 12px;
  158. width: 35%;
  159. float: left;
  160. }
  161. .input-rmb {
  162. float: left;
  163. width: 25%;
  164. }
  165. input {
  166. margin: 0;
  167. padding: 0;
  168. width: 40%;
  169. height: 25px;
  170. margin-top: 2%;
  171. text-align: center;
  172. }
  173. }
  174. &, li, div, input {
  175. -webkit-box-sizing: border-box;
  176. -moz-box-sizing: border-box;
  177. box-sizing: border-box;
  178. list-style: none;
  179. margin: 0;
  180. padding: 0;
  181. }
  182. }
  183. .btn-add-recharge {
  184. width: 80%;
  185. clear: both;
  186. color: white;
  187. padding: 15px;
  188. margin: 0 auto;
  189. border: 1px solid;
  190. text-align: center;
  191. background-color: rgba(146, 118, 3, 1);
  192. transition: all 2s;
  193. margin-top: 10px;
  194. }
  195. /*动画*/
  196. .slide {
  197. padding: 0 20px;
  198. overflow: hidden;
  199. max-height: 0;
  200. transition: max-height .5s cubic-bezier(0, 1, 0, 1) -.1s;
  201. span {
  202. display: block;
  203. text-align: left;
  204. font-size: 15px;
  205. }
  206. }
  207. .animate {
  208. max-height: 9999px;
  209. transition-timing-function: cubic-bezier(0.5, 0, 1, 0);
  210. transition-delay: 0s;
  211. }
  212. </style>