Commit bfa869a1 authored by beisir's avatar beisir

Merge branch 'feat/group-buy' of git.quantgroup.cn:ui/group-buy-ui into feat/group-buy

parents 8672747a 7d16b7f5
<template> <template>
<div class="goods-bottom"> <div class="goods-bottom">
<template v-if="status == 1">
<template v-if="groupId"> <template v-if="groupId">
<cr-button <cr-button
class="mutiplie" class="mutiplie"
...@@ -7,7 +8,7 @@ ...@@ -7,7 +8,7 @@
type="primary" type="primary"
shape="circle" shape="circle"
:disabled="disabled" :disabled="disabled"
@click="createGroup" @click="createOrJoin(1)"
>自己做团长</cr-button >自己做团长</cr-button
> >
<cr-button <cr-button
...@@ -16,16 +17,28 @@ ...@@ -16,16 +17,28 @@
:disabled="disabled" :disabled="disabled"
type="primary" type="primary"
block block
@click="joinGroup" @click="createOrJoin(0)"
> >
立即参团 立即参团
</cr-button> </cr-button>
</template> </template>
<template v-else> <template v-else>
<cr-button shape="circle" :disabled="disabled" type="primary" block @click="createGroup"> <cr-button
shape="circle"
:disabled="disabled"
type="primary"
block
@click="createOrJoin(1)"
>
立即开团 立即开团
</cr-button> </cr-button>
</template> </template>
</template>
<template v-else>
<cr-button shape="circle" :disabled="disabled" type="primary" block @click="shareTo">
邀请好友
</cr-button>
</template>
</div> </div>
</template> </template>
<script> <script>
...@@ -35,16 +48,8 @@ export default { ...@@ -35,16 +48,8 @@ export default {
mixins: [goodsCheckMixin], mixins: [goodsCheckMixin],
props: { props: {
groupId: { groupId: {
type: String, type: Number,
default: '' default: 0
},
type: {
type: String,
default: 'shopCar' // shoppingCar 购物车;settlement 结算;submitOrder 确认订单
},
shopBtnName: {
type: String,
default: '立即购买' // shoppingCar 购物车;settlement 结算;submitOrder 确认订单
}, },
info: { info: {
type: Object, type: Object,
...@@ -62,7 +67,7 @@ export default { ...@@ -62,7 +67,7 @@ export default {
}, },
status: { status: {
type: Number, type: Number,
default: 2 default: 1 // 1是大图详情页, 2是小图详情页
} }
}, },
data() { data() {
...@@ -71,21 +76,17 @@ export default { ...@@ -71,21 +76,17 @@ export default {
}; };
}, },
methods: { methods: {
joinGroup() { shareTo() {
// 参团 // 邀请好友
if (this.checkLogin()) { this.$emit('share');
// todo
return;
}
this.$emit('buy');
}, },
createGroup() { createOrJoin(mark) {
// 开团 // 参团
// mark 1-> 开团 2-> 参团
if (this.checkLogin()) { if (this.checkLogin()) {
// todo
return; return;
} }
this.$emit('buy'); this.$emit('buy', mark);
} }
} }
}; };
......
...@@ -13,9 +13,11 @@ ...@@ -13,9 +13,11 @@
</p> </p>
</template> </template>
</div> </div>
<div v-if="groupInfo.groupBuyStatus == 1" class="gourp-rules"> <div class="gourp-rules">
<template v-if="groupInfo.groupBuyStatus == 1 || groupInfo.groupBuyStatus == 0">
<p>成团条件:{{ groupInfo.groupBuyCondition || '' }}</p> <p>成团条件:{{ groupInfo.groupBuyCondition || '' }}</p>
<cr-image src="@/assets/images/flag.png" width="13px" /> <cr-image src="@/assets/images/flag.png" width="13px" />
</template>
<!-- </template> --> <!-- </template> -->
</div> </div>
<div v-if="showButtonGroup" ref="buttonArea" class="button-area"> <div v-if="showButtonGroup" ref="buttonArea" class="button-area">
...@@ -54,6 +56,7 @@ export default { ...@@ -54,6 +56,7 @@ export default {
return { return {
observer: null, observer: null,
statusTextMap: { statusTextMap: {
0: '发起拼团,邀请好友一起拼团吧!',
2: '恭喜成团,等待发货!', 2: '恭喜成团,等待发货!',
3: '哎呀,拼团时间已过,尚未成团!', 3: '哎呀,拼团时间已过,尚未成团!',
4: '已发货' 4: '已发货'
...@@ -98,7 +101,7 @@ export default { ...@@ -98,7 +101,7 @@ export default {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
margin-bottom: @padding-unit; margin-bottom: @padding-xs;
.desc { .desc {
margin-right: @padding-unit; margin-right: @padding-unit;
span { span {
......
...@@ -222,7 +222,7 @@ export default { ...@@ -222,7 +222,7 @@ export default {
inProgress: false, // 活动是否已经开始 inProgress: false, // 活动是否已经开始
countDownText: '', countDownText: '',
showPage: false, // 是否显示页面,当查询完团与人的关系后进行处理,如果用户已经参与了此商品此活动的团,navigateto small else showpage = true showPage: false, // 是否显示页面,当查询完团与人的关系后进行处理,如果用户已经参与了此商品此活动的团,navigateto small else showpage = true
groupId: '', // 团id groupId: 0, // 团id
// 以下是原有的data // 以下是原有的data
detailParam: { detailParam: {
skuNo: '', skuNo: '',
...@@ -262,10 +262,14 @@ export default { ...@@ -262,10 +262,14 @@ export default {
created() { created() {
this.hasLogin = localStorage.get('vccToken') != 'null' ? true : false; this.hasLogin = localStorage.get('vccToken') != 'null' ? true : false;
this.detailParam = { ...this.$route.query }; this.detailParam = { ...this.$route.query };
localStorage.remove('orderData');
localStorage.set('activityId', this.detailParam.templateId); // 设置活动模板id,用于下单 localStorage.set('activityId', this.detailParam.templateId); // 设置活动模板id,用于下单
if (this.detailParam.groupBuyGroupId) { if (this.detailParam.groupBuyGroupId) {
localStorage.set('groupBuyGroupId', this.detailParam.groupBuyGroupId || ''); // 设置groupBuyGroupId,用于下单 localStorage.set('groupBuyGroupId', this.detailParam.groupBuyGroupId); // 设置groupBuyGroupId,用于下单
this.groupId = this.detailParam.groupBuyGroupId || ''; this.groupId = +this.detailParam.groupBuyGroupId;
} else {
localStorage.remove('groupBuyGroupId');
this.groupId = 0;
} }
this.name = this.$route.params; this.name = this.$route.params;
this.init(this.detailParam); this.init(this.detailParam);
...@@ -284,11 +288,14 @@ export default { ...@@ -284,11 +288,14 @@ export default {
this.swiperCurrent = index; this.swiperCurrent = index;
}, },
// ka渠道逻辑 // ka渠道逻辑
goVccOrDetail() { goVccOrDetail(res) {
if (!this.hasLogin) { if (!this.hasLogin) {
this.checkLogin(); this.checkLogin();
return; return;
} }
if (res == 1) {
localStorage.remove('groupBuyGroupId'); // 开团或者自己做团长的时候需要移除groupBuyGroupId,再去调下单
}
this.toOrder(); this.toOrder();
}, },
setStartStatus(data) { setStartStatus(data) {
...@@ -298,7 +305,6 @@ export default { ...@@ -298,7 +305,6 @@ export default {
this.groupTimestemp = data.groupBuyInfo.currentGroupEndTime this.groupTimestemp = data.groupBuyInfo.currentGroupEndTime
? new Date(data.groupBuyInfo.currentGroupEndTime).getTime() ? new Date(data.groupBuyInfo.currentGroupEndTime).getTime()
: -1; : -1;
console.log(currentTime, activityStartTime, activityEndTime);
if (currentTime <= activityStartTime) { if (currentTime <= activityStartTime) {
// 当前时间小于活动开始时间 // 当前时间小于活动开始时间
this.timestemp = activityStartTime; this.timestemp = activityStartTime;
...@@ -323,7 +329,7 @@ export default { ...@@ -323,7 +329,7 @@ export default {
const [res] = await goods.detailInfo(detailParam); const [res] = await goods.detailInfo(detailParam);
if (res.groupBuyInfo.groupId) { if (res.groupBuyInfo.groupId) {
localStorage.set('groupBuyGroupId', res.groupBuyInfo.groupId || ''); // 设置groupBuyGroupId,用于下单 localStorage.set('groupBuyGroupId', res.groupBuyInfo.groupId || ''); // 设置groupBuyGroupId,用于下单
this.groupId = res.groupBuyInfo.groupId || ''; this.groupId = +res.groupBuyInfo.groupId || 0;
} }
if (res.groupBuyInfo?.joinGroup) { if (res.groupBuyInfo?.joinGroup) {
const query = { ...this.$route.query }; const query = { ...this.$route.query };
...@@ -332,6 +338,7 @@ export default { ...@@ -332,6 +338,7 @@ export default {
this.imgList = res.imageUrl || []; this.imgList = res.imageUrl || [];
this.detailInfo = res; this.detailInfo = res;
this.setStartStatus(res); this.setStartStatus(res);
this.showPage = true;
try { try {
const detailImages = await goods.getDetailPic(this.detailInfo.contentDetailUrl); const detailImages = await goods.getDetailPic(this.detailInfo.contentDetailUrl);
// const imgReg = new RegExp('(?<=src=").[^"]*', 'g'); // const imgReg = new RegExp('(?<=src=").[^"]*', 'g');
...@@ -346,7 +353,6 @@ export default { ...@@ -346,7 +353,6 @@ export default {
srcArr.push(src); srcArr.push(src);
} }
this.detailImgList = srcArr; this.detailImgList = srcArr;
this.showPage = true;
} catch (error) { } catch (error) {
console.error(error); console.error(error);
} }
......
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
/> />
</div> </div>
</div> </div>
<bottom-nav v-if="showButtonNav" type="shoppingCar" :disabled="false" @buy="goVccOrDetail" /> <bottom-nav v-if="showButtonNav" :status="2" :disabled="false" @share="shareTo" />
</div> </div>
</template> </template>
<script> <script>
...@@ -135,7 +135,11 @@ export default { ...@@ -135,7 +135,11 @@ export default {
this.detailParam = { ...this.$route.query }; this.detailParam = { ...this.$route.query };
localStorage.set('activityId', this.detailParam.templateId); // 设置活动模板id,用于下单 localStorage.set('activityId', this.detailParam.templateId); // 设置活动模板id,用于下单
if (this.detailParam.groupBuyGroupId) { if (this.detailParam.groupBuyGroupId) {
localStorage.set('groupBuyGroupId', this.detailParam.groupBuyGroupId || ''); // 设置groupBuyGroupId,用于下单 localStorage.set('groupBuyGroupId', this.detailParam.groupBuyGroupId); // 设置groupBuyGroupId,用于下单
this.groupId = +this.detailParam.groupBuyGroupId;
} else {
localStorage.remove('groupBuyGroupId');
this.groupId = 0;
} }
this.name = this.$route.params; this.name = this.$route.params;
this.imgList = [this.name.goodsimg]; this.imgList = [this.name.goodsimg];
...@@ -151,6 +155,9 @@ export default { ...@@ -151,6 +155,9 @@ export default {
}, 5000); }, 5000);
}, },
methods: { methods: {
shareTo() {
// 分享
},
changeButtonVisible(res) { changeButtonVisible(res) {
this.showButtonNav = res; this.showButtonNav = res;
}, },
...@@ -165,6 +172,7 @@ export default { ...@@ -165,6 +172,7 @@ export default {
const [res] = await goods.detailInfo(detailParam); const [res] = await goods.detailInfo(detailParam);
if (res.groupBuyInfo.groupId) { if (res.groupBuyInfo.groupId) {
localStorage.set('groupBuyGroupId', res.groupBuyInfo.groupId || ''); // 设置groupBuyGroupId,用于下单 localStorage.set('groupBuyGroupId', res.groupBuyInfo.groupId || ''); // 设置groupBuyGroupId,用于下单
this.groupId = +res.groupBuyInfo.groupId || '';
} }
this.showShareButton = res.groupBuyInfo.groupBuyStatus == 1 ? true : false; this.showShareButton = res.groupBuyInfo.groupBuyStatus == 1 ? true : false;
this.imgList = res.imageUrl || []; this.imgList = res.imageUrl || [];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment