medicineItem.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <view class="medicine-item" @click="showProduct">
  3. <view class="x-bc" style="margin-bottom: 16rpx;">
  4. <view class="pro-name ellipsis" style="white-space: normal;">{{ item.productName || '' }}</view>
  5. <view class="otctxt" v-show="item.productType">{{$getDictLabelName("storeProductType",item.productType)}}</view>
  6. </view>
  7. <view class="x-f">
  8. <view class="medicine">
  9. <image :src="item.image" mode="aspectFill"></image>
  10. <!-- {{$getDictLabelName("storeProductType",item.productType)}} -->
  11. <!-- <view class="otc">处方药</view> -->
  12. <!-- <image class="otc" src="https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/app/newImages/index/blue_lable_otc.svg" mode="aspectFill"></image> -->
  13. </view>
  14. <view class="medicine-r">
  15. <view class="desc ellipsis">包装规格:{{ item.unitName || '--' }}</view>
  16. <view class="desc ellipsis">批准文号:{{ item.batchNumber || '--' }}</view>
  17. <view class="desc ellipsis">生产厂家:{{ item.mah || '--' }}</view>
  18. <!-- <view class="desc"><text style="color: #2583EB;margin: 0 10rpx;">{{item.storecount||0}}</text> 商家销售 </view> -->
  19. <view class="price-box x-bc">
  20. <view>
  21. <text class="price-box-unit">¥</text>
  22. <text class="price-box-integer">{{splitPrice(item.price || 0).intPart}}</text>
  23. <text class="price-box-decimal">.{{splitPrice(item.price || 0).decPart}}</text>
  24. <!-- <text class="price-box-text">/日</text> -->
  25. <!-- <text class="old" v-show="item.price!=item.otPrice&&item.otPrice!==null&&item.otPrice!==undefined">¥{{item.otPrice.toFixed(2)}}</text> -->
  26. </view>
  27. <view class="desc"><text style="color: #2583EB;margin: 0 10rpx;">{{item.storecount||0}}</text> 商家销售 </view>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. export default {
  35. props: ['item'],
  36. data() {
  37. return {
  38. }
  39. },
  40. methods: {
  41. splitPrice(num) {
  42. const [intPart = '0', decPart = '00'] = String(num||0).split('.');
  43. return { intPart, decPart: decPart.padEnd(2, '0').slice(0, 2) };
  44. },
  45. showProduct() {
  46. uni.navigateTo({
  47. url: '/pages_shopping/productDetails?productId=' + this.item.productId
  48. })
  49. },
  50. }
  51. }
  52. </script>
  53. <style scoped lang="scss">
  54. .otctxt {
  55. background-color: #2BC7B9;
  56. font-family: PingFang SC, PingFang SC;
  57. font-weight: 500;
  58. font-size: 24rpx;
  59. color: #FFFFFF;
  60. padding: 4rpx 14rpx;
  61. border-radius: 6rpx;
  62. }
  63. .pro-name {
  64. flex: 1;
  65. font-family: PingFang SC, PingFang SC;
  66. font-weight: 500;
  67. font-size: 32rpx;
  68. color: #191A1B;
  69. flex: 1;
  70. overflow: hidden;
  71. }
  72. .old{
  73. margin-left: 14rpx;
  74. font-size: 26upx;
  75. font-family: PingFang SC;
  76. font-weight: 500;
  77. text-decoration: line-through;
  78. color: #BBBBBB;
  79. line-height: 1.1;
  80. }
  81. .price-box {
  82. font-family: Roboto, Roboto;
  83. font-weight: bold;
  84. font-size: 36rpx;
  85. color: #FF5C03;
  86. margin-top: 22rpx;
  87. &-unit {
  88. font-weight: 600;
  89. font-size: 26rpx;
  90. }
  91. &-decimal {
  92. font-weight: 600;
  93. font-size: 26rpx;
  94. }
  95. &-text {
  96. font-family: PingFang SC, PingFang SC;
  97. font-weight: 500;
  98. font-size: 26rpx;
  99. }
  100. }
  101. .medicine {
  102. width: 200rpx;
  103. height: 200rpx;
  104. flex-shrink: 0;
  105. border-radius: 16rpx 16rpx 16rpx 16rpx;
  106. overflow: hidden;
  107. position: relative;
  108. margin-right: 24rpx;
  109. .otc {
  110. position: absolute;
  111. top: 0;
  112. left: 0;
  113. width: 96rpx;
  114. height: 40rpx;
  115. border-radius: 0;
  116. }
  117. image {
  118. width: 100%;
  119. height: 100%;
  120. border-radius: 16rpx 16rpx 16rpx 16rpx;
  121. }
  122. &-r {
  123. font-family: PingFang SC, PingFang SC;
  124. font-weight: 500;
  125. font-size: 32rpx;
  126. color: #191A1B;
  127. flex: 1;
  128. overflow: hidden;
  129. }
  130. &-item {
  131. align-items: flex-start !important;
  132. padding: 20rpx 0;
  133. }
  134. }
  135. .desc {
  136. display: block;
  137. margin-top: 12rpx;
  138. font-family: PingFang SC, PingFang SC;
  139. font-weight: 400;
  140. font-size: 24rpx;
  141. color: #939599;
  142. }
  143. </style>