goodsInformation.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. <template>
  2. <view class="detail" @click="$emit('toDetail', itemInfo)" :style="isPadding">
  3. <view class="content">
  4. <image :src="itemInfo.goods.image" mode="" class="content-img"></image>
  5. <view class="mask" v-if="!downOrGrounding">
  6. <view class="text-1"> 已下架 </view>
  7. </view>
  8. <view class="content-right">
  9. <view class="goods-title">
  10. <view class="_label" v-if="itemInfo.goods.source == 2"> 供应商 </view>
  11. <view
  12. class="_label"
  13. style="background-color: #f83224"
  14. v-if="itemInfo.goods.source == 1"
  15. >
  16. 自营
  17. </view>
  18. <view class="_label" v-if="itemInfo.goods.source == 0"> 团长 </view>
  19. <view class="title" v-if="productAndCommodity == 'product'">
  20. {{ itemInfo.name_cn }}
  21. </view>
  22. <view class="title" v-else>{{ itemInfo.goods.name_cn }}</view>
  23. </view>
  24. <view class="inventory" v-if="productAndCommodity">
  25. <text>库存:</text>
  26. <text>{{ itemInfo.goods.stock }}</text>
  27. </view>
  28. <view class="inventory" v-else>
  29. <text>{{ itemInfo.labels.join(" | ") }} </text>
  30. </view>
  31. <view class="price">
  32. <view class="commodity-price">
  33. <text style="font-size: 20rpx">¥</text>
  34. <text>{{ itemInfo.goods.discount_price.split(".")[0] }}</text
  35. >.
  36. <text style="font-size: 20rpx">{{
  37. itemInfo.goods.discount_price.split(".")[1]
  38. }}</text>
  39. </view>
  40. <view
  41. class="discount_price"
  42. v-if="itemInfo.goods.price != itemInfo.goods.discount_price"
  43. >
  44. ¥{{ itemInfo.goods.price }}</view
  45. >
  46. </view>
  47. </view>
  48. </view>
  49. <view class="btn-list" v-if="!batch && productAndCommodity == 'commodity'">
  50. <button
  51. class="btn-1"
  52. v-if="downOrGrounding"
  53. @click.stop="$emit('openDiscountsPopup', itemInfo)"
  54. >
  55. 我要打折
  56. </button>
  57. <button
  58. class="btn-1"
  59. v-if="downOrGrounding"
  60. @click.stop="$emit('addAndRemove', itemInfo, 'down')"
  61. >
  62. 下架
  63. </button>
  64. <button
  65. class="btn-1"
  66. v-if="!downOrGrounding"
  67. @click.stop="$emit('deleteGoods', itemInfo)"
  68. >
  69. 删除
  70. </button>
  71. <button
  72. class="btn-1"
  73. v-if="!downOrGrounding"
  74. @click.stop="$emit('addAndRemove', itemInfo, 'normal')"
  75. >
  76. 上架
  77. </button>
  78. <!-- <button class="btn-2" v-if="itemInfo.goods.status == 'down'">编辑</button> -->
  79. </view>
  80. </view>
  81. </template>
  82. <script>
  83. export default {
  84. props: {
  85. status: {
  86. typeof: String,
  87. default: "",
  88. },
  89. itemInfo: {
  90. typeof: Object,
  91. default: () => {
  92. return {};
  93. },
  94. },
  95. productAndCommodity: {
  96. typeof: String,
  97. default: "",
  98. },
  99. batch: {
  100. typeof: Boolean,
  101. default: false,
  102. },
  103. },
  104. watch: {},
  105. computed: {},
  106. data() {
  107. return {
  108. obj: {
  109. url: "https://img11.360buyimg.com/jdcms/s460x460_jfs/t1/136953/20/42322/162799/665e6a6cF32604c1e/b9586c7ae52dc284.jpg.avif",
  110. title: "La Chapelle Sport拉夏贝尔高…",
  111. price: "75.00",
  112. },
  113. lebelList: [],
  114. };
  115. },
  116. computed: {
  117. isPadding() {
  118. if (this.productAndCommodity == "product") {
  119. return "padding: 28rpx 20rpx 20rpx;";
  120. }
  121. },
  122. downOrGrounding() {
  123. if (this.itemInfo.goods.status == "down") {
  124. return false;
  125. } else {
  126. if (this.itemInfo.status == "down") {
  127. return false;
  128. } else {
  129. return true;
  130. }
  131. }
  132. },
  133. },
  134. };
  135. </script>
  136. <style lang="scss" scoped>
  137. .detail {
  138. background-color: #fff;
  139. border-radius: 16rpx;
  140. margin: 10rpx 0;
  141. width: 94vw;
  142. .content {
  143. display: flex;
  144. position: relative;
  145. flex-shrink: 0;
  146. justify-content: flex-start;
  147. width: 100%;
  148. .content-img {
  149. width: 164rpx;
  150. height: 164rpx;
  151. border-radius: 12rpx;
  152. margin-right: 20rpx;
  153. flex-shrink: 0;
  154. }
  155. .mask {
  156. width: 164rpx;
  157. height: 164rpx;
  158. border-radius: 12rpx;
  159. position: absolute;
  160. background-color: rgba(255, 255, 255, 0.3);
  161. z-index: 100;
  162. display: flex;
  163. justify-content: center;
  164. align-items: center;
  165. .text-1 {
  166. width: 108rpx;
  167. height: 44rpx;
  168. text-align: center;
  169. line-height: 44rpx;
  170. color: #fff;
  171. background-color: rgba(0, 0, 0, 0.4);
  172. border-radius: 22rpx;
  173. font-size: 20rpx;
  174. }
  175. }
  176. .content-right {
  177. width: 80%;
  178. .goods-title {
  179. color: #333;
  180. margin-bottom: 20rpx;
  181. width: 88%;
  182. overflow: hidden;
  183. text-overflow: ellipsis;
  184. white-space: nowrap;
  185. word-break: break-word;
  186. display: flex;
  187. justify-content: flex-start;
  188. align-items: center;
  189. .title {
  190. width: 75%;
  191. overflow: hidden;
  192. text-overflow: ellipsis;
  193. white-space: nowrap;
  194. word-break: break-word;
  195. }
  196. ._label {
  197. color: #fff;
  198. background-color: #ffb111;
  199. width: 72rpx;
  200. height: 32rpx;
  201. text-align: center;
  202. line-height: 32rpx;
  203. height: 32rpx;
  204. border-radius: 4rpx;
  205. font-size: 20rpx;
  206. margin-right: 10rpx;
  207. }
  208. }
  209. .inventory {
  210. color: rgba(54, 54, 54, 0.5);
  211. font-size: 24rpx;
  212. margin-bottom: 30rpx;
  213. }
  214. .commodity-price {
  215. color: #f83224;
  216. font-size: 32rpx;
  217. font-weight: 600;
  218. }
  219. .price {
  220. display: flex;
  221. align-items: flex-end;
  222. .discount_price {
  223. margin-left: 20rpx;
  224. font-size: 26rpx;
  225. color: rgba(51, 51, 51, 0.5);
  226. text-decoration-line: line-through;
  227. }
  228. }
  229. }
  230. }
  231. .btn-list {
  232. display: flex;
  233. justify-content: flex-end;
  234. .btn-1 {
  235. height: 60rpx;
  236. margin: 0;
  237. padding: 0;
  238. font-size: 26rpx;
  239. color: #333;
  240. border: 2rpx solid rgba(151, 151, 151, 0.3);
  241. border-radius: 30rpx;
  242. background-color: #fff;
  243. line-height: 60rpx;
  244. margin-left: 20rpx;
  245. padding: 0 30rpx;
  246. }
  247. .btn-2 {
  248. height: 60rpx;
  249. margin: 0;
  250. padding: 0;
  251. font-size: 26rpx;
  252. color: #f83224;
  253. border: 2rpx solid #f83224;
  254. border-radius: 30rpx;
  255. background-color: #fff;
  256. margin-left: 20rpx;
  257. line-height: 60rpx;
  258. padding: 0 30rpx;
  259. }
  260. }
  261. }
  262. </style>