musicBoost.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  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 {appId} from '@/common/conf/config.js'
  106. import {authUrl} from '@/common/conf/config.js';
  107. import {getUrlParams} from '@/common/utils/utils.js';
  108. export default {
  109. data() {
  110. return {
  111. current: 0,
  112. boostDetail: {},
  113. dialogShow: false,
  114. shareShow: false,
  115. count: 1,
  116. currentPresentSum: 0,
  117. productId: '',
  118. userId: '',
  119. }
  120. },
  121. onLoad(options) {
  122. this.productId = options.id;
  123. this.userId = uni.getStorageSync("userId");
  124. this.getBoostDetail(options.id, this.userId);
  125. this.authorization();
  126. },
  127. methods: {
  128. //打榜助力
  129. userBoost() {
  130. if (this.$u.test.isEmpty(this.userId)) {
  131. let path = 'pages/activityList/activity/musicBoost?id=' + this.productId;
  132. window.location.href = authUrl(path);
  133. } else {
  134. this.$u.api.boost.doHit({
  135. activityId: this.boostDetail.activityId,
  136. productId: this.productId,
  137. senderId: this.userId,
  138. receiverId: this.boostDetail.userId,
  139. type: 0,
  140. }).then(res => {
  141. console.log(res);
  142. if (res.code == 400) {
  143. uni.showToast({
  144. icon: "none",
  145. title: res.msg
  146. })
  147. } else {
  148. this.getBoostDetail(this.productId, this.userId);
  149. }
  150. })
  151. }
  152. },
  153. //礼物支付
  154. async pay() {
  155. alert(1)
  156. let orderInfo = (await this.$u.api.yeePay.initOrder(
  157. {
  158. "appId": appId,
  159. "channel": "WECHAT",
  160. "channelPromotionInfo": "",
  161. "channelSpecifiedInfo": "",
  162. "csUrl": "",
  163. "expiredTime": "",
  164. "fundProcessType": "",
  165. "goodsName": "测试",
  166. "memo": "",
  167. "notifyUrl": "https://vote.guosen-fumao.cn/vote-h5/index.html",
  168. "orderAmount": 0.01,
  169. "orderId": "363223222169",
  170. "payWay": "MINI_PROGRAM",
  171. "redirectUrl": "",
  172. "scene": "ONLINE",
  173. "uniqueOrderNo": "",
  174. "userId": "ofODrjk12F8egZQJELDhcD-kMd2Y",
  175. "userIp": "127.0.0.1"
  176. }
  177. )).data;
  178. if(typeof orderInfo.prePayTn != 'undefined' ){
  179. //调起支付
  180. this.toPay(orderInfo.prePayTn);
  181. }
  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. // }
  187. },
  188. //获取助力详情
  189. getBoostDetail(productId, userId) {
  190. this.$u.api.musicBoost.detail({id: productId, userId: this.userId}).then(res => {
  191. this.boostDetail = res;
  192. this.currentPresentSum = res.presentList[this.current].price;
  193. })
  194. },
  195. change(index) {
  196. this.currentPresentSum = 0;
  197. this.count = 1;
  198. this.current = index;
  199. this.currentPresentSum = this.boostDetail.presentList[index].price;
  200. },
  201. //礼物+
  202. plus() {
  203. this.count++
  204. },
  205. //礼物 -
  206. minus() {
  207. if (this.count > 1) {
  208. this.count--
  209. }
  210. },
  211. async authorization() {
  212. let agenterId=uni.getStorageSync("agenterId")
  213. let params = getUrlParams(window.location.search);
  214. if (!this.$u.test.isEmpty(params.code)) {
  215. let res = await this.$u.api.wxInfo.getUserInfo({userCode: params.code});
  216. let datas = {
  217. nickName: res.nickname,
  218. avatar: res.headimgurl,
  219. gender: res.sex,
  220. openid: res.openid,
  221. unionid: res.unionid,
  222. province:res.province,
  223. city:res.city
  224. }
  225. if (!this.$u.test.isEmpty(agenterId)) {
  226. datas.agenterId=agenterId
  227. }
  228. let result = await this.$u.api.user.login(datas);
  229. if (result) {
  230. this.userId = result.id;
  231. uni.setStorageSync("userId", result.id);
  232. }
  233. }
  234. },
  235. //邀请
  236. invite() {
  237. this.shareShow = true;
  238. },
  239. toPay(info){
  240. WeixinJSBridge.invoke(
  241. 'getBrandWCPayRequest',info ,
  242. (res) =>{});
  243. }}
  244. }
  245. </script>
  246. <style lang="scss" scoped>
  247. .head {
  248. background-color: #ffffff;
  249. margin-top: -26upx;
  250. border-radius: 26upx 26upx 0 0;
  251. .number {
  252. font-size: 38upx;
  253. font-family: PingFang SC;
  254. font-weight: 800;
  255. color: #222222;
  256. }
  257. .tag {
  258. padding: 0 10upx;
  259. line-height: 40upx;
  260. display: flex;
  261. align-items: center;
  262. justify-content: center;
  263. background: linear-gradient(90deg, #7355F4 0%, #573BE5 100%);
  264. margin-top: 8upx;
  265. border-radius: 30upx;
  266. }
  267. }
  268. .title {
  269. line-height: 50px;
  270. padding-left: 30upx;
  271. font-size: 30upx;
  272. font-family: PingFang SC;
  273. font-weight: 800;
  274. color: #201F1F;
  275. }
  276. .container {
  277. background-color: #FFFFFF;
  278. margin-top: 30upx;
  279. }
  280. .boder {
  281. box-shadow: -1upx -1upx 60upx #d8d8d8;
  282. border-radius: 16upx;
  283. }
  284. .input {
  285. width: 80upx;
  286. background-color: #ffffff;
  287. text-align: center;
  288. border: none;
  289. height: 60rpx;
  290. min-height: 1.8rem;
  291. }
  292. .custom-style {
  293. background-color: #5b3ee7;
  294. width: 250upx;
  295. color: #ffffff;
  296. }
  297. </style>