Browse Source

修改秒杀商品状态

master
Gao xiaosong 4 years ago
parent
commit
c3618175f9
  1. 22
      components/t-goods-item/t-goods-item.vue
  2. 6
      pages/activity/GoodsSeckill/index.vue

22
components/t-goods-item/t-goods-item.vue

@ -1,5 +1,5 @@
<template> <template>
<view class="tui-goods__item" :class="{ 'tui-full__item': isList }" @tap="detail"> <view class="tui-goods__item" :class="{ 'tui-full__item': isList }">
<view class="tui-image__box" :class="{ 'tui-full__imgbox': isList }"> <view class="tui-image__box" :class="{ 'tui-full__imgbox': isList }">
<image class="tui-goods__img" :class="{ 'tui-full__img': isList }" :src="item.image" mode="widthFix"></image> <image class="tui-goods__img" :class="{ 'tui-full__img': isList }" :src="item.image" mode="widthFix"></image>
</view> </view>
@ -23,10 +23,10 @@
<!-- <tui-button :width="status == 3 ? '146rpx' : '144rpx'" :height="status == 3 ? '60rpx' : '50rpx'" :size="status == 3 ? 26 : 24" :type="status == 1 ? 'gray' : 'danger'" :disabled="status == 1" :plain="status == 3"> <!-- <tui-button :width="status == 3 ? '146rpx' : '144rpx'" :height="status == 3 ? '60rpx' : '50rpx'" :size="status == 3 ? 26 : 24" :type="status == 1 ? 'gray' : 'danger'" :disabled="status == 1" :plain="status == 3">
{{ status | getBtnText(item.subscribe) }} {{ status | getBtnText(item.subscribe) }}
</tui-button> --> </tui-button> -->
<view class="grab bg-color-red" v-if="item.status === 1 && item.stock > 0" @click="goDetail()">马上抢</view> <view class="grab bg-color-red" v-if="timeList[active].status === 1 && item.stock > 0" @click="goDetail">马上抢</view>
<view class="grab" v-if="item.status === 1 && item.stock <= 0">已售磬</view> <view class="grab" v-if="timeList[active].status === 1 && item.stock <= 0">已售磬</view>
<view class="grab bg-color-red" v-if="item.status === 2">即将开始</view> <view class="grab bg-color-red" v-if="timeList[active].status === 2">即将开始</view>
<view class="grab bg-color-red" v-if="item.status === 0">已结束</view> <view class="grab bg-color-red" v-if="timeList[active].status === 0">已结束</view>
</view> </view>
</view> </view>
</view> </view>
@ -53,6 +53,14 @@ export default {
type: Number, type: Number,
default: 2, default: 2,
}, },
timeList: {
type: Array,
default: [],
},
active: {
type: Number,
default: 0,
},
}, },
filters: { filters: {
getBtnText(status, subscribe) { getBtnText(status, subscribe) {
@ -84,10 +92,6 @@ export default {
return {} return {}
}, },
methods: { methods: {
// detail() {
// //id
// this.tui.href(`../seckillDetail/seckillDetail?status=${this.status}`)
// },
goDetail: function() { goDetail: function() {
this.$emit('goDetail', this.item) this.$emit('goDetail', this.item)
}, },

6
pages/activity/GoodsSeckill/index.vue

@ -45,12 +45,12 @@
<view class="tui-list__goods"> <view class="tui-list__goods">
<view class="tui-goods__left"> <view class="tui-goods__left">
<block v-for="(item, index) in seckillList" :key="index"> <block v-for="(item, index) in seckillList" :key="index">
<t-goods-item v-if="index % 2 == 0" :item="item" :isList="false" @goDetail="goDetail"></t-goods-item> <t-goods-item v-if="index % 2 == 0" :item="item" :timeList="timeList" :active="active" :isList="false" @goDetail="goDetail"></t-goods-item>
</block> </block>
</view> </view>
<view class="tui-goods__right"> <view class="tui-goods__right">
<block v-for="(item, index) in seckillList" :key="index"> <block v-for="(item, index) in seckillList" :key="index">
<t-goods-item v-if="index % 2 !== 0" :item="item" :isList="false" @goDetail="goDetail"></t-goods-item> <t-goods-item v-if="index % 2 !== 0" :item="item" :timeList="timeList" :active="active" :isList="false" @goDetail="goDetail"></t-goods-item>
</block> </block>
</view> </view>
</view> </view>
@ -189,7 +189,7 @@ export default {
query: { query: {
id: item.id, id: item.id,
time, time,
status: item.status, status: that.timeList[that.active].status,
}, },
}) })
}, },

Loading…
Cancel
Save