修改套餐价格

This commit is contained in:
wuweihua
2026-09-16 17:14:19 +08:00
parent 7172621fd3
commit 4441aa12bf
48 changed files with 4258 additions and 682 deletions
@@ -0,0 +1,131 @@
<template>
<set-section-card :title="title" tone="green" :count="filteredVersions.length">
<el-tabs v-model="statusTab" class="ver-tabs">
<el-tab-pane :label="tabLabel('all')" name="all" />
<el-tab-pane :label="tabLabel('0')" name="0" />
<el-tab-pane :label="tabLabel('1')" name="1" />
<el-tab-pane :label="tabLabel('2')" name="2" />
</el-tabs>
<el-table :data="filteredVersions" border empty-text="暂无版本">
<el-table-column :label="colNo" width="100">
<template #default="{ row }">
<el-button link type="primary" @click="openDetails(row)">{{ row.versionNo || '-' }}</el-button>
</template>
</el-table-column>
<el-table-column :label="colEff" min-width="170">
<template #default="{ row }">{{ row.effectiveTime || '-' }}</template>
</el-table-column>
<el-table-column :label="colExp" min-width="170">
<template #default="{ row }">{{ row.expireTime || '-' }}</template>
</el-table-column>
<el-table-column :label="colStatus" width="100" align="center">
<template #default="{ row }">
<el-tag :type="versionStatusTag(row.status)" size="small">{{ versionStatusLabel(row.status) }}</el-tag>
</template>
</el-table-column>
<el-table-column :label="colRows" width="100" align="center">
<template #default="{ row }">{{ detailCount(row) }}</template>
</el-table-column>
<el-table-column :label="colAction" width="320" align="center" fixed="right">
<template #default="{ row }">
<el-button link type="primary" @click="openDetails(row)">查看详情</el-button>
<el-button
v-if="String(row.status) === '0'"
link
type="primary"
@click="emit('edit', row)"
v-hasPermi="['price:set:edit']"
>继续配置</el-button>
<el-button
v-if="String(row.status) === '0'"
link
type="success"
@click="emit('activate', row)"
v-hasPermi="['price:set:edit']"
>启动</el-button>
<el-button
v-if="String(row.status) === '0'"
link
type="danger"
@click="emit('remove', row)"
v-hasPermi="['price:set:edit']"
>删除</el-button>
<el-button
v-if="String(row.status) === '1'"
link
type="primary"
@click="emit('copy-version', row)"
v-hasPermi="['price:set:add']"
>复制为新版本</el-button>
</template>
</el-table-column>
</el-table>
</set-section-card>
</template>
<script setup name="SetVersionTable">
import SetSectionCard from './SetSectionCard.vue'
import { versionStatusLabel, versionStatusTag } from '../../utils/priceSet'
const props = defineProps({
versions: { type: Array, default: () => [] },
modelValue: { type: [Number, String], default: undefined }
})
const emit = defineEmits(['update:modelValue', 'copy-version', 'open-details', 'activate', 'edit', 'remove'])
const title = '套餐版本'
const colNo = '版本号'
const colEff = '生效时间'
const colExp = '失效时间'
const colStatus = '状态'
const colRows = '明细行数'
const colAction = '操作'
const statusTab = ref('all')
const counts = computed(() => {
const map = { all: 0, '0': 0, '1': 0, '2': 0 }
;(props.versions || []).forEach(v => {
map.all++
const s = String(v.status == null ? '' : v.status)
if (map[s] != null) map[s]++
})
return map
})
function tabLabel(key) {
const labels = {
all: '全部',
'0': '草稿',
'1': '生效',
'2': '失效'
}
return labels[key] + ' (' + (counts.value[key] || 0) + ')'
}
const filteredVersions = computed(() => {
const list = props.versions || []
if (statusTab.value === 'all') return list
return list.filter(v => String(v.status) === statusTab.value)
})
function detailCount(row) {
if (row && row.detailCount != null) return row.detailCount
return (row && row.details || []).length
}
function openDetails(row) {
if (!row || row.psvId == null) return
emit('update:modelValue', row.psvId)
emit('open-details', row)
}
</script>
<style scoped>
.ver-tabs {
margin-bottom: 8px;
}
.ver-tabs :deep(.el-tabs__header) {
margin-bottom: 8px;
}
</style>