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