recharge.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <template>
  2. <view class="recharge">
  3. <view class="header main-left cross-center" @click="datePicker.show = true">
  4. <text>{{ date }}</text>
  5. <view class="icon" :class="{rotate: datePicker.show}">
  6. <u-icon name="arrow-down" />
  7. </view>
  8. </view>
  9. <view class="content">
  10. <view
  11. v-for="(item,index) in recharge"
  12. :key="index"
  13. class="recharge-item"
  14. >
  15. <view class="gold-box main-between cross-center">
  16. <view class="left-box main-left cross-center">
  17. <view class="gold">
  18. <text class="number">+150</text>
  19. <text>金币</text>
  20. </view>
  21. <view class="gift">充100赠50</view>
  22. </view>
  23. <view class="right-box">
  24. <text class="number">49.99</text>
  25. <text>金币</text>
  26. </view>
  27. </view>
  28. <text class="time">2022.07.21 12:55</text>
  29. </view>
  30. </view>
  31. <!--时间选择-->
  32. <u-datetime-picker
  33. ref="datePicker"
  34. v-model="datePicker.value"
  35. :show="datePicker.show"
  36. mode="year-month"
  37. @confirm="handleDateConfirm"
  38. @cancel="handleDateConfirm"
  39. />
  40. </view>
  41. </template>
  42. <script>
  43. export default {
  44. data() {
  45. return {
  46. recharge: [1, 2, 3, 4, 5],
  47. datePicker: {
  48. value: (new Date()).getTime(),
  49. date: uni.$u.timeFormat((new Date()).getTime(), 'yyyy-mm'),
  50. show: false
  51. }
  52. }
  53. },
  54. computed: {
  55. date() {
  56. const date = this.datePicker.date
  57. const arr = date.split('-')
  58. return `${arr[0]}年${arr[1]}月`
  59. }
  60. },
  61. watch: {
  62. datePicker: {
  63. handler(date) {
  64. date.date = uni.$u.timeFormat(date.value, 'yyyy-mm')
  65. },
  66. deep: true,
  67. immediate: true
  68. }
  69. },
  70. methods: {
  71. handleDateConfirm() {
  72. this.datePicker.show = false
  73. }
  74. }
  75. }
  76. </script>
  77. <style lang="scss" scoped>
  78. .recharge {
  79. padding: 20rpx 20rpx;
  80. .header{
  81. color: $info-color;
  82. text{
  83. margin-right: 20rpx;
  84. font-size: 32rpx;
  85. }
  86. .icon{
  87. transition: .3s;
  88. &.rotate{
  89. transform: rotate(-180deg);
  90. }
  91. }
  92. }
  93. .content{
  94. .recharge-item{
  95. border-bottom: 1rpx solid $info-color;
  96. color: $info-color;
  97. font-size: 26rpx;
  98. padding: 20rpx 0;
  99. &:last-child{
  100. border-bottom: none;
  101. }
  102. .gold-box{
  103. padding: 16rpx 0;
  104. .number{
  105. color: $primary-color;
  106. font-size: 38rpx;
  107. font-weight: 600;
  108. margin-right: 10rpx;
  109. }
  110. .gold .number{
  111. color: $default-color;
  112. }
  113. .left-box{
  114. .gift{
  115. color: $pink-color;
  116. margin-left: 40rpx;
  117. }
  118. }
  119. }
  120. text.time{
  121. font-size: 24rpx;
  122. }
  123. }
  124. }
  125. }
  126. </style>