|
|
|
@ -10,9 +10,11 @@ |
|
|
|
<view class="seckill-box" v-if="type == 'seckill'"> |
|
|
|
<view>距离结束还剩余</view> |
|
|
|
<view> |
|
|
|
<countdown-timer :time="time" :autoStart="true"> |
|
|
|
<template v-slot="{hour, minute, second}"> |
|
|
|
<countdown-timer :time="time" :autoStart="true" @finish="dateFinish"> |
|
|
|
<template v-slot="{day, hour, minute, second}"> |
|
|
|
<view class="lf-flex"> |
|
|
|
<view>{{ day }}</view> |
|
|
|
<view>天</view> |
|
|
|
<view>{{ hour >= 10 ? hour : "0" + hour }}</view> |
|
|
|
<view>时</view> |
|
|
|
<view>{{ minute >= 10 ? minute : "0" + minute }}</view> |
|
|
|
@ -252,10 +254,9 @@ |
|
|
|
skeletonLoading: false, |
|
|
|
pictures: [], |
|
|
|
show_popup: false, // 是否显示选规格模态框 |
|
|
|
spec_current: null, // 规格下标 |
|
|
|
click_type: null, // 当前点击的是加入购物车[1]还是立即购买[2] |
|
|
|
type: 'mail', // 页面显示类型,mail普通可邮寄商品,point积分商品,seckill秒杀商品 |
|
|
|
time: new Date('2021/09/8 14:15:00').getTime() - new Date('2021/09/8 13:10:00').getTime(), |
|
|
|
time: 0, |
|
|
|
goods_stock: { |
|
|
|
specs: {}, |
|
|
|
stores: {} |
|
|
|
@ -264,7 +265,8 @@ |
|
|
|
brand_detail: {}, |
|
|
|
token: '', |
|
|
|
coupons: [], // 优惠 |
|
|
|
goods_num: 1 |
|
|
|
goods_num: 1, |
|
|
|
is_date_finish: false |
|
|
|
} |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
@ -272,15 +274,21 @@ |
|
|
|
let goods_detail = this.goods_detail; |
|
|
|
let stores = this.goods_stock.stores; |
|
|
|
let specs = this.goods_stock.specs; |
|
|
|
let specId = 1; |
|
|
|
if(!this.$isRight(specs[specId])){ |
|
|
|
|
|
|
|
if(!this.$isRight(specs[1])){ |
|
|
|
return `¥${goods_detail.min_price} - ¥${goods_detail.max_price}`; |
|
|
|
} |
|
|
|
let spec_current = specs[specId].spec_current; |
|
|
|
|
|
|
|
if(specs[specId].spec_current != null){ |
|
|
|
let id = specs[specId].list[spec_current].id; |
|
|
|
return "¥"+ stores[specId +'-'+ id].price; |
|
|
|
let spec_current_1 = specs[1].spec_current; |
|
|
|
let spec_current_2 = specs[2].spec_current; |
|
|
|
if(specs[1].spec_current != null && specs[2].spec_current != null){ |
|
|
|
let id_1 = specs[1].list[spec_current_1].id; |
|
|
|
let id_2 = specs[2].list[spec_current_2].id; |
|
|
|
if(id_1 < id_2){ |
|
|
|
let id_3 = id_2; |
|
|
|
id_2 = id_1; |
|
|
|
id_1 = id_3; |
|
|
|
} |
|
|
|
return "¥"+ stores[id_2 +'-'+ id_1].price; |
|
|
|
}else{ |
|
|
|
return `¥${goods_detail.min_price} - ¥${goods_detail.max_price}`; |
|
|
|
} |
|
|
|
@ -381,24 +389,49 @@ |
|
|
|
}, |
|
|
|
// 跳转至下单页TODO |
|
|
|
confirm(){ |
|
|
|
if(this.is_date_finish){ |
|
|
|
return this.$msg('活动已结束'); |
|
|
|
} |
|
|
|
let goods_detail = this.goods_detail; |
|
|
|
let specs = this.goods_stock.specs; |
|
|
|
let stores = this.goods_stock.stores; |
|
|
|
|
|
|
|
let s_id_1 = 1; |
|
|
|
let s_id_2 = 2; |
|
|
|
for(let i in specs){ |
|
|
|
if(specs[i].label_key == 'size'){ |
|
|
|
s_id_1 = 1; |
|
|
|
} |
|
|
|
if(specs[i].label_key == 'color'){ |
|
|
|
s_id_2 = 2; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
let spec_current_1 = specs[s_id_1].spec_current; |
|
|
|
let spec_current_2 = specs[s_id_2].spec_current; |
|
|
|
let id_1 = specs[s_id_1].list[spec_current_1].id; |
|
|
|
let id_2 = specs[s_id_2].list[spec_current_2].id; |
|
|
|
if(id_1 > id_2){ |
|
|
|
let id_3 = id_2; |
|
|
|
id_2 = id_1; |
|
|
|
id_1 = id_3; |
|
|
|
} |
|
|
|
|
|
|
|
let par = { |
|
|
|
attributes: { |
|
|
|
color: specs[2].list[specs[2].spec_current].value, |
|
|
|
color: specs[s_id_2].list[specs[s_id_2].spec_current].value, |
|
|
|
com_id: goods_detail.id, |
|
|
|
img: goods_detail.img, |
|
|
|
size: specs[1].list[specs[1].spec_current].value, |
|
|
|
sku: goods_detail.goods_no +'-'+ specs[1].list[specs[1].spec_current].value |
|
|
|
size: specs[s_id_1].list[specs[s_id_1].spec_current].value, |
|
|
|
sku: goods_detail.goods_no +'-'+ specs[s_id_1].list[specs[s_id_1].spec_current].value |
|
|
|
}, |
|
|
|
id: stores[1 +'-'+ specs[1].list[specs[1].spec_current].id].id, |
|
|
|
product_id: stores[1 +'-'+ specs[1].list[specs[1].spec_current].id].id, |
|
|
|
id: stores[id_1 +'-'+ id_2].id, |
|
|
|
product_id: stores[id_1 +'-'+ id_2].id, |
|
|
|
price: stores[id_1 +'-'+ id_2].price, |
|
|
|
store_count: stores[id_1 +'-'+ id_2].store, |
|
|
|
market_price: goods_detail.market_price, |
|
|
|
name: goods_detail.name, |
|
|
|
price: stores[1 +'-'+ specs[1].list[specs[1].spec_current].id].price, |
|
|
|
qty: this.goods_num, |
|
|
|
store_count: stores[1 +'-'+ specs[1].list[specs[1].spec_current].id].store |
|
|
|
qty: this.goods_num |
|
|
|
} |
|
|
|
|
|
|
|
uni.showLoading({ |
|
|
|
@ -506,6 +539,8 @@ |
|
|
|
if(this.$isRight(meta.seckill)){ |
|
|
|
type = 'seckill'; |
|
|
|
this.seckill = meta.seckill; |
|
|
|
let currentDate = this.$shared.recordTime(); |
|
|
|
this.time = new Date(meta.seckill.ends_at).getTime() - new Date(currentDate).getTime() |
|
|
|
} |
|
|
|
if(type != 'point'){ |
|
|
|
this.getBrandDetail(goods_detail.brand_id); |
|
|
|
@ -570,6 +605,10 @@ |
|
|
|
}) |
|
|
|
}, 200); |
|
|
|
}, |
|
|
|
// 倒计时结束 |
|
|
|
dateFinish(){ |
|
|
|
this.is_date_finish = true; |
|
|
|
}, |
|
|
|
// 富文本处理 |
|
|
|
formatRichText(richText){ |
|
|
|
if(richText != null){ |
|
|
|
|