procurement_good.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <template>
  2. <view class="pro-good" @click.stop="handleJumpLink">
  3. <view class="img">
  4. <image :src="storeInfo.mainImage" mode="aspectFill" style="width: 100%;height: 100%;"></image>
  5. </view>
  6. <view class="pro-content">
  7. <view class="pro-title">
  8. {{storeInfo.name | sliceText(20)}}
  9. </view>
  10. <view class="pro-price" v-if='hasLogin'>
  11. ¥{{storeInfo.price}}
  12. </view>
  13. <view class="product-price-none" v-else>
  14. <uni-grader :grade="Number(storeInfo.priceGrade)"></uni-grader>
  15. </view>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. import { mapState } from 'vuex'
  21. import uniGrader from '@/components/uni-grade/uni-grade.vue'
  22. export default {
  23. props: {
  24. storeInfo: {
  25. type: Object,
  26. default: () => {}
  27. }
  28. },
  29. components: {
  30. uniGrader
  31. },
  32. filters: {
  33. // 字符过滤
  34. sliceText(text, num) {
  35. if (text && text.length > num) {
  36. let value = text.substring(0, num)
  37. return value + '...'
  38. }
  39. return text
  40. }
  41. },
  42. computed: {
  43. ...mapState(['hasLogin'])
  44. },
  45. data() {
  46. return {
  47. }
  48. },
  49. methods: {
  50. handleJumpLink() {
  51. this.$api.navigateTo(`/pages/goods/product?id=${this.storeInfo.productId}`)
  52. },
  53. }
  54. }
  55. </script>
  56. <style scoped lang="scss">
  57. .pro-good {
  58. width: 339rpx;
  59. height: 518rpx;
  60. border-radius: 8rpx;
  61. background-color: #fff;
  62. overflow: hidden;
  63. margin-bottom: 24rpx;
  64. }
  65. .img {
  66. width: 339rpx;
  67. height: 339rpx;
  68. // border: 1px dotted;
  69. box-sizing: border-box;
  70. }
  71. .pro-content {
  72. padding: 14rpx 24rpx 20rpx 24rpx;
  73. display: flex;
  74. justify-content: space-between;
  75. align-items: center;
  76. flex-direction: column;
  77. height: 179rpx;
  78. box-sizing: border-box;
  79. background-color: #fff;
  80. }
  81. .pro-title {
  82. color: #333333;
  83. font-size: 28rpx;
  84. width: 100%;
  85. }
  86. .pro-price {
  87. width: 100%;
  88. color: #F85050;
  89. font-size: 28rpx;
  90. }
  91. .product-price-none {
  92. width: 100%;
  93. color: #f8c499;
  94. float: left;
  95. line-height: 54rpx;
  96. margin-top: 16rpx;
  97. .p-no {
  98. float: left;
  99. font-size: $font-size-24;
  100. color: $text-color;
  101. }
  102. }
  103. </style>