修复:统一后台登录店铺展示和中文提示
This commit is contained in:
@@ -46,7 +46,7 @@
|
||||
<span>{{ item.quantity }}</span>
|
||||
<a-button size="small" :disabled="item.quantity >= 99" @click="changeQuantity(item, 1)">+</a-button>
|
||||
</div>
|
||||
<a-popconfirm title="确定删除吗?" ok-text="确定" cancel-text="取消" @confirm="removeItem(item)">
|
||||
<a-popconfirm title="确定删除吗?" ok-text="确认" cancel-text="取消" @confirm="removeItem(item)">
|
||||
<a-button type="text" danger size="small">
|
||||
<DeleteOutlined />
|
||||
</a-button>
|
||||
|
||||
@@ -442,7 +442,7 @@ const handleLogout = () => {
|
||||
Modal.confirm({
|
||||
title: '确认退出登录',
|
||||
content: '确定要退出登录吗?',
|
||||
okText: '确定',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: async () => {
|
||||
try {
|
||||
@@ -1027,4 +1027,4 @@ const loadWishlistCount = async () => {
|
||||
background: #f5f5f5;
|
||||
color: #8b8b9a;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -96,13 +96,16 @@ const { loadUserPermissions } = usePermission()
|
||||
const formState = reactive({
|
||||
account: '',
|
||||
password: '',
|
||||
shopId: undefined as number | undefined
|
||||
shopId: undefined as string | undefined
|
||||
})
|
||||
|
||||
const getShopIdValue = (shop: ShopSimpleVO) => String(shop.id ?? '')
|
||||
const getShopLabel = (shop: ShopSimpleVO) => String(shop.shopName || shop.name || `店铺 ${shop.id}`)
|
||||
|
||||
const shopOptions = computed(() =>
|
||||
shops.value.map(shop => ({
|
||||
label: shop.name,
|
||||
value: shop.id
|
||||
label: getShopLabel(shop),
|
||||
value: getShopIdValue(shop)
|
||||
}))
|
||||
)
|
||||
const hasAvailableShops = computed(() => shopOptions.value.length > 0)
|
||||
@@ -135,7 +138,7 @@ const restoreLoginShop = () => {
|
||||
try {
|
||||
const parsed = JSON.parse(cached)
|
||||
if (parsed?.shopId) {
|
||||
formState.shopId = parsed.shopId
|
||||
formState.shopId = String(parsed.shopId)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('恢复后台登录店铺失败:', error)
|
||||
@@ -150,12 +153,21 @@ const loadShops = async () => {
|
||||
formState.shopId = undefined
|
||||
return
|
||||
}
|
||||
if (!formState.shopId && shops.value.length === 1) {
|
||||
|
||||
const hasMatchedShop = shopOptions.value.some(option => option.value === formState.shopId)
|
||||
if (hasMatchedShop) {
|
||||
return
|
||||
}
|
||||
|
||||
if (shops.value.length === 1) {
|
||||
const [onlyShop] = shops.value
|
||||
if (onlyShop) {
|
||||
formState.shopId = onlyShop.id
|
||||
formState.shopId = getShopIdValue(onlyShop)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
formState.shopId = undefined
|
||||
} catch (error) {
|
||||
console.error('获取登录店铺列表失败:', error)
|
||||
message.error('店铺列表加载失败,请刷新后重试')
|
||||
|
||||
Reference in New Issue
Block a user