/*
 * Creator:     ML
 * CreatDate:   2020-03-14
 * descripts：   新增配送单
 * */
import React from 'react';
import { Tabs, List, Button, WhiteSpace, Modal, Result, Icon, Steps, WingBlank, Flex, Checkbox, } from 'antd-mobile';
import "pages/common/style/index.less";
import './style/index.less';
import { $http } from "containers/config/https";
import DistributionList from "./componts/DistributionList";
import CancelBtn from './componts/CancelBtn';
import store from "store";
import { Util } from 'tools';
const Step = Steps.Step;
const CheckboxItem = Checkbox.CheckboxItem;
// const AgreeItem = Checkbox.AgreeItem;
// let userData = localStorage.getItem("userData") ? JSON.parse(localStorage.getItem("userData")) : {};
let deliveryAddress = sessionStorage.getItem("deliveryAddress") ? JSON.parse(sessionStorage.getItem("deliveryAddress")) : {
    address: "河北省长安市小安区幸福里小区301",
    areaDesc: "小安区",
    areaID: "35",
    cityDesc: "长安市",
    cityID: "3",
    id: "1",
    mobile: "15679777777",
    name: "张三",
    provinceDesc: "河北省",
    provinceID: "2",
    villageDesc: "幸福里小区",
    villageID: "610"
}; // 配送地址

const Item = List.Item;
export default class AddDistributionSheetDeatail extends React.Component {
    constructor({ history }) {
        super();
        this.state = {
            smallClassModal: false,
            adressVisible: false,
            step: (store.getState().electronicPrescription && store.getState().electronicPrescription.distributionStepData) || 0,
            selectedNumber: 0,
            activeTabs: 0,
            deliveryAddressListData: [
                {
                    address: "河北省长安市幸福里小区333号",
                    areaDesc: "小安区",
                    areaID: "35",
                    cityDesc: "长安市",
                    cityID: "3",
                    id: "1",
                    mobile: "15679777777",
                    name: "张三",
                    provinceDesc: "河北省",
                    provinceID: "2",
                    villageDesc: "幸福里小区",
                    villageID: "610"
                }
            ],
            bigClassData: [
                {
                    descripts: '呼吸内科(2012-12-12)',
                    description: '',
                    index: 0,
                    checked: false
                }, {
                    descripts: '儿科',
                    description: '',
                    index: 1,
                    checked: false
                },
            ]
        }
        this.history = history;
    }

