Merge branch 'feature/task1.0.0' into 'msb_test'

Feature/task1.0.0

See merge request yanxuan-frontend/shop-pc!83
merge-requests/85/merge
肖广 3 years ago
commit 2f1c3d9ba1

@ -72,6 +72,7 @@ export default {
height: 28px; height: 28px;
padding: 0 10px; padding: 0 10px;
color: #FF512B; color: #FF512B;
background: #FFFFFF;;
} }
&__yellow_panel{ &__yellow_panel{
background:#FF512B; background:#FF512B;

@ -50,10 +50,15 @@
@click="onJumpGoodsDetail(item.productId)" @click="onJumpGoodsDetail(item.productId)"
class="seckill-products-wrap" class="seckill-products-wrap"
> >
<img <div class="seckill-products-wrap__cover">
:src="item.productMainPicture" <img :src="item.productMainPicture" />
class="seckill-products-wrap__cover" <div
/> v-if="item.percentage === 100"
class="products-wrap-cover__sold flex flex-middle flex-center"
>
已售罄
</div>
</div>
<div class="seckill-products-wrap__content"> <div class="seckill-products-wrap__content">
<p class="products-wrap-content__title">{{ item.productName }}</p> <p class="products-wrap-content__title">{{ item.productName }}</p>
<div class="products-wrap-content__price"> <div class="products-wrap-content__price">
@ -64,10 +69,21 @@
class="products-wrap-content__footer flex flex-middle flex-between" class="products-wrap-content__footer flex flex-middle flex-between"
> >
<div class="wrap-content-footer__stock"> <div class="wrap-content-footer__stock">
<el-progress :percentage="40" :show-text="false"></el-progress> <el-progress
:percentage="item.percentage"
:show-text="false"
></el-progress>
<p>仅剩{{ item.stock }}</p> <p>仅剩{{ item.stock }}</p>
</div> </div>
<div class="wrap-content-footer__btn">立即抢购</div> <div
v-if="item.percentage === 100"
class="wrap-content-footer__btn wrap-content-footer__btn--gray"
>
已售罄
</div>
<div v-else class="wrap-content-footer__btn">
{{ goodsBtnText }}
</div>
</div> </div>
</div> </div>
</div> </div>
@ -122,6 +138,7 @@ export default {
seckillTime: 0, // seckillTime: 0, //
seckillEndVisible: false, // seckillEndVisible: false, //
seckillStatus: SECKILL_STATUS.NOT_START, // seckillStatus: SECKILL_STATUS.NOT_START, //
inProgressId: 0, // id
}; };
}, },
computed: { computed: {
@ -136,6 +153,11 @@ export default {
second: second < 10 ? `0${second}` : `${second}`, second: second < 10 ? `0${second}` : `${second}`,
}; };
}, },
goodsBtnText() {
return this.query.activityTimeId === this.inProgressId
? "立即开抢"
: "即将开抢";
},
}, },
watch: { watch: {
// //
@ -186,10 +208,16 @@ export default {
if (result && result.length > 0) { if (result && result.length > 0) {
this.tabList = result; this.tabList = result;
const inProgressItem = result.find((item) => item.isInProgress); const inProgressItem = result.find((item) => item.isInProgress);
this.query.activityTimeId = if (inProgressItem) {
(inProgressItem && inProgressItem.id) || result[0].id; this.inProgressId = inProgressItem.id;
this.query.activityTimeId = inProgressItem.id;
} else {
this.query.activityTimeId = result[0].id;
}
this.getGoodsList(); this.getGoodsList();
return;
} }
this.seckillEndVisible = true;
}, },
async getGoodsList() { async getGoodsList() {
this.loading = true; this.loading = true;
@ -197,7 +225,17 @@ export default {
this.loading = false; this.loading = false;
if (result) { if (result) {
this.total = result.total; this.total = result.total;
this.goodsList = result.records; this.goodsList = result.records.map((item) => {
//
const saleNumber = item.number - item.stock;
return {
...item,
percentage:
saleNumber === 0
? 0
: (saleNumber / item.number).toFixed(2) * 100,
};
});
} }
}, },
@ -346,8 +384,25 @@ export default {
box-shadow: 0px 0px 10px 1px rgba(0, 0, 0, 0.1); box-shadow: 0px 0px 10px 1px rgba(0, 0, 0, 0.1);
} }
.seckill-products-wrap__cover { .seckill-products-wrap__cover {
position: relative;
width: 100%; width: 100%;
height: 288px; height: 288px;
img {
width: 100%;
height: 100%;
}
.products-wrap-cover__sold {
position: absolute;
width: 110px;
height: 110px;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
background: rgba(0, 0, 0, 0.5);
font-size: 24px;
color: #ffffff;
border-radius: 50%;
}
} }
.seckill-products-wrap__content { .seckill-products-wrap__content {
padding: 20px 16px; padding: 20px 16px;
@ -387,6 +442,10 @@ export default {
background: #ff512b; background: #ff512b;
font-size: 14px; font-size: 14px;
color: #ffffff; color: #ffffff;
&--gray {
color: #999999;
background: #eeeeee;
}
} }
} }
} }

Loading…
Cancel
Save