sign.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <template>
  2. <view center>
  3. <view class="title">天天领现金</view>
  4. <view class="main after" v-if="signTrue">
  5. <image class="main-bg" src="https://hy.liuniu946.com/app/img/money-ok.png" mode=""></image>
  6. <view class="num">{{ day_integral }}</view>
  7. </view>
  8. <view class="main before" v-if="!signTrue">
  9. <image class="main-bg" src="https://hy.liuniu946.com/app/img/money-bg.png" mode=""></image>
  10. <view class="btn" :class="{ current: is_have }" @click="integral()">立即领取</view>
  11. </view>
  12. <view class="info-box flex">
  13. <view class="info-item">
  14. <view class="info-num">{{ sum_integral }}</view>
  15. <view class="info-font">获得金额</view>
  16. </view>
  17. <view class="info-item">
  18. <view class="info-num">{{ allSign }}</view>
  19. <view class="info-font">公益池金额</view>
  20. </view>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. import calendar from '../../components/ss-calendar/ss-calendar.vue';
  26. import { signList, integral, signUser, my_award, get_award } from '@/api/functionalUnit.js';
  27. export default {
  28. components: {
  29. calendar
  30. },
  31. data() {
  32. return {
  33. money: '', //保存当前月份
  34. year: '', //保存当前年份
  35. day: '', //保存当前日期
  36. signList: [], //签到日子列表
  37. actionDay: 0, //连续签到天数
  38. allSign: 0, //累计签到
  39. sum_integral: 0, //累计获得积分
  40. day_integral: '', //今天签到的钱
  41. signTrue: false,
  42. is_have: true, //是否可领
  43. id: ''
  44. };
  45. },
  46. onLoad() {
  47. this.signUser();
  48. this.getData();
  49. },
  50. methods: {
  51. // 获取当前时间
  52. getData(current) {
  53. const date = current ? new Date(current) : new Date();
  54. this.year = date.getFullYear(); //保存当前年份
  55. this.month = date.getMonth() + 1; //保存当前月份
  56. this.day = date.getDate(); //保存当前日期
  57. },
  58. //获取签到用户信息
  59. signUser() {
  60. my_award().then(data => {
  61. console.log(data);
  62. this.sum_integral = data.data.all_get;
  63. this.allSign = data.data.all_out;
  64. if (data.data.todayAward != null) {
  65. this.day_integral = data.data.todayAward.award; //今天获取的金额
  66. this.id = data.data.todayAward.id;
  67. this.is_have = false;
  68. }
  69. console.log(this.is_have);
  70. });
  71. },
  72. // 签到
  73. integral() {
  74. if(this.is_have){
  75. return
  76. }
  77. console.log(111);
  78. get_award({}, this.id)
  79. .then(e => {
  80. console.log(e);
  81. // 改为已签到
  82. this.signTrue = true;
  83. })
  84. .catch(e => {
  85. console.log(e);
  86. });
  87. }
  88. }
  89. };
  90. </script>
  91. <style lang="scss">
  92. page,
  93. .center {
  94. height: auto;
  95. min-height: 100%;
  96. background: #ffdfd4;
  97. }
  98. .title {
  99. padding-top: 66rpx;
  100. text-align: center;
  101. font-size: 94rpx;
  102. font-family: SourceHanSansCN;
  103. font-weight: bold;
  104. color: #c85138;
  105. }
  106. .after {
  107. padding-top: 230rpx;
  108. }
  109. .before {
  110. padding-top: 590rpx;
  111. }
  112. .current {
  113. color: #FFFFFF !important;
  114. background: #989898 !important;
  115. }
  116. .main {
  117. width: 750rpx;
  118. height: 926rpx;
  119. position: relative;
  120. .main-bg {
  121. position: absolute;
  122. top: 0;
  123. left: 0;
  124. right: 0;
  125. width: 750rpx;
  126. height: 926rpx;
  127. }
  128. .num {
  129. line-height: 1;
  130. text-align: center;
  131. font-size: 122rpx;
  132. font-family: PingFang SC;
  133. font-weight: bold;
  134. color: #eb2749;
  135. opacity: 0.9;
  136. }
  137. .btn {
  138. position: relative;
  139. margin: 0 auto;
  140. z-index: 10;
  141. width: 420rpx;
  142. height: 76rpx;
  143. background: linear-gradient(180deg, #fce9a8 0%, #fecd75 100%);
  144. box-shadow: 0px 16rpx 16rpx 0px rgba(159, 20, 63, 0.3), 0px 2rpx 6rpx 0px #fef5d3;
  145. border-radius: 38rpx;
  146. font-size: 26rpx;
  147. font-family: PingFang SC;
  148. font-weight: bold;
  149. color: #cb0908;
  150. line-height: 76rpx;
  151. text-align: center;
  152. }
  153. }
  154. .info-box {
  155. margin: 24rpx auto 0;
  156. padding: 22rpx 0;
  157. width: 640rpx;
  158. height: 160rpx;
  159. background: #ffffff;
  160. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  161. border-radius: 20rpx;
  162. .info-item {
  163. width: 50%;
  164. display: flex;
  165. flex-direction: column;
  166. align-items: center;
  167. border-right: 1px solid #efefef;
  168. line-height: 1;
  169. .info-num {
  170. font-size: 50rpx;
  171. font-family: PingFang SC;
  172. font-weight: bold;
  173. color: #333333;
  174. }
  175. .info-font {
  176. margin-top: 20rpx;
  177. font-size: 26rpx;
  178. font-family: PingFang SC;
  179. font-weight: 500;
  180. color: #333333;
  181. opacity: 0.6;
  182. }
  183. }
  184. }
  185. </style>