    componentDidMount() {
        this.getPatInfo()
    }
    // 获取配送地址 ---step  2
    getDeliveryAddressListData = () => {
        let { userData } = this.state;
        let data = {
            params: [{
                openID: userData.openID || "o1Dcz6wWu8Tp3ByteUZjhtpdXYp8",
                pubAccCode: userData.pubAccCode || "NewElements",
            }]
        }
        $http.post("urlS", this, {
            code: "01020006",
            data: data,
            success: function (res) {
                if (+res.errorCode === 0) {
                    let resData = res.result && res.result.rows && res.result.rows.length > 0 ? res.result.rows : [];
                    let deliveryAddress = this.state.deliveryAddress;
                    if ((!(this.state.deliveryAddress && this.state.deliveryAddress.id)) && resData && resData.length > 0) {
                        deliveryAddress = resData[resData.length - 1];
                    }
                    this.setState({ deliveryAddressListData: resData, deliveryAddress }, () => {
                    });
                } else {
                    this.setState({ deliveryAddressListData: [] });
                }
            }
        });
    }
    getPatInfo = () => {
        let data = {
            params: [{
                patID: "1",
                hospID: "",
                language: "",
                dateFrom: "",
                dateTo: ""
            }]
        }
        $http.post("urlS", this, {
            code: "03030068",
            data: data,
            success: function (res) {
                if (+res.errorCode === 0) {
                    let arr = res.result.data
                    let num = 0
                    for (var i = 0; i < arr.length; i++) {
                        arr[i]["checked"] = false
                        arr[i]["qtyed"] = 0
                        num += arr[i].qty
                    }
                    // arr && arr.map((i, s) => {
                    //     i["checked"] = false
                    //     i["qtyed"] = 0
                    //     num += i.qty
                    // })
                    this.setState({
                        bigClassData: arr,
                        bigClassDataLength: num
                    })
                }
            }
        });
    }
    showModal = (e, key) => {
        e.preventDefault(); // 修复 Android 上点击穿透
        this.setState({
            [key]: true,
        });
    }
    onClose = () => {
        // let arr = []
        // store.dispatch({
        //     type: "precSubItems",
        //     value: [...arr]
        // });
        this.setState({
            smallClassModal: false,
            adressVisible: false
        })
    }
    handleOK = () => {
        this.setState({
            smallClassModal: false
        })
    }
    // 全选、反选
    handleCheckAllChange = e => {
        this.setState({ checkAll: e.target.checked }, () => {
            this.modifyAllChecked(this.state.checkAll);
        })
    }
    // 根据全选反选改变所有的checked
    modifyAllChecked = (checked) => {
        let { bigClassData } = this.state;
        // if(bigClassData&&bigClassData.length==0){
        //     return
        // }
        for (var i = 0; i < bigClassData.length; i++) {
            bigClassData[i].checked = checked;
        }
        this.setState({ bigClassData }, () => {
            this.recordTheNumberOfSelected();
            store.dispatch({
                type: "distributionItems",
                value: [...this.state.bigClassData]
            });
        })
    }
    // 修改单个checked   父级全选
    handleCheckedChange = (item, e) => {
        let { bigClassData } = this.state;
        for (var i = 0; i < bigClassData.length; i++) {
            if (bigClassData[i].admID === item.admID) {
                bigClassData[i].checked = e.target.checked;
                break;
            }
        }
        // this.getSubAll( item.admID,e.target.checked)
        this.setState({ bigClassData }, () => {
            this.modifyAllElectionStatus();
            this.recordTheNumberOfSelected();
            let arr = [];
            for (var i = 0; i < this.state.bigClassData.length; i++) {
                if (this.state.bigClassData[i].checked) {
                    arr.push(this.state.bigClassData[i])
                }
            }
            store.dispatch({
                type: "distributionItems",
                value: [...arr]
            });
        })
    };

    // 遍历所有的checked，如果所有的checked选中则全选选中
    modifyAllElectionStatus = () => {
        let { bigClassData } = this.state;
        let status = false;
        for (var i = 0; i < bigClassData.length; i++) {
            if (bigClassData[i].checked) {
                status = true;
            } else {
                status = false;
                break
            }
        }
        this.setState({ checkAll: status })
    }
    // 记录当前选中
    recordTheNumberOfSelected = () => {
        let { bigClassData } = this.state;
        let num = 0;
        for (var i = 0; i < bigClassData.length; i++) {
            if (bigClassData[i].checked) {
                num += 1;
            }
        }
        this.setState({ selectedNumber: num })
    }
    //下一步
    handleNext = () => {
        this.setState({
            step: 1
        }, () => {
            // this.getDeliveryAddressListData()
            store.dispatch({
                type: "distributionStep",
                value: 1
            });
        })
    }

