import $http from "./request/requestConfig"
import {
    BASE_URI
} from "../pages/utils/constant.js";
import qs from 'qs';

const baseUri = '/smartParkH5Server'
const parkActivity = '/wx/WxParkVenueAppointController'
export function login(data) {
    return $http.post(
        '/wx/auth/login_by_app_main?' + qs.stringify(data), {}, {})

}

export function addRectificationManagement(data) {

    return $http.post(
        '/wx/RectificationController/addRectificationManagement',
        data, {}
    )
}
export function getUserLocalStorageInfo() {
    const userInfo = JSON.parse(
        uni.getStorageSync("laocui_user_info"));
    return userInfo
}
export function uploadPDF() {
    uni.showLoading({
        title: '加载中',
        mask: true
    });
    return new Promise((resolve, reject) => {
        uni.chooseMessageFile({
            count: 1, //默认100
            type: 'file',
            success: (res) => {
                uni.uploadFile({
                    url: BASE_URI + "/wx/fileController/upload",
                    filePath: res.tempFiles[0].path,
                    name: "file",
                    formData: {
                        user: "test"
                    },
                    success(successRes) {
                        // 上传完成需要更新 fileList
                        let data = JSON.parse(successRes.data);
                        uni.showToast({
                            title: '提交成功',
                            duration: 500
                        });
                        resolve({
                            url: data.data[0],
                            name: res.tempFiles[0].name
                        })

                    },
                    fail(res) {},
                });

            },
            fail(e) {
                uni.showToast({
                    title: '提交成功',
                    duration: 0
                });
            }
        });
    })
}
export function getBuildDetails(data) {
    return $http.post(
        '/wx/MnpBuildingController/getById',
        data, {}
    )
}

export function addZaiti(data) {
    return $http.post(
        '/wx/ParkRoomController/add',
        data, {}
    )
}


export function getPartyBranchList(data) {
    return $http.post(
        '/wx/partyBranch/getPartyBranchList',
        data, {}
    )
}
export function selectByCompanyId(data) {
    return $http.post(
        '/wx/SocialCarrierController/selectByCompanyId',
        data, {}
    )
}
export function getTreeData2(data) {
    return $http.post(
        '/wx/ParkInfoController/getTreeData2',
        data, {}
    )
}
export function getTreeData6(data) {
    return $http.post(
        '/wx/ParkInfoController/getTreeData6',
        data, {}
    )
}
export function getActivationRanking(data) {
    return $http.post(
        '/wx/partyBranch/getActivationRanking',
        data, {}
    )
}
export function findRectificationManagementInOutList(data) {
    return $http.post(
        '/wx/RectificationController/findRectificationManagementInOutList',
        data, {}
    )
}

export function findRectificationManagementInOutById(e) {
    return $http.post(
        '/wx/RectificationController/findRectificationManagementInOutById', {
            id: e
        }, {}
    )
}
export function repairList(data) {
    return $http.post(
        '/wx/repair/list',
        data, {}
    )
}

export function addSafetySelfCheckingManage(data) {
    return $http.post(
        '/wx/SafetyController/addSafetySelfCheckingManage',
        data, {}
    )
}
export function updateSafetySelfCheckingManage(data) {
    return $http.post(
        '/wx/SafetyController/updateSafetySelfCheckingManage',
        data, {}
    )
}
export function editRepair(data) {
    return $http.post(
        '/wx/repair/edit',
        data, {}
    )
}
export function addRepair(data) {
    return $http.post(
        '/wx/repair/add',
        data, {}
    )
}
export function getRepairDispatchById(id) {
    return $http.post(
        '/wx/repair/getById', {
            id: id
        }, {}
    )
}
export function getDispatchToPerson(data) {
    return $http.post(
        '/wx/repair/getDispatchToPerson',
        data, {}
    )
}
export function getCompanyById(data) {
    return $http.post(
        '/wx/repair/getCompanyById', data, {},

    )
}

export function getWxCompanyTags(e) {
    return $http.post(
        '/wx/MnpTagInfoController/tagInfoList', e, {}
    )
}

export function tagsBind(e) {
    return $http.post(
        '/wx/MnpTagInfoController/bind', e, {}
    )
}
export function getDetial(e) {
    return $http.post(
        '/wx/WxParkVenueAppointController/VenueAppointDetail', e, {}
    )
}
export function saleControllerGetById(e) {
    return $http.post(
        '/wx/SaleController/getById', {
            id: e
        }, {}
    )
}

