wip(freight): migration 0017 + model/column-list groundwork for add-freight-templates

This commit is contained in:
Chengdong Zhang
2026-09-23 17:39:45 +08:00
parent a83e857bdf
commit 5b426486ac
105 changed files with 6193 additions and 1566 deletions
+51 -15
View File
@@ -33,7 +33,10 @@ async function load(): Promise<void> {
loading.value = true;
try {
await ensureCurrencies();
const [loadedOrder, loadedAftersales] = await Promise.all([$api.getOrder(orderId.value), $api.listMyAftersales()]);
const [loadedOrder, loadedAftersales] = await Promise.all([
$api.getOrder(orderId.value),
$api.listMyAftersales(),
]);
order.value = loadedOrder;
aftersales.value = loadedAftersales;
} catch {
@@ -70,7 +73,10 @@ async function submit(): Promise<void> {
kind: kind.value,
reason: { en: content, zh: content },
amount_minor: amount,
evidence: evidence.value.split("\n").map((url) => url.trim()).filter(Boolean),
evidence: evidence.value
.split("\n")
.map((url) => url.trim())
.filter(Boolean),
});
await navigateTo(`/user/aftersales/${created.id}`);
} catch {
@@ -85,26 +91,56 @@ onMounted(() => void load());
<template>
<VCard class="min-h-[560px]">
<h1 class="mb-4 text-xl font-bold text-text">{{ t("user.aftersaleApply") }}</h1>
<div v-if="loading" class="py-5 text-muted">{{ t("common.loading") }}</div>
<h1 class="text-text mb-4 text-xl font-bold">{{ t("user.aftersaleApply") }}</h1>
<div v-if="loading" class="text-muted py-5">{{ t("common.loading") }}</div>
<form v-else class="grid max-w-[640px] gap-4" @submit.prevent="submit">
<VCard :padded="false" class="flex items-center gap-3 border border-border p-4">
<img class="h-14 w-14 border border-border object-contain" :src="item.image || '/mock/product-1.svg'" :alt="item.product_name.en" />
<div class="min-w-0 flex-1"><p class="m-0 truncate text-sm text-text">{{ item.product_name.en }}</p><p class="mt-1 text-xs text-muted">{{ item.sku_code }} × {{ item.qty }}</p></div>
<VCard :padded="false" class="border-border flex items-center gap-3 border p-4">
<img
class="border-border h-14 w-14 border object-contain"
:src="item.image || '/mock/product-1.svg'"
:alt="item.product_name.en"
/>
<div class="min-w-0 flex-1">
<p class="text-text m-0 truncate text-sm">{{ item.product_name.en }}</p>
<p class="text-muted mt-1 text-xs">{{ item.sku_code }} × {{ item.qty }}</p>
</div>
</VCard>
<fieldset class="grid gap-2 border-0 p-0">
<legend class="mb-1 block text-[13px] text-muted">{{ t("user.aftersaleType") }}</legend>
<label class="text-sm text-text"><input v-model="kind" class="mr-1 accent-primary" type="radio" value="refund_only" /> {{ t("user.refundOnly") }}</label>
<label class="text-sm text-text"><input v-model="kind" class="mr-1 accent-primary" type="radio" value="return_refund" /> {{ t("user.returnRefund") }}</label>
<legend class="text-muted mb-1 block text-[13px]">{{ t("user.aftersaleType") }}</legend>
<label class="text-text text-sm"
><input v-model="kind" class="accent-primary mr-1" type="radio" value="refund_only" />
{{ t("user.refundOnly") }}</label
>
<label class="text-text text-sm"
><input v-model="kind" class="accent-primary mr-1" type="radio" value="return_refund" />
{{ t("user.returnRefund") }}</label
>
</fieldset>
<VField :label="t('user.aftersaleReason')"><textarea v-model="reason" class="min-h-24 rounded-md border border-border bg-surface p-2.5 text-sm text-text" :placeholder="t('user.aftersaleReasonHint')" /></VField>
<VField :label="t('user.aftersaleReason')">
<textarea
v-model="reason"
class="border-border bg-surface text-text min-h-24 rounded-md border p-2.5 text-sm"
:placeholder="t('user.aftersaleReasonHint')"
/>
</VField>
<VField :label="t('user.aftersaleAmount')">
<VInput v-model="amountMajor" />
<p class="m-0 mt-1 text-xs text-muted">{{ t("user.aftersaleAmountHint") }} {{ t("user.aftersaleRemaining") }}: <PriceText :amount-minor="remainingMinor" :currency="order.currency" /></p>
<p class="text-muted m-0 mt-1 text-xs">
{{ t("user.aftersaleAmountHint") }} {{ t("user.aftersaleRemaining") }}:
<PriceText :amount-minor="remainingMinor" :currency="order.currency" />
</p>
</VField>
<VField :label="t('user.aftersaleEvidence')"><textarea v-model="evidence" class="min-h-20 rounded-md border border-border bg-surface p-2.5 text-sm text-text" :placeholder="t('user.aftersaleEvidenceHint')" /></VField>
<p v-if="errorKey" class="m-0 text-xs text-danger">{{ t(errorKey) }}</p>
<VBtn class="w-fit" variant="primary" type="submit" :disabled="working">{{ t("user.submitAftersale") }}</VBtn>
<VField :label="t('user.aftersaleEvidence')">
<textarea
v-model="evidence"
class="border-border bg-surface text-text min-h-20 rounded-md border p-2.5 text-sm"
:placeholder="t('user.aftersaleEvidenceHint')"
/>
</VField>
<p v-if="errorKey" class="text-danger m-0 text-xs">{{ t(errorKey) }}</p>
<VBtn class="w-fit" variant="primary" type="submit" :disabled="working">{{
t("user.submitAftersale")
}}</VBtn>
</form>
</VCard>
</template>