accessoriesList.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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">{{ 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. const props = defineProps({
  29. list: {
  30. type: Array
  31. },
  32. result: {
  33. type: Array,
  34. default: () => []
  35. },
  36. onClick: {
  37. type: Function,
  38. default: () => { }
  39. },
  40. size: {
  41. type: String,
  42. default: 'large' // small, large
  43. }
  44. });
  45. function click(item) {
  46. emit('onClick', item);
  47. }
  48. function previewImge(url) {
  49. if (!url) return;
  50. uni.previewImage({
  51. urls: [url],
  52. current: url
  53. });
  54. }
  55. </script>
  56. <style lang="scss" scoped>
  57. .item {
  58. display: flex;
  59. width: 100%;
  60. background: #FFFFFF;
  61. border-radius: 20rpx;
  62. padding: 16rpx;
  63. box-sizing: border-box;
  64. margin-top: 16rpx;
  65. .left {
  66. flex-shrink: 0;
  67. width: 148rpx;
  68. height: 148rpx;
  69. background: #FFFFFF;
  70. border-radius: 8rpx;
  71. border: 2rpx solid #707070;
  72. margin-right: 16rpx;
  73. overflow: hidden;
  74. }
  75. .right {
  76. right: 1;
  77. .itemname {
  78. line-height: 34rpx;
  79. font-family: PingFang SC, PingFang SC;
  80. font-weight: bold;
  81. font-size: 24rpx;
  82. color: #333333;
  83. }
  84. .row {
  85. line-height: 28rpx;
  86. font-family: PingFang SC, PingFang SC;
  87. font-size: 20rpx;
  88. color: #999999;
  89. .price {
  90. color: #FA5151;
  91. }
  92. }
  93. }
  94. }
  95. .large {
  96. width: 690rpx;
  97. margin: 0 auto;
  98. .item {
  99. padding: 20rpx;
  100. margin-top: 20rpx;
  101. .left {
  102. width: 180rpx;
  103. height: 180rpx;
  104. background: #FFFFFF;
  105. margin-right: 20rpx;
  106. }
  107. .right {
  108. .itemname {
  109. line-height: 38rpx;
  110. font-size: 34rpx;
  111. }
  112. .row {
  113. font-size: 28rpx;
  114. margin-top: 12rpx;
  115. }
  116. }
  117. }
  118. }
  119. .radio {
  120. background: #3774F6;
  121. .right {
  122. right: 1;
  123. .itemname {
  124. color: #fff;
  125. }
  126. .row {
  127. color: #fff;
  128. .price {
  129. color: #fff;
  130. }
  131. }
  132. }
  133. }
  134. .item:first-child {
  135. margin-top: 0;
  136. }
  137. </style>