You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
yanzong_qianduan/pages/activity/presale.vue

284 lines
6.6 KiB

<template>
<view class="presale">
11 months ago
<view class="presale-hd">
9 months ago
<view class="rule" @click="openPage()">规则</view>
</view>
11 months ago
<view class="presale-bd">
<view class="tab">
<u-tabs :list="menuList" :is-scroll="true" :show-bar="false" active-color="#FFFFFF"
bg-color="rgba(255,255,255,0)" inactive-color="rgba(255,255,255,0.62)" v-model="current"
@change='onChosed'></u-tabs>
11 months ago
</view>
<view class="title">
10 months ago
<image :src="$picUrl+'/static/news/newPresale-1.png'"></image>
11 months ago
正在进行中
10 months ago
<image :src="$picUrl+'/static/news/newPresale-1.png'"></image>
11 months ago
</view>
<view class="list" :isLoading="isLoading">
10 months ago
<view class="item" v-for="(item,index) in goodList" :key="index" @click="goPre(item)">
<image class="pic" :src="item.image" mode="widthFix"></image>
11 months ago
<view class="info">
<view class="t">{{item.goods_name}}</view>
<view class="d">
9 months ago
<u-count-down :timestamp="item.end_time*1000" format="HH:mm:ss"></u-count-down>
<text>后失效</text>
</view>
11 months ago
<view class="p">
10 months ago
<image :src="$picUrl+'/static/news/newPresale-2.png'"></image>
9 months ago
<view class="s">预约价¥{{item.goods_price_min?Number(item.goods_price_min):''}}</view>
10 months ago
<view class="n">去预约</view>
11 months ago
</view>
</view>
</view>
</view>
</view>
9 months ago
<view style="margin-top: 250rpx;" v-if="goodList.length==0">
<u-empty text="暂无信息" mode="list">
</u-empty>
</view>
</view>
</template>
<script>
import * as Api from '@/api/activity'
export default {
data() {
11 months ago
return {
10 months ago
timestamp: '',
current: 0,
isLoading: true,
goodList: [],
menuList: [],
10 months ago
info: ''
}
},
/**
* 生命周期函数--监听页面显示
*/
onShow(options) {
this.getListCharts()
},
methods: {
10 months ago
goPre(item) {
uni.navigateTo({
9 months ago
url: '/pages/goods/detail?goodsId=' + item.goods_id + '&isPre=' + true + '&pre_id=' + this.info
.id + '&isBuy=' + this.info.end_time
10 months ago
})
},
openPage() {
uni.navigateTo({
url: '/pages/activity/presaleRule?type=5'
})
10 months ago
},
getListgoodData(categoryId) {
let app = this;
let pamars = {
9 months ago
category_id: categoryId?categoryId:"",
}
10 months ago
Api.presaleGoodsList(pamars)
.then(result => {
9 months ago
app.goodList = result.data.list ||[];
})
.finally(() => app.isLoading = false)
},
onChosed(index) {
let app = this;
app.current = index;
10 months ago
app.getListgoodData(app.menuList[index].category_id)
},
10 months ago
beginTime(end) {
const now = new Date();
const year = now.getFullYear();
const month = now.getMonth() + 1;
const day = now.getDate();
const hour = now.getHours();
const minute = now.getMinutes();
const second = now.getSeconds();
9 months ago
let start = year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second
return (Date.parse(end.replace(/-/g, '/')) - Date.parse(start.replace(/-/g, '/')))
10 months ago
},
// 分类
getListCharts() {
let app = this
app.menuList = []
let pamars = {
}
10 months ago
Api.presaleCateList(pamars)
.then(result => {
10 months ago
app.timestamp = this.beginTime(result.data.info.p_time);
app.info = result.data.info
10 months ago
app.menuList = result.data.category;
9 months ago
if(result.data.category && result.data.category.length > 0) {
app.getListgoodData(result.data.category[0].category_id)
}else{
app.getListgoodData()
}
})
.finally(() => app.isLoading = false)
},
goDetail(orderId) {
11 months ago
uni.navigateTo({
10 months ago
url: '/pages/goods/detail?goodsId=' + orderId
11 months ago
})
11 months ago
},
goDetailMore(categoryId, name) {
11 months ago
uni.navigateTo({
url: '/pages/activity/charts?categoryId=' + categoryId + '&name=' + name
11 months ago
})
},
}
}
</script>
<style lang="scss" scoped>
.presale {
9 months ago
background: #ff7b79 url(https://www.royaum.com.cn/static/news/newPresale-bg.png) center top no-repeat;
background-size: 100% auto;
overflow: hidden;
min-height: 100vh;
&-hd {
position: relative;
height: 380rpx;
.rule {
9 months ago
right: 0;
top: 74rpx;
z-index: 999;
width: 100rpx;
height: 60rpx;
9 months ago
background-color: rgba(0, 0, 0, 0.3);
font-size: 24rpx;
font-weight: 400;
color: #FFFFFF;
line-height: 60rpx;
text-align: center;
position: absolute;
9 months ago
border-radius: 50rpx 0 0 50rpx;
11 months ago
}
}
&-bd {
width: 678rpx;
margin: 0 auto;
padding-bottom: 30rpx;
margin-top: 20rpx;
.title {
width: 100%;
border-radius: 12rpx 12rpx 0 0;
height: 78rpx;
font-size: 28rpx;
font-weight: 500;
color: #FFFFFF;
border: 2px solid #fff;
11 months ago
display: flex;
align-items: center;
justify-content: center;
image {
width: 32rpx;
height: 13rpx;
margin: 0 20rpx;
11 months ago
}
}
.list {
background-color: #fff;
border-radius: 0 0 12rpx 12rpx;
overflow: hidden;
.item {
10 months ago
padding: 45rpx 40rpx 45rpx 30rpx;
overflow: hidden;
border-top: 1px solid #F1F1F1;
&:first-child {
border-top-color: #fff;
11 months ago
}
display: flex;
image {
width: 220rpx;
height: 220rpx;
10 months ago
margin-right: 30rpx;
11 months ago
}
.info {
flex: 1;
max-width: 400rpx;
.t {
height: 80rpx;
line-height: 40rpx;
font-size: 32rpx;
font-weight: 500;
color: #626262;
word-break: break-all;
text-overflow: ellipsis;
overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
11 months ago
}
.d {
display: flex;
align-items: center;
10 months ago
height: 44rpx;
font-size: 32rpx;
font-weight: 500;
color: #F94021;
text {
color: #9E9E9E;
10 months ago
margin-left: 15rpx;
}
11 months ago
}
.p {
width: 396rpx;
height: 88rpx;
position: relative;
image {
width: 396rpx;
height: 88rpx;
}
.s {
width: 240rpx;
line-height: 88rpx;
position: absolute;
text-align: center;
left: 0;
top: 0;
z-index: 2;
font-size: 32rpx;
font-weight: 500;
color: #FF584D;
}
.n {
width: 150rpx;
line-height: 88rpx;
text-align: center;
position: absolute;
right: 0;
top: 0;
z-index: 2;
font-size: 32rpx;
font-weight: 500;
color: #FFFFFF;
}
11 months ago
}
}
}
}
}
}
9 months ago
</style>