s-goods-column.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809
  1. <!-- 页面 -->
  2. <template>
  3. <view class="ss-goods-wrap">
  4. <!-- xs卡片:横向紧凑型,一行放两个,图片左内容右边 -->
  5. <view v-if="size === 'xs'" class="xs-goods-card ss-flex ss-col-stretch" :style="[elStyles]" @tap="onClick">
  6. <view v-if="tagStyle.show" class="tag-icon-box">
  7. <image class="tag-icon" :src="sheep.$url.cdn(tagStyle.src || tagStyle.imgUrl)"></image>
  8. </view>
  9. <image class="xs-img-box" :src="sheep.$url.cdn(data.image || data.picUrl)" mode="aspectFit" />
  10. <view v-if="goodsFields.title?.show || goodsFields.name?.show || goodsFields.price?.show"
  11. class="xs-goods-content ss-flex-col ss-row-around">
  12. <view v-if="goodsFields.title?.show || goodsFields.name?.show" class="xs-goods-title ss-line-1"
  13. :style="[{ color: titleColor, width: titleWidth ? titleWidth + 'rpx' : '' }]">
  14. {{ data.title || data.name }}
  15. </view>
  16. <!-- 活动信息 -->
  17. <view class="iconBox" v-if="data.promotionType > 0 || data.rewardActivity">
  18. <view class="card" v-if="discountText">{{ discountText }}</view>
  19. <view class="card2" v-if="data.rewardActivity">
  20. {{ (data.rewardActivity.ruleDescriptions[0])[1] }}
  21. </view>
  22. <view class="card2" v-if="data.rewardActivity && (data.rewardActivity.ruleDescriptions[0])[3]">
  23. {{ (data.rewardActivity.ruleDescriptions[0])[3] }}
  24. </view>
  25. </view>
  26. <view v-if="goodsFields.price?.show" class="xs-goods-price font-OPPOSANS"
  27. :style="[{ color: goodsFields.price.color }]">
  28. <text class="price-unit ss-font-24">{{ priceUnit }}</text>
  29. <!-- 活动价格 -->
  30. <text v-if="data.promotionPrice > 0">{{ fen2yuan(data.promotionPrice) }}</text>
  31. <text v-else>
  32. {{ isArray(data.price) ? fen2yuan(data.price[0]) : fen2yuan(data.price) }}
  33. </text>
  34. </view>
  35. </view>
  36. </view>
  37. <!-- sm卡片:竖向紧凑,一行放三个,图上内容下 -->
  38. <view v-if="size === 'sm'" class="sm-goods-card ss-flex-col" :style="[elStyles]" @tap="onClick">
  39. <view v-if="tagStyle.show" class="tag-icon-box">
  40. <image class="tag-icon" :src="sheep.$url.cdn(tagStyle.src || tagStyle.imgUrl)"></image>
  41. </view>
  42. <image class="sm-img-box" :src="sheep.$url.cdn(data.image || data.picUrl)" mode="aspectFill"></image>
  43. <view v-if="goodsFields.title?.show || goodsFields.name?.show || goodsFields.price?.show"
  44. class="sm-goods-content" :style="[{ color: titleColor, width: titleWidth ? titleWidth + 'rpx' : '' }]">
  45. <view v-if="goodsFields.title?.show || goodsFields.name?.show"
  46. class="sm-goods-title ss-line-1 ss-m-b-16">
  47. {{ data.title || data.name }}
  48. </view>
  49. <!-- 活动信息 -->
  50. <view class="iconBox" v-if="data.promotionType > 0 || data.rewardActivity">
  51. <view class="card" v-if="discountText">{{ discountText }}</view>
  52. <view class="card2" v-if="data.rewardActivity">
  53. {{ (data.rewardActivity.ruleDescriptions[0])[1] }}
  54. </view>
  55. <view class="card2" v-if="data.rewardActivity && (data.rewardActivity.ruleDescriptions[0])[3]">
  56. {{ (data.rewardActivity.ruleDescriptions[0])[3] }}
  57. </view>
  58. </view>
  59. <view v-if="goodsFields.price?.show" class="sm-goods-price font-OPPOSANS"
  60. :style="[{ color: goodsFields.price.color }]">
  61. <text class="price-unit ss-font-24">{{ priceUnit }}</text>
  62. <!-- 活动价格 -->
  63. <text v-if="data.promotionPrice > 0">{{ fen2yuan(data.promotionPrice) }}</text>
  64. <text v-else>
  65. {{ isArray(data.price) ? fen2yuan(data.price[0]) : fen2yuan(data.price) }}
  66. </text>
  67. </view>
  68. </view>
  69. </view>
  70. <!-- md卡片:竖向,一行放两个,图上内容下 -->
  71. <view v-if="size === 'md'" class="md-goods-card ss-flex-col" :style="[elStyles]" @tap="onClick">
  72. <view v-if="tagStyle.show" class="tag-icon-box">
  73. <image class="tag-icon" :src="sheep.$url.cdn(tagStyle.src || tagStyle.imgUrl)" />
  74. </view>
  75. <image class="md-img-box" :src="sheep.$url.cdn(data.image || data.picUrl)" mode="widthFix" />
  76. <view class="md-goods-content ss-flex-col ss-row-around ss-p-b-20 ss-p-t-20 ss-p-x-16" :id="elId">
  77. <view v-if="goodsFields.title?.show || goodsFields.name?.show" class="md-goods-title ss-line-1"
  78. :style="[{ color: titleColor, width: titleWidth ? titleWidth + 'rpx' : '' }]">
  79. {{ data.title || data.name }}
  80. </view>
  81. <view v-if="goodsFields.subtitle?.show || goodsFields.introduction?.show"
  82. class="md-goods-subtitle ss-m-t-16 ss-line-1"
  83. :style="[{ color: subTitleColor, background: subTitleBackground }]">
  84. {{ data.subtitle || data.introduction }}
  85. </view>
  86. <slot name="activity">
  87. <view v-if="data.promos?.length" class="tag-box ss-flex-wrap ss-flex ss-col-center">
  88. <view class="activity-tag ss-m-r-10 ss-m-t-16" v-for="item in data.promos" :key="item.id">
  89. {{ item.title }}
  90. </view>
  91. </view>
  92. </slot>
  93. <!-- 活动信息 -->
  94. <view class="iconBox" v-if="data.promotionType > 0 || data.rewardActivity">
  95. <view class="card" v-if="discountText">{{ discountText }}</view>
  96. <view class="card2" v-if="data.rewardActivity">
  97. {{ (data.rewardActivity.ruleDescriptions[0])[1] }}
  98. </view>
  99. <view class="card2" v-if="data.rewardActivity && (data.rewardActivity.ruleDescriptions[0])[3]">
  100. {{ (data.rewardActivity.ruleDescriptions[0])[3] }}
  101. </view>
  102. </view>
  103. <view class="ss-flex ss-col-bottom">
  104. <view v-if="goodsFields.price?.show" class="md-goods-price ss-m-t-16 font-OPPOSANS ss-m-r-10"
  105. :style="[{ color: goodsFields.price.color }]">
  106. <text class="price-unit ss-font-24">{{ priceUnit }}</text>
  107. <!-- 活动价格 -->
  108. <text v-if="data.promotionPrice > 0">{{ fen2yuan(data.promotionPrice) }}</text>
  109. <text v-else>
  110. {{ isArray(data.price) ? fen2yuan(data.price[0]) : fen2yuan(data.price) }}
  111. </text>
  112. </view>
  113. <view v-if="
  114. (goodsFields.original_price?.show || goodsFields.marketPrice?.show) &&
  115. (data.original_price > 0 || data.marketPrice > 0)
  116. " class="goods-origin-price ss-m-t-16 font-OPPOSANS ss-flex" :style="[{ color: originPriceColor }]">
  117. <text class="price-unit ss-font-20">{{ priceUnit }}</text>
  118. <view class="ss-m-l-8">{{ fen2yuan(data.marketPrice) }}</view>
  119. </view>
  120. </view>
  121. <view class="ss-m-t-16 ss-flex ss-col-center ss-flex-wrap">
  122. <view class="sales-text">{{ salesAndStock }}</view>
  123. </view>
  124. </view>
  125. <slot name="cart">
  126. <view class="cart-box ss-flex ss-col-center ss-row-center">
  127. <image class="cart-icon" src="/static/img/shop/tabbar/category2.png" mode="" />
  128. </view>
  129. </slot>
  130. </view>
  131. <!-- lg卡片:横向型,一行放一个,图片左内容右边 -->
  132. <view v-if="size === 'lg'" class="lg-goods-card ss-flex ss-col-stretch" :style="[elStyles]" @tap="onClick">
  133. <view v-if="tagStyle.show" class="tag-icon-box">
  134. <image class="tag-icon" :src="sheep.$url.cdn(tagStyle.src || tagStyle.imgUrl)"></image>
  135. </view>
  136. <view v-if="seckillTag" class="seckill-tag ss-flex ss-row-center">秒杀</view>
  137. <view v-if="grouponTag" class="groupon-tag ss-flex ss-row-center">
  138. <view class="tag-icon">拼团</view>
  139. </view>
  140. <image class="lg-img-box" :src="sheep.$url.cdn(data.image || data.picUrl)" mode="aspectFill" />
  141. <view class="lg-goods-content ss-flex-1 ss-flex-col ss-row-between ss-p-b-10 ss-p-t-20">
  142. <view>
  143. <view v-if="goodsFields.title?.show || goodsFields.name?.show" class="lg-goods-title ss-line-2"
  144. :style="[{ color: titleColor }]">
  145. {{ data.title || data.name }}
  146. </view>
  147. <view v-if="goodsFields.subtitle?.show || goodsFields.introduction?.show"
  148. class="lg-goods-subtitle ss-m-t-10 ss-line-1"
  149. :style="[{ color: subTitleColor, background: subTitleBackground }]">
  150. {{ data.subtitle || data.introduction }}
  151. </view>
  152. </view>
  153. <view>
  154. <slot name="activity">
  155. <view v-if="data.promos?.length" class="tag-box ss-flex ss-col-center">
  156. <view class="activity-tag ss-m-r-10" v-for="item in data.promos" :key="item.id">
  157. {{ item.title }}
  158. </view>
  159. </view>
  160. </slot>
  161. <!-- 活动信息 -->
  162. <view class="iconBox" v-if="data.promotionType > 0 || data.rewardActivity">
  163. <view class="card" v-if="discountText">{{ discountText }}</view>
  164. <view class="card2" v-if="data.rewardActivity">
  165. {{ (data.rewardActivity.ruleDescriptions[0])[1] }}
  166. </view>
  167. <view class="card2" v-if="data.rewardActivity && (data.rewardActivity.ruleDescriptions[0])[3]">
  168. {{ (data.rewardActivity.ruleDescriptions[0])[3] }}
  169. </view>
  170. </view>
  171. <view class="ss-flex ss-col-bottom ss-m-t-10">
  172. <view v-if="goodsFields.price?.show"
  173. class="lg-goods-price ss-m-r-12 ss-flex ss-col-bottom font-OPPOSANS"
  174. :style="[{ color: goodsFields.price.color }]">
  175. <text class="ss-font-24">{{ priceUnit }}</text>
  176. {{ isArray(data.price) ? fen2yuan(data.price[0]) : fen2yuan(data.price) }}
  177. </view>
  178. <view v-if="
  179. (goodsFields.original_price?.show || goodsFields.marketPrice?.show) &&
  180. (data.original_price > 0 || data.marketPrice > 0)
  181. " class="goods-origin-price ss-flex ss-col-bottom font-OPPOSANS" :style="[{ color: originPriceColor }]">
  182. <text class="price-unit ss-font-20">{{ priceUnit }}</text>
  183. <!-- 活动价格 -->
  184. <text v-if="data.promotionPrice > 0">{{ fen2yuan(data.promotionPrice) }}</text>
  185. <text v-else>
  186. {{ isArray(data.price) ? fen2yuan(data.price[0]) : fen2yuan(data.price) }}
  187. </text>
  188. </view>
  189. </view>
  190. <view class="ss-m-t-8 ss-flex ss-col-center ss-flex-wrap">
  191. <view class="sales-text">{{ salesAndStock }}</view>
  192. </view>
  193. </view>
  194. </view>
  195. <slot name="cart">
  196. <view class="buy-box ss-flex ss-col-center ss-row-center" v-if="buttonShow"> 去购买 </view>
  197. </slot>
  198. </view>
  199. <!-- sl卡片:竖向型,一行放一个,图片上内容下边 -->
  200. <view v-if="size === 'sl'" class="sl-goods-card ss-flex-col" :style="[elStyles]" @tap="onClick">
  201. <view v-if="tagStyle.show" class="tag-icon-box">
  202. <image class="tag-icon" :src="sheep.$url.cdn(tagStyle.src || tagStyle.imgUrl)" />
  203. </view>
  204. <image class="sl-img-box" :src="sheep.$url.cdn(data.image || data.picUrl)" mode="aspectFill" />
  205. <view class="sl-goods-content">
  206. <view>
  207. <view v-if="goodsFields.title?.show || goodsFields.name?.show" class="sl-goods-title ss-line-1"
  208. :style="[{ color: titleColor }]">
  209. {{ data.title || data.name }}
  210. </view>
  211. <view v-if="goodsFields.subtitle?.show || goodsFields.introduction?.show"
  212. class="sl-goods-subtitle ss-m-t-16"
  213. :style="[{ color: subTitleColor, background: subTitleBackground }]">
  214. {{ data.subtitle || data.introduction }}
  215. </view>
  216. </view>
  217. <view>
  218. <slot name="activity">
  219. <view v-if="data.promos?.length" class="tag-box ss-flex ss-col-center ss-flex-wrap">
  220. <view class="activity-tag ss-m-r-10 ss-m-t-16" v-for="item in data.promos" :key="item.id">
  221. {{ item.title }}
  222. </view>
  223. </view>
  224. </slot>
  225. <!-- 活动信息 -->
  226. <view class="iconBox" v-if="data.promotionType > 0 || data.rewardActivity">
  227. <view class="card" v-if="discountText">{{ discountText }}</view>
  228. <view class="card2" v-if="data.rewardActivity">
  229. {{ (data.rewardActivity.ruleDescriptions[0])[1] }}
  230. </view>
  231. <view class="card2" v-if="data.rewardActivity && (data.rewardActivity.ruleDescriptions[0])[3]">
  232. {{ (data.rewardActivity.ruleDescriptions[0])[3] }}
  233. </view>
  234. </view>
  235. <view v-if="goodsFields.price?.show" class="ss-flex ss-col-bottom font-OPPOSANS">
  236. <view class="sl-goods-price ss-m-r-12" :style="[{ color: goodsFields.price.color }]">
  237. <text class="price-unit ss-font-24">{{ priceUnit }}</text>
  238. <!-- 活动价格 -->
  239. <text v-if="data.promotionPrice > 0">{{ fen2yuan(data.promotionPrice) }}</text>
  240. <text v-else>
  241. {{ isArray(data.price) ? fen2yuan(data.price[0]) : fen2yuan(data.price) }}
  242. </text>
  243. </view>
  244. <view v-if="
  245. (goodsFields.original_price?.show || goodsFields.marketPrice?.show) &&
  246. (data.original_price > 0 || data.marketPrice > 0)
  247. " class="goods-origin-price ss-m-t-16 font-OPPOSANS ss-flex" :style="[{ color: originPriceColor }]">
  248. <text class="price-unit ss-font-20">{{ priceUnit }}</text>
  249. <view class="ss-m-l-8">{{ fen2yuan(data.marketPrice) }}</view>
  250. </view>
  251. </view>
  252. <view class="ss-m-t-16 ss-flex ss-flex-wrap">
  253. <view class="sales-text">{{ salesAndStock }}</view>
  254. </view>
  255. </view>
  256. </view>
  257. <slot name="cart">
  258. <view class="buy-box ss-flex ss-col-center ss-row-center">去购买</view>
  259. </slot>
  260. </view>
  261. </view>
  262. </template>
  263. <script setup>
  264. /**
  265. * 商品卡片
  266. *
  267. * @property {Array} size = [xs | sm | md | lg | sl ] - 列表数据
  268. * @property {String} tag - md及以上才有
  269. * @property {String} img - 图片
  270. * @property {String} background - 背景色
  271. * @property {String} topRadius - 上圆角
  272. * @property {String} bottomRadius - 下圆角
  273. * @property {String} title - 标题
  274. * @property {String} titleColor - 标题颜色
  275. * @property {Number} titleWidth = 0 - 标题宽度,默认0,单位rpx
  276. * @property {String} subTitle - 副标题
  277. * @property {String} subTitleColor - 副标题颜色
  278. * @property {String} subTitleBackground - 副标题背景
  279. * @property {String | Number} price - 价格
  280. * @property {String} priceColor - 价格颜色
  281. * @property {String | Number} originPrice - 原价/划线价
  282. * @property {String} originPriceColor - 原价颜色
  283. * @property {String | Number} sales - 销售数量
  284. * @property {String} salesColor - 销售数量颜色
  285. *
  286. * @slots activity - 活动插槽
  287. * @slots cart - 购物车插槽,默认包含文字,背景色,文字颜色 || 图片 || 行为
  288. *
  289. * @event {Function()} click - 点击卡片
  290. *
  291. */
  292. import {
  293. computed,
  294. getCurrentInstance,
  295. onMounted,
  296. nextTick
  297. } from 'vue';
  298. import sheep from '@/sheep';
  299. import {
  300. fen2yuan,
  301. formatSales
  302. } from '@/sheep/hooks/useGoods';
  303. import {
  304. formatStock
  305. } from '@/sheep/hooks/useGoods';
  306. import {
  307. isArray
  308. } from 'lodash-es';
  309. // 接收参数
  310. const props = defineProps({
  311. goodsFields: {
  312. type: [Array, Object],
  313. default () {
  314. return {
  315. // 商品价格
  316. price: {
  317. show: true,
  318. },
  319. // 库存
  320. stock: {
  321. show: true,
  322. },
  323. // 商品名称
  324. name: {
  325. show: true,
  326. },
  327. // 商品介绍
  328. introduction: {
  329. show: true,
  330. },
  331. // 市场价
  332. marketPrice: {
  333. show: true,
  334. },
  335. // 销量
  336. salesCount: {
  337. show: true,
  338. },
  339. };
  340. },
  341. },
  342. tagStyle: {
  343. type: Object,
  344. default: () => ({}),
  345. },
  346. data: {
  347. type: Object,
  348. default: () => ({}),
  349. },
  350. size: {
  351. type: String,
  352. default: 'sl',
  353. },
  354. background: {
  355. type: String,
  356. default: '',
  357. },
  358. topRadius: {
  359. type: Number,
  360. default: 0,
  361. },
  362. bottomRadius: {
  363. type: Number,
  364. default: 0,
  365. },
  366. titleWidth: {
  367. type: Number,
  368. default: 0,
  369. },
  370. titleColor: {
  371. type: String,
  372. default: '#333',
  373. },
  374. priceColor: {
  375. type: String,
  376. default: '',
  377. },
  378. originPriceColor: {
  379. type: String,
  380. default: '#C4C4C4',
  381. },
  382. priceUnit: {
  383. type: String,
  384. default: '¥',
  385. },
  386. subTitleColor: {
  387. type: String,
  388. default: '#999999',
  389. },
  390. subTitleBackground: {
  391. type: String,
  392. default: '',
  393. },
  394. buttonShow: {
  395. type: Boolean,
  396. default: true,
  397. },
  398. seckillTag: {
  399. type: Boolean,
  400. default: false,
  401. },
  402. grouponTag: {
  403. type: Boolean,
  404. default: false,
  405. },
  406. });
  407. // 优惠文案
  408. const discountText = computed(() => {
  409. const promotionType = props.data.promotionType;
  410. if (promotionType === 4) {
  411. return '限时优惠';
  412. } else if (promotionType === 6) {
  413. return '会员价';
  414. }
  415. return undefined;
  416. });
  417. // 组件样式
  418. const elStyles = computed(() => {
  419. return {
  420. background: props.background,
  421. 'border-top-left-radius': props.topRadius + 'px',
  422. 'border-top-right-radius': props.topRadius + 'px',
  423. 'border-bottom-left-radius': props.bottomRadius + 'px',
  424. 'border-bottom-right-radius': props.bottomRadius + 'px',
  425. };
  426. });
  427. // 格式化销量、库存信息
  428. const salesAndStock = computed(() => {
  429. let text = [];
  430. if (props.goodsFields.salesCount?.show) {
  431. text.push(formatSales(props.data.sales_show_type, props.data.salesCount));
  432. }
  433. if (props.goodsFields.stock?.show) {
  434. text.push(formatStock(props.data.stock_show_type, props.data.stock));
  435. }
  436. return text.join(' | ');
  437. });
  438. // 返回事件
  439. const emits = defineEmits(['click', 'getHeight']);
  440. const onClick = () => {
  441. emits('click');
  442. };
  443. // 获取卡片实时高度
  444. const {
  445. proxy
  446. } = getCurrentInstance();
  447. const elId = `sheep_${Math.ceil(Math.random() * 10e5).toString(36)}`;
  448. function getGoodsPriceCardWH() {
  449. if (props.size === 'md') {
  450. const view = uni.createSelectorQuery().in(proxy);
  451. view.select(`#${elId}`).fields({
  452. size: true,
  453. scrollOffset: true,
  454. });
  455. view.exec((data) => {
  456. let totalHeight = 0;
  457. const goodsPriceCard = data[0];
  458. if (props.data.image_wh) {
  459. totalHeight =
  460. (goodsPriceCard.width / props.data.image_wh.w) * props.data.image_wh.h +
  461. goodsPriceCard.height;
  462. } else {
  463. totalHeight = goodsPriceCard.width;
  464. }
  465. emits('getHeight', totalHeight);
  466. });
  467. }
  468. }
  469. onMounted(() => {
  470. nextTick(() => {
  471. getGoodsPriceCardWH();
  472. });
  473. });
  474. </script>
  475. <style lang="scss" scoped>
  476. .tag-icon-box {
  477. position: absolute;
  478. left: 0;
  479. top: 0;
  480. z-index: 2;
  481. .tag-icon {
  482. width: 72rpx;
  483. height: 44rpx;
  484. }
  485. }
  486. .seckill-tag {
  487. position: absolute;
  488. left: 0;
  489. top: 0;
  490. z-index: 2;
  491. width: 68rpx;
  492. height: 38rpx;
  493. background: linear-gradient(90deg, #ff5854 0%, #ff2621 100%);
  494. border-radius: 10rpx 0px 10rpx 0px;
  495. font-size: 24rpx;
  496. font-weight: 500;
  497. color: #ffffff;
  498. line-height: 32rpx;
  499. }
  500. .groupon-tag {
  501. position: absolute;
  502. left: 0;
  503. top: 0;
  504. z-index: 2;
  505. width: 68rpx;
  506. height: 38rpx;
  507. background: linear-gradient(90deg, #fe832a 0%, #ff6600 100%);
  508. border-radius: 10rpx 0px 10rpx 0px;
  509. font-size: 24rpx;
  510. font-weight: 500;
  511. color: #ffffff;
  512. line-height: 32rpx;
  513. }
  514. .goods-img {
  515. width: 100%;
  516. height: 100%;
  517. background-color: #f5f5f5;
  518. }
  519. .price-unit {
  520. margin-right: -4px;
  521. }
  522. .sales-text {
  523. display: table;
  524. font-size: 24rpx;
  525. transform: scale(0.8);
  526. margin-left: 0rpx;
  527. color: #c4c4c4;
  528. }
  529. .activity-tag {
  530. font-size: 20rpx;
  531. color: #ff0000;
  532. line-height: 30rpx;
  533. padding: 0 10rpx;
  534. border: 1px solid rgba(#ff0000, 0.25);
  535. border-radius: 4px;
  536. flex-shrink: 0;
  537. }
  538. .goods-origin-price {
  539. font-size: 20rpx;
  540. color: #c4c4c4;
  541. line-height: 36rpx;
  542. text-decoration: line-through;
  543. }
  544. // xs
  545. .xs-goods-card {
  546. overflow: hidden;
  547. // max-width: 375rpx;
  548. background-color: $white;
  549. position: relative;
  550. .xs-img-box {
  551. width: 128rpx;
  552. height: 128rpx;
  553. margin-right: 20rpx;
  554. }
  555. .xs-goods-title {
  556. font-size: 26rpx;
  557. color: #333;
  558. font-weight: 500;
  559. }
  560. .xs-goods-price {
  561. font-size: 30rpx;
  562. color: $red;
  563. }
  564. }
  565. // sm
  566. .sm-goods-card {
  567. overflow: hidden;
  568. // width: 223rpx;
  569. // width: 100%;
  570. background-color: $white;
  571. position: relative;
  572. .sm-img-box {
  573. // width: 228rpx;
  574. width: 100%;
  575. height: 208rpx;
  576. }
  577. .sm-goods-content {
  578. padding: 20rpx 16rpx;
  579. box-sizing: border-box;
  580. }
  581. .sm-goods-title {
  582. font-size: 26rpx;
  583. color: #333;
  584. }
  585. .sm-goods-price {
  586. font-size: 30rpx;
  587. color: $red;
  588. }
  589. }
  590. // md
  591. .md-goods-card {
  592. overflow: hidden;
  593. width: 100%;
  594. position: relative;
  595. z-index: 1;
  596. background-color: $white;
  597. position: relative;
  598. .md-img-box {
  599. width: 100%;
  600. }
  601. .md-goods-title {
  602. font-size: 26rpx;
  603. color: #333;
  604. width: 100%;
  605. }
  606. .md-goods-subtitle {
  607. font-size: 24rpx;
  608. font-weight: 400;
  609. color: #999999;
  610. }
  611. .md-goods-price {
  612. font-size: 30rpx;
  613. color: $red;
  614. line-height: 36rpx;
  615. }
  616. .cart-box {
  617. width: 54rpx;
  618. height: 54rpx;
  619. background: linear-gradient(90deg, #fe8900, #ff5e00);
  620. border-radius: 50%;
  621. position: absolute;
  622. bottom: 50rpx;
  623. right: 20rpx;
  624. z-index: 2;
  625. .cart-icon {
  626. width: 30rpx;
  627. height: 30rpx;
  628. }
  629. }
  630. }
  631. // lg
  632. .lg-goods-card {
  633. overflow: hidden;
  634. position: relative;
  635. z-index: 1;
  636. background-color: $white;
  637. height: 280rpx;
  638. .lg-img-box {
  639. width: 280rpx;
  640. height: 280rpx;
  641. margin-right: 20rpx;
  642. }
  643. .lg-goods-title {
  644. font-size: 28rpx;
  645. font-weight: 500;
  646. color: #333333;
  647. // line-height: 36rpx;
  648. // width: 410rpx;
  649. }
  650. .lg-goods-subtitle {
  651. font-size: 24rpx;
  652. font-weight: 400;
  653. color: #999999;
  654. // line-height: 30rpx;
  655. // width: 410rpx;
  656. }
  657. .lg-goods-price {
  658. font-size: 30rpx;
  659. color: $red;
  660. line-height: 36rpx;
  661. }
  662. .buy-box {
  663. position: absolute;
  664. bottom: 20rpx;
  665. right: 20rpx;
  666. z-index: 2;
  667. width: 120rpx;
  668. height: 50rpx;
  669. background: linear-gradient(90deg, #fe8900, #ff5e00);
  670. border-radius: 25rpx;
  671. font-size: 24rpx;
  672. color: #ffffff;
  673. }
  674. .tag-box {
  675. width: 100%;
  676. }
  677. }
  678. // sl
  679. .sl-goods-card {
  680. overflow: hidden;
  681. position: relative;
  682. z-index: 1;
  683. width: 100%;
  684. background-color: $white;
  685. .sl-goods-content {
  686. padding: 20rpx 20rpx;
  687. box-sizing: border-box;
  688. }
  689. .sl-img-box {
  690. width: 100%;
  691. height: 360rpx;
  692. }
  693. .sl-goods-title {
  694. font-size: 26rpx;
  695. color: #333;
  696. font-weight: 500;
  697. }
  698. .sl-goods-subtitle {
  699. font-size: 24rpx;
  700. font-weight: 400;
  701. color: #999999;
  702. line-height: 30rpx;
  703. }
  704. .sl-goods-price {
  705. font-size: 30rpx;
  706. color: $red;
  707. line-height: 36rpx;
  708. }
  709. .buy-box {
  710. position: absolute;
  711. bottom: 20rpx;
  712. right: 20rpx;
  713. z-index: 2;
  714. width: 148rpx;
  715. height: 50rpx;
  716. background: linear-gradient(90deg, #fe8900, #ff5e00);
  717. border-radius: 25rpx;
  718. font-size: 24rpx;
  719. color: #ffffff;
  720. }
  721. }
  722. .card {
  723. width: fit-content;
  724. height: fit-content;
  725. padding: 2rpx 10rpx;
  726. background-color: red;
  727. color: #ffffff;
  728. font-size: 24rpx;
  729. margin-top: 5rpx;
  730. }
  731. .card2 {
  732. width: fit-content;
  733. height: fit-content;
  734. padding: 2rpx 10rpx;
  735. background-color: rgb(255, 242, 241);
  736. color: #ff2621;
  737. font-size: 24rpx;
  738. margin: 5rpx 0 5rpx 5rpx;
  739. }
  740. .iconBox {
  741. width: 100%;
  742. height: fit-content;
  743. margin-top: 10rpx;
  744. display: flex;
  745. justify-content: flex-start;
  746. flex-wrap: wrap;
  747. }
  748. </style>