integral_sign.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  1. <template>
  2. <view class="integral-sign" v-show="user.id">
  3. <view class="user-sgin">
  4. <view class="header">
  5. <view class="flex">
  6. <!-- 头像 -->
  7. <view class="flex m-l-40">
  8. <u-avatar :src="user.avatar" :size="110"></u-avatar>
  9. </view>
  10. <!-- 券和明细按钮 -->
  11. <view class="m-l-30 flex row-between flex-1">
  12. <!-- 券 -->
  13. <view>
  14. <view class="white" style="font-size: 56rpx">{{user.user_integral}}</view>
  15. <router-link to="/bundle/pages/sign_rule/sign_rule">
  16. <view class="sm flex white">
  17. 我的券
  18. <image src="../../static/jifen_icon_help.png" class="m-l-10"
  19. style="height: 30rpx; width: 30rpx;"></image>
  20. </view>
  21. </router-link>
  22. </view>
  23. <!-- 明细按钮 -->
  24. <router-link to="/bundle/pages/integral_details/integral_details">
  25. <view class="score-detail-entry flex">
  26. <image style="width: 26rpx;height: 26rpx;flex: none; margin-right: 7rpx"
  27. src="../../static/jifen_icon_data.png"></image>
  28. <text class="sm white">券明细</text>
  29. </view>
  30. </router-link>
  31. </view>
  32. </view>
  33. </view>
  34. <view class="main">
  35. <!-- 签到列表 -->
  36. <view class="contain bg-white">
  37. <view class="title">已累积签到 {{user.days}}天</view>
  38. <view class="day-list flex flex-wrap">
  39. <view v-for="(item, index) in signList" :key="index" class="item flex-col col-center">
  40. <view :class="'circle flex row-center ' + (item.status == 1 ? 'active-circle' : '')">
  41. <view class="num xs lighter" v-if="item.status == 0">+{{item.integral}}</view>
  42. <image class="num" src="../../static/jifen_icon_select.png" v-if="item.status == 1">
  43. </image>
  44. </view>
  45. <view class="day m-t-10 lighter sm">{{item.day}}</view>
  46. </view>
  47. </view>
  48. <view class="right-sgin">
  49. <button :class="'lighter br60 ' + (user.today_sign ? 'gray' : 'primary-button')"
  50. @tap="userSignFun" size="md">{{user.today_sign ? '已签到' : '立即签到' }}</button>
  51. </view>
  52. </view>
  53. <!-- 赚券 -->
  54. <view class="contain bg-white m-t-20" v-if="integralTips.length > 0">
  55. <view class="title flex">
  56. <view class="line br60 m-r-20"></view>
  57. <view class="bold xl">赚券</view>
  58. </view>
  59. <view class="task">
  60. <view v-for="(item, index) in integralTips" :key="index" class="item flex">
  61. <image class="img m-r-20" :src="item.image">
  62. </image>
  63. <view class="con">
  64. <view class="md">{{item.name}}</view>
  65. </view>
  66. <button hover-class="none" :class="'btn br60 ' + (item.status ? 'muted' : 'primary' )"
  67. :style="'border-color: ' + (item.status ? '#BBBBBB' : '#FF2C3C') + ';'"
  68. size="xs">{{item.status ? '已完成' : '未完成'}}</button>
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. <u-popup v-model="showPop" mode="center">
  75. <view class="pop-container">
  76. <view class="header-score flex row-center">+{{signInfo.integral}}</view>
  77. <view class="box column-center">
  78. <view class="desc m-t-20 sm flex row-center">
  79. <view class="">
  80. 获得
  81. </view>
  82. <image style="width: 28rpx; height: 30rpx;margin-right: 8rpx; margin-left: 8rpx"
  83. src="../../static/icon_jifen.png"></image>
  84. <view class="">
  85. {{signInfo.integral}}
  86. </view>
  87. <view class="m-l-20 flex" v-if="signInfo.growth">
  88. + {{ signInfo.growth }}成长值
  89. </view>
  90. </view>
  91. <view class="bottom-box">
  92. <view class="md" style="line-height: 36rpx">
  93. 您已累积签到 <text style="font-size: 36rpx; color: #FF2C3C;">{{signInfo.days}}</text>
  94. </view>
  95. </view>
  96. <view class="white br60 primary-btn" style="margin-top: 26rpx" @tap="showPop = false">确定</view>
  97. </view>
  98. </view>
  99. </u-popup>
  100. </view>
  101. </template>
  102. <script>
  103. import {
  104. getSignLists,
  105. userSignIn
  106. } from "@/api/activity";
  107. import {
  108. trottle
  109. } from "@/utils/tools"
  110. export default {
  111. data() {
  112. return {
  113. // 用户信息
  114. user: {
  115. },
  116. // 签到天数列表
  117. signList: [],
  118. // 每日签到
  119. integralTips: [],
  120. // 显示签到结果弹窗
  121. showPop: false,
  122. // 签到结果
  123. signInfo: {}
  124. };
  125. },
  126. onLoad() {
  127. this.getSignListsFun()
  128. this.userSignFun = trottle(this.userSignFun, 1000, this)
  129. },
  130. methods: {
  131. // 获取签到数据
  132. getSignListsFun() {
  133. getSignLists()
  134. .then((res) => {
  135. if (res.code == 1) {
  136. const {
  137. user,
  138. sign_list,
  139. integral_tips
  140. } = res.data
  141. this.user = user
  142. this.signList = sign_list
  143. this.integralTips = integral_tips
  144. }
  145. }).catch((err) => {
  146. })
  147. },
  148. // 点击签到
  149. userSignFun() {
  150. if (this.user.today_sign) return
  151. userSignIn().then((res) => {
  152. if (res.code == 1) {
  153. this.showPop = true;
  154. this.signInfo = res.data
  155. this.getSignListsFun()
  156. }
  157. })
  158. }
  159. }
  160. };
  161. </script>
  162. <style lang="scss">
  163. .user-sgin {
  164. padding-bottom: 100rpx;
  165. }
  166. .user-sgin .header {
  167. background-image: url(../../static/bg_sgin.png);
  168. background-repeat: no-repeat;
  169. background-size: 100%;
  170. height: 400rpx;
  171. width: 750rpx;
  172. padding-top: 40rpx;
  173. box-sizing: border-box;
  174. }
  175. .user-sgin .header .avatar {
  176. border-radius: 50%;
  177. border: 4rpx solid #fff;
  178. }
  179. .user-sgin .main {
  180. z-index: 100;
  181. margin-top: -200rpx;
  182. width: 100%;
  183. top: 186rpx;
  184. padding: 0 20rpx;
  185. box-sizing: border-box;
  186. }
  187. .user-sgin .main .contain {
  188. border-radius: 10rpx;
  189. }
  190. .user-sgin .main .contain .title {
  191. padding: 24rpx 30rpx;
  192. }
  193. .user-sgin .main .contain .title .line {
  194. width: 6rpx;
  195. height: 34rpx;
  196. background-color: #ff2c3c;
  197. }
  198. .user-sgin .main .day-list {
  199. width: 100%;
  200. }
  201. .user-sgin .main .day-list .item {
  202. width: 14.2%;
  203. margin-bottom: 10rpx;
  204. }
  205. .user-sgin .main .day-list .item .num {
  206. width: 68rpx;
  207. height: 68rpx;
  208. line-height: 58rpx;
  209. border-radius: 50%;
  210. display: flex;
  211. align-items: center;
  212. justify-content: center;
  213. background-color: #f2f2f2;
  214. }
  215. .user-sgin .main .day-list .item .circle {
  216. position: relative;
  217. }
  218. .user-sgin .main .day-list .item .circle::before {
  219. content: "";
  220. height: 6rpx;
  221. background-color: #f2f2f2;
  222. width: 34rpx;
  223. position: absolute;
  224. right: 68rpx;
  225. top: 34rpx;
  226. }
  227. .user-sgin .main .day-list .item:nth-of-type(7n+1) .circle::before {
  228. background-color: rgba(0, 0, 0, 0);
  229. }
  230. .user-sgin .main .day-list .item .active-circle::before {
  231. background-color: #FFBD40;
  232. }
  233. .user-sgin .main .right-sgin {
  234. padding: 35rpx 145rpx;
  235. }
  236. .user-sgin .main .right-sgin .primary-button {
  237. color: #fff;
  238. background: linear-gradient(270deg, rgba(249, 95, 47, 1) 0%, rgba(252, 67, 54, 1) 55%, rgba(255, 44, 60, 1) 100%);
  239. }
  240. .user-sgin .main .contain .task {
  241. border-top: 1px solid $-color-border;
  242. }
  243. .user-sgin .main .contain .task .item {
  244. padding: 23rpx 30rpx;
  245. }
  246. .user-sgin .main .contain .task .item .img {
  247. width: 74rpx;
  248. height: 74rpx;
  249. border-radius: 22rpx;
  250. }
  251. .user-sgin .main .contain .task .item .con {
  252. flex: 1;
  253. }
  254. .user-sgin .main .contain .task .item .btn {
  255. width: 154rpx;
  256. border: 1px solid #FF2C3C;
  257. }
  258. .user-sgin .main .contain .task .item .con .num {
  259. color: #FF2C3C;
  260. }
  261. .user-sgin .main .contain .task .item .primary {
  262. color: #FF2C3C;
  263. }
  264. .score-detail-entry {
  265. background-color: rgba(255, 255, 255, 0.3);
  266. border-radius: 100rpx 0rpx 0rpx 100rpx;
  267. padding: 12rpx 19rpx 12rpx 16rpx;
  268. align-self: flex-end;
  269. }
  270. .van-popup {
  271. background-color: rgba(0, 0, 0, 0) !important;
  272. }
  273. .pop-container {
  274. background-repeat: no-repeat;
  275. background-size: 100%;
  276. height: 626rpx;
  277. width: 560rpx;
  278. position: relative;
  279. background-image: url('../../static/jifen_popBg.png');
  280. }
  281. .u-mode-center-box {
  282. background-color: rgba(0, 0, 0, 0) !important;
  283. }
  284. .header-score {
  285. font-size: 46rpx;
  286. line-height: 36rpx;
  287. font-weight: bold;
  288. padding-top: 90rpx;
  289. padding-bottom: 150rpx;
  290. // color: #FF2C3C;
  291. color: #FF8412;
  292. }
  293. .desc {
  294. color: white;
  295. background: linear-gradient(82deg, rgba(250, 81, 50, 1) 0%, rgba(236, 60, 34, 1) 49%, rgba(250, 83, 50, 1) 100%);
  296. padding: 16rpx 22rpx 16rpx 42rpx;
  297. text-align: center;
  298. }
  299. .bottom-box {
  300. margin-top: 84rpx;
  301. text-align: center;
  302. }
  303. .primary-btn {
  304. margin: 0 60rpx;
  305. width: 440rpx;
  306. height: 74rpx;
  307. border-radius: 37rpx;
  308. padding: 16rpx 190rpx;
  309. // background: linear-gradient(#f95f2f 0%, #ff2c3c 100%);
  310. background: linear-gradient(#f95f2f 0%, #ff2c3c 100%);
  311. }
  312. .gray {
  313. background-color: #f2f2f2 !important;
  314. }
  315. </style>