musicBoost.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  1. <template>
  2. <view>
  3. <view v-if="boostDetail.urlsType == 1">
  4. <video :src="boostDetail.urls" style="width: 100%;height: 400upx;"></video>
  5. </view>
  6. <view v-else class="bg-img" style="height: 563upx;" :style="{'backgroundImage':'url('+ boostDetail.urls +')'}"></view>
  7. <view class="homeBtn" @click="home">
  8. <image src="/static/home.png" style="width: 40upx;height: 40upx;" />
  9. </view>
  10. <view class="head">
  11. <view class="title">为{{boostDetail.title}}打榜</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.rank}}</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.ticketHotValue}}</text>
  28. </button>
  29. <view class="text-sm text-gray margin-top-xs">今日可打榜次数: {{boostDetail.allowHitNum}}</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" @click="invite">去邀请</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(item.id, 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="presentBoost(boostDetail.presentList[current].id)">助力</button>
  76. </view>
  77. </view>
  78. <u-popup v-model="shareShow" mode="bottom" height="460rpx" border-radius="30">
  79. <view class="flex align-center justify-around" style="padding: 90upx 60upx 70upx 60upx;">
  80. <view class="text-center" @click="wxShare">
  81. <image src="/static/wx-share.png" style="width: 125upx;height: 125upx;"></image>
  82. <view class="text-sm">分享好友</view>
  83. </view>
  84. <view class="text-center" @click="pyqShare">
  85. <image src="/static/wx-pyq.png" style="width: 129upx;height: 124upx;"></image>
  86. <view class="text-sm">分享朋友圈</view>
  87. </view>
  88. </view>
  89. <view class="padding">
  90. <button class="cu-btn bg-gray round" style="width: 100%;height: 80upx;" @click="shareShow = false">取消</button>
  91. </view>
  92. </u-popup>
  93. <u-popup v-model="dialogShow" mode="center" width="500rpx" height="600rpx" border-radius="30">
  94. <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;">
  95. <view style="height: 120upx;"></view>
  96. <u-avatar :src="boostDetail.avatar" size="160"></u-avatar>
  97. <view class="margin-top" style="font-size: 24upx;font-family: PingFang SC;font-weight: bold;color: #323035;">你将为{{boostDetail.title}}增加{{+boostDetail.presentList[current].hotValue * count}}热力值</view>
  98. <view class="text-gray text-sm" v-if="presentDetail.isGiveMedal == 1">公益勋章X {{count}}</view>
  99. <view class="text-gray text-sm" v-if="presentDetail.isSendGoods == 1">{{presentDetail.goodsName}} X {{count}}</view>
  100. <view class="text-gray text-sm">可得{{+boostDetail.presentList[current].pointsValue * count}}积分,可用于国信商城兑换</view>
  101. <view class="padding">
  102. <u-button class="custom-style" shape="circle" @click="pay">去支付</u-button>
  103. </view>
  104. </view>
  105. </u-popup>
  106. <u-popup v-model="successShow" mode="center" width="500rpx" height="600rpx" border-radius="30">
  107. <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;">
  108. <view style="height: 120upx;"></view>
  109. <u-avatar :src="boostDetail.avatar" size="160"></u-avatar>
  110. <view class="margin-top" style="font-size: 30upx;font-family: PingFang SC;font-weight: bold;color: #323035;">恭喜您已为{{boostDetail.title}}注入{{+boostDetail.presentList[current].hotValue * count}}热力值</view>
  111. <view class="margin-tb-xs">{{+boostDetail.presentList[current].pointsValue * count}}已到账,可用于商城兑换消费</view>
  112. <view class="text-gray text-sm">购买成功!快去我的订单兑换或捐赠</view>
  113. <view class="padding">
  114. <u-button class="custom-style" shape="circle" @click="successShow = false">确定</u-button>
  115. </view>
  116. </view>
  117. </u-popup>
  118. <view class="cu-modal" :class="wxShareShow ? 'show' : ''" style="z-index: 9999;">
  119. <view class="cu-dialog">
  120. <view style="height:150px;">
  121. <view style="color: #000000;font-size: 38upx;padding: 40upx;">1. 先点击右上角<text class="text-bold" style="font-size: 38upx;">"···"</text></view>
  122. <view style="color: #000000;font-size: 38upx;padding: 40upx;">2. 选择<text class="text-bold" style="font-size: 38upx;">"{{type}}"</text></view>
  123. </view>
  124. <view class="cu-bar text-green text-lg bg-white">
  125. <view class="action margin-0 flex-sub solid-left" @tap="wxShareShow = false">知道了</view>
  126. </view>
  127. </view>
  128. </view>
  129. </view>
  130. </template>
  131. <script>
  132. import {appId} from '@/common/conf/config.js'
  133. import {authUrl} from '@/common/conf/config.js';
  134. import {getUrlParams} from '@/common/utils/utils.js';
  135. export default {
  136. data() {
  137. return {
  138. activityId: '',
  139. current: 0,
  140. boostDetail: {},
  141. dialogShow: false,
  142. shareShow: false,
  143. wxShareShow: false,
  144. count: 1,
  145. currentPresentSum: 0,
  146. productId: '',
  147. userId: '',
  148. type:'',
  149. presentId: '',
  150. successShow: false,
  151. presentDetail: {},
  152. }
  153. },
  154. onLoad(options) {
  155. this.productId = options.id;
  156. this.userId = uni.getStorageSync("userId");
  157. this.getBoostDetail(options.id, this.userId);
  158. this.authorization();
  159. },
  160. methods: {
  161. home() {
  162. uni.navigateTo({
  163. url: "/pages/activityList/home/home?activityId=" + this.boostDetail.activityId,
  164. })
  165. },
  166. //打榜助力
  167. userBoost() {
  168. if (this.$u.test.isEmpty(this.userId)) {
  169. let path = 'pages/activityList/activity/musicBoost?id=' + this.productId;
  170. window.location.href = authUrl(path);
  171. } else {
  172. this.$u.api.boost.doHit({
  173. activityId: this.boostDetail.activityId,
  174. productId: this.productId,
  175. senderId: this.userId,
  176. receiverId: this.boostDetail.userId,
  177. type: 0,
  178. }).then(res => {
  179. console.log(res);
  180. if (res.code == 400) {
  181. uni.showToast({
  182. icon: "none",
  183. title: res.msg
  184. })
  185. } else {
  186. this.getBoostDetail(this.productId, this.userId);
  187. }
  188. })
  189. }
  190. },
  191. //礼物支付
  192. async pay() {
  193. if (this.$u.test.isEmpty(this.userId)) {
  194. let path = 'pages/activityList/activity/musicBoost?id=' + this.productId;
  195. window.location.href = authUrl(path);
  196. } else {
  197. let orderInfo = (await this.$u.api.yeePay.initOrder(
  198. {
  199. "appId": appId,
  200. "channel": "WECHAT",
  201. "channelPromotionInfo": "",
  202. "channelSpecifiedInfo": "",
  203. "csUrl": "",
  204. "expiredTime": "",
  205. "fundProcessType": "",
  206. "goodsName": this.boostDetail.presentList[this.current].name,
  207. "memo": "",
  208. "notifyUrl": "https://yyzs.nanyue6688.com/ldt/api/yeePay/notify",
  209. "orderAmount": this.count * this.currentPresentSum,
  210. "orderId": new Date().getTime(),
  211. "payWay": "WECHAT_OFFIACCOUNT",
  212. "redirectUrl": "",
  213. "scene": "OFFLINE",
  214. "uniqueOrderNo": "",
  215. "userId": uni.getStorageSync("openid"),
  216. "userIp": "127.0.0.1"
  217. }
  218. ));
  219. if(typeof orderInfo.prePayTn != 'undefined' ){
  220. //调起支付
  221. this.toPay(JSON.parse(orderInfo.prePayTn));
  222. }
  223. }
  224. },
  225. //获取助力详情
  226. getBoostDetail(productId, userId) {
  227. this.$u.api.musicBoost.detail({id: productId, userId: this.userId}).then(res => {
  228. this.boostDetail = res;
  229. this.currentPresentSum = res.presentList[this.current].price;
  230. })
  231. },
  232. change(id, index) {
  233. this.presentId = id;
  234. this.currentPresentSum = 0;
  235. this.count = 1;
  236. this.current = index;
  237. this.currentPresentSum = this.boostDetail.presentList[index].price;
  238. },
  239. //礼物+
  240. plus() {
  241. this.count++
  242. },
  243. //礼物 -
  244. minus() {
  245. if (this.count > 1) {
  246. this.count--
  247. }
  248. },
  249. async authorization() {
  250. let agenterId=uni.getStorageSync("agenterId")
  251. let params = getUrlParams(window.location.search);
  252. if (!this.$u.test.isEmpty(params.code)) {
  253. let res = await this.$u.api.wxInfo.getUserInfo({userCode: params.code});
  254. uni.setStorageSync("openid", res.openid);
  255. let datas = {
  256. nickName: res.nickname,
  257. avatar: res.headimgurl,
  258. gender: res.sex,
  259. openid: res.openid,
  260. unionid: res.unionid,
  261. province:res.province,
  262. city:res.city
  263. }
  264. if (!this.$u.test.isEmpty(agenterId)) {
  265. datas.agenterId=agenterId
  266. }
  267. let result = await this.$u.api.user.login(datas);
  268. if (result) {
  269. this.userId = result.id;
  270. uni.setStorageSync("userId", result.id);
  271. this.getBoostDetail(this.productId, this.userId);
  272. }
  273. }
  274. },
  275. //邀请
  276. invite() {
  277. this.shareShow = true;
  278. },
  279. wxShare() {
  280. this.shareShow = false;
  281. this.wxShareShow = true;
  282. this.type = "发送给朋友";
  283. },
  284. pyqShare() {
  285. this.shareShow = false;
  286. this.wxShareShow = true;
  287. this.type = "分享到朋友圈"
  288. },
  289. toPay(info) {
  290. console.log(info,456789);
  291. let _this = this;
  292. WeixinJSBridge.invoke('getBrandWCPayRequest', info, (res) => {
  293. if (res.err_msg == "get_brand_wcpay_request:ok" ) {
  294. _this.$u.api.boost.billRecord({
  295. userId: _this.userId,
  296. openId: uni.getStorageSync("openid"),
  297. activityId: _this.boostDetail.activityId,
  298. price: _this.count * _this.currentPresentSum,
  299. presentId: _this.boostDetail.presentList[_this.current].id,
  300. presentCount: _this.count,
  301. relationId: _this.productId,
  302. type: 1,
  303. payStatus: 1,
  304. })
  305. _this.$u.api.boost.doReward({
  306. activityId: _this.boostDetail.activityId,
  307. presentId: _this.boostDetail.presentList[_this.current].id,
  308. senderId: _this.userId,
  309. receiverId: _this.boostDetail.userId,
  310. type: 1,
  311. count: _this.count,
  312. }).then(res => {
  313. _this.successShow = true;
  314. })
  315. } else if (res.err_msg == "get_brand_wcpay_request:cancel") {
  316. _this.$u.api.boost.billRecord({
  317. userId: _this.userId,
  318. openId: uni.getStorageSync("openid"),
  319. activityId: _this.boostDetail.activityId,
  320. price: _this.count * _this.currentPresentSum,
  321. presentId: _this.boostDetail.presentList[_this.current].id,
  322. presentCount: _this.count,
  323. type: 1,
  324. payStatus: 2,
  325. })
  326. } else {
  327. console.log(res.err_msg);
  328. }
  329. });
  330. },
  331. presentBoost(id) {
  332. this.$u.api.boost.presentDetail({id: id}).then(res => {
  333. this.presentDetail = res;
  334. this.dialogShow = true;
  335. })
  336. }
  337. }
  338. }
  339. </script>
  340. <style lang="scss" scoped>
  341. .head {
  342. background-color: #ffffff;
  343. margin-top: -26upx;
  344. border-radius: 26upx 26upx 0 0;
  345. .number {
  346. font-size: 38upx;
  347. font-family: PingFang SC;
  348. font-weight: 800;
  349. color: #222222;
  350. }
  351. .tag {
  352. padding: 0 10upx;
  353. line-height: 40upx;
  354. display: flex;
  355. align-items: center;
  356. justify-content: center;
  357. background: linear-gradient(90deg, #7355F4 0%, #573BE5 100%);
  358. margin-top: 8upx;
  359. border-radius: 30upx;
  360. }
  361. }
  362. .title {
  363. line-height: 50px;
  364. padding-left: 30upx;
  365. font-size: 30upx;
  366. font-family: PingFang SC;
  367. font-weight: 800;
  368. color: #201F1F;
  369. }
  370. .container {
  371. background-color: #FFFFFF;
  372. margin-top: 30upx;
  373. }
  374. .boder {
  375. box-shadow: -1upx -1upx 60upx #d8d8d8;
  376. border-radius: 16upx;
  377. }
  378. .input {
  379. width: 80upx;
  380. background-color: #ffffff;
  381. text-align: center;
  382. border: none;
  383. height: 60rpx;
  384. min-height: 1.8rem;
  385. }
  386. .custom-style {
  387. background-color: #5b3ee7;
  388. width: 250upx;
  389. color: #ffffff;
  390. }
  391. </style>