remove customer package
This commit is contained in:
+2
-11
@@ -1,6 +1,6 @@
|
|||||||
import { axios } from "timi-web-api";
|
import { axios } from "timi-web-api";
|
||||||
import { getCurrentStoreId, withCurrentStoreId } from "@/utils/store";
|
import { getCurrentStoreId, withCurrentStoreId } from "@/utils/store";
|
||||||
import type { CustomerPackagePage, GaoCustomerPackage, GaoPackageConfig, PackageConfigPage, PackagePageResult, PackagePurchaseRequest } from "@/types/Package";
|
import type { GaoCustomerPackage, GaoPackageConfig, PackageConfigPage, PackagePageResult, PackagePurchaseRequest } from "@/types/Package";
|
||||||
|
|
||||||
const CONFIG_URI = "/gao/package/config";
|
const CONFIG_URI = "/gao/package/config";
|
||||||
const CUSTOMER_PACKAGE_URI = "/gao/customer/package";
|
const CUSTOMER_PACKAGE_URI = "/gao/customer/package";
|
||||||
@@ -23,17 +23,8 @@ async function configUpdate(config: GaoPackageConfig): Promise<void> {
|
|||||||
async function configRemove(id: string): Promise<void> {
|
async function configRemove(id: string): Promise<void> {
|
||||||
await axios.post(`${CONFIG_URI}/delete`, undefined, { params: { id } });
|
await axios.post(`${CONFIG_URI}/delete`, undefined, { params: { id } });
|
||||||
}
|
}
|
||||||
async function customerPackageList(page: CustomerPackagePage): Promise<PackagePageResult<GaoCustomerPackage>> {
|
|
||||||
return await axios.post(`${CUSTOMER_PACKAGE_URI}/list`, withCurrentStoreId(page));
|
|
||||||
}
|
|
||||||
async function customerPackageDetail(id: string): Promise<GaoCustomerPackage> {
|
|
||||||
return await axios.post(`${CUSTOMER_PACKAGE_URI}/detail`, undefined, { params: { id } });
|
|
||||||
}
|
|
||||||
async function purchase(request: PackagePurchaseRequest): Promise<GaoCustomerPackage> {
|
async function purchase(request: PackagePurchaseRequest): Promise<GaoCustomerPackage> {
|
||||||
return await axios.post(`${CUSTOMER_PACKAGE_URI}/purchase`, request);
|
return await axios.post(`${CUSTOMER_PACKAGE_URI}/purchase`, request);
|
||||||
}
|
}
|
||||||
async function cancel(customerPackageId: string, reason: string): Promise<GaoCustomerPackage> {
|
|
||||||
return await axios.post(`${CUSTOMER_PACKAGE_URI}/cancel`, { customerPackageId, reason });
|
|
||||||
}
|
|
||||||
|
|
||||||
export default { configList, configListValid, configDetail, configCreate, configUpdate, configRemove, customerPackageList, customerPackageDetail, purchase, cancel };
|
export default { configList, configListValid, configDetail, configCreate, configUpdate, configRemove, purchase };
|
||||||
|
|||||||
@@ -52,7 +52,19 @@
|
|||||||
v-entrance-transition="210"
|
v-entrance-transition="210"
|
||||||
@edit="openTagSelector"
|
@edit="openTagSelector"
|
||||||
/>
|
/>
|
||||||
<t-cell-group theme="card" v-entrance-transition="280">
|
<t-cell-group v-if="canReadSalesOrder" title="销售订单" theme="card" v-entrance-transition="280">
|
||||||
|
<t-cell title="产品订单列表" arrow @click="toProductOrderList">
|
||||||
|
<template #left-icon>
|
||||||
|
<t-icon name="order" />
|
||||||
|
</template>
|
||||||
|
</t-cell>
|
||||||
|
<t-cell title="套餐订单列表" arrow @click="toPackageOrderList">
|
||||||
|
<template #left-icon>
|
||||||
|
<t-icon name="layers" />
|
||||||
|
</template>
|
||||||
|
</t-cell>
|
||||||
|
</t-cell-group>
|
||||||
|
<t-cell-group theme="card" v-entrance-transition="350">
|
||||||
<t-cell v-if="canReadEventRecord" title="最近登记事件" arrow @click="toEventRecordList">
|
<t-cell v-if="canReadEventRecord" title="最近登记事件" arrow @click="toEventRecordList">
|
||||||
<template #left-icon>
|
<template #left-icon>
|
||||||
<t-icon name="history" />
|
<t-icon name="history" />
|
||||||
@@ -79,7 +91,7 @@
|
|||||||
v-if="inviter"
|
v-if="inviter"
|
||||||
:title="`由 ${inviter.name} 邀请`"
|
:title="`由 ${inviter.name} 邀请`"
|
||||||
theme="card"
|
theme="card"
|
||||||
v-entrance-transition="350"
|
v-entrance-transition="420"
|
||||||
>
|
>
|
||||||
<customer-profile-card :customer="inviter" @click="toCustomerDetail(inviter)"/>
|
<customer-profile-card :customer="inviter" @click="toCustomerDetail(inviter)"/>
|
||||||
</t-cell-group>
|
</t-cell-group>
|
||||||
@@ -137,6 +149,7 @@ import { useNavBarStore } from "@/store/navBarStore";
|
|||||||
import type { BodyAreaValue, Customer } from "@/types/Customer";
|
import type { BodyAreaValue, Customer } from "@/types/Customer";
|
||||||
import type { PointAccount } from "@/types/Point";
|
import type { PointAccount } from "@/types/Point";
|
||||||
import type { PhotoItem } from "@/types/Photo";
|
import type { PhotoItem } from "@/types/Photo";
|
||||||
|
import type { GaoSalesOrderType } from "@/types/SalesOrder";
|
||||||
import type { Tag } from "@/types/Tag";
|
import type { Tag } from "@/types/Tag";
|
||||||
import { bodyAreaLabelMap } from "@/utils/bodyArea";
|
import { bodyAreaLabelMap } from "@/utils/bodyArea";
|
||||||
import { getAttachmentReadURL } from "@/utils/attachment";
|
import { getAttachmentReadURL } from "@/utils/attachment";
|
||||||
@@ -160,6 +173,7 @@ const removeTarget = ref<Customer>();
|
|||||||
const canReadStat = computed(() => userStore.hasPermissions(permissionCodes.stat.read));
|
const canReadStat = computed(() => userStore.hasPermissions(permissionCodes.stat.read));
|
||||||
const canReadEventRecord = computed(() => userStore.hasPermissions(permissionCodes.eventRecord.read));
|
const canReadEventRecord = computed(() => userStore.hasPermissions(permissionCodes.eventRecord.read));
|
||||||
const canReadPointAccount = computed(() => userStore.hasPermissions(permissionCodes.point.accountRead));
|
const canReadPointAccount = computed(() => userStore.hasPermissions(permissionCodes.point.accountRead));
|
||||||
|
const canReadSalesOrder = computed(() => userStore.hasPermissions(permissionCodes.salesOrder.read));
|
||||||
const canReadTag = computed(() => userStore.hasPermissions(corePermissionCodes.tag.read));
|
const canReadTag = computed(() => userStore.hasPermissions(corePermissionCodes.tag.read));
|
||||||
const canApplyTag = computed(() => userStore.hasPermissions(corePermissionCodes.tag.apply));
|
const canApplyTag = computed(() => userStore.hasPermissions(corePermissionCodes.tag.apply));
|
||||||
const canUpdateCustomer = computed(() => userStore.hasPermissions(permissionCodes.customer.update));
|
const canUpdateCustomer = computed(() => userStore.hasPermissions(permissionCodes.customer.update));
|
||||||
@@ -390,6 +404,28 @@ async function toEventRecordList(): Promise<void> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function toSalesOrderList(orderType: GaoSalesOrderType): Promise<void> {
|
||||||
|
if (!customer.value?.id || !canReadSalesOrder.value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await router.push({
|
||||||
|
name: "SalesOrderList",
|
||||||
|
query: {
|
||||||
|
customerId: customer.value.id,
|
||||||
|
orderType,
|
||||||
|
transitionDepth: String(Number(route.meta.depth ?? 0) + 1)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function toProductOrderList(): Promise<void> {
|
||||||
|
await toSalesOrderList("DIRECT_PRODUCT");
|
||||||
|
}
|
||||||
|
|
||||||
|
async function toPackageOrderList(): Promise<void> {
|
||||||
|
await toSalesOrderList("PACKAGE");
|
||||||
|
}
|
||||||
|
|
||||||
async function toEdit(): Promise<void> {
|
async function toEdit(): Promise<void> {
|
||||||
if (!customer.value?.id) {
|
if (!customer.value?.id) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -58,7 +58,7 @@
|
|||||||
<t-cell
|
<t-cell
|
||||||
v-else-if="event.bizType === 'PACKAGE_PURCHASE'"
|
v-else-if="event.bizType === 'PACKAGE_PURCHASE'"
|
||||||
title="购买记录"
|
title="购买记录"
|
||||||
note="请在客户套餐详情中查看"
|
note="请在套餐订单列表或订单详情中查看"
|
||||||
/>
|
/>
|
||||||
</t-cell-group>
|
</t-cell-group>
|
||||||
<t-cell-group v-entrance-transition="140" v-if="event" title="登记配置" theme="card">
|
<t-cell-group v-entrance-transition="140" v-if="event" title="登记配置" theme="card">
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</t-form-item>
|
</t-form-item>
|
||||||
</t-form>
|
</t-form>
|
||||||
<div v-else class="empty" v-text="'暂无可履约明细,请返回订单详情或客户套餐详情检查'" />
|
<div v-else class="empty" v-text="'暂无可履约明细,请返回订单详情检查'" />
|
||||||
<t-form class="form" label-align="left" label-width="6rem">
|
<t-form class="form" label-align="left" label-width="6rem">
|
||||||
<t-form-item label="履约时间" content-align="right">
|
<t-form-item label="履约时间" content-align="right">
|
||||||
<t-button
|
<t-button
|
||||||
@@ -124,7 +124,7 @@ const canFulfillByPayment = computed(() => order.value?.paymentStatus === "PAID"
|
|||||||
async function loadData(): Promise<void> {
|
async function loadData(): Promise<void> {
|
||||||
const salesOrderId = String(route.query.salesOrderId || "");
|
const salesOrderId = String(route.query.salesOrderId || "");
|
||||||
if (!salesOrderId) {
|
if (!salesOrderId) {
|
||||||
Message.warning("请从订单详情或客户套餐详情进入履约创建");
|
Message.warning("请从订单详情进入履约创建");
|
||||||
await router.replace("/management/order-fulfillments");
|
await router.replace("/management/order-fulfillments");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -169,7 +169,7 @@ function buildAttachments(): Partial<Attachment>[] {
|
|||||||
|
|
||||||
function validate(): boolean {
|
function validate(): boolean {
|
||||||
if (!order.value?.id) {
|
if (!order.value?.id) {
|
||||||
Message.warning("请从订单详情或客户套餐详情进入履约创建");
|
Message.warning("请从订单详情进入履约创建");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (order.value.status !== "ACTIVE") {
|
if (order.value.status !== "ACTIVE") {
|
||||||
|
|||||||
@@ -63,11 +63,11 @@ const actions = computed<NavBarAction[]>(() => [
|
|||||||
action: toSalesOrderList
|
action: toSalesOrderList
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: "by-package",
|
key: "by-package-order",
|
||||||
text: "通过套餐创建",
|
text: "通过套餐订单创建",
|
||||||
icon: "gift",
|
icon: "gift",
|
||||||
theme: "primary",
|
theme: "primary",
|
||||||
action: toCustomerPackageList
|
action: toPackageOrderList
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
const status = ref<"ALL" | GaoFulfillmentStatus>(getInitialStatus(route.query.status));
|
const status = ref<"ALL" | GaoFulfillmentStatus>(getInitialStatus(route.query.status));
|
||||||
@@ -163,11 +163,20 @@ async function toDetail(item: OrderFulfillment): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function toSalesOrderList(): Promise<void> {
|
async function toSalesOrderList(): Promise<void> {
|
||||||
await router.push({ name: "SalesOrderList" });
|
await router.push({
|
||||||
|
name: "SalesOrderList",
|
||||||
|
query: { transitionDepth: String(getCurrentRouteDepth() + 1) }
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function toCustomerPackageList(): Promise<void> {
|
async function toPackageOrderList(): Promise<void> {
|
||||||
await router.push({ name: "CustomerPackageList" });
|
await router.push({
|
||||||
|
name: "SalesOrderList",
|
||||||
|
query: {
|
||||||
|
orderType: "PACKAGE",
|
||||||
|
transitionDepth: String(getCurrentRouteDepth() + 1)
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCurrentRouteDepth(): number {
|
function getCurrentRouteDepth(): number {
|
||||||
|
|||||||
@@ -1,196 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div v-can="permissionCodes.customerPackage.read" class="customer-package-detail">
|
|
||||||
<template v-if="customerPackage">
|
|
||||||
<customer-profile-card class="customer" :customer="customerPackage.customer" v-entrance-transition />
|
|
||||||
<t-cell-group class="summary" theme="card" v-entrance-transition="70">
|
|
||||||
<t-cell>
|
|
||||||
<template #title>
|
|
||||||
<div class="title">
|
|
||||||
<strong v-text="customerPackage.packageNameSnapshot || '未命名套餐'" />
|
|
||||||
<t-tag :content="getSalesOrderStatusText(order?.status)" variant="light-outline" :theme="getStatusTheme(order?.status)" />
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<template #description><span>购买于 </span><pass-time-label :timestamp="order?.purchasedAt || customerPackage.salesOrder?.purchasedAt" underline /></template>
|
|
||||||
</t-cell>
|
|
||||||
<t-cell v-if="customerPackage.salesOrderId && canReadOrder" title="销售订单" :note="order?.orderNo || customerPackage.salesOrderId" arrow @click="toOrder" />
|
|
||||||
<t-cell v-if="canReadPackageConfig && customerPackage.packageConfigId" title="套餐方案详情" arrow @click="toPackageConfig" />
|
|
||||||
</t-cell-group>
|
|
||||||
<card-container title="套餐权益" description="权益数量来自销售订单项,履约状态来自统一履约单" v-entrance-transition="210">
|
|
||||||
<t-cell-group>
|
|
||||||
<t-cell v-for="item in salesOrderItems" :key="item.id" class="benefit">
|
|
||||||
<template #title><div class="title"><strong v-text="item.productNameSnapshot || '未命名产品'" /><t-tag theme="primary" variant="light" :content="item.unitSnapshot || '未设置单位'" /></div></template>
|
|
||||||
<template #description>
|
|
||||||
<div class="stats">
|
|
||||||
<span>总数 <strong v-text="getPackageQuantityText(item.quantity)" /></span>
|
|
||||||
<span>可履约 <strong v-text="getPackageQuantityText(item.availableQuantity)" /></span>
|
|
||||||
<span>待核销 <strong v-text="getPackageQuantityText(item.pendingQuantity)" /></span>
|
|
||||||
<span>已履约 <strong v-text="getPackageQuantityText(item.fulfilledQuantity)" /></span>
|
|
||||||
<span>剩余 <strong v-text="getPackageQuantityText(item.remainingQuantity)" /></span>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</t-cell>
|
|
||||||
<div v-if="!salesOrderItems.length" class="empty" v-text="'暂无产品权益'" />
|
|
||||||
</t-cell-group>
|
|
||||||
</card-container>
|
|
||||||
<t-cell-group title="统一履约" theme="card" v-entrance-transition="280">
|
|
||||||
<t-cell
|
|
||||||
v-for="item in customerPackage.fulfillmentList || []"
|
|
||||||
:key="item.id"
|
|
||||||
:title="`${getSalesOrderItemTypeText(getFulfillmentItemType(item))} · ${getFulfillmentStatusText(item.status)}`"
|
|
||||||
:note="getFulfillmentSummary(item)"
|
|
||||||
arrow
|
|
||||||
@click="toFulfillment(item.id)"
|
|
||||||
/>
|
|
||||||
<t-cell v-if="!customerPackage.fulfillmentList?.length" title="暂无履约记录" />
|
|
||||||
<t-cell v-if="canCreateFulfillment && hasAvailableItem" title="创建统一履约单" note="选择本次履约的权益数量" arrow @click="toCreateFulfillment" />
|
|
||||||
</t-cell-group>
|
|
||||||
<t-cell-group v-if="order" class="finance-panel" title="订单资金摘要" theme="card" v-entrance-transition="350">
|
|
||||||
<t-cell title="成交金额" :note="formatPackageAmount(order.saleAmount)" />
|
|
||||||
<t-cell title="已生效收款" :note="formatPackageAmount(order.paidAmount)" />
|
|
||||||
<t-cell title="待核销收款" :note="formatPackageAmount(order.pendingPaidAmount)" />
|
|
||||||
<t-cell title="有效退款" :note="formatPackageAmount(order.refundedAmount)" />
|
|
||||||
<t-cell title="收款状态" :note="getSalesPaymentStatusText(order.paymentStatus)" />
|
|
||||||
<t-cell title="退款状态" :note="getSalesRefundStatusText(order.refundStatus)" />
|
|
||||||
</t-cell-group>
|
|
||||||
<t-cell-group v-if="order?.status === 'CANCELLED'" class="cancel-info" title="取消记录" theme="card" v-entrance-transition="420">
|
|
||||||
<t-cell title="取消时间" :note="order.cancelledAt ? Time.toDateTime(order.cancelledAt) : '未知'" />
|
|
||||||
<t-cell title="取消人" :note="order.cancelOperator?.name || customerPackage.cancelOperator?.name || order.cancelOperatorUserId || '未知'" />
|
|
||||||
<t-cell title="取消原因" :note="order.cancelReason || '未填写'" />
|
|
||||||
</t-cell-group>
|
|
||||||
<t-button v-if="canCancel" class="cell-button" theme="danger" @click="openCancel">取消客户套餐</t-button>
|
|
||||||
</template>
|
|
||||||
<t-empty v-else :description="isLoading ? '正在加载客户套餐' : '客户套餐不存在'" />
|
|
||||||
<bottom-popup
|
|
||||||
v-model="cancelVisible"
|
|
||||||
title="取消客户套餐"
|
|
||||||
height="min(35vh, 20rem)"
|
|
||||||
left-button-text="取消"
|
|
||||||
:right-button-text="isCancelling ? '取消中' : '确认取消'"
|
|
||||||
@left-button-click="cancelVisible = false"
|
|
||||||
@right-button-click="confirmCancel"
|
|
||||||
>
|
|
||||||
<t-form label-align="top">
|
|
||||||
<t-form-item label="取消原因" required-mark>
|
|
||||||
<t-textarea v-model.trim="cancelReason" borderless autosize maxlength="500" placeholder="请输入取消原因" />
|
|
||||||
</t-form-item>
|
|
||||||
</t-form>
|
|
||||||
</bottom-popup>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { PassTimeLabel, Time } from "timi-web";
|
|
||||||
import { useUserStore } from "timi-web-api";
|
|
||||||
import PackageAPI from "@/api/PackageAPI";
|
|
||||||
import SalesOrderAPI from "@/api/SalesOrderAPI";
|
|
||||||
import CustomerProfileCard from "@/components/CustomerProfileCard.vue";
|
|
||||||
import { useNavBarStore } from "@/store/navBarStore";
|
|
||||||
import type { GaoCustomerPackage } from "@/types/Package";
|
|
||||||
import type { OrderFulfillment } from "@/types/Fulfillment";
|
|
||||||
import type { GaoSalesOrderItemType, SalesOrder } from "@/types/SalesOrder";
|
|
||||||
import { getErrorMessage } from "@/utils/error";
|
|
||||||
import { formatPackageAmount, getPackageQuantityText } from "@/utils/package";
|
|
||||||
import { getFulfillmentStatusText, getSalesOrderItemTypeText, getSalesOrderStatusText, getSalesPaymentStatusText, getSalesRefundStatusText } from "@/utils/salesOrder";
|
|
||||||
import { Message } from "@/utils/message";
|
|
||||||
import { permissionCodes } from "@/utils/permission";
|
|
||||||
|
|
||||||
defineOptions({ name: "CustomerPackageDetail" });
|
|
||||||
const route = useRoute();
|
|
||||||
const router = useRouter();
|
|
||||||
const navBarStore = useNavBarStore();
|
|
||||||
const userStore = useUserStore();
|
|
||||||
const customerPackage = ref<GaoCustomerPackage>();
|
|
||||||
const order = ref<SalesOrder>();
|
|
||||||
const isLoading = ref(false);
|
|
||||||
const cancelVisible = ref(false);
|
|
||||||
const cancelReason = ref("");
|
|
||||||
const isCancelling = ref(false);
|
|
||||||
const hasPendingFulfillment = computed(() => customerPackage.value?.fulfillmentList?.some(item => item.status === "WAITING_STOCK" || item.status === "PENDING") ?? false);
|
|
||||||
const canOperateStock = computed(() => userStore.hasPermissions(permissionCodes.productStock.create));
|
|
||||||
const canFulfillByPayment = computed(() => order.value?.paymentStatus === "PAID" || (order.value?.paymentStatus === "PARTIALLY_PAID" && canOperateStock.value));
|
|
||||||
const canCancel = computed(() => order.value?.status === "ACTIVE" && !hasPendingFulfillment.value && userStore.hasPermissions(permissionCodes.customerPackage.cancel));
|
|
||||||
const canCreateFulfillment = computed(() => order.value?.status === "ACTIVE" && canFulfillByPayment.value && userStore.hasPermissions(permissionCodes.orderFulfillment.create));
|
|
||||||
const canReadOrder = computed(() => userStore.hasPermissions(permissionCodes.salesOrder.read));
|
|
||||||
const canReadPackageConfig = computed(() => userStore.hasPermissions(permissionCodes.packageConfig.read));
|
|
||||||
const salesOrderItems = computed(() => order.value?.itemList || customerPackage.value?.itemList || []);
|
|
||||||
const hasAvailableItem = computed(() => salesOrderItems.value.some(item => 0 < Number(item.availableQuantity)));
|
|
||||||
|
|
||||||
async function loadData(): Promise<void> {
|
|
||||||
const id = String(route.params.id || "");
|
|
||||||
if (!id) return;
|
|
||||||
isLoading.value = true;
|
|
||||||
try {
|
|
||||||
customerPackage.value = await PackageAPI.customerPackageDetail(id);
|
|
||||||
order.value = customerPackage.value.salesOrder;
|
|
||||||
if (customerPackage.value.salesOrderId && canReadOrder.value) {
|
|
||||||
order.value = await SalesOrderAPI.detail(customerPackage.value.salesOrderId);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
customerPackage.value = undefined;
|
|
||||||
Message.error(getErrorMessage(error, "客户套餐加载失败"));
|
|
||||||
} finally {
|
|
||||||
isLoading.value = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function getStatusTheme(status?: string): "success" | "warning" | "danger" | "default" { return status === "ACTIVE" ? "success" : status === "CANCELLED" ? "danger" : "default"; }
|
|
||||||
function getFulfillmentSummary(item: OrderFulfillment): string { return `${item.deliveredAt ? Time.toDateTime(item.deliveredAt) : "时间未知"} · ${(item.itemList || []).length} 项`; }
|
|
||||||
function getFulfillmentItemType(item: OrderFulfillment): GaoSalesOrderItemType | undefined {
|
|
||||||
const sourceOrderItemId = item.itemList?.[0]?.sourceOrderItemId;
|
|
||||||
return salesOrderItems.value.find(orderItem => orderItem.id === sourceOrderItemId)?.itemType;
|
|
||||||
}
|
|
||||||
async function toOrder(): Promise<void> {
|
|
||||||
if (order.value?.id) {
|
|
||||||
await router.push({
|
|
||||||
path: `/management/sales-orders/${order.value.id}`,
|
|
||||||
query: { transitionDepth: String(getCurrentRouteDepth() + 1) }
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
async function toPackageConfig(): Promise<void> { if (customerPackage.value?.packageConfigId) await router.push(`/management/package-configs/${customerPackage.value.packageConfigId}`); }
|
|
||||||
async function toFulfillment(id?: string): Promise<void> { if (id) await router.push(`/management/order-fulfillments/${id}`); }
|
|
||||||
async function toCreateFulfillment(): Promise<void> {
|
|
||||||
if (order.value?.id) {
|
|
||||||
await router.push({
|
|
||||||
path: "/management/order-fulfillments/create",
|
|
||||||
query: { salesOrderId: order.value.id }
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function openCancel(): void { cancelReason.value = ""; cancelVisible.value = true; }
|
|
||||||
async function confirmCancel(): Promise<void> {
|
|
||||||
if (isCancelling.value) return;
|
|
||||||
const customerPackageId = customerPackage.value?.id;
|
|
||||||
const reason = cancelReason.value.trim();
|
|
||||||
if (!customerPackageId) return;
|
|
||||||
if (!reason) {
|
|
||||||
Message.warning("取消原因不能为空");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
isCancelling.value = true;
|
|
||||||
try { await PackageAPI.cancel(customerPackageId, reason); cancelVisible.value = false; Message.success("客户套餐已取消"); await loadData(); }
|
|
||||||
catch (error) { Message.error(getErrorMessage(error, "套餐取消失败")); }
|
|
||||||
finally { isCancelling.value = false; }
|
|
||||||
}
|
|
||||||
function getCurrentRouteDepth(): number {
|
|
||||||
const transitionDepth = Array.isArray(route.query.transitionDepth)
|
|
||||||
? route.query.transitionDepth[0]
|
|
||||||
: route.query.transitionDepth;
|
|
||||||
const depth = Number(transitionDepth);
|
|
||||||
if (transitionDepth && Number.isInteger(depth) && 0 <= depth && depth <= 20) {
|
|
||||||
return depth;
|
|
||||||
}
|
|
||||||
return Number(route.meta.depth ?? 0);
|
|
||||||
}
|
|
||||||
onMounted(loadData);
|
|
||||||
onUnmounted(() => navBarStore.clearRight());
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped lang="less">
|
|
||||||
.customer-package-detail { gap: 1rem; padding: calc(var(--app-nav-height) + 1rem) 0 2rem; display: flex; flex-direction: column;
|
|
||||||
.customer { margin: 0 1rem; }
|
|
||||||
.summary .title, .benefit .title { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
|
|
||||||
.stats { gap: .75rem; display: flex; flex-wrap: wrap; color: var(--td-text-color-secondary); }
|
|
||||||
.stats strong { color: var(--td-text-color-primary); }
|
|
||||||
.empty { color: var(--td-text-color-secondary); padding: 1rem; text-align: center; }
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,317 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div v-can="permissionCodes.customerPackage.read" class="customer-package-list">
|
|
||||||
<div class="filters">
|
|
||||||
<t-input
|
|
||||||
v-model.trim="keyword"
|
|
||||||
class="search-input"
|
|
||||||
type="search"
|
|
||||||
borderless
|
|
||||||
clearable
|
|
||||||
placeholder="搜索客户、编码或套餐名称"
|
|
||||||
/>
|
|
||||||
<div class="filter-line">
|
|
||||||
<t-dropdown-menu class="filter-menu">
|
|
||||||
<t-dropdown-item
|
|
||||||
v-model="status"
|
|
||||||
label="套餐状态"
|
|
||||||
:options="statusOptions"
|
|
||||||
@change="selectStatus"
|
|
||||||
/>
|
|
||||||
</t-dropdown-menu>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<t-pull-down-refresh
|
|
||||||
v-model="isRefreshing"
|
|
||||||
:refresh-timeout="30000"
|
|
||||||
@refresh="reload"
|
|
||||||
@scrolltolower="loadMore"
|
|
||||||
>
|
|
||||||
<t-cell-group
|
|
||||||
class="list"
|
|
||||||
v-if="packageList.length"
|
|
||||||
theme="card"
|
|
||||||
>
|
|
||||||
<t-cell
|
|
||||||
v-for="(item, index) in packageList"
|
|
||||||
:key="item.id"
|
|
||||||
class="item"
|
|
||||||
arrow
|
|
||||||
v-entrance-transition="index * 30"
|
|
||||||
@click="toDetail(item)"
|
|
||||||
>
|
|
||||||
<template #leftIcon>
|
|
||||||
<t-image
|
|
||||||
v-if="getCustomerPhotoURL(item.customer, 64)"
|
|
||||||
:src="getCustomerPhotoURL(item.customer, 64)"
|
|
||||||
:alt="item.customer?.name || item.customer?.code || '客户头像'"
|
|
||||||
fit="cover"
|
|
||||||
class="avatar"
|
|
||||||
/>
|
|
||||||
<div v-else class="avatar fallback" v-text="(item.customer?.name || item.customer?.code || '客').slice(0, 1)" />
|
|
||||||
</template>
|
|
||||||
<template #title>
|
|
||||||
<div class="title">
|
|
||||||
<div class="text text-bold">
|
|
||||||
<span class="customer" v-text="Text.display(item.customer?.name)" />
|
|
||||||
<span> - </span>
|
|
||||||
<span v-text="item.packageNameSnapshot || '未命名套餐'" />
|
|
||||||
</div>
|
|
||||||
<t-tag :content="getSalesOrderStatusText(getPackageStatus(item))" variant="light-outline" :theme="getStatusTheme(getPackageStatus(item))" />
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<template #description>
|
|
||||||
<div class="description">
|
|
||||||
<div class="line" v-text="`订单:${item.salesOrderId || '未关联'}`" />
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</t-cell>
|
|
||||||
</t-cell-group>
|
|
||||||
<div v-else class="empty" v-text="loading ? '正在加载客户套餐' : '暂无客户套餐'" />
|
|
||||||
<div class="center-tips" v-text="loadStateText" />
|
|
||||||
</t-pull-down-refresh>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { type DropdownValue } from "tdesign-mobile-vue";
|
|
||||||
import { Text, Toolkit } from "timi-web";
|
|
||||||
import PackageAPI from "@/api/PackageAPI";
|
|
||||||
import { useNavBarStore } from "@/store/navBarStore";
|
|
||||||
import type { GaoCustomerPackage } from "@/types/Package";
|
|
||||||
import type { GaoSalesOrderStatus } from "@/types/SalesOrder";
|
|
||||||
import { getCustomerPhotoURL } from "@/utils/customer";
|
|
||||||
import { getErrorMessage } from "@/utils/error";
|
|
||||||
import { getSalesOrderStatusText } from "@/utils/salesOrder";
|
|
||||||
import { Message } from "@/utils/message";
|
|
||||||
import { permissionCodes } from "@/utils/permission";
|
|
||||||
|
|
||||||
defineOptions({ name: "CustomerPackageList" });
|
|
||||||
|
|
||||||
const router = useRouter();
|
|
||||||
const navBarStore = useNavBarStore();
|
|
||||||
const keyword = ref("");
|
|
||||||
const status = ref("ALL");
|
|
||||||
const packageList = ref<GaoCustomerPackage[]>([]);
|
|
||||||
const pageIndex = ref(0);
|
|
||||||
const total = ref(0);
|
|
||||||
const loading = ref(false);
|
|
||||||
const isRefreshing = ref(false);
|
|
||||||
const noMore = ref(false);
|
|
||||||
const statusOptions = [
|
|
||||||
{ label: "全部状态", value: "ALL" },
|
|
||||||
{ label: "进行中", value: "ACTIVE" },
|
|
||||||
{ label: "已履约", value: "FULFILLED" },
|
|
||||||
{ label: "已取消", value: "CANCELLED" }
|
|
||||||
];
|
|
||||||
const loadStateText = computed(() => loading.value ? "正在加载" : noMore.value ? "已经到底了" : "上拉加载更多");
|
|
||||||
|
|
||||||
async function loadMore(): Promise<void> {
|
|
||||||
if (loading.value || noMore.value) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
loading.value = true;
|
|
||||||
try {
|
|
||||||
const result = await PackageAPI.customerPackageList({
|
|
||||||
index: pageIndex.value,
|
|
||||||
size: 15,
|
|
||||||
keyword: keyword.value || undefined,
|
|
||||||
status: status.value === "ALL" ? undefined : status.value as GaoSalesOrderStatus
|
|
||||||
});
|
|
||||||
const list = result.list || [];
|
|
||||||
packageList.value = packageList.value.concat(list);
|
|
||||||
total.value = result.total || 0;
|
|
||||||
pageIndex.value += 1;
|
|
||||||
noMore.value = list.length < 15 || total.value <= packageList.value.length;
|
|
||||||
} finally {
|
|
||||||
loading.value = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function reload(): Promise<void> {
|
|
||||||
if (loading.value) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
pageIndex.value = 0;
|
|
||||||
packageList.value = [];
|
|
||||||
total.value = 0;
|
|
||||||
noMore.value = false;
|
|
||||||
await loadMore();
|
|
||||||
}
|
|
||||||
|
|
||||||
async function selectStatus(value: DropdownValue): Promise<void> {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
status.value = String(value);
|
|
||||||
await reload();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const reloadByKeyword = Toolkit.debounce(async () => {
|
|
||||||
try {
|
|
||||||
await reload();
|
|
||||||
} catch (error) {
|
|
||||||
Message.error(getErrorMessage(error, "客户套餐加载失败"));
|
|
||||||
}
|
|
||||||
}, false);
|
|
||||||
|
|
||||||
watch(keyword, () => {
|
|
||||||
reloadByKeyword();
|
|
||||||
});
|
|
||||||
|
|
||||||
async function toDetail(item: GaoCustomerPackage): Promise<void> {
|
|
||||||
if (item.id) {
|
|
||||||
await router.push(`/management/customer-packages/${item.id}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getPackageStatus(item: GaoCustomerPackage): GaoSalesOrderStatus | undefined {
|
|
||||||
return item.salesOrder?.status;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getStatusTheme(statusValue?: GaoSalesOrderStatus): "success" | "warning" | "default" {
|
|
||||||
return statusValue === "ACTIVE" ? "success" : statusValue === "CANCELLED" ? "warning" : "default";
|
|
||||||
}
|
|
||||||
|
|
||||||
onMounted(async () => {
|
|
||||||
navBarStore.clearRight();
|
|
||||||
try {
|
|
||||||
await reload();
|
|
||||||
} catch (error) {
|
|
||||||
Message.error(getErrorMessage(error, "客户套餐加载失败"));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
onUnmounted(() => {
|
|
||||||
navBarStore.clearRight();
|
|
||||||
reloadByKeyword.cancel();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped lang="less">
|
|
||||||
.customer-package-list {
|
|
||||||
padding: var(--app-nav-height) 0 1rem 0;
|
|
||||||
|
|
||||||
.filters {
|
|
||||||
top: var(--app-nav-height);
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
z-index: 10;
|
|
||||||
gap: .5rem;
|
|
||||||
display: flex;
|
|
||||||
padding: .75rem 1rem;
|
|
||||||
position: sticky;
|
|
||||||
background: var(--td-bg-color-page);
|
|
||||||
box-shadow: var(--td-shadow-1);
|
|
||||||
flex-direction: column;
|
|
||||||
|
|
||||||
.search-input {
|
|
||||||
--td-input-vertical-padding: 8px 14px;
|
|
||||||
|
|
||||||
border: 1px solid rgba(148, 163, 184, .28);
|
|
||||||
z-index: 1;
|
|
||||||
background: var(--td-bg-color-container);
|
|
||||||
border-radius: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.filter-menu {
|
|
||||||
--td-spacer-1: 6px;
|
|
||||||
|
|
||||||
width: 100%;
|
|
||||||
overflow: hidden;
|
|
||||||
margin-top: -1.5rem;
|
|
||||||
padding-top: .8rem;
|
|
||||||
background: var(--td-bg-color-container);
|
|
||||||
border: 1px solid rgba(148, 163, 184, .18);
|
|
||||||
border-radius: 0 0 1rem 1rem;
|
|
||||||
|
|
||||||
&:after {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.t-dropdown-menu__item) {
|
|
||||||
min-width: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.t-dropdown-menu__title) {
|
|
||||||
overflow: hidden;
|
|
||||||
white-space: nowrap;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.list {
|
|
||||||
margin-top: .75rem;
|
|
||||||
|
|
||||||
.item {
|
|
||||||
padding: 10px;
|
|
||||||
|
|
||||||
:deep(.t-cell__title) {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.avatar {
|
|
||||||
width: 3.5rem;
|
|
||||||
height: 3.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.title {
|
|
||||||
gap: .5rem;
|
|
||||||
flex: 1;
|
|
||||||
display: flex;
|
|
||||||
font-size: .875rem;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
}
|
|
||||||
|
|
||||||
.description {
|
|
||||||
gap: .5rem;
|
|
||||||
color: var(--td-text-color-secondary);
|
|
||||||
display: flex;
|
|
||||||
font-size: .8125rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.line {
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.empty {
|
|
||||||
color: var(--td-text-color-secondary);
|
|
||||||
padding: 2rem 1rem;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.avatar .t-image__img) {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
object-fit: cover;
|
|
||||||
border-radius: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
:global(html.theme-dark) {
|
|
||||||
.customer-package-list {
|
|
||||||
|
|
||||||
.fallback {
|
|
||||||
background: #115e59;
|
|
||||||
}
|
|
||||||
|
|
||||||
.filters {
|
|
||||||
background: #10161f;
|
|
||||||
|
|
||||||
.search-input {
|
|
||||||
background: rgba(15, 23, 42, .72);
|
|
||||||
border-color: rgba(148, 163, 184, .16);
|
|
||||||
}
|
|
||||||
|
|
||||||
.filter-menu {
|
|
||||||
background: #172033;
|
|
||||||
border-color: rgba(148, 163, 184, .16);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -409,15 +409,16 @@ async function submitRecord(): Promise<void> {
|
|||||||
isSaving.value = true;
|
isSaving.value = true;
|
||||||
try {
|
try {
|
||||||
const result = await submitPurchase();
|
const result = await submitPurchase();
|
||||||
if (!result?.id || !result.salesOrderId) {
|
if (!result?.salesOrderId) {
|
||||||
Message.error("套餐购买成功但未返回完整订单关联,请联系管理员");
|
Message.error("套餐购买成功但未返回完整订单关联,请联系管理员");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await settingStore.playRegisterSuccessSound();
|
await settingStore.playRegisterSuccessSound();
|
||||||
Message.success("套餐购买已提交");
|
Message.success("套餐购买已提交");
|
||||||
await router.replace({
|
await router.replace({
|
||||||
path: `/management/customer-packages/${result.id}`,
|
name: "SalesOrderDetail",
|
||||||
query: { salesOrderId: result.salesOrderId }
|
params: { id: result.salesOrderId },
|
||||||
|
query: { transitionDepth: String(Number(route.meta.depth ?? 0) + 1) }
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Message.error(getErrorMessage(error, "套餐购买提交失败"));
|
Message.error(getErrorMessage(error, "套餐购买提交失败"));
|
||||||
|
|||||||
@@ -57,6 +57,13 @@
|
|||||||
<t-cell-group title="库存流水" theme="card" v-entrance-transition="70">
|
<t-cell-group title="库存流水" theme="card" v-entrance-transition="70">
|
||||||
<t-cell title="操作类型" :note="getStockOperationText(record.operationType)" />
|
<t-cell title="操作类型" :note="getStockOperationText(record.operationType)" />
|
||||||
<t-cell title="业务类型" :note="getBizTypeText(record.bizType)" />
|
<t-cell title="业务类型" :note="getBizTypeText(record.bizType)" />
|
||||||
|
<t-cell
|
||||||
|
v-if="relatedFulfillmentId && canReadFulfillment"
|
||||||
|
title="关联履约单"
|
||||||
|
note="查看履约详情"
|
||||||
|
arrow
|
||||||
|
@click="toFulfillment"
|
||||||
|
/>
|
||||||
<t-cell title="发生时间">
|
<t-cell title="发生时间">
|
||||||
<template #note>
|
<template #note>
|
||||||
<pass-time-label :timestamp="record.occurredAt" underline />
|
<pass-time-label :timestamp="record.occurredAt" underline />
|
||||||
@@ -66,7 +73,7 @@
|
|||||||
<t-cell v-if="record.sourceRecordId" title="原库存流水" :note="record.sourceRecordId" arrow @click="openRelatedRecord(record.sourceRecordId)" />
|
<t-cell v-if="record.sourceRecordId" title="原库存流水" :note="record.sourceRecordId" arrow @click="openRelatedRecord(record.sourceRecordId)" />
|
||||||
<t-cell v-if="record.revokeRecordId" title="冲正流水" :note="record.revokeRecordId" arrow @click="openRelatedRecord(record.revokeRecordId)" />
|
<t-cell v-if="record.revokeRecordId" title="冲正流水" :note="record.revokeRecordId" arrow @click="openRelatedRecord(record.revokeRecordId)" />
|
||||||
<t-cell v-if="record.remark" title="备注" :note="record.remark" />
|
<t-cell v-if="record.remark" title="备注" :note="record.remark" />
|
||||||
<t-cell>
|
<t-cell class="empty-cell-title-margin">
|
||||||
<template #title>
|
<template #title>
|
||||||
<span></span>
|
<span></span>
|
||||||
</template>
|
</template>
|
||||||
@@ -159,6 +166,8 @@ const canManualRevoke = computed(() => {
|
|||||||
&& !record.value?.revokeRecordId
|
&& !record.value?.revokeRecordId
|
||||||
&& userStore.hasPermissions(permissionCodes.productStock.manualRevoke);
|
&& userStore.hasPermissions(permissionCodes.productStock.manualRevoke);
|
||||||
});
|
});
|
||||||
|
const canReadFulfillment = computed(() => userStore.hasPermissions(permissionCodes.orderFulfillment.read));
|
||||||
|
const relatedFulfillmentId = computed(() => record.value?.bizType === "ORDER_FULFILLMENT" ? record.value.bizId : "");
|
||||||
const photoItemList = computed<PhotoItem[]>(() => (record.value?.attachmentList || [])
|
const photoItemList = computed<PhotoItem[]>(() => (record.value?.attachmentList || [])
|
||||||
.filter(item => !!item.id)
|
.filter(item => !!item.id)
|
||||||
.map(item => ({
|
.map(item => ({
|
||||||
@@ -221,6 +230,16 @@ async function openRelatedRecord(id?: string): Promise<void> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function toFulfillment(): Promise<void> {
|
||||||
|
if (!relatedFulfillmentId.value || !canReadFulfillment.value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await router.push({
|
||||||
|
path: `/management/order-fulfillments/${relatedFulfillmentId.value}`,
|
||||||
|
query: { transitionDepth: String(getCurrentRouteDepth() + 1) }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function getCurrentRouteDepth(): number {
|
function getCurrentRouteDepth(): number {
|
||||||
const transitionDepth = Array.isArray(route.query.transitionDepth)
|
const transitionDepth = Array.isArray(route.query.transitionDepth)
|
||||||
? route.query.transitionDepth[0]
|
? route.query.transitionDepth[0]
|
||||||
|
|||||||
@@ -5,8 +5,11 @@
|
|||||||
<section class="hero" v-entrance-transition="35">
|
<section class="hero" v-entrance-transition="35">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<span class="eyebrow">销售订单</span>
|
<span class="eyebrow">销售订单</span>
|
||||||
|
<div class="tags">
|
||||||
|
<t-tag :content="getSalesOrderTypeText(order.orderType)" theme="primary" variant="light-outline" />
|
||||||
<t-tag :content="getSalesOrderStatusText(order.status)" variant="light-outline" :theme="getStatusTheme(order.status)" />
|
<t-tag :content="getSalesOrderStatusText(order.status)" variant="light-outline" :theme="getStatusTheme(order.status)" />
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<h1 class="no" v-text="order.orderNo" />
|
<h1 class="no" v-text="order.orderNo" />
|
||||||
<div class="meta">
|
<div class="meta">
|
||||||
<pass-time-label class="time" :timestamp="order.purchasedAt" underline />
|
<pass-time-label class="time" :timestamp="order.purchasedAt" underline />
|
||||||
@@ -215,6 +218,7 @@ import { getErrorMessage } from "@/utils/error";
|
|||||||
import { getProductPhotoURL } from "@/utils/product";
|
import { getProductPhotoURL } from "@/utils/product";
|
||||||
import {
|
import {
|
||||||
getSalesOrderStatusText,
|
getSalesOrderStatusText,
|
||||||
|
getSalesOrderTypeText,
|
||||||
getSalesPaymentStatusText,
|
getSalesPaymentStatusText,
|
||||||
getSalesRefundStatusText,
|
getSalesRefundStatusText,
|
||||||
getStatusTheme
|
getStatusTheme
|
||||||
@@ -468,6 +472,11 @@ onUnmounted(() => navBarStore.clearRight());
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|
||||||
|
.tags {
|
||||||
|
gap: .5rem;
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
.eyebrow {
|
.eyebrow {
|
||||||
color: #c2410c;
|
color: #c2410c;
|
||||||
display: block;
|
display: block;
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ const actions = computed(() => canCreate.value ? [{
|
|||||||
action: toCreate
|
action: toCreate
|
||||||
}] : []);
|
}] : []);
|
||||||
const keyword = ref("");
|
const keyword = ref("");
|
||||||
|
const customerId = ref("");
|
||||||
const orderType = ref("ALL");
|
const orderType = ref("ALL");
|
||||||
type PaymentFilter = "ALL" | GaoSalesPaymentStatus | "PENDING_RECEIVE";
|
type PaymentFilter = "ALL" | GaoSalesPaymentStatus | "PENDING_RECEIVE";
|
||||||
type RefundFilter = "ALL" | GaoSalesRefundStatus;
|
type RefundFilter = "ALL" | GaoSalesRefundStatus;
|
||||||
@@ -112,6 +113,7 @@ const paymentOptions = [{ label: "全部收款", value: "ALL" }, { label: "未
|
|||||||
const refundOptions = [{ label: "全部退款", value: "ALL" }, { label: "无需退款", value: "NOT_REQUIRED" }, { label: "待退款", value: "PENDING" }, { label: "已退款", value: "REFUNDED" }];
|
const refundOptions = [{ label: "全部退款", value: "ALL" }, { label: "无需退款", value: "NOT_REQUIRED" }, { label: "待退款", value: "PENDING" }, { label: "已退款", value: "REFUNDED" }];
|
||||||
|
|
||||||
const routeFilterKey = computed(() => [
|
const routeFilterKey = computed(() => [
|
||||||
|
route.query.customerId,
|
||||||
route.query.orderType,
|
route.query.orderType,
|
||||||
route.query.status,
|
route.query.status,
|
||||||
route.query.paymentStatus,
|
route.query.paymentStatus,
|
||||||
@@ -125,6 +127,7 @@ function queryValue(value: unknown): string {
|
|||||||
|
|
||||||
function applyRouteFilters(): void {
|
function applyRouteFilters(): void {
|
||||||
const pendingReceive = queryValue(route.query.pendingReceive) === "true";
|
const pendingReceive = queryValue(route.query.pendingReceive) === "true";
|
||||||
|
customerId.value = queryValue(route.query.customerId);
|
||||||
orderType.value = queryValue(route.query.orderType) || "ALL";
|
orderType.value = queryValue(route.query.orderType) || "ALL";
|
||||||
status.value = queryValue(route.query.status) || "ALL";
|
status.value = queryValue(route.query.status) || "ALL";
|
||||||
paymentStatus.value = pendingReceive ? "PENDING_RECEIVE" : queryValue(route.query.paymentStatus) as PaymentFilter || "ALL";
|
paymentStatus.value = pendingReceive ? "PENDING_RECEIVE" : queryValue(route.query.paymentStatus) as PaymentFilter || "ALL";
|
||||||
@@ -134,6 +137,7 @@ function applyRouteFilters(): void {
|
|||||||
function buildPageFilter(): SalesOrderPage {
|
function buildPageFilter(): SalesOrderPage {
|
||||||
const pendingReceive = paymentStatus.value === "PENDING_RECEIVE";
|
const pendingReceive = paymentStatus.value === "PENDING_RECEIVE";
|
||||||
return {
|
return {
|
||||||
|
customerId: customerId.value || undefined,
|
||||||
keyword: keyword.value || undefined,
|
keyword: keyword.value || undefined,
|
||||||
orderType: orderType.value === "ALL" ? undefined : orderType.value as GaoSalesOrderType,
|
orderType: orderType.value === "ALL" ? undefined : orderType.value as GaoSalesOrderType,
|
||||||
status: status.value === "ALL" ? undefined : status.value as GaoSalesOrderStatus,
|
status: status.value === "ALL" ? undefined : status.value as GaoSalesOrderStatus,
|
||||||
|
|||||||
@@ -62,7 +62,7 @@
|
|||||||
<strong class="value red" v-text="formatPackageAmount(props.order.saleAmount)" />
|
<strong class="value red" v-text="formatPackageAmount(props.order.saleAmount)" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="showActions" class="actions" @click.stop>
|
<div class="actions" @click.stop>
|
||||||
<t-button
|
<t-button
|
||||||
v-if="showReceiveAction"
|
v-if="showReceiveAction"
|
||||||
variant="outline"
|
variant="outline"
|
||||||
@@ -117,7 +117,6 @@ const productSummaryText = computed(() => `共 ${itemList.value.length} 项 ·
|
|||||||
const showReceiveAction = computed(() => props.canReceive && props.order.status !== "CANCELLED" && props.order.paymentStatus !== "PAID");
|
const showReceiveAction = computed(() => props.canReceive && props.order.status !== "CANCELLED" && props.order.paymentStatus !== "PAID");
|
||||||
const canFulfillByPayment = computed(() => props.order.paymentStatus === "PAID" || (props.order.paymentStatus === "PARTIALLY_PAID" && props.canOperateStock));
|
const canFulfillByPayment = computed(() => props.order.paymentStatus === "PAID" || (props.order.paymentStatus === "PARTIALLY_PAID" && props.canOperateStock));
|
||||||
const showFulfillAction = computed(() => props.canFulfill && canFulfillByPayment.value && props.order.status === "ACTIVE");
|
const showFulfillAction = computed(() => props.canFulfill && canFulfillByPayment.value && props.order.status === "ACTIVE");
|
||||||
const showActions = computed(() => showReceiveAction.value || showFulfillAction.value);
|
|
||||||
|
|
||||||
function getPaymentStatusTheme(status?: GaoSalesPaymentStatus): "success" | "warning" | "danger" | "default" {
|
function getPaymentStatusTheme(status?: GaoSalesPaymentStatus): "success" | "warning" | "danger" | "default" {
|
||||||
if (status === "PAID") {
|
if (status === "PAID") {
|
||||||
|
|||||||
@@ -82,18 +82,35 @@ const menuGroupList = computed<MenuGroup[]>(() => [
|
|||||||
{
|
{
|
||||||
title: "交易管理",
|
title: "交易管理",
|
||||||
items: [
|
items: [
|
||||||
{ icon: "order", path: "/management/sales-orders", title: "销售订单", visible: userStore.hasPermissions(permissionCodes.salesOrder.read) },
|
{
|
||||||
{ icon: "wallet", path: "/management/sales-orders?pendingReceive=true", title: "待收款", visible: userStore.hasPermissions(permissionCodes.salesOrder.read) },
|
icon: "order",
|
||||||
{ icon: "discount", path: "/management/sales-orders?status=CANCELLED&refundStatus=PENDING", title: "待退款", visible: userStore.hasPermissions(permissionCodes.salesOrder.read) },
|
path: "/management/sales-orders",
|
||||||
{ icon: "wallet", path: "/management/fund-records", title: "资金流水", visible: userStore.hasPermissions(permissionCodes.fundRecord.read) },
|
title: "销售订单",
|
||||||
{ icon: "task", path: "/management/order-fulfillments", title: "统一履约", visible: userStore.hasPermissions(permissionCodes.orderFulfillment.read) }
|
visible: userStore.hasPermissions(permissionCodes.salesOrder.read)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: "wallet",
|
||||||
|
path: "/management/fund-records",
|
||||||
|
title: "资金流水",
|
||||||
|
visible: userStore.hasPermissions(permissionCodes.fundRecord.read)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: "task",
|
||||||
|
path: "/management/order-fulfillments",
|
||||||
|
title: "统一履约",
|
||||||
|
visible: userStore.hasPermissions(permissionCodes.orderFulfillment.read)
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "套餐管理",
|
title: "套餐管理",
|
||||||
items: [
|
items: [
|
||||||
{ icon: "layers", path: "/management/package-configs", title: "套餐配置", visible: userStore.hasPermissions(permissionCodes.packageConfig.read) },
|
{
|
||||||
{ icon: "usergroup", path: "/management/customer-packages", title: "客户套餐", visible: userStore.hasPermissions(permissionCodes.customerPackage.read) }
|
icon: "layers",
|
||||||
|
path: "/management/package-configs",
|
||||||
|
title: "套餐配置",
|
||||||
|
visible: userStore.hasPermissions(permissionCodes.packageConfig.read)
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ import PackageConfigList from "@/pages/package/PackageConfigList.vue";
|
|||||||
import PackageConfigEdit from "@/pages/package/PackageConfigEdit.vue";
|
import PackageConfigEdit from "@/pages/package/PackageConfigEdit.vue";
|
||||||
import PackageConfigDetail from "@/pages/package/PackageConfigDetail.vue";
|
import PackageConfigDetail from "@/pages/package/PackageConfigDetail.vue";
|
||||||
import PackagePurchase from "@/pages/package/PackagePurchase.vue";
|
import PackagePurchase from "@/pages/package/PackagePurchase.vue";
|
||||||
import CustomerPackageList from "@/pages/package/CustomerPackageList.vue";
|
|
||||||
import CustomerPackageDetail from "@/pages/package/CustomerPackageDetail.vue";
|
|
||||||
|
|
||||||
function pageMeta(title: string, depth = 3, background = "#F5F5F8"): RouteRecordRaw["meta"] {
|
function pageMeta(title: string, depth = 3, background = "#F5F5F8"): RouteRecordRaw["meta"] {
|
||||||
return { depth, navBarVisible: true, navBarCanBack: true, navBarTitle: title, tabBarVisible: false, bodyBackground: background, darkBodyBackground: "#10161f" };
|
return { depth, navBarVisible: true, navBarCanBack: true, navBarTitle: title, tabBarVisible: false, bodyBackground: background, darkBodyBackground: "#10161f" };
|
||||||
@@ -15,7 +13,5 @@ export default [
|
|||||||
{ path: "/management/package-configs/create", name: "PackageConfigCreate", component: PackageConfigEdit, meta: pageMeta("新增套餐配置", 4) },
|
{ 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", 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/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", name: "CustomerPackageList", component: CustomerPackageList, meta: pageMeta("客户套餐") },
|
|
||||||
{ path: "/management/customer-packages/:id", name: "CustomerPackageDetail", component: CustomerPackageDetail, meta: pageMeta("客户套餐详情", 4) }
|
|
||||||
] as RouteRecordRaw[];
|
] as RouteRecordRaw[];
|
||||||
|
|||||||
@@ -53,8 +53,6 @@ export type GaoCustomerPackage = {
|
|||||||
fulfillmentList?: OrderFulfillment[];
|
fulfillmentList?: OrderFulfillment[];
|
||||||
} & Model;
|
} & Model;
|
||||||
|
|
||||||
export type CustomerPackagePage = { storeId?: string; customerId?: string; keyword?: string; status?: GaoSalesOrderStatus; beginAt?: number; endAt?: number; index: number; size: number };
|
|
||||||
|
|
||||||
export type PackagePurchaseItem = {
|
export type PackagePurchaseItem = {
|
||||||
productId: string;
|
productId: string;
|
||||||
productUnitId: string;
|
productUnitId: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user