index.html 16.3 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441
<!DOCTYPE html>
<html>

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
	<link rel="stylesheet" type="text/css" href="/themes/simplebootx/Portal/Template/css/swiper-3.4.2.min.css" />
	<link rel="stylesheet" type="text/css" href="/themes/simplebootx/Portal/Template/css/weui.css" />
	<link rel="stylesheet" type="text/css" href="/themes/simplebootx/Portal/Template/css/example.css" />
	<link rel="stylesheet" type="text/css" href="/themes/simplebootx/Portal/Template/css/init.css" />
	<link rel="stylesheet" type="text/css" href="http://at.alicdn.com/t/font_647640_l5rjgpoksoj62yb9.css" />
	<link rel="stylesheet" type="text/css" href="/themes/simplebootx/Portal/Template/css/index.css" />
	<script src="/themes/simplebootx/Portal/Template/js/base.js" type="text/javascript" charset="utf-8"></script>
	<title>首页</title>
	<style type="text/css">
		.nodata{
			margin-top: 90px;
			text-align: center;
			color: #999;
			font-size: 14px;
		}
		[v-cloak]{
			display: none;
		}

		.shop_car_item_btn{
			position: absolute;
			display: flex;
			top: 1.75rem;
			font-size: 0.3rem;
			left: 5.1rem;
			flex-wrap: nowrap;
			line-height: 0.4rem;
			width: 2rem;
		}
		.shop_car_item_btn .iconfont{
			font-size: 0.5rem;
			line-height: 0.5rem;
			color: #999999;
		}
		.shop_car_item_btn p{
			margin-left: 0.22rem;
			margin-right: 0.22rem;
		}
		.shop_car_num{
			width: 0.58rem;
			text-align: center;
			border: none;
			outline: none;
			font-size: 0.3rem;
			color: #222222;
		}
		.storearea{
			position:absolute;
			background: #FFFFFF;
			top:48px;

		}
		[v-cloak]{
			display: none;
		}
		.weui-toast {
			position: fixed;
			z-index: 5000;
			width: 2rem;
			/*height: 1rem;
            line-height: 1rem;*/
			height: 2rem;
			top:30%;
			bottom: 0;
			left: 0;
			right:0;
			margin: auto;
			/*margin-left: -3.8em;*/
			background: rgba(17, 17, 17, 0.7);
			text-align: center;
			border-radius: 5px;
			color: #FFFFFF;

			font-size: 0.2rem;
		}
		#unstock {
			position: fixed;
			z-index: 5000;
			width: 2rem;
			height: 2rem;
			line-height: 2rem;
			top: 30%;
			bottom: 0;
			left: 0;
			right: 0;
			margin: auto;
			/* margin-left: -3.8em; */
			background: rgba(17, 17, 17, 0.7);
			text-align: center;
			border-radius: 5px;
			color: #FFFFFF;
			font-size: 0.2rem;
		}
	</style>
</head>

