s-goods-column.vue 24 KB

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