增加订单列表优惠券抵扣商品划线,优化价格长度计算

This commit is contained in:
2024-11-12 10:50:55 +08:00
parent 5476a6af41
commit 9167ee9a9b

View File

@@ -40,7 +40,7 @@
</view>
<view class="u-flex u-flex-1 u-row-right">
<view>×{{item.num}}</view>
<template v-if="item.gift">
<template v-if="item.gift||item.userCouponId">
<view class="u-text-right u-relative" :style="computedPriceStyle()">
<text class="line-th">{{goodsPriceAmount(item)}}</text>
<view class="u-absolute" style="bottom: 100%;right: 0;">
@@ -155,9 +155,12 @@
let goodsNumber = ref(0)
const priceSize = 9
let minWidth=ref(36)
function goodsPriceAmount(item) {
return (item.price * item.num).toFixed(2)
const total=(item.price * item.num).toFixed(2)
const minW=total.length * priceSize + 15
minWidth.value=minW<minWidth.value?minWidth.value:minW
return total
}
function goodsVipPriceAmount(item) {
@@ -170,14 +173,8 @@
// },0).toFixed(2)
// })
function computedPriceStyle() {
const item = props.data.detailList.reduce((prev, current) => (`${prev.price}`.length > `${current.price}`
.length) ? prev : current)
if (!item) {
return ''
}
const minW = `${item.price}`.length * priceSize + 15
return {
'min-width': (minW < 36 ? 36 : minW) + 'px'
'min-width':minWidth.value + 'px'
}
}
// const computedPriceStyle = computed(() => {