musicBoost.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  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(item.id, 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" @click="wxShare">
  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" @click="pyqShare">
  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}}增加{{+boostDetail.presentList[current].hotValue}}热力值</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">可得{{+boostDetail.presentList[current].pointsValue}}积分,可用于国信商城兑换</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. <u-popup v-model="successShow" mode="center" width="500rpx" height="600rpx" border-radius="30">
  102. <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;">
  103. <view style="height: 120upx;"></view>
  104. <u-avatar src="/static/avatar.png" size="160"></u-avatar>
  105. <view class="margin-top" style="font-size: 30upx;font-family: PingFang SC;font-weight: bold;color: #323035;">恭喜您已为{{boostDetail.title}}注入{{+boostDetail.presentList[current].hotValue}}热力值</view>
  106. <view class="margin-tb-xs">{{+boostDetail.presentList[current].pointsValue}}已到账,可用于商城兑换消费</view>
  107. <view class="text-gray text-sm">购买成功!快去我的订单兑换或捐赠</view>
  108. <view class="padding">
  109. <u-button class="custom-style" shape="circle" @click="successShow = false">确定</u-button>
  110. </view>
  111. </view>
  112. </u-popup>
  113. <view class="cu-modal" :class="wxShareShow ? 'show' : ''" style="z-index: 9999;">
  114. <view class="cu-dialog">
  115. <view style="height:150px;">
  116. <view style="color: #000000;font-size: 38upx;padding: 40upx;">1. 先点击右上角<text class="text-bold" style="font-size: 38upx;">"···"</text></view>
  117. <view style="color: #000000;font-size: 38upx;padding: 40upx;">2. 选择<text class="text-bold" style="font-size: 38upx;">"{{type}}"</text></view>
  118. </view>
  119. <view class="cu-bar text-green text-lg bg-white">
  120. <view class="action margin-0 flex-sub solid-left" @tap="wxShareShow = false">知道了</view>
  121. </view>
  122. </view>
  123. </view>
  124. </view>
  125. </template>
  126. <script src="http://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
  127. <script>
  128. import {authUrl} from '@/common/conf/config.js';
  129. import {getUrlParams} from '@/common/utils/utils.js';
  130. export default {
  131. data() {
  132. return {
  133. activityId: '',
  134. current: 0,
  135. boostDetail: {},
  136. dialogShow: false,
  137. shareShow: false,
  138. wxShareShow: false,
  139. count: 1,
  140. currentPresentSum: 0,
  141. productId: '',
  142. userId: '',
  143. type:'',
  144. presentId: '',
  145. successShow: false,
  146. }
  147. },
  148. onLoad(options) {
  149. this.productId = options.id;
  150. this.userId = uni.getStorageSync("userId");
  151. this.getBoostDetail(options.id, this.userId);
  152. this.authorization();
  153. },
  154. methods: {
  155. //打榜助力
  156. userBoost() {
  157. if (this.$u.test.isEmpty(this.userId)) {
  158. let path = 'pages/activityList/activity/musicBoost?id=' + this.productId;
  159. window.location.href = authUrl(path);
  160. } else {
  161. this.$u.api.boost.doHit({
  162. activityId: this.boostDetail.activityId,
  163. productId: this.productId,
  164. senderId: this.userId,
  165. receiverId: this.boostDetail.userId,
  166. type: 0,
  167. }).then(res => {
  168. console.log(res);
  169. if (res.code == 400) {
  170. uni.showToast({
  171. icon: "none",
  172. title: res.msg
  173. })
  174. } else {
  175. this.getBoostDetail(this.productId, this.userId);
  176. }
  177. })
  178. }
  179. },
  180. //礼物支付
  181. pay() {
  182. if (this.$u.test.isEmpty(this.userId)) {
  183. let path = 'pages/activityList/activity/musicBoost?id=' + this.productId;
  184. window.location.href = authUrl(path);
  185. } else {
  186. console.log("发起支付");
  187. //支付成功后:
  188. // this.$u.api.boost.billRecord({
  189. // userId: this.userId,
  190. // openId: uni.getStorageSync("openid"),
  191. // activityId: this.boostDetail.activityId,
  192. // price: this.count * this.currentPresentSum,
  193. // presentId: this.presentId,
  194. // presentCount: this.count,
  195. // type: 1,
  196. // payStatus: '',
  197. // }).then(res => {
  198. // this.$u.api.boost.doReward({
  199. // activityId: this.boostDetail.activityId,
  200. // presentId: this.presentId,
  201. // senderId: this.userId,
  202. // receiverId: this.boostDetail.userId,
  203. // type: 1,
  204. // count: this.count,
  205. // }).then(res => {
  206. // this.successShow = true;
  207. // })
  208. // })
  209. this.successShow = true;
  210. }
  211. },
  212. //获取助力详情
  213. getBoostDetail(productId, userId) {
  214. this.$u.api.musicBoost.detail({id: productId, userId: this.userId}).then(res => {
  215. this.boostDetail = res;
  216. this.currentPresentSum = res.presentList[this.current].price;
  217. })
  218. },
  219. change(id, index) {
  220. this.presentId = id;
  221. this.currentPresentSum = 0;
  222. this.count = 1;
  223. this.current = index;
  224. this.currentPresentSum = this.boostDetail.presentList[index].price;
  225. },
  226. //礼物+
  227. plus() {
  228. this.count++
  229. },
  230. //礼物 -
  231. minus() {
  232. if (this.count > 1) {
  233. this.count--
  234. }
  235. },
  236. async authorization() {
  237. let agenterId=uni.getStorageSync("agenterId")
  238. let params = getUrlParams(window.location.search);
  239. if (!this.$u.test.isEmpty(params.code)) {
  240. let res = await this.$u.api.wxInfo.getUserInfo({userCode: params.code});
  241. uni.setStorageSync("openid", res.openid);
  242. let datas = {
  243. nickName: res.nickname,
  244. avatar: res.headimgurl,
  245. gender: res.sex,
  246. openid: res.openid,
  247. unionid: res.unionid,
  248. province:res.province,
  249. city:res.city
  250. }
  251. if (!this.$u.test.isEmpty(agenterId)) {
  252. datas.agenterId=agenterId
  253. }
  254. let result = await this.$u.api.user.login(datas);
  255. if (result) {
  256. this.userId = result.id;
  257. uni.setStorageSync("userId", result.id);
  258. this.getBoostDetail(this.productId, this.userId);
  259. }
  260. }
  261. },
  262. //邀请
  263. invite() {
  264. this.shareShow = true;
  265. },
  266. wxShare() {
  267. this.shareShow = false;
  268. this.wxShareShow = true;
  269. this.type = "发送给朋友";
  270. },
  271. pyqShare() {
  272. this.shareShow = false;
  273. this.wxShareShow = true;
  274. this.type = "分享到朋友圈"
  275. }
  276. }
  277. }
  278. </script>
  279. <style lang="scss" scoped>
  280. .head {
  281. background-color: #ffffff;
  282. margin-top: -26upx;
  283. border-radius: 26upx 26upx 0 0;
  284. .number {
  285. font-size: 38upx;
  286. font-family: PingFang SC;
  287. font-weight: 800;
  288. color: #222222;
  289. }
  290. .tag {
  291. padding: 0 10upx;
  292. line-height: 40upx;
  293. display: flex;
  294. align-items: center;
  295. justify-content: center;
  296. background: linear-gradient(90deg, #7355F4 0%, #573BE5 100%);
  297. margin-top: 8upx;
  298. border-radius: 30upx;
  299. }
  300. }
  301. .title {
  302. line-height: 50px;
  303. padding-left: 30upx;
  304. font-size: 30upx;
  305. font-family: PingFang SC;
  306. font-weight: 800;
  307. color: #201F1F;
  308. }
  309. .container {
  310. background-color: #FFFFFF;
  311. margin-top: 30upx;
  312. }
  313. .boder {
  314. box-shadow: -1upx -1upx 60upx #d8d8d8;
  315. border-radius: 16upx;
  316. }
  317. .input {
  318. width: 80upx;
  319. background-color: #ffffff;
  320. text-align: center;
  321. border: none;
  322. height: 60rpx;
  323. min-height: 1.8rem;
  324. }
  325. .custom-style {
  326. background-color: #5b3ee7;
  327. width: 250upx;
  328. color: #ffffff;
  329. }
  330. </style>