5.16 内拍改造

This commit is contained in:
jl-zhoujl2
2022-05-16 16:22:57 +08:00
parent 216d65fe55
commit a5d48fc999
8 changed files with 1106 additions and 18 deletions

View File

@ -0,0 +1,109 @@
.header {
display: flex;
height: 56px;
color: white;
font-size: 20px;
background-color: #b30000;
.headerAlign {
align-self: center;
margin-left: 20px;
font-weight: 400;
}
.rightBtns {
position: absolute;
right: 0;
li {
float: left;
padding: 0 14px;
color: #fff;
font-weight: 400 !important;
font-size: 14px;
line-height: 56px;
list-style: none;
span {
padding-right: 6px;
font-size: 16px;
}
a {
color: #fff;
}
}
}
}
.auction-start-time {
margin-top: 4px;
padding: 2px 0px;
color: #b30000;
background: #f2f2f2;
font-size: 90%;
font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
text-align: center;
border-radius: 3px;
}
.auction-final-time {
margin-top: 4px;
padding: 2px 0px;
color: #b30000;
font-size: 90%;
font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
text-align: center;
border: 1px solid #b30000;
border-radius: 3px;
}
.site-input-group-wrapper .site-input-split {
background-color: #fff;
}
.site-input-group-wrapper .site-input-right {
border-left-width: 0;
}
.site-input-group-wrapper .site-input-right {
border-left-width: 0;
}
.site-input-group-wrapper .site-input-right:hover,
.site-input-group-wrapper .site-input-right:focus {
border-left-width: 1px;
}
.site-input-group-wrapper .ant-input-rtl.site-input-right {
border-right-width: 0;
}
.site-input-group-wrapper .ant-input-rtl.site-input-right:hover,
.site-input-group-wrapper .ant-input-rtl.site-input-right:focus {
border-right-width: 1px;
}
.auction-wks-tag {
position: absolute;
top: 4px;
left: 4px;
margin: 0px;
font-size: 90%;
padding: 3px 12px;
background: #aaaaaa;
color: #fff;
border: none;
}
.auction-jpz-tag {
position: absolute;
top: 4px;
left: 4px;
margin: 0px;
font-size: 90%;
padding: 3px 12px;
background: #b30000;
color: #fff;
border: none;
}

View File

