| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445 |
- <template>
- <view>
- <view v-if="boostDetail.urlsType == 1">
- <video :src="boostDetail.urls" style="width: 100%;height: 400upx;"></video>
- </view>
- <view v-else class="bg-img" style="height: 563upx;" @click="preViewImg(boostDetail.urls)" :style="{'backgroundImage':'url('+ boostDetail.urls +')'}"></view>
- <view class="homeBtn" @click="home">
- <image src="/static/home.png" style="width: 40upx;height: 40upx;" />
- </view>
- <view class="head">
- <view class="title">为{{boostDetail.title}}打榜</view>
- <view class="flex justify-between align-center padding-lr">
- <view class="flex align-center">
- <u-avatar :src="boostDetail.avatar" size="120"></u-avatar>
- <view class="padding-left">
- <view class="number">{{+boostDetail.hotValue}}</view>
- <view class="tag">
- <image src="/static/crown.png" style="width: 22upx;height: 19upx;margin-right: 10upx;"></image>
- <view class="text-sm text-white">热力榜第{{boostDetail.rank}}</view>
- </view>
- </view>
- </view>
- <view class="text-center">
- <button class="cu-btn round theme-bg-color text-white text-bold" @click="userBoost">
- <text>打榜</text>
- <text class="cuIcon-hot padding-lr-xs"></text>
- <text>X{{boostDetail.ticketHotValue}}</text>
- </button>
- <view class="text-sm text-gray margin-top-xs">今日可打榜次数: {{boostDetail.allowHitNum}}</view>
- </view>
- </view>
- </view>
- <view class="flex justify-between align-center bg-white" style="padding: 40upx 30upx 30upx 30upx;">
- <view class="flex align-center">
- <image src="/static/icon-person.png" style="width: 82upx;height: 82upx;"></image>
- <view class="padding-left-sm">
- <view class="text-lg text-bold text-black">转发邀请打榜</view>
- <view class="text-sm text-gray padding-top-xs">邀请好友打榜,获得热力值更快哦</view>
- </view>
- </view>
- <button style="height: 56upx;" class="cu-btn round theme-bg-color text-white text-sm" @click="invite">去邀请</button>
- </view>
- <view class="container">
- <view class="title">打call助力</view>
- </view>
- <view class="bg-white padding-sm">
- <view class="grid col-3 padding-xs">
- <block v-for="(item,index) in boostDetail.presentList" :key="index">
- <view class="text-center padding-top-xs" :class="current == index ? 'boder':''" @click="change(item.id, index)">
- <image :src="item.icon" style="width: 150upx;height: 150upx;"></image>
- <view class="margin-tb-xs">金额: {{+item.price}}</view>
- <view style="margin-bottom: 10upx;">
- <text class="cuIcon-hotfill theme-color"></text>
- <text class="text-sm">{{+item.hotValue}}热力值/{{+item.pointsValue}}</text>
- </view>
- </view>
- </block>
- </view>
- </view>
- <view class="bg-white padding-sm">
- <view class="text-sm text-gray">打call助力的部分收入由平台发起定向公益捐赠</view>
- </view>
- <view style="height: 100upx;"></view>
- <view class="footer-fixed bg-white padding-sm flex justify-between align-center">
- <view>
- <text style="font-size: 36upx;color: #FF4200">¥</text>
- <text style="font-size: 46upx;font-family: PingFang SC;font-weight: bold;color: #FF4200">{{count * currentPresentSum}}</text>
- </view>
- <view class="flex align-center">
- <view class="flex align-center">
- <view class="padding-right-sm" @click="minus"> <u-icon name="minus-circle-fill" color="#5a3ee8" size="36"></u-icon> </view>
- <input type="number" class="text-center input" v-model="count" />
- <view class="padding-left-sm" @click="plus"> <u-icon name="plus-circle-fill" color="#5a3ee8" size="36"></u-icon> </view>
- </view>
- <button style="width: 150upx;" class="margin-left cu-btn round theme-bg-color text-white text-sm" @click="presentBoost(boostDetail.presentList[current].id)">助力</button>
- </view>
- </view>
- <u-popup v-model="shareShow" mode="bottom" height="460rpx" border-radius="30">
- <view class="flex align-center justify-around" style="padding: 90upx 60upx 70upx 60upx;">
- <view class="text-center" @click="wxShare">
- <image src="/static/wx-share.png" style="width: 125upx;height: 125upx;"></image>
- <view class="text-sm">分享好友</view>
- </view>
- <view class="text-center" @click="pyqShare">
- <image src="/static/wx-pyq.png" style="width: 129upx;height: 124upx;"></image>
- <view class="text-sm">分享朋友圈</view>
- </view>
- </view>
- <view style="width: 10upx;height: 10upx;" class="qrimg-i" v-if="shareShow">
- <tki-qrcode
- cid="qrcode"
- ref="qrcode"
- :val="val"
- :size="size"
- :onval="onval"
- :loadMake="loadMake"
- :usingComponents="true"
- @result="qrR" />
- </view>
- <view class="padding">
- <button class="cu-btn bg-gray round" style="width: 100%;height: 80upx;" @click="shareShow = false">取消</button>
- </view>
- </u-popup>
- <u-popup v-model="dialogShow" mode="center" width="500rpx" height="600rpx" border-radius="30">
- <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;">
- <view style="height: 120upx;"></view>
- <u-avatar :src="boostDetail.avatar" size="160"></u-avatar>
- <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>
- <view class="text-gray text-sm" v-if="presentDetail.isGiveMedal == 1">公益勋章X {{count}}</view>
- <view class="text-gray text-sm" v-if="presentDetail.isSendGoods == 1">{{presentDetail.goodsName}} X {{count}}</view>
- <view class="text-gray text-sm">可得{{+boostDetail.presentList[current].pointsValue * count}}积分,可用于国信商城兑换</view>
- <view class="padding">
- <u-button class="custom-style" shape="circle" @click="pay">去支付</u-button>
- </view>
- </view>
- </u-popup>
- <u-popup v-model="successShow" mode="center" width="500rpx" height="600rpx" border-radius="30">
- <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;">
- <view style="height: 120upx;"></view>
- <u-avatar :src="boostDetail.avatar" size="160"></u-avatar>
- <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>
- <view class="margin-tb-xs">{{+boostDetail.presentList[current].pointsValue * count}}已到账,可用于商城兑换消费</view>
- <view class="text-gray text-sm">购买成功!快去我的订单兑换或捐赠</view>
- <view class="padding">
- <u-button class="custom-style" shape="circle" @click="successShow = false">确定</u-button>
- </view>
- </view>
- </u-popup>
- <view class="cu-modal" :class="wxShareShow ? 'show' : ''" style="z-index: 9999;">
- <view class="cu-dialog">
- <view style="height:150px;">
- <view style="color: #000000;font-size: 38upx;padding: 40upx;">1. 先点击右上角<text class="text-bold" style="font-size: 38upx;">"···"</text></view>
- <view style="color: #000000;font-size: 38upx;padding: 40upx;">2. 选择<text class="text-bold" style="font-size: 38upx;">"{{type}}"</text></view>
- </view>
- <view class="cu-bar text-green text-lg bg-white">
- <view class="action margin-0 flex-sub solid-left" @tap="wxShareShow = false">知道了</view>
- </view>
- </view>
- </view>
- <works-poster ref="myCard" :works="works"></works-poster>
- </view>
- </template>
- <script>
- import {appId} from '@/common/conf/config.js'
- import {authUrl} from '@/common/conf/config.js';
- import {getUrlParams} from '@/common/utils/utils.js';
- import worksPoster from "@/components/works-poster/works-poster.vue";
- import { pathToBase64, base64ToPath } from '@/common/utils/index.js'
- export default {
- components: {worksPoster},
- data() {
- return {
- val: '', // 要生成的二维码值
- size: 200, // 二维码大小
- //unit: 'upx', // 单位
- //icon: '', // 二维码图标
- //iconsize: 40, // 二维码图标大小
- //lv: 3, // 二维码容错级别 , 一般不用设置,默认就行
- onval: false, // val值变化时自动重新生成二维码
- loadMake: true, // 组件加载完成后自动生成二维码
- src: '' ,// 二维码生成后的图片地址或base64
- works: {
- image: 'https://music.nanyue6688.com/obsfile/9bd6e4bb9e464794a23d7073de826662-图层 1.png',
- title: '',
- hotValue: '',
- rank: '',
- avatar: '',
- name: '',
- qrcode: 'https://music.nanyue6688.com/obsfile/c531395a576b4b1aa7377cdbf62cb088-default.png',
- },
- activityId: '',
- current: 0,
- boostDetail: {},
- dialogShow: false,
- shareShow: false,
- wxShareShow: false,
- count: 1,
- currentPresentSum: 0,
- productId: '',
- userId: '',
- type:'',
- presentId: '',
- successShow: false,
- presentDetail: {},
- }
- },
- onLoad(options) {
- this.productId = options.id;
- this.userId = uni.getStorageSync("userId");
- if (!this.$u.test.isEmpty(this.userId)) {
- this.val = "https://music.nanyue6688.com/vote-h5/index.html#/pages/activityList/activity/musicBoost?id=" + this.productId + "&agenterId=" + this.userId;
- } else {
- this.val = "https://music.nanyue6688.com/vote-h5/index.html#/pages/activityList/activity/musicBoost?id=" + this.productId;
- }
- this.addVisit(options.id);
- this.getBoostDetail(options.id, this.userId);
- this.authorization();
- },
- methods: {
- home() {
- uni.navigateTo({
- url: "/pages/activityList/home/home?activityId=" + this.boostDetail.activityId,
- })
- },
- addVisit(id) {
- this.$u.api.production.visit({id: id}).then(res => {
- console.log(res);
- })
- },
- //打榜助力
- userBoost() {
- if (this.$u.test.isEmpty(this.userId)) {
- let path = 'pages/activityList/activity/musicBoost?id=' + this.productId;
- window.location.href = authUrl(path);
- } else {
- this.$u.api.boost.doHit({
- activityId: this.boostDetail.activityId,
- productId: this.productId,
- senderId: this.userId,
- receiverId: this.boostDetail.userId,
- type: 0,
- }).then(res => {
- console.log(res);
- if (res.code == 400) {
- uni.showToast({
- icon: "none",
- title: res.msg
- })
- } else {
- this.getBoostDetail(this.productId, this.userId);
- }
-
- })
- }
- },
- //礼物支付
- async pay() {
- let _this = this;
- if (this.$u.test.isEmpty(this.userId)) {
- let path = 'pages/activityList/activity/musicBoost?id=' + this.productId;
- window.location.href = authUrl(path);
- } else {
- let orderId=new Date().getTime()
- let orderInfo = (await this.$u.api.yeePay.initOrder(
- {
- "appId": appId,
- "channel": "WECHAT",
- "channelPromotionInfo": "",
- "channelSpecifiedInfo": "",
- "csUrl": "",
- "expiredTime": "",
- "fundProcessType": "",
- "goodsName": this.boostDetail.presentList[this.current].name,
- "memo": "",
- "notifyUrl": "https://music.nanyue6688.com/ldt/api/yeePay/notify",
- "orderAmount": this.count * this.currentPresentSum,
- "orderId": orderId,
- "payWay": "WECHAT_OFFIACCOUNT",
- "redirectUrl": "",
- "scene": "OFFLINE",
- "uniqueOrderNo": "",
- "userId": uni.getStorageSync("openid"),
- "userIp": "127.0.0.1"
- }
- ));
- _this.$u.api.boost.billRecord({
- userId: _this.userId,
- orderId:orderId,
- openId: uni.getStorageSync("openid"),
- payPath: encodeURIComponent(window.location.href),
- activityId: _this.boostDetail.activityId,
- price: _this.count * _this.currentPresentSum,
- presentId: _this.boostDetail.presentList[_this.current].id,
- presentCount: _this.count,
- relationId: _this.productId,
- type: 1,
- payStatus: 0,
- }).then(res=>{
- if(typeof orderInfo.prePayTn != 'undefined' ){
- //调起支付
- this.toPay(JSON.parse(orderInfo.prePayTn));
- }
- })
- }
- },
- //获取助力详情
- getBoostDetail(productId, userId) {
- this.$u.api.musicBoost.detail({id: productId, userId: this.userId}).then(res => {
- this.boostDetail = res;
- this.currentPresentSum = res.presentList[this.current].price;
- })
- },
- change(id, index) {
- this.presentId = id;
- this.currentPresentSum = 0;
- this.count = 1;
- this.current = index;
- this.currentPresentSum = this.boostDetail.presentList[index].price;
- },
- //礼物+
- plus() {
- this.count++
- },
- //礼物 -
- minus() {
- if (this.count > 1) {
- this.count--
- }
- },
- async authorization() {
- let agenterId=uni.getStorageSync("agenterId")
- let params = getUrlParams(window.location.search);
- if (!this.$u.test.isEmpty(params.code)) {
- let res = await this.$u.api.wxInfo.getUserInfo({userCode: params.code});
- uni.setStorageSync("openid", res.openid);
- let datas = {
- nickName: res.nickname,
- avatar: res.headimgurl,
- gender: res.sex,
- openid: res.openid,
- unionid: res.unionid,
- province:res.province,
- city:res.city
- }
- if (!this.$u.test.isEmpty(agenterId)) {
- datas.agenterId=agenterId
- }
- let result = await this.$u.api.user.login(datas);
- if (result) {
- this.userId = result.id;
- uni.setStorageSync("userId", result.id);
- this.getBoostDetail(this.productId, this.userId);
- }
- }
- },
- qrR(res) {
- base64ToPath(res).then(res => {
- this.works.qrcode = res;
- });
- },
- //邀请
- invite() {
- this.shareShow = true;
- if (this.boostDetail.urlsType == 1) {
- this.works.image = this.boostDetail.cover;
- } else {
- this.works.image = this.boostDetail.urls;
- }
- this.works.title = this.boostDetail.title;
- this.works.hotValue = +this.boostDetail.hotValue;
- this.works.rank = this.boostDetail.rank;
- this.works.name = this.boostDetail.personName;
- },
- wxShare() {
- this.shareShow = false;
- this.wxShareShow = true;
- this.type = "发送给朋友";
- },
- pyqShare() {
- this.$refs.myCard.showCanvas();
- this.shareShow = false;
- // this.wxShareShow = true;
- // this.type = "分享到朋友圈"
- },
- toPay(info) {
- console.log(info,456789);
- let _this = this;
- WeixinJSBridge.invoke('getBrandWCPayRequest', info, (res) => {
- if (res.err_msg == "get_brand_wcpay_request:ok" ) {
- _this.successShow = true;
- } else if (res.err_msg == "get_brand_wcpay_request:cancel") {
- console.log("cancel");
- } else {
- console.log(res.err_msg);
- }
- });
- },
- presentBoost(id) {
- this.$u.api.boost.presentDetail({id: id}).then(res => {
- this.presentDetail = res;
- this.dialogShow = true;
- })
- },
- preViewImg(url) {
- uni.previewImage({
- urls: [url]
- });
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .head {
- background-color: #ffffff;
- margin-top: -26upx;
- border-radius: 26upx 26upx 0 0;
- .number {
- font-size: 38upx;
- font-family: PingFang SC;
- font-weight: 800;
- color: #222222;
- }
- .tag {
- padding: 0 10upx;
- line-height: 40upx;
- display: flex;
- align-items: center;
- justify-content: center;
- background: linear-gradient(90deg, #7355F4 0%, #573BE5 100%);
- margin-top: 8upx;
- border-radius: 30upx;
- }
- }
- .title {
- line-height: 50px;
- padding-left: 30upx;
- font-size: 30upx;
- font-family: PingFang SC;
- font-weight: 800;
- color: #201F1F;
- }
- .container {
- background-color: #FFFFFF;
- margin-top: 30upx;
- }
- .boder {
- box-shadow: -1upx -1upx 60upx #d8d8d8;
- border-radius: 16upx;
- }
- .input {
- width: 80upx;
- background-color: #ffffff;
- text-align: center;
- border: none;
- height: 60rpx;
- min-height: 1.8rem;
- }
- .custom-style {
- background-color: #5b3ee7;
- width: 250upx;
- color: #ffffff;
- }
- </style>
|