checkInRecord.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <template>
  2. <view class="checkInRecord">
  3. <view class="timeData">
  4. <picker mode="date" fields="month" @change="selectDataTime">
  5. <view class="time" v-if="isShowYeer" style="display: flex;align-items: center;">
  6. <text>{{queryForm.dayTime | getYMFilter}}</text>
  7. <image src="../../static/triangle.png" mode="widthFix" class="triangle"></image>
  8. </view>
  9. <view class="time" v-else>
  10. <text style="font-size: 48rpx;margin-right: 10rpx;">{{queryForm.dayTime | getDateFilter}}</text>
  11. <text>月</text>
  12. <image src="../../static/triangle.png" mode="widthFix" class="triangle"></image>
  13. </view>
  14. </picker>
  15. </view>
  16. <scroll-view scroll-y="true" class="checkInList" lower-threshold="80" @scrolltolower="scrolltolower">
  17. <view style="margin: 0 20rpx 20rpx" v-if="adConfig.videoAd">
  18. <ad-view :unitId="adConfig.videoAd" adIntervals="200" adType="video"></ad-view>
  19. </view>
  20. <view v-for="item in signList" :key="item.id" class="item">
  21. <view class="left">
  22. <view class="title">{{item.describe}}</view>
  23. <view class="data">{{item.longCreateTime | getTimerFilter}}</view>
  24. </view>
  25. <!-- <view class="right">
  26. <text v-if="item.rechargeStatus === 1">已发放</text>
  27. <view class="error" v-else>
  28. 发放中
  29. <view class="center">
  30. 24小时内发放
  31. </view>
  32. </view>
  33. </view> -->
  34. </view>
  35. <view class="baseline" v-if="this.total === this.signList.length">
  36. —— 我是有底线的 ——
  37. </view>
  38. </scroll-view>
  39. </view>
  40. </template>
  41. <script>
  42. import { getSignList, setReClaim, config } from '@/api/api.js'
  43. import { videoAd } from '@/utils/ad_config.js'
  44. import adView from '@/components/ad-view/ad-view.vue'
  45. export default {
  46. components: {
  47. adView
  48. },
  49. data() {
  50. return {
  51. adConfig: {
  52. videoAd
  53. },
  54. queryForm: {
  55. page: 1,
  56. pageSize: 20,
  57. dayTime: '',
  58. appId: config.appid
  59. },
  60. isShowYeer: false, //是否展示年月
  61. signList: [],
  62. total: 0
  63. };
  64. },
  65. onLoad(options) {
  66. if (Object.keys(options).length > 0) {
  67. this.queryForm = {...this.queryForm, ...options}
  68. this.queryForm.dayTime = this.getDate()
  69. this.getList()
  70. }
  71. },
  72. filters: {
  73. getYMFilter(value) {
  74. if(!value) return ''
  75. let data = value.split('-')
  76. if (data.length > 1) {
  77. return data[0] + '-' + data[1]
  78. }else {
  79. return value
  80. }
  81. },
  82. getDateFilter(value) { // 获取月
  83. if(!value) return ''
  84. let data = value.split('-')
  85. if (data.length > 1) {
  86. return Number(data[1])
  87. }else {
  88. return value
  89. }
  90. },
  91. getTimerFilter(value) { // 获取年月日时分秒
  92. if(!value) return ''
  93. let timestamp = Date.parse(new Date(value))
  94. let date = new Date(timestamp)
  95. let Y = date.getFullYear()
  96. let M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1)
  97. let D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
  98. let H = date.getHours() < 10 ? '0' + date.getHours() : date.getHours()
  99. let minute = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
  100. let S = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
  101. return `${Y}-${M}-${D} ${H}:${minute}:${S}`
  102. }
  103. },
  104. methods: {
  105. // 重新领取
  106. setAgainReceive (item) {
  107. setReClaim({id: item.id, createTime: item.longCreateTime}).then(res => {
  108. if (res.data === 1) {
  109. uni.showToast({
  110. title: '重领成功',
  111. icon: 'success'
  112. })
  113. this.signList = this.signList.map(item => {
  114. if (item.id === id) {
  115. return {
  116. ...item,
  117. rechargeStatus: res.data
  118. }
  119. } else {
  120. return item
  121. }
  122. })
  123. } else {
  124. uni.showToast({
  125. title: '重新领取失败,请稍后再来',
  126. icon: 'none',
  127. duration: 2000
  128. })
  129. }
  130. })
  131. },
  132. getList() {
  133. getSignList({...this.queryForm, dayTime: this.queryForm.dayTime + '-01'}).then(res => {
  134. this.signList = this.signList.concat(res.data.signInLogEsDtoList)
  135. this.total = res.data.total
  136. })
  137. },
  138. // 滚动到底部去获取数据
  139. scrolltolower() {
  140. if ( this.signList.length !== this.total ) {
  141. this.$set(this.queryForm, 'page', this.queryForm.page + 1)
  142. this.getList()
  143. }
  144. },
  145. // 选择时间
  146. selectDataTime(e) {
  147. this.isShowYeer = true
  148. this.signList = []
  149. this.$set(this.queryForm, 'page', 1)
  150. this.$set(this.queryForm, 'dayTime', e.target.value)
  151. this.getList()
  152. },
  153. // 获取年月
  154. getDate() {
  155. let timestamp = Date.parse(new Date())
  156. let date = new Date(timestamp)
  157. let Y = date.getFullYear()
  158. let M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1)
  159. let D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
  160. return Y + '-' + M
  161. }
  162. }
  163. }
  164. </script>
  165. <style lang="scss">
  166. page {
  167. background-color: #f3f3f3;
  168. }
  169. .checkInRecord {
  170. display: flex;
  171. flex-direction: column;
  172. justify-content: flex-start;
  173. width: 100%;
  174. height: 100vh;
  175. }
  176. .timeData {
  177. width: 100%;
  178. height: 104rpx;
  179. line-height: 104rpx;
  180. padding: 0 30rpx;
  181. box-sizing: border-box;
  182. border-bottom: 1rpx solid #eaeaea;
  183. }
  184. .time {
  185. font-size: 24rpx;
  186. .triangle {
  187. margin-left: 5rpx;
  188. width: 15rpx;
  189. height: 10rpx;
  190. }
  191. }
  192. .checkInList{
  193. height: calc(100vh - 100rpx);
  194. padding-bottom: 40rpx;
  195. box-sizing: border-box;
  196. overflow: hidden;
  197. .item {
  198. padding: 10rpx 0;
  199. margin: 0 30rpx;
  200. border-bottom: 1rpx solid #efefef;
  201. display: flex;
  202. justify-content: space-between;
  203. align-items: center;
  204. }
  205. .title {
  206. font-size: 28rpx;
  207. font-weight: 500;
  208. color: #000000;
  209. }
  210. .data {
  211. font-size: 24rpx;
  212. margin-top: 8rpx;
  213. color: #808080;
  214. }
  215. .center {
  216. font-size: 24rpx;
  217. color: #808080;
  218. }
  219. .right {
  220. text-align: center;
  221. &>text {
  222. font-size: 28rpx;
  223. }
  224. .error {
  225. font-size: 24rpx;
  226. color: #FC6E53;
  227. // background-color: #FC6E53;
  228. // width: 140rpx;
  229. // height: 55rpx;
  230. // box-sizing: border-box;
  231. // color: #FFFFFF;
  232. // text-align: center;
  233. // line-height: 55rpx;
  234. // border-radius: 30rpx;
  235. }
  236. }
  237. }
  238. .baseline {
  239. text-align: center;
  240. padding: 30rpx 0;
  241. font-size: 24rpx;
  242. color: #999999;
  243. }
  244. </style>