medicineItem.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <template>
  2. <view :class="type=='store'?'medicine-storeitem':'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="myotctxt" v-show="item.productType" :style="{background:_background(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.prescribeSpec || '--' }}</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" v-if="type!='store'"><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','type','storeId'],
  36. data() {
  37. return {
  38. }
  39. },
  40. computed: {
  41. _background() {
  42. //productType: 1:OTC,2:Rx,3:非药品,4:器械
  43. return (productType)=> {
  44. switch (productType) {
  45. case 1: return '#37E2EA' // OTC
  46. case 2: return 'red' // Rx
  47. case 3: return '#2583EB' // 非药品
  48. case 4: return '#999' // 器械
  49. default: return '#ccc'
  50. }
  51. }
  52. }
  53. },
  54. methods: {
  55. splitPrice(num) {
  56. const [intPart = '0', decPart = '00'] = String(num||0).split('.');
  57. return { intPart, decPart: decPart.padEnd(2, '0').slice(0, 2) };
  58. },
  59. showProduct() {
  60. uni.navigateTo({
  61. url: '/pages_shopping/productDetails?productId=' + this.item.productId+'&storeId='+this.storeId || ''
  62. })
  63. },
  64. }
  65. }
  66. </script>
  67. <style scoped lang="scss">
  68. .myotctxt {
  69. background-color: #37E2EA;
  70. font-family: PingFang SC, PingFang SC;
  71. font-weight: 500;
  72. font-size: 24rpx;
  73. color: #FFFFFF;
  74. padding: 4rpx 14rpx;
  75. border-radius: 6rpx;
  76. }
  77. .pro-name {
  78. flex: 1;
  79. font-family: PingFang SC, PingFang SC;
  80. font-weight: 500;
  81. font-size: 32rpx;
  82. color: #191A1B;
  83. flex: 1;
  84. overflow: hidden;
  85. }
  86. .old{
  87. margin-left: 14rpx;
  88. font-size: 26upx;
  89. font-family: PingFang SC;
  90. font-weight: 500;
  91. text-decoration: line-through;
  92. color: #BBBBBB;
  93. line-height: 1.1;
  94. }
  95. .price-box {
  96. font-family: Roboto, Roboto;
  97. font-weight: bold;
  98. font-size: 36rpx;
  99. color: #FF5C03;
  100. margin-top: 22rpx;
  101. &-unit {
  102. font-weight: 600;
  103. font-size: 26rpx;
  104. }
  105. &-decimal {
  106. font-weight: 600;
  107. font-size: 26rpx;
  108. }
  109. &-text {
  110. font-family: PingFang SC, PingFang SC;
  111. font-weight: 500;
  112. font-size: 26rpx;
  113. }
  114. }
  115. .medicine {
  116. width: 200rpx;
  117. height: 200rpx;
  118. flex-shrink: 0;
  119. border-radius: 16rpx 16rpx 16rpx 16rpx;
  120. overflow: hidden;
  121. position: relative;
  122. margin-right: 24rpx;
  123. .otc {
  124. position: absolute;
  125. top: 0;
  126. left: 0;
  127. width: 96rpx;
  128. height: 40rpx;
  129. border-radius: 0;
  130. }
  131. image {
  132. width: 100%;
  133. height: 100%;
  134. border-radius: 16rpx 16rpx 16rpx 16rpx;
  135. }
  136. &-r {
  137. font-family: PingFang SC, PingFang SC;
  138. font-weight: 500;
  139. font-size: 32rpx;
  140. color: #191A1B;
  141. flex: 1;
  142. overflow: hidden;
  143. }
  144. &-item {
  145. align-items: flex-start !important;
  146. padding: 20rpx 0;
  147. }
  148. &-storeitem {
  149. align-items: flex-start !important;
  150. background: #FFF;
  151. padding: 20rpx;
  152. border-radius: 16upx;
  153. margin-bottom: 20upx;
  154. }
  155. }
  156. .desc {
  157. display: block;
  158. margin-top: 12rpx;
  159. font-family: PingFang SC, PingFang SC;
  160. font-weight: 400;
  161. font-size: 24rpx;
  162. color: #939599;
  163. }
  164. </style>