fix: package-list
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 46s

This commit is contained in:
sexygoat
2026-04-15 15:17:12 +08:00
parent 181d24a388
commit d3a40f0d77
3 changed files with 167 additions and 8 deletions

View File

@@ -492,12 +492,13 @@
.btn-login {
width: 100%;
height: 108rpx;
background: #FFFFFF;
border: none;
background: rgba(255, 255, 255, 0.25);
backdrop-filter: blur(10px);
border: 2rpx solid rgba(255, 255, 255, 0.4);
border-radius: 20rpx;
font-size: 36rpx;
font-weight: 600;
color: $uni-color-primary;
color: #FFFFFF;
display: flex;
align-items: center;
justify-content: center;
@@ -506,8 +507,9 @@
}
.btn-login.disabled {
background: rgba(255, 255, 255, 0.4);
background: rgba(255, 255, 255, 0.3);
color: rgba(255, 255, 255, 0.7);
border: 2rpx solid rgba(255, 255, 255, 0.2);
box-shadow: none;
}

View File

@@ -69,6 +69,9 @@
<view class="info-value">{{ item.created_at }}</view>
</view>
</view>
<view v-if="item.status === 0" class="record-actions">
<button class="btn-pay" @tap="handleRechargePayment(item)">立即支付</button>
</view>
</view>
<view class="load-more" v-if="rechargeList.length > 0">
@@ -534,6 +537,119 @@
rechargeLoading.value = false;
};
const handleRechargePayment = async (rechargeOrder) => {
uni.showLoading({
title: '处理中...',
mask: true
});
try {
// 获取充值订单详情(包含支付配置)
const rechargeData = await walletApi.getRechargeOrderDetail(
userStore.state.identifier,
rechargeOrder.recharge_order_id || rechargeOrder.recharge_id
);
uni.hideLoading();
// 验证支付配置
if (!rechargeData.pay_config || !rechargeData.pay_config.package) {
uni.showToast({
title: '支付参数获取失败',
icon: 'none'
});
return;
}
// 调起微信支付
// #ifdef H5
if (typeof WeixinJSBridge === 'undefined') {
uni.showToast({
title: '请在微信中打开',
icon: 'none'
});
return;
}
WeixinJSBridge.invoke('getBrandWCPayRequest', {
appId: rechargeData.pay_config.app_id,
timeStamp: rechargeData.pay_config.timestamp,
nonceStr: rechargeData.pay_config.nonce_str,
package: rechargeData.pay_config.package,
signType: rechargeData.pay_config.sign_type,
paySign: rechargeData.pay_config.pay_sign
}, function(res) {
if (res.err_msg === 'get_brand_wcpay_request:ok') {
uni.showToast({
title: '充值成功',
icon: 'success'
});
setTimeout(() => {
loadWalletDetail();
rechargePage.value = 1;
rechargeNoMore.value = false;
loadRechargeList();
}, 1500);
} else if (res.err_msg === 'get_brand_wcpay_request:cancel') {
uni.showToast({
title: '已取消支付',
icon: 'none'
});
} else {
uni.showToast({
title: '支付失败',
icon: 'none'
});
}
});
// #endif
// #ifndef H5
uni.requestPayment({
timeStamp: rechargeData.pay_config.timestamp,
nonceStr: rechargeData.pay_config.nonce_str,
package: rechargeData.pay_config.package,
signType: rechargeData.pay_config.sign_type,
paySign: rechargeData.pay_config.pay_sign,
success: (res) => {
uni.showToast({
title: '充值成功',
icon: 'success'
});
setTimeout(() => {
loadWalletDetail();
rechargePage.value = 1;
rechargeNoMore.value = false;
loadRechargeList();
}, 1500);
},
fail: (err) => {
if (err.errMsg && (err.errMsg.includes('cancel') || err.errMsg.includes('用户取消'))) {
uni.showToast({
title: '已取消支付',
icon: 'none'
});
} else {
uni.showToast({
title: '支付失败',
icon: 'none'
});
}
}
});
// #endif
} catch (e) {
uni.hideLoading();
console.error('获取支付配置失败', e);
const errorMsg = e.msg || e.message || '支付失败,请稍后重试';
uni.showToast({
title: errorMsg,
icon: 'none'
});
}
};
const loadTransactionList = async (append = false) => {
if (transactionLoading.value || transactionNoMore.value) return;
transactionLoading.value = true;
@@ -787,6 +903,28 @@
}
}
}
.record-actions {
margin-top: 20rpx;
padding-top: 20rpx;
border-top: 1rpx solid var(--border-light);
display: flex;
justify-content: flex-end;
.btn-pay {
background: var(--primary);
color: #fff;
border: none;
border-radius: 8rpx;
padding: 12rpx 32rpx;
font-size: 26rpx;
font-weight: 500;
&::after {
border: none;
}
}
}
}
.empty-state {

View File

@@ -10,7 +10,7 @@
<view class="package-header flex-row-sb">
<view class="package-name">{{ item.package_name }}</view>
<view class="header-right">
<view class="validity-tag">{{ item.validity_days }}</view>
<view class="validity-tag">有效期{{ item.validity_days }}</view>
<view class="tag-apple" :class="item.is_addon ? 'tag-warning' : 'tag-primary'">
{{ item.is_addon ? '加油包' : '正式套餐' }}
</view>
@@ -162,7 +162,26 @@
return;
}
// 检查是否有支付配置(待支付状态应该有
// 检查充值订单是否已存在(待支付状态但无支付配置
if (recharge.status === 0 && (!orderResult.pay_config || !orderResult.pay_config.package)) {
// 待支付订单已存在,引导用户跳转到订单页面
uni.hideLoading();
showModal.value = false;
uni.showModal({
title: '提示',
content: '检测到您有待支付的充值订单,是否前往我的钱包查看?',
confirmText: '去查看',
cancelText: '取消',
success: (res) => {
if (res.confirm) {
uni.navigateTo({ url: '/pages/my-wallet/my-wallet' });
}
}
});
return;
}
// 检查是否有支付配置(新订单应该有)
if (!orderResult.pay_config || !orderResult.pay_config.package) {
uni.hideLoading();
showModal.value = false;
@@ -369,8 +388,8 @@
.package-footer {
align-items: center;
.package-price {
font-size: 32rpx;
font-weight: 600;
font-size: 40rpx;
font-weight: 700;
color: var(--warning);
}
.btn {