var tmpl=`
                <div class="mobiledealsearch-search" style="font-size: .28rem;
                                                        width: 6.90rem;
                                                        height: .60rem;
                                                        background: rgba(245, 245, 245, 1);
                                                        border-radius: .04rem;
                                                        color: #999999;
                                                        line-height: .6rem;
                                                        box-sizing: border-box;
                                                        padding-left: .2rem;">
                        <i class="el-icon-search" style="color: #999999;"></i>
                        <input @keyup.enter="getSearchList" style="outline: none;border: none;width: 5.7rem;background: rgba(245, 245, 245, 1);" type="text" v-model="searchValue" placeholder="请输入商标名称搜索">
                        <i @click="delValue" class="mintui mintui-guanbi" style="margin-right: .3rem;
        float: right;color: #999999;"></i>
                </div>
`
module.exports=
`{
   template:'${tmpl}',  
   props:['from'],
   data(){
           return{
                  searchValue:'',
                  obj:{},
           }
   },
   mounted(){
           this.searchValue = this.$route.query.data;
   },
   methods:{
           delValue(){
                   this.searchValue = '';
           },
           getObj(data){
                   this.obj = data;
                   console.log(data,"vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv");
           },
           getSearchList(){
                   this.obj = {
                                currentpage: 1,
                                keyword: "",
                                max: 1000000,
                                min: 0,
                                order: "",
                                pagesize: 10,
                                sort: "",
                                tm_nclcode: [],
                                tm_structure: "",
                                tm_word: "",
                        };

                   if(this.from=="history"){
                        let { dealHistroy } = localStorage;
                        let data = this.searchValue;
                        if (!dealHistroy) {
                                let arr = [];
                                arr.push(data);
                                let str = JSON.stringify(arr);
                                localStorage.dealHistroy = str;
                        } else {
                                let arr = JSON.parse(dealHistroy);
                                arr.push(data);
                                if (arr.length > 10) {
                                        arr.shift();
                                }
                                let sortArr = arr.reverse();
                                let str = JSON.stringify([...new Set(arr)]);
                                localStorage.dealHistroy = str;
                        }
                           this.$router.push({path:'/mobiledeallist',query:{data}});
                   }


                   /* 需要把搜索结果返回给爸爸哦 */
                   if(this.from=="list"){
                        this.obj.keywords =  this.searchValue;
                        let { dealHistroy } = localStorage;
                        let data = this.searchValue;
                        /**没缓存 */
                        if (!dealHistroy) {
                                let arr = [];
                                arr.push(data);
                                let str = JSON.stringify(arr);
                                localStorage.dealHistroy = str;
                                this.currentpage = 1;
                         this.$root.postReq('/web/trademarktransactionCtl/tmTransactionSearch', this.obj).then((res) => {
                                console.log('bbbbbbbbbbbbbbbbbbb', res);
                                if (res.status == 0) {
                                    this.$emit('searchResult',res.data.rows);
                                }

                        });
                        } else {
                                /**有缓存 */
                                let arr = JSON.parse(dealHistroy);
                                arr.push(data);
                                if (arr.length > 10) {
                                        arr.shift();
                                }
                                let sortArr = arr.reverse();
                                let str = JSON.stringify([...new Set(arr)]);
                                localStorage.dealHistroy = str;
                                this.currentpage = 1;
                        this.$root.postReq('/web/trademarktransactionCtl/tmTransactionSearch', this.obj).then((res) => {
                                if (res.status == 0) {
                                        this.$emit('searchResult',res.data.rows);

                                }

                        });
                   
                        }
                           
                   }
                 
                  
           },

   },
   vname:"gsb-mobiledealsearch"
}`
