| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631 |
- <template>
- <view class="center">
- <!-- 顶部logo and 搜索 start-->
- <view class="status_bar"></view>
- <view class="top-search flex">
- <view class="top-logo">
- <image src="../../static/icon/logo.png" mode="widthFix"></image>
- </view>
- <view class="search-box flex" @click="clickSearch()">
- <image class="search" src="../../static/icon/search-h.png" mode=""></image>
- <view class="search-font">输入关键词搜索</view>
- </view>
- </view>
- <!-- 顶部logo and 搜索 end-->
- <view class="jg"></view>
- <!-- 轮播图 start -->
- <swiper class="top-swiper" autoplay="true" duration="400" interval="5000" @change="swiperChange">
- <swiper-item v-for="(item, index) in carouselList" :key="index" class="carousel-item"
- @click="bannerNavToUrl(item)">
- <image :src="item.pic" />
- </swiper-item>
- </swiper>
- <!-- 轮播图 end -->
- <view class="swiper-btm flex">
- <view class="btm-item flex">
- <image src="../../static/icon/index-gou.png" mode=""></image>
- <view class="">自用购物返利</view>
- </view>
- <view class="btm-item flex">
- <image src="../../static/icon/index-gou.png" mode=""></image>
- <view class="">分享好友赚钱</view>
- </view>
- <view class="btm-item flex">
- <image src="../../static/icon/index-gou.png" mode=""></image>
- <view class="">超值正品优惠</view>
- </view>
- </view>
- <!-- 预约 start-->
- <view class="yuyue-wrap">
- <view class="yuyue-top flex">
- <image src="../../static/img/yuyue-top.png" mode="heightFix"></image>
- </view>
- <view class="yuyue-item" v-for="item in changCiList">
- <view class="item-top">
- <image src="../../static/img/yuyue.png" mode=""></image>
- <view class="item-top-info flex">
- <view class="">
- {{item.name}}<text>/大家都在买</text>
- </view>
- <view class="goto">
- GO>
- </view>
- </view>
- </view>
- <view class="item-info flex">
- <view class="item-img">
- <image :src="item.image" mode=""></image>
- </view>
- <view class="item-val flex">
- <view class="item-status">
- {{!item.djs.over ? '距离预约结束': (!item.jcdjs.over?'距离开始进场':(!item.jsdjs.over?'活动进行中': '活动已结束'))}}
- </view>
- <view class="item-djs">
- <!-- 预约倒计时 -->
- <uni-countdown v-if="!item.djs.over" color="#C6914E" background-color="#F6EFDF"
- :show-day="false" :day="item.djs.day" :hour="item.djs.hours" :minute="item.djs.minutes"
- :second="item.djs.seconds"></uni-countdown>
- <!-- 进场倒计时 -->
- <uni-countdown v-if="item.djs.over && !item.jcdjs.over" color="#C6914E" background-color="#F6EFDF"
- :show-day="false" :day="item.jcdjs.day" :hour="item.jcdjs.hours" :minute="item.jcdjs.minutes"
- :second="item.jcdjs.seconds"></uni-countdown>
- <!-- 场次结束倒计时 -->
- <uni-countdown v-if="item.jcdjs.over && !item.jsdjs.over" color="#C6914E" background-color="#F6EFDF"
- :show-day="false" :day="item.jsdjs.day" :hour="item.jsdjs.hours" :minute="item.jsdjs.minutes"
- :second="item.jsdjs.seconds"></uni-countdown>
- <!-- 第二天倒计时 -->
- <uni-countdown v-if="item.jsdjs.over" color="#C6914E" background-color="#F6EFDF"
- :show-day="false" :day="item.xcdjs.day" :hour="item.xcdjs.hours" :minute="item.xcdjs.minutes"
- :second="item.xcdjs.seconds"></uni-countdown>
- <!-- <view class="" v-if="item.jsdjs.over" style="color: #dc262b;">
- 活动已结束
- </view> -->
- </view>
- <view class="item-base">
- 开始时间 {{item.radd_time}} 结束时间 {{item.rend_time }}
- </view>
- <view class="item-btn" @click="yuyue(item)"
- :class="{'yuyue': item.sta == 1,'jcf': item.sta == 2 && !item.jsdjs.over }">
- <!-- {{item.sta == 2 ? '立即进场': (item.djs.over ? '已结束': '立即预约')}} -->
- <!-- {{item.sta == 2 ? '立即进场' : '立即预约'}} -->
- {{item.str}}
- </view>
- </view>
- </view>
- </view>
- </view>
- <!-- 预约 end-->
- <!-- 预约弹窗 start-->
- <uni-popup ref="popupyy" type="bottom">
- <view class="popupyy-wrap">
- <view class="popupyy-top">
- 预约活动
- </view>
- <view class="popupyy-tit">
- 本次预约冻结广告值
- </view>
- <view class="popupyy-val">
- {{ yuyueInfo.advert }}
- </view>
- <view class="" style="margin-top: 50rpx;">
- 消费积分不低于{{yuyueInfo.lowest }}
- </view>
- <view class="" style="color: #FF4C4C;margin-top: 15rpx;">
- 广告值不低于{{yuyueInfo.minimum }}
- </view>
- <view class="popupyy-btn" @click="yuyueOk()">
- 确认预约
- </view>
- </view>
- </uni-popup>
- <!-- 预约弹窗 end-->
- <!-- 预约成功弹窗 start-->
- <uni-popup ref="popupyyok" type="center">
- <view class="popupyyok-wrap">
- <image src="../../static/img/yuyueok.png" mode="widthFix"></image>
- <view class="" style="font-size: 35rpx;font-weight: bold;color: #333333;">
- 预约成功!
- </view>
- <view class="" style="padding: 20rpx 80rpx;color: #999999;font-size: 26rpx;">
- 恭喜您预约活动成功,请您调好闹钟,准时参与!
- </view>
- <view class="btn" @click="$refs.popupyyok.close()">
- 确定
- </view>
- </view>
- </uni-popup>
- </view>
- </template>
- <script>
- import {
- timeComputed
- } from '@/utils/rocessor.js'
- import {
- tabbar1
- } from '@/utils/tabbar.js';
- import {
- loadIndexs,
- getChangCi,
- subscribe,
- advance
- } from '@/api/index.js';
- import uniCountdown from '@/components/uni-countdown/uni-countdown.vue';
- import {
- mapState,
- mapMutations
- } from 'vuex';
- export default {
- components: {
- uniCountdown
- },
- data() {
- return {
- current: 0,
- tabbar: tabbar1,
- titleNViewBackground: '',
- swiperCurrent: 0,
- swiperLength: 0,
- dataList: '',
- carouselList: [], //轮播图列表
- changCiList: [],
- yuyueInfo: {},
- loadingType: 'more'
- };
- },
- onLoad() {
- this.loadData();
- },
- onShow() {
- this.changCiList = []
- this.getChangCi()
- },
- onHide() {
- this.changCiList = []
- },
- computed: {
- ...mapState('user', ['userInfo'])
- },
- methods: {
- loadData() {
- loadIndexs({})
- .then(({
- data
- }) => {
- let goods = data.info;
- this.dataList = goods.bastList; //精品推荐
- this.carouselList = data.banner;
- })
- .catch(e => {});
- },
- goDetails(e) {
- console.log(e, '123456');
- uni.navigateTo({
- url: '/pages/index/messageInfo'
- });
- },
- nav(url) {
- uni.navigateTo({
- url,
- fail() {
- uni.switchTab({
- url
- });
- }
- });
- },
- //轮播图切换修改背景色
- swiperChange(e) {
- const index = e.detail.current;
- this.swiperCurrent = index;
- this.titleNViewBackground = this.carouselList[index].background;
- },
- // 點擊搜索框
- clickSearch() {
- uni.navigateTo({
- url: '/pages/product/search'
- });
- },
- //详情页
- navToDetailPage(item) {
- let id = item.id;
- uni.navigateTo({
- url: '/pages/product/product?id=' + id
- });
- },
- // 打开预约弹窗
- yuyue(item) {
- if (item.sta == 2) {
- // 进场
- advance({
- id: item.id
- }).then(res => {
- console.log(res)
- uni.navigateTo({
- url: '/pages/index/yuyuechang?id=' + item.id
- })
- })
- } else {
- this.yuyueInfo = item
- this.$refs.popupyy.open()
- }
- },
- // 确定预约
- yuyueOk() {
- let obj = this
- // 判断广告值
- if (obj.yuyueInfo.minimum * 1 > obj.userInfo.aid_val * 1) {
- return obj.$api.msg('您当前广告值不足')
- }
- // 判断消费账户
- if (obj.yuyueInfo.lowest * 1 > obj.userInfo.now_money * 1) {
- return obj.$api.msg('您当前消费账户不足')
- }
- subscribe({
- id: obj.yuyueInfo.id
- }).then(res => {
- console.log(res, '确定预约')
- // yuyueInfo
- let s = obj.changCiList.indexOf(obj.yuyueInfo);
- obj.changCiList[s].sta = 2;
- obj.changCiList[s].str = '进入'
- obj.$refs.popupyy.close()
- obj.$refs.popupyyok.open()
- })
- },
- // 获取场次信息
- getChangCi() {
- let obj = this
- getChangCi({
- page: 1,
- limit: 100
- }).then(res => {
- console.log(res, '获取场次信息')
- let arr = res.data.map(e => {
- // 预约倒计时
- e.djs = timeComputed(e.time)
- // 进场倒计时
- e.jcdjs = timeComputed(e.time + 1800)
- // 场次结束倒计时
- e.jsdjs = timeComputed(e.e_time)
- // 第二天预约倒计时
- e.xcdjs = timeComputed(e.time + 86400)
- return e
- })
- console.log(arr)
- obj.changCiList = arr.reverse()
- })
- }
- }
- };
- </script>
- <style lang="scss">
- page,
- .center {
- min-height: 100%;
- height: auto;
- background: #ededed;
- }
- // 顶部搜索
- .top-search {
- height: 80rpx;
- padding: 0 20rpx;
- background-color: #fff;
- .top-logo {
- width: 50rpx;
- // height: 50rpx;
- margin-right: 10rpx;
- image {
- width: 48rpx;
- }
- }
- .search-box {
- justify-content: center;
- width: 698rpx;
- height: 60rpx;
- background: #EEEEEE;
- // box-shadow: 0px 10rpx 20rpx 0px rgba(4, 114, 69, 0.22);
- border-radius: 30rpx;
- .search {
- width: 34rpx;
- height: 34rpx;
- }
- .search-font {
- margin-left: 14rpx;
- font-size: 28rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #CBCBCB;
- }
- }
- }
- // 顶部轮播图
- .top-swiper {
- width: 750rpx;
- height: 360rpx;
- // margin: 20rpx 0 0;
- image {
- width: 750rpx;
- height: 360rpx;
- }
- }
- .swiper-btm {
- height: 60rpx;
- width: 750rpx;
- background-color: #fff;
- margin-bottom: 20rpx;
- font-size: 21rpx;
- font-weight: 500;
- color: #333333;
- .btm-item {
- flex-grow: 1;
- justify-content: center;
- image {
- width: 25rpx;
- height: 25rpx;
- margin-right: 14rpx;
- }
- }
- }
- .jg {
- height: 20rpx;
- background-color: #fff;
- }
- .yuyue-wrap {
- background-color: #fff;
- .yuyue-top {
- height: 117rpx;
- justify-content: center;
- image {
- display: inline-block;
- height: 31rpx;
- margin: auto;
- }
- }
- .yuyue-item {
- width: 690rpx;
- margin: auto;
- .item-top {
- width: 690rpx;
- height: 80rpx;
- border-radius: 18rpx;
- // background-color: #bfa;
- position: relative;
- image {
- width: 690rpx;
- height: 80rpx;
- // position: relative;
- }
- .item-top-info {
- width: 690rpx;
- height: 80rpx;
- position: absolute;
- top: 0;
- left: 0;
- font-size: 33rpx;
- font-weight: bold;
- color: #C6914E;
- padding-left: 35rpx;
- padding-right: 25rpx;
- text {
- font-size: 22rpx;
- font-weight: 500;
- color: #C6914E;
- }
- .goto {
- width: 60rpx;
- line-height: 26rpx;
- background: #C6914E;
- border-radius: 12rpx;
- font-size: 18rpx;
- font-weight: 500;
- color: #FFFFFF;
- text-align: center;
- }
- }
- }
- .item-info {
- width: 690rpx;
- height: 252rpx;
- margin-top: -20rpx;
- background: #FFFFFF;
- box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
- border-radius: 0px 0px 20rpx 20rpx;
- padding: 0 25rpx;
- margin-bottom: 20rpx;
- .item-img {
- width: 134rpx;
- height: 133rpx;
- background-color: #999;
- flex-shrink: 0;
- image {
- width: 134rpx;
- height: 133rpx;
- }
- }
- .item-val {
- flex-grow: 1;
- height: 100%;
- // background-color: #009688;
- position: relative;
- flex-direction: column;
- align-items: flex-start;
- padding-left: 25rpx;
- justify-content: center;
- .item-djs {
- margin: 20rpx 0;
- height: 42rpx;
- }
- .item-status {
- font-size: 26rpx;
- font-weight: bold;
- color: #333333;
- }
- .item-base {
- font-size: 25rpx;
- font-weight: 500;
- color: #666666;
- }
- .item-btn {
- width: 159rpx;
- height: 59rpx;
- line-height: 59rpx;
- background: #CCCCCC;
- border-radius: 10rpx;
- position: absolute;
- right: 0;
- top: 0;
- bottom: 0;
- margin: auto;
- text-align: center;
- }
- .yuyue {
- background-color: #303030;
- color: #F8DABA;
- }
- .jcf {
- background-color: #f42b4e;
- color: #fff;
- }
- }
- }
- }
- }
- .popupyy-wrap {
- width: 750rpx;
- height: 745rpx;
- background: #FFFFFF;
- border-radius: 20rpx 20rpx 0px 0px;
- text-align: center;
- font-size: 32rpx;
- color: #999999;
- font-weight: 500;
- padding-top: 60rpx;
- .popupyy-top {
- font-size: 36rpx;
- font-weight: 500;
- color: #333333;
- position: relative;
- &::before {
- content: '';
- width: 138rpx;
- height: 1rpx;
- background: #CBCBCB;
- position: absolute;
- top: 0;
- bottom: 0;
- left: 124rpx;
- margin: auto;
- }
- &::after {
- content: '';
- width: 138rpx;
- height: 1rpx;
- background: #CBCBCB;
- position: absolute;
- top: 0;
- bottom: 0;
- right: 124rpx;
- margin: auto;
- }
- }
- .popupyy-tit {
- font-size: 32rpx;
- font-weight: 500;
- color: #999999;
- margin-top: 70rpx;
- }
- .popupyy-val {
- font-size: 67rpx;
- font-weight: bold;
- color: #333333;
- margin-top: 60rpx;
- }
- .popupyy-btn {
- width: 680rpx;
- line-height: 100rpx;
- background: #303030;
- border-radius: 10rpx;
- font-size: 34rpx;
- font-weight: 500;
- color: #F8DABA;
- margin: 20rpx auto 0;
- }
- }
- .popupyyok-wrap {
- height: 707rpx;
- width: 551rpx;
- background-color: #fff;
- border-radius: 20rpx;
- text-align: center;
- image {
- width: 100%;
- }
- .btn {
- width: 295rpx;
- line-height: 69rpx;
- border-radius: 34rpx;
- background: #303030;
- color: #F8DABA;
- font-size: 35rpx;
- color: #F8DABA;
- margin: auto;
- }
- }
- .status_bar {
- height: var(--status-bar-height);
- width: 100%;
- background: #fff;
- }
- </style>
|