Commit 0347cbe3 authored by 许佳敏's avatar 许佳敏

Merge branch 'fix-0418-bug' into 'v2-220418'

fix: 修复商品详情活动价格问题和商品详情优惠券展示 See merge request linkseeks-design/pro-platform!252
parents dca911a8 b5d0272b
......@@ -128,7 +128,7 @@ const PartakeUserLayout: React.FC<PartakeUserLayoutProps> = (props: any) => {
<Col span={6}>
<div className={style.cell}>
<h5 className={style.label}>{intl.formatMessage({ id: 'selfManagement.LevelLabel' })}: </h5>
<h5 className={style.content}><Image width={56} height={16} preview={false} src={PIC_MAP[item.level]} /></h5>
<h5 className={style.content}>{item.levelTag}</h5>
</div>
</Col>
</Row>
......
@import '../../../common.less';
.product_info_coupons_line {
display: flex;
......@@ -39,6 +40,21 @@
cursor: pointer;
}
}
.product_promotion_expand {
font-size: 12px;
color: #91959B;
display: flex;
align-items: center;
cursor: pointer;
& > span {
margin-right: 4px;
}
&_icon {
font-size: 10px;
}
}
}
}
}
......
import React, { useEffect, useState } from 'react'
import { Modal, message } from 'antd'
import { CheckCircleFilled } from '@ant-design/icons'
import { TagItem } from '@/components/ActivityTags'
import { UserInfoType } from '@/store/userStore/modal'
import { LOGIN_DOMAIN } from '@/constants'
import { LinkTo } from '@/utils'
import { useMessageIntl } from '@linkseeks/lingxi-utils'
import { CaretDownOutlined, CaretUpOutlined, CheckCircleFilled } from '@ant-design/icons'
import { TagList } from '@linkseeks/lingxi-mall-components'
import { LinkTo } from '../../../utils'
import moment from 'moment'
import { postMarketingWebCouponReceive } from '@/services/MarketingV2Api'
import { CouponDataType } from '../../types'
import { getMessage } from '../../../utils'
import styles from './index.less'
interface CouponsProps {
data: CouponDataType[] | undefined,
userInfo: UserInfoType,
mallId: number,
}
const Coupons: React.FC<CouponsProps> = (props) => {
const { data, userInfo, mallId } = props
const { data, mallId } = props
const [couponsList, setCouponsList] = useState<CouponDataType[]>()
const { getMessage } = useMessageIntl()
const [expand, setExpand] = useState<boolean>(false)
const SHOW_COUNT = 2 // 默认显示数量
useEffect(() => {
if (data) {
......@@ -37,10 +35,6 @@ const Coupons: React.FC<CouponsProps> = (props) => {
}
const receiveCoupon = async (couponInfo: CouponDataType) => {
if (!userInfo) {
LinkTo(LOGIN_DOMAIN)
return
}
try {
const param: any = {
......@@ -120,9 +114,9 @@ const Coupons: React.FC<CouponsProps> = (props) => {
<div className={styles.product_info_coupons_line_brief}>
<div className={styles.product_coupon_list} >
{
couponsList.map((item) => (
couponsList.map((item, index) => (index < SHOW_COUNT || expand ) && (
<div className={styles.product_coupon_list_item} key={item.couponId}>
<TagItem isCoupon />
<TagList.Item isCoupon />
<span>{item.name},{getMessage('mall.activity.coupon.condition', '满{money}元可用', { money: item.useConditionMoney })}</span>
{
showReceiveBtnByType(item)
......@@ -130,6 +124,14 @@ const Coupons: React.FC<CouponsProps> = (props) => {
</div>
))
}
{
couponsList.length > SHOW_COUNT && (
<div className={styles.product_promotion_expand} onClick={() => setExpand(!expand)}>
<span>{expand ? getMessage('order.index.payway.PutAway', '收起') : getMessage('order.index.payway.open', '展开')}</span>
{expand ? <CaretUpOutlined className={styles.product_promotion_expand_icon} /> : <CaretDownOutlined className={styles.product_promotion_expand_icon} />}
</div>
)
}
</div>
</div>
</div>
......
......@@ -39,6 +39,22 @@
}
}
.product_promotion_expand {
font-size: 12px;
color: #91959B;
display: flex;
align-items: center;
cursor: pointer;
& > span {
margin-right: 4px;
}
&_icon {
font-size: 10px;
}
}
}
}
......
......@@ -4,6 +4,7 @@ import { MarketingTypeEnum } from '../../../constants/marketing'
import { PromotionItem } from '../../types'
import { getMessage } from '../../../utils'
import styles from './index.less'
import { CaretDownOutlined, CaretUpOutlined } from '@ant-design/icons'
interface PromotionProps {
data: PromotionItem[] | undefined,
......@@ -13,6 +14,8 @@ interface PromotionProps {
const Promotion: React.FC<PromotionProps> = (props) => {
const { data, skuId } = props
const [list, setList] = useState<PromotionItem[]>()
const [expand, setExpand] = useState<boolean>(false)
const SHOW_COUNT = 2 // 默认显示数量
const doNotShowList = [MarketingTypeEnum.activity_type_6, MarketingTypeEnum.activity_type_13]
......@@ -35,7 +38,7 @@ const Promotion: React.FC<PromotionProps> = (props) => {
<div className={styles.product_info_promotion_line_brief}>
<div className={styles.product_promotion_list} >
{
list.map((item) => (
list.map((item, index) => (index < SHOW_COUNT || expand ) && (
<div className={styles.product_promotion_list_item} key={`product_promotion_list_item_${item.activityId}`}>
<TagList.Item tag={item.preferentialTag} />
<span>{item.preferentialTagDesc}</span>
......@@ -51,6 +54,14 @@ const Promotion: React.FC<PromotionProps> = (props) => {
</div>
))
}
{
list.length > SHOW_COUNT && (
<div className={styles.product_promotion_expand} onClick={() => setExpand(!expand)}>
<span>{expand ? getMessage('order.index.payway.PutAway', '收起') : getMessage('order.index.payway.open', '展开')}</span>
{expand ? <CaretUpOutlined className={styles.product_promotion_expand_icon} /> : <CaretDownOutlined className={styles.product_promotion_expand_icon} />}
</div>
)
}
</div>
</div>
</div>
......
......@@ -2,7 +2,9 @@ import React, { useEffect, useState } from 'react'
import cx from 'classnames'
import { ProductInfoType, CurrentSkuItemType } from '../../types'
import styles from '../../index.less'
import { getMessage } from '../../../utils'
import { COMMODITY_TYPE } from '@/constants'
import { CaretDownOutlined, CaretUpOutlined } from '@ant-design/icons'
export interface SelectAttrValType {
attrId: number;
......@@ -22,6 +24,8 @@ const SkuInfo: React.FC<SkuInfoProps> = (props) => {
const { type, skuId, productInfo, currentSku, onSelect } = props
const [skuList, setSkuList] = useState<any[]>([])
const [selectAttrVal, setSelectAttrVal] = useState<SelectAttrValType[]>([])
const [expand, setExpand] = useState<boolean>(false)
const SHOW_COUNT = 3 // 默认显示数量
const judgeSelectAttrInList = (list: any[], attrValId: number, attrId: number) => {
return list.some(item => item["attrId"] === attrId && item["attrValId"] === attrValId)
......@@ -261,7 +265,7 @@ const SkuInfo: React.FC<SkuInfoProps> = (props) => {
return (skuList && skuList.length > 0) ? (
<>
{
skuList.map((skuItem) => (
skuList.map((skuItem, index) => (index < SHOW_COUNT || expand ) && (
<div
className={styles.product_info_line}
key={`product_info_line_${skuItem.id}`}
......@@ -308,6 +312,14 @@ const SkuInfo: React.FC<SkuInfoProps> = (props) => {
</div>
))
}
{
skuList.length > SHOW_COUNT && (
<div className={styles.product_promotion_expand} onClick={() => setExpand(!expand)}>
<span>{expand ? getMessage('order.index.payway.PutAway', '收起') : getMessage('order.index.payway.open', '展开')}</span>
{expand ? <CaretUpOutlined className={styles.product_promotion_expand_icon} /> : <CaretDownOutlined className={styles.product_promotion_expand_icon} />}
</div>
)
}
</>
) : null
}
......
......@@ -296,6 +296,7 @@
}
}
}
}
.shopping_cart {
......@@ -452,3 +453,21 @@
}
}
}
.product_promotion_expand {
font-size: 12px;
color: #91959B;
display: flex;
align-items: center;
cursor: pointer;
padding-left: 124px;
margin-top: 8px;
& > span {
margin-right: 4px;
}
&_icon {
font-size: 10px;
}
}
......@@ -14,7 +14,7 @@ import ProductDescription from './components/ProductDescription'
// import Interested from './components/Interested'
import CommodityPrice, { getMaxCountRange } from './components/Price'
import Promotion from './components/Promotion'
// import Coupons from './components/Coupons'
import Coupons from './components/Coupons'
// import GroupBuy from './components/GroupBuy'
// import Combination from './components/Combination'
import SkuInfo from './components/SkuInfo'
......@@ -380,8 +380,8 @@ const CommodityDetail: React.FC = (props: any) => {
unitPrice = getLadderPrice()
}
// 会员折扣价格
if (parameter && useParameter && !isGroupBuy) {
// 会员折扣价格(如果含有活动,则不需要在乘会员折扣,后台已计算进去)
if (parameter && useParameter && !isGroupBuy && !hasActivity) {
unitPrice = unitPrice * parameter
}
return unitPrice
......@@ -575,15 +575,14 @@ const CommodityDetail: React.FC = (props: any) => {
{/* 促销 */}
<Promotion data={marketingData?.tagDetailList} skuId={currentSku?.skuId} />
{/* 优惠券 */}
{/* {
{
marketingData?.canUseCoupon === 1 && (
<Coupons
data={marketingData?.couponList}
userInfo={userInfo}
mallId={mallId}
/>
)
} */}
}
{/* 配送 */}
<Delivery
productInfo={commodityDetail}
......
......@@ -25,6 +25,7 @@ const CommodityItem: React.FC<any> = (props) => {
deleteListItems,
saveOrUpdatePurchase,
deletePurchase,
buyerInfo,
} = props;
const [initShop, setInitShop] = useState<any>({})
const [showIsLoading, setShowIsLoading] = useState(true);
......
......@@ -376,6 +376,7 @@ const PurchaseOrder: React.FC= (props: any) => {
<CommodityItem
key={`${item.id}_${index}`}
newShop={item}
buyerInfo={agentPurchaseOrderInfo}
orderList={orderList}
setOrderList={setOrderList}
checkedList={checkedList}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment