medicineVerticalItem.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <template>
  2. <view class="item" @click="showProduct()">
  3. <view class="img-box">
  4. <image :src="item.image" mode="aspectFill"></image>
  5. </view>
  6. <view class="info-box">
  7. <view class="title ellipsis2">{{item.productName}}</view>
  8. <view class="price-box x-bc">
  9. <view>
  10. <text class="price-box-unit">¥</text>
  11. <text class="price-box-integer">{{splitPrice(item.price || 0).intPart}}</text>
  12. <text class="price-box-decimal">.{{splitPrice(item.price || 0).decPart}}</text>
  13. <!-- <text class="price-box-text">/日</text> -->
  14. <!-- <text class="old" v-show="item.price!=item.otPrice&&item.otPrice!==null&&item.otPrice!==undefined">¥{{item.otPrice.toFixed(2)}}</text> -->
  15. </view>
  16. </view>
  17. </view>
  18. </view>
  19. </template>
  20. <script>
  21. export default {
  22. props: ['item','storeId'],
  23. data() {
  24. return {
  25. }
  26. },
  27. methods: {
  28. splitPrice(num) {
  29. const [intPart = '0', decPart = '00'] = String(num||0).split('.');
  30. return { intPart, decPart: decPart.padEnd(2, '0').slice(0, 2) };
  31. },
  32. showProduct() {
  33. uni.navigateTo({
  34. url: '/pages_shopping/productDetails?productId=' + this.item.productId+'&storeId='+this.storeId || ''
  35. })
  36. },
  37. }
  38. }
  39. </script>
  40. <style scoped lang="scss">
  41. .price-box {
  42. font-family: Roboto, Roboto;
  43. font-weight: bold;
  44. font-size: 36rpx;
  45. color: #FF5C03;
  46. &-unit {
  47. font-weight: 600;
  48. font-size: 26rpx;
  49. }
  50. &-decimal {
  51. font-weight: 600;
  52. font-size: 26rpx;
  53. }
  54. &-text {
  55. font-family: PingFang SC, PingFang SC;
  56. font-weight: 500;
  57. font-size: 26rpx;
  58. }
  59. }
  60. .item{
  61. margin-right: 20rpx;
  62. margin-bottom: 20rpx;
  63. width: 235rpx;
  64. background: #FFFFFF;
  65. box-shadow: 0px 0px 10rpx 4rpx rgba(199, 199, 199, 0.22);
  66. border-radius: 20rpx;
  67. overflow: hidden;
  68. &:nth-child(2n) {
  69. margin-right: 0;
  70. }
  71. .img-box{
  72. width: 100%;
  73. height: 235rpx;
  74. image{
  75. width: 100%;
  76. height: 100%;
  77. }
  78. }
  79. .info-box{
  80. box-sizing: border-box;
  81. // height: 182rpx;
  82. padding: 12rpx 20rpx;
  83. display: flex;
  84. flex-direction: column;
  85. justify-content: space-between;
  86. .title{
  87. font-size: 26rpx;
  88. font-family: PingFang SC;
  89. font-weight: 500;
  90. color: #111111;
  91. line-height: 40rpx;
  92. }
  93. .price-box{
  94. display: flex;
  95. align-items: flex-end;
  96. .now{
  97. display: flex;
  98. align-items: flex-end;
  99. margin-right: 20rpx;
  100. .unit{
  101. font-size: 24rpx;
  102. font-family: PingFang SC;
  103. font-weight: 500;
  104. color: #FF6633;
  105. line-height: 1.2;
  106. margin-right: 4rpx;
  107. }
  108. .num{
  109. font-size: 36rpx;
  110. font-family: PingFang SC;
  111. font-weight: bold;
  112. color: #FF6633;
  113. line-height: 1;
  114. }
  115. }
  116. .old{
  117. font-size: 26rpx;
  118. font-family: PingFang SC;
  119. font-weight: 500;
  120. text-decoration: line-through;
  121. color: #BBBBBB;
  122. line-height: 1.1;
  123. }
  124. }
  125. }
  126. }
  127. </style>