accessoriesList.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <template>
  2. <view :class="size">
  3. <view v-for="item in list" :key="item.itemid" hover-class="navigator-hover" class="item"
  4. :class="result.includes(item.itemid) ? 'radio' : ''" @click="click(item)">
  5. <view class="left" @click.stop="previewImge(item.imageUrl)">
  6. <up-image :show-loading="true" :src="item.imageUrl" width="100%" height="100%" />
  7. </view>
  8. <view class="right">
  9. <view class="itemname">
  10. {{ item.itemname || '--' }}
  11. </view>
  12. <view class="row">
  13. 型号:{{ item.model || '--' }}
  14. </view>
  15. <view class="row">
  16. 分类:{{ item.bomfullname || '--' }}
  17. </view>
  18. <view class="row">
  19. 售价:<text class="price">{{ $Http.formatNumber(item.price) }}</text>
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script setup>
  26. import { defineProps, defineEmits } from 'vue';
  27. const emit = defineEmits(['uploadCallback'])
  28. import { getCurrentInstance } from 'vue';
  29. const { $Http } = getCurrentInstance().proxy;
  30. const props = defineProps({
  31. list: {
  32. type: Array
  33. },
  34. result: {
  35. type: Array,
  36. default: () => []
  37. },
  38. onClick: {
  39. type: Function,
  40. default: () => { }
  41. },
  42. size: {
  43. type: String,
  44. default: 'large' // small, large
  45. }
  46. });
  47. function click(item) {
  48. emit('onClick', item);
  49. }
  50. function previewImge(url) {
  51. if (!url) return;
  52. uni.previewImage({
  53. urls: [url],
  54. current: url
  55. });
  56. }
  57. </script>
  58. <style lang="scss" scoped>
  59. .item {
  60. display: flex;
  61. width: 100%;
  62. background: #FFFFFF;
  63. border-radius: 20rpx;
  64. padding: 16rpx;
  65. box-sizing: border-box;
  66. margin-top: 16rpx;
  67. .left {
  68. flex-shrink: 0;
  69. width: 148rpx;
  70. height: 148rpx;
  71. background: #FFFFFF;
  72. border-radius: 8rpx;
  73. border: 2rpx solid #707070;
  74. margin-right: 16rpx;
  75. overflow: hidden;
  76. }
  77. .right {
  78. right: 1;
  79. .itemname {
  80. line-height: 34rpx;
  81. font-family: PingFang SC, PingFang SC;
  82. font-weight: bold;
  83. font-size: 24rpx;
  84. color: #333333;
  85. }
  86. .row {
  87. line-height: 28rpx;
  88. font-family: PingFang SC, PingFang SC;
  89. font-size: 20rpx;
  90. color: #999999;
  91. .price {
  92. color: #FA5151;
  93. }
  94. }
  95. }
  96. }
  97. .large {
  98. width: 690rpx;
  99. margin: 0 auto;
  100. .item {
  101. padding: 20rpx;
  102. margin-top: 20rpx;
  103. .left {
  104. width: 180rpx;
  105. height: 180rpx;
  106. background: #FFFFFF;
  107. margin-right: 20rpx;
  108. }
  109. .right {
  110. .itemname {
  111. line-height: 38rpx;
  112. font-size: 34rpx;
  113. }
  114. .row {
  115. font-size: 28rpx;
  116. margin-top: 12rpx;
  117. }
  118. }
  119. }
  120. }
  121. .radio {
  122. background: #3774F6;
  123. .right {
  124. right: 1;
  125. .itemname {
  126. color: #fff;
  127. }
  128. .row {
  129. color: #fff;
  130. .price {
  131. color: #fff;
  132. }
  133. }
  134. }
  135. }
  136. .item:first-child {
  137. margin-top: 0;
  138. }
  139. </style>