修复:修复下单可多次点击支付按钮问题;允许积分支付小数;

This commit is contained in:
2025-12-22 17:52:02 +08:00
parent 55455fa4f2
commit cafb86cc9d
9 changed files with 283 additions and 132 deletions

View File

@@ -1,5 +1,11 @@
<template>
<view class="home-page">
<scroll-view
class="home-page"
scroll-y
refresher-enabled
:refresher-triggered="isRefreshing"
@refresherrefresh="handleRefresh"
>
<!-- 顶部背景区域 -->
<view class="home-bg" :style="{ paddingTop: getNotchHeight() + 'px' }">
<wd-search
@@ -244,7 +250,7 @@
</Skeleton>
</view>
</view>
</view>
</scroll-view>
</template>
<script setup lang="ts">
@@ -427,12 +433,38 @@ const getPrompt = () => {
}
}
// 下拉刷新状态
const isRefreshing = ref(false)
/**
* 处理下拉刷新
*/
const handleRefresh = async () => {
isRefreshing.value = true
try {
// 刷新所有数据
await Promise.all([
myBookSkeleton.value?.reload(),
recommendBooksSkeleton.value?.reload(),
categoryLevel1LabelSkeleton.value?.reload()
])
} catch (error) {
console.error('刷新数据失败:', error)
} finally {
// 延迟关闭刷新状态,避免闪烁
setTimeout(() => {
isRefreshing.value = false
}, 500)
}
}
/**
* 页面显示
*/
onShow(() => {
// 刷新数据
myBookSkeleton.value?.reload()
categoryLevel1LabelSkeleton.value.reload()
})
</script>
@@ -469,6 +501,7 @@ onShow(() => {
.content-wrapper {
padding-bottom: 40rpx;
height: calc(100vh - 240px);
}
.mine-block {

View File

@@ -1,5 +1,11 @@
<template>
<view class="course-home-page">
<scroll-view
class="course-home-page"
scroll-y
refresher-enabled
:refresher-triggered="isRefreshing"
@refresherrefresh="handleRefresh"
>
<!-- 头部区域 -->
<view class="home-bg" :style="{ paddingTop: getNotchHeight() + 'px' }">
<wd-search
@@ -215,7 +221,7 @@
</template>
</Skeleton>
</view>
</view>
</scroll-view>
</template>
<script setup lang="ts">
@@ -234,6 +240,9 @@ const userStore = useUserStore()
// 系统信息
const scrollTop = ref<number>(0) // 滚动位置
// 下拉刷新状态
const isRefreshing = ref(false)
/**
* 处理搜索点击
*/
@@ -451,6 +460,31 @@ const requestAll = async () => {
}
getTryListenList()
getNewsList()
// 刷新分类数据
if (selectedFirstLevel.value === '医学') {
medicineMenuSkeletonRef.value?.reload()
} else {
menuSkeletonRef.value?.reload()
}
}
/**
* 处理下拉刷新
*/
const handleRefresh = async () => {
isRefreshing.value = true
try {
// 刷新所有数据
await requestAll()
} catch (error) {
console.error('刷新数据失败:', error)
} finally {
// 延迟关闭刷新状态,避免闪烁
setTimeout(() => {
isRefreshing.value = false
}, 500)
}
}
/**
@@ -526,7 +560,7 @@ $text-placeholder: #999999;
$border-color: #eeeeee;
.course-home-page {
min-height: 100vh;
height: 100vh;
background-color: $bg-color;
font-size: 28upx;
}

View File

@@ -4,7 +4,7 @@
<nav-bar :title="$t('order.confirmTitle')" />
<!-- 确认订单组件 -->
<Confirm :goodsList="goodsList" :userInfo="userInfo" :orderType="orderType">
<Confirm :goodsList="goodsList" :userInfo="userInfo" :orderType="orderType" :allow-point-pay="allowPointPay">
<template #goodsList>
<!-- 商品列表内容 -->
<view
@@ -86,12 +86,15 @@ const isRelearn = ref<boolean>(false)
const orderType = computed(() => {
return isRelearn.value ? 'relearn' : 'order'
})
// 是否允许积分支付
const allowPointPay = ref<boolean>(false)
/**
* 页面加载
*/
onLoad(async (options: any) => {
try {
allowPointPay.value = options.allowPointPay !== '0'
if (options.isRelearn == 1) {
uni.$on('selectedGoods', async (data: IOrderGoods) => {
// 获取用户信息

View File

@@ -1,83 +1,91 @@
<template>
<view class="user-page" :style="{ paddingTop: getNotchHeight() + 30 + 'px' }" v-if="tokenState">
<!-- 设置图标 -->
<view class="settings-icon" :style="{ top: getNotchHeight() + 30 + 'px' }" @click="goSettings">
<wd-icon name="setting1" size="24px" color="#666" />
<text>{{ $t('user.settings') }}</text>
</view>
<template>
<scroll-view
scroll-y
refresher-enabled
:refresher-triggered="isRefreshing"
@refresherrefresh="handleRefresh"
v-if="tokenState"
>
<view class="user-page" :style="{ paddingTop: getNotchHeight() + 30 + 'px' }" v-if="tokenState">
<!-- 设置图标 -->
<view class="settings-icon" :style="{ top: getNotchHeight() + 30 + 'px' }" @click="goSettings">
<wd-icon name="setting1" size="24px" color="#666" />
<text>{{ $t('user.settings') }}</text>
</view>
<!-- 用户信息区域 -->
<view class="user-info-section">
<view class="user-info">
<image :src="userInfo.avatar || defaultAvatar" class="avatar" @click="goProfile" />
<view class="user-details">
<text class="nickname">{{ userInfo.nickname || $t('user.notSet') }}</text>
<text v-if="userInfo.email" class="email">{{ userInfo.email }}</text>
<!-- 用户信息区域 -->
<view class="user-info-section">
<view class="user-info">
<image :src="userInfo.avatar || defaultAvatar" class="avatar" @click="goProfile" />
<view class="user-details">
<text class="nickname">{{ userInfo.nickname || $t('user.notSet') }}</text>
<text v-if="userInfo.email" class="email">{{ userInfo.email }}</text>
</view>
</view>
</view>
</view>
<!-- VIP订阅卡片 -->
<view class="vip-card-section">
<view class="vip-card">
<view class="vip-card-title">{{ $t('user.vip') }}</view>
<view class="vip-card-content">
<view class="vip-item-list">
<view v-if="vipInfo?.length > 0" v-for="vip in vipInfo">
{{ vipTypeDict[vip.type] }}{{ parseTime(vip.endTime, '{y}-{m}-{d}') }} 截止</view>
<view v-else>办理课程VIP畅享更多权益</view>
<!-- VIP订阅卡片 -->
<view class="vip-card-section">
<view class="vip-card">
<view class="vip-card-title">{{ $t('user.vip') }}</view>
<view class="vip-card-content">
<view class="vip-item-list">
<view v-if="vipInfo?.length > 0" v-for="vip in vipInfo">
{{ vipTypeDict[vip.type] }}{{ parseTime(vip.endTime, '{y}-{m}-{d}') }} 截止</view>
<view v-else>办理课程VIP畅享更多权益</view>
</view>
<wd-button v-if="vipInfo?.length > 0" plain type="primary" size="small"
@click="goCourseVipSub">{{ $t('vip.renewal') }}</wd-button>
<wd-button v-else plain type="primary" size="small"
@click="goCourseVipSub">{{ $t('vip.openVip') }}</wd-button>
</view>
<wd-button v-if="vipInfo?.length > 0" plain type="primary" size="small"
@click="goCourseVipSub">{{ $t('vip.renewal') }}</wd-button>
<wd-button v-else plain type="primary" size="small"
@click="goCourseVipSub">{{ $t('vip.openVip') }}</wd-button>
</view>
<view class="vip-card-content">
<view class="vip-item-list">
<view v-if="vipInfoEbook?.length > 0" v-for="vip in vipInfoEbook">
电子书VIP{{ vipTypeDict[vip.type] }}{{ parseTime(vip.endTime, '{y}-{m}-{d}') }} 截止</view>
<view v-else>办理电子书VIP畅享更多权益</view>
<view class="vip-card-content">
<view class="vip-item-list">
<view v-if="vipInfoEbook?.length > 0" v-for="vip in vipInfoEbook">
电子书VIP{{ vipTypeDict[vip.type] }}{{ parseTime(vip.endTime, '{y}-{m}-{d}') }} 截止</view>
<view v-else>办理电子书VIP畅享更多权益</view>
</view>
<wd-button v-if="!vipInfoEbook?.length" plain type="primary" size="small"
@click="goSubscribe">{{ $t('vip.openVip') }}</wd-button>
</view>
<wd-button v-if="!vipInfoEbook?.length" plain type="primary" size="small"
@click="goSubscribe">{{ $t('vip.openVip') }}</wd-button>
</view>
</view>
</view>
<!-- 我的资产 -->
<view class="assets-card-section wallet-section">
<view class="assets-card wallet_l">
<view class="assets">
<view @click="goVirtualList">
<view class="assets_row">{{ t('global.coin') }}</view>
<view>{{userInfo.peanutCoin ?? 1}}</view>
<!-- 我的资产 -->
<view class="assets-card-section wallet-section">
<view class="assets-card wallet_l">
<view class="assets">
<view @click="goVirtualList">
<view class="assets_row">{{ t('global.coin') }}</view>
<view>{{userInfo.peanutCoin ?? 1}}</view>
</view>
<view @click="goPointsList">
<view class="assets_row">积分</view>
<view>{{userInfo.jf ?? 1}}</view>
</view>
<!-- <view>
<view class="assets_row">优惠卷</view>
<view>0</view>
</view> -->
</view>
<view @click="goPointsList">
<view class="assets_row">积分</view>
<view>{{userInfo.jf ?? 1}}</view>
</view>
<!-- <view>
<view class="assets_row">优惠卷</view>
<view>0</view>
</view> -->
<view class="chong_btn" @click="goRecharge"> </view>
<!-- <text class="wallet_title">{{$t('my.coin')}}<uni-icons type="help" size="19" color="#666"></uni-icons></text>
<text class="wallet_count">{{userMes.peanutCoin}}</text> -->
</view>
<view class="chong_btn" @click="goRecharge"> </view>
<!-- <text class="wallet_title">{{$t('my.coin')}}<uni-icons type="help" size="19" color="#666"></uni-icons></text>
<text class="wallet_count">{{userMes.peanutCoin}}</text> -->
</view>
<!-- 功能菜单列表 -->
<view class="menu-section">
<wd-cell-group border class="menu-list">
<wd-cell v-for="item in menuItems" :key="item.id" :title="item.name" :label="item.desc" is-link
@click="handleMenuClick(item)">
<text v-if="item.hufenState" class="menu-list-hufen">{{hufenData?.total ?? 0}}<text
style="margin-left: 6rpx;">湖分</text></text>
</wd-cell>
</wd-cell-group>
</view>
</view>
<!-- 功能菜单列表 -->
<view class="menu-section">
<wd-cell-group border class="menu-list">
<wd-cell v-for="item in menuItems" :key="item.id" :title="item.name" :label="item.desc" is-link
@click="handleMenuClick(item)">
<text v-if="item.hufenState" class="menu-list-hufen">{{hufenData?.total ?? 0}}<text
style="margin-left: 6rpx;">湖分</text></text>
</wd-cell>
</wd-cell-group>
</view>
</view>
</scroll-view>
<visitor v-else></visitor>
</template>
@@ -166,6 +174,9 @@
// 湖分
const hufenData = ref()
const tokenState = ref(false)
// 下拉刷新状态
const isRefreshing = ref(false)
/**
* 获取平台信息
@@ -186,6 +197,28 @@
}
}
/**
* 处理下拉刷新
*/
const handleRefresh = async () => {
isRefreshing.value = true
try {
// 刷新所有数据
await Promise.all([
getData(),
getHufen()
])
} catch (error) {
console.error('刷新数据失败:', error)
} finally {
// 延迟关闭刷新状态,避免闪烁
setTimeout(() => {
isRefreshing.value = false
}, 500)
}
}
/**
* 获取用户湖分
*/
@@ -297,6 +330,7 @@
.user-page {
min-height: calc(100vh - 50px);
background-color: #f7faf9;
position: relative;
}
.settings-icon {