feat: 方案待定制可编辑+通知去定制按钮+权限修复
All checks were successful
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 15s
Test / e2e-test (push) Successful in 50s

- 会员等待中可修改健康需求,修改后通知老师
- 通知里方案请求显示"去定制"按钮跳转用户管理
- 后端: 方案owner可更新health_desc,teacher可改title/status

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-12 22:04:14 +00:00
parent fe74f45bca
commit a6c8e7a6e1
3 changed files with 53 additions and 6 deletions

View File

@@ -32,12 +32,13 @@
</div>
</div>
<!-- Pending plan -->
<!-- Pending plan: editable -->
<div v-else-if="plansStore.pendingPlans.length" class="plan-section plan-pending">
<div class="plan-header">
<span class="plan-title"> 方案审核</span>
<span class="plan-title"> 老师正在为你定制方案中</span>
</div>
<p class="plan-desc">{{ plansStore.pendingPlans[0].health_desc }}</p>
<textarea v-model="pendingDesc" class="form-textarea" rows="3" @blur="updatePendingDesc"></textarea>
<div class="plan-pending-hint">修改后老师会收到通知</div>
</div>
<!-- No plan: request button -->
@@ -324,6 +325,28 @@ function matchTeacher() {
) || null
}
const pendingDesc = ref('')
// Sync pendingDesc when plans load
watch(() => plansStore.pendingPlans, (pp) => {
if (pp.length) pendingDesc.value = pp[0].health_desc || ''
}, { immediate: true })
async function updatePendingDesc() {
const plan = plansStore.pendingPlans[0]
if (!plan || pendingDesc.value === plan.health_desc) return
try {
await api(`/api/oil-plans/${plan.id}`, {
method: 'PUT',
body: JSON.stringify({ health_desc: pendingDesc.value }),
})
plan.health_desc = pendingDesc.value
ui.showToast('已更新,老师会收到通知')
} catch {
ui.showToast('更新失败')
}
}
const shoppingTotal = computed(() =>
plansStore.shoppingList.filter(i => !i.in_inventory).reduce((s, i) => s + i.total_cost, 0).toFixed(2)
)
@@ -641,6 +664,7 @@ onMounted(async () => {
.overlay-header h3 { margin: 0; font-size: 16px; }
.form-label { display: block; font-size: 13px; color: #6b6375; margin-bottom: 4px; font-weight: 500; }
.form-textarea { width: 100%; border: 1.5px solid #e5e4e7; border-radius: 8px; padding: 8px; font-size: 13px; font-family: inherit; resize: vertical; box-sizing: border-box; }
.plan-pending-hint { font-size: 11px; color: #b0aab5; margin-top: 4px; }
.teacher-matched { color: #2e7d5a; font-size: 13px; margin-top: 4px; font-weight: 500; }
.teacher-no-match { color: #c62828; font-size: 12px; margin-top: 4px; }
</style>