|
@@ -11,7 +11,7 @@
|
|
<view class="tpTitle">评选活动</view>
|
|
<view class="tpTitle">评选活动</view>
|
|
<view class="endTextBox flex">
|
|
<view class="endTextBox flex">
|
|
<view class="leftLine"><view class="roundness"></view></view>
|
|
<view class="leftLine"><view class="roundness"></view></view>
|
|
- <view class="textLine">距离投票结束还有</view>
|
|
|
|
|
|
+ <view class="textLine">距离活动结束还有</view>
|
|
<view class="rightLine"><view class="roundness"></view></view>
|
|
<view class="rightLine"><view class="roundness"></view></view>
|
|
</view>
|
|
</view>
|
|
<view class="down">
|
|
<view class="down">
|
|
@@ -73,7 +73,7 @@
|
|
<view>号</view>
|
|
<view>号</view>
|
|
</view>
|
|
</view>
|
|
<image class="itemImg" :src="item.avatar" mode="scaleToFill"></image>
|
|
<image class="itemImg" :src="item.avatar" mode="scaleToFill"></image>
|
|
- <view class="itemAddress clamp" v-if="item.address">{{ item.address }}</view>
|
|
|
|
|
|
+ <view class="itemAddress clamp" v-if="item.type==2">{{ item.company }}</view>
|
|
</view>
|
|
</view>
|
|
<view class="itemNameBox flex">
|
|
<view class="itemNameBox flex">
|
|
<view class="itemName">{{ item.name }}</view>
|
|
<view class="itemName">{{ item.name }}</view>
|
|
@@ -133,7 +133,16 @@
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
- <view class="addUser" @click="pushUserData">我要参与</view>
|
|
|
|
|
|
+ <view class="alertAddBox flex">
|
|
|
|
+ <view class="textAlertBox">
|
|
|
|
+ <view class="psBox">
|
|
|
|
+ <image class="psImgIcon" src="../static/img/alertPIcon.png" mode="widthFix"></image>
|
|
|
|
+ <text>{{ myVote }}</text>
|
|
|
|
+ </view>
|
|
|
|
+ <view>剩余票数</view>
|
|
|
|
+ </view>
|
|
|
|
+ <view class="addUser" @click="pushUserData">我要参与</view>
|
|
|
|
+ </view>
|
|
<u-popup border-radius="20" width="540" v-model="showAlert" mode="center">
|
|
<u-popup border-radius="20" width="540" v-model="showAlert" mode="center">
|
|
<view class="alertBox">
|
|
<view class="alertBox">
|
|
<image class="titleImg" src="../static/img/alertbg.png" mode="widthFix"></image>
|
|
<image class="titleImg" src="../static/img/alertbg.png" mode="widthFix"></image>
|
|
@@ -161,29 +170,34 @@
|
|
<u-popup border-radius="20" v-model="showCharge" mode="bottom">
|
|
<u-popup border-radius="20" v-model="showCharge" mode="bottom">
|
|
<view class="alertChargeBox">
|
|
<view class="alertChargeBox">
|
|
<view class="alertCharge flex">
|
|
<view class="alertCharge flex">
|
|
- <view class="chargeItem" :class="{ actionCharge: ind == moneyIndex }" v-for="(ls, ind) in 8" @click="moneyIndex = ind">
|
|
|
|
- <view class="chargeImgIcon">{{ (ind + 1) * numCharge }}票</view>
|
|
|
|
|
|
+ <view class="chargeItem" :class="{ actionCharge: ind == moneyIndex }" v-for="(ls, ind) in voteNumList" @click="moneyIndex = ind">
|
|
|
|
+ <view class="chargeImgIcon">{{ ls.num }}票</view>
|
|
<view class="chargeImgBox"><image class="chargeImg" :src="'../static/img/chargeIcon' + (ind + 1) + '.png'" mode="widthFix"></image></view>
|
|
<view class="chargeImgBox"><image class="chargeImg" :src="'../static/img/chargeIcon' + (ind + 1) + '.png'" mode="widthFix"></image></view>
|
|
<view class="chargeTextBox flex">
|
|
<view class="chargeTextBox flex">
|
|
<image class="chargeIcon" src="../static/img/moneyIcon.png" mode="scaleToFill"></image>
|
|
<image class="chargeIcon" src="../static/img/moneyIcon.png" mode="scaleToFill"></image>
|
|
- <text>{{ (ind + 1) * numCharge }}</text>
|
|
|
|
|
|
+ <text>{{ ls.num }}</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="flex chargeButtom">
|
|
<view class="flex chargeButtom">
|
|
<view class="left flex">
|
|
<view class="left flex">
|
|
<image class="chargeIcon" src="../static/img/moneyIcon.png" mode="scaleToFill"></image>
|
|
<image class="chargeIcon" src="../static/img/moneyIcon.png" mode="scaleToFill"></image>
|
|
- <text class="num">¥{{ (moneyIndex + 1) * numCharge * priceBl }}</text>
|
|
|
|
- <text class="tip">可为选手加{{ (moneyIndex + 1) * numCharge }}票</text>
|
|
|
|
|
|
+ <text class="num">¥{{ payMoneyNum }}</text>
|
|
|
|
+ <text class="tip">可为选手加{{ voteNumList[moneyIndex].num }}票</text>
|
|
</view>
|
|
</view>
|
|
- <view class="right" @click="commitCharge">赠送</view>
|
|
|
|
|
|
+ <view class="right" @click="payLoding ? false : commitCharge()">赠送</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</u-popup>
|
|
</u-popup>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
</template>
|
|
<script>
|
|
<script>
|
|
-import { ptDetail, ptJoin,ptPush } from '@/api/tp.js';
|
|
|
|
|
|
+import { ptDetail, ptJoin, ptPush, rechargeWechat } from '@/api/tp.js';
|
|
|
|
+import weixinObj from '@/plugin/jweixin-module/index.js';
|
|
|
|
+import { shareLoad } from '@/utils/wxAuthorized.js';
|
|
|
|
+import {
|
|
|
|
+ share
|
|
|
|
+} from '@/api/wx';
|
|
export default {
|
|
export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
@@ -235,17 +249,57 @@ export default {
|
|
name: '母乳喂养师排行'
|
|
name: '母乳喂养师排行'
|
|
}
|
|
}
|
|
],
|
|
],
|
|
|
|
+ voteNumList: [
|
|
|
|
+ {
|
|
|
|
+ num: 1
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ num: 3
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ num: 5
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ num: 10
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ num: 20
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ num: 50
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ num: 100
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ num: 200
|
|
|
|
+ }
|
|
|
|
+ ],
|
|
//参赛类型
|
|
//参赛类型
|
|
csType: 0, //0个人 1企业
|
|
csType: 0, //0个人 1企业
|
|
showAlert: false, //显示参赛弹窗
|
|
showAlert: false, //显示参赛弹窗
|
|
showCharge: false, //显示投票弹窗
|
|
showCharge: false, //显示投票弹窗
|
|
moneyIndex: 0, //当前选中的投票对象
|
|
moneyIndex: 0, //当前选中的投票对象
|
|
- numCharge:10,//默认对应翻倍比例
|
|
|
|
- priceBl: 1 ,//默认1票对应金额投票比例
|
|
|
|
- chargeUserItem:{},//当前选中的投票对象
|
|
|
|
- timeStop:false,//判断倒计时是否结束
|
|
|
|
|
|
+ numCharge: 1, //默认对应翻倍比例
|
|
|
|
+ priceBl: 1, //默认1票对应金额投票比例
|
|
|
|
+ chargeUserItem: {}, //当前选中的投票对象
|
|
|
|
+ timeStop: false, //判断倒计时是否结束
|
|
|
|
+ dayFree: '', //可投票数
|
|
|
|
+ dayFreeVote: '', //已投票数
|
|
|
|
+ payLoding: false, //是否微信充值
|
|
|
|
+ activtyName: '' //活动标题
|
|
};
|
|
};
|
|
},
|
|
},
|
|
|
|
+ computed: {
|
|
|
|
+ // 我剩余可投票数
|
|
|
|
+ myVote() {
|
|
|
|
+ return this.dayFree - this.dayFreeVote;
|
|
|
|
+ },
|
|
|
|
+ // 需要支付的金额
|
|
|
|
+ payMoneyNum() {
|
|
|
|
+ return this.voteNumList[this.moneyIndex].num * this.priceBl;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
watch: {
|
|
watch: {
|
|
rank(newValue, oldValue) {
|
|
rank(newValue, oldValue) {
|
|
let data = {};
|
|
let data = {};
|
|
@@ -269,71 +323,147 @@ export default {
|
|
job = '母乳喂养指导师';
|
|
job = '母乳喂养指导师';
|
|
}
|
|
}
|
|
this.getData(data, rank, job);
|
|
this.getData(data, rank, job);
|
|
- },
|
|
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ onLoad() {
|
|
|
|
+ this.loadShare();
|
|
},
|
|
},
|
|
onShow() {
|
|
onShow() {
|
|
- this.ptDetail();
|
|
|
|
- this.ptJoin();
|
|
|
|
|
|
+ this.init();
|
|
},
|
|
},
|
|
// 页面下拉到底部加载
|
|
// 页面下拉到底部加载
|
|
onReachBottom() {
|
|
onReachBottom() {
|
|
this.ptJoin();
|
|
this.ptJoin();
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ loadShare() {
|
|
|
|
+ // 请求获取默认数据
|
|
|
|
+ shareLoad();
|
|
|
|
+ },
|
|
|
|
+ init() {
|
|
|
|
+ this.ptDetail();
|
|
|
|
+ this.ptJoin();
|
|
|
|
+ },
|
|
// 倒计时结束
|
|
// 倒计时结束
|
|
- stopTime(){
|
|
|
|
- this.timeStop= true;
|
|
|
|
|
|
+ stopTime() {
|
|
|
|
+ this.timeStop = true;
|
|
},
|
|
},
|
|
- //开始投票
|
|
|
|
- commitCharge(){
|
|
|
|
|
|
+ //开始投票
|
|
|
|
+ async commitCharge() {
|
|
|
|
+ // 创建对象
|
|
|
|
+ let payType, num;
|
|
|
|
+ // 判断是否有剩余投票次数
|
|
|
|
+ if (this.myVote > 0) {
|
|
|
|
+ payType = 'free';
|
|
|
|
+ num = 1;
|
|
|
|
+ } else {
|
|
|
|
+ payType = 'yue';
|
|
|
|
+ num = this.voteNumList[this.moneyIndex].num;
|
|
|
|
+ await this.payMoney();
|
|
|
|
+ }
|
|
uni.showLoading({
|
|
uni.showLoading({
|
|
- title:"投票中",
|
|
|
|
- mask:true
|
|
|
|
- })
|
|
|
|
- ptPush({
|
|
|
|
- num:this.numCharge*(this.moneyIndex+1),
|
|
|
|
- payType:'yue'
|
|
|
|
- },this.chargeUserItem.id).then((e) => {
|
|
|
|
- uni.hideLoading()
|
|
|
|
- if(e.msg =='余额支付成功'){
|
|
|
|
- uni.showToast({
|
|
|
|
- title:'投票成功!'
|
|
|
|
|
|
+ title: '投票中',
|
|
|
|
+ mask: true
|
|
|
|
+ });
|
|
|
|
+ ptPush(
|
|
|
|
+ {
|
|
|
|
+ num,
|
|
|
|
+ payType
|
|
|
|
+ },
|
|
|
|
+ this.chargeUserItem.id
|
|
|
|
+ )
|
|
|
|
+ .then(e => {
|
|
|
|
+ uni.hideLoading();
|
|
|
|
+ if (e.msg == '余额支付成功' || e.msg == '投票成功') {
|
|
|
|
+ uni.showToast({
|
|
|
|
+ title: '投票成功!'
|
|
|
|
+ });
|
|
|
|
+ // 修改当前用户获得的票数
|
|
|
|
+ this.chargeUserItem.vote += num;
|
|
|
|
+ if (e.msg == '投票成功') {
|
|
|
|
+ // 修改当前可投票数
|
|
|
|
+ this.dayFree -= num;
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ this.showCharge = false;
|
|
|
|
+ uni.showModal({
|
|
|
|
+ title: '错误',
|
|
|
|
+ content: '余额不足请充值',
|
|
|
|
+ success: res => {
|
|
|
|
+ if (res.confirm) {
|
|
|
|
+ uni.navigateTo({
|
|
|
|
+ url: '/pages/recharge/pay'
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ fail: () => {},
|
|
|
|
+ complete: () => {}
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ .catch(e => {
|
|
|
|
+ uni.hideLoading();
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ // 调用微信支付
|
|
|
|
+ payMoney() {
|
|
|
|
+ let obj = this;
|
|
|
|
+ return new Promise((ok, err) => {
|
|
|
|
+ if (obj.payLoding) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ obj.payLoding = true;
|
|
|
|
+ rechargeWechat({ price: this.payMoneyNum, from: 'weixin' })
|
|
|
|
+ .then(e => {
|
|
|
|
+ let da = e.data.data;
|
|
|
|
+ console.log(da);
|
|
|
|
+ console.log(weixinObj, 'weixinObj');
|
|
|
|
+ try {
|
|
|
|
+ weixinObj.ready(() => {
|
|
|
|
+ weixinObj.chooseWXPay({
|
|
|
|
+ timestamp: da.timestamp,
|
|
|
|
+ nonceStr: da.nonceStr,
|
|
|
|
+ package: da.package,
|
|
|
|
+ signType: da.signType,
|
|
|
|
+ paySign: da.paySign,
|
|
|
|
+ success: function(res) {
|
|
|
|
+ console.log(res);
|
|
|
|
+ ok(true);
|
|
|
|
+ },
|
|
|
|
+ fail: function(res) {
|
|
|
|
+ console.log(res);
|
|
|
|
+ err(false);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ } catch (e) {
|
|
|
|
+ console.log(e);
|
|
|
|
+ }
|
|
|
|
+ obj.payLoding = false;
|
|
})
|
|
})
|
|
- window.reload()
|
|
|
|
- }else{
|
|
|
|
- this.showCharge = false;
|
|
|
|
- uni.showModal({
|
|
|
|
- title: '错误',
|
|
|
|
- content: '余额不足请充值',
|
|
|
|
- success: res => {
|
|
|
|
- if(res.confirm){
|
|
|
|
- uni.navigateTo({
|
|
|
|
- url:'/pages/recharge/pay'
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- fail: () => {},
|
|
|
|
- complete: () => {}
|
|
|
|
|
|
+ .catch(e => {
|
|
|
|
+ obj.payLoding = false;
|
|
});
|
|
});
|
|
- }
|
|
|
|
-
|
|
|
|
- }).catch((e) => {
|
|
|
|
- uni.hideLoading()
|
|
|
|
- })
|
|
|
|
|
|
+ });
|
|
},
|
|
},
|
|
// 投票弹窗
|
|
// 投票弹窗
|
|
chargeConfirm(item) {
|
|
chargeConfirm(item) {
|
|
- if(this.timeStop){
|
|
|
|
|
|
+ if (this.timeStop) {
|
|
uni.showModal({
|
|
uni.showModal({
|
|
title: '提示',
|
|
title: '提示',
|
|
content: '投票已结束!',
|
|
content: '投票已结束!',
|
|
- showCancel: false,
|
|
|
|
|
|
+ showCancel: false
|
|
});
|
|
});
|
|
- return
|
|
|
|
- };
|
|
|
|
- this.showCharge = true;
|
|
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
// 保存当前选中的投票对象
|
|
// 保存当前选中的投票对象
|
|
- this.chargeUserItem = item
|
|
|
|
|
|
+ this.chargeUserItem = item;
|
|
|
|
+ // 判断是否还有剩余投票次数
|
|
|
|
+ if (this.myVote <= 0) {
|
|
|
|
+ this.showCharge = true;
|
|
|
|
+ } else {
|
|
|
|
+ this.commitCharge();
|
|
|
|
+ }
|
|
},
|
|
},
|
|
// 确认报名
|
|
// 确认报名
|
|
pushBm() {
|
|
pushBm() {
|
|
@@ -371,6 +501,9 @@ export default {
|
|
this.item.votes = data.vote_num;
|
|
this.item.votes = data.vote_num;
|
|
this.item.count = data.visit;
|
|
this.item.count = data.visit;
|
|
this.priceBl = +data.price;
|
|
this.priceBl = +data.price;
|
|
|
|
+ this.dayFree = data.day_free; //可投免费票数
|
|
|
|
+ this.dayFreeVote = data.today_free_vote_num; //已投免费 票数
|
|
|
|
+ this.activtyName = data.title;
|
|
})
|
|
})
|
|
.catch(e => {
|
|
.catch(e => {
|
|
console.log();
|
|
console.log();
|
|
@@ -407,14 +540,14 @@ export default {
|
|
},
|
|
},
|
|
// 报名
|
|
// 报名
|
|
pushUserData() {
|
|
pushUserData() {
|
|
- if(this.timeStop){
|
|
|
|
|
|
+ if (this.timeStop) {
|
|
uni.showModal({
|
|
uni.showModal({
|
|
title: '提示',
|
|
title: '提示',
|
|
content: '投票已结束!',
|
|
content: '投票已结束!',
|
|
- showCancel: false,
|
|
|
|
|
|
+ showCancel: false
|
|
});
|
|
});
|
|
- return
|
|
|
|
- };
|
|
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
this.showAlert = true;
|
|
this.showAlert = true;
|
|
},
|
|
},
|
|
// 请求用户数据
|
|
// 请求用户数据
|
|
@@ -467,7 +600,7 @@ page,
|
|
background-color: #ff9ba7;
|
|
background-color: #ff9ba7;
|
|
}
|
|
}
|
|
.container {
|
|
.container {
|
|
- padding-bottom: 22rpx;
|
|
|
|
|
|
+ padding-bottom: 130rpx;
|
|
position: relative;
|
|
position: relative;
|
|
}
|
|
}
|
|
.alertChargeBox {
|
|
.alertChargeBox {
|
|
@@ -544,8 +677,8 @@ page,
|
|
font-size: 24rpx;
|
|
font-size: 24rpx;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- .right{
|
|
|
|
- background-color: #D7272B;
|
|
|
|
|
|
+ .right {
|
|
|
|
+ background-color: #d7272b;
|
|
color: #ffffff;
|
|
color: #ffffff;
|
|
border-radius: 99rpx;
|
|
border-radius: 99rpx;
|
|
padding: 5rpx 40rpx;
|
|
padding: 5rpx 40rpx;
|
|
@@ -553,20 +686,42 @@ page,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-.addUser {
|
|
|
|
- clear: both;
|
|
|
|
- background: #d7272b;
|
|
|
|
- border: 1px solid #170911;
|
|
|
|
- border-radius: 7px;
|
|
|
|
- margin: 0 40rpx;
|
|
|
|
- line-height: 1;
|
|
|
|
- font-size: 31rpx;
|
|
|
|
- font-weight: bold;
|
|
|
|
- color: #ffffff;
|
|
|
|
- text-align: center;
|
|
|
|
- padding: 30rpx;
|
|
|
|
- line-height: 24rpx;
|
|
|
|
- margin-top: 50rpx;
|
|
|
|
|
|
+.alertAddBox {
|
|
|
|
+ background: #ff9ba7;
|
|
|
|
+ position: fixed;
|
|
|
|
+ bottom: 0;
|
|
|
|
+ left: 0;
|
|
|
|
+ right: 0;
|
|
|
|
+ padding: 20rpx 30rpx;
|
|
|
|
+ z-index: 1;
|
|
|
|
+ .textAlertBox {
|
|
|
|
+ flex-shrink: 0;
|
|
|
|
+ text-align: center;
|
|
|
|
+ font-size: 28rpx;
|
|
|
|
+ color: #ffffff;
|
|
|
|
+ padding-right: 20rpx;
|
|
|
|
+ .psBox {
|
|
|
|
+ font-size: 40rpx;
|
|
|
|
+ font-weight: bold;
|
|
|
|
+ .psImgIcon {
|
|
|
|
+ margin-right: 10rpx;
|
|
|
|
+ width: 30rpx;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ .addUser {
|
|
|
|
+ flex-grow: 1;
|
|
|
|
+ background: #d7272b;
|
|
|
|
+ border: 1px solid #170911;
|
|
|
|
+ border-radius: 7px;
|
|
|
|
+ line-height: 1;
|
|
|
|
+ font-size: 31rpx;
|
|
|
|
+ font-weight: bold;
|
|
|
|
+ color: #ffffff;
|
|
|
|
+ text-align: center;
|
|
|
|
+ padding: 30rpx;
|
|
|
|
+ line-height: 24rpx;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
.topImg {
|
|
.topImg {
|
|
width: 100%;
|
|
width: 100%;
|
|
@@ -736,7 +891,7 @@ page,
|
|
left: -18rpx;
|
|
left: -18rpx;
|
|
height: 73rpx;
|
|
height: 73rpx;
|
|
width: 62rpx;
|
|
width: 62rpx;
|
|
- z-index: 99;
|
|
|
|
|
|
+ z-index: 1;
|
|
background-image: url(../static/img/img07.png);
|
|
background-image: url(../static/img/img07.png);
|
|
background-size: 100% 100%;
|
|
background-size: 100% 100%;
|
|
color: #ffffff;
|
|
color: #ffffff;
|