Commit dc644d71 authored by Xuguangxing's avatar Xuguangxing

feat: 增加订阅后的接口调用

parent 9a12f320
<template>
<div class="goods-bottom">
<template v-if="groupId">
<cr-button
class="mutiplie"
plain
type="primary"
shape="circle"
:disabled="disabled"
@click="createGroup"
>自己做团长</cr-button
>
<cr-button
class="mutiplie"
shape="circle"
:disabled="disabled"
type="primary"
block
@click="joinGroup"
>
立即参团
</cr-button>
<template v-if="status == 1">
<template v-if="groupId">
<cr-button
class="mutiplie"
plain
type="primary"
shape="circle"
:disabled="disabled"
@click="createOrJoin"
>自己做团长</cr-button
>
<cr-button
class="mutiplie"
shape="circle"
:disabled="disabled"
type="primary"
block
@click="createOrJoin"
>
立即参团
</cr-button>
</template>
<template v-else>
<cr-button shape="circle" :disabled="disabled" type="primary" block @click="createOrJoin">
立即开团
</cr-button>
</template>
</template>
<template v-else>
<cr-button shape="circle" :disabled="disabled" type="primary" block @click="createGroup">
立即开团
<cr-button shape="circle" :disabled="disabled" type="primary" block @click="shareTo">
邀请好友
</cr-button>
</template>
</div>
......@@ -35,16 +42,8 @@ export default {
mixins: [goodsCheckMixin],
props: {
groupId: {
type: String,
default: ''
},
type: {
type: String,
default: 'shopCar' // shoppingCar 购物车;settlement 结算;submitOrder 确认订单
},
shopBtnName: {
type: String,
default: '立即购买' // shoppingCar 购物车;settlement 结算;submitOrder 确认订单
type: Number,
default: 0
},
info: {
type: Object,
......@@ -62,7 +61,7 @@ export default {
},
status: {
type: Number,
default: 2
default: 1 // 1是大图详情页, 2是小图详情页
}
},
data() {
......@@ -71,18 +70,13 @@ export default {
};
},
methods: {
joinGroup() {
// 参团
if (this.checkLogin()) {
// todo
return;
}
this.$emit('buy');
shareTo() {
// 邀请好友
this.$emit('share');
},
createGroup() {
//
createOrJoin() {
//
if (this.checkLogin()) {
// todo
return;
}
this.$emit('buy');
......
......@@ -13,9 +13,11 @@
</p>
</template>
</div>
<div v-if="groupInfo.groupBuyStatus == 1" class="gourp-rules">
<p>成团条件:{{ groupInfo.groupBuyCondition || '' }}</p>
<cr-image src="@/assets/images/flag.png" width="13px" />
<div class="gourp-rules">
<template v-if="groupInfo.groupBuyStatus == 1 || groupInfo.groupBuyStatus == 0">
<p>成团条件:{{ groupInfo.groupBuyCondition || '' }}</p>
<cr-image src="@/assets/images/flag.png" width="13px" />
</template>
<!-- </template> -->
</div>
<div v-if="showButtonGroup" ref="buttonArea" class="button-area">
......@@ -54,6 +56,7 @@ export default {
return {
observer: null,
statusTextMap: {
0: '发起拼团,邀请好友一起拼团吧!',
2: '恭喜成团,等待发货!',
3: '哎呀,拼团时间已过,尚未成团!',
4: '已发货'
......@@ -98,7 +101,7 @@ export default {
display: flex;
justify-content: center;
align-items: center;
margin-bottom: @padding-unit;
margin-bottom: @padding-xs;
.desc {
margin-right: @padding-unit;
span {
......
......@@ -222,7 +222,7 @@ export default {
inProgress: false, // 活动是否已经开始
countDownText: '',
showPage: false, // 是否显示页面,当查询完团与人的关系后进行处理,如果用户已经参与了此商品此活动的团,navigateto small else showpage = true
groupId: '', // 团id
groupId: 0, // 团id
// 以下是原有的data
detailParam: {
skuNo: '',
......@@ -264,8 +264,11 @@ export default {
this.detailParam = { ...this.$route.query };
localStorage.set('activityId', this.detailParam.templateId); // 设置活动模板id,用于下单
if (this.detailParam.groupBuyGroupId) {
localStorage.set('groupBuyGroupId', this.detailParam.groupBuyGroupId || ''); // 设置groupBuyGroupId,用于下单
this.groupId = this.detailParam.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.init(this.detailParam);
......@@ -298,7 +301,6 @@ export default {
this.groupTimestemp = data.groupBuyInfo.currentGroupEndTime
? new Date(data.groupBuyInfo.currentGroupEndTime).getTime()
: -1;
console.log(currentTime, activityStartTime, activityEndTime);
if (currentTime <= activityStartTime) {
// 当前时间小于活动开始时间
this.timestemp = activityStartTime;
......@@ -323,7 +325,7 @@ export default {
const [res] = await goods.detailInfo(detailParam);
if (res.groupBuyInfo.groupId) {
localStorage.set('groupBuyGroupId', res.groupBuyInfo.groupId || ''); // 设置groupBuyGroupId,用于下单
this.groupId = res.groupBuyInfo.groupId || '';
this.groupId = +res.groupBuyInfo.groupId || 0;
}
if (res.groupBuyInfo?.joinGroup) {
const query = { ...this.$route.query };
......@@ -332,6 +334,7 @@ export default {
this.imgList = res.imageUrl || [];
this.detailInfo = res;
this.setStartStatus(res);
this.showPage = true;
try {
const detailImages = await goods.getDetailPic(this.detailInfo.contentDetailUrl);
// const imgReg = new RegExp('(?<=src=").[^"]*', 'g');
......@@ -346,7 +349,6 @@ export default {
srcArr.push(src);
}
this.detailImgList = srcArr;
this.showPage = true;
} catch (error) {
console.error(error);
}
......
......@@ -85,7 +85,7 @@
/>
</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>
</template>
<script>
......@@ -135,7 +135,11 @@ export default {
this.detailParam = { ...this.$route.query };
localStorage.set('activityId', this.detailParam.templateId); // 设置活动模板id,用于下单
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.imgList = [this.name.goodsimg];
......@@ -151,6 +155,9 @@ export default {
}, 5000);
},
methods: {
shareTo() {
// 分享
},
changeButtonVisible(res) {
this.showButtonNav = res;
},
......@@ -165,6 +172,7 @@ export default {
const [res] = await goods.detailInfo(detailParam);
if (res.groupBuyInfo.groupId) {
localStorage.set('groupBuyGroupId', res.groupBuyInfo.groupId || ''); // 设置groupBuyGroupId,用于下单
this.groupId = +res.groupBuyInfo.groupId || '';
}
this.showShareButton = res.groupBuyInfo.groupBuyStatus == 1 ? true : false;
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