diff --git a/miniapp/pages/merchant/index.vue b/miniapp/pages/merchant/index.vue
index 2930623..a732635 100644
--- a/miniapp/pages/merchant/index.vue
+++ b/miniapp/pages/merchant/index.vue
@@ -28,6 +28,15 @@
›
+
+
+
+
+ 切换身份
+
+ ›
+
+
@@ -237,6 +246,11 @@
uni.navigateTo({ url: '/pages/merchant/records' })
},
+ /** 切换身份 */
+ goRoleSelect() {
+ uni.navigateTo({ url: '/pages/login/role-select' })
+ },
+
/** 退出登录 */
handleLogout() {
uni.showModal({
diff --git a/miniapp/pages/mine/index.vue b/miniapp/pages/mine/index.vue
index 59027cf..42ed035 100644
--- a/miniapp/pages/mine/index.vue
+++ b/miniapp/pages/mine/index.vue
@@ -49,7 +49,7 @@
›
@@ -158,9 +158,7 @@
// 即使接口失败也清除本地状态
}
clearAuth()
- this.isLogin = false
- this.userInfo = {}
- uni.showToast({ title: '已退出登录', icon: 'none' })
+ uni.reLaunch({ url: '/pages/index/index' })
}
}
}
diff --git a/miniapp/pages/points/index.vue b/miniapp/pages/points/index.vue
index c8a5ee0..9fe8944 100644
--- a/miniapp/pages/points/index.vue
+++ b/miniapp/pages/points/index.vue
@@ -46,6 +46,7 @@
{{ item.name }}
+ 适用门店:{{ item.stores.map(s => s.name).join('、') }}
有效期:{{ isPermanent(item) ? '永久有效' : formatDate(item.validStart) + '至' + formatDate(item.validEnd) }}
剩余数量:{{ item.remainingCount }} 张
@@ -92,6 +93,7 @@
import {
getPopup
} from '@/api/config'
+ import { isLoggedIn, checkLogin } from '@/utils/auth'
import RichContentPopup from '@/components/RichContentPopup.vue'
import ConfirmDialog from '@/components/ConfirmDialog.vue'
import NavBar from '@/components/NavBar.vue'
@@ -150,21 +152,25 @@
async loadData() {
this.loading = true
try {
- const [balanceRes, availableRes, storesRes] = await Promise.all([
- getBalance(), getAvailable(), getStores()
- ])
- this.balance = balanceRes.balance ?? balanceRes.data?.balance ?? 0
- this.availableList = availableRes.data || availableRes || []
- const stores = storesRes.data || storesRes || []
- this.storeOptions = [{
- label: '全部',
- value: ''
- },
- ...stores.map(s => ({
- label: s.name,
- value: s.id
- }))
- ]
+ // 未登录时跳过积分余额请求
+ const requests = [getAvailable(), getStores()]
+ if (isLoggedIn()) {
+ requests.unshift(getBalance())
+ }
+ const results = await Promise.all(requests)
+
+ if (isLoggedIn()) {
+ const balanceRes = results[0]
+ this.balance = balanceRes.balance ?? balanceRes.data?.balance ?? 0
+ this.availableList = results[1].data || results[1] || []
+ const stores = results[2].data || results[2] || []
+ this.storeOptions = [{ label: '全部', value: '' }, ...stores.map(s => ({ label: s.name, value: s.id }))]
+ } else {
+ this.balance = 0
+ this.availableList = results[0].data || results[0] || []
+ const stores = results[1].data || results[1] || []
+ this.storeOptions = [{ label: '全部', value: '' }, ...stores.map(s => ({ label: s.name, value: s.id }))]
+ }
// 加载积分页背景图配置
try {
const bgRes = await getPopup('points-bg')
@@ -199,6 +205,7 @@
})
},
onExchange(item) {
+ if (!checkLogin()) return
if (item.remainingCount <= 0) return
if (item.pointsCost > 0 && this.balance < item.pointsCost) {
uni.showToast({
diff --git a/miniapp/static/ic_switch.png b/miniapp/static/ic_switch.png
new file mode 100644
index 0000000..cf4adda
Binary files /dev/null and b/miniapp/static/ic_switch.png differ
diff --git a/server/src/HuangyanParking.Api/Controllers/CouponController.cs b/server/src/HuangyanParking.Api/Controllers/CouponController.cs
index dc6727b..2793290 100644
--- a/server/src/HuangyanParking.Api/Controllers/CouponController.cs
+++ b/server/src/HuangyanParking.Api/Controllers/CouponController.cs
@@ -26,6 +26,7 @@ public class CouponController : ControllerBase
/// GET /api/coupons/available
///
[HttpGet("available")]
+ [AllowAnonymous]
public async Task>>> GetAvailable()
{
var templates = await _couponService.GetAvailableTemplatesAsync();