s-goods-column.vue 24 KB

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