s-goods-column.vue 25 KB

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