update customer package
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
<div class="center-tips" v-text="loading ? '正在加载' : noMore ? '已经到底了' : '上拉加载更多'" />
|
||||
</t-pull-down-refresh>
|
||||
</div>
|
||||
<nav-bar-action-menu v-if="canCreate" :actions="actions" />
|
||||
<nav-bar-action-menu v-if="actions.length" :actions="actions" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -81,16 +81,26 @@ const router = useRouter();
|
||||
const navBarStore = useNavBarStore();
|
||||
const userStore = useUserStore();
|
||||
const canCreate = computed(() => userStore.hasPermissions(permissionCodes.salesOrder.create));
|
||||
const canCreatePackageOrder = computed(() => userStore.hasPermissions(permissionCodes.customerPackage.create));
|
||||
const canReceive = computed(() => userStore.hasPermissions(permissionCodes.fundReceive.create));
|
||||
const canCreateFulfillment = computed(() => userStore.hasPermissions(permissionCodes.orderFulfillment.create));
|
||||
const canOperateStock = computed(() => userStore.hasPermissions(permissionCodes.productStock.create));
|
||||
const actions = computed(() => canCreate.value ? [{
|
||||
const actions = computed(() => [
|
||||
...(canCreate.value ? [{
|
||||
key: "create",
|
||||
text: "直接产品下单",
|
||||
icon: "add",
|
||||
theme: "primary" as const,
|
||||
action: toCreate
|
||||
}] : []);
|
||||
}] : []),
|
||||
...(canCreatePackageOrder.value ? [{
|
||||
key: "create-package-order",
|
||||
text: "创建客户套餐",
|
||||
icon: "add-circle",
|
||||
theme: "primary" as const,
|
||||
action: toCreatePackageOrder
|
||||
}] : [])
|
||||
]);
|
||||
const keyword = ref("");
|
||||
const customerId = ref("");
|
||||
const orderType = ref("ALL");
|
||||
@@ -225,6 +235,10 @@ async function toCreate(): Promise<void> {
|
||||
await router.push("/management/sales-orders/create");
|
||||
}
|
||||
|
||||
async function toCreatePackageOrder(): Promise<void> {
|
||||
await router.push("/management/customer-packages/create");
|
||||
}
|
||||
|
||||
const search = Toolkit.debounce(async () => {
|
||||
try {
|
||||
await fetchList(true);
|
||||
@@ -239,7 +253,7 @@ watch(routeFilterKey, async () => {
|
||||
});
|
||||
onMounted(async () => {
|
||||
navBarStore.clearRight();
|
||||
navBarStore.setCustomRightVisible(canCreate.value);
|
||||
navBarStore.setCustomRightVisible(!!actions.value.length);
|
||||
applyRouteFilters();
|
||||
try { await fetchList(true); } catch (error) { Message.error(getErrorMessage(error, "销售订单加载失败")); }
|
||||
});
|
||||
|
||||
@@ -13,5 +13,6 @@ export default [
|
||||
{ path: "/management/package-configs/create", name: "PackageConfigCreate", component: PackageConfigEdit, meta: pageMeta("新增套餐配置", 4) },
|
||||
{ path: "/management/package-configs/:id", name: "PackageConfigDetail", component: PackageConfigDetail, meta: pageMeta("套餐配置详情", 4) },
|
||||
{ path: "/management/package-configs/:id/edit", name: "PackageConfigEdit", component: PackageConfigEdit, meta: pageMeta("编辑套餐配置", 5) },
|
||||
{ path: "/management/package-configs/:id/purchase", name: "PackagePurchase", component: PackagePurchase, meta: pageMeta("购买套餐", 5) }
|
||||
{ path: "/management/package-configs/:id/purchase", name: "PackagePurchase", component: PackagePurchase, meta: pageMeta("购买套餐", 5) },
|
||||
{ path: "/management/customer-packages/create", name: "CustomerPackageCreate", component: PackagePurchase, meta: pageMeta("创建客户套餐", 4) }
|
||||
] as RouteRecordRaw[];
|
||||
|
||||
Reference in New Issue
Block a user