This commit is contained in:
2025-09-29 21:38:32 +08:00
parent ed26244cdb
commit 19117de6c8
182 changed files with 11590 additions and 2156 deletions

View File

@@ -222,9 +222,16 @@ export default {
formatDisplay(value) {
if (!value) return '-'
const s = String(value)
// 简单规范化:只保留到分钟
const m = s.match(/^(\d{4}-\d{2}-\d{2})([ T](\d{2}:\d{2}))/)
if (m) return `${m[1]} ${m[3]}`
// 仅显示“YYYY-MM-DD”
const m = s.match(/^(\d{4}-\d{2}-\d{2})/)
if (m) return m[1]
const d = new Date(s)
if (!isNaN(d.getTime())) {
const y = d.getFullYear()
const mo = String(d.getMonth() + 1).padStart(2, '0')
const da = String(d.getDate()).padStart(2, '0')
return `${y}-${mo}-${da}`
}
return s
},
startLogin() {

View File

@@ -46,6 +46,17 @@
</view>
</view>
<!-- 已是VIP展示申请普通管理员入口 -->
<view v-if="isVip" class="apply-card">
<view class="apply-text">
<text class="apply-title">申请成为普通管理员</text>
<text class="apply-desc">在普通管理端参与配件审核</text>
</view>
<view role="button" :class="['apply-btn', { disabled: applyDisabled }]" @click="onApplyNormalAdmin">
<text>{{ applyBtnText }}</text>
</view>
</view>
<view v-if="!isVip" class="purchase-card">
<view class="purchase-text">
<text class="purchase-title">立即升级 VIP</text>
@@ -67,21 +78,59 @@ export default {
isVip: false,
expire: '',
price: 0,
benefits: []
benefits: [],
normalAdmin: { isNormalAdmin: false, applicationStatus: 'none' }
}
},
onShow(){
this.loadVip()
this.loadNormalAdminStatus()
this.composeBenefits()
},
computed: {
expireDisplay(){
const s = String(this.expire || '')
return s || '11年11月11日'
const v = this.expire
if (v === null || v === undefined) return ''
if (typeof v === 'number') {
const d = new Date(v)
if (!isNaN(d.getTime())) {
const y = d.getFullYear()
const m = String(d.getMonth() + 1).padStart(2, '0')
const dd = String(d.getDate()).padStart(2, '0')
return `${y}-${m}-${dd}`
}
return ''
}
const s = String(v)
const m = s.match(/^(\d{4}-\d{2}-\d{2})/)
if (m) return m[1]
const idx = s.search(/[ T]/)
if (idx > 0) {
const head = s.slice(0, idx)
if (head) return head
}
const d2 = new Date(s)
if (!isNaN(d2.getTime())) {
const y = d2.getFullYear()
const m2 = String(d2.getMonth() + 1).padStart(2, '0')
const dd2 = String(d2.getDate()).padStart(2, '0')
return `${y}-${m2}-${dd2}`
}
return s
},
priceDisplay(){
const n = Number(this.price)
return Number.isFinite(n) && n > 0 ? n.toFixed(2) : '0.00'
},
applyDisabled(){
const s = String(this.normalAdmin?.applicationStatus || 'none')
return !!(this.normalAdmin?.isNormalAdmin || s === 'approved' || s === 'pending')
},
applyBtnText(){
if (this.normalAdmin?.isNormalAdmin || this.normalAdmin?.applicationStatus === 'approved') return '已通过'
if (this.normalAdmin?.applicationStatus === 'pending') return '审核中'
if (!this.isVip) return '仅限VIP'
return '提交申请'
}
},
methods: {
@@ -103,6 +152,17 @@ export default {
this.isVip = false
}
},
async loadNormalAdminStatus(){
try {
const data = await get('/api/normal-admin/application/status')
this.normalAdmin = {
isNormalAdmin: !!data?.isNormalAdmin,
applicationStatus: String(data?.applicationStatus || 'none')
}
} catch(e) {
this.normalAdmin = { isNormalAdmin: false, applicationStatus: 'none' }
}
},
async onPay(){
try {
await post('/api/vip/pay', {})
@@ -111,7 +171,20 @@ export default {
} catch(e) {
uni.showToast({ title: String(e.message || '开通失败'), icon: 'none' })
}
}
},
async onApplyNormalAdmin(){
if (this.applyDisabled) {
const msg = this.normalAdmin?.isNormalAdmin || this.normalAdmin?.applicationStatus === 'approved' ? '已通过,无需重复申请' : (this.normalAdmin?.applicationStatus === 'pending' ? '审核中,请耐心等待' : '不可申请')
return uni.showToast({ title: msg, icon: 'none' })
}
try {
await post('/api/normal-admin/apply', { remark: '从我的-会员发起申请' })
uni.showToast({ title: '申请已提交', icon: 'success' })
await this.loadNormalAdminStatus()
} catch(e) {
uni.showToast({ title: String(e.message || '申请失败'), icon: 'none' })
}
}
}
}
</script>
@@ -186,6 +259,9 @@ page {
border-color: #4c8dff;
}
/* 指定 hero 内激活态徽标文本为黑色 */
.vip-hero .status-pill.active text { color: #000 !important; }
.vip-summary {
display: grid;
grid-template-columns: repeat(2, minmax(0,1fr));
@@ -337,6 +413,45 @@ page {
opacity: 0.88;
}
.apply-card {
margin-top: 0;
background: linear-gradient(135deg, rgba(30,173,145,0.14) 0%, rgba(30,173,145,0.06) 100%);
border-radius: 28rpx;
padding: 30rpx 28rpx;
display: flex;
align-items: center;
gap: 24rpx;
border: 2rpx solid rgba(30,173,145,0.18);
box-shadow: 0 10rpx 24rpx rgba(30,173,145,0.15);
}
.apply-text { flex: 1; display:flex; flex-direction: column; gap: 10rpx; }
.apply-title { font-size: 32rpx; font-weight: 800; color: #1ead91; }
.apply-desc { font-size: 24rpx; color: #247a66; line-height: 34rpx; }
.apply-btn {
flex: 0 0 auto;
padding: 20rpx 36rpx;
border-radius: 999rpx;
border: none;
background-color: transparent;
background: linear-gradient(135deg, #1ead91 0%, #159b7e 100%);
color: #fff;
font-size: 28rpx;
font-weight: 700;
box-shadow: 0 10rpx 22rpx rgba(21,155,126,0.20);
}
.apply-btn::after { border: none; }
.apply-btn:active { opacity: .9; }
.apply-btn.disabled {
opacity: .5;
background: #c7e8df;
color: #fff;
box-shadow: none;
pointer-events: none;
}
@media (max-width: 375px) {
.vip-summary {
grid-template-columns: 1fr;