s-goods-column.vue 20 KB

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