ui调整
This commit is contained in:
@@ -115,20 +115,14 @@ function scheduleCartUpdate(item: MerchantCartVo, targetValue: number) {
|
||||
pendingUpdateTimers.set(key, timer)
|
||||
}
|
||||
|
||||
function normalizeInputNumberValue(payload: any): number {
|
||||
if (typeof payload === 'number') {
|
||||
return payload
|
||||
}
|
||||
if (payload && typeof payload === 'object') {
|
||||
if (typeof payload.detail?.value === 'number') {
|
||||
return payload.detail.value
|
||||
}
|
||||
if (typeof payload.value === 'number') {
|
||||
return payload.value
|
||||
}
|
||||
}
|
||||
const numeric = Number(payload)
|
||||
return Number.isNaN(numeric) ? 0 : numeric
|
||||
/** wd-input-number change 为 { value },兼容 detail.value */
|
||||
function normalizeInputNumberValue(payload: unknown): number {
|
||||
const raw =
|
||||
typeof payload === "number"
|
||||
? payload
|
||||
: (payload as any)?.value ?? (payload as any)?.detail?.value ?? payload;
|
||||
const n = Number(raw);
|
||||
return Number.isFinite(n) ? n : 0;
|
||||
}
|
||||
|
||||
const delItemData = ref<MerchantCartVo | null>(null)
|
||||
@@ -247,6 +241,18 @@ function appMerchantCartCalculateSavings() {
|
||||
})
|
||||
}
|
||||
|
||||
function getCartItemDiscountPrice(item: MerchantCartVo) {
|
||||
return item.discountPrice ?? item.merchantDishVo?.discountPrice
|
||||
}
|
||||
|
||||
function getCartItemOriginalPrice(item: MerchantCartVo) {
|
||||
return item.originalPrice ?? item.merchantDishVo?.originalPrice
|
||||
}
|
||||
|
||||
function getCartItemMemberPrice(item: MerchantCartVo) {
|
||||
return item.memberPrice ?? item.merchantDishVo?.memberPrice
|
||||
}
|
||||
|
||||
function navigateTo(url: string) {
|
||||
uni.navigateTo({ url })
|
||||
}
|
||||
@@ -301,21 +307,21 @@ function navigateTo(url: string) {
|
||||
|
||||
<view class="price-row flex items-center mt-18rpx">
|
||||
<text class="current-price text-[#333333] text-30rpx font-normal"
|
||||
>${{ item.merchantDishVo.discountPrice }}</text
|
||||
>${{ getCartItemDiscountPrice(item) }}</text
|
||||
>
|
||||
<text
|
||||
v-if="item.merchantDishVo.originalPrice"
|
||||
v-if="getCartItemOriginalPrice(item)"
|
||||
class="original-price text-[#7D7D7D] text-24rpx font-normal line-through ml-10rpx"
|
||||
>${{ item.merchantDishVo.originalPrice }}</text
|
||||
>${{ getCartItemOriginalPrice(item) }}</text
|
||||
>
|
||||
|
||||
<!-- 会员价标签 -->
|
||||
<view
|
||||
v-if="Number(item.merchantDishVo.memberPrice) > 0"
|
||||
v-if="Number(getCartItemMemberPrice(item)) > 0"
|
||||
class="member-price-tag ml-10rpx center pl-16rpx pr-6rpx pb-2rpx"
|
||||
>
|
||||
<text class="text-[#FBE3C3] text-20rpx"
|
||||
>{{ t('pages-store.store.members') }}: ${{ item.merchantDishVo.memberPrice }}</text
|
||||
>{{ t('pages-store.store.members') }}: ${{ getCartItemMemberPrice(item) }}</text
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user