fix: 套装方案对比仅商业认证用户可用,美化入口按钮
Some checks failed
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 5s
Test / build-check (push) Successful in 4s
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 13s
Test / e2e-test (push) Has been cancelled

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-13 23:15:56 +00:00
parent 981765e4bb
commit 750b247b5b
2 changed files with 34 additions and 1 deletions

View File

@@ -109,11 +109,15 @@
<script setup> <script setup>
import { ref, computed, onMounted, watch } from 'vue' import { ref, computed, onMounted, watch } from 'vue'
import { useRouter } from 'vue-router'
import { useAuthStore } from '../stores/auth'
import { useOilsStore } from '../stores/oils' import { useOilsStore } from '../stores/oils'
import { useRecipesStore } from '../stores/recipes' import { useRecipesStore } from '../stores/recipes'
import { useUiStore } from '../stores/ui' import { useUiStore } from '../stores/ui'
import { useKitCost } from '../composables/useKitCost' import { useKitCost } from '../composables/useKitCost'
const router = useRouter()
const auth = useAuthStore()
const oils = useOilsStore() const oils = useOilsStore()
const recipeStore = useRecipesStore() const recipeStore = useRecipesStore()
const ui = useUiStore() const ui = useUiStore()
@@ -125,6 +129,10 @@ const sellingPrices = ref({})
const activeKitData = computed(() => kitAnalysis.value.find(k => k.id === activeKit.value)) const activeKitData = computed(() => kitAnalysis.value.find(k => k.id === activeKit.value))
onMounted(async () => { onMounted(async () => {
if (!auth.isBusiness && !auth.isAdmin) {
router.replace('/projects')
return
}
if (!oils.oilNames.length) await oils.loadOils() if (!oils.oilNames.length) await oils.loadOils()
if (!recipeStore.recipes.length) await recipeStore.loadRecipes() if (!recipeStore.recipes.length) await recipeStore.loadRecipes()
loadSellingPrices() loadSellingPrices()

View File

@@ -10,7 +10,7 @@
<div class="toolbar-sticky"> <div class="toolbar-sticky">
<div class="toolbar-inner"> <div class="toolbar-inner">
<h3 class="page-title">📊 服务项目成本利润分析</h3> <h3 class="page-title">📊 服务项目成本利润分析</h3>
<button class="btn-outline btn-sm" @click="$router.push('/kit-export')">套装方案对比</button> <button class="btn-kit-compare" @click="handleKitExport">📦 套装方案对比</button>
<button class="btn-primary btn-sm" @click="handleCreateProject">+ 新增项目</button> <button class="btn-primary btn-sm" @click="handleCreateProject">+ 新增项目</button>
</div> </div>
</div> </div>
@@ -297,6 +297,14 @@ function selectDemoProject() {
} }
} }
function handleKitExport() {
if (!auth.isBusiness && !auth.isAdmin) {
showCertPrompt()
return
}
router.push('/kit-export')
}
function handleCreateProject() { function handleCreateProject() {
if (!auth.isBusiness && !auth.isAdmin) { if (!auth.isBusiness && !auth.isAdmin) {
showCertPrompt() showCertPrompt()
@@ -867,6 +875,23 @@ function formatDate(d) {
font-weight: 500; font-weight: 500;
} }
.btn-kit-compare {
background: linear-gradient(135deg, #f0e6d3 0%, #e8d5b8 100%);
color: #7a6540;
border: 1.5px solid #d4c4a0;
border-radius: 10px;
padding: 6px 14px;
font-size: 12px;
cursor: pointer;
font-family: inherit;
font-weight: 500;
transition: all 0.15s;
}
.btn-kit-compare:hover {
background: linear-gradient(135deg, #e8d5b8 0%, #d4c4a0 100%);
box-shadow: 0 2px 6px rgba(122, 101, 64, 0.15);
}
/* Buttons */ /* Buttons */
.btn-primary { .btn-primary {
background: linear-gradient(135deg, #7ec6a4 0%, #4a9d7e 100%); background: linear-gradient(135deg, #7ec6a4 0%, #4a9d7e 100%);