Lufaneng 11 months ago
parent 158713e3b8
commit 1f735c5c53

@ -49,7 +49,7 @@
negative: item.amount < 0, negative: item.amount < 0,
}" }"
> >
{{ item.amount > 0 ? "+" : "" }}¥{{ {{ item.amount > 0 ? "+" : "-" }}¥{{
Math.abs(item.amount).toFixed(2) Math.abs(item.amount).toFixed(2)
}} }}
</view> </view>

@ -1,457 +1,431 @@
<template> <template>
<view class="container"> <view class="container">
<!-- 顶部标题 --> <!-- 顶部标题 -->
<view class="header"> <view class="header">
<view class="header-title">管理您的账户信息和服务</view> <view class="header-title">管理您的账户信息和服务</view>
</view> </view>
<!-- 用户信息卡片 --> <!-- 用户信息卡片 -->
<view class="user-card"> <view class="user-card">
<view class="user-info"> <view class="user-info">
<image <div class="avatar"></div>
<!-- <image
class="avatar" class="avatar"
src="/static/imgs/avatar.png" src="/static/imgs/avatar.png"
mode="aspectFill" mode="aspectFill"
></image> ></image> -->
<view class="user-details"> <view class="user-details">
<view class="username"> <view class="username">
张三 张三
<u-icon <u-icon name="checkmark-circle-fill" color="#ffa500" size="16"></u-icon>
name="checkmark-circle-fill" </view>
color="#ffa500" <view class="user-id">用户ID: U12345678</view>
size="16" <view class="membership">
></u-icon> 会员等级: 年会员 (有效期至: 2026-05-15)
</view> </view>
<view class="user-id">用户ID: U12345678</view> </view>
<view class="membership"> </view>
会员等级: 年会员 (有效期至: 2026-05-15) <view class="edit-btn" @click="editProfile">
</view> <text>点击编辑资料</text>
</view> </view>
</view> </view>
<view class="edit-btn" @click="editProfile">
<text>点击编辑资料</text> <!-- 账户余额 -->
</view> <view class="balance-card">
</view> <div>
<!-- 账户余额 --> <view class="balance-header">
<view class="balance-card"> <view class="balance-label">账户余额</view>
<view class="balance-header"> </view>
<view class="balance-label">账户余额</view> <view class="balance-amount">¥50.00</view>
<u-button type="default" size="small" shape="round" @click="recharge"> </div>
充值 <uv-button type="primary" color="#fff" customStyle="color:#000;width:90px" shape="circle" @click="recharge">
</u-button> 充值
</view> </uv-button>
<view class="balance-amount">¥50.00</view> </view>
</view>
<!-- 会员套餐 -->
<!-- 会员套餐 --> <view class="membership-section">
<view class="membership-section"> <view class="membership-grid">
<view class="membership-grid"> <view class="membership-item" :class="{ active: selectedPlan === 'monthly' }"
<view @click="selectPlan('monthly')">
class="membership-item" <view class="tag">新人特惠</view>
:class="{ active: selectedPlan === 'monthly' }" <view class="plan-name">包月会员</view>
@click="selectPlan('monthly')" <view class="plan-price">¥120</view>
> </view>
<view class="tag new">新人特惠</view> <view class="membership-item" :class="{ active: selectedPlan === 'season' }"
<view class="plan-name">包月会员</view> @click="selectPlan('season')">
<view class="plan-price">¥120</view> <view class="tag">最受欢迎</view>
</view> <view class="plan-name">包季会员</view>
<view <view class="plan-price">¥300</view>
class="membership-item" <view class="plan-discount">立减¥60</view>
:class="{ active: selectedPlan === 'season' }" </view>
@click="selectPlan('season')" <view class="membership-item" :class="{ active: selectedPlan === 'yearly' }"
> @click="selectPlan('yearly')">
<view class="tag popular">最受欢迎</view> <view class="tag">年度首享</view>
<view class="plan-name">包季会员</view> <view class="plan-name">包年会员</view>
<view class="plan-price">¥300</view> <view class="plan-price">¥1000</view>
<view class="plan-discount">立减¥60</view> <view class="plan-discount">立减¥440</view>
</view> </view>
<view </view>
class="membership-item" </view>
:class="{ active: selectedPlan === 'yearly' }"
@click="selectPlan('yearly')" <!-- 支付方式 -->
> <view class="payment-section">
<view class="tag yearly">年度首享</view> <view class="payment-item" :class="{ active: selectedPayment === 'alipay' }"
<view class="plan-name">包年会员</view> @click="selectPayment('alipay')">
<view class="plan-price">¥1000</view> <view class="payment-info">
<view class="plan-discount">立减¥440</view> <uv-icon name="shopping-cart-fill" color="#1677ff" size="24"></uv-icon>
</view> <text class="payment-name">支付宝</text>
</view> </view>
</view> <uv-icon name="checkmark-circle-fill" :color="selectedPayment === 'alipay' ? '#ff3333' : '#ccc'"
size="20"></uv-icon>
<!-- 支付方式 --> </view>
<view class="payment-section"> <view class="payment-item" :class="{ active: selectedPayment === 'wechat' }"
<view @click="selectPayment('wechat')">
class="payment-item" <view class="payment-info">
:class="{ active: selectedPayment === 'alipay' }" <uv-icon name="weixin-fill" color="#07c160" size="24"></uv-icon>
@click="selectPayment('alipay')" <text class="payment-name">微信</text>
> </view>
<view class="payment-info"> <uv-icon name="checkmark-circle-fill" :color="selectedPayment === 'wechat' ? '#ff3333' : '#ccc'"
<u-icon name="alipay-circle-fill" color="#1677ff" size="24"></u-icon> size="20"></uv-icon>
<text class="payment-name">支付宝</text> </view>
</view> </view>
<u-icon
:name=" <!-- 底部按钮 -->
selectedPayment === 'alipay' <view class="bottom-section">
? 'checkmark-circle-fill' <uv-button type="primary" size="large" @click="confirmPayment" :loading="paying">
: 'radio-button-off' 确认支付
" </uv-button>
:color="selectedPayment === 'alipay' ? '#ff3333' : '#ccc'" <view class="agreement">
size="20" 购买前请仔细阅读
></u-icon> <text class="link" @click="showAgreement"></text>
</view> </view>
<view </view>
class="payment-item" </view>
:class="{ active: selectedPayment === 'wechat' }"
@click="selectPayment('wechat')"
>
<view class="payment-info">
<u-icon name="weixin-fill" color="#07c160" size="24"></u-icon>
<text class="payment-name">支付宝</text>
</view>
<u-icon
:name="
selectedPayment === 'wechat'
? 'checkmark-circle-fill'
: 'radio-button-off'
"
:color="selectedPayment === 'wechat' ? '#ff3333' : '#ccc'"
size="20"
></u-icon>
</view>
</view>
<!-- 底部按钮 -->
<view class="bottom-section">
<u-button
type="primary"
size="large"
@click="confirmPayment"
:loading="paying"
>
确认支付
</u-button>
<view class="agreement">
购买前请仔细阅读
<text class="link" @click="showAgreement"></text>
</view>
</view>
</view>
</template> </template>
<script setup> <script setup>
import { ref } from "vue"; import {
import HeaderCustom from "/components/HeaderCustom/HeaderCustom.vue"; ref
import { useAuthStore, useUserStore } from "@/store"; } from "vue";
import RPC from "@/utils/request"; import HeaderCustom from "/components/HeaderCustom/HeaderCustom.vue";
import {
const modal = ref(null); useAuthStore,
const authStore = useAuthStore(); useUserStore
const userStore = useUserStore(); } from "@/store";
import RPC from "@/utils/request";
//
const selectedPlan = ref("season"); // const modal = ref(null);
const selectedPayment = ref("alipay"); // const authStore = useAuthStore();
const paying = ref(false); const userStore = useUserStore();
// //
const selectPlan = (plan) => { const selectedPlan = ref("season"); //
selectedPlan.value = plan; const selectedPayment = ref("alipay"); //
}; const paying = ref(false);
// //
const selectPayment = (payment) => { const selectPlan = (plan) => {
selectedPayment.value = payment; selectedPlan.value = plan;
}; };
// //
const editProfile = () => { const selectPayment = (payment) => {
uni.navigateTo({ selectedPayment.value = payment;
url: "/pagesA/edit-profile/edit-profile", };
});
}; //
const editProfile = () => {
// uni.navigateTo({
const recharge = () => { url: "/pagesA/edit-profile/edit-profile",
uni.navigateTo({ });
url: "/pages/recharge/recharge", };
});
}; //
const recharge = () => {
// uni.navigateTo({
const confirmPayment = async () => { url: "/pages/recharge/recharge",
if (!selectedPlan.value) { });
uni.showToast({ };
title: "请选择会员套餐",
icon: "none", //
}); const confirmPayment = async () => {
return; if (!selectedPlan.value) {
} uni.showToast({
title: "请选择会员套餐",
if (!selectedPayment.value) { icon: "none",
uni.showToast({ });
title: "请选择支付方式", return;
icon: "none", }
});
return; if (!selectedPayment.value) {
} uni.showToast({
title: "请选择支付方式",
paying.value = true; icon: "none",
try { });
const params = { return;
plan: selectedPlan.value, }
paymentMethod: selectedPayment.value,
}; paying.value = true;
try {
// API const params = {
// const result = await RPC.post('/api/payment', params) plan: selectedPlan.value,
paymentMethod: selectedPayment.value,
uni.showToast({ };
title: "正在跳转支付...",
icon: "loading", // API
duration: 2000, // const result = await RPC.post('/api/payment', params)
});
uni.showToast({
// title: "正在跳转支付...",
setTimeout(() => { icon: "loading",
uni.showToast({ duration: 2000,
title: "支付成功", });
icon: "success",
}); //
paying.value = false; setTimeout(() => {
}, 2000); uni.showToast({
} catch (error) { title: "支付成功",
console.error("支付失败:", error); icon: "success",
uni.showToast({ });
title: "支付失败,请重试", paying.value = false;
icon: "none", }, 2000);
}); } catch (error) {
paying.value = false; console.error("支付失败:", error);
} uni.showToast({
}; title: "支付失败,请重试",
icon: "none",
// });
const showAgreement = () => { paying.value = false;
uni.navigateTo({ }
url: "/pages/agreement/agreement", };
});
}; //
const showAgreement = () => {
uni.navigateTo({
url: "/pages/agreement/agreement",
});
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.container { .container {
font-size: 14px; font-size: 14px;
min-height: 100vh; background: linear-gradient(180deg, #7b9cdb 0%, #f8f8f8 40%);
background: linear-gradient(180deg, #7b9cdb 0%, #f8f8f8 40%); padding-bottom: 120px;
padding-bottom: 120px; }
}
.header {
.header { padding: 20px 16px 16px;
padding: 20px 16px 16px;
.header-title {
.header-title { color: white;
color: white; font-size: 18px;
font-size: 18px; font-weight: 500;
font-weight: 500; }
} }
}
.user-card {
.user-card { margin: 0 16px 16px;
margin: 0 16px 16px; background: white;
background: white; border-radius: 12px;
border-radius: 12px; padding: 16px;
padding: 16px; position: relative;
.user-info { .user-info {
display: flex; display: flex;
align-items: center; align-items: center;
margin-bottom: 12px; // margin-bottom: 12px;
.avatar { .avatar {
width: 60px; width: 60px;
height: 60px; height: 60px;
border-radius: 50%; border-radius: 50%;
margin-right: 12px; margin-right: 12px;
} background-color: skyblue;
overflow: hidden;
.user-details {
flex: 1; .img {
width: 100%;
.username { height: 100%;
display: flex; }
align-items: center;
gap: 4px; }
font-size: 18px;
font-weight: bold; .user-details {
color: #333; flex: 1;
margin-bottom: 4px;
} .username {
display: flex;
.user-id { align-items: center;
font-size: 12px; gap: 4px;
color: #999; font-size: 18px;
margin-bottom: 2px; font-weight: bold;
} color: #333;
margin-bottom: 4px;
.membership { }
font-size: 12px;
color: #999; .user-id {
} font-size: 12px;
} color: #999;
} margin-bottom: 2px;
}
.edit-btn {
text-align: right; .membership {
color: #4285f4; font-size: 12px;
font-size: 14px; color: #999;
} }
} }
}
.balance-card {
margin: 0 16px 16px; .edit-btn {
background: linear-gradient(135deg, #4285f4 0%, #6fa8f5 100%); text-align: right;
border-radius: 12px; color: #4285f4;
padding: 20px; font-size: 14px;
color: white; position: absolute;
top: 10px;
.balance-header { right: 20px;
display: flex; }
justify-content: space-between; }
align-items: center;
margin-bottom: 8px; .balance-card {
display: flex;
.balance-label { justify-content: space-between;
font-size: 14px; align-items: center;
opacity: 0.9; margin: 0 16px 16px;
} background: linear-gradient(135deg, #4285f4 0%, #6fa8f5 100%);
} border-radius: 12px;
padding: 16px;
.balance-amount { color: white;
font-size: 32px;
font-weight: bold; .balance-header {
} display: flex;
} justify-content: space-between;
align-items: center;
.membership-section { margin-bottom: 6px;
margin: 0 16px 24px;
.balance-label {
.membership-grid { font-size: 14px;
display: flex; opacity: 0.9;
gap: 8px; }
}
.membership-item {
flex: 1; .balance-amount {
background: white; font-size: 28px;
border-radius: 12px; font-weight: bold;
padding: 16px 12px; }
text-align: center; }
position: relative;
border: 2px solid transparent; .membership-section {
transition: all 0.3s; margin: 0 16px 16px;
&.active { .membership-grid {
border-color: #4285f4; display: flex;
background-color: #f0f7ff; gap: 8px;
}
.membership-item {
.tag { flex: 1;
position: absolute; background: white;
top: -6px; border-radius: 12px;
left: 50%; padding: 16px 12px;
transform: translateX(-50%); text-align: center;
padding: 2px 8px; position: relative;
border-radius: 8px; border: 2px solid transparent;
font-size: 10px; transition: all 0.3s;
color: white; overflow: hidden;
&.new { &.active {
background: #ff6b6b; border-color: #4285f4;
} background-color: #f0f7ff;
}
&.popular {
background: #ff3333; .tag {
} position: absolute;
top: 0px;
&.yearly { left: 0;
background: #ff3333; padding: 2px 8px;
} border-radius: 0 0 10px 0;
} font-size: 10px;
color: white;
.plan-name { background: #ff3333;
font-size: 14px; }
color: #333;
margin: 12px 0 8px; .plan-name {
} font-size: 14px;
color: #333;
.plan-price { margin: 12px 0 8px;
font-size: 20px; }
font-weight: bold;
color: #ff3333; .plan-price {
margin-bottom: 4px; font-size: 20px;
} font-weight: bold;
color: #ff3333;
.plan-discount { margin-bottom: 4px;
font-size: 12px; }
color: #999;
} .plan-discount {
} font-size: 12px;
} color: #999;
} }
}
.payment-section { }
margin: 0 16px 24px; }
.payment-item { .payment-section {
display: flex; margin: 0 16px 24px;
align-items: center;
justify-content: space-between; .payment-item {
background: white; display: flex;
border-radius: 12px; align-items: center;
padding: 16px; justify-content: space-between;
margin-bottom: 8px; background: white;
border: 1px solid #e5e5e5; border-radius: 12px;
transition: all 0.3s; padding: 16px;
margin-bottom: 8px;
&.active { border: 1px solid #e5e5e5;
border-color: #4285f4; transition: all 0.3s;
background-color: #f0f7ff;
} &.active {
border-color: #4285f4;
&:last-child { background-color: #f0f7ff;
margin-bottom: 0; }
}
&:last-child {
.payment-info { margin-bottom: 0;
display: flex; }
align-items: center;
gap: 12px; .payment-info {
display: flex;
.payment-name { align-items: center;
font-size: 14px; gap: 12px;
color: #333;
} .payment-name {
} font-size: 14px;
} color: #333;
} }
}
.bottom-section { }
position: fixed; }
bottom: 0;
left: 0; .bottom-section {
right: 0; position: fixed;
background: white; bottom: 0;
padding: 16px; left: 0;
border-top: 1px solid #e5e5e5; right: 0;
background: white;
.agreement { padding: 16px;
text-align: center; border-top: 1px solid #e5e5e5;
font-size: 12px;
color: #999; .agreement {
margin-top: 12px; text-align: center;
font-size: 12px;
.link { color: #999;
color: #4285f4; margin-top: 12px;
}
} .link {
} color: #4285f4;
}
}
}
</style> </style>
Loading…
Cancel
Save