fix: 套餐
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 6m14s

This commit is contained in:
sexygoat
2026-04-28 18:40:18 +08:00
parent 55515410ae
commit b6625748ac
5 changed files with 320 additions and 60 deletions

View File

@@ -1359,7 +1359,8 @@
const res = await PackageManageService.getPackages(params)
if (res.code === 0) {
packageOptions.value = res.data.items
// 过滤掉赠送套餐
packageOptions.value = res.data.items.filter((pkg) => !pkg.is_gift)
}
} catch (error) {
console.error('加载套餐选项失败:', error)
@@ -1999,6 +2000,16 @@
// 可选:套餐配置(将元转换为分)
if (form.packages.length > 0) {
// 验证是否包含赠送套餐
for (const pkg of form.packages) {
const pkgInfo = packageOptions.value.find((p) => p.id === pkg.package_id)
if (pkgInfo?.is_gift) {
ElMessage.error(`套餐 ${getPackageName(pkg.package_id)} 是赠送套餐,不能参与授权`)
submitLoading.value = false
return
}
}
// 验证成本价是否在允许范围内
for (const pkg of form.packages) {
const costPrice = pkg.cost_price ?? 0
@@ -2138,7 +2149,8 @@
const res = await PackageManageService.getPackages(params)
if (res.code === 0) {
availablePackages.value = res.data.items
// 过滤掉赠送套餐
availablePackages.value = res.data.items.filter((pkg) => !pkg.is_gift)
}
} catch (error) {
console.error('加载套餐选项失败:', error)