添加:商品添加购物协议

This commit is contained in:
wuhui_zzw 2024-03-30 18:29:38 +08:00
parent 1ff439d6c0
commit d8cb26547f
1 changed files with 106 additions and 4 deletions

View File

@ -389,6 +389,25 @@
<!--套餐产品弹窗-->
<discounts-goods ref="discounts" :id="id" :uid="uid"></discounts-goods>
</view>
<!-- 购物协议 -->
<uni-popup ref="agreePopup" type="bottom">
<view class="agree-content">
<view class="agreement">
<scroll-view style="height: 100%;" scroll-y="true">
<view v-html="buy_agreement"></view>
</scroll-view>
</view>
<view class="agree-btn">
<checkbox-group class="checkgroup" @change='is_agree=!is_agree'>
<checkbox class="checkbox" :checked="is_agree ? true : false" />
我已同意购物协议
</checkbox-group>
</view>
<view v-if="is_agree && Number(countdown_timer) <= 0" class="continue-shopping" @click="continueShopping">继续购物</view>
<view v-else class="continue-shopping not-btn">{{ Number(countdown_timer) > 0 ? countdown_timer : '继续购物' }}</view>
<view class="close-btn" @click="closeAgreePopup">关闭</view>
</view>
</uni-popup>
</view>
</template>
@ -584,6 +603,13 @@
url: '/pages/user/index'
},
],
//
buy_agreement: '',
countdown: 10,
is_agree: true,
news: {},
countdown_timer: 0,
intervalId: '',
};
},
computed:{
@ -1097,6 +1123,10 @@
that.$set(that.storeInfo, 'community', res.data.community);
that.$set(that.storeInfo, 'top_name', res.data.top_name);
that.$set(that.storeInfo, 'atmosphere_pic', res.data.atmosphere_pic);
//
that.$set(that, 'buy_agreement', res.data.buy_agreement ? (res.data.buy_agreement.content || '') : '');
if(that.buy_agreement) that.is_agree = false;
that.$set(that, 'countdown', res.data.countdown ? (Number(res.data.countdown) > 0 ? Number(res.data.countdown) : 10) : 10);
})
if (that.isLogin) {
that.downloadFilePromotionCode();
@ -1347,8 +1377,24 @@
* 加入购物车
*/
goCat: function(news) {
let that = this,
productSelect = that.productValue[this.attrValue];
let that = this;
//
if(!that.is_agree){
that.news = news;
that.$refs.agreePopup.open('bottom');
//
that.countdown_timer = that.countdown;
that.intervalId = setInterval(function () {
--that.countdown_timer;
if(that.countdown_timer <= 0){
if (that.intervalId) clearInterval(that.intervalId);
}
}, 1000); //
return false
}
//
let productSelect = that.productValue[this.attrValue];
//
if (that.attrValue) {
//
@ -1723,11 +1769,67 @@
uni.hideLoading();
}
});
}
},
//
continueShopping(){
this.closeAgreePopup();
this.goCat(this.news);
},
closeAgreePopup(){
this.$refs.agreePopup.close();
}
}
}
</script>
<style lang="scss" scoped>
.agree-content{
height: 80vh!important;
border-top-left-radius: 30rpx!important;
border-top-right-radius: 30rpx!important;
background: #ffffff;
padding: 50rpx 25rpx 50rpx 25rpx;
position: relative;
.agreement{
width: 100%;
overflow: auto;
height: calc(100% - 50rpx - (15rpx * 2) - 80rpx);
}
.agree-btn{
width: 100%;
height: 50rpx;
display: inline-flex;
flex-direction: row;
flex-wrap: nowrap;
align-items: center;
justify-content: flex-start;
font-size: 30rpx;
margin: 15rpx 0!important;
}
.continue-shopping{
width: 100%;
text-align: center;
font-size: 35rpx;
height: 80rpx;
line-height: 80rpx;
border-radius: 100rpx;
background: #8e1318;
color: #f4dede;
}
.not-btn{
background-color: #909399!important;
color: #fff!important;
}
.close-btn{
position: absolute;
top: 0;
right: 0;
height: 50rpx;
line-height: 50rpx;
font-size: 28rpx;
width: 100rpx;
text-align: center;
}
}
.ml8{
top:2rpx
}
@ -1831,7 +1933,7 @@
height: calc(100rpx+ constant(safe-area-inset-bottom)); /// IOS<11.2/
height: calc(100rpx + env(safe-area-inset-bottom)); /// IOS>11.2/
background-color: #fff;
z-index: 277;
z-index: 1;
border-top: 1px solid #f0f0f0;
}
.product-con .footer .item {