<body onload="load()">
<div class="container" id="pageindex" v-cloak>
	<!--遮罩-->
	<div class="wrap hidden" style="margin-top: 1.2rem; display: none;">
		<!--到店堂食弹层-->
		<div class="eat_popup" style="display: none;">
			<div class="address_list" >
				<div class="address_item" v-for="item in storelist" :id="item.store_id" @click="changespot(item)">
					<div class="address_item_left">
						<p class="distance">
							<span class="storename" style="color:#666666">{{item.store_name}}</span>
							<span>距您{{item.distance_text}}</span>
						</p>
						<p class="business"><i class="iconfont icon-shijianzhongbiao"></i>营业时间: {{item.open_start}}-{{item.open_end}}</p>
						<p class="business"><i class="iconfont icon-hdxq_icon"></i>{{item.store_address}}</p>
					</div>
					<div class="address_item_right" v-bind:id="JSON.stringify(item)" @click="jumpaddress(item)">
						&gt;
					</div>
				</div>
				<!--<div class="address_item">
                    <div class="address_item_left">
                        <p class="distance">香格里拉大酒店<span>距您3km</span></p>
                        <p class="business"><i class="iconfont icon-shijianzhongbiao"></i>营业时间:12:00-14:00</p>
                        <p class="business"><i class="iconfont icon-hdxq_icon"></i>天津市和平区气象台路中环公寓29</p>
                    </div>
                    <div class="address_item_right">
                        &gt;
                    </div>
                </div>
                <div class="address_item">
                    <div class="address_item_left">
                        <p class="distance">香格里拉大酒店<span>距您3km</span></p>
                        <p class="business"><i class="iconfont icon-shijianzhongbiao"></i>营业时间:12:00-14:00</p>
                        <p class="business"><i class="iconfont icon-hdxq_icon"></i>天津市和平区气象台路中环公寓29</p>
                    </div>
                    <div class="address_item_right">
                        &gt;
                    </div>
                </div>-->
			</div>
		</div>
		<!--就近自提弹层-->
		<div class="popup hidden">
			<!--<div class="head_tab">
            <div class="active"></div>
            <span class="head_tab_left">就近自提</span><span class="head_tab_right">到店堂食</span>
        </div>-->
			<div class="popup_title">
				<span>选择自提点</span>
				<p class="hope_address">没有门口的?点我试试!</p>
			</div>
			<div class="popup_tab">
				<div class="popup_nav">
					<ul>
						<li v-for="item in selfarea" v-bind:id="item.area_id" @click="add(item.area_id)">{{item.area_name}}</li>
						<!--<li>西城</li>
                        <li>朝阳</li>
                        <li>海淀</li>
                        <li>通州</li>
                        <li>西城</li>
                        <li>朝阳</li>
                        <li>海淀</li>
                        <li>通州</li>-->
					</ul>
				</div>
				<div class="popup_address">
					<div class="popup_address_item" v-for="item in spot" @click="cartpay(item)">
						<span>{{item.spot_name}}</span>
						<div class="popup_address_wrap">
							<p><i class="iconfont icon-hdxq_icon"></i>{{item.distance_text}}</p>
							<p @click="jump(item.spot_id)" v-bind:id="item.spot_id">
								<a href="#">取货点详情</a>
							</p>
						</div>
					</div>
					<!--<div class="popup_address_item">
                        <span>国贸地铁A口</span>
                        <div class="popup_address_wrap">
                            <p><i class="iconfont icon-hdxq_icon"></i>距您0.8km</p>
                            <p>
                                <a href="TakeDetails.html">取货点详情</a>
                            </p>
                        </div>
                    </div>-->
					<!--<div class="popup_address_item">
                        <span>国贸地铁A口</span>
                        <div class="popup_address_wrap">
                            <p><i class="iconfont icon-hdxq_icon"></i>距您0.8km</p>
                            <p>
                                <a href="TakeDetails.html">取货点详情</a>
                            </p>
                        </div>
                    </div>-->
				</div>
			</div>
		</div>
	</div>

	<!--头部-->
	<div class="header">
		<div class="head_tab">
			<div class="active"></div>
			<span class="head_tab_left" @click="areaspot()">就近自提</span><span class="head_tab_right" @click="areastore()">到店堂食</span>
		</div>
		<div class="head_add spotarea" v-if="yespot">
			<i class="iconfont icon-hdxq_icon"></i>
			<p>{{address}}{{distance}}</p>
		</div>
		<div class="head_add storearea" v-if="yestore">
			<i class="iconfont icon-hdxq_icon"></i>
			<p>{{storeaddress}}{{storedistance}}</p>
		</div>
	</div>
	<!--导航列表-->
	<div class="nav">
		<ul class="nav_list">
			<li class="nav_list_item active" @click="allfood()">全部美食</li>
			<li  v-for="(item,index) in type" @click="find(item.t_id,index)" :class="{active:index===current}" v-bind:id="item.t_id" >{{item.type_name}}</li>
			<!--<li class="nav_list_item">河南美食</li>
            <li class="nav_list_item">天津美食</li>-->
		</ul>
	</div>
	<!--swiper-->
	<div class="swiper-container banner">
		<div class="swiper-wrapper">
			<div class="swiper-slide" v-for="item in banner">
				<img v-if="item.slide_pic" :src="item.slide_pic"/>
			</div>
			<!--<div class="swiper-slide"><img src="img/矩形6@2x.png" /></div>
            <div class="swiper-slide"><img src="img/矩形6@2x.png" /></div>-->
		</div>
		<!-- Add Pagination -->
		<div class="swiper-pagination"></div>
	</div>
	<!--主体列表-->
	<div class="content" v-cloak>
		<div class="content_list" >
			<div class="content_item" v-for="item in goods_list" v-bind:id="item.goods_id" @click="fooddetail(item.goods_id)">
				<img v-if="item.thumb" v-bind:src="item.thumb"/>
				<div class="content_item_text">
					<span class="content_item_text_h">{{item.goods_name}}</span>
					<span class="content_item_text_subh">{{item.goods_description}}</span>
					<div class="content_item_num">
						<span class="content_item_num_money">¥{{item.goods_price}}</span>
						<span class="content_item_num_num">月销 {{item.month_sales}}件</span>
						<div class="choose_num">
							<p class="choose_num_control">
								<span class="num_reduce">-</span>
								<span style="display: inline-block; width: 0.6rem;font-size: 0.36rem;text-align: center;">1</span>
								<span class="num_add">+</span>
							</p>
						</div>
						<!--购物车-->
						<div v-if="item.goods_num<=0" class="content_item_shop_car_icon" v-bind:id="item.goods_id" @click="addcart(item.goods_id)">
							<i class="iconfont icon-gouwuche_select"></i>
						</div>

						<div class="shop_car_item_btn" v-if="item.goods_num>0">
							<i class="iconfont icon-icon--" v-on:click="reducenum(item)"></i>
							<input type="" name="" class="shop_car_num"  v-model="item.goods_num"/>
							<i class="iconfont icon-jia" v-bind:id="JSON.stringify(item)"  @click="addnum(item)"></i>
						</div>

					</div>
				</div>
			</div>

			<!--<div class="content_item">
                <img src="img/图层8@2x.png" />
                <div class="content_item_text">
                    <span class="content_item_text_h">胡辣汤精选啊实材啊实材啊熬制</span>
                    <span class="content_item_text_subh">又名糊辣汤,中原知名小吃</span>
                    <div class="content_item_num">
                        <span class="content_item_num_money">¥20</span>
                        <span class="content_item_num_num">月销 200件</span>
                        <div class="choose_num">
                            <p class="choose_num_control">
                                <span class="num_reduce">-</span>
                                <span style="display: inline-block; width: 0.6rem;font-size: 0.36rem;text-align: center;">1</span>
                                <span class="num_add">+</span>
                            </p>
                        </div>
                        <!--购物车-->
			<!--<div class="content_item_shop_car_icon">
                <i class="iconfont icon-gouwuche_select"></i>
            </div>
        </div>
    </div>
