tuiProduct.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <template>
  2. <view class="medicine-box box">
  3. <view class="title-box">
  4. <view class="title">推荐药品</view>
  5. <view class="more" @click="navTo('/pages_shopping/home/productList')">
  6. <view class="text">更多药品</view>
  7. <image src="https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/shop/image/arrow_gray.png"></image>
  8. </view>
  9. </view>
  10. <view class="medicine-item x-f" v-for="(item, index) in list" :key="index" @click="showProduct(item)">
  11. <view class="medicine">
  12. <image :src="item.image" mode="aspectFill"></image>
  13. <!-- {{$getDictLabelName("storeProductType",product.productType)}} -->
  14. <!-- <image class="otc" src="https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/app/newImages/index/blue_lable_otc.svg" mode="aspectFill"></image> -->
  15. </view>
  16. <view class="medicine-r">
  17. <view class="ellipsis" style="white-space: normal;">{{ item.productName || '' }}</view>
  18. <view class="desc">包装规格:{{ item.unitName || '--' }}</view>
  19. <view class="desc" v-show="item.storecount">共有 <text style="color: #2583EB;margin: 0 10rpx;">{{item.storecount||0}}</text> 个商家销售 </view>
  20. <view class="price-box">
  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>
  28. </view>
  29. <Loading :loaded="loaded" :loading="loading"></Loading>
  30. </view>
  31. </template>
  32. <script>
  33. import {getTuiProducts} from '@/api/index.js'
  34. import Loading from "@/components/Loading";
  35. export default {
  36. components: {
  37. Loading
  38. },
  39. name: "likeProduct",
  40. data() {
  41. return {
  42. page: {
  43. page: 1,
  44. pageSize: 10
  45. },
  46. total: 0,
  47. list: [],
  48. loaded: false,
  49. loading: false
  50. };
  51. },
  52. created() {},
  53. mounted() {
  54. this.getTuiProducts();
  55. },
  56. methods: {
  57. splitPrice(num) {
  58. const [intPart = '0', decPart = '00'] = String(num||0).split('.');
  59. return { intPart, decPart: decPart.padEnd(2, '0').slice(0, 2) };
  60. },
  61. getTuiProducts() {
  62. var that = this;
  63. if (that.loaded == true || that.loading == true) return;
  64. that.loading = true;
  65. getTuiProducts(that.page).then(
  66. res => {
  67. if (res.code == 200) {
  68. that.total = res.data.total;
  69. that.list.push.apply(that.list, res.data.list);
  70. that.loading = false;
  71. that.loaded = that.list.length < that.total ? false : true;
  72. that.page.page = that.page.page + 1;
  73. uni.hideLoading()
  74. }
  75. },
  76. err => {
  77. uni.hideLoading()
  78. uni.showToast({
  79. title: err.msg,
  80. icon: 'none',
  81. duration: 2000
  82. });
  83. }
  84. )
  85. },
  86. showProduct(item) {
  87. uni.navigateTo({
  88. url: '/pages_shopping/productDetails?productId=' + item.productId
  89. })
  90. },
  91. navTo(url){
  92. uni.navigateTo({
  93. url: url
  94. })
  95. },
  96. }
  97. };
  98. </script>
  99. <style lang="scss" scoped>
  100. .old{
  101. margin-left: 14rpx;
  102. font-size: 26upx;
  103. font-family: PingFang SC;
  104. font-weight: 500;
  105. text-decoration: line-through;
  106. color: #BBBBBB;
  107. line-height: 1.1;
  108. }
  109. .box {
  110. background: #FFFFFF;
  111. border-radius: 16rpx 16rpx 16rpx 16rpx;
  112. margin: 24rpx;
  113. box-sizing: border-box;
  114. .title-box {
  115. display: flex;
  116. flex-direction: row;
  117. align-items: center;
  118. justify-content: space-between;
  119. padding: 28rpx 0;
  120. box-sizing: border-box;
  121. .title {
  122. font-size: 32upx;
  123. font-family: PingFang SC;
  124. font-weight: bold;
  125. color: #111111;
  126. }
  127. .more {
  128. display: flex;
  129. align-items: center;
  130. justify-content: flex-end;
  131. .text {
  132. font-size: 24rpx;
  133. font-family: PingFang SC;
  134. color: #9B9B9B;
  135. }
  136. image {
  137. margin-left: 10rpx;
  138. width: 15rpx;
  139. height: 20rpx;
  140. }
  141. }
  142. }
  143. .price-box {
  144. font-family: Roboto, Roboto;
  145. font-weight: bold;
  146. font-size: 36rpx;
  147. color: #FF5C03;
  148. margin-top: 22rpx;
  149. &-unit {
  150. font-weight: 600;
  151. font-size: 26rpx;
  152. }
  153. &-decimal {
  154. font-weight: 600;
  155. font-size: 26rpx;
  156. }
  157. &-text {
  158. font-family: PingFang SC, PingFang SC;
  159. font-weight: 500;
  160. font-size: 26rpx;
  161. }
  162. }
  163. }
  164. .medicine-box {
  165. padding: 0 24rpx 32rpx 24rpx;
  166. .medicine {
  167. width: 200rpx;
  168. height: 200rpx;
  169. flex-shrink: 0;
  170. border-radius: 16rpx 16rpx 16rpx 16rpx;
  171. overflow: hidden;
  172. position: relative;
  173. margin-right: 24rpx;
  174. .otc {
  175. position: absolute;
  176. top: 0;
  177. left: 0;
  178. width: 96rpx;
  179. height: 40rpx;
  180. border-radius: 0;
  181. }
  182. image {
  183. width: 100%;
  184. height: 100%;
  185. border-radius: 16rpx 16rpx 16rpx 16rpx;
  186. }
  187. &-r {
  188. font-family: PingFang SC, PingFang SC;
  189. font-weight: 500;
  190. font-size: 32rpx;
  191. color: #191A1B;
  192. flex: 1;
  193. overflow: hidden;
  194. }
  195. &-item {
  196. align-items: flex-start !important;
  197. margin-bottom: 40rpx;
  198. &:last-child {
  199. margin-bottom: 0;
  200. }
  201. }
  202. }
  203. .desc {
  204. margin-top: 12rpx;
  205. font-family: PingFang SC, PingFang SC;
  206. font-weight: 400;
  207. font-size: 24rpx;
  208. color: #939599;
  209. }
  210. }
  211. </style>