authorBoost.vue 8.1 KB

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