|
|
@@ -1,5 +1,6 @@
|
|
|
<script setup lang="ts">
|
|
|
import type { AppMemberCouponVO } from '@/api/globals'
|
|
|
+import router from '@/router'
|
|
|
|
|
|
definePage({
|
|
|
name: 'voucher',
|
|
|
@@ -15,11 +16,20 @@ const StaticUrl = import.meta.env.VITE_STATIC_BASE_URL
|
|
|
|
|
|
// Tab 列表
|
|
|
const tabList = ref([
|
|
|
- { label: '可用', value: 0, count: 0 },
|
|
|
- { label: '已使用', value: 1, count: 0 },
|
|
|
- { label: '已过期', value: 2, count: 0 },
|
|
|
+ { label: '可用', value: 2 },
|
|
|
+ { label: '已使用', value: 1 },
|
|
|
+ { label: '已过期', value: 5 },
|
|
|
+ { label: '未生效', value: 7 },
|
|
|
+])
|
|
|
+const currentTab = ref(2)
|
|
|
+
|
|
|
+// 状态映射
|
|
|
+const statusMap = new Map([
|
|
|
+ [2, '可用'],
|
|
|
+ [1, '已使用'],
|
|
|
+ [5, '已过期'],
|
|
|
+ [7, '未生效'],
|
|
|
])
|
|
|
-const currentTab = ref(0)
|
|
|
|
|
|
// 分页请求
|
|
|
const { data, send, isLastPage, page } = usePagination(
|
|
|
@@ -43,10 +53,9 @@ function handleTabChange(value: number) {
|
|
|
send()
|
|
|
}
|
|
|
|
|
|
-// 去使用
|
|
|
function handleUse(_item: AppMemberCouponVO) {
|
|
|
- // TODO: 跳转到使用页面
|
|
|
- uni.switchTab({ url: '/pages/index/index' })
|
|
|
+ router.pushTab({ name: 'home' })
|
|
|
+ useTabbar().setTabbarItemActive('home')
|
|
|
}
|
|
|
|
|
|
// 取消订单(占位)
|
|
|
@@ -91,7 +100,7 @@ watch(() => currentTab.value, () => {
|
|
|
<template>
|
|
|
<view class="min-h-100vh bg-#f5f5f5">
|
|
|
<!-- Tab 切换 -->
|
|
|
- <view class="sticky top-0 z-10 flex items-center bg-white px24rpx">
|
|
|
+ <view class="sticky top-0 z-10 flex items-center justify-between bg-white px24rpx">
|
|
|
<view
|
|
|
v-for="item in tabList"
|
|
|
:key="item.value"
|
|
|
@@ -122,7 +131,7 @@ watch(() => currentTab.value, () => {
|
|
|
</view>
|
|
|
</view>
|
|
|
<!-- 待支付倒计时 -->
|
|
|
- <view v-if="item.lockStatus === 1 && currentTab === 0" class="text-24rpx text-#1890ff">
|
|
|
+ <view v-if="item.lockStatus === 1 && currentTab === 2" class="text-24rpx text-#1890ff">
|
|
|
待支付(<wd-count-down :time="getCountdownTime(item.orderCreateTime)" format="还剩mm:ss" />)
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -140,11 +149,11 @@ watch(() => currentTab.value, () => {
|
|
|
</text>
|
|
|
</view>
|
|
|
<view class="mt12rpx text-26rpx text-#999">
|
|
|
- 状态:{{ item.useStatus === 0 ? '可用' : item.useStatus === 1 ? '已使用' : '已过期' }}
|
|
|
+ 状态:{{ statusMap.get(item.useStatus as number) || '' }}
|
|
|
</view>
|
|
|
|
|
|
<!-- 操作按钮区域 -->
|
|
|
- <view v-if="currentTab === 0" class="mt20rpx">
|
|
|
+ <view v-if="currentTab === 2" class="mt20rpx">
|
|
|
<!-- 未被锁定 - 显示去使用 -->
|
|
|
<view v-if="item.lockStatus !== 1" class="flex justify-end">
|
|
|
<wd-button size="small" plain custom-class="use-btn" @click="handleUse(item)">
|