boost.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <template>
  2. <view>
  3. <view class="bg-img" style="height: 563upx;" :style="{'backgroundImage':'url('+ boostDetail.cover +')'}"></view>
  4. <view class="head">
  5. <view class="title">为{{boostDetail.nickName}}打榜</view>
  6. <view class="flex justify-between align-center padding-lr">
  7. <view class="flex align-center">
  8. <u-avatar :src="boostDetail.avatar" size="120"></u-avatar>
  9. <view class="padding-left">
  10. <view class="number">{{+boostDetail.hotValue}}</view>
  11. <view class="tag">
  12. <image src="/static/crown.png" style="width: 22upx;height: 19upx;margin-right: 10upx;"></image>
  13. <view class="text-sm text-white">热力榜第{{boostDetail.sequence}}</view>
  14. </view>
  15. </view>
  16. </view>
  17. <view class="text-center">
  18. <button class="cu-btn round theme-bg-color text-white text-bold" @click="userBoost">
  19. <text>打榜</text>
  20. <text class="cuIcon-hot padding-lr-xs"></text>
  21. <text>X{{boostDetail.activityHotValue}}</text>
  22. </button>
  23. <view class="text-sm text-gray margin-top-xs">今日可打榜次数: {{boostDetail.allowHitCount}}</view>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="flex justify-between align-center bg-white" style="padding: 40upx 30upx 30upx 30upx;">
  28. <view class="flex align-center">
  29. <image src="/static/icon-person.png" style="width: 82upx;height: 82upx;"></image>
  30. <view class="padding-left-sm">
  31. <view class="text-lg text-bold text-black">转发邀请打榜</view>
  32. <view class="text-sm text-gray padding-top-xs">成功邀请一位好友打榜,热力值+5</view>
  33. </view>
  34. </view>
  35. <button style="height: 56upx;" class="cu-btn round theme-bg-color text-white text-sm">去邀请</button>
  36. </view>
  37. <view class="container">
  38. <view class="title">打call助力</view>
  39. </view>
  40. <view class="bg-white padding-sm">
  41. <view class="flex justify-around">
  42. <block v-for="(item,index) in boostDetail.presentList" :key="index">
  43. <view class="text-center padding-top-xs" :class="current == index ? 'boder':''" @click="change(index)">
  44. <image :src="item.icon" style="width: 80upx;height: 80upx;"></image>
  45. <view class="text-sm margin-tb-xs">金额: {{+item.price}}</view>
  46. <view style="margin-bottom: 10upx;">
  47. <text class="cuIcon-hotfill theme-color"></text>
  48. <text style="font-size: 20upx;">{{+item.hotValue}}热力值/{{+item.pointsValue}}</text>
  49. </view>
  50. </view>
  51. </block>
  52. </view>
  53. </view>
  54. <view class="bg-white padding-sm">
  55. <view class="text-sm text-gray">所有的打call助力均会由本平台发起公益捐赠</view>
  56. </view>
  57. <view style="height: 100upx;"></view>
  58. <view class="footer-fixed bg-white padding-sm flex justify-between align-center">
  59. <view>
  60. <text style="font-size: 36upx;color: #FF4200">¥</text>
  61. <text style="font-size: 46upx;font-family: PingFang SC;font-weight: bold;color: #FF4200">{{count * currentPresentSum}}</text>
  62. </view>
  63. <view class="flex align-center">
  64. <view class="flex align-center">
  65. <view class="padding-right-sm" @click="minus"> <u-icon name="minus-circle-fill" color="#5a3ee8" size="36"></u-icon> </view>
  66. <input type="number" class="text-center input" v-model="count" />
  67. <view class="padding-left-sm" @click="plus"> <u-icon name="plus-circle-fill" color="#5a3ee8" size="36"></u-icon> </view>
  68. </view>
  69. <button style="width: 150upx;" class="margin-left cu-btn round theme-bg-color text-white text-sm" @click="dialogShow = true">助力</button>
  70. </view>
  71. </view>
  72. <u-popup v-model="dialogShow" mode="center" width="500rpx" height="600rpx" border-radius="30">
  73. <view class="bg-img text-center" style="background-image: url('/static/dialogBgImg.png');height: 600rpx;">
  74. <view style="height: 120upx;"></view>
  75. <u-avatar src="/static/avatar.png" size="160"></u-avatar>
  76. <view class="margin-top" style="font-size: 24upx;font-family: PingFang SC;font-weight: bold;color: #323035;">你将为{{boostDetail.nickName}}增加50热力值</view>
  77. <view class="text-gray text-sm">公益勋章X1</view>
  78. <view class="text-gray text-sm">立白助力礼包A</view>
  79. <view class="text-gray text-sm">可得300积分,可用于国信商城兑换</view>
  80. <view class="padding">
  81. <u-button class="custom-style" shape="circle" @click="pay">去支付</u-button>
  82. </view>
  83. </view>
  84. </u-popup>
  85. </view>
  86. </template>
  87. <script>
  88. import {authUrl} from '@/common/conf/config.js';
  89. import {getUrlParams} from '@/common/utils/utils.js';
  90. export default {
  91. data() {
  92. return {
  93. current: 0,
  94. boostDetail: {},
  95. dialogShow: false,
  96. count: 1,
  97. currentPresentSum: 0,
  98. activityId: '',
  99. senderId: '',
  100. receiverId: '',
  101. }
  102. },
  103. onLoad(options) {
  104. this.activityId = options.activityId;
  105. this.senderId = uni.getStorageSync("userId");
  106. this.receiverId = options.receiverId;
  107. this.getBoostDetail(options.activityId, options.receiverId);
  108. this.authorization();
  109. },
  110. methods: {
  111. //打榜助力
  112. userBoost() {
  113. if (this.$u.test.isEmpty(this.senderId)) {
  114. let path = 'pages/activityList/activity/boost?activityId=' + this.activityId + '&receiverId=' + this.receiverId;
  115. window.location.href = authUrl(path);
  116. } else {
  117. }
  118. },
  119. //礼物支付
  120. pay() {
  121. if (this.$u.test.isEmpty(this.senderId)) {
  122. let path = 'pages/activityList/activity/boost?activityId=' + this.activityId + '&receiverId=' + this.receiverId;
  123. window.location.href = authUrl(path);
  124. } else {
  125. }
  126. },
  127. //获取助力详情
  128. getBoostDetail(activityId, receiverId) {
  129. this.$u.api.user.boost({activityId: activityId, receiverId: receiverId, senderId: this.senderId}).then(res => {
  130. this.boostDetail = res;
  131. this.currentPresentSum = res.presentList[this.current].price;
  132. })
  133. },
  134. change(index) {
  135. this.currentPresentSum = 0;
  136. this.count = 1;
  137. this.current = index;
  138. this.currentPresentSum = this.present[index].price;
  139. },
  140. //礼物+
  141. plus() {
  142. this.count++
  143. },
  144. //礼物 -
  145. minus() {
  146. if (this.count > 1) {
  147. this.count--
  148. }
  149. },
  150. async authorization() {
  151. let params = getUrlParams(window.location.search);
  152. if (!this.$u.test.isEmpty(params.code)) {
  153. let res = await this.$u.api.wxInfo.getUserInfo({userCode: params.code});
  154. let datas = {
  155. nickName: res.nickname,
  156. avatar: res.headimgurl,
  157. gender: res.sex,
  158. openid: res.openid,
  159. unionid: res.unionid
  160. }
  161. let result = await this.$u.api.user.login(datas);
  162. if (result) {
  163. this.senderId = result.id;
  164. uni.setStorageSync("userId", result.id);
  165. }
  166. }
  167. },
  168. }
  169. }
  170. </script>
  171. <style lang="scss" scoped>
  172. .head {
  173. background-color: #ffffff;
  174. margin-top: -26upx;
  175. border-radius: 26upx 26upx 0 0;
  176. .number {
  177. font-size: 38upx;
  178. font-family: PingFang SC;
  179. font-weight: 800;
  180. color: #222222;
  181. }
  182. .tag {
  183. padding: 0 10upx;
  184. line-height: 40upx;
  185. display: flex;
  186. align-items: center;
  187. justify-content: center;
  188. background: linear-gradient(90deg, #7355F4 0%, #573BE5 100%);
  189. margin-top: 8upx;
  190. border-radius: 30upx;
  191. }
  192. }
  193. .title {
  194. line-height: 50px;
  195. padding-left: 30upx;
  196. font-size: 30upx;
  197. font-family: PingFang SC;
  198. font-weight: 800;
  199. color: #201F1F;
  200. }
  201. .container {
  202. background-color: #FFFFFF;
  203. margin-top: 30upx;
  204. }
  205. .boder {
  206. box-shadow: -1upx -1upx 60upx #d8d8d8;
  207. border-radius: 16upx;
  208. }
  209. .input {
  210. width: 80upx;
  211. background-color: #ffffff;
  212. text-align: center;
  213. border: none;
  214. height: 60rpx;
  215. min-height: 1.8rem;
  216. }
  217. .custom-style {
  218. background-color: #5b3ee7;
  219. width: 250upx;
  220. color: #ffffff;
  221. }
  222. </style>