Commit 282690c1 authored by 前端-许冠华's avatar 前端-许冠华

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

fix: 更换代客下单优惠券领取和查询优惠券列表的接口 See merge request linkseeks-design/pro-platform!267
parents 6f6b2e04 f2a9fd9b
......@@ -4,7 +4,7 @@ import { CaretDownOutlined, CaretUpOutlined, CheckCircleFilled } from '@ant-desi
import { TagList } from '@linkseeks/lingxi-mall-components'
import { LinkTo } from '../../../utils'
import moment from 'moment'
import { postMarketingWebCouponReceive } from '@/services/MarketingV2Api'
import { postMarketingWebAgentCouponReceive } from '@/services/MarketingV2Api'
import { CouponDataType } from '../../types'
import { getMessage } from '../../../utils'
import styles from './index.less'
......@@ -12,10 +12,12 @@ import styles from './index.less'
interface CouponsProps {
data: CouponDataType[] | undefined,
mallId: number,
agentMemberId: number,
agentRoleId: number,
}
const Coupons: React.FC<CouponsProps> = (props) => {
const { data, mallId } = props
const { data, mallId, agentMemberId, agentRoleId } = props
const [couponsList, setCouponsList] = useState<CouponDataType[]>()
const [expand, setExpand] = useState<boolean>(false)
const SHOW_COUNT = 2 // 默认显示数量
......@@ -42,10 +44,15 @@ const Coupons: React.FC<CouponsProps> = (props) => {
belongType: couponInfo.belongType,
couponId: couponInfo.couponId
}
const res = await postMarketingWebCouponReceive(param)
message.destroy()
const headers: any = {
agentMemberId,
agentRoleId,
}
const res = await postMarketingWebAgentCouponReceive(param, { headers })
if (res.code === 1000 && res.data) {
if (res.data?.canReceive === 3) {
message.destroy()
if (res.data?.canReceive !== 1) {
const newCoupons = couponsList ? couponsList.map((item) => {
return {
...item,
......@@ -83,6 +90,8 @@ const Coupons: React.FC<CouponsProps> = (props) => {
</div>
)
})
} else {
message.info(getMessage('coupons.incompatible'))
}
}
} catch (error) {
......
......@@ -582,6 +582,8 @@ const CommodityDetail: React.FC = (props: any) => {
<Coupons
data={marketingData?.couponList}
mallId={mallId}
agentMemberId={agentPurchaseOrderInfo?.memberId}
agentRoleId={agentPurchaseOrderInfo?.roleId}
/>
)
}
......
......@@ -75,10 +75,8 @@ const CouponSelect: React.FC<InvoicePropsType> = (props) => {
skuIdList: [],
};
item.orderList.forEach((newCommodity) => {
obj.memberId = buyerInfo.memberId
obj.roleId = buyerInfo.roleId
// obj.memberId = newCommodity.vendorMemberId
// obj.roleId = newCommodity.vendorRoleId
obj.memberId = newCommodity.vendorMemberId
obj.roleId = newCommodity.vendorRoleId
obj.skuIdList.push(newCommodity.id);
});
skuIdListObj.push(obj);
......
......@@ -6,7 +6,7 @@ import { Link } from 'react-router-dom';
import { fnGetActivityTips } from './callBlackTips';
import { CaretDownOutlined, RightOutlined } from '@ant-design/icons';
import InputNumber from '../components/InputNumber';
import { getMarketingWebCouponListByShop, postMarketingMobileCouponReceive } from '@/services/MarketingV2Api';
import { getMarketingWebAgentCouponListByShop, postMarketingWebAgentCouponReceive } from '@/services/MarketingV2Api';
import { priceFormat, numFormat } from '../utils/numFormat'
import { LinkTo, getMessage } from '../utils';
......@@ -376,7 +376,13 @@ const CommodityItem: React.FC<any> = (props) => {
memberId: newShop.memberId,
roleId: newShop.memberRoleId,
};
getMarketingWebCouponListByShop(parmas).then((res) => {
const headers: any = {
agentMemberId: buyerInfo?.memberId,
agentRoleId: buyerInfo?.roleId,
}
getMarketingWebAgentCouponListByShop(parmas, { headers }).then((res) => {
setShowIsLoading(false);
if (res.code === 1000) {
setcouponList(res.data);
......@@ -405,8 +411,13 @@ const CommodityItem: React.FC<any> = (props) => {
belongType: item.belongType,
couponId: item.couponId,
}
postMarketingMobileCouponReceive(parmas).then((res) => {
const headers: any = {
agentMemberId: buyerInfo?.memberId,
agentRoleId: buyerInfo?.roleId,
}
postMarketingWebAgentCouponReceive(parmas, { headers }).then((res) => {
if (res.code === 1000) {
message.destroy();
message.success(getMessage('purchaseOrder.lingquchenggong', '领取成功'))
item.completeReceive = 3;
setcouponList([...couponList]);
......
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