goodItem.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <template>
  2. <view class="good-row">
  3. <view class="good-check" v-if="manageType">
  4. <view class="iconfont" :class="goodData.check ? 'iconqueding' : 'iconfeigouxuan'" @click="checkGood()"></view>
  5. </view>
  6. <view class="good-card" :style="{width: manageType ? 'calc(100% - 60px)' : ''}" @click="goToGoodDetail()">
  7. <image class="goods-img" mode="aspectFill" :src="goodData.imgPath"></image>
  8. <view class="good-info">
  9. <view class="good-type">{{goodData.productType == 1 ? '普通商品' : (goodData.productType == 2 ? '拍卖商品' : '自助采摘')}}</view>
  10. <view class="good-name">{{goodData.productName}}</view>
  11. <view class="good-price">
  12. <text class="goods-spec">¥{{goodData.productType == 2 ? goodData.auctionStartPrice : goodData.bizPrice}}/{{goodData.unit}}</text>
  13. <text class="goods-original">原价:{{goodData.originalPrice}}</text>
  14. </view>
  15. <view class="good-text">库存:{{goodData.stock}}&nbsp;&nbsp;&nbsp;&nbsp;销量:{{goodData.sellCount}}</view>
  16. <view class="good-text">上架时间:{{goodData.onShelfTime}}</view>
  17. </view>
  18. </view>
  19. <u-top-tips ref="uTips"></u-top-tips>
  20. </view>
  21. </template>
  22. <script>
  23. const NET = require('@/utils/request')
  24. const API = require('@/config/api')
  25. export default {
  26. props: {
  27. manageType: {
  28. default: false
  29. },
  30. check: {
  31. default: false
  32. },
  33. goodData: {
  34. default: {
  35. id: '',
  36. imgPath: '',
  37. productName: '',
  38. productType: 0,
  39. bizPrice: 0,
  40. unit: '',
  41. originalPrice: 0,
  42. stock: 0,
  43. sellCount: 0,
  44. onShelfTime: '',
  45. check: false,
  46. }
  47. },
  48. },
  49. data() {
  50. return {}
  51. },
  52. onLoad() {},
  53. methods: {
  54. // 勾选商品
  55. checkGood() {
  56. this.$emit('update:check', !this.check)
  57. },
  58. // 商品详情
  59. goToGoodDetail() {
  60. uni.navigateTo({
  61. url: '/pagesGood/goodForm?type=detail&formType=' + this.goodData.productType + '&goodId=' + this.goodData.id
  62. });
  63. },
  64. }
  65. }
  66. </script>
  67. <style lang="less" scoped>
  68. .good-row {
  69. width: 100%;
  70. float: left;
  71. .good-check {
  72. width: 30px;
  73. height: 104px;
  74. float: left;
  75. line-height: 104px;
  76. .iconfont {
  77. font-size: 40px;
  78. text-align: right;
  79. color: #51A539;
  80. }
  81. }
  82. .good-card {
  83. width: calc(100% - 30px);
  84. float: left;
  85. margin: 0 15px 10px 15px;
  86. background: #FFFFFF;
  87. border-radius: 15px;
  88. box-shadow: 0px 1px 5px 0px rgba(102, 102, 102, 0.43);
  89. padding: 12px;
  90. box-sizing: border-box;
  91. .goods-img {
  92. width: 80px;
  93. height: 80px;
  94. float: left;
  95. border-radius: 10px;
  96. object-fit: cover;
  97. }
  98. .good-info {
  99. width: calc(100% - 86px);
  100. height: 80px;
  101. float: right;
  102. .good-type {
  103. width: 70px;
  104. height: 20px;
  105. float: left;
  106. margin-right: 6px;
  107. background: #56B03D;
  108. border-radius: 4px;
  109. font-size: 12px;
  110. font-family: PingFang SC;
  111. color: #FFFFFF;
  112. line-height: 20px;
  113. text-align: center;
  114. }
  115. .good-name {
  116. width: calc(100% - 76px);
  117. height: 20px;
  118. float: left;
  119. font-size: 15px;
  120. font-family: PingFang SC;
  121. color: #333333;
  122. line-height: 20px;
  123. overflow: hidden;
  124. white-space: nowrap;
  125. text-overflow: ellipsis;
  126. }
  127. }
  128. .good-price {
  129. width: 100%;
  130. height: 20px;
  131. float: left;
  132. line-height: 20px;
  133. font-family: PingFang SC;
  134. white-space: nowrap;
  135. margin: 3px 0 3px 0;
  136. .goods-spec {
  137. font-size: 15px;
  138. color: #52A63A;
  139. margin-right: 6px;
  140. }
  141. .goods-original {
  142. font-size: 12px;
  143. text-decoration: line-through;
  144. color: #A67954;
  145. }
  146. }
  147. .good-text {
  148. width: 100%;
  149. height: 16px;
  150. float: left;
  151. font-size: 12px;
  152. font-family: PingFang SC;
  153. color: #999999;
  154. line-height: 16px;
  155. }
  156. }
  157. }
  158. .good-row:first-child {
  159. margin-top: 10px;
  160. }
  161. </style>