medicineItem.vue 4.9 KB

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