From d8cb26547f2eb5137b43af39172a672e7e7d2068 Mon Sep 17 00:00:00 2001
From: wuhui_zzw <1760308791@qq.com>
Date: Sat, 30 Mar 2024 18:29:38 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=EF=BC=9A=E5=95=86=E5=93=81?=
=?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=B4=AD=E7=89=A9=E5=8D=8F=E8=AE=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pages/goods_details/index.vue | 110 ++++++++++++++++++++++++++++++++--
1 file changed, 106 insertions(+), 4 deletions(-)
diff --git a/pages/goods_details/index.vue b/pages/goods_details/index.vue
index e17fa03..61ee2e1 100644
--- a/pages/goods_details/index.vue
+++ b/pages/goods_details/index.vue
@@ -389,6 +389,25 @@
+
+
+
+
+
+
+
+
+
+
+
+ 我已同意《购物协议》
+
+
+ 继续购物
+ {{ Number(countdown_timer) > 0 ? countdown_timer : '继续购物' }}
+ 关闭
+
+
@@ -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();
+ }
}
}