indexpage.js 2.9 KB
function getdata(){
	var url = '/Index/index'
			var params = {
				t_id: '',
				unique_id: localStorage.getItem('unique_id')
			}
			ajaxsend(url, params, function(res) {
				/*console.log(JSON.stringify(res))*/
				console.log(res);
				var data = JSON.parse(JSON.stringify(res.data));
				console.log(data);
				//banner图
				var banner = data.banner;
				console.log(banner)
				var html="";
			
				for(var i=0;i<banner.length;i++){
					html+='<div class="swiper-slide"><img src="'+banner[i].slide_pic+'" /></div>'
				}
				$(".swiper-wrapper").html(html)
				
				//食品列表
				var goods_list=data.goods_list;
				console.log(goods_list)
				
				for(var i=0;i<goods_list.length;i++){
					var good=""
//					good+='<div class="content_item">'+
//						'<img src="'+goods_list[i].thumb+'" />'+
//						'<div class="content_item_text">'+
//							'<span class="content_item_text_h">'+goods_list[i].goods_name+'</span>'+
//							'<span class="content_item_text_subh">'+goods_list[i].goods_name+'</span>'+
//							'<div class="content_item_num">'
//								'<span class="content_item_num_money">¥'+goods_list[i].goods_price+'</span>'+
//								'<span class="content_item_num_num">月销 '+goods_list[i].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 class="content_item_shop_car_icon">'+
//'									<i class="iconfont icon-gouwuche_select"></i>'
//								'</div>'+
//							'</div>'+
//						'</div>'+
//					'</div>'
					
					
					good+='<div class="content_item">'+
						'<img src="'+goods_list[i].thumb+'" />'+
						'<div class="content_item_text">'+
							'<span class="content_item_text_h">'+goods_list[i].goods_name+'</span>'+
							'<span class="content_item_text_subh">'+goods_list[i].goods_description+'</span>'+
							'<div class="content_item_num">'+
								'<span class="content_item_num_money">'+goods_list[i].goods_price+'</span>'+
								'<span class="content_item_num_num">'+goods_list[i].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 class="content_item_shop_car_icon">'+
									'<i class="iconfont icon-gouwuche_select"></i>'+
								'</div>'
							'</div>'+
						'</div>'+
					'</div>'
//					console.log(good)
					$(".content").html(good)
				}
				
				//美食种类
				var type=data.type;
				 					
			})
}
getdata();