order 7.22
This commit is contained in:
@@ -40,9 +40,9 @@
|
||||
<view class="bottom">
|
||||
<view class="left" @click="showGroupUser=true">
|
||||
<view class="avatar">
|
||||
<image v-for="(user, i) in groupUser.slice(0, 3)" :src="user[0].member_avatar" :key="i"></image>
|
||||
<image v-for="(user, i) in user_suc" :src="user[0].member_avatar" :key="i"></image>
|
||||
</view>
|
||||
<view class="all">
|
||||
<view class="all" @click="showGroupUser=true">
|
||||
<text>查看全部</text>
|
||||
<image src="/static/image/common/1.png"></image>
|
||||
</view>
|
||||
@@ -84,7 +84,7 @@
|
||||
<view class="name u-line-1">{{ user.member_nickname }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="involvement-btn" @click="withImmediate('involvement')">参与拼团</view>
|
||||
<view class="involvement-btn" @click="settlementOrder('involvement')">参与拼团</view>
|
||||
<image class="close" src="/static/image/common/17.png" @click="showInvolvementUser=false"></image>
|
||||
</view>
|
||||
</u-popup>
|
||||
@@ -98,7 +98,7 @@
|
||||
</view>
|
||||
<!-- 拼团 tool -->
|
||||
<view class="group-tool" v-if="type==2">
|
||||
<view class="launch" @click="withImmediate">发起拼团</view>
|
||||
<view class="launch" @click="settlementOrder">发起拼团</view>
|
||||
<view class="involvement" @click="showGroupUser=true">参与拼团</view>
|
||||
</view>
|
||||
<!-- 秒杀 -->
|
||||
@@ -113,7 +113,8 @@
|
||||
<text>客服</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="btn" :class="{'cannot': groupbuyInfo.groupbuy_state == 32 || groupbuyInfo.inventory == groupbuyInfo.groupbuy_buy_quantity}">
|
||||
<view class="btn" v-if="groupbuyInfo.groupbuy_state == 20 && groupbuyInfo.inventory > groupbuyInfo.groupbuy_buy_quantity" @click="spikeGoods">立即秒杀</view>
|
||||
<view class="btn" :class="{'cannot': groupbuyInfo.groupbuy_state == 32 || groupbuyInfo.inventory == groupbuyInfo.groupbuy_buy_quantity}" v-else>
|
||||
{{ groupbuyInfo.groupbuy_state == 32 ? '时间已结束' : (groupbuyInfo.inventory > groupbuyInfo.groupbuy_buy_quantity ? '立即秒杀' : '已售空') }}
|
||||
</view>
|
||||
</view>
|
||||
@@ -133,10 +134,12 @@ export default {
|
||||
goodsInfo: {},
|
||||
info:{},
|
||||
glist:[],
|
||||
id:0,
|
||||
id:0, // 商品id
|
||||
type: '', // 商品类型 商品详情 1普通 2拼团 3秒杀 4优惠券
|
||||
groupUser: [], // 拼团用户
|
||||
user_suc: [], // 拼团成功用户
|
||||
avatarWidth: '',
|
||||
pintuan_id: '', // 拼团id
|
||||
showGroupUser: false, // 拼团
|
||||
showInvolvementUser: false, // 参团
|
||||
involvemenGroupInfo: [], // 参团的人
|
||||
@@ -160,14 +163,16 @@ export default {
|
||||
this.id = this.$store.state.goods_id;
|
||||
this.type = this.$store.getters.getGoodsType;
|
||||
const info = this.$store.getters.getGoodsInfo;
|
||||
if(this.type == 2) {
|
||||
this.user_suc = info.user_suc;
|
||||
this.groupUser = info.user;
|
||||
this.pintuan_id = info.pintuan_id;
|
||||
}
|
||||
if (this.type == 3) {
|
||||
this.groupbuyInfo = this.$store.state.groupbuyInfo;
|
||||
this.setSpikeTime();
|
||||
}
|
||||
// console.log(this.groupbuyInfo);
|
||||
if(this.type == 2) {
|
||||
this.groupUser = info.user;
|
||||
}
|
||||
this.goodsInfo = info.goods;
|
||||
// 设置轮播图
|
||||
let list = [];
|
||||
@@ -180,21 +185,26 @@ export default {
|
||||
this.list = list;
|
||||
this.setTitle();
|
||||
},
|
||||
spikeGoods() {
|
||||
this.settlementOrder(3)
|
||||
},
|
||||
setSpikeTime() {
|
||||
const time = this.groupbuyInfo.groupbuy_endtime;
|
||||
// console.log(new Date(time*1000));
|
||||
// console.log(new Date());
|
||||
this.timer = setInterval(() => {
|
||||
let spikeTime = time * 1000 - new Date();
|
||||
let spikeTime = time * 1000 - new Date().getTime();
|
||||
// 计算天数
|
||||
const days = Math.floor(spikeTime/(24*3600*1000));
|
||||
//计算出小时数
|
||||
const leave1 = spikeTime % (24*3600*1000) //计算天数后剩余的毫秒数
|
||||
const hours = Math.floor(leave1/(3600*1000))
|
||||
const leave1 = spikeTime % (24*3600*1000) // 计算天数后剩余的毫秒数
|
||||
let hours = Math.floor(leave1/(3600*1000));
|
||||
//计算相差分钟数
|
||||
const leave2 = leave1 % (3600*1000) //计算小时数后剩余的毫秒数
|
||||
const leave2 = leave1 % (3600*1000) // 计算小时数后剩余的毫秒数
|
||||
const minutes = Math.floor(leave2 / (60*1000))
|
||||
//计算相差秒数
|
||||
const leave3 = leave2 % (60*1000) //计算分钟数后剩余的毫秒数
|
||||
const leave3 = leave2 % (60*1000) // 计算分钟数后剩余的毫秒数
|
||||
const seconds = Math.round(leave3 / 1000)
|
||||
// 把天数算在小时里
|
||||
hours = days * 24 + hours;
|
||||
this.spikeTime = hours + ':' + minutes + ':' + seconds;
|
||||
// console.log(this.spikeTime);
|
||||
}, 1000)
|
||||
@@ -234,37 +244,29 @@ export default {
|
||||
this.glist = res.data.spec_list;
|
||||
})
|
||||
},
|
||||
// 如果有pintuangroup_headid为参团不然为开团
|
||||
withImmediate(type) {
|
||||
let params = {
|
||||
pintuan_id: this.id,
|
||||
}
|
||||
// console.log(this.involvemenGroupInfo);
|
||||
if(type == 'involvement' && this.involvemenGroupInfo.length) {
|
||||
Object.assign(params, { pintuangroup_headid: this.involvemenGroupInfo[0].user_id });
|
||||
Object.assign(params, { pintuangroup_id: this.involvemenGroupInfo[0].pintuangroup_id });
|
||||
}
|
||||
// console.log(params);
|
||||
this.$u.api.withImmediate(params).then(res => {
|
||||
this.showGroupUser = false;
|
||||
this.showInvolvementUser = false;
|
||||
if(res.errCode == 0) {
|
||||
this.settlementOrder();
|
||||
} else {
|
||||
this.$u.toast(res.message);
|
||||
}
|
||||
})
|
||||
},
|
||||
settlementOrder() {
|
||||
settlementOrder(type) {
|
||||
// ifcart 结算方式 1:购物车 0:直接结算(立即购买/拼团/秒杀)
|
||||
this.$u.api.settlementOrder({
|
||||
let params = {
|
||||
ifcart: 0,
|
||||
cart_id: [this.goodsInfo.goods_id + '|' + 1],
|
||||
pintuan_id: this.involvemenGroupInfo[0].user_id,
|
||||
pintuangroup_id: this.involvemenGroupInfo[0].pintuangroup_id
|
||||
}).then(res => {
|
||||
}
|
||||
if(this.type == 2) {
|
||||
if(type == 'involvement') {
|
||||
Object.assign(params, {
|
||||
pintuan_id: this.pintuan_id,
|
||||
pintuangroup_id: this.involvemenGroupInfo[0].pintuangroup_id
|
||||
})
|
||||
} else {
|
||||
const userId = uni.getStorageSync('user_info').member.member_id;
|
||||
this.$store.commit('setGroupHeadId', userId);
|
||||
Object.assign(params, {
|
||||
pintuan_id: this.pintuan_id,
|
||||
})
|
||||
}
|
||||
}
|
||||
this.$u.api.settlementOrder(params).then(res => {
|
||||
if(res.errCode == 0) {
|
||||
this.$store.commit('orderType', 3);
|
||||
this.$store.commit('setOrderType', this.type);
|
||||
this.$store.commit('updateOrderInfo', res.data)
|
||||
this.$u.route({
|
||||
url: '/pageC/cart/ConfirmOrder'
|
||||
@@ -276,7 +278,7 @@ export default {
|
||||
this.involvemenGroupInfo = user;
|
||||
this.showGroupUser = false;
|
||||
this.showInvolvementUser = true;
|
||||
console.log(this.involvemenGroupInfo);
|
||||
// console.log(this.involvemenGroupInfo);
|
||||
},
|
||||
xuanze(id){
|
||||
// console.log(id)
|
||||
@@ -291,8 +293,8 @@ export default {
|
||||
case 2:
|
||||
title = '拼团商品详情';
|
||||
break;
|
||||
case 1:
|
||||
|
||||
case 3:
|
||||
title = '秒杀商品详情';
|
||||
break;
|
||||
case 1:
|
||||
|
||||
@@ -340,6 +342,7 @@ export default {
|
||||
}
|
||||
.origin-price {
|
||||
font-size: 26rpx;
|
||||
text-decoration: line-through;
|
||||
}
|
||||
}
|
||||
.num {
|
||||
|
||||
Reference in New Issue
Block a user