diff --git a/src/components/sp-point/index.scss b/src/components/sp-point/index.scss index 1e7ed2169..1f45111d6 100644 --- a/src/components/sp-point/index.scss +++ b/src/components/sp-point/index.scss @@ -3,16 +3,19 @@ * See LICENSE file for license details. */ .sp-point { - font-family: PingFangSC-Regular, PingFang SC; + font-family: D-DIN-PRO, D-DIN-PRO; + font-weight: 600; + font-size: 34px; + line-height: 1; .point { - font-size: 32px; color: var(--color-primary); margin-right: 4px; } .unit { - font-size: 26px; + font-family: D-DIN-PRO, D-DIN-PRO; + font-weight: 500; + font-size: 24px; + line-height: 1; color: var(--color-primary); - // position: relative; - // top: -2px; } } diff --git a/src/components/sp-render-goods/compact-card.jsx b/src/components/sp-render-goods/compact-card.jsx index 98c0b2db4..eca58b7c6 100644 --- a/src/components/sp-render-goods/compact-card.jsx +++ b/src/components/sp-render-goods/compact-card.jsx @@ -1,6 +1,6 @@ import React, { useEffect } from 'react' import { View, Text } from '@tarojs/components' -import { SpImage, SpPrice } from '@/components' +import { SpImage, SpPrice, SpPoint } from '@/components' import SpTag from '@/components/sp-tag/index' import Taro from '@tarojs/taro' import qs from 'qs' @@ -15,6 +15,7 @@ function SpGoodsCompactCard(props) { mode = 'aspectFill', top, showTop, + showPrice = true, onClickGio = () => {}, onChangeRegionauth = () => {} } = props @@ -26,7 +27,7 @@ function SpGoodsCompactCard(props) { onClick(info) return } - const { itemId, distributorId } = info + const { itemId, distributorId, point } = info let query = { id: itemId } if (typeof distributorId !== 'undefined') { query = { @@ -34,7 +35,9 @@ function SpGoodsCompactCard(props) { dtid: distributorId } } - const url = `/pages/item/espier-detail?${qs.stringify(query)}` + const url = point + ? `/subpages/pointshop/espier-detail?${qs.stringify(query)}` + : `/pages/item/espier-detail?${qs.stringify(query)}` onChangeRegionauth(info) Taro.navigateTo({ url @@ -114,28 +117,32 @@ function SpGoodsCompactCard(props) { - - - {Number(info.marketPrice || 0) > 0 && - Number(finalPrice || 0) < Number(info.marketPrice || 0) && ( + {info.point != null && info.point !== '' ? ( + + ) : showPrice ? ( + <> - )} + {Number(info.marketPrice || 0) > 0 && + Number(finalPrice || 0) < Number(info.marketPrice || 0) && ( + + )} + + ) : null} - {info.discountRate && ( + {showPrice && !info.point && info.discountRate && ( {info.discountRate} @@ -161,6 +168,7 @@ SpGoodsCompactCard.defaultProps = { width: 218, top: 0, showTop: false, + showPrice: true, onLoad: () => {} } diff --git a/src/components/sp-render-goods/hero-card.jsx b/src/components/sp-render-goods/hero-card.jsx index ac91dc40b..f03e23947 100644 --- a/src/components/sp-render-goods/hero-card.jsx +++ b/src/components/sp-render-goods/hero-card.jsx @@ -1,6 +1,6 @@ import React from 'react' import { View, Text } from '@tarojs/components' -import { SpImage, SpPrice } from '@/components' +import { SpImage, SpPrice, SpPoint } from '@/components' import SpTag from '@/components/sp-tag/index' import Taro from '@tarojs/taro' import qs from 'qs' @@ -8,17 +8,19 @@ import { classNames } from '@/utils' import './hero-card.scss' function SpGoodsHeroCard(props) { - const { info = null, onClick, mode = 'aspectFill' } = props + const { info = null, onClick, mode = 'aspectFill', showPrice = true } = props const handleClick = async () => { if (!info) return - const { itemId, distributorId } = info + const { itemId, distributorId, point } = info if (onClick) { onClick(info) return } let query = { id: itemId, dtid: distributorId ?? '' } - const url = `/pages/item/espier-detail?${qs.stringify(query)}` + const url = point + ? `/subpages/pointshop/espier-detail?${qs.stringify(query)}` + : `/pages/item/espier-detail?${qs.stringify(query)}` Taro.navigateTo({ url }) @@ -88,29 +90,35 @@ function SpGoodsHeroCard(props) { )} - - {Number(info.marketPrice || 0) > 0 && - Number(finalPrice || 0) < Number(info.marketPrice || 0) && ( + {info.point != null && info.point !== '' ? ( + + ) : showPrice ? ( + <> - )} - {info.discountRate && ( - - {info.discountRate} - - - )} + {Number(info.marketPrice || 0) > 0 && + Number(finalPrice || 0) < Number(info.marketPrice || 0) && ( + + )} + {info.discountRate && ( + + {info.discountRate} + + + )} + + ) : null} @@ -130,6 +138,7 @@ SpGoodsHeroCard.defaultProps = { onClick: null, mode: 'aspectFill', width: 200, + showPrice: true, onLoad: () => {} } diff --git a/src/doc/goods.js b/src/doc/goods.js index eec8aebb1..2c333be88 100644 --- a/src/doc/goods.js +++ b/src/doc/goods.js @@ -550,5 +550,8 @@ export const WGT_SPEEDKILL_GOODS = { return (activity_price || price) / 100 }, discount_var: ({ discount_rate }) => - discount_rate ? String((discount_rate / 10).toFixed(1)) : null + discount_rate ? String((discount_rate / 10).toFixed(1)) : null, + // 积分商品:data_type=pointsmall_items 时接口返回,用于挂件展示积分不展示价格 + point: ({ point, point_exchange }) => + point != null ? point : point_exchange != null ? point_exchange : null } diff --git a/src/pages/home/wgts/goods-layout/index.jsx b/src/pages/home/wgts/goods-layout/index.jsx index 92752088d..abdb7f6f2 100644 --- a/src/pages/home/wgts/goods-layout/index.jsx +++ b/src/pages/home/wgts/goods-layout/index.jsx @@ -17,6 +17,7 @@ import './index.scss' * @param {Array} props.goodsRightList - 右列商品列表(two布局时使用) * @param {Function} props.onClickItem - 商品点击回调函数 * @param {string} props.classNamePrefix - CSS类名前缀,如 'wgt-goods', 'wgt-group' 等 + * @param {boolean} [props.showPrice=true] - 是否展示价格(积分商品时可传 false,由卡片根据 info.point 展示积分) */ export default function GoodsLayout(props) { const { @@ -25,7 +26,8 @@ export default function GoodsLayout(props) { goodsLeftList = [], goodsRightList = [], onClickItem, - classNamePrefix = 'wgt-goods' + classNamePrefix = 'wgt-goods', + showPrice = true } = props // 一列网格布局 @@ -39,6 +41,7 @@ export default function GoodsLayout(props) { })} key={item.item_id} info={item} + showPrice={showPrice} onClick={() => onClickItem(item, index + 1)} /> ))} @@ -55,6 +58,7 @@ export default function GoodsLayout(props) { onClickItem(item, index + 1)} /> ))} @@ -64,6 +68,7 @@ export default function GoodsLayout(props) { onClickItem(item, index + 1)} /> ))} @@ -80,6 +85,7 @@ export default function GoodsLayout(props) { onClickItem(item, index + 1)} /> ))} diff --git a/src/pages/home/wgts/goods/index.jsx b/src/pages/home/wgts/goods/index.jsx index 29e059775..5f74340c0 100644 --- a/src/pages/home/wgts/goods/index.jsx +++ b/src/pages/home/wgts/goods/index.jsx @@ -5,7 +5,7 @@ import React, { useState, useEffect, useMemo, useContext, useCallback } from 'react' import Taro, { useDidShow } from '@tarojs/taro' import { View, Text } from '@tarojs/components' -import { SpImage } from '@/components' +import { SpImage, SpPoint } from '@/components' import { classNames, styleNames, linkPage, pickBy, getDistributorId } from '@/utils' import { getBrowseHistoryList } from '@/utils/browseHistory' import doc from '@/doc' @@ -29,6 +29,7 @@ export default function WgtGoods(props) { const data = params.data || {} const { onAddToCart } = useContext(WgtsContext) + const isPointsmallItems = base.dataType === 'pointsmall_items' // 获取外层样式(包含 outerMargin 和背景配置) const outerStyle = useMemo(() => { @@ -121,8 +122,15 @@ export default function WgtGoods(props) { } } - // 处理商品点击 + // 处理商品点击:积分商品跳积分详情,否则走 linkPage const handleClickItem = (item) => { + const itemId = item.item_id ?? item.itemId + if (isPointsmallItems || item.point != null) { + Taro.navigateTo({ + url: `/subpages/pointshop/espier-detail?id=${itemId}` + }) + return + } linkPage({ linkPage: 'goods', id: item.goodsId || item.item_id || item.itemId @@ -199,15 +207,21 @@ export default function WgtGoods(props) { {item.itemName || item.title} - - - - {item.mainPrice || - (item.activityPrice - ? item.activityPrice.toFixed(2) - : item.price?.toFixed(2) || '0.00')} - - + {isPointsmallItems ? ( + + + + ) : ( + + + + {item.mainPrice || + (item.activityPrice + ? item.activityPrice.toFixed(2) + : item.price?.toFixed(2) || '0.00')} + + + )} ))} @@ -221,6 +235,7 @@ export default function WgtGoods(props) { goodsRightList={goodsRightList} onClickItem={handleClickItem} classNamePrefix='wgt-goods' + showPrice={!isPointsmallItems} /> )}