修改价格套餐样式结构

This commit is contained in:
wuweihua
2026-09-14 11:53:11 +08:00
parent 4cc20386d9
commit e2f75afb27
16 changed files with 2348 additions and 1330 deletions
@@ -0,0 +1,113 @@
<template>
<set-section-card
title="绑定客户"
tone="green"
:count="customers.length"
sub="一个客户只能绑定一个套餐"
>
<template #action>
<el-button
v-if="editable"
type="primary"
size="small"
icon="Plus"
@click="dialogRef.open()"
v-hasPermi="['price:set:edit']"
>添加客户</el-button>
</template>
<el-table :data="customers" border class="customer-table" empty-text="暂未绑定客户">
<el-table-column label="客户代码" prop="customerCode" min-width="140" show-overflow-tooltip>
<template #default="{ row }">
<span class="c-code">{{ row.customerCode }}</span>
</template>
</el-table-column>
<el-table-column label="客户名称" prop="customerName" min-width="160" show-overflow-tooltip />
<el-table-column label="优先级" width="130" align="center">
<template #default="{ row }">
<el-tag v-if="row.bindPriority === 1" size="small" type="success" effect="light">最高</el-tag>
<span v-else class="priority">{{ row.bindPriority }}</span>
</template>
</el-table-column>
<el-table-column label="有效期" min-width="220">
<template #default="{ row }">{{ formatDateRange(row.prBegindate, row.prEnddate) }}</template>
</el-table-column>
<el-table-column v-if="editable" label="操作" width="120" align="center" fixed="right">
<template #default="{ row }">
<el-button link type="primary" @click="dialogRef.open(row)" v-hasPermi="['price:set:edit']">编辑</el-button>
<el-button link type="danger" @click="remove(row)" v-hasPermi="['price:set:edit']">解绑</el-button>
</template>
</el-table-column>
</el-table>
<div class="table-hint">解绑后该客户可绑定其他套餐;生效中的套餐修改绑定会即时影响计费命中。</div>
<set-customer-dialog
ref="dialogRef"
:price-set-id="set.priceSetId"
:default-begindate="set.effectiveDate"
:default-enddate="set.expireDate"
@success="emit('refresh')"
/>
</set-section-card>
</template>
<script setup name="SetCustomerTable">
/**
* 套餐详情 · 绑定客户表格
* 自带新增 / 编辑弹窗与解绑,数据变更后 emit('refresh') 由页面重新拉取详情。
*/
import SetSectionCard from './SetSectionCard.vue'
import SetCustomerDialog from './SetCustomerDialog.vue'
import { formatDateRange, isChildEditable } from '../../utils/priceSet'
import { delSetCustomer } from '@/api/price/set'
const props = defineProps({
/** 套餐详情对象 */
set: {
type: Object,
required: true
}
})
const emit = defineEmits(['refresh'])
const { proxy } = getCurrentInstance()
const dialogRef = ref()
const customers = computed(() => props.set.customers || [])
const editable = computed(() => isChildEditable(props.set.status))
function remove(row) {
proxy.$modal.confirm('确认解绑该客户?').then(() => delSetCustomer(row.customerPricesetId)).then(() => {
proxy.$modal.msgSuccess('已解绑')
emit('refresh')
}).catch(() => {})
}
</script>
<style scoped>
.customer-table {
border-radius: 6px;
}
.customer-table :deep(th.el-table__cell) {
background: #fafbfc;
color: #606266;
font-weight: 600;
}
.c-code {
font-family: Consolas, Monaco, monospace;
font-size: 12px;
color: #606266;
}
.priority {
color: #303133;
}
.table-hint {
margin-top: 10px;
font-size: 12px;
color: #909399;
line-height: 1.6;
}
</style>