import Vue from "vue";
import Router from "vue-router";
import ReportData from "@/components/reportData";
import SaleData from "@/components/saleData";
import CollectData from "@/components/collectData";
import ajaxAuth from "../script/api/auth.js";
import globalData from "@/components/common/globaldata/global.data.vue";

import TargetImport from "@/components/targetImport";
import saleGmv from "@/components/saleGmv";
import businessData from "@/components/businessData";
import serviceQualityData from "@/components/serviceQualityData";
import serviceAbility from "@/components/serviceAbility";
import saleDetail from "@/components/saleDetail";
import businessDetail from "@/components/businessDetail";
import serviceQualityDetail from "@/components/serviceQualityDetail";
import serviceAbilityDetail from "@/components/serviceAbilityDetail";
import servantDetail from "@/components/servantDetail";
import nannyData from "@/components/nannyData";
import nannyDataNew from "@/components/nannyDataNew";
import marketRebuyRemind from "@/components/marketRebuyRemind"

import callTask from "@/components/callTask"; //电访任务报表
import onlineChatData from "@/components/onlineChatData";
import mallRecommendData from "@/components/mallRecommendData";
import orderHeatMap from "@/components/orderHeatMap";
import serviceQualityDataHm from "@/components/serviceQualityDataHm";

import serviceRebuy from "@/components/serviceRebuy"; //服务力服务单次卡T+7复购
import serviceSalary from "@/components/serviceSalary"; //服务力薪资
import marketrRebuyPR from "@/components/marketrRebuyPR"; //复购率报表
import cleaningDataMonitor from "@/components/cleaningDataMonitor"; //保洁数据监控
import bjManagerTool from "@/components/bjManagerTool"; //保洁数据监控
import stockIndex from "@/components/stockIndex"; //库存指标
import repurchaseDetail from "@/components/repurchaseDetail"; //复购明细
import marketActivity from "@/components/marketActivity"; //市场活动

import cpJoinByUser from "@/components/cpJoinByUser"; //企微添加数 by user
import cpJoinData from "@/components/cpJoinData"; //企微添加数 （预采，日常回访2个维度）

import douyinPage from "@/components/douyin/douyinPage"; //抖音页面点击数据
import douyinSales from "@/components/douyin/douyinSales"; //抖音销售服务相关数据
import douyinFiance from "@/components/douyin/douyinFiance"; //抖音财务对账
import douyinShopScore from "@/components/douyin/douyinShopScore"; //抖音门店分数
import douyinBoard from "@/components/douyin/douyinBoard"; //抖音财务对账
import douyinRebuy from "@/components/douyin/douyinRebuy"; //抖音复购
import douyinServant from "@/components/douyin/douyinServant"; //抖音服务力看板
import douyinRepurchase from "@/components/douyin/douyinRepurchase"; //抖音复购看板
import douyinBusiness from "@/components/douyin/douyinBusiness"; //抖音业务看板
import reportViewLog from "@/components/reportViewLog"; //报表浏览记录查看
import douyinOrderAssign from '@/components/douyin/douyinOrderAssign';//私域服务工单分配
import douyinReservationVerification from '@/components/douyin/douyinReservationVerification';//预约核销
import saleScreen from "@/components/saleScreen";
import KaoSales from "@/components/caocf/KaoSales"; //花王销售订单
import KaoCom from "@/components/caocf/KaoCom"; //花王销售履约
import serviceGmv from "@/components/serviceGmv"; //服务gmv看板
import serviceGmvZA from "@/components/serviceGmvZA"; //服务gmv众安看板
import huawangRebuy from "@/components/caocf/huawangRebuy"; //花王复购
import KaoDataReport from "@/components/caocf/KaoDataReport"; //花王复购



