checkInRecord.vue 6.3 KB

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