consume.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <template>
  2. <view class="consume">
  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 consume"
  12. :key="index"
  13. class="consume-item dir-left-nowrap cross-center"
  14. >
  15. <view class="cover-image">
  16. <image src="@/static/image/default-movie.png" />
  17. </view>
  18. <view class="episode-box dir-top-wrap ">
  19. <view class="name">毒液</view>
  20. <view class="status-box main-left cross-center">
  21. <text class="status">已完结</text>
  22. <text>共18集</text>
  23. </view>
  24. <view class="detail">5集</view>
  25. <text class="time">2022-07-21 12:45:21</text>
  26. </view>
  27. <view class="gold">
  28. <text class="number">-150</text>
  29. <text>金币</text>
  30. </view>
  31. </view>
  32. </view>
  33. <!--时间选择-->
  34. <u-datetime-picker
  35. ref="datePicker"
  36. v-model="datePicker.value"
  37. :show="datePicker.show"
  38. mode="year-month"
  39. @confirm="handleDateConfirm"
  40. @cancel="handleDateConfirm"
  41. />
  42. </view>
  43. </template>
  44. <script>
  45. export default {
  46. data() {
  47. return {
  48. consume: [1, 2],
  49. datePicker: {
  50. value: (new Date()).getTime(),
  51. date: uni.$u.timeFormat((new Date()).getTime(), 'yyyy-mm'),
  52. show: false
  53. }
  54. }
  55. },
  56. computed: {
  57. date() {
  58. const date = this.datePicker.date
  59. const arr = date.split('-')
  60. return `${arr[0]}年${arr[1]}月`
  61. }
  62. },
  63. watch: {
  64. datePicker: {
  65. handler(date) {
  66. date.date = uni.$u.timeFormat(date.value, 'yyyy-mm')
  67. },
  68. deep: true,
  69. immediate: true
  70. }
  71. },
  72. methods: {
  73. handleDateConfirm() {
  74. this.datePicker.show = false
  75. }
  76. }
  77. }
  78. </script>
  79. <style lang="scss" scoped>
  80. .consume {
  81. padding: 20rpx 20rpx;
  82. font-size: 30rpx;
  83. .header{
  84. color: $info-color;
  85. text{
  86. margin-right: 20rpx;
  87. font-size: 32rpx;
  88. }
  89. .icon{
  90. transition: .3s;
  91. &.rotate{
  92. transform: rotate(-180deg);
  93. }
  94. }
  95. }
  96. .content{
  97. .consume-item{
  98. color: $info-color;
  99. margin-top: 20rpx;
  100. .cover-image{
  101. image{
  102. width: 200rpx;
  103. height: 260rpx;
  104. }
  105. }
  106. .episode-box{
  107. flex: 1;
  108. margin-left: 20rpx;
  109. font-size: 26rpx;
  110. .name{
  111. color: $default-color;
  112. font-size: 38rpx;
  113. font-weight: 600;
  114. margin-bottom: 10rpx;
  115. }
  116. .status-box{
  117. margin-bottom: 50rpx;
  118. .status{
  119. color: $primary-color;
  120. margin-right: 14rpx;
  121. }
  122. }
  123. .detail{
  124. font-size: 32rpx;
  125. color: $default-color;
  126. margin-bottom: 10rpx;
  127. }
  128. }
  129. .gold{
  130. .number{
  131. color: $pink-color;
  132. font-size: 42rpx;
  133. }
  134. }
  135. }
  136. }
  137. }
  138. </style>