浏览代码

Merge branch 'development'

liangan 2 周之前
父节点
当前提交
22fbf97e78

+ 2 - 0
src/locale/bn.json

@@ -146,6 +146,8 @@
   "mine.pages.share.copySuccess": "ক্লিপবোর্ডে অনুলিপি করা হয়েছে",
   "mine.pages.share.shareTo": "{0} এ শেয়ার করুন",
   "share.appNotInstalled": "শেয়ারিং সক্ষম করতে অ্যাপ ডাউনলোড করুন",
+  "share.productShareText": "[BandhuBuy] {url} {productName}\nএখনই BandhuBuy থেকে কিনুন!",
+  "share.inviteShareText": "[BandhuBuy] {url} আপনার বন্ধু আপনাকে নিবন্ধন করতে আমন্ত্রণ জানিয়েছে",
   "mine.pages.myFavorite.title": "আমার পছন্দ",
   "mine.pages.myFavorite.empty": "এখনও পছন্দ নেই",
   "wallet.withdraw.title": "উত্তোলন",

+ 2 - 0
src/locale/en.json

@@ -171,6 +171,8 @@
   "mine.pages.share.copySuccess": "Copied to clipboard",
   "mine.pages.share.shareTo": "Share to {0}",
   "share.appNotInstalled": "Please download the APP to enable sharing",
+  "share.productShareText": "[BandhuBuy] {url} {productName}\nGet it on BandhuBuy now!",
+  "share.inviteShareText": "[BandhuBuy] {url} Your friend invited you to register",
   "mine.pages.myFavorite.title": "My Favorite",
   "mine.pages.myFavorite.empty": "No favorites yet",
   "auth.login.title": "Login",

+ 2 - 0
src/locale/zh-Hans.json

@@ -146,6 +146,8 @@
   "mine.pages.share.copySuccess": "已复制到剪贴板",
   "mine.pages.share.shareTo": "分享到{0}",
   "share.appNotInstalled": "请下载APP以启用分享功能",
+  "share.productShareText": "[BandhuBuy] {url} {productName}\n快来 BandhuBuy 购买吧!",
+  "share.inviteShareText": "[BandhuBuy] {url} 你的好友邀请你注册",
   "mine.pages.myFavorite.title": "我的收藏",
   "mine.pages.myFavorite.empty": "暂无收藏",
   "wallet.withdraw.title": "提现",

+ 53 - 22
src/pages/mine/mine.vue

