|
|
@@ -17,6 +17,7 @@ import { getConfigByCode } from '@/api/common'
|
|
|
import { pendingRedDots } from '@/api/order'
|
|
|
import { getWalletAccountInfo } from '@/api/wallet'
|
|
|
import { t } from '@/locale'
|
|
|
+import i18n from '@/locale/index'
|
|
|
import { useUserStore } from '@/store/user'
|
|
|
import { formatNumber } from '@/utils'
|
|
|
import { toPage } from '@/utils/page'
|
|
|
@@ -43,21 +44,45 @@ const isLoggedIn = computed(() => !!userStore.token)
|
|
|
// 获取用户信息
|
|
|
const userInfo = computed(() => userStore.userInfo)
|
|
|
|
|
|
-const groupList = ref([
|
|
|
- { name: t('mine.group.toPay'), url: `/pages/myOrders/myOrders`, dotName: 'toPayNum', type: 1, icon: '/static/icons/to-pay.png' },
|
|
|
- { name: t('mine.group.success'), url: `/pages/myOrders/myOrders`, type: 2, dotName: 'successNum', icon: '/static/icons/success.png' },
|
|
|
- { name: t('mine.group.failed'), url: `/pages/myOrders/myOrders`, type: 3, dotName: 'failedNum', icon: '/static/icons/failed.png' },
|
|
|
- { name: t('mine.group.reward'), url: `/pages/myOrders/myOrders`, type: 4, dotName: 'rewardNum', icon: '/static/icons/reward.png' },
|
|
|
-])
|
|
|
+const groupList = computed(() => {
|
|
|
+ // 依赖 locale,确保切换语言后这里会重新计算
|
|
|
+ const _locale = i18n.global.locale
|
|
|
+ void _locale
|
|
|
+ return [
|
|
|
+ { name: t('mine.group.toPay'), url: `/pages/myOrders/myOrders`, dotName: 'toPayNum', type: 1, icon: '/static/icons/to-pay.png' },
|
|
|
+ { name: t('mine.group.success'), url: `/pages/myOrders/myOrders`, type: 2, dotName: 'successNum', icon: '/static/icons/success.png' },
|
|
|
+ { name: t('mine.group.failed'), url: `/pages/myOrders/myOrders`, type: 3, dotName: 'failedNum', icon: '/static/icons/failed.png' },
|
|
|
+ { name: t('mine.group.reward'), url: `/pages/myOrders/myOrders`, type: 4, dotName: 'rewardNum', icon: '/static/icons/reward.png' },
|
|
|
+ ]
|
|
|
+})
|
|
|
+
|
|
|
+const menuList = computed(() => {
|
|
|
+ const _locale = i18n.global.locale
|
|
|
+ void _locale
|
|
|
+ return [
|
|
|
+ { name: t('mine.menu.profile'), url: '/pages/mine/myProfile', icon: '/static/icons/my-profile.png' },
|
|
|
+ { name: t('mine.menu.address'), url: '/pages/mine/addressBook', icon: '/static/icons/address-book.png' },
|
|
|
+ { name: t('mine.menu.share'), url: '/pages/mine/share', icon: '/static/icons/share.png' },
|
|
|
+ { name: t('mine.menu.favorite'), url: '/pages/mine/myFavorite', icon: '/static/icons/my-favorite.png' },
|
|
|
+ { name: t('mine.menu.chat'), config: 'live_chat', icon: '/static/icons/live-chat.png' },
|
|
|
+ { name: t('mine.menu.activity'), config: 'activity_group', icon: '/static/icons/activity-group.png' },
|
|
|
+ ]
|
|
|
+})
|
|
|
+
|
|
|
+function getPlusRuntime() {
|
|
|
+ const p = (globalThis as any)?.plus
|
|
|
+ return p?.runtime
|
|
|
+}
|
|
|
|
|
|
-const menuList = ref([
|
|
|
- { name: t('mine.menu.profile'), url: '/pages/mine/myProfile', icon: '/static/icons/my-profile.png' },
|
|
|
- { name: t('mine.menu.address'), url: '/pages/mine/addressBook', icon: '/static/icons/address-book.png' },
|
|
|
- { name: t('mine.menu.share'), url: '/pages/mine/share', icon: '/static/icons/share.png' },
|
|
|
- { name: t('mine.menu.favorite'), url: '/pages/mine/myFavorite', icon: '/static/icons/my-favorite.png' },
|
|
|
- { name: t('mine.menu.chat'), config: 'live_chat', icon: '/static/icons/live-chat.png' },
|
|
|
- { name: t('mine.menu.activity'), config: 'activity_group', icon: '/static/icons/activity-group.png' },
|
|
|
-])
|
|
|
+function openH5WhatsApp(config: string, value: string = '') {
|
|
|
+ const phone = (value || '').replace(/\s+/g, '')
|
|
|
+ const url = config === 'activity_group'
|
|
|
+ ? `https://chat.whatsapp.com/${encodeURIComponent(value || '')}`
|
|
|
+ : `https://wa.me/${encodeURIComponent(phone)}`
|
|
|
+
|
|
|
+ if (typeof window !== 'undefined' && typeof window.open === 'function')
|
|
|
+ window.open(url, '_blank')
|
|
|
+}
|
|
|
async function getConfig(code: string) {
|
|
|
try {
|
|
|
let value = ''
|
|
|
@@ -91,12 +116,18 @@ async function menuClick(item: any) {
|
|
|
}
|
|
|
// 跳转whatsapp
|
|
|
function openWhatsApp(config: string, value: string = '') {
|
|
|
+ const runtime = getPlusRuntime()
|
|
|
+ if (!runtime) {
|
|
|
+ openH5WhatsApp(config, value)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
// 判断手机是否安装whatsapp
|
|
|
// pname:Android 需要查询的包名 action:ios 需要查询的 URL Scheme
|
|
|
const pname = 'com.whatsapp'
|
|
|
|
|
|
// installed ture:安装 false:未安装
|
|
|
- const installed = plus.runtime.isApplicationExist({
|
|
|
+ const installed = runtime.isApplicationExist({
|
|
|
pname,
|
|
|
action: 'whatsapp://',
|
|
|
})
|
|
|
@@ -104,19 +135,19 @@ function openWhatsApp(config: string, value: string = '') {
|
|
|
// whatsapp包名
|
|
|
|
|
|
// 判断手机系统,走不同方法
|
|
|
- if (plus.os.name === 'Android') {
|
|
|
+ if ((globalThis as any)?.plus?.os?.name === 'Android') {
|
|
|
if (installed) {
|
|
|
// 手机已安装 直接跳转
|
|
|
if (config === 'live_chat') {
|
|
|
- plus.runtime.openURL(`whatsapp://send?phone=${value}`)
|
|
|
+ runtime.openURL(`whatsapp://send?phone=${value}`)
|
|
|
}
|
|
|
else if (config === 'activity_group') {
|
|
|
- plus.runtime.openURL(`https://chat.whatsapp.com/${value}`)
|
|
|
+ runtime.openURL(`https://chat.whatsapp.com/${value}`)
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
// 手机未安装,跳转到手机商城并搜索whatsapp (国内目前搜不到)
|
|
|
- plus.nativeUI.actionSheet(
|
|
|
+ ;(globalThis as any).plus.nativeUI.actionSheet(
|
|
|
{
|
|
|
title: '选择应用',
|
|
|
cancel: '取消',
|
|
|
@@ -125,11 +156,11 @@ function openWhatsApp(config: string, value: string = '') {
|
|
|
({ index }) => {
|
|
|
switch (index) {
|
|
|
case 1:
|
|
|
- plus.runtime.openURL(
|
|
|
+ runtime.openURL(
|
|
|
`market://details?id=${pname}`,
|
|
|
() => {
|
|
|
// 手机没有应用市场
|
|
|
- plus.nativeUI.alert('本机未安装指定的应用')
|
|
|
+ ;(globalThis as any).plus.nativeUI.alert('本机未安装指定的应用')
|
|
|
},
|
|
|
)
|
|
|
}
|
|
|
@@ -176,7 +207,7 @@ onShow(() => {
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
- <z-paging ref="paging" refresher-only use-page-scroll @refresh="handleRefresh">
|
|
|
+ <z-paging ref="paging" use-page-scroll refresher-only @refresh="handleRefresh">
|
|
|
<view
|
|
|
class="flex items-center justify-between bg-[rgba(var(--wot-color-theme-rgb),0.3)] pb-72rpx pl-24rpx pr-54rpx"
|
|
|
:style="{ paddingTop: `${safeAreaInsets?.top + 24}px` }"
|