| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227 |
- <template>
- <view v-if="spikeList.length > 0" class="skeleton-rect" :style="'margin-top:'+mbConfig+'rpx'">
- <view class="seckill-count" :class="'wrapper-count'+styleType" :style="'background:'+bgColor+';border-radius:'+bgStyle+'rpx'">
- <view class="spike-bd">
- <view class="acea-row row-middle">
- <image class="title-img" src="/static/images/spike_title.png"></image>
- <view class="spike-distance">
- <text :style="'background-color:'+countDownColor" class="text bg-red">距结束</text>
- <countDown :is-day="false" :tip-text="' '" :day-text="' '" :hour-text="':'" :minute-text="':'" :second-text="' '" :datatime="datatime" :colors="themeColor" @getProduct="getProduct"></countDown>
- </view>
- </view>
- <navigator v-if="!merId" url="/pages/activity/goods_seckill/index" class="more-btn" hover-class="none">
- 更多惊喜
- <text class="iconfont icon-jiantou" hover-class="none"></text>
- </navigator>
- </view>
- <view class="spike-wrapper" :class="'wrapper'+styleType">
- <scroll-view v-if="styleType != 2" :class="'colum'+styleType" :scroll-x="styleType == 0 ? true : false" show-scrollbar="false">
- <navigator
- class="spike-item"
- v-for="(item, index) in spikeList"
- :key="index"
- :url="'/pages/activity/goods_seckill_details/index?id=' + item.product_id + '&time=' + item.stop + ''"
- hover-class="none">
- <view class="img-box" :class="'img-box'+conStyle">
- <easy-loadimage mode="widthFix" :image-src="item.image"></easy-loadimage>
- </view>
- <view class="info">
- <view v-if="titleShow" class="name line1">{{ item.store_name }}</view>
- <view v-if="progressShow" class="stock-box">
- <view class="grabbed" :style="'width:' + item.percent + ';'"></view>
- <text class="stock-sales">{{ item.percent }}</text>
- </view>
- <view class="price-box">
- <text class="price">
- <text>¥</text>
- {{ item.price }}
- </text>
- <text v-if="priceShow" class="old-price">
- <text>¥</text>
- {{ item.ot_price }}
- </text>
- </view>
- </view>
- </navigator>
- </scroll-view>
- <block v-else class="acea-row row-between-wrapper combination">
- <navigator
- class="combination-item"
- v-for="(item, index) in spikeList"
- :key="index"
- :url="'/pages/activity/goods_seckill_details/index?id=' + item.product_id + '&time=' + item.stop + ''"
- hover-class="none"
- :style="'border-radius:'+conStyle">
- <view class="info">
- <view class="price-box combination-price">
- <view v-if="titleShow" class="name line1">{{ item.store_name }}</view>
- <text class="price">
- <text>¥</text>
- {{ item.price }}
- </text>
- <text class="gocom_btn">
- 去抢购
- <text class="iconfont icon-jiantou"></text>
- </text>
- </view>
- </view>
- <view class="img-box">
- <easy-loadimage mode="widthFix" :image-src="item.image"></easy-loadimage>
- </view>
- </navigator>
- <navigator v-if="spikeList.length == 1"
- class="combination-item"
- hover-class="none"
- :url="'/pages/activity/goods_seckill_details/index?id=' + spikeList[0].product_id + '&time=' + spikeList[0].stop + ''"
- :style="'border-radius:'+conStyle">
- <view class="info">
- <view class="price-box combination-price">
- <view v-if="titleShow" class="name line1">{{ spikeList[0].store_name }}</view>
- <text class="price">
- <text>¥</text>
- {{ spikeList[0].price }}
- </text>
- <text class="gocom_btn">
- 去抢购
- <text class="iconfont icon-jiantou"></text>
- </text>
- </view>
- </view>
- <view class="img-box">
- <easy-loadimage mode="widthFix" :image-src="spikeList[0].image"></easy-loadimage>
- </view>
- </navigator>
- <navigator v-if="spikeList.length == 1"
- class="combination-item"
- hover-class="none"
- :url="'/pages/activity/goods_seckill_details/index?id=' + spikeList[0].product_id + '&time=' + spikeList[0].stop + ''"
- :style="'border-radius:'+conStyle">
- <view class="info">
- <view class="price-box combination-price">
- <view v-if="titleShow" class="name line1">{{ spikeList[0].store_name }}</view>
- <text class="price">
- <text>¥</text>
- {{ spikeList[0].price }}
- </text>
- <text class="gocom_btn">
- 去抢购
- <text class="iconfont icon-jiantou"></text>
- </text>
- </view>
- </view>
- <view class="img-box">
- <easy-loadimage mode="widthFix" :image-src="spikeList[0].image"></easy-loadimage>
- </view>
- </navigator>
- <navigator v-if="spikeList.length == 2"
- class="combination-item"
- hover-class="none"
- :url="'/pages/activity/goods_seckill_details/index?id=' + spikeList[1].product_id + '&time=' + spikeList[1].stop + ''"
- :style="'border-radius:'+conStyle">
- <view class="info">
- <view class="price-box combination-price">
- <view v-if="titleShow" class="name line1">{{ spikeList[1].store_name }}</view>
- <text class="price">
- <text>¥</text>
- {{ spikeList[1].price }}
- </text>
- <text class="gocom_btn">
- 去抢购
- <text class="iconfont icon-jiantou"></text>
- </text>
- </view>
- </view>
- <view class="img-box">
- <easy-loadimage mode="widthFix" :image-src="spikeList[1].image"></easy-loadimage>
- </view>
- </navigator>
- </block>
- </view>
- </view>
- </view>
- </template>
- <script>
- import countDown from '@/components/countDown';
- import easyLoadimage from '@/components/easy-loadimage/easy-loadimage.vue';
- import {
- getSeckillIndexTime,
- getSeckillList
- } from '@/api/activity.js';
- export default {
- name: 'seckill',
- components:{
- countDown,
- easyLoadimage
- },
- props: {
- dataConfig: {
- type: Object,
- default: () => {}
- },
- merId: {
- type: String || Number,
- default: ''
- }
- },
- data() {
- return {
- datatime:0,
- spikeList: [],
- countDownColor: this.dataConfig.countDownColor.color[0].item,
- themeColor: this.dataConfig.themeColor.color[0].item,
- styleType: this.dataConfig.tabConfig.tabVal, //单行,多行,板块
- mbConfig: this.dataConfig.mbConfig.val*2,
- bgStyle: this.dataConfig.bgStyle.type ? 20 : 0,
- bgColor: this.dataConfig.bgColor.color[0].item,
- conStyle: this.dataConfig.conStyle.type ? 16 : 0,
- priceShow: this.dataConfig.priceShow.val,
- progressShow: this.dataConfig.progressShow.val,
- titleShow: this.dataConfig.titleShow.val
- };
- },
- created() {},
- mounted() {
- this.getSpikeProduct();
- this.getSpeckillCutTime();
- },
- methods: {
- // 获取秒杀截止时间
- getSpeckillCutTime() {
- getSeckillIndexTime().then(res => {
- this.datatime = res.data.seckillEndTime ? res.data.seckillEndTime : '';
- });
- },
- getSpikeProduct() {
- let that = this;
- getSeckillList({
- mer_id:that.merId,limit: that.styleType == 2 ? 3 : 12
- }).then(res => {
- that.spikeList = res.data.list;
- that.spikeList.map(item => {
- item.percent = item.stock === 0 ? '0%' : ((item.sales * 100) / item.stock).toFixed(2) + '%';
- });
-
- }).catch(e => {});
- },
- getProduct(){
- this.getSpeckillCutTime();
- this.getSpikeProduct();
- }
- }
- }
- </script>
- <style lang="scss">
- @import '../style/main.scss';
- .seckill-count {
- background-color: #fff;
- margin: 0 20rpx;
- border-radius: 16rpx;
- padding: 24rpx 0 26rpx 20rpx;
- box-shadow: 4rpx 2rpx 12rpx 2rpx rgba(0, 0, 0, 0.03);
- &.wrapper-count2{
- padding: 24rpx 20rpx 26rpx;
- }
- }
- </style>
|