info.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <template>
  2. <view class="content">
  3. <view class="main">
  4. <view class="main-list" v-for="(item,index) in list" :key="index">
  5. <view class="list-top flex">
  6. <view class="list-title">
  7. 获得{{item.award}}{{item.award_type ==1?'积分':''}}
  8. </view>
  9. <view class="list-btn" :class="{current: item.status != 0}" @click="dh(item)">
  10. {{item.status == 0?'兑换' : '已兑换'}}
  11. </view>
  12. </view>
  13. <view class="list-bottom flex">
  14. <view class="list-time">
  15. 抽奖时间:{{item.add}}
  16. </view>
  17. <view class="list-time">
  18. 过期时间:{{item.limit}}
  19. </view>
  20. </view>
  21. </view>
  22. </view>
  23. <uni-popup ref="ewm" type="center">
  24. <view class="hym-wrap">
  25. <view class="hym-tit">
  26. 兑换码
  27. </view>
  28. <view class="hym-tip">
  29. {{wwrdhm}}
  30. </view>
  31. <view class="hym-val">
  32. <tki-qrcode :key="dhm" cid="tki-qrcode-canvas" ref="qrcode" :val="dhm" :size="300" unit="upx"
  33. background="#ffffff" foreground="#333333" pdground="#333333" icon="" :iconSize="0" :lv="3"
  34. :onval="true" :loadMake="true" :usingComponents="true" />
  35. </view>
  36. </view>
  37. </uni-popup>
  38. </view>
  39. </template>
  40. <script>
  41. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  42. import empty from '@/components/empty';
  43. import {
  44. getTime
  45. } from '@/utils/rocessor.js'
  46. import {
  47. gachalog,
  48. dhjp
  49. } from '@/api/sign.js'
  50. import tkiQrcodes from '@/components/tki-qrcode/tki-qrcode.vue';
  51. export default {
  52. components: {
  53. empty,
  54. uniLoadMore,
  55. tkiQrcodes
  56. },
  57. data() {
  58. return {
  59. page: 1,
  60. limit: 10,
  61. loadingType: 'more',
  62. list: [],
  63. dhm: ''
  64. };
  65. },
  66. onLoad() {},
  67. onShow() {
  68. this.loadData()
  69. },
  70. onReachBottom() {
  71. this.loadData()
  72. },
  73. onReady() {},
  74. methods: {
  75. loadData() {
  76. if (this.loadingType == 'nomore' || this.loadingType == 'loading') {
  77. return
  78. }
  79. this.loadingType = 'loading'
  80. gachalog({
  81. page: this.page,
  82. limit: this.limit
  83. }).then(({
  84. data
  85. }) => {
  86. data.list.forEach(e => {
  87. e.add = getTime(e.add_time)
  88. e.limit = getTime(e.limit_time)
  89. })
  90. this.list = this.list.concat(data.list);
  91. console.log(this.list);
  92. this.page++
  93. if (this.limit == data.list.length) {
  94. this.loadingType = 'more'
  95. } else {
  96. this.loadingType = 'nomore'
  97. }
  98. })
  99. },
  100. dh(item) {
  101. if (item.award_type == 1) {
  102. dhjp({}, item.id).then(e => {
  103. item.status = 1
  104. this.$api.msg('兑换成功')
  105. })
  106. } else {
  107. this.wwrdhm = item.unicode
  108. this.dhm = item.unicode + '&lhlswez'
  109. this.$refs.ewm.open()
  110. }
  111. }
  112. }
  113. };
  114. </script>
  115. <style lang="scss">
  116. page,
  117. .content {
  118. min-height: 100%;
  119. height: auto;
  120. }
  121. .main {
  122. padding: 20rpx;
  123. .main-list {
  124. padding: 20rpx;
  125. background: #ffffff;
  126. margin-top: 20rpx;
  127. border-radius: 20rpx;
  128. .list-top {
  129. line-height: 1;
  130. .list-title {
  131. font-size: $font-lg;
  132. color: $font-color-base;
  133. }
  134. .list-btn {
  135. padding: 20rpx 50rpx;
  136. border-radius: 40rpx;
  137. background: #52c696;
  138. color: #ffffff;
  139. }
  140. .current {
  141. background: #e7ebf2;
  142. }
  143. }
  144. .list-bottom {
  145. margin-top: 20rpx;
  146. .list-time {
  147. font-size: 24rpx;
  148. color: $font-color-light;
  149. }
  150. }
  151. }
  152. }
  153. .hym-wrap {
  154. width: 500rpx;
  155. background-color: #fff;
  156. text-align: center;
  157. border-radius: 20rpx;
  158. padding: 20rpx;
  159. .hym-tit {
  160. color: $base-color;
  161. font-size: 48rpx;
  162. }
  163. .hym-tip {
  164. padding: 20rpx;
  165. font-size: 24rpx;
  166. word-wrap: break-word;
  167. }
  168. .hym-val {
  169. width: 300rpx;
  170. height: 300rpx;
  171. margin: auto;
  172. }
  173. .hym-num {
  174. font-size: 28rpx;
  175. font-weight: bold;
  176. padding-top: 20rpx;
  177. }
  178. }
  179. </style>