PointsPrice.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <template>
  2. <view ref="textContainer" class="price-box acea-row w-full line-heightOne align-center">
  3. <view class="acea-row row-middle" v-if="parseFloat(pointsPrice.redeemIntegral)" ref="redeemIntegral">
  4. <image :src="`${urlDomain}crmebimage/presets/points_my.png`" :style="[iconStyle]"></image>
  5. <text class="icon-color semiBold" :style="[priceStyle, priceColor]">{{ pointsPrice.redeemIntegral }}</text>
  6. </view>
  7. <view
  8. v-if="parseFloat(pointsPrice.redeemIntegral) && (parseFloat(pointsPrice.price) || parseFloat(pointsPrice.payFee))"
  9. ref="hao" class="ml-4"> + </view>
  10. <view class="acea-row row-middle" v-if="parseFloat(pointsPrice.price) || parseFloat(pointsPrice.payFee)">
  11. <text class="icon-color semiBold ml-4"
  12. :style="[priceStyle, priceColor]">{{ pointsPrice.price || pointsPrice.payFee }}</text>
  13. <text :style="[unitStyle]" class="ml-4">元</text>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. /**
  19. * 字数超过样式
  20. */
  21. export const pointsStyle = {
  22. iconStyle: {
  23. width: '22rpx',
  24. height: '22rpx'
  25. },
  26. priceStyle: {
  27. fontSize: '22rpx',
  28. },
  29. unitStyle: {
  30. fontSize: '18rpx',
  31. },
  32. }
  33. import easyLoadimage from '@/components/base/easy-loadimage.vue';
  34. export default {
  35. components: {
  36. easyLoadimage
  37. },
  38. props: {
  39. //是否展示小字样式
  40. value: {
  41. type: Boolean,
  42. default: false,
  43. },
  44. //商品大小样式
  45. pointsPrice: {
  46. type: Object,
  47. default: function() {
  48. return {};
  49. }
  50. },
  51. //商品大小样式
  52. pointsGoodsStyle: {
  53. type: Object,
  54. default: function() {
  55. return {};
  56. }
  57. },
  58. },
  59. computed: {
  60. isOverflow() {
  61. return this.pointsPrice.redeemIntegral > 9999 && this.pointsPrice.price > 9999;
  62. },
  63. // 价格
  64. priceStyle() {
  65. return this.isOverflow && this.value ? this.pointsStyle.priceStyle : this.pointsGoodsStyle.priceStyle
  66. },
  67. //单位
  68. unitStyle() {
  69. return this.isOverflow && this.value ? this.pointsStyle.unitStyle : this.pointsGoodsStyle.unitStyle
  70. },
  71. // 图标
  72. iconStyle() {
  73. return this.isOverflow && this.value ? this.pointsStyle.iconStyle : this.pointsGoodsStyle.iconStyle
  74. },
  75. // 价格颜色
  76. priceColor() {
  77. return this.pointsGoodsStyle.priceColor ? this.pointsGoodsStyle.priceColor : ''
  78. },
  79. },
  80. data() {
  81. return {
  82. pointsStyle: pointsStyle,
  83. urlDomain: this.$Cache.get("imgHost"),
  84. }
  85. },
  86. }
  87. </script>
  88. <style scoped lang="scss">
  89. .acea-row {
  90. flex-wrap: nowrap;
  91. }
  92. .price-box {
  93. width: auto;
  94. //font-size: 24rpx;
  95. font-weight: 500;
  96. color: #666;
  97. image {
  98. width: 31rpx;
  99. height: 31rpx;
  100. margin-right: 6rpx;
  101. }
  102. }
  103. .sales {
  104. color: #999999;
  105. margin-top: 8rpx;
  106. }
  107. </style>