152 lines
3.9 KiB
Vue
152 lines
3.9 KiB
Vue
<script setup lang="ts">
|
||
/** 京东商品详情居中弹窗(v1.6 蓝图 Phase 4,additive——页面接线随 Phase 5):
|
||
* 居中大弹窗壳(设计稿款式):顶部标题+「编辑/删除」动作(按写权限档渲染)+关闭,
|
||
* 内容区=JdProductDetailContent 共享块(hero 左图右信息/属性分组/SKU 矩阵/图片三区/
|
||
* 放大预览,数据自取)。壳不发请求、不碰业务链——编辑/删除 emit 给页面接既有链
|
||
* (EditDrawer 与 removeOne),与现表格行操作同源。 */
|
||
import JdProductDetailContent from './JdProductDetailContent.vue'
|
||
import type { JdProductItem } from './jd-product-model.ts'
|
||
|
||
const props = defineProps<{
|
||
/** 详情行(来自列表行集;内容块按 item.id 自取详情)。 */
|
||
item: JdProductItem | null
|
||
visible: boolean
|
||
/** 写权限档(超管级投影:平台超管/公司超管,2026-11-23 客户口径):可写档顶部渲染
|
||
* 「编辑/删除」,管理人员与普通账号只读无动作。 */
|
||
canWrite?: boolean
|
||
}>()
|
||
|
||
const emit = defineEmits<{
|
||
/** 关闭弹窗(mask 自身点击/右上 ×)。 */
|
||
(event: 'close'): void
|
||
/** 编辑(页面开 JdProductEditDrawer 既有链)。 */
|
||
(event: 'edit'): void
|
||
/** 删除(页面走 removeOne 既有链:确认弹窗→先桶后库)。 */
|
||
(event: 'remove'): void
|
||
}>()
|
||
|
||
const title = (): string =>
|
||
`商品详情${props.item?.productCode ? ` · ${props.item.productCode}` : ''}`
|
||
</script>
|
||
|
||
<template>
|
||
<div v-if="props.visible" class="jd-modal-mask" @click.self="emit('close')">
|
||
<div class="jd-modal" role="dialog" aria-label="商品详情">
|
||
<header class="jd-modal-head">
|
||
<h3>{{ title() }}</h3>
|
||
<div v-if="props.canWrite" class="jd-modal-actions">
|
||
<button class="jd-modal-btn" type="button" @click="emit('edit')">编辑</button>
|
||
<button class="jd-modal-btn jd-modal-btn-danger" type="button" @click="emit('remove')">删除</button>
|
||
</div>
|
||
<button class="jd-modal-close" type="button" aria-label="关闭" @click="emit('close')">×</button>
|
||
</header>
|
||
<div class="jd-modal-body">
|
||
<JdProductDetailContent :item="props.item" :visible="props.visible" />
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
<style scoped>
|
||
.jd-modal-mask {
|
||
position: fixed;
|
||
inset: 0;
|
||
z-index: 2600;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
padding: 40px 20px;
|
||
background: rgba(45, 66, 86, 0.36);
|
||
backdrop-filter: blur(4px);
|
||
}
|
||
|
||
.jd-modal {
|
||
display: flex;
|
||
flex-direction: column;
|
||
width: min(1080px, 100%);
|
||
max-height: 90vh;
|
||
background: #ffffff;
|
||
border-radius: 14px;
|
||
box-shadow: 0 22px 60px rgba(39, 67, 94, 0.2);
|
||
overflow: hidden;
|
||
}
|
||
|
||
.jd-modal-head {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 12px;
|
||
padding: 14px 20px;
|
||
border-bottom: 1px solid #dbe5ee;
|
||
}
|
||
|
||
.jd-modal-head h3 {
|
||
margin: 0;
|
||
font-size: 15px;
|
||
font-weight: 650;
|
||
color: #24384d;
|
||
flex: 1;
|
||
min-width: 0;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
.jd-modal-actions {
|
||
display: flex;
|
||
gap: 8px;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.jd-modal-btn {
|
||
min-height: 32px;
|
||
padding: 4px 14px;
|
||
border: 1px solid #c7d7e5;
|
||
border-radius: 8px;
|
||
background: #ffffff;
|
||
color: #2f5d8b;
|
||
font-size: 13px;
|
||
cursor: pointer;
|
||
}
|
||
|
||
.jd-modal-btn:hover {
|
||
border-color: #95b1cb;
|
||
background: #edf5fb;
|
||
}
|
||
|
||
.jd-modal-btn-danger {
|
||
color: #a04432;
|
||
border-color: #f0c9c2;
|
||
}
|
||
|
||
.jd-modal-btn-danger:hover {
|
||
background: #fdf1ef;
|
||
border-color: #e0a79c;
|
||
}
|
||
|
||
.jd-modal-close {
|
||
flex-shrink: 0;
|
||
width: 30px;
|
||
height: 30px;
|
||
border: 1px solid transparent;
|
||
border-radius: 9px;
|
||
background: none;
|
||
color: #5b6f83;
|
||
font-size: 20px;
|
||
line-height: 1;
|
||
cursor: pointer;
|
||
}
|
||
|
||
.jd-modal-close:hover {
|
||
border-color: #cbd9e6;
|
||
background: #eef4fa;
|
||
color: #24384d;
|
||
}
|
||
|
||
.jd-modal-body {
|
||
flex: 1;
|
||
min-height: 0;
|
||
overflow-y: auto;
|
||
padding: 16px 20px 28px;
|
||
}
|
||
</style>
|