Parcourir la source

fix: 修复best 进入商品详情入参问题及多语言,支付loading

liangan il y a 2 semaines
Parent
commit
f3c760b293

+ 4 - 0
src/locale/bn.json

@@ -185,6 +185,9 @@
   "auth.login.error.emptyUsername": "অনুগ্রহ করে ব্যবহারকারীর নাম বা ফোন নম্বর লিখুন",
   "auth.login.error.emptyPassword": "অনুগ্রহ করে পাসওয়ার্ড লিখুন",
   "auth.login.error.passwordLength": "পাসওয়ার্ড ৬-২০ অক্ষরের হতে হবে",
+  "auth.login.loading": "লগইন করা হচ্ছে...",
+  "auth.login.success": "লগইন সফল হয়েছে!",
+  "auth.login.error.failed": "লগইন ব্যর্থ হয়েছে",
   "auth.register.title": "নিবন্ধন",
   "auth.register.username.placeholder": "ব্যবহারকারীর নাম",
   "auth.register.phone.placeholder": "+88 মোবাইল নম্বর",
@@ -415,6 +418,7 @@
   "orderDetail.rechargeDialog.confirm": "এখনই রিচার্জ করুন",
   "orderDetail.payDialog.title": "পেমেন্ট",
   "orderDetail.payDialog.confirm": "এখনই পেমেন্ট করুন",
+  "orderDetail.payment.loading": "পেমেন্ট...",
   "orderDetail.time.placed": "অর্ডার করা হয়েছে",
   "orderDetail.time.paid": "পেমেন্ট করা হয়েছে",
   "orderDetail.time.shipped": "শিপ করা হয়েছে",

+ 4 - 0
src/locale/en.json

@@ -185,6 +185,9 @@
   "auth.login.error.emptyUsername": "Please enter username or phone number",
   "auth.login.error.emptyPassword": "Please enter password",
   "auth.login.error.passwordLength": "Password should be 6-20 characters",
+  "auth.login.loading": "Logging in...",
+  "auth.login.success": "Login successful!",
+  "auth.login.error.failed": "Login failed",
   "auth.register.title": "Register",
   "auth.register.username.placeholder": "Username",
   "auth.register.phone.placeholder": "+88 Mobile number",
@@ -415,6 +418,7 @@
   "orderDetail.rechargeDialog.confirm": "Recharge Now",
   "orderDetail.payDialog.title": "Payment",
   "orderDetail.payDialog.confirm": "Pay Now",
+  "orderDetail.payment.loading": "Processing Payment...",
   "orderDetail.time.placed": "Placed On",
   "orderDetail.time.paid": "Paid On",
   "orderDetail.time.shipped": "Shipped On",

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

@@ -185,6 +185,9 @@
   "auth.login.error.emptyUsername": "请输入用户名或手机号码",
   "auth.login.error.emptyPassword": "请输入密码",
   "auth.login.error.passwordLength": "密码应为6-20位字符",
+  "auth.login.loading": "登录中...",
+  "auth.login.success": "登录成功!",
+  "auth.login.error.failed": "登录失败",
   "auth.register.title": "注册",
   "auth.register.username.placeholder": "用户名",
   "auth.register.phone.placeholder": "+88 手机号码",
@@ -420,6 +423,7 @@
   "orderDetail.time.shipped": "发货时间",
   "orderDetail.time.completed": "完成时间",
   "orderDetail.copy.success": "已复制到剪贴板",
+  "orderDetail.payment.loading": "支付中...",
   "wallet.unpaidOrderDialog.title": "您有未完成的充值订单,\n是否继续?",
   "wallet.unpaidOrderDialog.confirm": "查看",
   "wallet.unpaidOrderDialog.cancel": "取消",

+ 1 - 1
src/pages/bestSellers/bestSellers.vue

@@ -81,7 +81,7 @@ function getRankNumber(index: number) {
       </view>
     </template>
     <view class="pt-20rpx">
-      <view v-for="(item, index) in dataList" :key="item.productId" class="mb-20rpx mb-20rpx flex items-center gap-24rpx bg-white p-24rpx" @click="toPage({ url: '/pages/productDetail/productDetail', productId: item.productId })">
+      <view v-for="(item, index) in dataList" :key="item.productId" class="mb-20rpx mb-20rpx flex items-center gap-24rpx bg-white p-24rpx" @click="toPage({ url: '/pages/productDetail/productDetail', params: { productId: item.productId } })">
         <view class="relative">
           <view class="h-160rpx w-160rpx shrink-0">
             <image

+ 5 - 0
src/pages/myOrders/orderDetail.vue

@@ -245,6 +245,10 @@ function showPayOrderDialog() {
   ))
 }
 async function goPay() {
+  uni.showLoading({
+    title: t('orderDetail.payment.loading'),
+    mask: true,
+  })
   const payRes = await payOrder({
     orderId: detail.value?.orderId,
     type: detail.value?.storePink?.kId ? 'join' : 'open',
@@ -254,6 +258,7 @@ async function goPay() {
     toast.success(t('orderDetail.payment.success'))
     getDetail()
   }
+  uni.hideLoading()
 }
 
 function handleClick() {

+ 4 - 3
src/store/user.ts

@@ -2,6 +2,7 @@ import { defineStore } from 'pinia'
 import { ref } from 'vue'
 import { bindUser } from '@/api/common'
 import { getUserInfo as _getUserInfo, login as _login } from '@/api/login'
+import { t } from '@/locale'
 import { toPage } from '@/utils/page'
 import { toast } from '@/utils/toast'
 
@@ -48,7 +49,7 @@ export const useUserStore = defineStore(
       try {
         // 显示加载状态
         uni.showLoading({
-          title: 'Logging in...',
+          title: t('auth.login.loading'),
           mask: true,
         })
 
@@ -68,7 +69,7 @@ export const useUserStore = defineStore(
         }
 
         // 登录成功提示
-        toast.success('Login successful!')
+        toast.success(t('auth.login.success'))
 
         // 跳转到指定页面或默认首页
         setTimeout(() => {
@@ -86,7 +87,7 @@ export const useUserStore = defineStore(
       }
       catch (error) {
         uni.hideLoading()
-        toast.error(error.message || 'Login failed')
+        toast.error(error.message || t('auth.login.error.failed'))
         throw error
       }
     }