Files
lucky_shop/pages_tool/member/public/js/member-public.js
ZF sun 8e218bb663 feat: 新增多语言国际化页面配置,修复部分页面硬编码文案
1. 新增了zh-cn和en-us两套语言下的大量页面国际化配置文件,覆盖商品、订单、会员、营销活动等多个业务模块
2. 修复了分销页面、VR页面、支付页面、商品不存在页面的硬编码提示文案,替换为国际化调用
3. 删除了原有的i18n检查脚本文件
2026-06-25 11:00:50 +08:00

91 lines
2.5 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
export default {
methods: {
// 清除登录态(token / 用户信息 / 购物车 / 本地存储)
clearLoginState() {
this.$store.commit('setToken', '');
this.$store.commit('setMemberInfo', '');
this.$store.dispatch('emptyCart');
uni.removeStorageSync('authInfo');
uni.removeStorageSync('privacyAgreed');
},
// 退出登录
logout() {
uni.showModal({
title: this.$lang('logoutTitle'),
content: this.$lang('logoutContent'),
success: (res) => {
if (res.confirm) {
this.clearLoginState();
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL);
}
}
});
},
// 账号注销入口:先查状态,根据状态分流
cancellation() {
this.getCancelStatus();
},
// 查询注销状态并跳转对应页面
// status: undefined/null → 未申请 → 协议页 cancellation.vue
// status: 0 → 审核中 → 状态页 cancelstatus.vue
// status: 1 → 通过 → 成功页 cancelsuccess.vue
// status: -1 → 拒绝 → 拒绝页 cancelrefuse.vue
getCancelStatus() {
this.$api.sendRequest({
url: '/membercancel/api/membercancel/info',
success: res => {
if (res.code >= 0) {
if (res.data) {
if (res.data.status == 0) {
this.$util.redirectTo('/pages_tool/member/cancelstatus');
} else if (res.data.status == 1) {
this.$util.redirectTo('/pages_tool/member/cancelsuccess');
} else {
this.$util.redirectTo('/pages_tool/member/cancelrefuse');
}
} else {
this.$util.redirectTo('/pages_tool/member/cancellation');
}
} else if (res.code == -1) {
this.clearLoginState();
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL);
}
}
});
},
// 提交注销申请并清理登录态(供 assets.vue 等页面调用)
submitCancelApply(options = {}) {
uni.showModal({
title: options.title || '风险提示',
content: options.content || '确定要注销当前账号吗?',
confirmColor: '#000000',
success: res => {
if (res.confirm) {
this.$api.sendRequest({
url: '/membercancel/api/membercancel/apply',
success: rres => {
if (rres.code >= 0) {
if (options.clearStateAndRedirect) {
this.clearLoginState();
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL);
} else {
this.$util.redirectTo('/pages_tool/member/cancelstatus');
}
} else {
this.$util.showToast({
title: rres.message
});
}
}
});
}
}
});
}
}
};