Commit 1af4a334 authored by cellee's avatar cellee

预订完善,基本解决

Signed-off-by: cellee's avatarcellee <893264950@qq.com>
parent d8a40b9f
...@@ -2,7 +2,7 @@ import React, { useState, useEffect, useRef } from 'react'; ...@@ -2,7 +2,7 @@ import React, { useState, useEffect, useRef } from 'react';
import styles from './css/index.less'; import styles from './css/index.less';
import './css/index.less'; import './css/index.less';
import { import {
Input, InputNumber,
Descriptions, Descriptions,
Spin, Spin,
Space, Space,
...@@ -41,15 +41,17 @@ const BookingDetail = (props: any) => { ...@@ -41,15 +41,17 @@ const BookingDetail = (props: any) => {
const [modalVisible, setModalVisible] = useState(false); const [modalVisible, setModalVisible] = useState(false);
const [modalItem, setModalIteme] = useState({ title: '', tab: 1 }); const [modalItem, setModalIteme] = useState({ title: '', tab: 1 });
const [backFeeFlag, setBackFeeFlag] = useState(false); const [backFeeFlag, setBackFeeFlag] = useState(false); // 部分退费 与 全部退费
const [curbackFee, setCurBackFee] = useState(0); const [curbackFee, setCurBackFee] = useState(0);
// 设置默认全款退费
useEffect(() => { useEffect(() => {
if (DataSaveDetail != null) { if (DataSaveDetail != null) {
setCurBackFee(DataSaveDetail.marginFee); setCurBackFee(DataSaveDetail.marginFee);
} }
}, [DataSaveDetail]); }, [DataSaveDetail]);
const radioStyle = { display: 'block', height: '30px', lineHeight: '30px' }; const radioStyle = { display: 'block', height: '50px', lineHeight: '50px' };
const formRef = useRef(null); const formRef = useRef(null);
const backFee = (e: any) => { const backFee = (e: any) => {
...@@ -63,8 +65,11 @@ const BookingDetail = (props: any) => { ...@@ -63,8 +65,11 @@ const BookingDetail = (props: any) => {
const onFinish = (values: any) => { const onFinish = (values: any) => {
var val = values; var val = values;
if (val.backMarginFeeReason == null) { // 如果选择了 部分退款 则 需要填写 理由 且不为全额退款的默认值
message.error('Back marginFee reason is empty!', 3); if (curbackFee == DataSaveDetail.marginFee) {
message.error('Please Fill In The Refund Amount Less Than The Full Amount!', 3);
} else if (backFeeFlag && val.backMarginFeeReason == null) {
message.error('Back MarginFee Reason Is Empty!', 3);
} else { } else {
var RAVAL = { var RAVAL = {
accountCategoriesId: DataSave.id, accountCategoriesId: DataSave.id,
...@@ -83,8 +88,9 @@ const BookingDetail = (props: any) => { ...@@ -83,8 +88,9 @@ const BookingDetail = (props: any) => {
console.log('Failed:', errorInfo); console.log('Failed:', errorInfo);
}; };
// 退款金额改变
const getBackMarginFee = (e: any) => { const getBackMarginFee = (e: any) => {
setCurBackFee(e.target.value); setCurBackFee(e);
}; };
const makeFee = () => { const makeFee = () => {
setModalIteme({ title: 'Deposit And Fee', tab: 2 }); setModalIteme({ title: 'Deposit And Fee', tab: 2 });
...@@ -182,28 +188,37 @@ const BookingDetail = (props: any) => { ...@@ -182,28 +188,37 @@ const BookingDetail = (props: any) => {
onFinish={onFinish} onFinish={onFinish}
onFinishFailed={onFinishFailed} onFinishFailed={onFinishFailed}
> >
<Row gutter={8} style={{ marginTop: 16 }}> <Descriptions>
<Col>已交管理费</Col> <Descriptions.Item label="Management Expense">
<Col span={2}>{DataSaveDetail.managerFee}</Col> $ {parseInt(DataSaveDetail.managerFee).toFixed(2)}
<Col>已交押金</Col> </Descriptions.Item>
<Col span={2}>{DataSaveDetail.marginFee}</Col> <Descriptions.Item label="Deposit">
</Row> $ {parseInt(DataSaveDetail.marginFee).toFixed(2)}
</Descriptions.Item>
</Descriptions>
<div style={{ marginTop: 16 }}>
<Radio.Group onChange={backFee} defaultValue={1}> <Radio.Group onChange={backFee} defaultValue={1}>
<Radio value={1} style={radioStyle}> <Radio value={1} style={radioStyle}>
全额退还 Full Refund
</Radio> </Radio>
<Radio value={2} style={radioStyle}> <Radio value={2} style={radioStyle}>
部分退还{' '} Partial Refund
{backFeeFlag ? ( {backFeeFlag ? (
<> <>
<Input onChange={getBackMarginFee} style={{ width: 80 }} /> $ <InputNumber
placeholder="00.00"
min={0}
max={parseInt(DataSaveDetail.marginFee).toFixed(2)}
maxLength={6}
step={0.01}
prefix="$"
onChange={getBackMarginFee}
style={{ width: 80, marginLeft: 10 }}
/>
</> </>
) : null} ) : null}
</Radio> </Radio>
</Radio.Group> </Radio.Group>
</div>
{backFeeFlag ? ( {backFeeFlag ? (
<div style={{ marginTop: 16 }}> <div style={{ marginTop: 16 }}>
...@@ -219,7 +234,7 @@ const BookingDetail = (props: any) => { ...@@ -219,7 +234,7 @@ const BookingDetail = (props: any) => {
<div style={{ marginTop: 16 }}> <div style={{ marginTop: 16 }}>
<Form.Item> <Form.Item>
<Button type="primary" htmlType="submit" loading={load}> <Button type="primary" htmlType="submit" loading={load}>
退还押金 Deposit Refunds
</Button> </Button>
</Form.Item> </Form.Item>
</div> </div>
...@@ -229,7 +244,7 @@ const BookingDetail = (props: any) => { ...@@ -229,7 +244,7 @@ const BookingDetail = (props: any) => {
) : null} ) : null}
{DataSave.status == 1 || DataSave.status == 2 ? ( {DataSave.status == 1 || DataSave.status == 2 ? (
<Button onClick={showModal} loading={load}> <Button onClick={showModal} loading={load}>
取消预约 Cancel Reservation
</Button> </Button>
) : null} ) : null}
<Modal <Modal
......
...@@ -45,7 +45,7 @@ const module = 'FacilityBookings'; ...@@ -45,7 +45,7 @@ const module = 'FacilityBookings';
import moment from 'moment'; import moment from 'moment';
const Facility = (props: any) => { const Facility = (props: any) => {
const { dispatch, location, token, sourceData, DataSave, Result, imgList } = props; const { dispatch, location, token, sourceData, DataSave, Result, imgList, load } = 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 } });
...@@ -457,13 +457,13 @@ const Facility = (props: any) => { ...@@ -457,13 +457,13 @@ const Facility = (props: any) => {
</Row> */} </Row> */}
{facilityDetail ? ( {facilityDetail ? (
<> <>
<Button type="primary" onClick={Subscribe}> <Button type="primary" onClick={Subscribe} loading={load}>
Subscribe Subscribe
</Button> </Button>
</> </>
) : ( ) : (
<> <>
<Button type="primary" htmlType="submit"> <Button type="primary" htmlType="submit" loading={load}>
Submit Submit
</Button> </Button>
</> </>
...@@ -474,15 +474,19 @@ const Facility = (props: any) => { ...@@ -474,15 +474,19 @@ const Facility = (props: any) => {
}; };
function mapStateToProps(state: any) { function mapStateToProps(state: any) {
console.log(state);
const { sourceData, DataSave, Result, imgList } = state.FacilityBookings; const { sourceData, DataSave, Result, imgList } = state.FacilityBookings;
const { token } = state.login; const { token } = state.login;
const load =
typeof state.loading.models.FacilityBookings == 'undefined'
? true
: state.loading.models.FacilityBookings;
return { return {
DataSave, DataSave,
sourceData, sourceData,
token, token,
Result, Result,
imgList, imgList,
load,
}; };
} }
export default connect(mapStateToProps)(Facility); export default connect(mapStateToProps)(Facility);
......
...@@ -73,7 +73,6 @@ ...@@ -73,7 +73,6 @@
line-height: 32px; line-height: 32px;
} }
.box2item2 { .box2item2 {
width: 336px;
padding-left: 135px; padding-left: 135px;
} }
// 线栏 // 线栏
......
...@@ -29,16 +29,16 @@ export const Notice = [ ...@@ -29,16 +29,16 @@ export const Notice = [
// 新增设施 // 新增设施
export const NewFaci = [ export const NewFaci = [
[{ required: false, message: 'Please select community' }], [{ required: true, message: 'Please select community' }],
[{ required: false, message: 'Please input Facility Name' }], [{ required: true, message: 'Please input Facility Name' }],
[{ required: false, message: 'Please Set management fee' }], [{ required: true, message: 'Please Set management fee' }],
[{ required: false, message: 'Please Set Setting deposit' }], [{ required: true, message: 'Please Set Setting deposit' }],
[{ required: false, message: 'Please Upload facility photos' }], [{ required: true, message: 'Please Upload facility photos' }],
[{ required: false, message: 'Required' }], [{ required: true, message: 'Required' }],
[{ required: false, message: 'Required' }], [{ required: true, message: 'Required' }],
[{ required: false, message: 'Required' }], [{ required: true, message: 'Required' }],
[{ required: false, message: 'Required' }], [{ required: true, message: 'Required' }],
[{ required: false, message: 'Required' }], [{ required: true, message: 'Required' }],
]; ];
// 设施预订 // 设施预订
......
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