修复bug
This commit is contained in:
+2
-2
@@ -2,8 +2,8 @@
|
|||||||
"name" : "CHEFLINK delivery",
|
"name" : "CHEFLINK delivery",
|
||||||
"appid" : "__UNI__06509BE",
|
"appid" : "__UNI__06509BE",
|
||||||
"description" : "",
|
"description" : "",
|
||||||
"versionName" : "3.3.1",
|
"versionName" : "3.3.2",
|
||||||
"versionCode" : 331,
|
"versionCode" : 332,
|
||||||
"transformPx" : false,
|
"transformPx" : false,
|
||||||
/* 5+App特有相关 */
|
/* 5+App特有相关 */
|
||||||
"app-plus" : {
|
"app-plus" : {
|
||||||
|
|||||||
@@ -1419,6 +1419,51 @@ const isUserMemberCheckout = computed(() => {
|
|||||||
return false;
|
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(() => {
|
const cartTotalPieceCount = computed(() => {
|
||||||
if (orderType.value === 'batch') {
|
if (orderType.value === 'batch') {
|
||||||
let n = 0;
|
let n = 0;
|
||||||
@@ -1773,7 +1818,13 @@ function handleClose(merchantId?: string) {
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="text-30rpx text-#333 font-500 shrink-0 ml-16rpx">${{ item.merchantDishVo?.discountPrice }}</view>
|
<view class="checkout-order-line-price shrink-0 ml-16rpx text-right">
|
||||||
|
<view class="text-30rpx text-#333 font-500">${{ getCheckoutLineDisplayPrice(item) }}</view>
|
||||||
|
<view
|
||||||
|
v-if="showCheckoutLineOriginalPrice(item)"
|
||||||
|
class="text-24rpx text-#7D7D7D line-through mt-4rpx"
|
||||||
|
>${{ getCheckoutCartItemOriginalPrice(item) }}</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</wd-collapse-item>
|
</wd-collapse-item>
|
||||||
</wd-collapse>
|
</wd-collapse>
|
||||||
@@ -1863,11 +1914,11 @@ function handleClose(merchantId?: string) {
|
|||||||
<view class="flex items-center justify-between mt-12rpx">
|
<view class="flex items-center justify-between mt-12rpx">
|
||||||
<view class="flex items-center">
|
<view class="flex items-center">
|
||||||
<text class="text-[#333333] text-28rpx font-500"
|
<text class="text-[#333333] text-28rpx font-500"
|
||||||
>${{ item.merchantDishVo?.discountPrice }}</text>
|
>${{ getCheckoutLineDisplayPrice(item) }}</text>
|
||||||
<text
|
<text
|
||||||
v-if="item.merchantDishVo?.originalPrice && item.merchantDishVo?.originalPrice !== item.merchantDishVo?.discountPrice"
|
v-if="showCheckoutLineOriginalPrice(item)"
|
||||||
class="text-[#7D7D7D] text-22rpx line-through ml-8rpx"
|
class="text-[#7D7D7D] text-22rpx line-through ml-8rpx"
|
||||||
>${{ item.merchantDishVo?.originalPrice }}</text>
|
>${{ getCheckoutCartItemOriginalPrice(item) }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="text-[#7D7D7D] text-22rpx">
|
<view class="text-[#7D7D7D] text-22rpx">
|
||||||
x{{ item.count }}
|
x{{ item.count }}
|
||||||
|
|||||||
Reference in New Issue
Block a user