| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658 |
- <template>
- <view class="container">
- <view class="contentBox">
- <view class="btoomBg"></view>
- <view class="topBg">
- <image class="topImg" src="../../static/img/img08.png" mode="widthFix"></image>
-
- <view class="tpConent">
- <view class="titleUser">
- <text>{{chargeUserItem.sub_id}}号</text>
- <test style='margin-left: 0.5em;'></test>
- <text>{{chargeUserItem.name}}</text>
- </view>
- <view class="userType flex">
- <image class="typeIcon" src="../../static/img/userinfoLeft.png" mode="widthFix"></image>
- <view class="typeItem">
- {{chargeUserItem.job}}
- </view>
- <image class="typeIcon" src="../../static/img/userinfoRight.png" mode="widthFix"></image>
- </view>
- <view class="tip">
- 正在参加:“2022年度明星母婴工作者颖川杯海选赛”评选邀您来投票
- </view>
- <view class="tjContent borderV flex">
- <view class="tjItem">
- <view class="topText">
- {{ chargeUserItem.vote }}
- <text class="iconTip"></text>
- </view>
- <view class="bottomText">投票</view>
- </view>
- <view class="tjItem">
- <view class="topText">
- {{ chargeUserItem.rank }}
- <text class="iconTip"></text>
- </view>
- <view class="bottomText">排名</view>
- </view>
- </view>
- <view class="userImg">
- <view class="imgBox">
- <image class="img" :src="chargeUserItem.avatar" mode="scaleToFill"></image>
- <view class="company clamp" v-if="chargeUserItem.type==2">
- {{chargeUserItem.company}}
- </view>
- </view>
- </view>
- <view class="detail borderV">
- 个人介绍
- </view>
- <view class="detailText">
- {{chargeUserItem.detail}}
- </view>
- </view>
- </view>
- </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="chargeConfirm">给TA投票</view>
- </view>
- <u-popup border-radius="20" v-model="showCharge" mode="bottom">
- <view class="alertChargeBox">
- <view class="alertCharge flex">
- <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="chargeTextBox flex">
- <image class="chargeIcon" src="../../static/img/moneyIcon.png" mode="scaleToFill"></image>
- <text>{{ ls.num }}</text>
- </view>
- </view>
- </view>
- <view class="flex chargeButtom">
- <view class="left flex">
- <image class="chargeIcon" src="../../static/img/moneyIcon.png" mode="scaleToFill"></image>
- <text class="num">¥{{ payMoneyNum }}</text>
- <text class="tip">可为选手加{{ voteNumList[moneyIndex].num }}票</text>
- </view>
- <view class="right" @click="payLoding ? false : commitCharge()">赠送</view>
- </view>
- </view>
- </u-popup>
- </view>
- </template>
- <script>
- import { ptDetail, rechargeWechat, getItemInfo,ptPush } 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 {
- data() {
- return {
- // 投票数列表
- voteNumList: [
- {
- num: 1
- },
- {
- num: 3
- },
- {
- num: 5
- },
- {
- num: 10
- },
- {
- num: 20
- },
- {
- num: 50
- },
- {
- num: 100
- },
- {
- num: 200
- }
- ],
- moneyIndex: 0, //当前选中的投票对象
- showCharge: false, //显示投票弹窗
- priceBl: 1, //默认1票对应金额投票比例
- chargeUserItem: {}, //当前选中的投票对象
- dayFree: '', //可投票数
- dayFreeVote: '', //已投票数
- payLoding: false, //是否微信充值
- activtyName: '', //活动标题
- erweima: '', //首页分享二维码
- uid: ''
- };
- },
- computed: {
- // 我剩余可投票数
- myVote() {
- return this.dayFree - this.dayFreeVote;
- },
- // 需要支付的金额
- payMoneyNum() {
- return this.voteNumList[this.moneyIndex].num * this.priceBl;
- }
- },
- onLoad(res) {
- // 保存当前用户信息
- this.uid = res.id;
- // 获取参赛用户信息
- this.getItemInfo();
- },
- onShow() {
- this.init();
- },
- methods: {
- loadShare() {
- // 请求获取默认数据
- shareLoad({
- link: window.location.href, // 分享链接
- imgUrl: this.chargeUserItem.avatar,
- desc:this.chargeUserItem.detail,
- title: this.chargeUserItem.name+'需要您的助力!',
- });
- },
- init() {
- this.ptDetail();
- },
- getItemInfo() {
- // 获取用户信息
- getItemInfo({}, this.uid)
- .then(e => {
- this.chargeUserItem = e.data.data;
- this.loadShare();
- console.log(e);
- })
- .catch(e => {
- console.log(e);
- });
- },
- //开始投票
- 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({
- 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;
- })
- .catch(e => {
- obj.payLoding = false;
- });
- });
- },
- // 投票弹窗
- chargeConfirm() {
- // 判断是否还有剩余投票次数
- if (this.myVote <= 0) {
- uni.showToast({
- title: '已无免费票数'
- });
- // this.showCharge = true;
- } else {
- this.commitCharge();
- }
- },
- // 请求返回项目数据
- ptDetail() {
- ptDetail()
- .then(e => {
- const data = e.data;
- this.priceBl = +data.price;
- this.dayFree = data.day_free; //可投免费票数
- this.dayFreeVote = data.today_free_vote_num; //已投免费 票数
- this.activtyName = data.title;
- })
- .catch(e => {
- console.log();
- });
- },
- // 页面跳转
- nextTo(url) {
- console.log(url, '跳转地址');
- uni.navigateTo({
- url,
- fail: e => {
- console.log(e);
- }
- });
- }
- }
- };
- </script>
- <style lang="scss">
- page,
- .container {
- height: auto;
- min-height: 100%;
- background-color: #ff9ba7;
- }
- .container {
- padding-top: 50rpx;
- padding-bottom: 130rpx;
- position: relative;
- }
- .alertChargeBox {
- .alertCharge {
- justify-content: flex-start;
- flex-wrap: wrap;
- padding: 30rpx;
- .chargeItem {
- width: 25%;
- text-align: center;
- position: relative;
- height: 180rpx;
- padding: 40rpx;
- margin: 20rpx 0;
- &.actionCharge {
- border: 1px solid #d7272b;
- border-radius: 10rpx;
- }
- .chargeImgIcon {
- position: absolute;
- top: 10rpx;
- right: 10rpx;
- font-size: 18rpx;
- font-weight: bold;
- color: #ffffff;
- border-top-right-radius: 90rpx;
- border-top-left-radius: 90rpx;
- border-bottom-right-radius: 90rpx;
- padding: 5rpx 15rpx;
- background-color: #d7272b;
- }
- .chargeTextBox {
- position: absolute;
- bottom: 10rpx;
- right: 0;
- left: 0;
- justify-content: center;
- color: #223438;
- font-size: 24rpx;
- text-align: center;
- .chargeIcon {
- width: 35rpx;
- height: 35rpx;
- margin-right: 10rpx;
- }
- }
- .chargeImgBox {
- .chargeImg {
- width: 77rpx;
- }
- }
- }
- }
- .chargeButtom {
- padding: 30rpx;
- background-color: #fff6f6;
- .left {
- font-weight: bold;
- flex-grow: 1;
- justify-content: flex-start;
- .chargeIcon {
- width: 40rpx;
- height: 40rpx;
- }
- .num {
- margin-left: 10rpx;
- color: #16363a;
- font-size: 30rpx;
- }
- .tip {
- margin-left: 10rpx;
- color: #d82a2e;
- font-size: 24rpx;
- }
- }
- .right {
- background-color: #d7272b;
- color: #ffffff;
- border-radius: 99rpx;
- padding: 5rpx 40rpx;
- font-size: 26rpx;
- }
- }
- }
- .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 {
- width: 100%;
- }
- .contentBox {
- position: relative;
- width: 0px;
- min-width: 100%;
- margin-bottom: 32rpx;
- .btoomBg {
- background-color: #ffffff;
- min-height: 50vh;
- height: 100%;
- position: absolute;
- top: 32rpx;
- right: 30rpx;
- left: 42rpx;
- }
- .topBg {
- position: relative;
- margin-left: 30rpx;
- margin-right: 42rpx;
- box-shadow: 3px 5rpx 3rpx 0rpx rgba(4, 0, 0, 0.15);
- line-height: 0;
- min-height: 100%;
- .leftIcon {
- position: absolute;
- top: 30rpx;
- left: -30rpx;
- width: 100rpx;
- }
- .tpConent {
- background: #ffffff;
- line-height: 1;
- min-height: 50vh;
- padding-top: 15px;
- padding-bottom: 11px;
- .detail{
- color: #333333;
- font-size: 32rpx;
- text-align: center;
- font-weight: bold;
- padding: 30rpx 0;
- }
- .detailText{
- line-height: 1.5;
- padding: 30rpx;
- color: #666666;
- }
- .userImg{
- padding: 40rpx 30rpx;
- text-align: center;
- .imgBox{
- position: relative;
- width: 100%;
- padding-top: 100%;
- .img{
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- }
- .company{
- position: absolute;
- bottom: 0;
- left: 0;
- right: 0;
- background: #262626;
- opacity: 0.6;
- color: #ffffff;
- font-size: 30rpx;
- padding: 10rpx 0;
- text-align: center;
- line-height: 1.5;
-
- }
- }
-
- }
- .tip{
- color: #333333;
- text-align: center;
- font-size: 26rpx;
- font-weight: bold;
- padding:30rpx ;
- line-height: 1.5;
- }
- .userType{
- color:#FFC103 ;
- font-weight: bold;
- padding-top: 32rpx;
- justify-content: center;
- .typeIcon{
- width:120rpx ;
- }
- .typeItem{
- padding: 0 1em;
- }
- }
- .titleUser{
- padding-top: 50rpx;
- color:#d7272b;
- font-size: 50rpx;
- font-weight: bold;
- text-align: center;
- }
- .borderV{
- border-top: 1px solid #f3f3f3;
- border-bottom: 1px solid #f3f3f3;
- }
- .tjContent {
- margin-top: 10rpx;
- padding-top: 30rpx;
- padding-bottom: 30rpx;
- justify-content: space-around;
- text-align: center;
-
- .tjItem {
- .topText {
- font-size: 50rpx;
- font-weight: bold;
- color: #d7272b;
- .iconTip {
- font-size: 20rpx;
- }
- }
- .bottomText {
- margin-top: 10rpx;
- font-size: 24rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #333333;
- }
- }
- }
- }
- }
- }
- /deep/ .u-countdown-item {
- padding: 10rpx;
- border-radius: 8rpx;
- overflow: hidden;
- }
- .alertBox {
- padding-bottom: 40rpx;
- .titleImg {
- width: 100%;
- z-index: -1;
- }
- .title {
- text-align: center;
- font-size: 36rpx;
- font-weight: bold;
- color: #333333;
- margin-top: -80rpx;
- }
- .titleTip {
- text-align: center;
- font-size: 24rpx;
- font-weight: bold;
- color: #808080;
- }
- .lxTtem {
- margin: 0 40rpx;
- padding: 30rpx 0;
- border-bottom: 1px solid #ebebeb;
- .leftTitle {
- justify-content: start;
- width: 43rpx;
- flex-grow: 1;
- color: #333333;
- font-size: 28rpx;
- .leftImgTip {
- flex-shrink: 0;
- // width: 30rpx;
- height: 30rpx;
- margin-right: 20rpx;
- }
- }
- .rightTip {
- border: 1px solid #d7272b;
- opacity: 0.5;
- border-radius: 50%;
- width: 32rpx;
- height: 32rpx;
- justify-content: center;
- .xzTip {
- width: 20rpx;
- height: 20rpx;
- border-radius: 99rpx;
- background-color: #d7272b;
- }
- }
- }
- .pushtyle {
- background: #d7272b;
- box-shadow: 0px 16rpx 16rpx 0px rgba(215, 39, 43, 0.5);
- border-radius: 10rpx;
- color: #ffffff;
- font-size: 28rpx;
- font-weight: bold;
- text-align: center;
- padding: 20rpx 0;
- margin: 0 40rpx;
- margin-top: 40rpx;
- }
- }
- </style>
|