    //点击大类 获取详细项目
    getSmallClassData = () => {
        // const { bigClassData } = this.state
        let data = {
            params: [{
                admID: this.state.admID,
                hospID: "1",
                language: "",
            }]
        }
        $http.post("urlS", this, {
            code: "03030069",
            data: data,
            success: function (res) {
                if (+res.errorCode === 0) {
                    let arr = res.result;
                    let subData = [];
                    for (var i = 0; arr.length; i++) {
                        arr[i]["key"] = i;
                        if (this.state.activeTabs === i) {
                            subData = arr[i].data;
                            for (var j = 0; j < subData.length; j++) {
                                subData[j]["checked"] = false;
                                if (store.getState().electronicPrescription && store.getState().electronicPrescription.precSubItemsData) {
                                    let childArr = store.getState().electronicPrescription.precSubItemsData;
                                    for (var k = 0; k < childArr.length; k++) {
                                        if (subData[j].prescNo === childArr[k].prescNo) {
                                            subData[j].checked = true
                                            // this.handleCheckedSubClass(items, true, subData)
                                        }
                                    }
                                }
                            }
                        }
                    } 
                    // arr.map((item, i) => {
                    //     item["key"] = i
                    //     if (this.state.activeTabs === i) {
                    //         subData = item.data
                    //         subData.map((items, index) => {
                    //             items["checked"] = false
                    //             if (store.getState().electronicPrescription && store.getState().electronicPrescription.precSubItemsData) {
                    //                 let arr = store.getState().electronicPrescription.precSubItemsData
                    //                 arr.map((i, s) => {
                    //                     if (items.prescNo === i.prescNo) {
                    //                         items.checked = true
                    //                         // this.handleCheckedSubClass(items, true, subData)
                    //                     }
                    //                 })
                    //             }
                    //             // bigClassData && bigClassData.map((item, index) => {
                    //             //     if (item.admID == items.admID && item.checked) {//找到父级 设置对应子级
                    //             //         items.checked = true
                    //             //         // subArr.push(items)
                    //             //         // subItems = items
                    //             //         // this.handleCheckedSubClass(items,true)
                    //             //     }
                    //             // })
                    //             // for (var i = 0; i < bigClassData.length; i++) {
                    //             //     if(bigClassData[i].admID)
                    //             //     if (bigClassData[i].checked) {
                    //             //         items.checked = true
                    //             //     }
                    //             // }
                    //         })
                    //     }
                    // })
                    this.setState({
                        tabsActive: arr,
                        subData,
                    }, () => {
                        // this.handleCheckedSubClass(subItems,true)
                    })
                    // store.dispatch({
                    //     type: "precSubItems",
                    //     value: [...arr]
                    // });
                }
            }
        });
    }
    //点击大类 选择详细项目 弹窗
    handleSmallClassItem = (item) => {
        if (store.getState().electronicPrescription && store.getState().electronicPrescription.precSubItemsData) {
            // console.log("store.getState().precSubItemsData", store.getState().electronicPrescription.precSubItemsData)
        }
        this.setState({
            smallClassModal: true,
            admID: item.admID
        }, () => {
            document.querySelector(".modal-dom").style.position = "relative";
            document.querySelector(".modal-dom .select-dom").style.float = "right";
            if (document.querySelector(".am-checkbox-inner")) {
                var x = document.querySelectorAll(".am-checkbox-inner");
                for (var i = 0; i < x.length; i++) {
                    x[i].style.borderRadius = "0";
                }
            }
            this.getSmallClassData()
        })

    }
    //子类选中 ---记录所有 手动 
    handleCheckedSubClass = (item, e, ) => {
        let { subData } = this.state;
        // if (subDatas) {
        //     this.setState({
        //         subData:subData,
        //     })
        // }
        for (var i = 0; i < subData.length; i++) {
            if (subData[i].key === item.key) {
                subData[i].checked = e;
                break;
            }
        }
        let arr = store.getState().electronicPrescription.precSubItemsData || [];
        this.setState({ subData }, () => {
            if (subData && subData.length > 0) {
                for (var i = 0; i < subData.length; i++) {
                    if (subData[i].checked && subData[i].checked) {
                        arr.push(subData[i])
                        this.handleSelectNow(arr, item.admID)
                    } else {
                        var id = subData[i].prescNo;
                        for (var j = 0; j < arr.length; j++) {
                            if (id === arr[j]['prescNo']) {
                                arr.splice(arr[j], 1)
                                console.log("arr减少后新数组", arr)
                                this.handleSelectNow(arr, item.admID)
                            }
                        }
                    }
                }
                // subData.map((items, index) => {
                //     if (items.checked && items.checked) {
                //         arr.push(items)
                //         this.handleSelectNow(arr, item.admID)
                //     } else {
                //         var id = items.prescNo
                //         arr && arr.map((it, is) => {
                //             if (id === it['prescNo']) {
                //                 arr.splice(it, 1)
                //                 console.log("arr减少后新数组", arr)
                //                 this.handleSelectNow(arr, item.admID)
                //             }
                //         })
                //         // for (var i in arr) {

                //         // }
                //     }
                // })
            }
            // for (var i = 0; i < subData.length; i++) {
            //     if (subData[i].checked) {
            //         arr.push(subData[i])
            //         this.handleSelectNow(arr, item.admID)
            //     } else {
            //         console.log("arr减少",arr)
            //         var id = subData[i].prescNo
            //         for (var i in arr) {
            //             if (id === arr[i]['prescNo']) {
            //                 arr.splice(i, 1)
            //                 console.log("arr减少",arr)
            //                 this.handleSelectNow(arr, item.admID)
            //             }
            //         }
            //     }
            // }
          
        })
    }
    //子类选中记录当前已选条数 以及父级选中
    handleSelectNow = (arr, admID) => {
        let id = "prescNo";//定义过滤的对象的属性名称
        let newArr = arr.reduce((all, next) => all.some((item) => item[id] === next[id]) ? all : [...all, next], []);
        console.log("newArr", newArr)
        store.dispatch({
            type: "precSubItems",
            value: [...newArr]
        });

        const { bigClassData } = this.state
        let bigLength = bigClassData
        let a = []
        for (var i = 0; i < newArr.length; i++) {
            newArr[i].qtyed = 0
            if (admID === newArr[i].admID) {
                a.push(newArr[i])
            }
        }
        // newArr && newArr.map((i, s) => {
        //     i.qtyed = 0
        //     if (admID === i.admID) {
        //         a.push(i)
        //     }
        // })
        for (var j = 0; j < bigLength.length; j++) {
            if (admID === bigLength[j].admID) {
                bigLength[j].qtyed = a.length
                if (a.length === bigLength[j].qty) {
                    bigLength[j].checked = true
                } else {
                    bigLength[j].checked = false
                }
            }
        }
        // bigLength && bigLength.map((item, index) => {
        //     if (admID === item.admID) {
        //         item.qtyed = a.length
        //         if (a.length === item.qty) {
        //             item.checked = true
        //         } else {
        //             item.checked = false
        //         }
        //     }
        // })
        // console.log("bigClassData", bigLength)
        this.setState({
            bigClassData: bigLength
        })
    }
    //全选 反选 改变子级状态
    getSubAll = (admID, checked) => {
        let data = {
            params: [{
                admID: admID,
                hospID: "1",
                language: "",
            }]
        }
        $http.post("urlS", this, {
            code: "03030069",
            data: data,
            success: function (res) {
                if (+res.errorCode === 0) {
                    let arr = res.result
                    let subData = []
                    for(var i = 0; i < arr.length; i++) {
                        arr[i]["key"] = i;
                        if (this.state.activeTabs === i) {
                            subData = arr[i].data
                            for (var j = 0; j < subData.length; j++) {
                                if (checked) {
                                    subData[j]["checked"] = true
                                    store.dispatch({
                                        type: "precSubItems",
                                        value: [...subData]
                                    });
                                } else {
                                    subData[j]["checked"] = false

                                }
                            }
                        }
                    }
                    // arr.map((item, i) => {
                    //     item["key"] = i
                    //     if (this.state.activeTabs === i) {
                    //         subData = item.data
                    //         subData.map((items, index) => {
                    //             if (checked) {
                    //                 items["checked"] = true
                    //                 store.dispatch({
                    //                     type: "precSubItems",
                    //                     value: [...subData]
                    //                 });
                    //             } else {
                    //                 items["checked"] = false

                    //             }


                    //         })

                    //     }
                    // })
                    this.setState({
                        tabsActive: arr,
                        subData,

                    }, () => {
                        // this.handleCheckedSubClass(subData,true)
                    })

                }
            }
        });

    }
    // tabs切换
    handleTabsChange = (tab) => {
        this.setState({ activeTabs: tab.key }, () => {
            // let { activeTabs } = this.state;
            this.getSmallClassData()
        })
    }
    handleFilter = (type, i, a, b, c, d) => {
        //策略
        let obj = {
            "Presc": () => {
                a.push(i)
                new Set(a)
            },
            "CheckNo": () => {
                d.push(i)
                new Set(d)
            },
            "CMPresc": () => {
                b.push(i)
                new Set(b)
            },
            "SpecNo": () => {
                c.push(i)
                new Set(c)
            },
        }
        if (obj[type]) {
            obj[type]()
        }
    }
    //提交配送单信息
    handleSubmit = () => {
        // console.log("store.getState().precSubItemsData", store.getState().electronicPrescription.precSubItemsData)
        let arr = store.getState().electronicPrescription.precSubItemsData
        let presc = []
        let cmpresc = []
        let specNos = []
        let checkNos = [];
        for (var i = 0; i < arr.length; i++) {
            this.handleFilter(arr[i].typeCode, arr[i].prescNo, presc, cmpresc, specNos, checkNos)
        }
        // arr.map((i, s) => {
        //     this.handleFilter(i.typeCode, i.prescNo, presc, cmpresc, specNos, checkNos)
        // })
        // console.log("prec", new Set(presc), "cmpresc", cmpresc, "specNos", specNos, "checkNos", checkNos)
        let data = {
            params: [{
                hospID: "1",
                userID: "1",
                patientID: "1",
                receiveConpany: "张三的公司",
                receiveName: "张三",
                receivePhone: "020-666",
                receiveMobile: "15679777777",
                receiveProvinceID: "2",
                receiveCityID: "3",
                receiveAreaID: "35",
                receiveVillageID: "610",
                receiveHamletID: "",
                receiveAdress: "河北省长安市小安区幸福里小区301",
                parcelQuantity: "1",
                presc,
                cmpresc,
                specNos,
                checkNos,
            }]
        }
        $http.post("urlS", this, {
            code: "03030060",
            data: data,
            success: function (res) {
                if (+res.errorCode === 0) {
                    this.setState({
                        step: 2
                    }, () => {
                        store.dispatch({
                            type: "distributionStep",
                            value: 2
                        });
                        let obj = {}
                        obj["orderID"] = res.result
                        this.setState({
                            obj,
                        })
                    })
                }
            }
        });
    }
    //查看全部配送单
    handleCheckAllOrder = () => {
        store.dispatch({
            type: "distributionTabs",
            value: "2"
        });
        this.history.push({
            pathname: "/0006/00000005",
            state: ""
        });
    }
    // 添加配送地址
    handleAddAddress = () => {
        this.history.push({
            pathname: "/0003/00000006",
            state: {}
        });
    }
    // 选择配送地址
    handleSelectAddressClick = item => {
        this.setState({ deliveryAddress: item }, () => {
            window.sessionStorage.setItem(
                "deliveryAddress",
                JSON.stringify(
                    { ...this.state.deliveryAddress }
                )
            );
            this.onClose();
        })
    }

