Commit 5d88c0e2 authored by cellee's avatar cellee

预约时间在用户已预约做限制,修复预约提示时间报错,文案更改,优化其他页面加载

Signed-off-by: cellee's avatarcellee <893264950@qq.com>
parent 70457ec7
......@@ -6,10 +6,43 @@ import moment from 'moment';
const OnTime = (porps: any) => {
// placeholder 默认显示 disabled 是否禁止
// openSelect 选中函数 limit 限制时间 type 类型 时开始还是结束 1 就是结束 结尾是59
// defaultValue 默认时间
let { placeholder, disabled, openSelect, limit, type, defaultValue } = porps;
// defaultValue 默认时间 inhibitTime 禁止选择时间
let { placeholder, disabled, openSelect, limit, type, defaultValue, inhibitTime } = porps;
const [imgOpen, setImgOpen] = useState(null as any);
// 已经预约时间禁止
const [Scheduled, setScheduled] = useState(null as any);
// 禁止选择时间
useEffect(() => {
if (inhibitTime != null) {
let arrs = '' as any;
inhibitTime.forEach((element: any) => {
let strArr = cutOut(element);
arrs = arrs + strArr;
});
let confirm = [...new Set(arrs.substr(0, arrs.length - 1).split(','))];
console.log(confirm);
let newConfirm = [] as any;
confirm.forEach((element: any) => {
return newConfirm.push(parseInt(element));
});
console.log(newConfirm);
setScheduled(newConfirm);
}
}, [inhibitTime]);
// 时间截取
function cutOut(str: any) {
var one = str.indexOf(':');
let str1 = parseInt(str.substring(0, one));
let str2 = parseInt(str.match(/-(\S*):/)[1]);
let arr = '';
for (let i = str1; i <= str2; i++) {
arr = `${arr}${i},`;
}
return arr;
}
useEffect(() => {
if (defaultValue != null) {
......@@ -52,6 +85,10 @@ const OnTime = (porps: any) => {
parseInt(item) >= parseInt(openTime.slice(0, 2)) &&
parseInt(item) <= parseInt(openTime.slice(6, 8))
) {
if (Scheduled && Scheduled.indexOf(parseInt(item)) != -1) {
// 如果存在有预约的时间 且在数组里面,就禁止选择
return true;
}
return false;
} else {
return true;
......
......@@ -122,7 +122,7 @@ export default {
yield put({ type: 'returnResult', Result });
break;
case 11:
Result ={index:playload.index,msg:"Information Wrong!"};
Result ={index:playload.index,msg:resp.error_msg};
yield put({ type: 'returnResult', Result });
break;
}
......
......@@ -16,13 +16,12 @@ import {
} from 'antd';
// 样式
import './celllist.less';
import { RA, ResultClear } from '@/utils/method';
import { RA } from '@/utils/method';
import { history } from 'umi';
import { village } from '@/utils/tip';
import moment from 'moment';
import { getNumber } from '@/utils/string'; // 正则
import imgs from '@/assets/logo_icon_bg.png';
import FileViewer from 'react-file-viewer';
import PDF from 'react-pdf-js';
......@@ -35,16 +34,10 @@ interface objc {}
const Adds = (props: any) => {
const module = 'CellList';
const { Data, dispatch, loading, Result, imgUrl } = props;
const { Data, dispatch, loading, imgUrl } = props;
const [form] = Form.useForm();
//物业费选择
const plainOptions = [
{ label: 'Online Payment', value: '0', disabled: true },
{ label: 'Offline Payment', value: '1' },
];
const [PropertyFee, setPropertyFee] = useState(['1']); // 表单物业费提交值
const [loubaUpload, setLouba] = useState([] as any); // 楼巴上传列表
......
import React, { useState, useEffect } from 'react';
import { connect } from 'dva';
import {
LeftOutlined,
EyeOutlined,
PoweroffOutlined,
SnippetsOutlined,
ApiTwoTone,
} from '@ant-design/icons';
import { Modal, Input, Button, Spin, Checkbox, Image, message, Divider, Avatar } from 'antd';
import { LeftOutlined, EyeOutlined, PoweroffOutlined } from '@ant-design/icons';
import { Modal, Input, Button, Spin, Checkbox, Image, message, Divider } from 'antd';
import { history } from 'umi';
// 样式
import './celllist.less';
import { RA } from '@/utils/method';
import img from '@/assets/logo_icon_color.png';
import imgs from '@/assets/logo_icon_bg.png';
import hfor from '@/assets/h5.png';
import PreView from '@/components/PreView';
import moment from 'moment';
import Axios from 'axios';
import fileDownload from 'js-file-download';
......@@ -28,7 +19,7 @@ import fileDownload from 'js-file-download';
const Detail = (props: any) => {
const module = 'CellList';
const { detailData, DataSave, dispatch, loading, imgUrl, overCom } = props;
const { detailData, DataSave, dispatch, loading, overCom } = props;
useEffect(() => {
if (DataSave) {
......@@ -39,14 +30,6 @@ const Detail = (props: any) => {
}
}, [1]);
// 下载
// useEffect(() => {
// if (imgUrl != null) {
// // console.log('变化了'); 开始下载
// openDows(imgUrl.url, imgUrl.name);
// }
// }, [imgUrl]);
useEffect(() => {
if (overCom != null) {
message.success(`Community Deleted Successfully`);
......
import React, { useState, useEffect, useRef } from 'react';
import { Input, Tabs, message, Form, Button, DatePicker, Spin } from 'antd';
const { TabPane } = Tabs;
import { Input, Form, Button, DatePicker, Spin } from 'antd';
import { connect, history } from 'umi';
import { RA, SA } from '@/utils/method';
import { RA } from '@/utils/method';
import TitleBack from '@/components/TitleBack/TitleBack';
// import FileUpload from '@/components/FileUpload/FileUpload';
import { validateMessages } from '@/utils/params';
import PictureOptionsRow from '@/components/PictureOptions/PictureOptionsRow';
import TextArea from 'antd/lib/input/TextArea';
import SelectCommunity from '@/components/SelectCommunity';
// import Line from '@/components/Line/Line';
// import TimeComfirm from '@/components/TimeComfirm/TimeComfirm';
import imgs from '@/assets/logo_icon_bg.png';
import './ann.less';
import { Notice } from '@/utils/tip';
import { getCookie } from '@/utils/method';
import moment from 'moment';
import ShowOptions from '@/components/ShowOptions/index';
......@@ -24,14 +17,11 @@ import ShowOptions from '@/components/ShowOptions/index';
const module = 'CommunityAnnouncement';
const Add = (props: any) => {
const { dispatch, Result, loading, DataSave, ImgSrc } = props;
const { dispatch, loading, DataSave, ImgSrc } = props;
const formRef = useRef(null);
const [form] = Form.useForm();
const [ImageSrc, setImageSrc] = useState([] as any); // 图片显示地址
const [ImageName, setImageName] = useState([] as any); // 全部图片名称
const [timeT, settimeT] = useState(true); // 结束时间是否禁止选择
const [timeOver, settimeOver] = useState(1); // 结束时间禁止天数
// 监听传递过来的值
useEffect(() => {
......@@ -54,11 +44,6 @@ const Add = (props: any) => {
fileName: DataSave.noticImageName,
};
RA(47, msg, module, dispatch);
// 解除结束时间不可选
settimeT(false);
// 图片名
setImageName(DataSave.noticImageName);
}
}, [DataSave]);
......
import React, { useState, useEffect, useRef } from 'react';
import styles from './css/index.less';
import './css/index.less';
import {
InputNumber,
Descriptions,
Spin,
Space,
Form,
Radio,
Modal,
Row,
Col,
Button,
message,
} from 'antd';
import { InputNumber, Descriptions, Spin, Form, Radio, Modal, Button, message } from 'antd';
import moment from 'moment';
import { Link, useIntl, connect, Dispatch } from 'umi';
import { connect } from 'umi';
import TitleBack from '../../../components/TitleBack/TitleBack';
import Line from '../../../components/Line/Line';
import { timestampToTime3 } from '../../../utils/time';
import TextArea from 'antd/lib/input/TextArea';
import { getUrlLast } from '../../../utils/string';
import { merge } from 'lodash';
const BookingDetail = (props: any) => {
const { dispatch, location, DataSave, DataSaveDetail, token, load } = props;
console.log(DataSave);
const { dispatch, location, DataSave, history, DataSaveDetail, token, load } = props;
const RA = (index: any, values: any) => {
dispatch({ type: 'FacilityBookings/RA', playload: { index: index, body: values } });
};
useEffect(() => {
if (DataSave != null && DataSave.managerFeeStatus != 0) {
RA(2, { accountCategoriesId: DataSave.id });
if (DataSave != null) {
// 已预约时间段
let arr = DataSave.subscribeTime.split(',');
let time1 = parseInt(moment(arr[0], 'HH:mm').format('hh'));
let time2 = parseInt(moment(arr[arr.length - 1], 'HH:mm').format('hh'));
let Time = '';
for (let i = time1; i <= time2; i++) {
Time = `${Time}${i}:00,`;
}
setExtractTime(Time);
if (DataSave.managerFeeStatus != 0) {
RA(2, { accountCategoriesId: DataSave.id });
}
} else {
history.push('/CommunityManagement/FacilityBookings');
}
}, [DataSave]);
......@@ -48,6 +45,7 @@ const BookingDetail = (props: any) => {
const [modalItem, setModalIteme] = useState({ title: '', tab: 1 });
const [backFeeFlag, setBackFeeFlag] = useState(false); // 部分退费 与 全部退费
const [curbackFee, setCurBackFee] = useState(0);
const [ExtractTime, setExtractTime] = useState(null as any); // 已预约时间段
// 设置默认全款退费
useEffect(() => {
......@@ -85,7 +83,6 @@ const BookingDetail = (props: any) => {
marginFee: DataSaveDetail.marginFee.toString(),
};
console.log(RAVAL);
RA(3, RAVAL);
}
};
......@@ -159,7 +156,7 @@ const BookingDetail = (props: any) => {
{DataSave.facilityTitle}
</Descriptions.Item>
<Descriptions.Item label="Booking Time">
{DataSave.subscribeDate} {DataSave.subscribeTime}
{DataSave.subscribeDate} {ExtractTime}
</Descriptions.Item>
<Descriptions.Item label="User Name">{DataSave.accountName}</Descriptions.Item>
<Descriptions.Item label="Contact Number">{DataSave.accountPhone}</Descriptions.Item>
......
import React, { useState, useEffect, useRef } from 'react';
import styles from './css/Bookings.less';
import './css/Bookings.less';
import {
Spin,
Input,
DatePicker,
Button,
Form,
Radio,
TimePicker,
Row,
Col,
message,
Select,
} from 'antd';
const { RangePicker } = TimePicker;
import { Spin, Input, DatePicker, Button, Form, Radio, Row, Col, message } from 'antd';
import { DollarOutlined, ClockCircleOutlined } from '@ant-design/icons';
......@@ -24,7 +11,6 @@ import TitleBack from '../../../components/TitleBack/TitleBack';
import SearchOptionsCommnity from '../../../components/SearchOptions/SearchOptionsCommnity';
import { numberToString } from '../../../utils/string';
import { checkData, checkInput } from '@/utils/method';
import { validateMessages } from '@/utils/params';
// 日期
......@@ -62,15 +48,13 @@ const Bookings = (props: any) => {
const formRef = useRef(null as any);
const [prohibit, setProhibit] = useState(true); // 输入框是否不可选
const [result, setResultTime] = useState(resultTime); // 已预约时间段
const [result, setResultTime] = useState(null as any); // 已预约时间段
const [soltTime, setSoltTime] = useState(['', '']); // 已选时间
const [bookTime, setBookTime] = useState(1); // 默认延后预订时间
useEffect(() => {
if (DataSave != null) {
console.log('页面进入参数');
console.log(DataSave);
setComminityValues(DataSave.communityName);
RA(1, { userToken: token, communityName: DataSave.communityName, facilitieId: DataSave.id });
}
......@@ -82,7 +66,6 @@ const Bookings = (props: any) => {
useEffect(() => {
if (Result != null) {
console.log(Result);
message.error(Result.msg);
if (Result.index == 1) {
IA();
......@@ -92,7 +75,6 @@ const Bookings = (props: any) => {
}
}, [Result]);
console.log(Data3);
// 选择小区监听是不是有值
useEffect(() => {
setLoading(false);
......@@ -145,11 +127,6 @@ const Bookings = (props: any) => {
message.error('Please Fill In The Contact Information Correctly!');
return false;
}
// tmp.categoriesId = null
// tmp.facilitiesId = null
// tmp.communityName = null
// tmp.communityManagerFee = null
// tmp.communityMargin=null
if (value.categoriesName != null) {
tmp.categoriesId = value.categoriesName.categoriesId;
tmp.facilitiesId = value.categoriesName.facilitiesId;
......@@ -169,26 +146,21 @@ const Bookings = (props: any) => {
}
if (tmp.accountName.length < 2) {
message.error('User Name Should be limit 2~30!', 3);
} else if (
soltTime &&
moment(soltTime[0], 'HH:mm').format('hh') > moment(soltTime[1], 'HH:mm').format('hh')
) {
// 判断选的时间 是不是结束时间小于开始时间
message.error('Appointment time range error');
} else {
tmp.reservedTimeList = soltTime; // 预约时间
RA(11, tmp);
//还差检测
// if (checkParam(tmp)) {
// console.log(tmp);
// RA(11, tmp);
// } else {
// message.error('Error,Please Finish It,Not Empty!', 3);
// }
}
// console.log(checkParam(tmp))
// console.log(comminityValues)
// console.log(tmp)
};
// 选择设施
const RadioChoose = (e: any) => {
Data3.map((item: any, index: any) => {
item.categorieList.map((thing: any, i: any) => {
console.log(thing);
if (thing.categoriesId == e.target.value.categoriesId) {
setCurString({
communityManagerFee: parseInt(item.communityManagerFee).toFixed(2),
......@@ -202,8 +174,6 @@ const Bookings = (props: any) => {
setProhibit(false);
// 赋值给延后天数
setBookTime(-item.canReservationDay + 1);
// console.log(item.communityManagerFee)
// console.log(item.communityMargin)
}
});
});
......@@ -390,6 +360,7 @@ const Bookings = (props: any) => {
limit={curString.categoriesOpenTime}
openSelect={startTimes}
type={0}
inhibitTime={result}
/>
</Form.Item>
<span className="diyspan"> </span>
......@@ -472,7 +443,6 @@ function mapStateToProps(state: any) {
typeof state.loading.models.FacilityBookings == 'undefined'
? true
: state.loading.models.FacilityBookings;
console.log(Data3);
const { token } = state.login;
return {
Data3,
......
......@@ -17,11 +17,9 @@ const managerFeeStatusDes = ['Not paid', 'Paid', 'Returned'];
const marginFeeStatusDes = ['Not paid', 'Paid', 'Not Returned', 'Returned part', 'Returned all'];
const statusDes = ['All', 'Applied', 'Reserved', 'Used', 'Cancelled', 'Completed'];
import { getUrlLastParams } from '../../../utils/string';
import './css/index.less';
import ProTable from '@ant-design/pro-table';
import { PlusOutlined, ClockCircleOutlined, ClearOutlined } from '@ant-design/icons';
import { PlusOutlined } from '@ant-design/icons';
import moment from 'moment';
......
......@@ -17,9 +17,6 @@ const module = 'VisitorRecord';
const VisitorRecord = (props: any) => {
const { dispatch, Data, DataSave, loading } = props;
useEffect(() => {
RA(26, { inviterAddress: '', visitorCommunity: '' }, module, dispatch);
}, [1]);
const TosVisitorRecordGet = (values: any) => {
dispatch({ type: 'tosVisitorRecord/get', playload: values });
};
......@@ -30,6 +27,8 @@ const VisitorRecord = (props: any) => {
Data.forEach((item: any) => {
item.showTime = moment(item.updateTime).format('YYYY-MM-DD');
});
} else {
RA(26, { inviterAddress: '', visitorCommunity: '' }, module, dispatch);
}
}, [Data]);
......@@ -140,6 +139,7 @@ const VisitorRecord = (props: any) => {
// 刷新
const onReset = () => {
SA(DataSave, module, dispatch);
RA(26, { inviterAddress: '', visitorCommunity: '' }, module, dispatch);
};
// 去掉null undefined 无效字段
......
......@@ -17,9 +17,6 @@ const module = 'VisitorRecord';
const VisitorRecord = (props: any) => {
const { dispatch, Data, DataSave, loading } = props;
useEffect(() => {
RA(26, { inviterAddress: '', visitorCommunity: '' }, module, dispatch);
}, [1]);
const TosVisitorRecordGet = (values: any) => {
dispatch({ type: 'tosVisitorRecord/get', playload: values });
};
......@@ -30,6 +27,8 @@ const VisitorRecord = (props: any) => {
Data.forEach((item: any) => {
item.showTime = moment(item.updateTime).format('YYYY-MM-DD');
});
} else {
RA(26, { inviterAddress: '', visitorCommunity: '' }, module, dispatch);
}
}, [Data]);
......@@ -140,6 +139,7 @@ const VisitorRecord = (props: any) => {
// 刷新
const onReset = () => {
SA(DataSave, module, dispatch);
RA(26, { inviterAddress: '', visitorCommunity: '' }, module, dispatch);
};
// 去掉null undefined 无效字段
......
import React, { useState, useEffect } from 'react';
import { Space, Button, message, Pagination, Form, Input, Tooltip } from 'antd';
import { connect, history, Loading } from 'umi';
import { connect, history } from 'umi';
import { PlusOutlined, SearchOutlined, ClearOutlined } from '@ant-design/icons';
import ProTable from '@ant-design/pro-table';
import moment from 'moment';
import styles from './ContractContent.less';
import { RA } from '@/services/tos';
import SearchOptionsCommnity from '@/components/SearchOptions/SearchOptionsCommnity';
const Contract = (props: any) => {
const { location, dispatch, Contract, loading } = props;
const { Data, DataSave, DataSaveDetail, Result } = Contract;
const { Data } = Contract;
// 把请求装在一个地方
const RA = (index: any, values: any) => {
dispatch({ type: 'Contract/RA', playload: { index: index, body: values } });
};
function requst(payload: any) {
dispatch({ type: 'Contract/getList', payload: payload });
}
// 数据
useEffect(() => {
if (Data == null) {
......
import React, { useState, useEffect, useRef } from 'react';
import React, { useState, useEffect } from 'react';
import styles from './ContractContent.less';
import {
Input,
Form,
message,
Upload,
Button,
DatePicker,
Pagination,
Modal,
Spin,
Image,
} from 'antd';
import { PlusOutlined, LeftOutlined } from '@ant-design/icons';
import { Link, useIntl, connect, history, Loading } from 'umi';
import { RA } from '@/services/tos';
import { Input, Form, message, Upload, DatePicker, Pagination, Modal, Spin, Image } from 'antd';
import { LeftOutlined } from '@ant-design/icons';
import { connect, history } from 'umi';
import LINE from '../../components/Line/Line';
import TextArea from 'antd/lib/input/TextArea';
......@@ -23,15 +10,11 @@ import TextArea from 'antd/lib/input/TextArea';
import PDF from 'react-pdf-js';
import moment from 'moment';
import './ContractContent.less';
// 配置英文
import 'moment/locale/en-au';
import locale from 'antd/es/date-picker/locale/en_US';
import SearchOptionsCommnity from '@/components/SearchOptions/SearchOptionsCommnity';
import { tipList } from '@/utils/tip';
import FileViewer from 'react-file-viewer';
import { stringSplit } from '@/utils/string';
const ContractContent = (props: any) => {
const { Contract, dispatch, FileImg, loading } = props;
......@@ -341,7 +324,6 @@ const ContractContent = (props: any) => {
rules={[{ required: true, message: `${tipList[5]}` }]}
>
<RangePicker
locale={locale}
defaultValue={DataSaveDetail ? DataSaveDetail.time : null}
disabledDate={disabledDate}
placeholder={['Effective Date', 'Expiration Date']}
......@@ -400,7 +382,6 @@ const ContractContent = (props: any) => {
<span style={{ color: 'red' }}>*</span> If the time has passed, it will not be
sent
</p>
{/* <span style={{color:'#f00'}}>&nbsp;{stateTime}</span> */}
</div>
</div>
......@@ -424,7 +405,6 @@ const ContractContent = (props: any) => {
// pdf 换一种
<>
<PDF
// file={stringSplit(fileInfo.url, 'm/cash')}
file={fileInfo.url}
page={pageNumber}
scale={1.25}
......@@ -447,11 +427,7 @@ const ContractContent = (props: any) => {
style={{ margin: '0 auto', textAlign: 'center' }}
/>
) : (
<FileViewer
fileType={fileInfo.type}
// filePath={stringSplit(fileInfo.url, 'm/cash')}
filePath={fileInfo.url}
/>
<FileViewer fileType={fileInfo.type} filePath={fileInfo.url} />
)
) : (
''
......
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