<template>
  <view class="container">
    <!-- 顶部标题 -->

    <view class="header">
	 <view class="header_info">
		 <text class="header_text" :title="title">{{title}}</text>
		 <text style="margin-right: 0.8rem; font-size: 1.8rem;">|</text>
		 <view @click="change_text" class="header_change">
			 <text >切换</text>
			  <uni-icons type="right" size="30" color="#c2d4de" :size="1"></uni-icons>
		 </view>
	 </view>
    </view>
	
	<view  class="swiper">
		<image  class="swiper-image"  src="/static/image/组 71699.png"></image>
	</view>


<view class="order_Entry_container" @click="orderEntry">
 <image class="order_Entry_image" src="/static/image/组 71699_1@3x.png"></image>
 <text style="color: #115881;font-weight: bold;margin-left: 1rem;">录入订单</text>
 <uni-icons class="order_Entry_end" type="right" :size="25" color="#306e91"></uni-icons>
</view>

<view v-if="isshow" class="show_container"> 
<view class="isshow-header">
	<uni-icons class=" isshow-header-content-icon" type="search" :size="20"></uni-icons>
	<uni-easyinput :inputBorder="false" @input="handleSearch" class=" isshow-header-content-input" v-model="ServiceName" placeholder="请输入服务名称"  />
	<text class="isshow-header-content-text" @click="searchName">搜索</text>
</view>
<view class="isshow-content" >
	<text class="isshow-content-text" v-for="(item, index) in textcontent" :key="index"  @click="change_city(item.name)">{{item.name}}</text>
</view>
</view>

<view v-if="isshow_1" class="show_container_1"> 
<image class="show_container_1_image" src="/static/image/图层_6.png"></image>
<view class="show_container_1_footer">
	<text>门店已经切换为{{title}}</text>
	<button @click="close_view">好的</button>
</view>
</view>

</view>
</template>

<script>
export default {
  data() {
    return {
	  ServiceName:'',
	  title:"北京汽车有限公司",
	  isshow:false,
	  isshow_1:false,
	  newListData:[],
	  allMsg : [
	    { name: "myhua", id: 1 },
	    { name: "mp3", id: 2 },
	    { name: "hello", id: 3 },
	    { name: "world", id: 4 },
	    { name: "warm weather", id: 5 },
	    { name: "m3", id: 6 },
	    { name: "hahaha", id: 7 }
	  ],
	textcontent: [],
    };
  },
  mounted() {
     this.allMsg = [
       { name: "myhua", id: 1 },
       { name: "mp3", id: 2 },
       { name: "hello", id: 3 },
       { name: "world", id: 4 },
       { name: "warm weather", id: 5 },
       { name: "m3", id: 6 },
       { name: "hahaha", id: 7 }
     ];
     this.textcontent = this.allMsg;
	 
   },
  methods: {
	  change_text(){
		  
		  if(this.isshow){
			  this.isshow=false;
		  }else{
			  this.isshow=true;
			  console.log('111')
		  }
	  },
	  orderEntry(){
		  console.log('111');
		  uni.navigateTo(
		  { url: '/pages/views/dingDanCreate' }
		  )
	  },
	  // 搜索城市名字
	  searchName(){
		  
	  },
	  change_city(name){
		  this.title = name;
		  this.change_text();
		  this.isshow_1 = true;
	  },
	  close_view(){
		  this.isshow_1 = false;
	  },
	  // 模糊匹配
	  // 右上角搜索框--模糊查询
	      handleSearch(event) {
			  console.log(event);
			  if(event){
				  let queryStringArr = event.split("");
				  let str = "(.*?)";
				  this.textcontent = [];
				  let regStr = str + queryStringArr.join(str) + str;
				  let reg = RegExp(regStr, "i"); // 以mh为例生成的正则表达式为/(.*?)m(.*?)h(.*?)/i
				  this.allMsg.map(item => {
				    if (reg.test(item.name)) {
				      this.textcontent.push(item);
				    }
				  });
			  }else {
				  this.textcontent=[];
				  this.textcontent = this.allMsg;
			  }
	      }
  }
};
</script>

<style>

