提交
This commit is contained in:
parent
e5b33085bd
commit
2b2c834c59
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
<!-- 内容区域 -->
|
||||
<scroll-view class="notice-content" scroll-y>
|
||||
<view v-html="ruleData.content"></view>
|
||||
<rich-text :nodes="ruleData.content"></rich-text>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
|
|
@ -24,11 +24,8 @@
|
|||
<!-- 不再提示选项 -->
|
||||
<view class="remember-option">
|
||||
<view class="checkbox" @click="isAgree = !isAgree">
|
||||
<image class="checkbox-icon" :src="isAgree ? $img1('common/check_act.png') : $img1('common/check.png')
|
||||
" lazy-load></image>
|
||||
<text class="checkbox-text">{{
|
||||
getPurchasePopup() ? "今日不再弹出消费规则" : "不再弹出消费规则"
|
||||
}}</text>
|
||||
<image class="checkbox-icon" :src="isAgree ? $img1('common/check_act.png') : $img1('common/check.png')" lazy-load></image>
|
||||
<text class="checkbox-text">{{ checkboxText }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
|
|
@ -37,6 +34,7 @@
|
|||
<script>
|
||||
export default {
|
||||
name: "BuyNotice",
|
||||
|
||||
data() {
|
||||
return {
|
||||
isAgree: false,
|
||||
|
|
@ -46,17 +44,33 @@ export default {
|
|||
},
|
||||
};
|
||||
},
|
||||
|
||||
computed: {
|
||||
/**
|
||||
* 根据配置返回不同的复选框文本
|
||||
*/
|
||||
checkboxText() {
|
||||
return this.getPurchasePopup()
|
||||
? "今日不再弹出消费规则"
|
||||
: "不再弹出消费规则";
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
/**
|
||||
* 获取消费弹窗配置
|
||||
* @returns {Boolean} 是否启用今日不再弹出配置
|
||||
*/
|
||||
getPurchasePopup() {
|
||||
try {
|
||||
var _purchase_popup = this.$config.getAppSetting("purchase_popup");
|
||||
if (_purchase_popup != null && _purchase_popup === "1") {
|
||||
return true;
|
||||
}
|
||||
} catch (error) { }
|
||||
return false;
|
||||
const purchasePopup = this.$config.getAppSetting("purchase_popup");
|
||||
return purchasePopup !== null && purchasePopup === "1";
|
||||
} catch (error) {
|
||||
console.error("获取消费弹窗配置异常:", error);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 确认按钮点击处理
|
||||
*/
|
||||
|
|
@ -65,17 +79,27 @@ export default {
|
|||
|
||||
// 如果用户选择不再提示,则保存到本地存储
|
||||
if (this.isAgree) {
|
||||
if (this.getPurchasePopup()) {
|
||||
uni.setStorageSync("_agree_buy_notice_time", new Date().toLocaleDateString());
|
||||
uni.setStorageSync("_agree_buy_notice", 2);
|
||||
} else {
|
||||
uni.setStorageSync("_agree_buy_notice_time", "");
|
||||
uni.setStorageSync("_agree_buy_notice", 1);
|
||||
}
|
||||
this.saveAgreementState();
|
||||
}
|
||||
|
||||
// 触发确认事件
|
||||
this.$emit("confirm");
|
||||
},
|
||||
|
||||
/**
|
||||
* 保存用户协议状态
|
||||
*/
|
||||
saveAgreementState() {
|
||||
if (this.getPurchasePopup()) {
|
||||
// 保存为当天不再显示
|
||||
uni.setStorageSync("_agree_buy_notice_time", new Date().toLocaleDateString());
|
||||
uni.setStorageSync("_agree_buy_notice", 2);
|
||||
} else {
|
||||
// 保存为永久不再显示
|
||||
uni.setStorageSync("_agree_buy_notice_time", "");
|
||||
uni.setStorageSync("_agree_buy_notice", 1);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 关闭弹窗
|
||||
|
|
@ -92,28 +116,34 @@ export default {
|
|||
this.ruleData = opt;
|
||||
this.$refs._buy_notice.open();
|
||||
},
|
||||
|
||||
/**
|
||||
* 检查是否需要显示弹窗
|
||||
* @returns {Boolean} 是否显示弹窗
|
||||
*/
|
||||
getIsShow() {
|
||||
var _agree_buy_notice = uni.getStorageSync("_agree_buy_notice")
|
||||
if (_agree_buy_notice == null || _agree_buy_notice == "") {
|
||||
const agreeBuyNotice = uni.getStorageSync("_agree_buy_notice");
|
||||
|
||||
// 如果没有保存协议状态,则显示
|
||||
if (!agreeBuyNotice) {
|
||||
return true;
|
||||
}
|
||||
//判断是否配置了今天不在弹出
|
||||
|
||||
// 判断是否配置了今天不再弹出
|
||||
if (this.getPurchasePopup()) {
|
||||
//判断时间
|
||||
var newd = new Date().toLocaleDateString();
|
||||
let _agree_buy_notice_time = uni.getStorageSync("_agree_buy_notice_time");
|
||||
if (_agree_buy_notice_time == newd) {
|
||||
//今日弹出
|
||||
// 判断时间是否为今天
|
||||
const today = new Date().toLocaleDateString();
|
||||
const agreedTime = uni.getStorageSync("_agree_buy_notice_time");
|
||||
|
||||
// 如果今天已经同意过,则不显示
|
||||
if (agreedTime === today) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (_agree_buy_notice == 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
} else if (agreeBuyNotice == 1) {
|
||||
// 如果永久不再显示,则不显示
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user