feat: 订场页余额<=0可看3天 + 我的页下拉刷新/进入刷新 + 门票tab改名 + 商城页进入/切tab刷新 + 底部tab顺序调整
This commit is contained in:
@@ -48,7 +48,8 @@
|
|||||||
{
|
{
|
||||||
"path": "pages/profile/index",
|
"path": "pages/profile/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "我的"
|
"navigationBarTitleText": "我的",
|
||||||
|
"enablePullDownRefresh": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -311,10 +312,10 @@
|
|||||||
"selectedIconPath": "static/comprehensive/tab/home-active.png"
|
"selectedIconPath": "static/comprehensive/tab/home-active.png"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"pagePath": "pages/private/index",
|
"pagePath": "pages/courses/index",
|
||||||
"text": "订场",
|
"text": "约课",
|
||||||
"iconPath": "static/comprehensive/tab/private.png",
|
"iconPath": "static/comprehensive/tab/course.png",
|
||||||
"selectedIconPath": "static/comprehensive/tab/private-active.png"
|
"selectedIconPath": "static/comprehensive/tab/course-active.png"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"pagePath": "pages/mall/index",
|
"pagePath": "pages/mall/index",
|
||||||
@@ -323,10 +324,10 @@
|
|||||||
"selectedIconPath": "static/comprehensive/tab/mall-active.png"
|
"selectedIconPath": "static/comprehensive/tab/mall-active.png"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"pagePath": "pages/courses/index",
|
"pagePath": "pages/private/index",
|
||||||
"text": "约课",
|
"text": "订场",
|
||||||
"iconPath": "static/comprehensive/tab/course.png",
|
"iconPath": "static/comprehensive/tab/private.png",
|
||||||
"selectedIconPath": "static/comprehensive/tab/course-active.png"
|
"selectedIconPath": "static/comprehensive/tab/private-active.png"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"pagePath": "pages/profile/index",
|
"pagePath": "pages/profile/index",
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<block>
|
<block>
|
||||||
<view class="tab-bar">
|
<view class="tab-bar">
|
||||||
<view class="tab-item" :class="{ active: activeTab === 'membership' }" @tap="switchTab('membership')">会员卡</view>
|
<view class="tab-item" :class="{ active: activeTab === 'membership' }" @tap="switchTab('membership')">会员卡</view>
|
||||||
<view class="tab-item" :class="{ active: activeTab === 'tickets' }" @tap="switchTab('tickets')">门票</view>
|
<view class="tab-item" :class="{ active: activeTab === 'tickets' }" @tap="switchTab('tickets')">篮球门票</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<template v-if="activeTab === 'tickets'">
|
<template v-if="activeTab === 'tickets'">
|
||||||
@@ -12,7 +12,6 @@
|
|||||||
<view class="product-head">
|
<view class="product-head">
|
||||||
<view>
|
<view>
|
||||||
<text class="product-title">篮球门票</text>
|
<text class="product-title">篮球门票</text>
|
||||||
<text class="product-subtitle">购买后进入会员权益账户,到馆由前台核销。</text>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="price-block">
|
<view class="price-block">
|
||||||
|
|||||||
@@ -4,14 +4,14 @@
|
|||||||
<view
|
<view
|
||||||
class="tab-item"
|
class="tab-item"
|
||||||
:class="{ active: activeTab === 'stored_value' }"
|
:class="{ active: activeTab === 'stored_value' }"
|
||||||
@tap="activeTab = 'stored_value'"
|
@tap="switchTab('stored_value')"
|
||||||
>
|
>
|
||||||
储值卡
|
储值卡
|
||||||
</view>
|
</view>
|
||||||
<view
|
<view
|
||||||
class="tab-item"
|
class="tab-item"
|
||||||
:class="{ active: activeTab === 'membership' }"
|
:class="{ active: activeTab === 'membership' }"
|
||||||
@tap="activeTab = 'membership'"
|
@tap="switchTab('membership')"
|
||||||
>
|
>
|
||||||
会员卡
|
会员卡
|
||||||
</view>
|
</view>
|
||||||
@@ -80,7 +80,18 @@ const goDetail = (item) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({ refresh: loadPage })
|
const switchTab = (tab) => {
|
||||||
|
if (activeTab.value === tab) return
|
||||||
|
activeTab.value = tab
|
||||||
|
loadPage()
|
||||||
|
}
|
||||||
|
|
||||||
|
const refresh = async () => {
|
||||||
|
await session.init()
|
||||||
|
await loadPage()
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({ refresh })
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ const weekDays = ['周日', '周一', '周二', '周三', '周四', '周五', '
|
|||||||
const hasPositiveBalance = computed(() => toAmountNumber(session.member?.balance) > 0)
|
const hasPositiveBalance = computed(() => toAmountNumber(session.member?.balance) > 0)
|
||||||
const dateOptions = computed(() => {
|
const dateOptions = computed(() => {
|
||||||
const today = dayjs()
|
const today = dayjs()
|
||||||
const dateCount = hasPositiveBalance.value ? 7 : 1
|
const dateCount = hasPositiveBalance.value ? 7 : 3
|
||||||
return Array.from({ length: dateCount }).map((_, i) => {
|
return Array.from({ length: dateCount }).map((_, i) => {
|
||||||
const d = today.add(i, 'day')
|
const d = today.add(i, 'day')
|
||||||
return {
|
return {
|
||||||
@@ -360,8 +360,12 @@ function normalizeClock(value) {
|
|||||||
|
|
||||||
async function refresh() {
|
async function refresh() {
|
||||||
await session.init()
|
await session.init()
|
||||||
if (!hasPositiveBalance.value && selectedDate.value !== dayjs().format('YYYY-MM-DD')) {
|
if (!hasPositiveBalance.value) {
|
||||||
selectedDate.value = dayjs().format('YYYY-MM-DD')
|
const todayStr = dayjs().format('YYYY-MM-DD')
|
||||||
|
const maxDateStr = dayjs().add(2, 'day').format('YYYY-MM-DD')
|
||||||
|
if (selectedDate.value < todayStr || selectedDate.value > maxDateStr) {
|
||||||
|
selectedDate.value = todayStr
|
||||||
|
}
|
||||||
}
|
}
|
||||||
now.value = dayjs()
|
now.value = dayjs()
|
||||||
await loadGrid()
|
await loadGrid()
|
||||||
|
|||||||
@@ -77,7 +77,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, onMounted, ref } from 'vue'
|
import { computed, ref } from 'vue'
|
||||||
import { useComprehensiveSessionStore } from '@/modules/comprehensive/stores/session'
|
import { useComprehensiveSessionStore } from '@/modules/comprehensive/stores/session'
|
||||||
import { memberApi } from '@/modules/comprehensive/api/member'
|
import { memberApi } from '@/modules/comprehensive/api/member'
|
||||||
import { formatAmount } from '@/modules/comprehensive/utils/money'
|
import { formatAmount } from '@/modules/comprehensive/utils/money'
|
||||||
@@ -93,16 +93,6 @@ const menuItems = [
|
|||||||
{ title: '余额流水', url: '/pages/comprehensive/profile/balance', theme: 'order-theme', icon: 'order' }
|
{ title: '余额流水', url: '/pages/comprehensive/profile/balance', theme: 'order-theme', icon: 'order' }
|
||||||
]
|
]
|
||||||
|
|
||||||
onMounted(async () => {
|
|
||||||
await session.init()
|
|
||||||
try {
|
|
||||||
const data = await memberApi.getBalance()
|
|
||||||
balance.value = data.balance
|
|
||||||
} catch {
|
|
||||||
balance.value = '0.00'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const login = () => {
|
const login = () => {
|
||||||
uni.navigateTo({ url: '/pages/comprehensive/profile/login' })
|
uni.navigateTo({ url: '/pages/comprehensive/profile/login' })
|
||||||
}
|
}
|
||||||
@@ -116,7 +106,17 @@ const go = (url) => {
|
|||||||
uni.navigateTo({ url })
|
uni.navigateTo({ url })
|
||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({ onPageShow: () => {} })
|
const refresh = async () => {
|
||||||
|
await session.init()
|
||||||
|
try {
|
||||||
|
const data = await memberApi.getBalance()
|
||||||
|
balance.value = data.balance
|
||||||
|
} catch {
|
||||||
|
balance.value = '0.00'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({ onPageShow: refresh, refresh })
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
@@ -497,7 +497,7 @@ const formatDate = (dateStr) => {
|
|||||||
return `${date.getFullYear()}年${date.getMonth() + 1}月${date.getDate()}日`
|
return `${date.getFullYear()}年${date.getMonth() + 1}月${date.getDate()}日`
|
||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({ onPageShow: refreshSession })
|
defineExpose({ onPageShow: refreshSession, refresh: refreshSession })
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
@@ -7,13 +7,22 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { onPullDownRefresh } from '@dcloudio/uni-app'
|
import { onPullDownRefresh, onShow } from '@dcloudio/uni-app'
|
||||||
import { getStoredVenue } from '@/utils/venue'
|
import { getStoredVenue } from '@/utils/venue'
|
||||||
import ComprehensiveMall from '@/pages/comprehensive/mall/index.vue'
|
import ComprehensiveMall from '@/pages/comprehensive/mall/index.vue'
|
||||||
import IceMall from '@/pages/ice/mall/index.vue'
|
import IceMall from '@/pages/ice/mall/index.vue'
|
||||||
|
|
||||||
const isComprehensive = getStoredVenue() === 'comprehensive'
|
const isComprehensive = getStoredVenue() === 'comprehensive'
|
||||||
const contentRef = ref()
|
const contentRef = ref()
|
||||||
|
let isFirstShow = true
|
||||||
|
|
||||||
|
onShow(() => {
|
||||||
|
if (isFirstShow) {
|
||||||
|
isFirstShow = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
contentRef.value?.refresh?.()
|
||||||
|
})
|
||||||
|
|
||||||
onPullDownRefresh(async () => {
|
onPullDownRefresh(async () => {
|
||||||
await contentRef.value?.refresh?.()
|
await contentRef.value?.refresh?.()
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { onShow } from '@dcloudio/uni-app'
|
import { onShow, onPullDownRefresh } from '@dcloudio/uni-app'
|
||||||
import { getStoredVenue } from '@/utils/venue'
|
import { getStoredVenue } from '@/utils/venue'
|
||||||
import ComprehensiveProfile from '@/pages/comprehensive/profile/index.vue'
|
import ComprehensiveProfile from '@/pages/comprehensive/profile/index.vue'
|
||||||
import IceProfile from '@/pages/ice/profile/index.vue'
|
import IceProfile from '@/pages/ice/profile/index.vue'
|
||||||
@@ -18,6 +18,11 @@ const contentRef = ref()
|
|||||||
onShow(() => {
|
onShow(() => {
|
||||||
contentRef.value?.onPageShow?.()
|
contentRef.value?.onPageShow?.()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
onPullDownRefresh(async () => {
|
||||||
|
await contentRef.value?.refresh?.()
|
||||||
|
uni.stopPullDownRefresh()
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
Reference in New Issue
Block a user