export function getAppUserMain(data) {
    return $http.post(
        '/wx/company/getById',
        data, {}
    )
}

export function confirmAudit(data) {
    return $http.post(
        '/wx/WxParkVenueAppointController/confirmAudit',
        data, {}
    )

}
export function getCompanyTags(e) {
    return $http.post(
        '/wx/MnpTagInfoController/getCompanyTags', e, {}
    )
}
export function getCompanyTagsByQybq(qybq) {
    return $http.post(
        '/wx/MnpTagInfoController/getCompanyTagsByQybq', {
            qybq: qybq
        }, {})
}
export function companyECdit(data) {
    return $http.post(
        '/wx/company/edit', data, {})
}

export function tagInfoList(e) {
    return $http.post(
        '/wx/MnpTagInfoController/tagInfoList',
        e, {})
}
export function findDeptList() {

    return $http.post(
        '/wx/SaleController/findDeptList', {}, {})

}
export function tagCategoryList() {
    return $http.post(
        '/wx/MnpTagController/tagCategoryList', {}, {}
    )
}
export function interviewEscalationListAll(id) {
    return $http.post('/wx/interviewEscalation/listAll', {
        companyId: id
    }, {})
}
export function getUserInfo(data) {
    let laocui_user_info = JSON.parse(uni.getStorageSync('laocui_user_info'))
    return $http.post(
        '/wx/frameUser/getMyInfo?userId=' + laocui_user_info.user.id, {}, {})

}

export function getRoomInfo(e) {
    return $http.post(
        '/wx/ParkRoomController/getById', {
            id: e
        }, {})
}
export function getCompanyHouseDetails(e) {
    return $http.post(
        '/wx/company/getById', {
            id: e
        }, {})
}
export function handleList(e) {
    return $http.post(
        '/wx/workPaneController/handleList',
        e, {})
}
export function readList(e) {
    return $http.post(
        '/wx/workPaneController/readList',
        e, {})
}
// handleList?
export function findCompanyTags(e) {
    return $http.post(
        '/wx/MnpTagInfoController/getCompanyTags/' + e, {}, {})
}
export function removeTagsBind(e) {
    return $http.post(
        '/wx/MnpTagInfoController/removeBind', e, {}
    )
}
export function addInterview(e) {

    return $http.post(
        "/wx/interviewEscalation/add", e, {})
}
export function editInterview(e) {
    return $http.post(
        "/wx/interviewEscalation/edit", e, {})
}
export function getInterviewList(e) {
    return $http.post(
        "/wx/interviewEscalation/list", e, {})
}
export function getInterviewDetails(e) {
    return $http.post(
        "/wx/interviewEscalation/getById", {
            id: e
        }, {})
}
export function findSafetySelfCheckingPlanById(e) {
    return $http.post(
        "/wx/SafetyController/findSafetySelfCheckingPlanById", {
            id: e
        }, {})
}
// 
export function findSafetySelfCheckingPlanList(e) {
    return $http.post(
        "/wx/SafetyController/findSafetySelfCheckingPlanList",
        e, {})
}
export function getBySaveStatus(e) {
    return $http.post(
        "/wx/interviewEscalation/getBySaveStatus", {
            createdBy: e
        }, {})
}
export function companyExamineAdd(e) {
    return $http.post(
        "/wx/company/add", e, {})
}
export function listByModel(e) {
    return $http.post(
        '/wx/SaleController/findSaleManagementListByRoomId',
        e, {})
}
export function listVo(e) {
    // 查询园区列表，不需要参数
    return $http.post(
        '/wx/company/listVo', e, {})
}
// /wx/SafetyController/addSafetySelfCheckingPlan
export function addSafetySelfCheckingPlan(e) {
    // 查询园区列表，不需要参数
    return $http.post(
        '/wx/SafetyController/addSafetySelfCheckingPlan', {
            ...e
        }, {})
}
export function findSafetySelfCheckingManagetById(e) {

    // 查询园区列表，不需要参数
    return $http.post(
        '/wx/SafetyController/findSafetySelfCheckingManagetById', {
            id: e
        }, {})
}
export function findSafetySelfCheckingManageList(e) {

    // 查询园区列表，不需要参数
    return $http.post(
        '/wx/SafetyController/findSafetySelfCheckingManageList', e, {})
}
export function findYuanQuList() {
    // 查询园区列表，不需要参数
    return $http.post(
        '/wx/SaleController/findYuanQuList', {}, {})
}
export function findLongPanList(id) {
    // 用园区ID查询楼盘列表
    return $http.post(
        '/wx/SaleController/findLouPanList', {
            id: id
        }, {})
}
export function findLouDongList(id) {
    // 用园区ID查询楼盘列表
    return $http.post(
        '/wx/SaleController/findLouDongList', {
            id: id
        }, {})
}
export function clickCollect(e) {
    return $http.post(
        '/wx/parkActivity/clickCollect',
        e, {})
}
export function insertRegisSignInfo(e) {
    return $http.post(
        '/wx/parkActivity/insertRegisSignInfo',
        e, {})
}

