|
|
|
@ -9,7 +9,7 @@ |
|
|
|
<image mode="aspectFill" :src="item" style="width: 100%; height: 100%;" @click="lookImg(index)"></image> |
|
|
|
<view class="seckill-box" v-if="type == 'seckill'"> |
|
|
|
<view>距离结束还剩余</view> |
|
|
|
<view v-if="$isRight(time)"> |
|
|
|
<view> |
|
|
|
<countdown-timer :time="time" :autoStart="true" @finish="dateFinish"> |
|
|
|
<template v-slot="{day, hour, minute, second}"> |
|
|
|
<view class="lf-flex"> |
|
|
|
@ -177,7 +177,7 @@ |
|
|
|
<button class="btn" style="width: 349rpx;">立即秒杀</button> |
|
|
|
</view> |
|
|
|
<view v-else-if="type == 'point'"> |
|
|
|
<button class="btn" style="width: 349rpx;" @click="goExchange()">立即兑换</button> |
|
|
|
<button class="btn" style="width: 349rpx;">立即兑换</button> |
|
|
|
</view> |
|
|
|
<view class="lf-flex" v-else> |
|
|
|
<button class="btn1" @click="shoot(1)">加入购物车</button> |
|
|
|
@ -268,9 +268,7 @@ |
|
|
|
token: '', |
|
|
|
coupons: [], // 优惠 |
|
|
|
goods_num: 1, |
|
|
|
is_date_finish: false, |
|
|
|
show_share: false, |
|
|
|
shareImg: '' |
|
|
|
is_date_finish: false |
|
|
|
} |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
@ -319,11 +317,6 @@ |
|
|
|
this.getGoodsStock(); // 获取商品库存、规格信息 |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
goExchange() { |
|
|
|
if(this.showSpec == '请选择规格') { |
|
|
|
this.shoot(3) |
|
|
|
} |
|
|
|
}, |
|
|
|
// 切换商品收藏 |
|
|
|
switchCollect(){ |
|
|
|
if(!this.token){ |
|
|
|
@ -396,7 +389,7 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
// 跳转至下单页 |
|
|
|
// 跳转至下单页TODO |
|
|
|
confirm(){ |
|
|
|
if(this.is_date_finish){ |
|
|
|
return this.$msg('活动已结束'); |
|
|
|
@ -484,7 +477,7 @@ |
|
|
|
// 直接结算 |
|
|
|
this.$cookieStorage.set('order_confirm', par); |
|
|
|
uni.hideLoading(); |
|
|
|
this.$url('/pages/order/confirm/confirm?goods_type=1'); |
|
|
|
this.$url('/pages/order/confirm/confirm'); |
|
|
|
// this.$http.post({ |
|
|
|
// api: 'api/shopping/order/checkout', |
|
|
|
// data: par, |
|
|
|
@ -499,73 +492,50 @@ |
|
|
|
// } |
|
|
|
// uni.hideLoading() |
|
|
|
// }).catch(err => uni.hideLoading()) |
|
|
|
}else if(this.click_type == 3) { |
|
|
|
// 直接结算 |
|
|
|
this.$cookieStorage.set('order_confirm', par); |
|
|
|
uni.hideLoading(); |
|
|
|
this.$url('/pages/order/confirm/confirm?goods_type=0'); |
|
|
|
} |
|
|
|
}, |
|
|
|
// 点击页面分享按钮 |
|
|
|
shareGraphic(){ |
|
|
|
this.getShearImg(); |
|
|
|
this.getCreateShareImg(); |
|
|
|
}, |
|
|
|
// 获取分享图片 |
|
|
|
getShearImg() { |
|
|
|
wx.showLoading({ |
|
|
|
title: "生成中", |
|
|
|
mask: true |
|
|
|
}); |
|
|
|
var token = this.token; |
|
|
|
this.$http.get({ |
|
|
|
api: 'api/distribution/createMiniShareImg', |
|
|
|
header: { |
|
|
|
Authorization: token |
|
|
|
}, |
|
|
|
data: { |
|
|
|
goods_id: this.goods_id |
|
|
|
} |
|
|
|
}).then(res => { |
|
|
|
if (res.statusCode == 200) { |
|
|
|
res = res.data; |
|
|
|
|
|
|
|
if (res.status) { |
|
|
|
this.setData({ |
|
|
|
shareImg: res.data.image |
|
|
|
}); |
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
this.changeImg(); |
|
|
|
}, 100) |
|
|
|
} else { |
|
|
|
wx.showModal({ |
|
|
|
content: res.message || '请求失败', |
|
|
|
showCancel: false |
|
|
|
}); |
|
|
|
} |
|
|
|
} else { |
|
|
|
wx.showModal({ |
|
|
|
content: '请求失败', |
|
|
|
showCancel: false |
|
|
|
}); |
|
|
|
} |
|
|
|
//请求h5的图片接口 |
|
|
|
getCreateShareImg(){ |
|
|
|
wx.showLoading({ |
|
|
|
title:"生成中", |
|
|
|
mask:true |
|
|
|
}) |
|
|
|
let origin = window.location.origin; |
|
|
|
let share_url = origin+'/pages/store/detail/detail'; |
|
|
|
this.$http.get({ |
|
|
|
api:'api/distribution/createH5ShareImg', |
|
|
|
data:{ |
|
|
|
goods_id:this.id, |
|
|
|
share_url:share_url |
|
|
|
} |
|
|
|
}).then(res=>{ |
|
|
|
res = res.data; |
|
|
|
if(res.status){ |
|
|
|
this.qr_code_image = res.data.image; |
|
|
|
|
|
|
|
wx.hideLoading(); |
|
|
|
this.changeShare(); |
|
|
|
}).catch(rej => { |
|
|
|
wx.showModal({ |
|
|
|
content: '内部错误', |
|
|
|
showCancel: false |
|
|
|
}); |
|
|
|
wx.hideLoading(); |
|
|
|
this.changeShare(); |
|
|
|
}); |
|
|
|
}, |
|
|
|
// 弹出分享 |
|
|
|
changeShare() { |
|
|
|
this.setData({ |
|
|
|
show_share: !this.show_share |
|
|
|
}); |
|
|
|
if(this.qr_code_image){ |
|
|
|
this.share_gaphic =!this.share_gaphic; |
|
|
|
this.is_toggle_share = false; |
|
|
|
} |
|
|
|
} else{ |
|
|
|
wx.showModal({ |
|
|
|
content: res.message || '请求失败,请重试', |
|
|
|
showCancel: false |
|
|
|
}); |
|
|
|
} |
|
|
|
wx.hideLoading() |
|
|
|
}).catch(rej=>{ |
|
|
|
wx.hideLoading() |
|
|
|
wx.showModal({ |
|
|
|
content: rej.message || '内部错误,请重试', |
|
|
|
showCancel: false |
|
|
|
}); |
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
// 商品详情 |
|
|
|
getNewdetail(){ |
|
|
|
@ -590,7 +560,6 @@ |
|
|
|
this.seckill = meta.seckill; |
|
|
|
let currentDate = this.$shared.recordTime(); |
|
|
|
this.time = new Date(meta.seckill.ends_at).getTime() - new Date(currentDate).getTime() |
|
|
|
console.log("time", this.time, meta.seckill.ends_at, currentDate) |
|
|
|
} |
|
|
|
if(type != 'point'){ |
|
|
|
this.getBrandDetail(goods_detail.brand_id); |
|
|
|
|