123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251 |
- <template>
- <view class="activity">
- <u-navbar leftIconSize="0" :placeholder="true" bgColor="#ffffff">
- <view slot="left" style="font-size: 32rpx;">免费抽奖</view>
- </u-navbar>
- <view class="status">
- <u-tabs @change="changeTab" :scrollable="false" :list="statusArr" lineWidth="30" lineHeight="3"
- lineColor="#E96737" :activeStyle="{
- color: '#E96737',
- transform: 'scale(1)',
- width: '150rpx',
-
- }" :inactiveStyle="{
- color: '#999999',
- transform: 'scale(1)',
- width: '150rpx'
- }" itemStyle="padding-left: 11px; padding-right: 11px; height: 44px;text-align: center; ">
- </u-tabs>
- </view>
- <view class="list">
- <view v-for="(item,index) in list" :key="index" class="list-view">
- <view class="list-view-slot">
- <view @click="toRecord(item)">
- <view>
- <image :src="item.picUrl" mode="" class="list-view-slot-img"></image>
- </view>
- <view class="list-view-slot-bor">
- <view class="list-view-slot-bor-title">
- <view class="time bor-title">{{item.title}}</view>
- <view v-if="item.status.value == 2" class="time">
- 开始时间:{{ $parseTime(item.startTime, '{y}-{m}-{d} {h}:{i}:{s}')}}</view>
- <view v-else class="time">开奖时间:{{ $parseTime(item.endTime, '{y}-{m}-{d} {h}:{i}:{s}')}}
- </view>
- </view>
- <view class="details">
- <button class="details-button" v-if="item.status.value == 3">查看详情</button>
- <button class="details-buttonTwo" v-else-if="item.isHit == 0">未中奖</button>
- <button class="details-button" v-else-if="item.isHit == 1">已中奖</button>
- <button class="details-buttonTwo" v-else>即将开始</button>
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class="flex empty" v-if="!list.length && !loading">
- <view class="center">
- <image class="center-img" src="../../static/activity/null.png" mode=""></image>
- <view class="center-font">新的活动正在准备中...</view>
- </view>
- <!-- <u-empty text="活动为空" mode="order" /> -->
- </view>
- </view>
- <custom-tab-bar :activeValue="'activity'" />
- </view>
- </template>
- <script>
- import env from '../../config/env.js'
- import $http from '@/utils/request.js'
- export default {
- data() {
- return {
- list: [],
- statusArr: [{
- name: '参与抽奖'
- }, {
- name: '已开奖',
- }, {
- disabled: true
- }, {
- disabled: true
- }, {
- disabled: true
- }],
- triggerStatus: 0,
- }
- },
- onLoad(opthios) {
- if (opthios.triggerStatus) {
- this.triggerStatus = opthios.triggerStatus
- }
- },
- onShow() {
- this.pageList()
- },
- methods: {
- toRecord(item) {
- if (!uni.getStorageSync('token')) {
- uni.navigateTo({
- url: '/pages/login/index'
- })
- return
- }
- uni.navigateTo({
- url: item.status.value == 4 ? `/packageOperate/activity/record?id=${ item.id }` :
- `/packageOperate/activity/index?id=${ item.id }`
- })
- },
- changeTab(e) {
- if (e.index == 0) {
- this.triggerStatus = 0
- } else if (e.index == 1) {
- this.triggerStatus = 1
- }
- this.pageList()
- },
- pageList() {
- this.list = []
- this.getList()
- },
- getList() {
- uni.showLoading({
- title: '加载中'
- });
- this.loading = true
- $http.post(`/api/v1/mp/user/marketing/list?pageNum=1&pageSize=30`, {
- triggerStatus: this.triggerStatus,
- }).then(res => {
- uni.hideLoading();
- this.loading = false
- if (res.code == 0) {
- res.rows.forEach(item => {
- let picUrlArr = item.picUrl.split(',')
- item.picUrl = env.filePublic + picUrlArr[0] + '?imageView2/2/w/750'
- item.status = JSON.parse(item.status)
- })
- this.total = res.total
- this.list = this.list.concat(res.rows)
- }
- }).catch(() => {
- uni.hideLoading();
- this.loading = false
- })
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .activity {
- width: 100%;
- height: 100%;
- // 设置ios刘海屏底部横线安全区域
- padding-bottom: constant(safe-area-inset-bottom);
- padding-bottom: env(safe-area-inset-bottom);
- }
- .status {
- width: 100%;
- position: fixed;
- z-index: 100;
- background-color: #FFFFFF;
- box-shadow: 0 5rpx 5rpx #ececec;
- }
- .list {
- padding: 120rpx 20rpx 100rpx;
- &-view {
- text-align: center;
- height: 530rpx;
- &-slot {
- background-color: #FFFFFF;
- // margin-bottom: 20rpx;
- border-radius: 22rpx;
- &-img {
- width: 100%;
- height: 370rpx;
- border-radius: 22rpx 22rpx 0 0;
- }
- &-bor {
- line-height: 50rpx;
- width: 700rpx;
- height: 120rpx;
- margin: 0 auto;
- padding: 10rpx 20rpx 0 20rpx;
- border-radius: 0 0 22rpx 22rpx;
- &-title {
- text-align: left;
- float: left;
- .time {
- color: #333333;
- }
- .bor-title {
- font-size: 34rpx;
- }
- }
- .details {
- float: right;
- .details-button {
- width: 200rpx;
- height: 72rpx;
- line-height: 72rpx;
- background-color: #F9822C;
- color: #fff;
- margin-top: 18rpx;
- font-size: 30rpx;
- border-radius: 36rpx;
- }
- .details-buttonTwo {
- width: 200rpx;
- height: 72rpx;
- line-height: 72rpx;
- background-color: #BBBBBB;
- color: #fff;
- margin-top: 18rpx;
- font-size: 30rpx;
- border-radius: 36rpx;
- }
- }
- }
- }
- }
- }
- .empty {
- height: 60vh;
- .center {
- text-align: center;
- &-img {
- width: 228rpx;
- height: 320rpx;
- }
- &-font {
- font-size: 30rpx;
- font-weight: 400;
- color: #999999;
- margin-bottom: 250rpx;
- }
- }
- }
- </style>
|