musicBoost.vue 9.0 KB

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