diff --git a/src/manifest.json b/src/manifest.json index 8edf53d..6f7a49a 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -2,8 +2,8 @@ "name" : "CHEFLINK delivery", "appid" : "__UNI__06509BE", "description" : "", - "versionName" : "3.3.1", - "versionCode" : 331, + "versionName" : "3.3.2", + "versionCode" : 332, "transformPx" : false, /* 5+App特有相关 */ "app-plus" : { diff --git a/src/pages-store/pages/order/checkout.vue b/src/pages-store/pages/order/checkout.vue index 836fe8b..9b4641b 100644 --- a/src/pages-store/pages/order/checkout.vue +++ b/src/pages-store/pages/order/checkout.vue @@ -1419,6 +1419,51 @@ const isUserMemberCheckout = computed(() => { return false; }); +function getCheckoutCartItemDiscountPrice(item: MerchantCartVo) { + return item.discountPrice ?? item.merchantDishVo?.discountPrice; +} + +function getCheckoutCartItemOriginalPrice(item: MerchantCartVo) { + return item.originalPrice ?? item.merchantDishVo?.originalPrice; +} + +function getCheckoutCartItemMemberPrice(item: MerchantCartVo) { + return item.memberPrice ?? item.merchantDishVo?.memberPrice; +} + +function normalizeCheckoutPriceString(val: unknown) { + const s = String(val ?? '').trim(); + if (!/^\d+(\.\d+)?$/.test(s)) return '0'; + const [intRaw, decRaw = ''] = s.split('.'); + const intPart = intRaw.replace(/^0+(?=\d)/, '') || '0'; + const decPart = decRaw.slice(0, 2).padEnd(2, '0'); + return `${intPart}.${decPart}`; +} + +function checkoutPriceToCentString(val: unknown) { + const normalized = normalizeCheckoutPriceString(val); + const [intPart, decPart = '00'] = normalized.split('.'); + return `${intPart}${decPart}`.replace(/^0+(?=\d)/, '') || '0'; +} + +/** 与购物车列表一致:会员展示会员价,非会员展示折扣价 */ +function getCheckoutLineDisplayPrice(item: MerchantCartVo) { + if (isUserMemberCheckout.value) { + return getCheckoutCartItemMemberPrice(item); + } + return getCheckoutCartItemDiscountPrice(item); +} + +/** 与购物车列表一致:划线原价与当前展示价不一致时显示 */ +function showCheckoutLineOriginalPrice(item: MerchantCartVo) { + const originalCent = checkoutPriceToCentString(getCheckoutCartItemOriginalPrice(item)); + const currentCent = + isUserMemberCheckout.value && checkoutPriceToCentString(getCheckoutCartItemMemberPrice(item)) !== '0' + ? checkoutPriceToCentString(getCheckoutCartItemMemberPrice(item)) + : checkoutPriceToCentString(getCheckoutCartItemDiscountPrice(item)); + return originalCent !== '0' && originalCent !== currentCent; +} + const cartTotalPieceCount = computed(() => { if (orderType.value === 'batch') { let n = 0; @@ -1773,7 +1818,13 @@ function handleClose(merchantId?: string) { - ${{ item.merchantDishVo?.discountPrice }} + + ${{ getCheckoutLineDisplayPrice(item) }} + ${{ getCheckoutCartItemOriginalPrice(item) }} + @@ -1863,11 +1914,11 @@ function handleClose(merchantId?: string) { ${{ item.merchantDishVo?.discountPrice }} + >${{ getCheckoutLineDisplayPrice(item) }} ${{ item.merchantDishVo?.originalPrice }} + >${{ getCheckoutCartItemOriginalPrice(item) }} x{{ item.count }}