{
        template: '${tmpl}',
                data: function() {
                        return {
                                autoFill: false,
                                oneCondition: ['相同商标', '相似商标', '申请人', '申请号'],
                                twoCondition: ['申请类别', '法律状态', '申请年份'],
                                /*所有数据 */
                                loading: false,
                                data: null,
                                searchValue: null,
                                /* 数据数量合计 */
                                dataListCount: null,
                                /*弹框开关 */
                                popupShow: false,
                                /*二级菜单ID */
                                secondLevelId: null,
                                /* 弹框数据 */
                                type: [],
                                /*列表数据row */
                                listInfo: null,
                                /* 下拉加载如果数据全部获取到改为true */
                                allLoaded: false,
                                /**按钮切换 */
                                titlecolor: 1,
                                titlecolortwo: null,
                                /* 清空 */
                                obj: {},
                                currentPage: 1,
                                /*搜索历史 */
                                historySearch: [],
                                /**post当前筛选条件存储 */
                                postMsg: {},
                                itemUrl: '/web/bytmqueryCtl/findTrademarkNameAccurate',
                                pagesCount: null,
                                url: null,
                        }
                },
        mounted: function() {
                /**初始化数据 */
                this.init();/* */
                this.$root.hidemenu();

        },
        created: function() {
                this.searchValue = this.$route.query.data;
        },
        updated() {
                /*
                this.allLoaded = false;
                */
        },
        methods: {
                init() {
                        console.log('fffffffffffffffffffffffffffffff');
                        let obj = {};
                        obj.name = this.$route.query.data;
                        this.loading = true;
                        this.getListInfo(obj, '/web/bytmqueryCtl/findTrademarkName');
                },
                maskHide(){
                        this.popupShow = false;
                },
                search(){
                        $('.mobilesearchlist input').blur();
                        this.currentPage = 1;
                        let { historySearch } = localStorage;
                        let data = this.searchValue;
                        if (!historySearch) {
                                let arr = [];
                                arr.push(data);
                                let str = JSON.stringify(arr);
                                localStorage.historySearch = str;
                        } else {
                                let arr = JSON.parse(historySearch);
                                arr.push(data);
                                if (arr.length > 10) {
                                        arr.shift();
                                }
                                let sortArr = arr.reverse();
                                let str = JSON.stringify([...new Set(arr)]);
                                localStorage.historySearch = str;
                        }
                        let obj = {};
                        obj.name = this.searchValue;
                        this.loading = true;
                        this.getListInfo(obj, '/web/bytmqueryCtl/findTrademarkName');
                        /* 存储搜索历史 */


                },
                firstLevel(idx, item){
                        var obj = {};
                        this.postMsg.currentPage = 1;
                        obj.name = this.searchValue;
                        switch (idx) {
                                case 0:
                                        this.popupShow = false;
                                        this.titlecolor = idx;
                                        if (this.twoCondition.length > 3) {
                                                this.twoCondition.pop();
                                        }
                                        this.loading = true;
                                        this.getListInfo(obj, '/web/bytmqueryCtl/findTrademarkNameAccurate');
                                        break;
                                case 1:
                                        this.popupShow = false;
                                        this.titlecolor = idx;
                                        if (this.twoCondition.length > 3) {
                                                this.twoCondition.pop();
                                        };
                                        this.loading = true;
                                        this.getListInfo(obj, '/web/bytmqueryCtl/findTrademarkName');


                                        break;
                                case 2:
                                        this.popupShow = false;
                                        this.titlecolor = idx;
                                        if (this.twoCondition.length < 4) {
                                                this.twoCondition.push("申请人");
                                        }
                                        this.loading = true;
                                        obj.regMan = this.searchValue;
                                        this.getListInfo(obj, '/web/bytmqueryCtl/findTrademarkzcr');
                                        break;

                                case 3:
                                        this.popupShow = false;
                                        this.titlecolor = idx;
                                        if (this.twoCondition.length > 3) {
                                                this.twoCondition.pop();
                                        }

                                        obj = {};
                                        obj.regNum = this.searchValue;
                                        this.loading = true;
                                        this.getListInfo(obj, '/web/bytmqueryCtl/findTrademarkzchAccurate');
                                        break;
                                default:

                                        break;
                        }
                },
                secondLevel(idx, item){
                        this.postMsg.currentPage = 1;
                        this.secondLevelId = idx;
                        console.log(this.secondLevelId);
                        this.popupShow = true;
                        switch (idx) {
                                case 0:
                                        this.titlecolortwo = idx;
                                        this.type = this.data.code_counts;
                                        break;
                                case 1:
                                        this.titlecolortwo = idx;
                                        this.type = this.data.status_counts;
                                        break;
                                case 2:
                                        this.titlecolortwo = idx;
                                        let arr = this.data.year_counts;

                                        for (var i = 0; i < arr.length; i++) {
                                                arr[i]['keyvalue'] = arr[i].key
                                        }
                                        this.type = arr;


                                        break;
                                case 3:
                                        this.titlecolortwo = idx;
                                        /**申请人点击有的话再赋值 */
                                        var arr1 = this.data.namecounts;
                                        console.log(arr1);
                                        for (var i = 0; i < arr1.length; i++) {
                                                arr1[i]['keyvalue'] = arr1[i].key
                                        }
                                        this.type = arr1;
                                        break;
                                default:

                                        break;
                        }




                },
                trdSeleted(item){
                        this.popupShow = false;
                },
                secondLevelItem(idx, item){


                        /*
                         "tmName": name,
                                "sqlbtabkey": sqlbtabkey || "",
                                "flzttabkey": flzttabkey || "",
                                "sqnftabkey": sqnftabkey || "",
                                "ncl": [],
                                "xcl": [],
                                "nclNum": [],
                                "sbtjdata": ["近似", "变字", "拼音", "同义词", "形近字", "换序", "包含该商标"],
                                "pageSize": 20,
                                "currentPage": 1
                        
                        */

                        console.log(idx, this.listInfo, "@@@@@@@@@@@@@@@@@@@@", this.type);
                        this.postMsg.currentPage = 1;
                        var obj = {};
                        obj.name = this.searchValue;
                        switch (this.secondLevelId) {

                                case 0:
                                        this.url = '/web/bytmqueryCtl/findTrademarkNameAccurate';
                                        obj.sqlbtabkey = this.type[idx].key;
                                        break;
                                case 1:
                                        this.url = '/web/bytmqueryCtl/findTrademarkNameAccurate';
                                        obj.flzttabkey = this.type[idx].key;
                                        break;
                                case 2:
                                        this.url = '/web/bytmqueryCtl/findTrademarkNameAccurate';
                                        obj.sqnftabkey = this.type[idx].key;
                                        break;
                                case 3:
                                        this.url = '/web/bytmqueryCtl/findTrademarkzcr';
                                        obj.zcrname = this.type[idx].key;
                                        console.log(this.type[idx].key, "mmmmmmmmmmmmmmm");
                                        obj.regMan = this.searchValue;
                                        break;
                        }
                        this.getListInfo(obj, this.url);



                },
                back(){
                        window.history.go(-1);
                },
                goSearchDetail(idx, item){
                        console.log(idx, item);
                        var data = {};
                        data.gjfl = item.gjfl;
                        data.sbzch = item.sbzch;
                        data.gjflname = item.gjflname;
                        var data = JSON.stringify(data);
                        this.$router.push({ path: '/mobilesearchdetail', query: { data } });

                },
                getListInfo(obj, url){
                        this.allLoaded = false;
                        /*是否需要分页 默认每页20条数据*/
                        this.loading = true;
                        !obj.pages ? obj.pages = 20 : "";
                        console.log(obj.currentPage, "xxxxxxxxxxxxx");
                        this.url = url;
                        let { name, pages, zcrname, sqlbtabkey, flzttabkey, sqnftabkey, regNum, currentPage, regMan } = obj;
                        let postMsg = {
                                "tmName": name,
                                "sqlbtabkey": sqlbtabkey || "",
                                "flzttabkey": flzttabkey || "",
                                "sqnftabkey": sqnftabkey || "",
                                "regNum": regNum || "",
                                "regMan": regMan || "",
                                "ncl": [],
                                "xcl": [],
                                "nclNum": [],
                                "sbtjdata": ["近似", "变字", "拼音", "同义词", "形近字", "换序", "包含该商标"],
                                "zcrname": zcrname || "",
                                "pageSize": pages,
                                "currentPage": currentPage || 1,
                        };
                        this.postMsg = postMsg;
                        console.log(postMsg, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~");

                        this.$root.postReq(url, postMsg).then((res) => {
                                console.log(postMsg.currentPage, res, '0000000000000000000000');
                                if (postMsg.currentPage != 1) {
                                        res.data.rows.forEach(item => {
                                                this.listInfo.push(item);
                                        });
                                        console.log(this.listInfo.length, "/../.....................");
                                        this.loading = false;
                                        this.data = res.data;
                                        this.type = res.data.code_counts;
                                        this.dataListCount = res.data.count;
                                        if (res.data.rows.length >= 20) {
                                                $('.mint-loadmore-bottom').css('display', 'block');
                                        } else {
                                                $('.mint-loadmore-bottom').css('display', 'none');
                                        }
                                        console.log(this.currentPage, this.dataListCount, res.data, "xxxxxxxxxxxxxxxxxxxddddzzzzzzzz");
                                        if (res.data.rows.length < 20 || this.currentPage > this.pagesCount) {
                                                this.allLoaded = true;
                                        }
                                } else {
                                        this.loading = false;
                                        this.data = res.data;
                                        this.dataListCount = res.data.count;
                                        this.listInfo = res.data.rows;
                                        this.type = res.data.code_counts;
                                        this.pagesCount = Math.abs(this.dataListCount / this.listInfo.length) + 1;
                                        if (res.data.rows.length >= 20) {
                                                $('.mint-loadmore-bottom').css('display', 'block');
                                        } else {
                                                $('.mint-loadmore-bottom').css('display', 'none');
                                        }
                                        if (this.listInfo.length < 20 || this.currentPage > this.pagesCount) {
                                                this.allLoaded = true;
                                        }
                                }

                        });
                },
                /**上拉加载 */
                loadBottom() {
                        /* ...加载更多数据*/
                        /*
                        刷新改page只改页码..其他值不变
                        */
                        this.postMsg.name = this.searchValue;
                        this.postMsg.currentPage = ++this.currentPage;
                        console.log(obj.currentPage, "xxxxxxxxxxxxxxxxxzzzzzzzzzz", this.postMsg);
                        this.getListInfo(this.postMsg, this.url);
                        this.$refs.loadmore.onBottomLoaded();

                        /* this.allLoaded = true; 若数据已全部获取完毕 */

                },
                /*
                        loadTop() {
                                let obj = {};
                                obj.pages = this.currentPage;
                                obj.name = this.searchValue;
                                obj.currentPage = ++this.currentPage;
                                this.getListInfo(obj, '/web/bytmqueryCtl/findTrademarkName');
                                
                                this.$refs.loadmore.onTopLoaded();
                        }
                */
        },
        vname: "gsb-mobilesearchlist"
}