</div>-->
		</div>
	</div>
	<!--没有美食提醒-->
	<div class="nodata" v-if="goods_list.length==0">
		暂无美食
	</div>

	<!-- loading toast 数据加载中-->
	<div id="loadingToast" style="display:none">
		<div class="weui-mask_transparent"></div>
		<div class="weui-toast">
			<i class="weui-loading weui-icon_toast"></i>
			<p class="weui-toast__content">数据加载中</p>
		</div>
	</div>

	<!--库存不足弹出框-->
	<div id="unstock" style="display:none">
		<div class="weui-mask_transparent"></div>
		<div class="weui-toast">
			<!-- <i class="weui-icon-success-no-circle weui-icon_toast"></i>-->
			<p class="weui-toast__content">库存不足</p>
		</div>
	</div>
	<!--footer-->
	<div class="footer">
		<div class="footer_item footer_active">
			<a href="index.html"><img src="/themes/simplebootx/Portal/Template/img/menu_icon1_select@2x.png" /><span>首页</span></a>
		</div>
		<div class="footer_item">
			<a href="shopcar.html"><img src="/themes/simplebootx/Portal/Template/img/9拷贝@2x.png" />
				<span>购物车</span>
			</a>
			<span class="foot_cartnum" v-if="cartnum>0">{{cartnum}}</span>
		</div>
		<div class="footer_item">
			<a href="PersonCenter/PersonCenter.html"><img src="/themes/simplebootx/Portal/Template/img/menu_icon3_select@2x.png" /><span>我的</span></a>
		</div>
	</div>
