add preset reason
This commit is contained in:
@@ -217,8 +217,12 @@ html.theme-dark body {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.t-dialog__footer {
|
.t-dialog {
|
||||||
gap: 1rem;
|
--td-spacer-3: .75rem;
|
||||||
|
|
||||||
|
.t-dialog__footer {
|
||||||
|
--td-button-border-radius: 1rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.t-pull-down-refresh {
|
.t-pull-down-refresh {
|
||||||
|
|||||||
@@ -113,8 +113,41 @@
|
|||||||
@cancel="reasonVisible = false"
|
@cancel="reasonVisible = false"
|
||||||
@confirm="submitReason"
|
@confirm="submitReason"
|
||||||
>
|
>
|
||||||
<t-textarea v-model.trim="reason" borderless autosize placeholder="请输入原因" />
|
<div class="reason">
|
||||||
|
<t-input
|
||||||
|
label="原因"
|
||||||
|
v-model="reason"
|
||||||
|
borderless
|
||||||
|
autosize
|
||||||
|
maxlength="500"
|
||||||
|
placeholder="请输入原因"
|
||||||
|
>
|
||||||
|
<template #suffix>
|
||||||
|
<t-button
|
||||||
|
size="extra-small"
|
||||||
|
theme="primary"
|
||||||
|
variant="outline"
|
||||||
|
content="选择"
|
||||||
|
@click="openReasonPicker"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</t-input>
|
||||||
|
</div>
|
||||||
</t-dialog>
|
</t-dialog>
|
||||||
|
<t-popup
|
||||||
|
v-model="reasonPickerVisible"
|
||||||
|
placement="bottom"
|
||||||
|
:z-index="reasonPickerZIndex"
|
||||||
|
:overlay-props="{ zIndex: reasonPickerZIndex - 1 }"
|
||||||
|
>
|
||||||
|
<t-picker
|
||||||
|
v-model="reasonPickerDraft"
|
||||||
|
:columns="reasonPickerColumns"
|
||||||
|
:title="reasonAction === 'reject' ? '选择拒绝原因' : '选择撤销原因'"
|
||||||
|
@cancel="reasonPickerVisible = false"
|
||||||
|
@confirm="confirmReason"
|
||||||
|
/>
|
||||||
|
</t-popup>
|
||||||
<order-fulfillment-revoke
|
<order-fulfillment-revoke
|
||||||
v-if="fulfillment"
|
v-if="fulfillment"
|
||||||
v-model:visible="revokeVisible"
|
v-model:visible="revokeVisible"
|
||||||
@@ -161,6 +194,9 @@ const operating = ref(false);
|
|||||||
const reasonVisible = ref(false);
|
const reasonVisible = ref(false);
|
||||||
const reasonAction = ref<ReasonAction>("reject");
|
const reasonAction = ref<ReasonAction>("reject");
|
||||||
const reason = ref("");
|
const reason = ref("");
|
||||||
|
const reasonPickerVisible = ref(false);
|
||||||
|
const reasonPickerDraft = ref<string[]>([]);
|
||||||
|
const reasonPickerZIndex = 12001;
|
||||||
const revokeVisible = ref(false);
|
const revokeVisible = ref(false);
|
||||||
const stockPreviewList = ref<ProductStockPreviewItem[]>([]);
|
const stockPreviewList = ref<ProductStockPreviewItem[]>([]);
|
||||||
const stockPreviewLoading = ref(false);
|
const stockPreviewLoading = ref(false);
|
||||||
@@ -179,6 +215,23 @@ const isOrderCancelled = computed(() => order.value?.status === "CANCELLED");
|
|||||||
const canVerify = computed(() => userStore.hasPermissions(permissionCodes.orderFulfillment.verify));
|
const canVerify = computed(() => userStore.hasPermissions(permissionCodes.orderFulfillment.verify));
|
||||||
const canCreate = computed(() => userStore.hasPermissions(permissionCodes.orderFulfillment.create));
|
const canCreate = computed(() => userStore.hasPermissions(permissionCodes.orderFulfillment.create));
|
||||||
const canRevoke = computed(() => userStore.hasPermissions(permissionCodes.orderFulfillment.revoke));
|
const canRevoke = computed(() => userStore.hasPermissions(permissionCodes.orderFulfillment.revoke));
|
||||||
|
const reasonOptions: Record<ReasonAction, string[]> = {
|
||||||
|
reject: [
|
||||||
|
"履约信息填写有误",
|
||||||
|
"商品或服务与订单不符",
|
||||||
|
"履约数量与实际不符",
|
||||||
|
"缺少必要的履约凭证",
|
||||||
|
"当前条件无法完成履约"
|
||||||
|
],
|
||||||
|
cancel: [
|
||||||
|
"客户申请撤销履约",
|
||||||
|
"履约单重复创建",
|
||||||
|
"履约信息填写有误",
|
||||||
|
"商品或服务信息有误",
|
||||||
|
"订单状态异常"
|
||||||
|
]
|
||||||
|
};
|
||||||
|
const reasonPickerColumns = computed(() => reasonOptions[reasonAction.value].map(item => ({ label: item, value: item })));
|
||||||
const stockPreviewVisible = computed(() => (isWaitingStock.value || isPending.value)
|
const stockPreviewVisible = computed(() => (isWaitingStock.value || isPending.value)
|
||||||
&& userStore.hasPermissions(permissionCodes.product.read)
|
&& userStore.hasPermissions(permissionCodes.product.read)
|
||||||
&& userStore.hasPermissions(permissionCodes.productStock.read));
|
&& userStore.hasPermissions(permissionCodes.productStock.read));
|
||||||
@@ -324,9 +377,28 @@ async function verify(): Promise<void> {
|
|||||||
} catch (error) { Message.error(getErrorMessage(error, "履约核销失败")); }
|
} catch (error) { Message.error(getErrorMessage(error, "履约核销失败")); }
|
||||||
finally { operating.value = false; }
|
finally { operating.value = false; }
|
||||||
}
|
}
|
||||||
function openReason(action: ReasonAction): void { reasonAction.value = action; reason.value = ""; reasonVisible.value = true; }
|
function openReason(action: ReasonAction): void {
|
||||||
|
reasonAction.value = action;
|
||||||
|
reason.value = "";
|
||||||
|
reasonPickerVisible.value = false;
|
||||||
|
reasonVisible.value = true;
|
||||||
|
}
|
||||||
|
function openReasonPicker(): void {
|
||||||
|
const options = reasonOptions[reasonAction.value];
|
||||||
|
const currentReason = options.includes(reason.value) ? reason.value : options[0];
|
||||||
|
reasonPickerDraft.value = [currentReason];
|
||||||
|
reasonPickerVisible.value = true;
|
||||||
|
}
|
||||||
|
function confirmReason(value: Array<string | number>): void {
|
||||||
|
reason.value = String(value[0] || reasonPickerDraft.value[0] || "");
|
||||||
|
reasonPickerVisible.value = false;
|
||||||
|
}
|
||||||
async function submitReason(): Promise<void> {
|
async function submitReason(): Promise<void> {
|
||||||
if (!fulfillment.value?.id || !reason.value || operating.value) return;
|
if (!fulfillment.value?.id || operating.value) return;
|
||||||
|
if (!reason.value.trim()) {
|
||||||
|
Message.warning("请填写或选择原因");
|
||||||
|
return;
|
||||||
|
}
|
||||||
operating.value = true;
|
operating.value = true;
|
||||||
try {
|
try {
|
||||||
const payload = { fulfillmentId: fulfillment.value.id, reason: reason.value.trim() };
|
const payload = { fulfillmentId: fulfillment.value.id, reason: reason.value.trim() };
|
||||||
@@ -355,6 +427,17 @@ onMounted(loadData);
|
|||||||
padding: .75rem 1rem;
|
padding: .75rem 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.reason {
|
||||||
|
gap: .5rem;
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
|
||||||
|
.t-textarea {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.items {
|
.items {
|
||||||
|
|
||||||
.item {
|
.item {
|
||||||
|
|||||||
Reference in New Issue
Block a user