Commit bce4c404 authored by 卢均锐's avatar 卢均锐

chore: 在线竞价 提交竞价按钮增加loading

parent 3372d94f
......@@ -12,11 +12,12 @@ interface BtnItemProps {
btnType?: number,
active?: boolean,
onOk?: () => void,
onCancle?: () => void
onCancle?: () => void,
btnLoading?: boolean
}
const BtnItem: React.FC<BtnItemProps> = (props: any) => {
const { btnType, active, detail, onOk, onCancle } = props;
const { btnType, active, detail, onOk, onCancle, btnLoading } = props;
const _returnBtn = () => {
if (btnType === 1) {
return (
......@@ -43,7 +44,7 @@ const BtnItem: React.FC<BtnItemProps> = (props: any) => {
<div className={styles.box}>
<div className={styles.price}>
<div>¥{priceFormat(detail?.sumPice)}<span>(含税)</span></div>
{detail?.peportPriceSum}
{detail?.peportPriceSum}
</div>
<div className={styles.time}>
<span>{formatTimeString(detail?.peportTime, 'HH:mm:ss')}</span>
......@@ -67,7 +68,7 @@ const BtnItem: React.FC<BtnItemProps> = (props: any) => {
<Button block style={{ backgroundColor: '#F4F5F7', border: 0 }} onClick={onCancle}>取消</Button>
</Col>
<Col span={12}>
<Button type="primary" block onClick={onOk} disabled={!active}>提交报价</Button>
<Button type="primary" block onClick={onOk} loading={btnLoading} disabled={!active}>提交报价</Button>
</Col>
</Row>
</div>
......
......@@ -24,6 +24,7 @@ const DetailBottomDrawer: React.FC<DetailBottomDrawerProps> = (props: any) => {
const [activeIndex, setActiveIndex] = useState<any>('');
const [dataSource, setDataSource] = useState<any>(materiels);
const [dataSource2, setDataSource2] = useState<any>(materiels);
const [btnLoading, setBtnLoading] = useState<boolean>(false);
useEffect(() => {
if (visible) {
setDataSource(materiels)
......@@ -121,6 +122,9 @@ const DetailBottomDrawer: React.FC<DetailBottomDrawerProps> = (props: any) => {
}
const bidOk = () => {
if(btnLoading){
return;
}
const _price = dataSource2.reduce((total: any, cur: any) => total + Number(cur.price), 0);
if (detail?.minLowPrice && Number(detail.minLowPrice) - _price < detail.minPrice) {
message.error('当前报价金额不满足最小价差要求,请修改后再报价!');
......@@ -137,11 +141,12 @@ const DetailBottomDrawer: React.FC<DetailBottomDrawerProps> = (props: any) => {
onlineId: detail.onlineId,
materiels: _dataSource2,
}
setBtnLoading(true);
PublicApi.postPurchaseOnlineBiddingSubmitReportPrice(_params).then(res => {
if (res.code === 1000) {
onClose && onClose();
}
})
}).finally(() => setBtnLoading(false))
}
return (
......@@ -158,7 +163,7 @@ const DetailBottomDrawer: React.FC<DetailBottomDrawerProps> = (props: any) => {
>
<Row gutter={[8, 8]} style={{ marginBottom: '10px' }}>
<Col span={7} key={'BtnItem_0'} onClick={() => { chooseItem() }}>
<BtnItem btnType={3} detail={{ sumPice: _calcCurrentTotal, peportPriceSum: offerCount + 1 }} active={!activeItem} onOk={bidOk} onCancle={onClose} />
<BtnItem btnType={3} detail={{ sumPice: _calcCurrentTotal, peportPriceSum: offerCount + 1 }} active={!activeItem} onOk={bidOk} onCancle={onClose} btnLoading={btnLoading} />
</Col>
{awardProcess?.map((item, index, arr) => {
let _ratio = 0;
......
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