feat: 更新支付模块 (Stripe/PayPal/PingPong) 和 uni-app 配置

This commit is contained in:
TradeMate Dev
2026-06-16 13:32:50 +08:00
parent e5b1e7d588
commit 15d172e825
17 changed files with 1254 additions and 12 deletions
+36 -4
View File
@@ -9,6 +9,16 @@
</view>
</view>
<view class="credit-card" v-if="user.tier !== 'guest'" @click="goCredits">
<view class="credit-left">
<text class="credit-label">可用次数</text>
<text class="credit-value">{{ creditBalance }}</text>
</view>
<view class="credit-right">
<text class="credit-buy">购买次数 </text>
</view>
</view>
<view class="section">
<view class="section-title">账号设置</view>
<view class="menu-item" v-if="user.tier !== 'guest'" @click="showProfileEdit = true">
@@ -21,9 +31,9 @@
<text class="menu-text">修改密码</text>
<text class="menu-arrow"></text>
</view>
<view class="menu-item" @click="goUpgrade">
<view class="menu-item" @click="goCredits">
<text class="menu-icon"></text>
<text class="menu-text">会员升级</text>
<text class="menu-text">购买次数</text>
<text class="menu-arrow"></text>
</view>
</view>
@@ -128,11 +138,12 @@
<script setup>
import { ref, computed, onMounted } from 'vue'
import { onShow } from '@dcloudio/uni-app'
import { authApi } from '@/utils/api.js'
import { authApi, creditApi } from '@/utils/api.js'
import AiAssistant from '@/components/ai-assistant.vue'
import { STORAGE_KEYS, PAGES, TIER_LABELS } from '@/config.js'
const user = ref({})
const creditBalance = ref(0)
const showProfileEdit = ref(false)
const showPassword = ref(false)
const editForm = ref({ username: '', email: '' })
@@ -158,6 +169,12 @@ const loadUser = async () => {
} catch {
user.value = { tier: 'guest' }
}
try {
const cb = await creditApi.balance()
creditBalance.value = cb.balance || 0
} catch {
creditBalance.value = 0
}
}
const saveProfile = async () => {
@@ -195,7 +212,7 @@ const changePwd = async () => {
}
const goLogin = () => uni.navigateTo({ url: PAGES.LOGIN })
const goUpgrade = () => uni.navigateTo({ url: PAGES.UPGRADE })
const goCredits = () => uni.navigateTo({ url: PAGES.CREDITS })
const goFeedback = () => uni.navigateTo({ url: PAGES.FEEDBACK })
const goAgreement = (type) => uni.navigateTo({ url: `/pages/agreement/${type}` })
const goCertification = () => uni.navigateTo({ url: PAGES.CERTIFICATION })
@@ -280,6 +297,21 @@ onShow(loadUser)
.tier-badge.enterprise { background: #e3f2fd; color: #1565c0; }
.tier-badge.guest { background: #fce4ec; color: #c62828; }
.credit-card {
background: linear-gradient(135deg, #f97316, #ea580c);
border-radius: 16rpx;
padding: 28rpx 32rpx;
margin-bottom: 20rpx;
display: flex;
align-items: center;
justify-content: space-between;
}
.credit-left { display: flex; flex-direction: column; }
.credit-label { font-size: 24rpx; color: rgba(255,255,255,0.8); }
.credit-value { font-size: 48rpx; color: #fff; font-weight: bold; }
.credit-right { }
.credit-buy { font-size: 28rpx; color: #fff; font-weight: 500; }
.section {
background: #fff;
border-radius: 16rpx;