优化
This commit is contained in:
parent
fbb9c67e24
commit
a711c6e594
|
|
@ -28,6 +28,15 @@
|
||||||
<text class="record-arrow">›</text>
|
<text class="record-arrow">›</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<!-- 切换身份 -->
|
||||||
|
<view class="record-entry" style="margin-top:20rpx" @click="goRoleSelect">
|
||||||
|
<view style="display:flex;align-items:center">
|
||||||
|
<image src="/static/ic_switch.png" class="logout-icon" />
|
||||||
|
<text class="record-label">切换身份</text>
|
||||||
|
</view>
|
||||||
|
<text class="record-arrow">›</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
<!-- 退出登录 -->
|
<!-- 退出登录 -->
|
||||||
<view class="record-entry logout-entry" @click="handleLogout">
|
<view class="record-entry logout-entry" @click="handleLogout">
|
||||||
<view style="display:flex;align-items:center">
|
<view style="display:flex;align-items:center">
|
||||||
|
|
@ -237,6 +246,11 @@
|
||||||
uni.navigateTo({ url: '/pages/merchant/records' })
|
uni.navigateTo({ url: '/pages/merchant/records' })
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** 切换身份 */
|
||||||
|
goRoleSelect() {
|
||||||
|
uni.navigateTo({ url: '/pages/login/role-select' })
|
||||||
|
},
|
||||||
|
|
||||||
/** 退出登录 */
|
/** 退出登录 */
|
||||||
handleLogout() {
|
handleLogout() {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@
|
||||||
<text class="arrow-right">›</text>
|
<text class="arrow-right">›</text>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="isLogin && userInfo.isMerchant" class="menu-item" @click="goRoleSelect">
|
<view v-if="isLogin && userInfo.isMerchant" class="menu-item" @click="goRoleSelect">
|
||||||
<image class="menu-icon" src="/static/ic_pitch.png" mode="aspectFit" />
|
<image class="menu-icon" src="/static/ic_switch.png" mode="aspectFit" />
|
||||||
<text class="menu-text">切换身份</text>
|
<text class="menu-text">切换身份</text>
|
||||||
<text class="arrow-right">›</text>
|
<text class="arrow-right">›</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -158,9 +158,7 @@
|
||||||
// 即使接口失败也清除本地状态
|
// 即使接口失败也清除本地状态
|
||||||
}
|
}
|
||||||
clearAuth()
|
clearAuth()
|
||||||
this.isLogin = false
|
uni.reLaunch({ url: '/pages/index/index' })
|
||||||
this.userInfo = {}
|
|
||||||
uni.showToast({ title: '已退出登录', icon: 'none' })
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@
|
||||||
<!-- 右侧信息 -->
|
<!-- 右侧信息 -->
|
||||||
<view class="coupon-right">
|
<view class="coupon-right">
|
||||||
<text class="coupon-name">{{ item.name }}</text>
|
<text class="coupon-name">{{ item.name }}</text>
|
||||||
|
<text class="coupon-info">适用门店:{{ item.stores.map(s => s.name).join('、') }}</text>
|
||||||
<text
|
<text
|
||||||
class="coupon-info">有效期:{{ isPermanent(item) ? '永久有效' : formatDate(item.validStart) + '至' + formatDate(item.validEnd) }}</text>
|
class="coupon-info">有效期:{{ isPermanent(item) ? '永久有效' : formatDate(item.validStart) + '至' + formatDate(item.validEnd) }}</text>
|
||||||
<text class="coupon-info">剩余数量:{{ item.remainingCount }} 张</text>
|
<text class="coupon-info">剩余数量:{{ item.remainingCount }} 张</text>
|
||||||
|
|
@ -92,6 +93,7 @@
|
||||||
import {
|
import {
|
||||||
getPopup
|
getPopup
|
||||||
} from '@/api/config'
|
} from '@/api/config'
|
||||||
|
import { isLoggedIn, checkLogin } from '@/utils/auth'
|
||||||
import RichContentPopup from '@/components/RichContentPopup.vue'
|
import RichContentPopup from '@/components/RichContentPopup.vue'
|
||||||
import ConfirmDialog from '@/components/ConfirmDialog.vue'
|
import ConfirmDialog from '@/components/ConfirmDialog.vue'
|
||||||
import NavBar from '@/components/NavBar.vue'
|
import NavBar from '@/components/NavBar.vue'
|
||||||
|
|
@ -150,21 +152,25 @@
|
||||||
async loadData() {
|
async loadData() {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
try {
|
try {
|
||||||
const [balanceRes, availableRes, storesRes] = await Promise.all([
|
// 未登录时跳过积分余额请求
|
||||||
getBalance(), getAvailable(), getStores()
|
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.balance = balanceRes.balance ?? balanceRes.data?.balance ?? 0
|
||||||
this.availableList = availableRes.data || availableRes || []
|
this.availableList = results[1].data || results[1] || []
|
||||||
const stores = storesRes.data || storesRes || []
|
const stores = results[2].data || results[2] || []
|
||||||
this.storeOptions = [{
|
this.storeOptions = [{ label: '全部', value: '' }, ...stores.map(s => ({ label: s.name, value: s.id }))]
|
||||||
label: '全部',
|
} else {
|
||||||
value: ''
|
this.balance = 0
|
||||||
},
|
this.availableList = results[0].data || results[0] || []
|
||||||
...stores.map(s => ({
|
const stores = results[1].data || results[1] || []
|
||||||
label: s.name,
|
this.storeOptions = [{ label: '全部', value: '' }, ...stores.map(s => ({ label: s.name, value: s.id }))]
|
||||||
value: s.id
|
}
|
||||||
}))
|
|
||||||
]
|
|
||||||
// 加载积分页背景图配置
|
// 加载积分页背景图配置
|
||||||
try {
|
try {
|
||||||
const bgRes = await getPopup('points-bg')
|
const bgRes = await getPopup('points-bg')
|
||||||
|
|
@ -199,6 +205,7 @@
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
onExchange(item) {
|
onExchange(item) {
|
||||||
|
if (!checkLogin()) return
|
||||||
if (item.remainingCount <= 0) return
|
if (item.remainingCount <= 0) return
|
||||||
if (item.pointsCost > 0 && this.balance < item.pointsCost) {
|
if (item.pointsCost > 0 && this.balance < item.pointsCost) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
|
|
|
||||||
BIN
miniapp/static/ic_switch.png
Normal file
BIN
miniapp/static/ic_switch.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
|
|
@ -26,6 +26,7 @@ public class CouponController : ControllerBase
|
||||||
/// GET /api/coupons/available
|
/// GET /api/coupons/available
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[HttpGet("available")]
|
[HttpGet("available")]
|
||||||
|
[AllowAnonymous]
|
||||||
public async Task<ActionResult<ApiResponse<List<AvailableCouponResponse>>>> GetAvailable()
|
public async Task<ActionResult<ApiResponse<List<AvailableCouponResponse>>>> GetAvailable()
|
||||||
{
|
{
|
||||||
var templates = await _couponService.GetAvailableTemplatesAsync();
|
var templates = await _couponService.GetAvailableTemplatesAsync();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user