编辑代码

//arrived number
/*
Name: fnGetInhouseReservationList
Function: Get In-House reservation list
Param: null
Return: In-House reservation list
future: property need to update - JSON.parse(window.localStorage.getItem('RM_Property')).data.split('_')[0]
 */

function fnGetInhouseReservationList() {
    let date = new Date();
    let strSymble1;
    let strSymble2;

    //如果月或者日小于10,strSymble '-'或者‘-0’
    if (parseInt(date.getMonth()) < 9) {
        strSymble1 = '-0';
    }
    else
        strSymble1 = '-';
    if (parseInt(date.getDate()) < 10) {
        strSymble2 = '-0';
    }
    else
        strSymble2 = '-';
    let objParam = {
        "FromDate": date.getFullYear() + strSymble1
            + parseInt(date.getMonth() + 1) + strSymble2
            + date.getDate(),
        "ToDate": date.getFullYear() + strSymble1
            + parseInt(date.getMonth() + 1) + strSymble2
            + date.getDate(),
        "OnlyShowPrimaryClient": true,
        "ShowGroupMasterOnly": false,
        "Properties": [JSON.parse(window.localStorage.getItem('RM_Property')).data.split('_')[0]],
        "BookingTypeId": 0,
        "ReportView": 3,
        "ResView": 0,
        "CatGrpIds": [],
        "CatIds": []
    }
    let xmlhttp = new XMLHttpRequest();
    xmlhttp.onreadystatechange = function () {
        if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
            console.log("fnGetInhouseReservationList: ");
            console.log(xmlhttp.responseText);
            //objParam.objReservationDetails= rtn.responseJSON.ResScreenData.ResRows;
            //fnTasksLoop("fnGetReservationDetails",xmlhttp.responseText);
            window.objParam = null;
            window.objParam = (xmlhttp.responseText);

            let objParam = {
                "strName": "fnCallBackGetInhouseReservationList",
                "objValue": 0,
                "bIfContinue": true
            }
            window.objGlobalParam.objAryInOutData = JSON.parse(xmlhttp.responseText).InOutData;
            window.postMessage(objParam);
        }
    }

    xmlhttp.open("POST", "https://app9.rmscloud.cn/api/Reservation/InOutScreen/RetrieveScreenData");
    xmlhttp.setRequestHeader('content-Type', 'application/json; charset=utf-8');
    xmlhttp.send(JSON.stringify(objParam));
    console.log("get reservation list");
}