consume.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <template>
  2. <view class="consume">
  3. <view class="header main-left cross-center" @click="datePicker.show = true">
  4. <picker
  5. mode="date"
  6. fields="month"
  7. :value="date"
  8. @change="handleDateConfirm"
  9. >
  10. <text>{{ date }}</text>
  11. </picker>
  12. <view class="icon" :class="{rotate: datePicker.show}">
  13. <u-icon name="arrow-down" />
  14. </view>
  15. </view>
  16. <view class="content">
  17. <view
  18. v-for="(item,index) in consume"
  19. :key="index"
  20. class="consume-item dir-left-nowrap cross-center"
  21. >
  22. <view class="cover-image">
  23. <image :src="item.detail.episode.cover_img" />
  24. </view>
  25. <view class="episode-box dir-top-wrap ">
  26. <view class="name">{{ item.detail.episode.name }}</view>
  27. <view class="status-box main-left cross-center">
  28. <text class="status">{{ item.detail.episode.status_text }}</text>
  29. <text>共{{ item.detail.episode.total }}集</text>
  30. </view>
  31. <view class="detail">{{ item.detail.sort }}集</view>
  32. <text class="time">{{ item.created_at }}</text>
  33. </view>
  34. <view class="gold">
  35. <text class="number">-{{ item.price }}</text>
  36. <text>金币</text>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. </template>
  42. <script>
  43. export default {
  44. data() {
  45. return {
  46. consume: [],
  47. datePicker: {
  48. date: uni.$u.timeFormat(Number(new Date()), 'yyyy-mm'),
  49. show: false
  50. }
  51. }
  52. },
  53. computed: {
  54. date() {
  55. const date = this.datePicker.date
  56. const arr = date.split('-')
  57. return `${arr[0]}年${arr[1]}月`
  58. }
  59. },
  60. methods: {
  61. handlePlay(detail) {
  62. this.$u.route({
  63. url: '/pages/episode/play',
  64. params: {
  65. id: detail.episode.id,
  66. list_id: detail.id
  67. }
  68. })
  69. },
  70. handleDateConfirm({ detail }) {
  71. this.datePicker.date = detail.value
  72. this.datePicker.show = false
  73. this.getConsume()
  74. },
  75. getConsume() {
  76. this.$loading()
  77. this.$api.user.consume.record({ date: this.datePicker.date }).then(res => {
  78. this.$hideLoading()
  79. this.consume = res.data
  80. })
  81. }
  82. },
  83. onLoad() {
  84. this.getConsume()
  85. }
  86. }
  87. </script>
  88. <style lang="scss" scoped>
  89. .consume {
  90. padding: 20rpx 20rpx;
  91. font-size: 30rpx;
  92. .header{
  93. color: $info-color;
  94. text{
  95. margin-right: 20rpx;
  96. font-size: 32rpx;
  97. }
  98. .icon{
  99. transition: .3s;
  100. &.rotate{
  101. transform: rotate(-180deg);
  102. }
  103. }
  104. }
  105. .content{
  106. .consume-item{
  107. color: $info-color;
  108. margin-top: 20rpx;
  109. .cover-image{
  110. image{
  111. width: 200rpx;
  112. height: 260rpx;
  113. border-radius: 16rpx;
  114. }
  115. }
  116. .episode-box{
  117. flex: 1;
  118. margin-left: 20rpx;
  119. font-size: 26rpx;
  120. .name{
  121. color: $default-color;
  122. font-size: 38rpx;
  123. font-weight: 600;
  124. margin-bottom: 10rpx;
  125. }
  126. .status-box{
  127. margin-bottom: 50rpx;
  128. .status{
  129. color: $primary-color;
  130. margin-right: 14rpx;
  131. }
  132. }
  133. .detail{
  134. font-size: 32rpx;
  135. color: $default-color;
  136. margin-bottom: 10rpx;
  137. }
  138. }
  139. .gold{
  140. .number{
  141. color: $pink-color;
  142. font-size: 42rpx;
  143. }
  144. }
  145. }
  146. }
  147. }
  148. </style>