    // 修改配送地址
    handleChildItemClick = () => {
        this.setState({ adressVisible: true });
    }
    // 修改地址
    handleModify = (item, e) => {
        e.stopPropagation(); // 阻止事件冒泡
        this.history.push({
            pathname: "/0003/00000006",
            state: { ...item }
        });
    }
    handlePush = (i) => {
        this.history.push({
            pathname: "/0006/00000008",
            state: { ...i }
        });
        store.dispatch({
            type: "distributionStep",
            value: 0
        });
        store.dispatch({
            type: "precSubItems",
            value: []
        });
    }
    render() {
        let { selectedNumber, step, bigClassData, deliveryAddressListData, bigClassDataLength, activeTabs, tabsActive, subData } = this.state;
        let childItemData = subData
        let renderContent = () =>
            (<div className="smallClass-itemInfo" style={{ minHeight: "500px", maxHeight: "500px", overflow: "auto" }}>
                {childItemData && childItemData.length > 0 ? childItemData.map((item, index) => {
                    return (
                        <div className="check-dom" key={index}>
                            <CheckboxItem key={index} checked={item.checked} onChange={(e) => this.handleCheckedSubClass(item, e.target.checked)}>
                                <p className="smallItems-dom"><span className="small-title">{item.locDesc}</span><span className="small-title" style={{ color: "#888" }}>{"(" + item.prescNo + ")"}</span></p>
                            </CheckboxItem>
                            <Item>
                                {
                                    item.orderDetail && item.orderDetail.map((i, s) => {
                                        return (
                                            <div key={i}>
                                                <p style={{ fontSize: "12px", display: "flex", alignItems: "center", marginBottom: "6px", color: "#888" }}>
                                                    <span style={{ whiteSpace: "pre-wrap", margin: "0 32px" }}>{(s + 1) + "." + i.medDesc}</span>
                                                    <span style={{ flex: "1", textAlign: "right" }}>{"x" + i.orderQty}</span>
                                                </p>
                                            </div>


                                        )
                                    })
                                }
                            </Item>
                        </div>

                    )

                }) : <p style={{ paddingTop: "24px", textAlign: "center" }}>暂无数据</p>}
            </div>);
        const steps = [{
            title: '选择配送项目',
            description: '',
            index: 0,
        }, {
            title: '填写配送信息',
            description: '',
            index: 1,
        }, {
            title: '提交',
            description: '',
            index: 2,
        }].map((s, i) => <Step className={i === step ? "activeColor" : i < step ? "finshColor" : i > step ? "watingColor" : ""} key={i} title={s.title} description={s.description} />);
        // const customIcon = () => (
        //     <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 42 42" className="am-icon am-icon-md">
        //         <g fillRule="evenodd" stroke="transparent" strokeWidth="4">
        //             <path d="M21 0C9.402 0 0 9.402 0 21c0 11.6 9.402 21 21 21s21-9.4 21-21C42 9.402 32.598 0 21 0z" />
        //             <path fill="#FFF" d="M29 18.73c0-.55-.447-1-1-1H23.36l4.428-5.05c.407-.46.407-1.208 0-1.668-.407-.46-1.068-.46-1.476 0l-5.21 5.89-5.21-5.89c-.406-.46-1.067-.46-1.475 0-.406.46-.406 1.207 0 1.667l4.43 5.05H14.23c-.55 0-.998.45-.998 1 0 .554.448.97 1 .97h5.9v3.942h-5.9c-.552 0-1 .448-1 1s.448.985 1 .985h5.9v4.896c0 .552.448 1 1 1 .55 0 .968-.284.968-.836v-5.06H28c.553 0 1-.433 1-.985s-.447-1-1-1h-5.9v-3.94H28c.553 0 1-.418 1-.97z" />
        //         </g>
        //     </svg>
        // );
        // console.log("bigClassData", bigClassData)
        return (
            <div className="add-dom">
                <div className="step-dom">
                    <WingBlank mode={20} className="stepsExample">
                        <Item>
                            <Steps current={step} direction="horizontal">{steps}</Steps>
                        </Item>
                        <WhiteSpace />
                        <div className="sub-title">
                            {
                                step === 0 ? <div>
                                    <p style={{ height: "48px", lineHeight: "48px", fontSize: "14px", paddingLeft: "10px", color: "#333" }}>
                                        就诊记录
                                    </p>
                                    <Item>
                                        {
                                            bigClassData && bigClassData.map((item, index) => {
                                                return (
                                                    // <CheckboxItem key={index} checked={item.checked} onChange={(e) => this.handleCheckedChange(item, e)}>
                                                    //     <p onClick={() => this.handleSmallClassItem(item)} className="bigItems-dom"><span className="small-title">{item.locDesc + "(" + item.admDate + ")"}</span><span className="small-title" style={{ color: "#888" }}>已选{item.qtyed}项,共{item.qty}项 ></span></p>
                                                    // </CheckboxItem>
                                                    <Item key={index}>
                                                        <p onClick={() => this.handleSmallClassItem(item)} className="bigItems-dom"><span className="small-title">{item.locDesc + "(" + item.admDate + ")"}</span><span className="small-title" style={{ color: "#888" }}><span style={{ margin: "0 6px" }}>已选{item.qtyed}项,</span>{"共" + item.qty + "项 >"}</span></p>
                                                    </Item>
                                                )
                                            })
                                        }
                                    </Item>
                                </div> : step === 1 ? <div>
                                    <Item>
                                        <List className="my-list">
                                            <Item
                                                arrow={"horizontal"}
                                                onClick={this.handleChildItemClick}
                                                className="api-child-item"
                                            >
                                                <p className="p">{(deliveryAddress.provinceDesc || "--") + (deliveryAddress.cityDesc || "") + (deliveryAddress.areaDesc || "") + (deliveryAddress.villageDesc || "")}</p>
                                                <h3 className="position">{deliveryAddress.address || "--"}</h3>
                                                <p className="p">{deliveryAddress.name || ""} {deliveryAddress.mobile ? Util.phoneNumberEncryption(deliveryAddress.mobile) : "--"}</p>

                                            </Item>
                                        </List>
                                    </Item>
                                    <WhiteSpace />
                                    <DistributionList orderBlock="1" data={(store.getState().electronicPrescription && store.getState().electronicPrescription.precSubItemsData)}></DistributionList>
                                </div> : step === 2 ? <div>
                                    {
                                        <div className="detail-dom">
                                            <Item>
                                                <div className="btn-check-tips">
                                                    <Result
                                                        img={<Icon type="check-circle-o" className="spe" style={{ fill: '#1F90E6' }} />}
                                                        title={<span style={{ color: "#333", fontWeight: "600", fontSize: "12px" }}>配送订单提交成功!</span>}
                                                    />

                                                </div>
                                                <div className="btn-check-info">
                                                    <span onClick={this.handleCheckAllOrder}>查看全部配送单</span>
                                                </div>
                                            </Item>
                                            <WhiteSpace />
                                        </div>
                                    }
                                    <div className="adress-info">
                                        <Item className="adress-item">
                                            <p>
                                                {"xxxx"}
                                            </p>
                                            <p>
                                                {"xxxxx"}
                                            </p>
                                            <p>
                                                <span>{"***"}</span>
                                                <span>{"xxxxxx"}</span>
                                            </p>
                                        </Item>
                                        <Item>
                                            <div>
                                                物流单号:<span>未配送</span>
                                            </div>
                                            <div>
                                                物流动态:<span>正在加紧为您安排配送，请耐心等待。</span>
                                            </div>
                                        </Item>

                                    </div>
                                    <WhiteSpace />
                                    <DistributionList orderBlock="1" info={this.state.obj} step={step} data={(store.getState().electronicPrescription && store.getState().electronicPrescription.precSubItemsData)}></DistributionList>
                                    <CancelBtn handlePush={this.handlePush} info={this.state.obj}></CancelBtn>
                                </div> : ""
                            }
                        </div>
                        <div className="ep-footer" style={{ display: step === 2 ? "none" : "block" }}>
                            {step === 0 ?
                                <div className="foot-operation">
                                    <Flex>
                                        {/* <Flex.Item>
                                            <AgreeItem data-seed="logId" checked={checkAll} onChange={this.handleCheckAllChange}>
                                                全选
                                            </AgreeItem>
                                        </Flex.Item> */}
                                        <div style={{ color: "#108ee9", margin: "2px 14px 0 28px" }}>
                                            <span className="span">共 {bigClassDataLength} 项,</span>
                                            <span className="span">已选 {(store.getState().electronicPrescription && store.getState().electronicPrescription.precSubItemsData.length)} 项</span>
                                        </div>
                                    </Flex>
                                    <Button type="primary" className="btn" onClick={this.handleNext} disabled={selectedNumber > 0 || (store.getState().electronicPrescription && store.getState().electronicPrescription.precSubItemsData.length > 0) ? false : true}>确定</Button>
                                </div>
                                : (step === 1 ? <Button onClick={this.handleSubmit} type="primary">提交</Button> : "")}
                        </div>
                        <WhiteSpace />

                    </WingBlank>

                </div>
                <WhiteSpace />
                <Modal
                    popup
                    visible={this.state.smallClassModal}
                    onClose={this.onClose}
                    animationType="slide-up"
                >
                    <div className="modal-dom">
                        <Item extra={<span className="ok-btn" onClick={this.handleOK} style={{ color: "#108ee9", fontSize: "12px" }}>{"确定"}</span>}><span className="select-dom">选择配送项目</span><span onClick={this.onClose} className="cancel-btn" style={{ fontSize: "12px" }} >取消</span></Item>
                        <Item >
                            <Tabs tabs={tabsActive}
                                page={activeTabs}
                                onChange={this.handleTabsChange}
                                renderTabBar={props => <Tabs.DefaultTabBar {...props} page={4} />}
                            >
                                {
                                    renderContent
                                }
                            </Tabs>
                        </Item>
                    </div>

                </Modal>
                <Modal
                    popup
                    visible={this.state.adressVisible}
                    onClose={this.onClose}
                    animationType="slide-up"
                    className="id-address-modal"
                >
                    <List renderHeader={() => <div>选择配送地址<span className="close" onClick={this.onClose}>关闭</span></div>} className="di-popup-list">
                        {deliveryAddressListData && deliveryAddressListData.map((item, index) => (
                            <List.Item key={index} extra={<i onClick={(e) => this.handleModify(item, e)} className="iconfont icon-bianji"></i>} thumb={<span className={deliveryAddress && (deliveryAddress.id === item.id) ? "check-pat radio-checked" : "check-pat"}></span>} onClick={() => this.handleSelectAddressClick(item)}>
                                <div className="di-popup-list-childiten">
                                    <p>{item.provinceDesc + item.cityDesc + item.areaDesc + item.villageDesc + item.address}</p>
                                    <p><span>{item.name}</span>{item.mobile}</p>
                                </div>
                            </List.Item>
                        ))}
                        <List.Item className="dl-btn">
                            <Button type="primary" onClick={this.handleAddAddress}>添加配送地址</Button>
                        </List.Item>
                    </List>
                </Modal>
            </div>
        )
    }
}