export default {
    data() {
        return {
            showServicePopup: false,
            showLogoutPopup: false
        }
    },
    methods: {
        navToSettings() {
            uni.navigateTo({
                url: '/pages/mine/settings/index'
            });
        },
        navToProfile() {
            uni.navigateTo({
                url: '/pages/mine/settings/profile/index'
            });
        },
        navToLevel() {
            uni.navigateTo({
                url: '/pages/mine/level/index'
            });
        },
        navToNotification() {
            uni.navigateTo({
                url: '/pages/mine/message/index'
            });
        },
        navToWallet() {
            uni.navigateTo({
                url: '/pages/mine/wallet/index'
            });
        },
        navToPoints() {
            uni.navigateTo({
                url: '/pages/mine/points/index'
            });
        },
        navToOrderStats() {
            uni.navigateTo({
                url: '/pages/mine/order-stats'
            });
        },
        navToRewards() {
            uni.navigateTo({
                url: '/pages/mine/rewards'
            });
        },
        openServicePopup() {
            this.showServicePopup = true;
        },
        closeServicePopup() {
            this.showServicePopup = false;
        },
        previewQRCode() {
            uni.previewImage({
                urls: ['/static/logo.png']
            });
        },
        openOnlineService() {
            // 模拟跳转企业微信客服
            uni.showToast({
                title: '正在跳转企业微信客服...',
                icon: 'none'
            });
        },
        callServicePhone() {
            uni.makePhoneCall({
                phoneNumber: '400-123-4567'
            });
        },
        logout() {
            this.showLogoutPopup = true;
        },
        cancelLogout() {
            this.showLogoutPopup = false;
        },
        confirmLogout() {
            this.showLogoutPopup = false;
            // 跳转到登录页，使用 reLaunch 关闭所有页面
            uni.reLaunch({
                url: '/pages/login/login'
            });
        }
    }
}
