GoodsItem.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440
  1. <template>
  2. <view :class="[isList ? 'list-box' : 'list-box-two']" :style="{ display: isList ? 'block' : 'inline-block' }" @click="goPage(`/pagesT/product/product?id=${item.id}`)">
  3. <!-- 单列 -->
  4. <view class="goods_item_justify clearfix" v-if="isList">
  5. <view class="imgStyle float_left">
  6. <block v-if="item.isDistribution === 4">
  7. <view :style="{ height: item.minMemberPrice > 0 ? '206rpx' : '176rpx' }" v-if="!(item.inventorTotal - 0) || item.inventorTotal - 0 <= 0" class="sale-end">
  8. <text class="ibonfont ibonbuhuozhong"></text>
  9. </view>
  10. </block>
  11. <view v-if="item.brandName" class="brand-name primary-lg">{{ item.brandName }}</view>
  12. <image :style="{ height: item.minMemberPrice > 0 ? '206rpx' : '176rpx' }" mode="aspectFill" :src="item.images[0]"></image>
  13. </view>
  14. <view class="float_right goods-info">
  15. <view class="title ellipsis">{{ item.title }}</view>
  16. <view class="unit clearfix">
  17. <!-- <text class="float_right"
  18. v-if="item.showMinUnitPrice === 5 && item.minMinUnitPrice !== '0.00'">1斤={{ Number(item.minMinUnitPrice) }}元</text> -->
  19. 已售
  20. <text v-if="baseSet.isSalesNum === 5" style="color: #333333;font-size: 24rpx;margin-left: 10rpx;">{{ item.realSalesNum }}</text>
  21. </view>
  22. <!-- <view class="unit" v-if="baseSet.isSalesNum === 5" style="font-size: 26rpx;color: #000000;">已售:{{ item.realSalesNum }}</view> -->
  23. <view class="price clearfix primary-color">
  24. <view class="float_left" v-if="!showGoodsPrice">
  25. <view>
  26. <text class="rmb-icon" v-if="item.showMinUnitPrice !== 5">¥</text>
  27. <view style="display: inline-block;" v-if="item.isEq === 4">
  28. <view style="display: inline-block;" v-if="item.showMinUnitPrice === 5">
  29. <view class="float_left rmb-icon" style="margin-top: 14rpx;">¥</view>
  30. <rich-text class="float_left" :nodes="$_utils.splitPrice(item.minMinUnitPrice)"></rich-text>
  31. <view class="float_left">-</view>
  32. <rich-text class="float_left" :nodes="$_utils.splitPrice(item.maxMinUnitPrice)"></rich-text>
  33. <view class="float_left" style="font-size: 20rpx;margin-top: 14rpx;">/斤</view>
  34. </view>
  35. <rich-text v-else :nodes="$_utils.splitPrice(item.minSalePrice)"></rich-text>
  36. </view>
  37. <view style="display: inline-block;" v-else>
  38. <view style="display: inline-block;" v-if="item.showMinUnitPrice === 5">
  39. <view class="float_left rmb-icon" style="margin-top: 14rpx;">¥</view>
  40. <rich-text class="float_left" :nodes="$_utils.splitPrice(item.maxMinUnitPrice)"></rich-text>
  41. <view class="float_left" style="font-size: 20rpx;margin-top: 14rpx;">/斤</view>
  42. </view>
  43. <rich-text v-else :nodes="$_utils.splitPrice(item.maxSalePrice)"></rich-text>
  44. </view>
  45. <!-- <text class="market-price">¥{{ item.maxMarketPrice }}</text> -->
  46. </view>
  47. <view class="vip-price clearfix" v-if="item.minMemberPrice > 0">
  48. <view class="price-text" v-if="item.isEq === 4">¥{{ item.minMemberPrice }}</view>
  49. <view class="price-text" v-else>¥{{ item.maxMemberPrice }}</view>
  50. <view class="price-bs">VIP</view>
  51. </view>
  52. </view>
  53. <view class="float_left showGoodsPrice" v-else>{{ showGoodsPrice }}</view>
  54. <!-- <view class="float_right" @click.stop="addCart"><text
  55. class="ibonfont ibonxinzeng1 cart-icon p-background-img"></text></view> -->
  56. </view>
  57. <view class="addCart-btn p-background-img" @click.stop="addCart">加入购物车</view>
  58. </view>
  59. </view>
  60. <!-- 两列 -->
  61. <view class="goods_item_align" v-else>
  62. <view class="img_style">
  63. <block v-if="item.isDistribution === 4">
  64. <view class="sale-end" v-if="!(item.inventorTotal - 0) || item.inventorTotal - 0 <= 0"><text class="ibonfont ibonbuhuozhong"></text></view>
  65. </block>
  66. <view v-if="item.brandName" class="brand-name primary-btn">{{ item.brandName }}</view>
  67. <image mode="aspectFill" :src="item.images[0]"></image>
  68. </view>
  69. <view class="goods-info">
  70. <view class="title_align ellipsis">{{ item.title }}</view>
  71. <!-- <view class="unit_align">{{ item.describe }}</view> -->
  72. <view class="price_align clearfix">
  73. <view class="float_left">
  74. <view class="now-price" v-if="!showGoodsPrice">
  75. <text class="rmb-icon">¥</text>
  76. <view style="display: inline-block;" v-if="item.isEq === 4"><rich-text :nodes="$_utils.splitPrice(item.minSalePrice)"></rich-text></view>
  77. <view style="display: inline-block;" v-else><rich-text :nodes="$_utils.splitPrice(item.maxSalePrice)"></rich-text></view>
  78. <text class="market-price">¥{{ item.maxMarketPrice }}</text>
  79. <view class="vip-price clearfix" v-if="item.minMemberPrice > 0">
  80. <view class="price-text" v-if="item.isEq === 4">¥{{ item.minMemberPrice }}</view>
  81. <view class="price-text" v-else>¥{{ item.maxMemberPrice }}</view>
  82. <view class="price-bs">vip</view>
  83. </view>
  84. </view>
  85. <view class="now-price showGoodsPrice" v-else>
  86. <text>{{ showGoodsPrice }}</text>
  87. </view>
  88. </view>
  89. <view class="k-add-btn" @click.stop="addCart"><text class="ibonfont ibonxinzeng1 cart-icon p-background-img"></text></view>
  90. </view>
  91. </view>
  92. </view>
  93. </view>
  94. </template>
  95. <script>
  96. export default {
  97. data() {
  98. return {
  99. tip_show: false
  100. };
  101. },
  102. computed: {
  103. hasLogin() {
  104. return this.$store.state.hasLogin;
  105. },
  106. baseSet() {
  107. return this.$store.state.baseSet;
  108. },
  109. showGoodsPrice() {
  110. if (this.baseSet.goodsPrice === 5 && this.$store.state.hasLogin) {
  111. return '';
  112. } else if (!this.$store.state.hasLogin && this.baseSet.goodsPrice === 4) {
  113. return '请登录';
  114. } else if (this.$store.state.userStatus.enableStatus === 4 && this.baseSet.goodsPrice === 4) {
  115. return '已禁用';
  116. } else if (this.$store.state.userStatus.status !== 2 && this.baseSet.goodsPrice === 4) {
  117. if (this.$store.state.userStatus.status === 0) {
  118. return '待审核';
  119. } else if (this.$store.state.userStatus.status === 1) {
  120. return '审核中';
  121. } else if (this.$store.state.userStatus.status === 3) {
  122. return '已驳回';
  123. }
  124. } else {
  125. return '';
  126. }
  127. }
  128. },
  129. props: {
  130. isList: {
  131. type: Boolean,
  132. default: false
  133. },
  134. item: {
  135. type: Object,
  136. default: () => {
  137. return {
  138. images: ['https://cdn.uviewui.com/uview/example/fade.jpg'],
  139. title: '商品名称商品名称商品名称商品名称商品名称商品名称',
  140. describe: 'describedescribedescribedescribe',
  141. id: 1
  142. };
  143. }
  144. },
  145. index: {
  146. type: [String, Number],
  147. default: 0
  148. }
  149. },
  150. methods: {
  151. addCart(skuId) {
  152. this.$emit('addCart');
  153. }
  154. }
  155. };
  156. </script>
  157. <style lang="scss">
  158. .list-box-two {
  159. padding: 0 10rpx;
  160. }
  161. .goods_item_justify {
  162. background-color: #ffffff;
  163. padding: 24upx;
  164. width: 100%;
  165. border-radius: 12upx;
  166. .imgStyle {
  167. position: relative;
  168. .sale-end {
  169. position: absolute;
  170. height: 176upx;
  171. width: 176upx;
  172. border-radius: 10upx;
  173. display: block;
  174. left: 0;
  175. top: 0;
  176. text-align: center;
  177. z-index: 8;
  178. line-height: 160rpx;
  179. background-color: rgba($color: #000000, $alpha: 0.3);
  180. .ibonfont {
  181. font-size: 120rpx;
  182. color: #ffffff;
  183. }
  184. }
  185. image {
  186. height: 176upx;
  187. width: 176upx;
  188. border-radius: 10upx;
  189. display: block;
  190. }
  191. .brand-name {
  192. position: absolute;
  193. z-index: 9;
  194. top: -12rpx;
  195. left: -12rpx;
  196. padding: 0 10rpx;
  197. line-height: 32rpx;
  198. height: 32rpx;
  199. color: #ffffff;
  200. border-radius: 8rpx;
  201. font-size: 20rpx;
  202. }
  203. }
  204. .goods-info {
  205. // width: 476upx;
  206. width: calc(100% - 188rpx);
  207. position: relative;
  208. .title {
  209. font-size: 28upx;
  210. width: 100%;
  211. height: 80upx;
  212. line-height: 40upx;
  213. font-weight: 500;
  214. color: #111111;
  215. }
  216. .unit {
  217. font-size: 20upx;
  218. font-family: DIN-Medium;
  219. color: #9d9d9d;
  220. width: 100%;
  221. height: 28upx;
  222. line-height: 28upx;
  223. margin-top: 8rpx;
  224. margin-bottom: 12rpx;
  225. }
  226. .price {
  227. color: $price-color;
  228. font-size: 32upx;
  229. font-weight: 500;
  230. font-family: DIN-Medium;
  231. .rmb-icon {
  232. font-size: 20upx;
  233. font-weight: 400;
  234. }
  235. .float_right {
  236. .cart-icon {
  237. font-size: 40rpx;
  238. background-image: -webkit-linear-gradient(45deg, #fe923e 0%, #ff3724 100%);
  239. -webkit-background-clip: text;
  240. color: transparent;
  241. display: block;
  242. }
  243. }
  244. .market-price {
  245. font-family: DINPro-Regular;
  246. color: #d8d8d8;
  247. text-decoration: line-through;
  248. font-size: 24upx;
  249. margin-left: 20upx;
  250. font-weight: 400;
  251. }
  252. }
  253. }
  254. }
  255. .vip-price {
  256. // margin-left: 20upx;
  257. margin-top: 6upx;
  258. line-height: 32rpx;
  259. height: 32rpx;
  260. border-radius: 4rpx;
  261. overflow: hidden;
  262. font-family: DINPro-Regular;
  263. .price-text {
  264. min-width: 80rpx;
  265. text-align: center;
  266. float: left;
  267. vertical-align: middle;
  268. font-size: 20rpx;
  269. color: #ffdfa2;
  270. background: linear-gradient(270deg, #1e5657 0%, #0d2b2c 100%);
  271. padding: 0 8rpx;
  272. }
  273. .price-bs {
  274. text-align: center;
  275. float: left;
  276. vertical-align: middle;
  277. width: 32rpx;
  278. background-color: #ffdfa2;
  279. font-size: 16rpx;
  280. color: #2c7564;
  281. font-family: DIN-Medium;
  282. }
  283. }
  284. .addCart-btn {
  285. width: 198rpx;
  286. height: 60rpx;
  287. background: linear-gradient(90deg, #fe923e 0%, #ff3724 100%);
  288. border-radius: 30rpx;
  289. color: #ffffff;
  290. line-height: 60rpx;
  291. font-size: 28rpx;
  292. text-align: center;
  293. position: absolute;
  294. bottom: 0;
  295. right: 0;
  296. }
  297. .goods_item_align {
  298. width: 350upx;
  299. margin-top: 12upx;
  300. background-color: #ffffff;
  301. border-radius: 10upx;
  302. overflow: hidden;
  303. .img_style {
  304. padding-top: 24rpx;
  305. position: relative;
  306. .sale-end {
  307. position: absolute;
  308. height: 260upx;
  309. width: 260upx;
  310. border-radius: 10upx;
  311. display: block;
  312. left: 50%;
  313. transform: translate(-50%, -50%);
  314. top: calc(50% + 12rpx);
  315. text-align: center;
  316. line-height: 260rpx;
  317. background-color: rgba($color: #000000, $alpha: 0.3);
  318. .ibonfont {
  319. font-size: 120rpx;
  320. color: #ffffff;
  321. }
  322. }
  323. image {
  324. width: 260rpx;
  325. height: 260rpx;
  326. display: block;
  327. margin: 0 auto;
  328. border-radius: 8rpx;
  329. }
  330. .brand-name {
  331. position: absolute;
  332. top: 12rpx;
  333. left: 12rpx;
  334. padding: 0 10rpx;
  335. line-height: 32rpx;
  336. height: 32rpx;
  337. color: #ffffff;
  338. border-radius: 8rpx;
  339. font-size: 20rpx;
  340. z-index: 9;
  341. }
  342. }
  343. .goods-info {
  344. padding: 20upx;
  345. .title_align {
  346. font-size: 28upx;
  347. font-weight: 500;
  348. width: 100%;
  349. height: 72upx;
  350. line-height: 36upx;
  351. }
  352. .unit_align {
  353. font-size: 24upx;
  354. height: 32upx;
  355. line-height: 32upx;
  356. color: #9d9d9d;
  357. overflow: hidden;
  358. text-overflow: ellipsis;
  359. white-space: nowrap;
  360. margin: 8upx 0;
  361. }
  362. .price_align {
  363. color: $price-color;
  364. font-size: 28upx;
  365. position: relative;
  366. .k-add-btn {
  367. position: absolute;
  368. right: 0;
  369. top: 50%;
  370. transform: translateY(-50%);
  371. .cart-icon {
  372. font-size: 40rpx;
  373. background-image: -webkit-linear-gradient(45deg, #fe923e 0%, #ff3724 100%);
  374. -webkit-background-clip: text;
  375. color: transparent;
  376. display: block;
  377. }
  378. }
  379. .now-price {
  380. display: inline-block;
  381. font-weight: 500;
  382. font-size: 32upx;
  383. font-family: DIN-Medium;
  384. .rmb-icon {
  385. font-size: 24upx;
  386. font-weight: 400;
  387. }
  388. }
  389. .market-price {
  390. font-size: 24rpx;
  391. color: #d8d8d8;
  392. font-family: DINPro-Regular;
  393. text-decoration: line-through;
  394. margin-left: 20rpx;
  395. font-weight: 400;
  396. }
  397. .cart-icon {
  398. font-size: 40rpx;
  399. background-image: -webkit-linear-gradient(45deg, #fe923e 0%, #ff3724 100%);
  400. -webkit-background-clip: text;
  401. color: transparent;
  402. display: inline-block;
  403. }
  404. }
  405. }
  406. }
  407. </style>