修复bug

This commit is contained in:
2026-04-14 17:45:41 +08:00
parent d2077f5844
commit a89610c245
12 changed files with 454 additions and 125 deletions
+10 -4
View File
@@ -556,14 +556,20 @@ function feeLine(
return { show: true, orig, cur };
}
onMounted(() => {
loading.value = true;
getCartList();
});
// onMounted(() => {
// loading.value = true;
// getCartList();
// });
onShow(() => {
if (userStore.isLogin) {
userStore.getAppointmentTime();
// 从结算页返回时强制刷新购物车,避免已结算商品残留
loading.value = true;
getCartList();
} else {
dataList.value = [];
loading.value = false;
}
});
+21 -1
View File
@@ -42,6 +42,26 @@ function formatCouponDetail(item: any) {
return t('pages-store.store.discount')
}
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
}
function formatCouponMerchantText(item: any) {
const name = String(item?.merchantVo?.merchantName || '').trim()
if (name) {
return fillI18nParams(t('pages-user.coupon.merchant-only'), { name })
}
return item?.snapshotMerchantId
? t('pages-user.coupon.merchant-specific')
: t('pages-user.coupon.all-merchants')
}
function getList(pageNum: number, pageSize: number) {
return appCouponUserCouponListPost({
params: {
@@ -150,7 +170,7 @@ function handleSubmit() {
{{ item.snapshotNameZh }}
</view>
<view class="text-24rpx lh-32rpx text-#999 my-18rpx">
{{ item.snapshotMerchantId ? t('pages-user.coupon.merchant-specific') : t('pages-user.coupon.all-merchants') }}
{{ formatCouponMerchantText(item) }}
</view>
<view class="text-24rpx lh-32rpx text-#999 my-18rpx">
{{ dayjs(Number(item.snapshotValidEnd)).format('YYYY-MM-DD HH:mm') }}{{ isEnLocale() ? ' expires' : '到期' }}