</div>
<script src="/themes/simplebootx/Portal/Template/js/vue.min.js" type="text/javascript" charset="utf-8"></script>
<script src="/themes/simplebootx/Portal/Template/js/jquery-2.1.4.js" type="text/javascript" charset="utf-8"></script>
<script src="/themes/simplebootx/Portal/Template/js/cookie.js" type="text/javascript" charset="utf-8"></script>
<!--<script src="js/swiper-3.4.2.jquery.min.js" type="text/javascript" charset="utf-8"></script>-->
<script src="/themes/simplebootx/Portal/Template/js/swiper.min.js"></script>
<script src="/themes/simplebootx/Portal/Template/js/zepto.min.js"></script>
<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script src="https://res.wx.qq.com/open/libs/weuijs/1.0.0/weui.min.js"></script>
<!--<script src="js/example.js"></script>-->
<script src="/themes/simplebootx/Portal/Template/js/index.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">

    var header = document.getElementsByClassName('header')[0];
    var wrap = document.getElementsByClassName('wrap')[0];
    var popup = document.getElementsByClassName('popup')[0];
    var hope_address = document.getElementsByClassName('hope_address')[0];
    var head_tab_right = document.getElementsByClassName('head_tab_right')[0];
    var active = document.getElementsByClassName('active')[0];
    var head_tab_left = document.getElementsByClassName('head_tab_left')[0];
    var content_item_shop_car_icon = document.getElementsByClassName('content_item_shop_car_icon');
    var eat_popup = document.getElementsByClassName('eat_popup')[0]
    var container = document.getElementsByClassName('container')[0]
    var address_item_right = document.getElementsByClassName('address_item_right')
    var nav_list_item = document.getElementsByClassName('nav_list_item')
    console.log(nav_list_item[0])

    //种类跳转
    //			for(var i=0;i<nav_list_item.length;i++){
    //				console.log(nav_list_item[i])
    //				nav_list_item[0].className="active";
    //				nav_list_item[i].click(function(){
    //
    //				})
    //			}

    $('.content_item_shop_car_icon').click(function() {
        event.stopPropagation();
        $(this).css('display', 'none');
        $(this).prev().css('display', 'block')
    })
    //到点食堂跳页
    for (i=0; i<address_item_right.length; i++) {
        console.log(address_item_right[i])
        address_item_right[i].onclick = function(event){
            window.event.stopPropagation();
            window.location.href = 'addressdetails.html'
        }
    }
    //			$(".eat_popup").on("click",".content_item_shop_car_icon",function(){
    //				alert(111)
    //				window.event.stopPropagation();
    //				window.location.href = 'addressdetails.html';
    //			})

    //商品购物车

    head_tab_right.onclick = function() {
        popup.style.display = 'none'
        active.style.left = 1.8 + 'rem';
        wrap.style.display = 'block';
        eat_popup.style.display = 'block';
        container.style.overflowY = 'none';
//				$(".storearea").css("display","block");
//				$(".spotearea").css("display","none");

    }
    head_tab_left.onclick = function() {
        eat_popup.style.display = 'none';
        active.style.left = 0 + 'rem';
        wrap.style.display = 'block';
        popup.style.display = 'block';
        container.style.overflowY = 'none';
//				$(".storearea").css("display","none");
//				$(".spotearea").css("display","block");
    }
    wrap.onclick = function() {
        wrap.style.display = 'none';
        popup.style.display = 'none';
    }
    var content_item = document.getElementsByClassName('content_item');
    for(i = 0; i < content_item.length; i++) {
        content_item[i].onclick = function() {
            window.location.href = 'productdetails.html';
        }
    }
    //			跳转抓取地址
    hope_address.onclick = function() {
        window.location.href = 'hopeaddress.html'
    }
    //弹层
    var aLi = document.getElementsByClassName('popup_nav')[0].getElementsByTagName('li');
    console.log(aLi)
    for(var i = 0; i < aLi.length; i++) {
        aLi[i].index = i;
        aLi[0].classList.add('popup_active');
        aLi[i].onclick = function() {
            for(j = 0; j < aLi.length; j++) {
                console.log(aLi[j])
                aLi[j].classList.remove('popup_active');
            }
            aLi[this.index].classList.add('popup_active');
        }
    }

</script>

</body>

</html>