增加订单列表优惠券抵扣商品划线,优化价格长度计算
This commit is contained in:
@@ -40,7 +40,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="u-flex u-flex-1 u-row-right">
|
<view class="u-flex u-flex-1 u-row-right">
|
||||||
<view>×{{item.num}}</view>
|
<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()">
|
<view class="u-text-right u-relative" :style="computedPriceStyle()">
|
||||||
<text class="line-th">¥{{goodsPriceAmount(item)}}</text>
|
<text class="line-th">¥{{goodsPriceAmount(item)}}</text>
|
||||||
<view class="u-absolute" style="bottom: 100%;right: 0;">
|
<view class="u-absolute" style="bottom: 100%;right: 0;">
|
||||||
@@ -155,9 +155,12 @@
|
|||||||
let goodsNumber = ref(0)
|
let goodsNumber = ref(0)
|
||||||
|
|
||||||
const priceSize = 9
|
const priceSize = 9
|
||||||
|
let minWidth=ref(36)
|
||||||
function goodsPriceAmount(item) {
|
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) {
|
function goodsVipPriceAmount(item) {
|
||||||
@@ -170,14 +173,8 @@
|
|||||||
// },0).toFixed(2)
|
// },0).toFixed(2)
|
||||||
// })
|
// })
|
||||||
function computedPriceStyle() {
|
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 {
|
return {
|
||||||
'min-width': (minW < 36 ? 36 : minW) + 'px'
|
'min-width':minWidth.value + 'px'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// const computedPriceStyle = computed(() => {
|
// const computedPriceStyle = computed(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user