authorBoost.vue 12 KB

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