update customer package

This commit is contained in:
Timi
2026-09-07 16:42:12 +08:00
parent d56719df1c
commit ab47086ed7
3 changed files with 67 additions and 10 deletions
+42
View File
@@ -44,6 +44,15 @@
:customer="selectedCustomer"
v-entrance-transition
/>
<t-form-item v-if="isCustomerPackageCreate" label="套餐" required-mark>
<t-input
:model-value="config?.name || ''"
readonly
borderless
placeholder="请选择套餐"
@click="configSelectorVisible = true"
/>
</t-form-item>
<div v-if="config && !isSaleable" class="saleable-tip red">套餐当前不可购买,请检查套餐状态和有效期</div>
<section class="package-purchase-form">
<div v-if="config" class="config-summary">
@@ -156,6 +165,26 @@
selection-mode="single"
@change="handleCustomerChange"
/>
<t-popup v-model="configSelectorVisible" placement="bottom">
<div class="config-selector bg-white">
<div class="popup-header">
<t-button variant="text" size="small" @click="configSelectorVisible = false">关闭</t-button>
<h3>选择套餐</h3>
<span />
</div>
<t-cell-group v-if="configList.length">
<t-cell
v-for="item in configList"
:key="item.id"
:title="item.name || '未命名套餐'"
:note="`标准价:${formatPackageAmount(item.standardAmount)}`"
arrow
@click="selectConfig(item)"
/>
</t-cell-group>
<div v-else class="center-tips" v-text="'暂无可购买套餐'" />
</div>
</t-popup>
<t-popup v-model="selectedCustomerListVisible" placement="bottom">
<div class="selected-customer-popup bg-white">
<div class="popup-header">
@@ -223,7 +252,10 @@ const userStore = useUserStore();
// ---------- 套餐配置 ----------
const configId = computed(() => String(route.params.id || ""));
const isCustomerPackageCreate = computed(() => route.name === "CustomerPackageCreate");
const config = ref<GaoPackageConfig>();
const configList = ref<GaoPackageConfig[]>([]);
const configSelectorVisible = ref(false);
// ---------- 客户 ----------
@@ -431,12 +463,21 @@ async function submitRecord(): Promise<void> {
async function loadPageData(): Promise<void> {
if (!configId.value) {
configList.value = await PackageAPI.configListValid();
return;
}
config.value = await PackageAPI.configDetail(configId.value);
applyConfig(config.value);
}
async function selectConfig(item: GaoPackageConfig): Promise<void> {
if (!item.id) {
return;
}
config.value = await PackageAPI.configDetail(item.id);
configSelectorVisible.value = false;
}
onMounted(async () => {
navBarStore.clearRight();
if (userStore.hasPermissions(permissionCodes.customerPackage.create)) {
@@ -596,6 +637,7 @@ watch(config, value => {
border-radius: inherit;
}
.config-selector,
.selected-customer-popup {
height: 70vh;
overflow: auto;