.container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background-color: #f5f5f5;
}
/* 头部 */
.header {
  padding: 1rem;
  width: 100%;
  height: 15%;
  background-color: #044f7a;
  color: #fff;
  display: flex;
  flex-direction: row;
  align-items: center;
}
.header_info{
	width: 100%;
	display: flex;
	flex-direction: row;
	align-items: center;
		color: #e0e9ef;
}

.header_text{
	width: 45%;
white-space: nowrap;/*设置不换行*/
 overflow: hidden; /*设置隐藏*/
  text-overflow: ellipsis; /*设置隐藏部分为省略号*/
}
.header_change{
	width: 100%;
	display: flex;
	flex-direction: row;
	align-items: center;
}
/* 订单录入 */
.order_Entry_container{
	width: 90%;
	height: 8%;
	background-color: #d9e5eb;
	border-radius: 0.6rem;
	left:5%;
	display: flex;
	flex-direction: row;
	align-items: center;
	margin-top: 10%;
}
.order_Entry_image{
	width: 10%;
	height: 70%;
	margin-left: 3%;
}
.order_Entry_end{
	  margin-left: auto;
	  margin-right: 7%;
}
/* 轮播图 */
.swiper {
  height: 30%;
  width: 100%;
  display: flex;
  flex-direction: row;
  align-items: center;
  overflow: hidden;
}

.swiper-image {
  width: 100%;
 height: 100%;
  margin: 0 auto;
}

.form {
  flex: 1;
  padding: 1rem;
}


.submit-button {
  width: 100%;
  height: 2rem;
  background-color: #007aff;
  color: #fff;
  border: none;
  border-radius: 0.3rem;
  font-size: 1rem;
}

.footer {
  display: flex;
  justify-content: space-around;
  padding: 0.8rem;
  background-color: #fff;
  border-top: 1rem solid #ccc;
}

.nav-item {
  text-align: center;
}

.nav-item text {
  font-size: 0.9rem;
}

.icon-image{
	width: 30%;
	height: 10rem;
	margin: 0 auto;
	margin-top:  1rem;
}

/* 遮罩层 */
.show_container{
	width: 60%;
	height: 36%;
	background-color: #ffffff;
	position: absolute;
	border-radius: 1rem;
	/* border: 1rem solid; */
	box-shadow: 0rem 0.2rem 0rem #e4e4e4;
	left:5%;
	top: 13%;
	z-index:999;
	display: flex;
	flex-direction: column;
	align-items: center;
}
.isshow-header{
	width: 90%;
	height: 30%;
	display: flex; 
	justify-content: center;
	align-items: center;
	flex-direction: row;
	color: #3c7697;
}
.isshow-header-content-icon{
	width: 10%;
	height: 30%;
}
.isshow-header-content-input{
	width: 80%;
	height: 40%;
	margin: 0 1rem 0 1rem;
	border:none;
	outline:none;
}
.isshow-content{
	height: 70%;
	display: flex;
	flex-direction: column;
	align-items: center;
	overflow-y:scroll;
}
.isshow-content-text{
	color: #414141;
	height: 1.5rem;
	width: 100%;
	line-height: 1.5rem;
	margin: 1rem 0 1rem 0;
	font-size: 0.8rem;
}
.isshow-content::-webkit-scrollbar {
    display: none;
}
/* 提示框*/
.show_container_1{
	width: 80%;
	height: 40%;
	background-color: #ffffff;
	position: absolute;
	border-radius: 1rem;
	/* border: 1rem solid; */
	box-shadow: 0rem 0.2rem 0rem #e4e4e4;
	left:10%;
	top: 30%;
	z-index:999;
	display: flex;
	flex-direction: column;
	align-items: center;
}
.show_container_1_image{
	height: 50%;
	width: 50%;
	top: 5%;
}
.show_container_1_footer{
	height: 50%;
	width: 100%;
	color:#0b5583;
	display: flex;
	flex-direction: column;
	align-items: center;
	font-weight: bold;
	font-size: 0.7rem;
}
.show_container_1_footer text{
	margin-top: 10%;
}
.show_container_1_footer button{
	color:#0b5583;
	height: 30%;
	border-radius: 1.8rem;
	width: 80%;
	margin-top: 5%;
	border: 1rem solid #0c547e;
	display: flex;
	justify-content: center;
	align-items: center; 
}
</style>