import '../public-path';
Vue.use(Router);
var isRouteFinish = false;
var iframeList = [];
const router = new Router({
    base: window.__POWERED_BY_QIANKUN__ ? '/report' : '/',
    mode: 'history',  //去掉url中的#
    routes: [{
        path: "/",
        redirect: "/dashboard"
    },
    {
        path: "/saleGmv",
        component: () =>
            import("../components/common/Home.vue"),
        meta: {
            title: "销售数据"
        },
        children: [
            {
                path: "saleScreen",
                name: "saleScreen",
                component: saleScreen,
                meta: {
                    title: "实时销售看板"
                }
            },
            {
                path: "saleDetail",
                name: "saleDetail",
                component: saleDetail,
                meta: {
                    title: "销售明细"
                }
            },
            {
                path: "saleGmv",
                name: "saleGmv",
                component: saleGmv,
                meta: {
                    title: "销售看板"
                }
            },
            {
                path: "servantDetail",
                name: "servantDetail",
                component: servantDetail,
                meta: {
                    title: "保姆明细"
                }
            },
            {
                path: "nannyData",
                name: "nannyData",
                component: nannyData,
                meta: {
                    title: "三嫂数据"
                }
            },
            {
                path: "marketActivity",
                name: "marketActivity",
                component: marketActivity,
                meta: {
                    title: "销售活动"
                }
            },
            {
              path: "nannyDataNew",
              name: "nannyDataNew",
              component: nannyDataNew,
              meta: {
                title: "三嫂列表数据"
              }
            },

        ]

    },
    {
        path: "/businessData",
        component: () =>
            import("../components/common/Home.vue"),
        meta: {
            title: "招商数据"
        },
        children: [
            {
                path: "businessData",
                name: "businessData",
                component: businessData,
                meta: {
                    title: "招商看板"
                }
            },
            {
                path: "businessDetail",
                name: "businessDetail",
                component: businessDetail,
                meta: {
                    title: "招商明细"
                }
            },
        ]
    },
    {
        path: "/douyin",
        component: () =>
            import("../components/common/Home.vue"),
        meta: {
            title: "抖音数据"
        },
        children: [
            {
                path: "douyinBoard",
                name: "douyinBoard",
                component: douyinBoard,
                meta: {
                    title: "抖音看板"
                },
            },
            {
                path: "douyinSales",
                name: "douyinSales",
                component: douyinSales,
                meta: {
                    title: "私域销售明细"
                },
            },
            {
                path: "douyinFiance",
                name: "douyinFiance",
                component: douyinFiance,
                meta: {
                    title: "财务对账"
                },
            },
            {
                path: "douyinPage",
                name: "douyinPage",
                component: douyinPage,
                meta: {
                    title: "小程序数据"
                }
            },

            {
                path: "douyinRebuy",
                name: "douyinRebuy",
                component: douyinRebuy,
                meta: {
                    title: "抖音复购"
                },
            },

            {
                path: "douyinServant",
                name: "douyinServant",
                component: douyinServant,
                meta: {
                    title: "服务力"
                },
            },

            , {
                path: "douyinRepurchase",
                name: "douyinRepurchase",
                component: douyinRepurchase,
                meta: {
                    title: "复购看板"
                }
            },
            {
                path: "douyinBusiness",
                name: "douyinBusiness",
                component: douyinBusiness,
                meta: {
                    title: "抖音业务看板"
                },
            },

            {
                path: "douyinShopScore",
                name: "douyinShopScore",
                component: douyinShopScore,
                meta: {
                    title: "门店评分"
                },
            },
            {
                path: "douyinReservationVerification",
                name: "douyinReservationVerification",
                component: douyinReservationVerification,
                meta: {
                    title: "预约核销"
                }
            },
            {
                path: "douyinOrderAssign",
                name: "douyinOrderAssign",
                component: douyinOrderAssign,
                meta: {
                    title: "私域服务工单分配"
                }
            },
        ]
    },
    {
        path: "/serviceQualityData",
        component: () =>
            import("../components/common/Home.vue"),
        meta: {
            title: "服务质量数据"
        },
        children: [
            {
                path: "serviceQualityData",
                name: "serviceQualityData",
                component: serviceQualityData,
                meta: {
                    title: "服务质量看板"
                }
            },
            {
                path: "serviceQualityDetail",
                name: "serviceQualityDetail",
                component: serviceQualityDetail,
                meta: {
                    title: "服务质量明细"
                }
            },
            {
                path: "callTask",
                name: "callTask",
                component: callTask,
                meta: {
                    title: "电访任务报表"
                }
            },

            {
                path: "serviceQualityDataHm",
                name: "serviceQualityDataHm",
                component: serviceQualityDataHm,
                meta: {
                    title: "服务质量"
                }
            },

        ]
    },

    {
        path: "/serviceAbility",
        component: () =>
            import("../components/common/Home.vue"),
        meta: {
            title: "服务力数据"
        },
        children: [
            {
                path: "serviceGmv",
                name: "serviceGmv",
                component: serviceGmv,
                meta: {
                    title: "服务GMV看板"
                }
            }, {
                path: "serviceGmvZA",
                name: "serviceGmvZA",
                component: serviceGmvZA,
                meta: {
                    title: "服务GMV众安"
                }
            },
            {
                path: "serviceAbility",
                name: "serviceAbility",
                component: serviceAbility,
                meta: {
                    title: "服务力看板"
                }
            },
            {
                path: "serviceAbilityDetail",
                name: "serviceAbilityDetail",
                component: serviceAbilityDetail,
                meta: {
                    title: "服务力明细"
                }
            },

            {
                path: "serviceSalary",
                name: "serviceSalary",
                component: serviceSalary,
                meta: {
                    title: "服务力薪资"
                }
            },
            {
                path: "serviceRebuy",
                name: "serviceRebuy",
                component: serviceRebuy,
                meta: {
                    title: "服务力复购"
                }
            },
            {
                path: "bjManagerTool",
                name: "bjManagerTool",
                component: bjManagerTool,
                meta: {
                    title: "保洁管理工具"
                }
            },
            {
                path: "stockIndex",
                name: "stockIndex",
                component: stockIndex,
                meta: {
                    title: "库存指标"
                }
            },
            {
                path: "cleaningDataMonitor",
                name: "cleaningDataMonitor",
                component: cleaningDataMonitor,
                meta: {
                    title: "保洁监控工具"
                }
            },
            {
                path: "repurchaseDetail",
                name: "repurchaseDetail",
                component: repurchaseDetail,
                meta: {
                    title: "复购看板"
                }
            },

        ]
    },
    {
        path: "/serviceCP",
        component: () =>
            import("../components/common/Home.vue"),
        meta: {
            title: "企微数据"
        },
        children: [
            {
                path: "cpJoinData",
                name: "cpJoinData",
                component: cpJoinData,
                meta: {
                    title: "企微添加分析"
                }
            },

        ]
    },
    {
        path: "/market",
        component: () =>
            import("../components/common/Home.vue"),
        meta: {
            title: "市场营销"
        },
        children: [
            {
                path: "marketrRebuyPR",
                name: "marketrRebuyPR",
                component: marketrRebuyPR,
                meta: {
                    title: "复购分析报表"
                }
            },

            {
                path: "marketRebuyRemind",
                name: "marketRebuyRemind",
                component: marketRebuyRemind,
                meta: {
                    title: "销售复购提醒"
                }
            },
        ]
    },

    {
        path: "/reportLog",
        component: () =>
            import("../components/common/Home.vue"),
        meta: {
            title: "报表日志"
        },
        children: [

            {
                path: "reportViewLog",
                name: "reportViewLog",
                component: reportViewLog,
                meta: {
                    title: "报表浏览记录"
                }
            }

        ]
    },

    {
        path: "/KaoReport",
        component: () =>
            import("../components/common/Home.vue"),
        meta: {
            title: "花王报表"
        },
        children: [ {
            path: "KaoSales",
            name: "KaoSales",
            component: KaoSales,
            meta: {
                title: "销售订单"
            }
        },
        {
            path: "KaoCom",
            name: "KaoCom",
            component: KaoCom,
            meta: {
                title: "销售履约"
            }
        },
          {
            path: "huawangRebuy",
            name: "huawangRebuy",
            component: huawangRebuy,
            meta: {
              title: "花王复购"
            }
          },
          {
            path: "KaoDataReport",
            name: "KaoDataReport",
            component: KaoDataReport,
            meta: {
              title: "花王数据看板"
            }
          }
        ]
    },

    {
        path: "/targetImport",
        name: "TargetImport",
        component: TargetImport,
        meta: {
            title: "目标值导入"
        }
    },
    {
        path: "/onlineChatData",
        name: "onlineChatData",
        component: onlineChatData,
        meta: {
            title: "在线客服报表"
        }
    },

    {
        path: "/mallRecommendData",
        name: "mallRecommendData",
        component: mallRecommendData,
        meta: {
            title: "商城引荐看板"
        }
    },
    {
        path: "/orderHeatMap",
        name: "orderHeatMap",
        component: orderHeatMap,
        meta: {
            title: "订单热力图"
        }
    },



    {
        path: "/",
        component: () =>
            import("../components/common/Home.vue"),
        meta: {
            title: "自述文件"
        },
        children: [{
            path: "/dashboard",
            component: () =>
                import("../components/page/Dashboard.vue"),
            meta: {
                title: "首页"
            }
        },
        {
            path: "/reportData",
            name: "ReportData",
            component: ReportData,
            meta: {
                title: "报表数据"
            }
        },
        {
            path: "/saleData",
            name: "SaleData",
            component: SaleData,
            meta: {
                title: "销售报表"
            }
        },
        {
            path: "/collectData",
            name: "CollectData",
            component: CollectData,
            meta: {
                title: "服务Gmv统计报表"
            }
        },



        ]
    },
    {
        path: "/login",
        component: () =>
            import("../components/page/Login.vue")
    },
    {
        path: "/hsMap",
        component: () =>
            import("../components/page/hsMap.vue")
    }
    ]





});


function checkurl(url) {
    let userMenu = JSON.parse(window.localStorage.getItem("menulist")); //菜单list
    let boo = false;
    if (userMenu == undefined) {
        return boo;
    }
    for (let i = 0; i < userMenu.length; i++) {
        let murl = userMenu[i].menuUrl;
        if (url.indexOf(murl) != -1) {
            boo = true;
            break;
        }
    }

    return boo;
}

export default router;
