This commit is contained in:
2026-04-14 15:02:00 +08:00
parent ec9282a64f
commit d2077f5844
23 changed files with 1551 additions and 428 deletions
+64 -16
View File
@@ -28,6 +28,21 @@ const { t } = useI18n();
const configStore = useConfigStore();
const userStore = useUserStore();
function fillI18nParams(template: string, params: Record<string, string | number>) {
let text = template;
Object.keys(params).forEach((key) => {
const value = String(params[key] ?? "");
text = text.replace(new RegExp(`\\{${key}\\}`, "g"), value);
text = text.replace(new RegExp(`\\$\\{${key}\\}`, "g"), value);
});
return text;
}
const appDisplayName = computed(() => {
const name = String((Config as any)?.appName ?? "").trim();
return name || "CHEFLINK";
});
// 送达偏好
const visitMethodRef = ref();
// value 与 visit-method 组件保持一致:0-亲自送达 1-放门口
@@ -1176,6 +1191,47 @@ const scheduledServiceEndLabel = computed(() => {
return '';
});
const localDeliverySubtitleText = computed(() =>
fillI18nParams(t('pages-store.checkout.localDeliverySubtitle'), { name: appDisplayName.value })
);
const itemsGoodsTotalWithPriceText = computed(() =>
fillI18nParams(t('pages-store.checkout.itemsGoodsTotalWithPrice'), {
count: cartTotalPieceCount.value,
amount: displayGoodsAmountStr.value,
})
);
const scheduledDeliveryWindowText = computed(() =>
fillI18nParams(t('pages-store.checkout.scheduledDeliveryWindow'), {
time: scheduledServiceEndLabel.value,
})
);
const deliverBeforeText = computed(() =>
fillI18nParams(t('pages-store.checkout.deliverBefore'), {
time: deliveryMethod.value === 0
? String(userSelectedDeliveryTimeDate.value ?? '')
: String(userSelectedSelfPickupTimeDate.value ?? ''),
})
);
const memberThanksText = computed(() =>
fillI18nParams(t('pages-store.checkout.memberThanks'), { name: appDisplayName.value })
);
const subtotalWithPiecesText = computed(() =>
fillI18nParams(t('pages-store.checkout.subtotalWithPieces'), {
count: cartTotalPieceCount.value,
})
);
const subtotalOneLineText = computed(() =>
fillI18nParams(t('pages-store.checkout.subtotalOneLine'), {
amount: displayPaidStr.value,
})
);
const showAppointmentEntry = computed(() => {
if (deliveryMethod.value === 0) {
return storeIsDeliveryService.value || orderType.value === 'batch';
@@ -1332,7 +1388,7 @@ function handleClose(merchantId?: string) {
}}</text>
<text class="checkout-card-subtitle block">{{
deliveryMethod === 0
? t('pages-store.checkout.localDeliverySubtitle', { name: Config.appName })
? localDeliverySubtitleText
: t('pages-store.checkout.pickupSubtitle')
}}</text>
</view>
@@ -1346,7 +1402,7 @@ function handleClose(merchantId?: string) {
</view>
<view class="checkout-confirm-band-right">
<text class="checkout-confirm-band-line1">
{{ t('pages-store.checkout.itemsGoodsTotalWithPrice', { count: cartTotalPieceCount, amount: displayGoodsAmountStr }) }}
{{ itemsGoodsTotalWithPriceText }}
</text>
<view v-if="deliveryMethod === 0" class="checkout-confirm-band-line2">
<text>{{ t('pages-store.checkout.shippingFee') }}</text>
@@ -1370,7 +1426,7 @@ function handleClose(merchantId?: string) {
<view class="flex-1 min-w-0">
<text class="checkout-schedule-title">{{ t('pages-store.checkout.scheduledDeliveryTitle') }}</text>
<text v-if="scheduledServiceEndLabel" class="checkout-schedule-mid">{{
t('pages-store.checkout.scheduledDeliveryWindow', { time: scheduledServiceEndLabel })
scheduledDeliveryWindowText
}}</text>
<text class="checkout-schedule-hint">{{
t('pages-store.checkout.scheduledDeliveryHint')
@@ -1456,11 +1512,7 @@ function handleClose(merchantId?: string) {
v-if="showAppointmentEntry && (userSelectedDeliveryTimeDate || userSelectedSelfPickupTimeDate)"
class="checkout-deliver-hint"
>
{{
t('pages-store.checkout.deliverBefore', {
time: deliveryMethod === 0 ? userSelectedDeliveryTimeDate : userSelectedSelfPickupTimeDate,
})
}}
{{ deliverBeforeText }}
</view>
</view>
</view>
@@ -1735,13 +1787,11 @@ function handleClose(merchantId?: string) {
<view class="checkout-section-label">{{ t('pages-store.checkout.orderBreakdown') }}</view>
<view class="checkout-card checkout-breakdown checkout-gutter">
<view v-if="isUserMemberCheckout" class="checkout-member-line">
<text class="checkout-member-text">{{
t('pages-store.checkout.memberThanks', { name: Config.appName })
}}</text>
<text class="checkout-member-text">{{ memberThanksText }}</text>
<text class="checkout-member-icon"></text>
</view>
<view class="checkout-breakdown-row">
<text class="checkout-breakdown-label">{{ t('pages-store.checkout.subtotalWithPieces', { count: cartTotalPieceCount }) }}</text>
<text class="checkout-breakdown-label">{{ subtotalWithPiecesText }}</text>
<text class="checkout-breakdown-value">${{ displayGoodsAmountStr }}</text>
</view>
<view class="checkout-breakdown-row">
@@ -1792,7 +1842,7 @@ function handleClose(merchantId?: string) {
</view>
<view class="checkout-breakdown-divider"></view>
<view class="checkout-breakdown-row checkout-breakdown-row--total">
<text class="checkout-breakdown-total-label">{{ t('pages-store.checkout.subtotalWithPieces', { count: cartTotalPieceCount }) }}</text>
<text class="checkout-breakdown-total-label">{{ subtotalWithPiecesText }}</text>
<text class="checkout-breakdown-total-value">${{ displayPaidStr }}</text>
</view>
</view>
@@ -1822,9 +1872,7 @@ function handleClose(merchantId?: string) {
<view class="checkout-bottom-bar-glass"></view>
<view class="checkout-bottom-bar-inner">
<view class="checkout-bottom-bar-price">
<text class="checkout-bottom-bar-one-line">{{
t('pages-store.checkout.subtotalOneLine', { amount: displayPaidStr })
}}</text>
<text class="checkout-bottom-bar-one-line">{{ subtotalOneLineText }}</text>
</view>
<wd-button
@click="handleGoSettle"