export function richScan(e) {
    return $http.post(
        '/wx/parkActivity/richScan',
        e, {})
}
export function getActivityById(id, signInCode, userId) {
    return $http.get(
        '/wx/parkActivity/getBySignInCode?id=' + id + '&userId=' + userId + "&signInCode=" + signInCode, {}, {})
}
// /wx/userPower/getUserPower?userId=1088765543780974592
export function getUserPower(e) {
    return $http.post(
        '/wx/userPower/getUserPower', {
            userId: e
        }, {})
}
export function editPassword(e) {
    return $http.post(
        '/wx/frameUser/editPassword', e, {})
}

export function updateListRectificationManagement(e) {

    return $http.post(
        '/wx/RectificationController/updateListRectificationManagement', e, {})
}
// /wx/RectificationController/findUserListByRoleWuye
export function findUserListByRoleWuye() {
    // 用园区ID查询楼盘列表
    return $http.post(
        '/wx/RectificationController/findUserListByRoleWuye',

        {}, {})
}
export function listAllUserMain() {
    // 用园区ID查询楼盘列表
    return $http.post(
        '/wx/UserMainExpandController/listAllUserMain',

        {}, {})
}
export function userList() {
    // http://192.168.2.112:9011/wx/frameUser/userList
    return $http.post(
        '/wx/frameUser/userList',

        {}, {})
}

export function getSelectUserTwo(e) {

    // 用园区ID查询楼盘列表
    return $http.post(
        '/wx/frameUser/getSelectUserTwo', {
            searchName: e
        }, {})
}
export function getSelectDeptTwo(e) {
    // 用园区ID查询楼盘列表
    return $http.post(
        '/wx/frameUser/getSelectDeptTwo',

        {
            searchName: e
        }, {})
}
export function findRoomInfoListByIds(e) {
    // 用园区ID查询楼盘列表
    return $http.post(
        '/wx/SaleController/findRoomInfoListByIds',

        {
            ids: e
        }, {})
}
export function findCompanyList() {
    // 用园区ID查询楼盘列表
    return $http.post(
        '/wx/SaleController/findCompanyList', {}, {})
}

export function addyixiang(e) {
    return $http.post(
        '/wx/SaleController/add',
        e, {})
}
export function findCompanyInfoList(data) {
    return $http.post(
        "/wx/SaleController/findCompanyInfoList",
        data, {}
    )
}
export function findRoomByCondition(params) {
    // 用园区ID查询楼盘列表
    return $http.post(
        '/wx/SaleController/findRoomByCondition', params, {})

}
export function getCompanyAll(qymc) {
    return $http.post(
        '/wx/company/listAll', {
            qymc: qymc ? qymc : ""
        }, {})

}
export function getByCodes(params) {
    // 用园区ID查询楼盘列表
    return $http.post(
        '/wx/sysDict/getByCodes',

        {
            codes: params
        }, {})
}



export function list(data) {
    return $http.post(
        parkActivity + '/getVenueAppointList',
        data, {}
    )
}

export function listApp(data) {
    return $http.post(
        parkActivity + '/getVenueAppointListApp',
        data, {}
    )
}





export function cancelAppoint(data) {
    return $http.post(
        parkActivity + '/cancelAppoint',
        data, {}
    )
}


// /wx/SaleController/
export function getRepairList(data) {
    return $http.post(
        '/wx/repair/list',
        data, {}
    )
}