充值页面

This commit is contained in:
2025-11-24 17:56:34 +08:00
parent b357225703
commit a63bd684b5
3 changed files with 386 additions and 297 deletions

View File

@@ -215,3 +215,31 @@ export async function verifyIAP(data: any) {
}) })
return res return res
} }
/**
* 获取充值列表
* @param type 固定值 point
* @param qudao 支付类型
*/
export async function getBookBuyConfigList(type: string, qudao: string) {
const res = await mainClient.request<IApiResponse>({
url: 'common/bookBuyConfig/getBookBuyConfigList',
method: 'POST',
data: {type, qudao}
})
return res
}
/**
* 获取隐私协议
* @param id 101众妙之门隐私政策
*/
export async function getAgreement(id: string) {
console.log(id, 'id');
const res = await mainClient.request<IApiResponse>({
url: '/sys/agreement/getAgreement',
method: 'POST',
data: {id}
})
return res
}

View File

@@ -67,6 +67,18 @@
"navigationBarTitleText": "%user.feedback%", "navigationBarTitleText": "%user.feedback%",
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, {
"path": "pages/user/recharge/index",
"style": {
"navigationBarTitleText": "%user.recharge%",
"navigationStyle": "custom"
}
},{
"path": "pages/user/virtual/index",
"style": {
"navigationBarTitleText": "%user.virtual%",
"navigationStyle": "custom"
}
}, { }, {
"path": "pages/user/myBook/index", "path": "pages/user/myBook/index",
"style": { "style": {

View File

@@ -9,11 +9,7 @@
<!-- 用户信息区域 --> <!-- 用户信息区域 -->
<view class="user-info-section"> <view class="user-info-section">
<view class="user-info"> <view class="user-info">
<image <image :src="userInfo.avatar || defaultAvatar" class="avatar" @click="goProfile" />
:src="userInfo.avatar || defaultAvatar"
class="avatar"
@click="goProfile"
/>
<view class="user-details"> <view class="user-details">
<text class="nickname">{{ userInfo.nickname || $t('user.notSet') }}</text> <text class="nickname">{{ userInfo.nickname || $t('user.notSet') }}</text>
<text v-if="userInfo.email" class="email">{{ userInfo.email }}</text> <text v-if="userInfo.email" class="email">{{ userInfo.email }}</text>
@@ -46,7 +42,21 @@
<!-- 我的资产 --> <!-- 我的资产 -->
<view class="vip-card-section wallet-section"> <view class="vip-card-section wallet-section">
<view class="vip-card wallet_l"> <view class="vip-card wallet_l">
我的资产功能重写中 <view class="assets">
<view @click="goVirtualList">
<view class="assets_row">天医币</view>
<view>{{userInfo.peanutCoin ?? 1}}</view>
</view>
<view>
<view class="assets_row">积分</view>
<view>{{userInfo.jf ?? 1}}</view>
</view>
<view>
<view class="assets_row">优惠卷</view>
<view>0</view>
</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_title">{{$t('my.coin')}}<uni-icons type="help" size="19" color="#666"></uni-icons></text>
<text class="wallet_count">{{userMes.peanutCoin}}</text> --> <text class="wallet_count">{{userMes.peanutCoin}}</text> -->
</view> </view>
@@ -55,12 +65,7 @@
<!-- 功能菜单列表 --> <!-- 功能菜单列表 -->
<view class="menu-section"> <view class="menu-section">
<view class="menu-list"> <view class="menu-list">
<view <view v-for="item in menuItems" :key="item.id" class="menu-item" @click="handleMenuClick(item)">
v-for="item in menuItems"
:key="item.id"
class="menu-item"
@click="handleMenuClick(item)"
>
<text class="menu-text">{{ item.name }}</text> <text class="menu-text">{{ item.name }}</text>
<wd-icon name="arrow-right" size="16px" color="#aaa" /> <wd-icon name="arrow-right" size="16px" color="#aaa" />
</view> </view>
@@ -70,34 +75,34 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed, onMounted } from 'vue' import { ref, computed, onMounted } from 'vue'
import { useUserStore } from '@/stores/user' import { useUserStore } from '@/stores/user'
import { getUserInfo, getVipInfo } from '@/api/modules/user' import { getUserInfo, getVipInfo } from '@/api/modules/user'
import type { IVipInfo } from '@/types/user' import type { IVipInfo } from '@/types/user'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { getNotchHeight } from '@/utils/system' import { getNotchHeight } from '@/utils/system'
const { t } = useI18n() const { t } = useI18n()
const userStore = useUserStore() const userStore = useUserStore()
// 默认头像 // 默认头像
const defaultAvatar = '/static/home_icon.png' const defaultAvatar = '/static/home_icon.png'
// 用户信息 // 用户信息
const userInfo = computed(() => userStore.userInfo) const userInfo = computed(() => userStore.userInfo)
// VIP信息 // VIP信息
const vipInfo = ref<IVipInfo>({ const vipInfo = ref<IVipInfo>({
id: 0, id: 0,
endTime: '', endTime: '',
vipType: 0 vipType: 0
}) })
// 平台信息 // 平台信息
const platform = ref('') const platform = ref('')
// 菜单项 // 菜单项
const menuItems = computed(() => [ const menuItems = computed(() => [
{ {
id: 1, id: 1,
name: t('user.myOrders'), name: t('user.myOrders'),
@@ -128,23 +133,24 @@ const menuItems = computed(() => [
url: '/pages/user/feedback/index', url: '/pages/user/feedback/index',
type: 'pageJump' type: 'pageJump'
} }
]) ])
/** /**
* 获取平台信息 * 获取平台信息
*/ */
const getPlatform = () => { const getPlatform = () => {
const systemInfo = uni.getSystemInfoSync() const systemInfo = uni.getSystemInfoSync()
platform.value = systemInfo.platform === 'android' ? 'android' : 'ios' platform.value = systemInfo.platform === 'android' ? 'android' : 'ios'
} }
/** /**
* 获取数据 * 获取数据
*/ */
const getData = async () => { const getData = async () => {
try { try {
// 获取用户信息 // 获取用户信息
const userRes = await getUserInfo() const userRes = await getUserInfo()
console.log(userRes);
if (userRes.user) { if (userRes.user) {
userStore.setUserInfo(userRes.user) userStore.setUserInfo(userRes.user)
} }
@@ -157,39 +163,39 @@ const getData = async () => {
} catch (error) { } catch (error) {
console.error('获取数据失败:', error) console.error('获取数据失败:', error)
} }
} }
/** /**
* 跳转到设置页面 * 跳转到设置页面
*/ */
const goSettings = () => { const goSettings = () => {
uni.navigateTo({ uni.navigateTo({
url: '/pages/user/settings/index' url: '/pages/user/settings/index'
}) })
} }
/** /**
* 跳转到个人资料页面 * 跳转到个人资料页面
*/ */
const goProfile = () => { const goProfile = () => {
uni.navigateTo({ uni.navigateTo({
url: '/pages/user/profile/index' url: '/pages/user/profile/index'
}) })
} }
/** /**
* 跳转到订阅页面 * 跳转到订阅页面
*/ */
const goSubscribe = () => { const goSubscribe = () => {
uni.navigateTo({ uni.navigateTo({
url: '/pages/user/wallet/index' url: '/pages/user/wallet/index'
}) })
} }
/** /**
* 处理菜单点击 * 处理菜单点击
*/ */
const handleMenuClick = (item: any) => { const handleMenuClick = (item : any) => {
switch (item.type) { switch (item.type) {
case 'pageJump': case 'pageJump':
uni.navigateTo({ uni.navigateTo({
@@ -202,23 +208,43 @@ const handleMenuClick = (item: any) => {
}) })
break break
} }
} }
onMounted(() => { /**
* 跳转充值页面
*/
const goRecharge = () => {
uni.navigateTo({
url: '/pages/user/recharge/index'
})
}
/**
* 跳转虚拟币页面
*/
const goVirtualList = () => {
uni.navigateTo({
url: '/pages/user/virtual/index'
})
}
onMounted(() => {
getPlatform() getPlatform()
getData() getData()
}) })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
$theme-color: #54a966; $theme-color: #54a966;
.user-page { .user-page {
min-height: 100vh; min-height: 100vh;
background-color: #f7faf9; background-color: #f7faf9;
} }
.settings-icon { .settings-icon {
position: absolute; position: absolute;
right: 20px; right: 20px;
z-index: 2; z-index: 2;
@@ -232,14 +258,14 @@ $theme-color: #54a966;
font-size: 28rpx; font-size: 28rpx;
color: #333; color: #333;
} }
} }
.user-info-section { .user-info-section {
padding: 0 30rpx; padding: 0 30rpx;
margin-bottom: 50rpx; margin-bottom: 50rpx;
} }
.user-info { .user-info {
display: flex; display: flex;
align-items: center; align-items: center;
@@ -274,14 +300,14 @@ $theme-color: #54a966;
color: #333; color: #333;
} }
} }
} }
.vip-card-section { .vip-card-section {
padding: 0 20rpx; padding: 0 20rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;
} }
.vip-card { .vip-card {
background: #fff; background: #fff;
border-radius: 15rpx; border-radius: 15rpx;
padding: 40rpx; padding: 40rpx;
@@ -306,20 +332,20 @@ $theme-color: #54a966;
color: $theme-color; color: $theme-color;
} }
} }
} }
.menu-section { .menu-section {
padding: 20rpx 20rpx 0; padding: 20rpx 20rpx 0;
} }
.menu-list { .menu-list {
background: #fff; background: #fff;
border-radius: 15rpx; border-radius: 15rpx;
overflow: hidden; overflow: hidden;
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05); box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
} }
.menu-item { .menu-item {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
@@ -339,5 +365,28 @@ $theme-color: #54a966;
color: #333; color: #333;
line-height: 40rpx; line-height: 40rpx;
} }
} }
.chong_btn {
font-size: 26rpx;
display: block;
border-radius: 50rpx;
color: #fffbf6;
padding: 10rpx 32rpx;
background-image: linear-gradient(90deg, #3ab3ae 0%, #d5ecdd 200%);
}
.assets {
display: flex;
flex: 1;
justify-content: space-around;
text-align: center;
transform:translateX(-20px);
.assets_row {
margin-bottom: 20rpx;
}
}
</style> </style>