@ -0,0 +1,296 @@
import React, { useEffect, useRef, useState } from 'react';
import { Avatar, Card, DatePicker, Descriptions, Input, List, Radio, Space, Tag, Typography } from 'antd';
import './index.less';
import styles from './index.less';
import logo from '@/images/opening/logo.svg';
import { UserSwitchOutlined, CarryOutOutlined, EnvironmentOutlined } from '@ant-design/icons';
import moment from 'moment';
import { getSessionUserData } from '@/utils/session';
import { getProvince } from '../AuctionAnnouncementData/service';
import { getList, getSfbm } from './service';
import { saveDateTimeFormatter } from '@/utils/DateUtils';
import { isNotEmpty } from '@/utils/CommonUtils';
export default () => {
//获取用户数据
let userData = getSessionUserData();
//省数据
const [sfbms, setSfbms] = useState<string[]>([]);
//商品列表数据
const [productList, setProductList] = useState<any[]>([]);
//loading
const [loading, setLoading] = useState<boolean>(false);
//所属省份
const sfbm = useRef<string>('all');
//拍卖状态
const zt = useRef<string>('all');
//当前/起拍价-最低价
const zdjg = useRef<string>('');
//当前/起拍价-最高价
const zgjg = useRef<string>('');
//拍卖时间-开始日期
const kssj = useRef<string>('');
//拍卖时间-结束日期
const jssj = useRef<string>('');
//省字典
const provinces = useRef<any[]>([]);
//最低价ref
const zdjgRef = useRef<any>();
//最高价ref
const zgjgRef = useRef<any>();
//页码
const pageNo = useRef<number>(1);
const { Text } = Typography;
//查询
const getParticipateList = async () => {
const params = {
pageNo: pageNo.current,
pageSize: 12,
}
sfbm.current != 'all' ? params['sfbm'] = [sfbm.current] : null;
zt.current != 'all' ? params['zt'] = zt.current : null;
isNotEmpty(zdjg.current) ? params['zdjg'] = zdjg.current : null;
isNotEmpty(zgjg.current) ? params['zgjg'] = zgjg.current : null;
isNotEmpty(kssj.current) ? params['kssj'] = kssj.current : null;
isNotEmpty(jssj.current) ? params['jssj'] = jssj.current : null;
setLoading(true);
await getList(params).then(res => {
if (res?.code == 200) {
setProductList(res?.data.records);
}
}).finally(() => {
setLoading(false);
})
}
//获取省份字典及数据
const getProvinces = async () => {
await getProvince().then(res => {
if (res?.code == 200) {
provinces.current = res?.data;
}
})
//获取省份数据
await getSfbm().then(res => {
if (res?.code == 200) {
setSfbms(res?.data);
}
})
}
//省份名称转换
const getProvinceName = (id: string) => {
if (provinces.current.length > 0) {
for (const item of provinces.current) {
if (item.id == id) {
return item.name;
}
}
}
return null;
}
const sfbmChange = (e: any) => {
sfbm.current = e.target.value;
pageNo.current = 1;
getParticipateList();
}
const bidOpeningStatusChange = (e: any) => {
zt.current = e.target.value;
pageNo.current = 1;
getParticipateList();
}
const zdjgBlur = (e: any) => {
e.persist();
if (zdjg.current !== e.target.value) {
zdjg.current = e.target.value;
pageNo.current = 1;
getParticipateList();
}
}
const zgjgBlur = (e: any) => {
e.persist();
if (zgjg.current !== e.target.value) {
zgjg.current = e.target.value;
pageNo.current = 1;
getParticipateList();
}
}
const sjChange = (times: any) => {
if (times?.length > 0) {
kssj.current = saveDateTimeFormatter(times[0].startOf('day'));
jssj.current = saveDateTimeFormatter(times[1].endOf('day'));
pageNo.current = 1;
getParticipateList();
} else {
kssj.current = '';
jssj.current = '';
pageNo.current = 1;
getParticipateList();
}
}
const pageChange = (page: number) => {
pageNo.current = page;
getParticipateList();
}
//点击商品进入详情
const cardClick = (id: string) => {
console.log('cardClick', id)
let projectData = {
id: id
};
sessionStorage.setItem('projectData', JSON.stringify(projectData));
window.open("/AuctionParticipateDetail");
}
useEffect(() => {
getProvinces();
getParticipateList();
}, []);
return (
<div>
<div className={styles.header}>
<div className={styles.headerAlign} style={{ position: "absolute", left: "0px", top: "15px", fontSize: "16px", fontWeight: "600" }}>
<img src={logo} style={{ height: "30px", marginRight: "10px", position: 'relative', top: '-2px' }} />
</div>
<ul className={styles.rightBtns}>
<li><CarryOutOutlined />{moment().format("YYYY-MM-DD")}</li>
{userData?.organizationName == null ? null : (<li><UserSwitchOutlined />{userData.organizationName}</li>)}
<li>
<Avatar size="small" src="https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png" style={{ width: '30px' }} />
<a className="antd-dropdown-link" style={{ color: "#fff", marginRight: "36px" }}>
{userData.fullName}
</a>
</li>
</ul>
</div>
<div style={{ display: 'flex', justifyContent: 'center', height: innerHeight - 57, overflowY: 'auto' }}>
<div style={{ width: 1248 }}>
<Descriptions
bordered={true}
column={1}
labelStyle={{ background: '#f2f2f2', width: '15%', textAlign: 'center' }}
contentStyle={{ padding: "12px 20px" }}
style={{ margin: '16px 0px' }}
>
<Descriptions.Item label="所属省份">
<Radio.Group defaultValue="all" buttonStyle="solid" onChange={sfbmChange}>
<Space wrap>
<Radio.Button value="all" key="all"></Radio.Button>
{sfbms.map(item => <Radio.Button value={item} key={item}>{getProvinceName(item)}</Radio.Button>)}
</Space>
</Radio.Group>
</Descriptions.Item>
<Descriptions.Item label="拍卖状态">
<Radio.Group defaultValue="all" buttonStyle="solid" onChange={bidOpeningStatusChange}>
<Space wrap>
<Radio.Button value="all"></Radio.Button>
<Radio.Button value="0"></Radio.Button>
<Radio.Button value="1"></Radio.Button>
</Space>
</Radio.Group>
</Descriptions.Item>
<Descriptions.Item label="当前/起拍价">
<div className="site-input-group-wrapper">
<Input.Group compact>
<Input
style={{ width: 150, textAlign: 'center' }}
placeholder="最低价"
prefix="¥"
allowClear
maxLength={11}
type="number"
ref={zdjgRef}
id="zdjgId"
onBlur={(event) => zdjgBlur(event)}
onPressEnter={() => zdjgRef.current.blur()}
/>
<Input
className="site-input-split"
style={{
width: 30,
borderLeft: 0,
borderRight: 0,
pointerEvents: 'none',
}}
placeholder="~"
disabled
/>
<Input
className="site-input-right"
style={{
width: 150,
textAlign: 'center',
}}
placeholder="最高价"
allowClear
maxLength={11}
type="number"
ref={zgjgRef}
onBlur={(event) => zgjgBlur(event)}
onPressEnter={() => zgjgRef.current.blur()}
/>
</Input.Group>
</div>
</Descriptions.Item>
<Descriptions.Item label="开拍时间">
<DatePicker.RangePicker style={{ width: '328px' }} onChange={sjChange} />
</Descriptions.Item>
</Descriptions>
<List
grid={{ gutter: 16, column: 4 }}
dataSource={productList}
loading={loading}
pagination={{
size: "small",
hideOnSinglePage: true,
onChange: page => pageChange(page),
pageSize: 12,
}}
renderItem={item => (
<List.Item>
<Card
hoverable
bodyStyle={{
padding: 0,
MozUserSelect: 'none',/* Firefox私有属性 */
WebkitUserSelect: 'none',/* WebKit内核私有属性 */
msUserSelect: 'none',/* IE私有属性(IE10及以后) */
userSelect: 'none'/* CSS3属性 */
}}
cover={
<img
alt="example"
height="245px"
src="https://gw.alipayobjects.com/zos/rmsportal/JiqGstEfoWAOHiTxclqi.png"
/>
}
onClick={() => cardClick(item.id)}
>
<div className={item.bidOpeningStatus == "0" ? 'auction-start-time' : 'auction-final-time'}>
{item.bidOpeningStatus == "0" ? `竞拍开始时间:${moment(item.jpkssj).format('YYYY年MM月DD日HH时mm分ss秒')}` : `竞拍结束时间:${moment(item.jpjssj).format('YYYY年MM月DD日HH时mm分ss秒')}`}
</div>
<div style={{ padding: "10px 12px 12px 16px" }}>
<div>
<Text>{item.projectName}</Text>
</div>
<div style={{ marginTop: 6 }}>
<div style={{ textAlign: 'right' }}>
<Text style={{ fontSize: '90%' }}>
<EnvironmentOutlined style={{ color: '#aaaaaa' }} />{getProvinceName(item.sfbm)}
</Text>
</div>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'flex-end' }}>
<Text strong style={{ fontSize: 'large', color: item.bidOpeningStatus == "0" ? '#4b7902' : '#b30000' }}>{item.bidOpeningStatus == "0" ? `起拍价:${item.qpjg}` : `当前价:${item.dqjg}`}</Text>
<Text type={item.bidOpeningStatus == "0" ? "secondary" : void 0} style={{ fontSize: '90%' }}>{item.offerNumber}</Text>
</div>
</div>
</div>
<Tag className={item.bidOpeningStatus == "0" ? "auction-wks-tag" : "auction-jpz-tag"}>{item.bidOpeningStatus == "0" ? '未开始' : '竞拍中'}</Tag>
</Card>
</List.Item>
)}
/>
</div>
</div>
</div>
)
};

View File

@ -0,0 +1,20 @@
import request from '@/utils/request';
/**
* 获取省份数据
* @returns
*/
export async function getSfbm() {
return request('/api/biz-service-ebtp-auction/v1/innerShot/getProvince');
}
/**
* 查询商品列表
* @param data
* @returns
*/
export async function getList(data: any) {
return request('/api/biz-service-ebtp-auction/v1/innerShot/libraryTube/getPageList', {
method: 'POST',
data: data,
});
}