@@ -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` }"

+ 27 - 6
src/pages/mine/myProfile.vue

@@ -29,8 +29,9 @@ const uploading = ref(false)
 // 更新头像
 async function updateAvatar() {
   try {
-    // 使用 uni.chooseMedia 选择图片
+    // 微信小程序从基础库 2.21.0 开始,wx.chooseImage 停止维护,请使用 uni.chooseMedia 代替。
     const res: any = await new Promise((resolve, reject) => {
+      // #ifdef MP-WEIXIN
       uni.chooseMedia({
         count: 1,
         mediaType: ['image'],
@@ -38,18 +39,38 @@ async function updateAvatar() {
         success: resolve,
         fail: reject,
       })
+      // #endif
+
+      // #ifndef MP-WEIXIN
+      uni.chooseImage({
+        count: 1,
+        sourceType: ['album', 'camera'],
+        success: resolve,
+        fail: reject,
+      })
+      // #endif
     })
 
-    if (!res.tempFiles || res.tempFiles.length === 0) {
+    let tempFilePath = ''
+    let size = 0
+
+    // #ifdef MP-WEIXIN
+    if (!res.tempFiles || res.tempFiles.length === 0)
       return
-    }
+    tempFilePath = res.tempFiles[0].tempFilePath
+    size = res.tempFiles[0].size
+    // #endif
 
-    const tempFile = res.tempFiles[0]
-    const tempFilePath = tempFile.tempFilePath
+    // #ifndef MP-WEIXIN
+    if (!res.tempFilePaths || res.tempFilePaths.length === 0)
+      return
+    tempFilePath = res.tempFilePaths[0]
+    size = res.tempFiles?.[0]?.size || 0
+    // #endif
 
     // 检查文件大小(限制为5MB)
     const maxSize = 5 * 1024 * 1024
-    if (tempFile.size > maxSize) {
+    if (size > maxSize) {
       toast.error(t('myProfile.upload.sizeLimit'))
       return
     }

+ 8 - 1
src/pages/mine/setting.vue

@@ -18,7 +18,14 @@ defineOptions({
   name: 'Setting', // 设置
 })
 const userStore = useUserStore()
-const columns = ref([{ label: t('setting.lang.en'), value: 'en' }, { label: t('setting.lang.bn'), value: 'bn' }])
+const columns = computed(() => {
+  const _locale = i18n.global.locale
+  void _locale
+  return [
+    { label: t('setting.lang.en'), value: 'en' },
+    { label: t('setting.lang.bn'), value: 'bn' },
+  ]
+})
 const language = ref(uni.getLocale() === 'bn' ? 'bn' : 'en')
 function changeLanguage(data: any) {
   console.log(data)

+ 58 - 3
src/pages/mine/share.vue

@@ -23,6 +23,33 @@ const safeAreaInsets = systemInfo.safeAreaInsets
 const userStore = useUserStore()
 const baseUrl = import.meta.env.VITE_H5_BASE_URL
 
+function getPlusRuntime() {
+  const p = (globalThis as any)?.plus
+  return p?.runtime
+}
+
+function isH5ShareSupported() {
+  return typeof navigator !== 'undefined' && typeof (navigator as any).share === 'function'
+}
+
+function openH5ShareTarget(platform: string) {
+  const { url, text } = generateInviteShareLink()
+
+  const targets: Record<string, string> = {
+    facebook: `https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(url)}`,
+    whatsapp: `https://wa.me/?text=${encodeURIComponent(text)}`,
+    twitter: `https://twitter.com/intent/tweet?text=${encodeURIComponent(text)}`,
+    instagram: 'https://www.instagram.com/',
+  }
+
+  const targetUrl = targets[platform]
+  if (!targetUrl)
+    return
+
+  if (typeof window !== 'undefined' && typeof window.open === 'function')
+    window.open(targetUrl, '_blank')
+}
+
 // 推荐码
 const userInfo = computed(() => getUserInfoHook())
 const qrcodeConfig = ref<any>({
@@ -74,7 +101,9 @@ function generateInviteShareLink() {
   const inviteUrl = `${baseUrl}?referrer=${userInfo.value.invitedCode}`
 
   // 分享文案格式:[BandhuBuy] + 邀请注册链接 + 邀请文案
-  const shareText = `[BandhuBuy] ${inviteUrl} Your friend invited you to register`
+  const shareText = t('share.inviteShareText', {
+    url: inviteUrl,
+  })
 
   return {
     url: inviteUrl,
@@ -84,6 +113,10 @@ function generateInviteShareLink() {
 
 // 检查APP是否安装
 function checkAppInstalled(platform: string): boolean {
+  const runtime = getPlusRuntime()
+  if (!runtime)
+    return false
+
   const appSchemes = {
     facebook: { pname: 'com.facebook.katana', scheme: 'fb://' },
     whatsapp: { pname: 'com.whatsapp', scheme: 'whatsapp://' },
@@ -95,7 +128,7 @@ function checkAppInstalled(platform: string): boolean {
   if (!appInfo)
     return false
 
-  return plus.runtime.isApplicationExist({
+  return runtime.isApplicationExist({
     pname: appInfo.pname,
     action: appInfo.scheme,
   })
@@ -105,6 +138,23 @@ function checkAppInstalled(platform: string): boolean {
 function openSocialApp(platform: string) {
   const { url, text } = generateInviteShareLink()
 
+  const runtime = getPlusRuntime()
+  if (!runtime) {
+    if (isH5ShareSupported()) {
+      ;(navigator as any).share({
+        title: 'BandhuBuy',
+        text,
+        url,
+      }).catch(() => {
+        openH5ShareTarget(platform)
+      })
+    }
+    else {
+      openH5ShareTarget(platform)
+    }
+    return
+  }
+
   // 先复制分享内容到剪贴板
   uni.setClipboardData({
     data: text,
@@ -122,7 +172,7 @@ function openSocialApp(platform: string) {
 
   const shareUrl = shareUrls[platform]
   if (shareUrl) {
-    plus.runtime.openURL(shareUrl, (error) => {
+    runtime.openURL(shareUrl, (error: any) => {
       console.error('打开APP失败:', error)
       toast.info(t('share.appNotInstalled'))
     })
@@ -131,6 +181,11 @@ function openSocialApp(platform: string) {
 
 // 统一分享处理方法
 function handleShare(platform: string) {
+  if (!getPlusRuntime()) {
+    openSocialApp(platform)
+    return
+  }
+
   // 检查APP是否安装
   if (!checkAppInstalled(platform)) {
     toast.info(t('share.appNotInstalled'))

+ 25 - 20
src/pages/missionCenter/missionCenter.vue

@@ -12,6 +12,7 @@
 <script lang="ts" setup>
 import { clockIn, todayDetail } from '@/api/mine'
 import { t } from '@/locale'
+import i18n from '@/locale/index'
 import { toPage } from '@/utils/page'
 import { toast } from '@/utils/toast'
 
@@ -19,26 +20,30 @@ defineOptions({
   name: 'MissionCenter', // 任务中心
 })
 
-const dailyMission = ref<any>([
-  {
-    name: t('missionCenter.dailyMission.inviteFriends.name'),
-    description: t('missionCenter.dailyMission.inviteFriends.description'),
-    icon: '/static/icons/invite-friends.png',
-    url: '/pages/referEarn/referEarn',
-  },
-  {
-    name: t('missionCenter.dailyMission.openGroupBuy.name'),
-    description: t('missionCenter.dailyMission.openGroupBuy.description'),
-    icon: '/static/icons/open-group-buy.png',
-    url: '/pages/bestSellers/bestSellers',
-  },
-  {
-    name: t('missionCenter.dailyMission.joinGroupBuy.name'),
-    description: t('missionCenter.dailyMission.joinGroupBuy.description'),
-    icon: '/static/icons/join-group-buy.png',
-    url: '/pages/bestSellers/bestSellers',
-  },
-])
+const dailyMission = computed(() => {
+  const _locale = i18n.global.locale
+  void _locale
+  return [
+    {
+      name: t('missionCenter.dailyMission.inviteFriends.name'),
+      description: t('missionCenter.dailyMission.inviteFriends.description'),
+      icon: '/static/icons/invite-friends.png',
+      url: '/pages/referEarn/referEarn',
+    },
+    {
+      name: t('missionCenter.dailyMission.openGroupBuy.name'),
+      description: t('missionCenter.dailyMission.openGroupBuy.description'),
+      icon: '/static/icons/open-group-buy.png',
+      url: '/pages/bestSellers/bestSellers',
+    },
+    {
+      name: t('missionCenter.dailyMission.joinGroupBuy.name'),
+      description: t('missionCenter.dailyMission.joinGroupBuy.description'),
+      icon: '/static/icons/join-group-buy.png',
+      url: '/pages/bestSellers/bestSellers',
+    },
+  ]
+})
 // 今日是否已签到
 const hasSignedToday = ref(true)
 

+ 12 - 7
src/pages/notifications/notifications.vue

@@ -16,6 +16,7 @@ import useZPaging from 'z-paging/components/z-paging/js/hooks/useZPaging.js'
 
 import { noticeDel, noticeList, noticeRead, readAllNotice } from '@/api/common'
 import { t } from '@/locale'
+import i18n from '@/locale/index'
 import { goBack, toPage } from '@/utils/page'
 import { toast } from '@/utils/toast'
 
@@ -33,13 +34,17 @@ const paging = ref(null)
 useZPaging(paging)
 
 const tab = ref<string>('ALL')
-const tabs = [
-  { title: t('notifications.tabs.all'), value: 'ALL' },
-  { title: t('notifications.tabs.orders'), value: 'ORDER' },
-  { title: t('notifications.tabs.revenue'), value: 'REWARD' },
-  { title: t('notifications.tabs.account'), value: 'MONEY' },
-  { title: t('notifications.tabs.promos'), value: 'OTHER' },
-]
+const tabs = computed(() => {
+  const _locale = i18n.global.locale
+  void _locale
+  return [
+    { title: t('notifications.tabs.all'), value: 'ALL' },
+    { title: t('notifications.tabs.orders'), value: 'ORDER' },
+    { title: t('notifications.tabs.revenue'), value: 'REWARD' },
+    { title: t('notifications.tabs.account'), value: 'MONEY' },
+    { title: t('notifications.tabs.promos'), value: 'OTHER' },
+  ]
+})
 
 const typeMap = {
   order: ['ORDER_GROUP_BUY_PAYMENT_SUCCESS', 'ORDER_GROUP_BUY_SUCCESS_WIN', 'ORDER_GROUP_BUY_SUCCESS_LOSE', 'ORDER_PROVIDE_SHIPPING_ADDRESS', 'ORDER_GROUP_BUY_FAIL', 'ORDER_SHIPPED_SUCCESS'],

+ 61 - 3
src/pages/productDetail/productDetail.vue

@@ -368,6 +368,34 @@ const socialPlatforms = ref([
 const showShare = ref<boolean>(false)
 
 const baseUrl = import.meta.env.VITE_H5_BASE_URL
+
+function getPlusRuntime() {
+  const p = (globalThis as any)?.plus
+  return p?.runtime
+}
+
+function isH5ShareSupported() {
+  return typeof navigator !== 'undefined' && typeof (navigator as any).share === 'function'
+}
+
+function openH5ShareTarget(platform: string) {
+  const { url, text } = generateShareLink()
+
+  const targets: Record<string, string> = {
+    facebook: `https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(url)}`,
+    whatsapp: `https://wa.me/?text=${encodeURIComponent(text)}`,
+    twitter: `https://twitter.com/intent/tweet?text=${encodeURIComponent(text)}`,
+    instagram: 'https://www.instagram.com/',
+  }
+
+  const targetUrl = targets[platform]
+  if (!targetUrl)
+    return
+
+  if (typeof window !== 'undefined' && typeof window.open === 'function')
+    window.open(targetUrl, '_blank')
+}
+
 // 生成商品分享链接
 function generateShareLink() {
   // 基础域名 - 根据需求使用bandhubuy.shop.com
@@ -375,7 +403,10 @@ function generateShareLink() {
 
   // 分享文案格式:[BandhuBuy] + 商品链接 + 商品名称 + 邀请文案
   const productName = detail.value.storeName
-  const shareText = `[BandhuBuy] ${productUrl} ${productName}\nGet it on BandhuBuy now!`
+  const shareText = t('share.productShareText', {
+    url: productUrl,
+    productName,
+  })
 
   return {
     url: productUrl,
@@ -395,6 +426,10 @@ function copyToClipboard() {
 
 // 检查APP是否安装
 function checkAppInstalled(platform: string): boolean {
+  const runtime = getPlusRuntime()
+  if (!runtime)
+    return false
+
   const appSchemes = {
     facebook: { pname: 'com.facebook.katana', scheme: 'fb://' },
     whatsapp: { pname: 'com.whatsapp', scheme: 'whatsapp://' },
@@ -406,7 +441,7 @@ function checkAppInstalled(platform: string): boolean {
   if (!appInfo)
     return false
 
-  return plus.runtime.isApplicationExist({
+  return runtime.isApplicationExist({
     pname: appInfo.pname,
     action: appInfo.scheme,
   })
@@ -416,6 +451,23 @@ function checkAppInstalled(platform: string): boolean {
 function openSocialApp(platform: string) {
   const { url, text } = generateShareLink()
 
+  const runtime = getPlusRuntime()
+  if (!runtime) {
+    if (isH5ShareSupported()) {
+      ;(navigator as any).share({
+        title: detail.value.storeName,
+        text,
+        url,
+      }).catch(() => {
+        openH5ShareTarget(platform)
+      })
+    }
+    else {
+      openH5ShareTarget(platform)
+    }
+    return
+  }
+
   // 先复制分享内容到剪贴板
   uni.setClipboardData({
     data: text,
@@ -433,7 +485,7 @@ function openSocialApp(platform: string) {
 
   const shareUrl = shareUrls[platform]
   if (shareUrl) {
-    plus.runtime.openURL(shareUrl, (error) => {
+    runtime.openURL(shareUrl, (error: any) => {
       console.error('打开APP失败:', error)
       toast.info(t('share.appNotInstalled'))
     })
@@ -447,6 +499,12 @@ function handleShare(platform: string) {
     return
   }
 
+  if (!getPlusRuntime()) {
+    openSocialApp(platform)
+    showShare.value = false
+    return
+  }
+
   // 检查APP是否安装
   if (!checkAppInstalled(platform)) {
     toast.info(t('share.appNotInstalled'))

+ 56 - 41
src/pages/search/search.vue

@@ -15,6 +15,7 @@ import { useQueue } from 'wot-design-uni'
 import useZPaging from 'z-paging/components/z-paging/js/hooks/useZPaging.js'
 import { categoryList, getList } from '@/api/product'
 import { t } from '@/locale'
+import i18n from '@/locale/index'
 import { goBack, toPage } from '@/utils/page'
 
 defineOptions({
@@ -38,52 +39,66 @@ const formData = ref<any>({
 
 const { closeOutside } = useQueue()
 
-const option1 = ref<Record<string, any>[]>([
-  { label: t('home.priceTab.allPrice'), value: 0 },
-  {
-    label: t('home.priceTab.300spot'),
-    value: 300,
-    minPrice: 0,
-    maxPrice: 300,
-  },
-  {
-    label: t('home.priceTab.500spot'),
-    value: 500,
-    minPrice: 300,
-    maxPrice: 500,
-  },
-  {
-    label: t('home.priceTab.1000spot'),
-    value: 1000,
-    minPrice: 500,
-    maxPrice: 1000,
-  },
-  {
-    label: t('home.priceTab.2000spot'),
-    value: 2000,
-    minPrice: 1000,
-    maxPrice: 2000,
-  },
-  {
-    label: t('home.priceTab.3000spot'),
-    value: 3000,
-    minPrice: 2000,
-    maxPrice: 3000,
-  },
-])
+const option1 = computed<Record<string, any>[]>(() => {
+  const _locale = i18n.global.locale
+  void _locale
+  return [
+    { label: t('home.priceTab.allPrice'), value: 0 },
+    {
+      label: t('home.priceTab.300spot'),
+      value: 300,
+      minPrice: 0,
+      maxPrice: 300,
+    },
+    {
+      label: t('home.priceTab.500spot'),
+      value: 500,
+      minPrice: 300,
+      maxPrice: 500,
+    },
+    {
+      label: t('home.priceTab.1000spot'),
+      value: 1000,
+      minPrice: 500,
+      maxPrice: 1000,
+    },
+    {
+      label: t('home.priceTab.2000spot'),
+      value: 2000,
+      minPrice: 1000,
+      maxPrice: 2000,
+    },
+    {
+      label: t('home.priceTab.3000spot'),
+      value: 3000,
+      minPrice: 2000,
+      maxPrice: 3000,
+    },
+  ]
+})
 
-const option2 = ref<Record<string, any>[]>([
-  { label: t('search.filterCategory'), value: 0 },
-])
+const categoryOptions = ref<Record<string, any>[]>([])
+const option2 = computed<Record<string, any>[]>(() => {
+  const _locale = i18n.global.locale
+  void _locale
+  return [
+    { label: t('search.filterCategory'), value: 0 },
+    ...categoryOptions.value,
+  ]
+})
 
-const option3 = ref<Record<string, any>[]>([
-  { label: t('search.filterSellers'), value: 'SALES_DESC' },
-  { label: t('search.filterSellers1'), value: 'CREATE_DESC' },
-])
+const option3 = computed<Record<string, any>[]>(() => {
+  const _locale = i18n.global.locale
+  void _locale
+  return [
+    { label: t('search.filterSellers'), value: 'SALES_DESC' },
+    { label: t('search.filterSellers1'), value: 'CREATE_DESC' },
+  ]
+})
 async function getCategoryList() {
   const res = await categoryList({ page: 1, size: 20 })
   console.log(res)
-  option2.value = [...option2.value, ...res.data.list.map((i: any) => ({ label: i.name, value: i.id }))]
+  categoryOptions.value = res.data.list.map((i: any) => ({ label: i.name, value: i.id }))
 }
 
 // 搜索结果

+ 12 - 7
src/pages/vipMembership/vipMembership.vue

@@ -12,6 +12,7 @@
 <script lang="ts" setup>
 import { memberConfigs } from '@/api/mine'
 import { t } from '@/locale'
+import i18n from '@/locale/index'
 import { useUserStore } from '@/store'
 import { formatNumber } from '@/utils'
 
@@ -42,13 +43,17 @@ interface TableColumn {
 }
 
 // 表格列配置
-const tableColumns = ref<TableColumn[]>([
-  { prop: 'level', label: t('vipMembership.table.vipLevel'), fixed: true, align: 'center', width: '100rpx' },
-  { prop: 'invitedNo', label: t('vipMembership.table.invitedNo'), align: 'center', width: '120rpx' },
-  { prop: 'directReferralReward', slot: true, label: t('vipMembership.table.directReferralReward'), align: 'center', width: '210rpx' },
-  { prop: 'indirectReferralReward', slot: true, label: t('vipMembership.table.indirectReferralReward'), align: 'center', width: '220rpx' },
-  { prop: 'joinedGroupsNo', label: t('vipMembership.table.joinedGroupsNo'), align: 'center', width: '220rpx' },
-])
+const tableColumns = computed<TableColumn[]>(() => {
+  const _locale = i18n.global.locale
+  void _locale
+  return [
+    { prop: 'level', label: t('vipMembership.table.vipLevel'), fixed: true, align: 'center', width: '100rpx' },
+    { prop: 'invitedNo', label: t('vipMembership.table.invitedNo'), align: 'center', width: '120rpx' },
+    { prop: 'directReferralReward', slot: true, label: t('vipMembership.table.directReferralReward'), align: 'center', width: '210rpx' },
+    { prop: 'indirectReferralReward', slot: true, label: t('vipMembership.table.indirectReferralReward'), align: 'center', width: '220rpx' },
+    { prop: 'joinedGroupsNo', label: t('vipMembership.table.joinedGroupsNo'), align: 'center', width: '220rpx' },
+  ]
+})
 
 const dataList = ref<TableData[]>([])