goodsInformation.vue 6.8 KB

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