展示秒杀

main
fanfan 6 months ago
parent 5aad1feb2f
commit cf507c446f
  1. 2
      pages/activity/seckill.vue
  2. 43
      pages/goods/detail.vue

@ -250,7 +250,7 @@
handleTargetGoods(sharpGoodsId) { handleTargetGoods(sharpGoodsId) {
let count_down_time = new Date(this.tabbar[this.curTabIndex].count_down_time.replace(/-/g, '/')) let count_down_time = new Date(this.tabbar[this.curTabIndex].count_down_time.replace(/-/g, '/'))
.getTime() - new Date().getTime() .getTime() - new Date().getTime()
console.log(count_down_time)
uni.navigateTo({ uni.navigateTo({
url: '/pages/goods/seckillDetail?activeTimeId=' + this.getCurTabbarId() + '&sharpGoodsId=' + sharpGoodsId + url: '/pages/goods/seckillDetail?activeTimeId=' + this.getCurTabbarId() + '&sharpGoodsId=' + sharpGoodsId +
"&isSeckill=" + true + '&isBuy=' + count_down_time + '&seckillText=' + (this.tabbar[this "&isSeckill=" + true + '&isBuy=' + count_down_time + '&seckillText=' + (this.tabbar[this

@ -33,7 +33,7 @@
<text class="sellLeft"></text>{{goods.line_price_min?Number(goods.line_price_min):0}} <text class="sellLeft"></text>{{goods.line_price_min?Number(goods.line_price_min):0}}
</view> </view>
</view> </view>
<view class="right"> <view class="right" v-if="seckillCountTime==0">
<view class="rightPrice" v-if="goods.is_check==1"> <view class="rightPrice" v-if="goods.is_check==1">
<image :src="$picUrl+'/static/detail/shenhe.png'" style="width: 44rpx;height: 42rpx;"></image> <image :src="$picUrl+'/static/detail/shenhe.png'" style="width: 44rpx;height: 42rpx;"></image>
</view> </view>
@ -45,16 +45,18 @@
<image :src="$picUrl+'/static/detail/sheng.png'" v-if="userInfo.user_type==20"></image> <image :src="$picUrl+'/static/detail/sheng.png'" v-if="userInfo.user_type==20"></image>
<text class="span" <text class="span"
v-if="userInfo.user_type==40">{{goods.cost_price_min?Number(goods.cost_price_min):0}}</text> v-if="userInfo.user_type==40">{{goods.cost_price_min?Number(goods.cost_price_min):0}}</text>
<text class="span" <text
v-else>{{(goods.line_price_min>0&&goods.goods_price_min>0)?Number((Number(goods.line_price_min)-Number(goods.goods_price_min)).toFixed(2)):0}}</text> class="span">{{(goods.line_price_min>0&&goods.goods_price_min>0)?Number((Number(goods.line_price_min)-Number(goods.goods_price_min)).toFixed(2)):0}}</text>
</view>
</view> </view>
<view class="rightBox" v-if="isSeckill" style="background:unset;padding:unset;"> <view class="right2" v-if="userInfo.user_type==40&&seckillCountTime>0">
<view class="rightBox" style="background:unset;padding:unset;">
<text class="span" style="color: #ffffff;font-size: 45rpx;font-family: STXinwei;">限时抢购</text> <text class="span" style="color: #ffffff;font-size: 45rpx;font-family: STXinwei;">限时抢购</text>
</view> </view>
<view class="rest" v-if="isSeckill" <view class="rest"
style="display: inline-flex;color:#ffffff;font-size: 30rpx;margin-top: 5rpx;float: right;font-family: STXinwei;width: 300rpx;"> style="display: inline-flex;color:#ffffff;font-size: 30rpx;margin-top: 5rpx;float: right;font-family: STXinwei;width: 300rpx;">
<text style="margin-right: 20rpx;font-family: STXinwei;">距活动{{seckillText}}</text> <text style="margin-right: 20rpx;font-family: STXinwei;">距活动结束</text>
<u-count-down :timestamp="isBuy" format="HH:mm:ss" autoStart <u-count-down :timestamp="seckillCountTime" format="HH:mm:ss" autoStart
@change="onChangeSeckillCutDownTime"> @change="onChangeSeckillCutDownTime">
<view class="date-time" style="font-family: STXinwei;"> <view class="date-time" style="font-family: STXinwei;">
<text <text
@ -526,7 +528,8 @@
province: '江苏省', province: '江苏省',
city: '南京市', city: '南京市',
district: '玄武区' district: '玄武区'
} },
seckillCountTime: 0,
} }
}, },
onLoad(options) { onLoad(options) {
@ -676,6 +679,7 @@
GoodsApi.editGoodsSeckillPrice(params).then(res => { GoodsApi.editGoodsSeckillPrice(params).then(res => {
if (res.status == 200) { if (res.status == 200) {
that.$toast("设置成功"); that.$toast("设置成功");
that.getGoodsDetail()
this.$refs.setRange.afterSale = false; this.$refs.setRange.afterSale = false;
setTimeout(() => { setTimeout(() => {
that.getGoodsDetail(1); that.getGoodsDetail(1);
@ -689,6 +693,7 @@
}, },
setPirce() { setPirce() {
let item = this.findItemById(this.goods.skuList, this.goods.goods_id) let item = this.findItemById(this.goods.skuList, this.goods.goods_id)
console.log('item', item)
if (item) { if (item) {
this.$refs.setRange.startTime = item.sec_start_time; this.$refs.setRange.startTime = item.sec_start_time;
this.$refs.setRange.sec_hour = item.sec_hour this.$refs.setRange.sec_hour = item.sec_hour
@ -970,6 +975,19 @@
GoodsApi.detail(this.goodsId) GoodsApi.detail(this.goodsId)
.then(result => { .then(result => {
let info = result.data.detail; let info = result.data.detail;
let item = this.findItemById(info.skuList, info.goods_id)
if (item) {
if (item.sec_start_time) {
that.seckillCountTime = new Date(item.sec_start_time
.replace(/-/g, '/'))
.getTime() - new Date().getTime()
} else {
that.seckillCountTime = 0
}
} else {
that.seckillCountTime = 0
}
that.seckillCountTime = that.seckillCountTime > 0 ? that.seckillCountTime : 0
that.goods.skuList = []; that.goods.skuList = [];
that.godds = {} that.godds = {}
info.goods_images1 = [] info.goods_images1 = []
@ -1389,11 +1407,18 @@
} }
} }
.right { .right2 {
display: flex; display: flex;
align-items: center; align-items: center;
margin-right: 40rpx; margin-right: 40rpx;
flex-flow: column; flex-flow: column;
}
.right {
display: flex;
align-items: center;
margin-right: 40rpx;
// flex-flow: column;
.rightPrice { .rightPrice {
overflow: hidden; overflow: hidden;

Loading…
Cancel
Save