boost.vue 8.0 KB

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