parent
987e90f80a
commit
a89d014836
|
@ -1,5 +1,12 @@
|
||||||
import request from "@/utils/request.js";
|
import request from "@/utils/request.js";
|
||||||
|
|
||||||
|
// 获得当前秒杀活动
|
||||||
|
export function getNowSeckillActivity(id) {
|
||||||
|
return request.get("app-api/promotion/seckill-activity/get-now", {}, {
|
||||||
|
noAuth: true // TODO 芋艿:后续要做调整
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// 获得秒杀活动明细
|
// 获得秒杀活动明细
|
||||||
export function getSeckillActivity(id) {
|
export function getSeckillActivity(id) {
|
||||||
return request.get("app-api/promotion/seckill-activity/get-detail", {
|
return request.get("app-api/promotion/seckill-activity/get-detail", {
|
||||||
|
|
|
@ -9,34 +9,34 @@
|
||||||
<view class="lines"></view>
|
<view class="lines"></view>
|
||||||
<view class="point">{{point}} 场</view>
|
<view class="point">{{point}} 场</view>
|
||||||
<countDown :is-day="false" :tip-text="' '" :day-text="' '" :hour-text="' : '" :minute-text="' : '" :second-text="' '"
|
<countDown :is-day="false" :tip-text="' '" :day-text="' '" :hour-text="' : '" :minute-text="' : '" :second-text="' '"
|
||||||
:datatime="datatime" :is-col="true" :bgColor="bgColor"></countDown>
|
:datatime="datatime" :is-col="true" :bgColor="bgColor" />
|
||||||
</view>
|
</view>
|
||||||
<navigator url="/pages/activity/goods_seckill/index" hover-class="none" class="more acea-row row-center-wrapper">GO<text class="iconfont icon-xiangyou"></text></navigator>
|
<navigator url="/pages/activity/goods_seckill/index" hover-class="none" class="more acea-row row-center-wrapper">
|
||||||
|
GO<text class="iconfont icon-xiangyou"></text>
|
||||||
|
</navigator>
|
||||||
</view>
|
</view>
|
||||||
<view class="conter">
|
<view class="conter">
|
||||||
<scroll-view scroll-x="true" style="white-space: nowrap; vertical-align: middle;" show-scrollbar="false">
|
<scroll-view scroll-x="true" style="white-space: nowrap; vertical-align: middle;" show-scrollbar="false">
|
||||||
<view class="itemCon" v-for="(item, index) in spikeList" :key="index" @click="goDetail(item)">
|
<view class="itemCon" v-for="(item, index) in spikeList" :key="index" @click="goDetail(item)">
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<view class="pictrue">
|
<view class="pictrue">
|
||||||
<image :src="item.image"></image>
|
<image :src="item.picUrl"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="name line1">{{item.title}}</view>
|
<view class="name line1">{{ item.name }}</view>
|
||||||
<view class="x_money line1">¥<text class="num">{{item.price}}</text></view>
|
<view class="x_money line1">¥<text class="num">{{ fen2yuan(item.seckillPrice ) }}</text></view>
|
||||||
<view class="y_money line1">¥{{item.otPrice}}</view>
|
<view class="y_money line1">¥{{ fen2yuan(item.marketPrice) }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
let app = getApp();
|
let app = getApp();
|
||||||
import countDown from "@/components/countDown";
|
import countDown from "@/components/countDown";
|
||||||
import {
|
import * as SeckillApi from '@/api/promotion/seckill.js';
|
||||||
getSeckillIndexApi
|
import * as Util from '@/utils/util.js';
|
||||||
} from '@/api/activity.js';
|
export default {
|
||||||
export default {
|
|
||||||
name: 'a_seckill',
|
name: 'a_seckill',
|
||||||
components: {
|
components: {
|
||||||
countDown
|
countDown
|
||||||
|
@ -50,33 +50,39 @@
|
||||||
'timeTxtwidth': '16rpx',
|
'timeTxtwidth': '16rpx',
|
||||||
'isDay': true
|
'isDay': true
|
||||||
},
|
},
|
||||||
spikeList: [], // 秒杀
|
spikeList: [], // 秒杀活动数组
|
||||||
point: '',
|
point: '', // 秒杀开始时间
|
||||||
datatime: 0,
|
datatime: 0 // 秒杀剩余结束时间
|
||||||
status: 0
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getSeckillIndexTime();
|
SeckillApi.getNowSeckillActivity().then(res => {
|
||||||
|
// 如果为空,说明没有活动
|
||||||
|
const config = res.data.config;
|
||||||
|
if (!config) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.spikeList = res.data.activities;
|
||||||
|
this.point = config.startTime;
|
||||||
|
// 计算结束时间
|
||||||
|
const now = new Date();
|
||||||
|
this.datatime = new Date(now.getFullYear() + '-' + (now.getMonth() + 1) + '-' + now.getDate()
|
||||||
|
+ ' ' + config.endTime).getTime() / 1000;
|
||||||
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getSeckillIndexTime() {
|
|
||||||
getSeckillIndexApi().then(({data}) => {
|
|
||||||
this.spikeList = data ? data.productList : [];
|
|
||||||
this.point = data ? data.secKillResponse.time.split(',')[0] : '';
|
|
||||||
this.datatime = data ? parseFloat(data.secKillResponse.timeSwap) : '';
|
|
||||||
this.status = data ? data.secKillResponse.status : 0;
|
|
||||||
})
|
|
||||||
},
|
|
||||||
goDetail(item){
|
goDetail(item){
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/activity/goods_seckill_details/index?id=' + item.id
|
url: '/pages/activity/goods_seckill_details/index?id=' + item.id
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
|
|
||||||
|
fen2yuan(price) {
|
||||||
|
return Util.fen2yuan(price)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.default{
|
.default{
|
||||||
width: 690rpx;
|
width: 690rpx;
|
||||||
|
@ -187,7 +193,7 @@
|
||||||
color: #999999;
|
color: #999999;
|
||||||
text-decoration: line-through;
|
text-decoration: line-through;
|
||||||
}
|
}
|
||||||
|
|
||||||
.x_money {
|
.x_money {
|
||||||
color: #FD502F;
|
color: #FD502F;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
|
|
Loading…
Reference in New Issue