| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491 |
- <template>
- <view class="content">
- <view class="top-wrap">
- <view class="top-bg">
-
- </view>
- <view class="user-data flex">
- <!-- <view class="data" @click="navto('/pages/vip/contract')">
- <view class="data-val">200</view>
- <view class="data-tit">合约收益</view>
- </view> -->
- <view class="data" @click="navto('/pages/vip/extension')">
- <view class="data-val">{{(userInfo.brokerage_price*1).toFixed(0)}}</view>
- <view class="data-tit">推广收益</view>
- </view>
- <view class="data" @click="navto('/pages/vip/mytz')">
- <view class="data-val">{{(userInfo.now_money*1).toFixed(0)}}</view>
- <view class="data-tit">我的通证</view>
- </view>
- <view class="data" @click="navto('/pages/user/integral')">
- <view class="data-val">{{(userInfo.integral*1).toFixed(0)}}</view>
- <view class="data-tit">我的积分</view>
- </view>
- </view>
- </view>
- <view class="fwb-logo">
- <image src="../../static/img/fwb.png" mode=""></image>
- </view>
- <scroll-view scroll-y="true" :style="{'height': height}" class="scoll-wrap" @scrolltolower="loadData()">
- <view class="buy-item" v-for="item in list" >
- <!-- v-if="item.start <= nowTime && item.end > nowTime" -->
- <view class="item-top">
- <view class="top-left">
- <image src="../../static/icon/mrlogo.png" mode=""></image><text class="top-name clamp">{{item.name || ''}}</text>
- </view>
- <view class="top-right">
- {{item.status}}
- <!-- {{item.am == 1? '上午场':'下午场'}} -->
- </view>
- </view>
- <view class="item-info">
- <view class="info-data">
- <view class="info-tit">收益:</view>
- <view class="info-val">{{item.day}}天/{{item.proportion}}</view>
- </view>
- <!-- <view class="info-data">
- <view class="info-tit">开始时间:</view>
- <view class="info-val">10:20</view>
- </view> -->
- <view class="info-data">
- <view class="info-tit">可获通证:</view>
- <view class="info-val">{{item.pass}}</view>
- </view>
- <!-- <view class="info-data">
- <view class="info-tit">终止释放时间:</view>
- <view class="info-val">10:20</view>
- </view> -->
- <view class="info-data" v-if="item.status == '已结束'">
- <view class="info-tit">开奖时间:</view>
- <!-- <view class="info-val">{{item.cts}}</view> -->
- <view class="info-val">{{getNextTime()}}</view>
- </view>
- <view class="info-data">
- <view class="info-tit">价值:</view>
- <view class="info-val">{{item.price}}</view>
- </view>
- </view>
- <view class="mc-btn yy " @click="((item.am == 1 && nowTime >= '06:00' && nowTime < '12:00') || (item.am == 0 && nowTime >= '13:00' && nowTime < '17:00')) ? packageReserve(item): ''" :class="{'could':((item.am == 1 && nowTime >= '06:00' && nowTime < '12:00') || (item.am == 0 && nowTime >= '13:00' && nowTime < '17:00'))}">
- 立即预约
- </view>
- <!-- <view class="mc-btn pass could" @click="packageExchange(item,2)">
- 合约兑换
- </view> -->
- <!-- <view class="mc-btn fail" :class="{'could':(item.am == 0 && item.status == '进行中')}" @click="(item.am == 0 && item.status == '进行中')?packageExchange(item,1):''"> -->
- <view class="mc-btn fail" :class="{'could':item.am == 0 }" @click="item.am == 0 ?packageExchange(item,1):''">
- 推广兑换
- </view>
- </view>
- <uni-load-more :status="loadingType"></uni-load-more>
- </scroll-view>
- <view class="btm-btn flex">
- <view class="btm-left flex" @click="navto('/pages/appointment/appointment')">
- <image src="../../static/icon/myyy.png" mode=""></image>
- <view class="">
- 我的预约
- </view>
- </view>
- <view class="btm-right" style="background-color: #FFB238;" @click="navto('/pages/sellout/sellout')">
- 卖出
- </view>
- <view class="btm-right" style="background-color: #FF4C4C;" @click="navto('/pages/purchase/purchase')">
- 买入
- </view>
- </view>
- </view>
- </template>
- <script>
- import { orderData, getUserInfo,service } from '@/api/user.js';
- import { getPackageList, packageReserve, packageExchange } from '@/api/package.js'
- import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
- import { mapState, mapMutations } from 'vuex';
-
- export default {
- computed:{
- ...mapState('user',['userInfo'])
- },
- components: {
- uniLoadMore,
- },
- data() {
- return {
- height: '',
- list: [],
- loadingType: 'more',
- page: 1,
- limit: 10,
- // loaded: false,
- nowTime: '',
- timer: ''
- }
- },
- onReady(res) {
- var obj = this;
- uni.getSystemInfo({
- success: resu => {
- const query = uni.createSelectorQuery();
- query.select('.scoll-wrap').boundingClientRect();
- query.exec(function(res) {
- console.log(res, 'ddddddddddddd');
- obj.height = resu.windowHeight - res[0].top + 'px';
- console.log('打印页面的剩余高度', obj.height);
- });
- },
- fail: res => {}
- });
- },
- onShow() {
- // this.getPackageList()
- console.log(this.userInfo)
- this.loadData()
- this.getUserInfo()
- // this.nowTime = this.getNow()
- clearInterval(this.timer)
- this.timer = setInterval(()=> {
- this.nowTime = this.getNow()
- console.log(this.nowTime)
- },1000)
- // this.nowTime = '10:25'
- },
- onBackPress() {
- console.log('页面隐藏onBackPress')
- clearInterval(this.timer)
- },
- onUnload() {
- console.log('页面隐藏onUnload')
- clearInterval(this.timer)
- },
- onHide() {
- console.log('页面隐藏')
- clearInterval(this.timer)
- },
- methods: {
- ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
- getNow() {
- let myDate = new Date();
- let h = myDate.getHours() > 9 ? myDate.getHours() : ('0' + myDate.getHours()); //获取当前小时数(0-23)
- let m = myDate.getMinutes() > 9 ? myDate.getMinutes() : ('0' + myDate.getMinutes()); //获取当前分钟数(0-59)
- return ('' + h + ':' + m)
- },
- getNextTime() {
- let myDate = new Date();
- // let h = myDate.getHours() > 9 ? myDate.getHours() : ('0' + myDate.getHours()); //获取当前小时数(0-23)
- // let m = myDate.getMinutes() > 9 ? myDate.getMinutes() : ('0' + myDate.getMinutes()); //获取当前分钟数(0-59)
- let H = myDate.getHours()
- let M = myDate.getMinutes()
- let h = ''
- let m = ''
- if(M <= 30) {
- h = (H +1) > 9 ? (H +1) : ('0' + (H +1))
- m = '00'
- }else {
- h = (H +1) > 9 ? (H +1) : ('0' + (H +1))
- m = '30'
- }
- return ('' + h + ':' + m)
- },
- getPackageList() {
- getPackageList().then(res => {
- console.log(res,'getPackageList')
- })
- },
- navTo(url) {
- uni.switchTab({
- url: url
- })
- },
- navto(url) {
- console.log('dianji ')
- uni.navigateTo({
- url: url
- })
- },
- loadData() {
- let obj = this
- if(obj.loadingType == 'noMore' || obj.loadingType == 'loading') {
- return
- }
- obj.loadingType = 'loading'
- getPackageList({
- page: obj.page,
- limit: obj.limit
- }).then(({data}) => {
- // console.log(res,'getPackageList')
- obj.list = obj.list.concat(data)
- console.log(obj.list,'dd')
- obj.page++
- if(obj.limit == data.length) {
- obj.loadingType = 'more'
- }else {
- obj.loadingType = 'noMore'
- }
- })
- },
- // 兑换包
- packageExchange(item,type) {
- let nowTime = this.getNow()
- // if(item.start > nowTime) {
- // return this.$api.msg('活动未开始')
- // }
- // if(item.end < nowTime) {
- // return this.$api.msg('活动已结束')
- // }
- console.log(item)
- // this.judgeBase()
- packageExchange({
- package_manager: item.id,
- type: type,
- price: item.price,
- day: item.day,
- proportion: item.proportion,
- pass: item.pass,
- consume_pass: item.consume_pass
- }).then( res => {
- console.log(res)
- uni.showToast({
- title:'兑换成功',
- duration:2000
- });
- this.getUserInfo()
- }).catch(err => {
- console.log(err)
- })
- },
- //预约包
- packageReserve(item) {
- let nowTime = this.getNow()
- // if(item.start > nowTime) {
- // return this.$api.msg('活动未开始')
- // }
- // if(item.end < nowTime) {
- // return this.$api.msg('活动已结束')
- // }
- packageReserve({
- package_manager: item.id,
- price: item.price,
- day: item.day,
- proportion: item.proportion,
- pass: item.pass
- }).then(res => {
- uni.showToast({
- title:'预约成功',
- duration:2000
- });
- this.getUserInfo()
- console.log(res)
- }).catch(err => {
- console.log(err)
- })
- },
- getUserInfo() {
- getUserInfo({})
- .then(({ data }) => {
- console.log(data)
- this.setUserInfo(data);
- console.log(data)
- })
- .catch(e => {
- console.log(e);
- });
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .top-wrap {
- position: relative;
- .top-bg {
- width: 750rpx;
- height: 100rpx;
- background: linear-gradient(30deg, #FF4C4C, #FE6238);
- border-radius: 0 0 10rpx 10rpx;
- position: absolute;
- top: 0;
- }
- padding-top: 20rpx;
- .user-data {
- width: 710rpx;
- height: 165rpx;
- background: #FFFFFF;
- box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
- border-radius: 20rpx;
- margin: auto;
- position: relative;
- .data {
- display: flex;
- width: 33.3%;
- flex-direction: column;
- justify-content: center;
- align-items: center;
-
- font-family: PingFang SC;
- font-weight: bold;
- color: #666666;
- position: relative;
- .data-val {
- font-size: 36rpx;
- }
- .data-tit {
- font-size: 26rpx;
- padding-top: 10rpx;
- }
- &::after {
- content: '';
- width: 1px;
- height: 36rpx;
- background: #d6d6d6;
- position: absolute;
- right: 0;
- top: 0;
- bottom: 0;
- margin: auto;
- }
- &:last-of-type {
- &::after {
- background: #fff;
- }
- }
- }
- }
- }
- .fwb-logo {
- height: 99rpx;
- display: flex;
- justify-content: space-around;
- align-items: center;
- image {
- width: 374rpx;
- height: 33rpx;
- }
- }
- .buy-item {
- width: 690rpx;
- height: 300rpx;
- margin: 0 auto 20rpx;
- background: #FFFFFF;
- box-shadow: 0px 0px 17rpx 0px rgba(0, 0, 0, 0.05);
- border-radius: 20rpx;
- padding: 26rpx 30rpx;
- position: relative;
- .item-top {
- display: flex;
- justify-content: space-between;
- height: 50rpx;
- .top-left {
- font-size: 34rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #0F253A;
- line-height: 50rpx;
- display: flex;
- align-items: center;
- image {
- width: 48rpx;
- height: 46rpx;
- }
- .top-name {
- width: 450rpx;
- padding-left: 11rpx;
- }
- }
- .top-right {
- line-height: 50rpx;
- width: 100rpx;
- text-align: right;
- font-size: 26rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #6D7C88;
- }
- }
- .item-info {
- width: 100%;
- margin-top: 28rpx;
- line-height: 50rpx;
- font-size: 26rpx;
- font-family: PingFang SC;
- display: flex;
- flex-wrap: wrap;
- .info-data {
- width: 50%;
- display: flex;
- .info-tit {
-
- font-weight: 500;
- color: #6D7C88;
- }
- .info-val {
- color: #0F253A;
- font-weight: bold;
- }
- }
-
- }
- .mc-btn {
- width: 144rpx;
- line-height: 50rpx;
- border-radius: 25px;
- background: #FFFFFF;
- font-size: 26rpx;
- font-family: PingFang SC;
- font-weight: 500;
- text-align: center;
- position: absolute;
- bottom: 25rpx;
- color: #999999;
- border: 2px solid #EBEBEB;
- }
- .yy {
- // right: 344rpx;
- right: 190rpx;
- }
- .pass {
- right: 190rpx;
- }
- .fail {
- right: 36rpx;
- }
- .could{
- color: #FF4C4C;
- border: 2px solid #FF4C4C;
- }
- .cant {
- color: #999999;
- border: 2px solid #EBEBEB;
- }
- }
- .scoll-wrap {
- padding-bottom: 120rpx;
- }
- .btm-btn {
- height: 100rpx;
- position: fixed;
- bottom: 0;
- .btm-left {
- flex-direction: column;
- justify-content: center;
- align-items: center;
- height: 100rpx;
- width: 136rpx;
- background-color: #fff;
- image {
- width: 48rpx;
- height: 48rpx;
- background-color: #fff;
- }
- }
- .btm-right {
- width: 307rpx;
- height: 100rpx;
- background: #FFB238;
- text-align: center;
- color: #fff;
- font-size: 34rpx;
- font-family: PingFang SC;
- font-weight: bold;
- line-height: 100rpx;
- }
- }
- </style>
|