Commit e5659671 authored by cellee's avatar cellee

新增预约可用次数接口

Signed-off-by: cellee's avatarcellee <893264950@qq.com>
parent 269f1bbb
...@@ -35,11 +35,6 @@ const Facilitys = (props: any) => { ...@@ -35,11 +35,6 @@ const Facilitys = (props: any) => {
return data; return data;
}; };
//绑定值
const updetaList = (key: any) => {
return FacilitysList[key].fileList;
};
// 预览 // 预览
const handlePreview = async (file: any) => { const handlePreview = async (file: any) => {
if (!file.url && !file.preview) { if (!file.url && !file.preview) {
...@@ -67,6 +62,7 @@ const Facilitys = (props: any) => { ...@@ -67,6 +62,7 @@ const Facilitys = (props: any) => {
// 拿到key 值 开始存储 // 拿到key 值 开始存储
let key = info.fileList[0].response.data.identification; let key = info.fileList[0].response.data.identification;
let list = FacilitysList; let list = FacilitysList;
list[key] = { list[key] = {
id: key, id: key,
fileList: info.fileList, fileList: info.fileList,
......
...@@ -31,6 +31,8 @@ export default { ...@@ -31,6 +31,8 @@ export default {
NoticeList: [], NoticeList: [],
resultTime: null, // 设施已预约时间段 resultTime: null, // 设施已预约时间段
FacilitysList: [],// 动态新增组件 FacilitysList: [],// 动态新增组件
Remaining:null,
}, },
reducers: { reducers: {
...@@ -79,6 +81,11 @@ export default { ...@@ -79,6 +81,11 @@ export default {
return { ...state, resultTime }; return { ...state, resultTime };
}, },
// 可预约次数
Remaining(state, { Remaining }) {
return { ...state, Remaining };
},
}, },
effects: { effects: {
...@@ -142,15 +149,11 @@ export default { ...@@ -142,15 +149,11 @@ export default {
case 7: { case 7: {
let tmp = resp.data; let tmp = resp.data;
const reg = [ const reg = [
['id','id'],
["url", "categoriesImageUrl"], ["url", "categoriesImageUrl"],
["name", "categoriesName"], ["name", "categoriesName"],
['imgName','categoriesImageName'] ['imgName','categoriesImageName']
] ]
const reg2 = [["url", null]]
//let sourceData = tmp;
// sourceData.categoriesOpenTime= timeToMoment(tmp.categoriesOpenTime);
// sourceData.categoriesName = Fromate(tmp.categoriesList, reg),
// sourceData.categoriesDetailsImageName = Fromate(tmp.facilitiesImageList, reg2)
let sourceData = { let sourceData = {
canReservationDay: tmp.canReservationDay, canReservationDay: tmp.canReservationDay,
...@@ -167,7 +170,6 @@ export default { ...@@ -167,7 +170,6 @@ export default {
categoriesName: Fromate(tmp.categoriesList, reg), categoriesName: Fromate(tmp.categoriesList, reg),
categoriesDetailsImageName:Fromate3(tmp.facilitiesImageList) categoriesDetailsImageName:Fromate3(tmp.facilitiesImageList)
} }
console.log(sourceData)
yield put({ type: 'returnSource', sourceData }); yield put({ type: 'returnSource', sourceData });
} break; } break;
...@@ -195,9 +197,16 @@ export default { ...@@ -195,9 +197,16 @@ export default {
let a = data[i] + '-' + data[i+1]; let a = data[i] + '-' + data[i+1];
resultTime.push(a); resultTime.push(a);
} }
console.log(resultTime)
yield put({ type: 'onResult', resultTime }); yield put({ type: 'onResult', resultTime });
}break; } break;
// 设施可预约次数
case 58: {
let Remaining = resp.data;
yield put({ type: 'Remaining', Remaining });
}
break;
} }
} }
...@@ -229,7 +238,13 @@ export default { ...@@ -229,7 +238,13 @@ export default {
// 更新列表 // 更新列表
*genxin({ list }, { put }) { *genxin({ list }, { put }) {
yield put({type: 'retImgsList', list}) yield put({type: 'retImgsList', list})
} },
//次数
*SetRemaining(state, { put }) {
let Remaining = null;
yield put({type: 'Remaining', Remaining})
},
}, },
......
...@@ -3,7 +3,7 @@ import styles from './css/Bookings.less'; ...@@ -3,7 +3,7 @@ import styles from './css/Bookings.less';
import './css/Bookings.less'; import './css/Bookings.less';
import { Spin, Input, DatePicker, Button, Form, Radio, Row, Col, message } from 'antd'; import { Spin, Input, DatePicker, Button, Form, Radio, Row, Col, message } from 'antd';
import { DollarOutlined, ClockCircleOutlined } from '@ant-design/icons'; import { DollarOutlined, ClockCircleOutlined, BarChartOutlined } from '@ant-design/icons';
import { connect } from 'umi'; import { connect } from 'umi';
...@@ -20,7 +20,7 @@ import { BookingsTip } from '@/utils/tip'; ...@@ -20,7 +20,7 @@ import { BookingsTip } from '@/utils/tip';
import OnTime from '@/components/OnTime/OnTime'; import OnTime from '@/components/OnTime/OnTime';
const Bookings = (props: any) => { const Bookings = (props: any) => {
const { dispatch, Data3, Result, DataSave, token, load, resultTime } = props; const { dispatch, Data3, Result, DataSave, token, load, resultTime, Remaining } = props;
const RA = (index: any, values: any) => { const RA = (index: any, values: any) => {
dispatch({ type: 'FacilityBookings/RA', playload: { index: index, body: values } }); dispatch({ type: 'FacilityBookings/RA', playload: { index: index, body: values } });
...@@ -41,6 +41,8 @@ const Bookings = (props: any) => { ...@@ -41,6 +41,8 @@ const Bookings = (props: any) => {
communityManagerFee: null, communityManagerFee: null,
communityMargin: null, communityMargin: null,
categoriesOpenTime: null, categoriesOpenTime: null,
categoriesId: null,
facilitiesId: null,
} as any); } as any);
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
...@@ -52,13 +54,20 @@ const Bookings = (props: any) => { ...@@ -52,13 +54,20 @@ const Bookings = (props: any) => {
const [bookTime, setBookTime] = useState(1); // 默认延后预订时间 const [bookTime, setBookTime] = useState(1); // 默认延后预订时间
const [Unit, setUnit] = useState({} as any); // 输入框的值
// 表单标识 // 表单标识
const [form] = Form.useForm(); const [form] = Form.useForm();
// 选择的小区名
useEffect(() => { useEffect(() => {
if (DataSave != null) { if (DataSave != null) {
setComminityValues(DataSave.communityName); setComminityValues(DataSave.communityName);
RA(1, { userToken: token, communityName: DataSave.communityName, facilitieId: DataSave.id }); RA(1, { userToken: token, communityName: DataSave.communityName, facilitieId: DataSave.id });
// 选择一次 清空一次次数 和 楼栋
dispatch({ type: 'FacilityBookings/SetRemaining' });
setUnit({});
} }
}, [DataSave]); }, [DataSave]);
...@@ -89,8 +98,6 @@ const Bookings = (props: any) => { ...@@ -89,8 +98,6 @@ const Bookings = (props: any) => {
setResultTime(null); setResultTime(null);
setSoltTime([]); setSoltTime([]);
} }
console.log(Data3);
}, [Data3]); }, [Data3]);
// 监听 已选时间段 // 监听 已选时间段
...@@ -100,23 +107,18 @@ const Bookings = (props: any) => { ...@@ -100,23 +107,18 @@ const Bookings = (props: any) => {
} }
}, [resultTime]); }, [resultTime]);
const format = 'HH:mm'; // 监听输入框是否全部输入完毕
useEffect(() => {
const checkParam = (values: any) => { if (Unit.buildNumber && Unit.floorNumber && Unit.roomNumber) {
var flag = true; RA(58, {
facilitiesId: curString.facilitiesId,
for (var i in values) { communityName: comminityValues,
// console.log(values[i]); buildNumber: `BLK ${Unit.buildNumber}`,
if (values[i] == null) { floorNumber: Unit.floorNumber,
flag = false; roomNumber: Unit.roomNumber,
} else { });
if (values[i].length == 0) {
flag = false;
}
}
} }
return flag; }, [Unit]);
};
// 保存提交 // 保存提交
const onFinish = (value: any) => { const onFinish = (value: any) => {
...@@ -131,6 +133,13 @@ const Bookings = (props: any) => { ...@@ -131,6 +133,13 @@ const Bookings = (props: any) => {
message.error('Please Fill In The Contact Information Correctly!'); message.error('Please Fill In The Contact Information Correctly!');
return false; return false;
} }
// 没有次数
if (Remaining == 0) {
message.error('No bookable times');
return false;
}
if (value.categoriesName != null) { if (value.categoriesName != null) {
tmp.categoriesId = value.categoriesName.categoriesId; tmp.categoriesId = value.categoriesName.categoriesId;
tmp.facilitiesId = value.categoriesName.facilitiesId; tmp.facilitiesId = value.categoriesName.facilitiesId;
...@@ -179,6 +188,10 @@ const Bookings = (props: any) => { ...@@ -179,6 +188,10 @@ const Bookings = (props: any) => {
// 再把提示时间删除 // 再把提示时间删除
setResultTime(null); setResultTime(null);
// 选择一次 清空一次次数 和楼栋
dispatch({ type: 'FacilityBookings/SetRemaining' });
setUnit({});
// 然后在做切换 // 然后在做切换
Data3.map((item: any, index: any) => { Data3.map((item: any, index: any) => {
item.categorieList.map((thing: any, i: any) => { item.categorieList.map((thing: any, i: any) => {
...@@ -223,7 +236,6 @@ const Bookings = (props: any) => { ...@@ -223,7 +236,6 @@ const Bookings = (props: any) => {
// 确认日期 // 确认日期
const confirmData = (value: any) => { const confirmData = (value: any) => {
console.log(value);
let data = { let data = {
categoriesId: curString.categoriesId, categoriesId: curString.categoriesId,
facilitiesId: curString.facilitiesId, facilitiesId: curString.facilitiesId,
...@@ -246,6 +258,20 @@ const Bookings = (props: any) => { ...@@ -246,6 +258,20 @@ const Bookings = (props: any) => {
setSoltTime(s); setSoltTime(s);
}; };
// 鼠标移走
const onBlur = (e: any) => {
switch (e.target.id) {
case 'basic_buildNumber':
setUnit({ ...Unit, buildNumber: e.target.value });
break;
case 'basic_floorNumber':
setUnit({ ...Unit, floorNumber: e.target.value });
break;
default:
setUnit({ ...Unit, roomNumber: e.target.value });
}
};
return ( return (
<div className={styles.base}> <div className={styles.base}>
{/* 头部组件v1.2 */} {/* 头部组件v1.2 */}
...@@ -298,7 +324,7 @@ const Bookings = (props: any) => { ...@@ -298,7 +324,7 @@ const Bookings = (props: any) => {
<Radio.Group onChange={RadioChoose}> <Radio.Group onChange={RadioChoose}>
{Data3.map((item: any, index: any) => { {Data3.map((item: any, index: any) => {
return ( return (
<li> <li key={index} style={{ lineHeight: '32px' }}>
<i <i
style={{ style={{
display: 'inline-block', display: 'inline-block',
...@@ -329,12 +355,16 @@ const Bookings = (props: any) => { ...@@ -329,12 +355,16 @@ const Bookings = (props: any) => {
<div className="box4 required" style={{ marginBottom: 25 }}> <div className="box4 required" style={{ marginBottom: 25 }}>
<div className={styles.box4item1}>Unit : </div> <div className={styles.box4item1}>Unit : </div>
<div className="divbox4"> <div className="divbox4">
<span className="jio" style={{ marginLeft: 0 }}>
BLK
</span>
<Form.Item name="buildNumber" rules={BookingsTip[2]}> <Form.Item name="buildNumber" rules={BookingsTip[2]}>
<Input <Input
placeholder="Blk" placeholder="Blk"
style={{ width: 80 }} style={{ width: 80 }}
disabled={prohibit} disabled={prohibit}
maxLength={10} maxLength={10}
onBlur={onBlur}
/> />
</Form.Item> </Form.Item>
<span className="jio">#</span> <span className="jio">#</span>
...@@ -344,11 +374,17 @@ const Bookings = (props: any) => { ...@@ -344,11 +374,17 @@ const Bookings = (props: any) => {
style={{ width: 80 }} style={{ width: 80 }}
disabled={prohibit} disabled={prohibit}
maxLength={10} maxLength={10}
onBlur={onBlur}
/> />
</Form.Item> </Form.Item>
<span className="heng">--</span> <span className="heng">--</span>
<Form.Item name="roomNumber" rules={BookingsTip[4]}> <Form.Item name="roomNumber" rules={BookingsTip[4]}>
<Input placeholder="Room" style={{ width: 80 }} disabled={prohibit} /> <Input
placeholder="Room"
style={{ width: 80 }}
disabled={prohibit}
onBlur={onBlur}
/>
</Form.Item> </Form.Item>
</div> </div>
</div> </div>
...@@ -460,6 +496,19 @@ const Bookings = (props: any) => { ...@@ -460,6 +496,19 @@ const Bookings = (props: any) => {
<ClockCircleOutlined style={{ color: '#999' }} /> {curString.categoriesOpenTime} <ClockCircleOutlined style={{ color: '#999' }} /> {curString.categoriesOpenTime}
</div> </div>
</div> </div>
{/* 可预约次数 */}
{Remaining ? (
<div className={styles.box6}>
<div className={styles.box6item1}>Remaining times : </div>
<div className={styles.box6item2}>
<BarChartOutlined style={{ color: '#999', marginRight: 10 }} />
<span style={{ color: '#f00' }}>{Remaining}</span> times
</div>
</div>
) : (
''
)}
</> </>
) : null} ) : null}
...@@ -481,7 +530,7 @@ const Bookings = (props: any) => { ...@@ -481,7 +530,7 @@ const Bookings = (props: any) => {
}; };
function mapStateToProps(state: any) { function mapStateToProps(state: any) {
const { Data3, Result, DataSave, resultTime } = state.FacilityBookings; const { Data3, Result, DataSave, resultTime, Remaining } = state.FacilityBookings;
const load = const load =
typeof state.loading.models.FacilityBookings == 'undefined' typeof state.loading.models.FacilityBookings == 'undefined'
? true ? true
...@@ -494,6 +543,7 @@ function mapStateToProps(state: any) { ...@@ -494,6 +543,7 @@ function mapStateToProps(state: any) {
token, token,
resultTime, resultTime,
load, load,
Remaining,
}; };
} }
export default connect(mapStateToProps)(Bookings); export default connect(mapStateToProps)(Bookings);
...@@ -33,7 +33,8 @@ const Facility = (props: any) => { ...@@ -33,7 +33,8 @@ const Facility = (props: any) => {
}; };
const [pictrueExtend, setPictrueExtend] = useState({ pic: null, pics: null, tab: 3 }); const [pictrueExtend, setPictrueExtend] = useState({ pic: null, pics: null, tab: 3 });
const [facilityDetail, setFacilityDetail] = useState(false); const [facilityDetail, setFacilityDetail] = useState(false); // 全部禁止
const [Community, setCommunity] = useState(false); // 小区全部禁止
const [PATHNAME, setPATHNAME] = useState(''); const [PATHNAME, setPATHNAME] = useState('');
const formRef = useRef(null as any); const formRef = useRef(null as any);
...@@ -69,13 +70,12 @@ const Facility = (props: any) => { ...@@ -69,13 +70,12 @@ const Facility = (props: any) => {
}; };
useEffect(() => { useEffect(() => {
if (sourceData != null) { if (sourceData != null) {
console.log(sourceData); setCommunity(true);
setCtyName(DataSave.communityName); setCtyName(DataSave.communityName);
setSoltTime(sourceData.reservationQuantumTime); // 设置时间 setSoltTime(sourceData.reservationQuantumTime); // 设置时间
// 中断 // 中断
// setPictrueExtend({tab:null,pic:null,pics:null}) // setPictrueExtend({tab:null,pic:null,pics:null})
// 设施图片默认值 // 设施图片默认值
let list: any = sourceData.categoriesName.map((item: any, index: any) => { let list: any = sourceData.categoriesName.map((item: any, index: any) => {
let sam = { let sam = {
...@@ -83,7 +83,7 @@ const Facility = (props: any) => { ...@@ -83,7 +83,7 @@ const Facility = (props: any) => {
name: item.name, name: item.name,
fileList: [ fileList: [
{ {
uid: index, uid: item.id,
name: item.imgName, name: item.imgName,
status: 'done', status: 'done',
url: item.url, url: item.url,
...@@ -97,6 +97,9 @@ const Facility = (props: any) => { ...@@ -97,6 +97,9 @@ const Facility = (props: any) => {
return sam; return sam;
}); });
console.log(sourceData);
console.log(list);
dispatch({ type: module + '/genxin', list }); dispatch({ type: module + '/genxin', list });
// 当是查看的时候禁止点击 // 当是查看的时候禁止点击
...@@ -110,8 +113,6 @@ const Facility = (props: any) => { ...@@ -110,8 +113,6 @@ const Facility = (props: any) => {
// 设置表单默认值 // 设置表单默认值
formRef.current.setFieldsValue(sourceData); formRef.current.setFieldsValue(sourceData);
console.log(Cycle);
} else { } else {
// 新增页面进来 先清一遍 图片列表 // 新增页面进来 先清一遍 图片列表
let list: any = []; let list: any = [];
...@@ -151,9 +152,13 @@ const Facility = (props: any) => { ...@@ -151,9 +152,13 @@ const Facility = (props: any) => {
let imgs: any = []; let imgs: any = [];
for (let i in FacilitysList) { for (let i in FacilitysList) {
imgs[i] = `${FacilitysList[i].name}&${FacilitysList[i].fileList[0].name}`; imgs[
i
] = `${FacilitysList[i].name}&${FacilitysList[i].fileList[0].name}&${FacilitysList[i].fileList[0].uid}`;
} }
console.log(imgs);
if (imgs.length == 0) { if (imgs.length == 0) {
// 图片设施判断 // 图片设施判断
message.error('Please Upload At Least One Facility!'); message.error('Please Upload At Least One Facility!');
...@@ -321,7 +326,7 @@ const Facility = (props: any) => { ...@@ -321,7 +326,7 @@ const Facility = (props: any) => {
// ubmit={extendName} // ubmit={extendName}
defaultName={DataSave != null ? DataSave.communityName : null} defaultName={DataSave != null ? DataSave.communityName : null}
opname={opname} opname={opname}
disabled={facilityDetail} disabled={facilityDetail || Community}
/> />
</Form.Item> </Form.Item>
...@@ -487,6 +492,7 @@ const Facility = (props: any) => { ...@@ -487,6 +492,7 @@ const Facility = (props: any) => {
placeholder="Second" placeholder="Second"
style={{ width: 120 }} style={{ width: 120 }}
disabled={facilityDetail} disabled={facilityDetail}
defaultValue={0}
suffix="Time(s)" suffix="Time(s)"
/> />
</Form.Item> </Form.Item>
......
...@@ -109,8 +109,28 @@ const FacilityBookings = (props: any) => { ...@@ -109,8 +109,28 @@ const FacilityBookings = (props: any) => {
</div> </div>
), ),
], ],
['Fee', 'managerFeeStatus', (text: any) => <div>{managerFeeStatusDes[text]}</div>], [
['Deposit', 'marginFeeStatus', (text: any) => <div>{marginFeeStatusDes[text]}</div>], 'Fee',
'managerFeeStatus',
(text: any, record: any) => (
<div>
{record.communityManagerFee == 0 && record.communityMargin
? 'N.A.'
: managerFeeStatusDes[text]}
</div>
),
],
[
'Deposit',
'marginFeeStatus',
(text: any, record: any) => (
<div>
{record.communityManagerFee == 0 && record.communityMargin
? 'N.A.'
: marginFeeStatusDes[text]}
</div>
),
],
['Status', 'status', (text: any) => <div>{statusDes[text]}</div>], ['Status', 'status', (text: any) => <div>{statusDes[text]}</div>],
[ [
......
...@@ -171,7 +171,7 @@ ...@@ -171,7 +171,7 @@
} }
.box6item2 { .box6item2 {
position: absolute; position: absolute;
left: 216px; left: 196px;
} }
.divbox4 { .divbox4 {
...@@ -184,7 +184,7 @@ ...@@ -184,7 +184,7 @@
.heng { .heng {
display: inline-block; display: inline-block;
line-height: 32px; line-height: 32px;
margin: 0 20px; margin: 0 10px;
} }
} }
.required { .required {
......
/* /*
* @Author: your name * @Author: your name
* @Date: 2020-11-19 20:34:18 * @Date: 2020-11-19 20:34:18
* @LastEditTime: 2020-12-30 10:02:48 * @LastEditTime: 2021-01-07 15:08:08
* @LastEditors: your name * @LastEditors: Please set LastEditors
* @Description: In User Settings Edit * @Description: In User Settings Edit
* @FilePath: \tostumi\src\utils\params.ts * @FilePath: \tostumi\src\utils\params.ts
*/ */
...@@ -90,4 +90,5 @@ export const requestList = [ ...@@ -90,4 +90,5 @@ export const requestList = [
['/tos/tosCommunity/get/user', '55 根据用户id获取用户管辖小区名', {}], ['/tos/tosCommunity/get/user', '55 根据用户id获取用户管辖小区名', {}],
['/tos/user/twoLevel/get', '56 获取二级账号', {}], ['/tos/user/twoLevel/get', '56 获取二级账号', {}],
['/tos/user/twoLevel/get/CommunityAuth', '57 根据用户id获取用户管辖小区名和权限', {}], ['/tos/user/twoLevel/get/CommunityAuth', '57 根据用户id获取用户管辖小区名和权限', {}],
['/tos/community/categories/subscribe/reservationNum', '58 获取小区设施可预约次数', {}],
]; ];
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