var total_price = 0;
var total_no = 1;
var prod_Arr = [];
//var category_id = getStorage("category_id");
//var pro_cate_id = getStorage("pro_cate_id");
var category_id = '';
var pro_cate_id = '';
var pro_cate_name = "";
var run_date = after(getDateTime(0));
var back_run_date = after(getDateTime(0));
var go_year = getMonthAndDayByDate(run_date, 'year');
var go_month = getMonthAndDayByDate(run_date, 'month');
var go_day = getMonthAndDayByDate(run_date, 'day');
var back_year = getMonthAndDayByDate(back_run_date, 'year');
var back_month = getMonthAndDayByDate(back_run_date, 'month');
var back_day = getMonthAndDayByDate(back_run_date, 'day');
var car_id = "";
var back_car_id = "";
var go_back = "0";

var bus_stock = -1;  //后台实时库存

var back_station_prod = [];
var back_prod_arr = [];

$(document).ready(function() {
	category_id = category_id ? category_id : getPar('category_id');
	pro_cate_id = pro_cate_id ? pro_cate_id : getPar('pro_cate_id');
	getFxUid();
	ifLogin(function(flag) {
		$('body').show();
		httpLoadInfo();
	}, "landmark_ticket.html?fx_uid=" + getFxUid() + "&category_id=" + category_id + "&pro_cate_id=" + pro_cate_id);

});

function httpLoadInfo() {
	get_data();
	$("#go_run_date").text(go_month + "月" + go_day + "日");
	$("#back_run_date").text(back_month + "月" + back_day + "日");
	$("#go_sel_date").text(go_month + "月" + go_day + "日");
	$(".model").on("click", function() {
		$('.model_box').addClass('fadeInDown animated');
		setTimeout(function() {
			$('.model').hide();
			$('#body_mod').removeClass('mod_fil');
		}, 400);
		//		$(".model_box").animate({
		//			height: "hide"
		//		}, 400, function() {
		//			$(".model").hide();
		//			$("#body_mod").removeClass("mod_fil");
		//		});
	});
	$(".model_car").on("click", function() {
		$('.model_box_car').addClass('fadeInDown animated');
		setTimeout(function() {
			$('.model_car').hide();
			$('#body_mod').removeClass('mod_fil');
		}, 400);
		//		$(".model_box_car").animate({
		//			height: "hide"
		//		}, 400, function() {
		//			$(".model_car").hide();
		//			$("#body_mod").removeClass("mod_fil");
		//		});
	});

	$(".model_box").on("click", function(e) {
		e.stopPropagation();
	});
	$(".model_box_car").on("click", function(e) {
		e.stopPropagation();
	});
}

function get_data() {
	$.ajax({
		url: base_api + "prod/prod/get-prod-detail", //请求地址
		data: {
			pro_cate_id: pro_cate_id,
			category_id: category_id
		},
		type: "post",
		dataType: "json",
		async: false,
		success: function(data) {
			ZZLog(data);
			if(data.flag) {
				list_html(data.data);
				$("#bg_img").css("background-image", "url(" + data.data.show_img + ")");
				$(".top_title").text(data.data.pro_cate_name);
				pro_cate_name = data.data.pro_cate_name;
			} else {
				if(codeNotLogin == data['code']) {
					alert(infoNotLogin);
					var URL = '/web/fx/landmark_ticket.html?fx_uid=' + getFxUid();
					URL = encodeURI(URL);
					location.href = data['url'] + URL;
				} else if(codeNotRegister == res_data['code']) {
					location.href = 'register.html';
				} else {
					alert(data['msg']);
				}
			}
		},
		error: function(error) {
			console.log(error);
		}
	});
}

function list_html(data) {
	var temp = "";
	for(var i = 0, j = data.prod_arr.length; i < j; i++) {
		var img = 'images/jianhao.png';
		var str = '<span class="ulev3 count aticket" type="text" readonly="true" one_price="' + data.prod_arr[i].prod_price + '" prod_name="' + data.prod_arr[i].prod_name + '" prod_id="' + data.prod_arr[i].prod_id + '">0</span>';
		if(i == 0) {
			img = 'images/jianhao_sel.png';
			str = '<span class="ulev3 count aticket" type="text" readonly="true" one_price="' + data.prod_arr[i].prod_price + '" prod_name="' + data.prod_arr[i].prod_name + '" prod_id="' + data.prod_arr[i].prod_id + '">1</span>'
		}
		temp += '<div class="ub ub-ver disney_div">' +
			'<div style="padding-bottom: 0.12rem;">' + data.prod_arr[i].prod_name + '</div>' +
			'<div class="ub">' +
			'<div class="ub-f1 ub">' +
			'<img class="cut" style="width: 0.22rem;height: 0.22rem;vertical-align: middle;" src="' + img + '"/>' +
			str +
			//			'<span class="ulev3 count aticket" type="text" readonly="true" one_price="' + data.prod_arr[i].prod_price + '" prod_name="' + data.prod_arr[i].prod_name + '" prod_id="' + data.prod_arr[i].prod_id + '">0</span>' +
			'<img class="add" style="width: 0.22rem;height: 0.22rem;vertical-align: middle;" src="images/jiahao_sel.png"/>' +
			'</div>' +
			'<div class="ub-f1 ub tx-r">' +
			'<div class="ub-f1 ub ub-pe ub-ae font_price" >￥</div>' +
			'<div class="ulev3 ub ub-ae font_price single_price" data-price="' + data.prod_arr[i].prod_price + '" style="line-height: 1;">' + data.prod_arr[i].prod_price + '<span class="font_price" style="font-size:0.12rem">/张</span></div>' +
			'</div>' +
			'</div>' +
			'</div>'
	}
	$("#tick_type").html(temp);
	//订票须知
	if(data.booking_notice) {
		var booking_notice_arr = data.booking_notice.split('<br/>');
		var bnHTML = '';
		for(var i = 0, m = booking_notice_arr.length; i < m; i++) {
			bnHTML += '<div class = "font_gray" >' + booking_notice_arr[i] + '</div >';
		}
		$(".booking_notice").html(bnHTML);
	}

	//加
	$(".add").on("touchstart", function() {
		if(pro_cate_id == "3") {
			//          var tot_no = 1;
			$(".aticket").each(function(index, domE) {
				total_no += parseInt($(this).text());
			});
			if(total_no == 5) {
				alert("迪士尼最多只能买五张票");
			} else {
				var current = $(this).parent().find(".aticket").text();
				var now_count = parseInt(current) + 1;
				$(this).parent().find(".aticket").text(now_count);
				$(this).parent().find(".cut").attr("src", "images/jianhao_sel.png");
				//              countTotal();
			}
		} else {
			var current = $(this).parent().find(".aticket").text();
			var now_count = parseInt(current) + 1;
			$(this).parent().find(".aticket").text(now_count);
			$(this).parent().find(".cut").attr("src", "images/jianhao_sel.png");
			//          countTotal();
		}

	});

	//减
	$(".cut").on("touchstart", function() {
		var current = $(this).parent().find(".aticket").text();
		var now_count = parseInt(current) - 1;
		if(now_count > 0) {
			$(this).parent().find(".aticket").text(now_count);
		} else {
			$(this).parent().find(".aticket").text('0');
			$(this).attr("src", "images/jianhao.png");
		}
		//      countTotal();
	})
}

//总价
function countTotal() {
	total_price = 0;
	prod_Arr = [];
	prod_info = "";
	total_no = 0;
	var tick_no = '';
	back_prod_arr = [];
	$(".aticket").each(function(index, domE) {
		tick_no = parseInt($(this).text());
		var tick_price = parseFloat($(this).attr("one_price"));
		var back_tick_price = 0;
		var back_prod_id = 0;
		var go_back = $("#if_back").attr("go_back");
		if(go_back == 1) {
			back_tick_price = back_station_prod[index]['prod_price'] - 0;
			back_prod_id = back_station_prod[index]['prod_id'];
			var obj = {
				"prod_id": back_prod_id,
				"prod_count": $(this).text(),
				"prod_name": $(this).attr('prod_name')
			}
			back_prod_arr.push(obj);
		}
        total_price = (total_price * 100 + tick_no * tick_price * 100) / 100;
		total_no += tick_no;
		prod_info = {
			"prod_id": $(this).attr("prod_id"),
			"prod_count": $(this).text(),
			"prod_name": $(this).attr("prod_name")
		}
		prod_Arr.push(prod_info);
	});
	//	console.log(total_price);
	//	console.log(prod_Arr);
	//	console.log(total_no);

}
//选择去程日期
$("#go_date_select").on("click", function() {
	$('.model_box').removeClass('fadeInUp');
	$('.model_box').removeClass('animated');
	$('.model_box').removeClass('fadeInDown');
	$("#go_sel_date").text(go_month + "月" + go_day + "日");
	window.calendar.init({
		startDate: getDateTime(0),
		chooseDate: run_date
	}, function(year, month, day, ymdString) {
		$('.model_box').addClass('fadeInDown animated');
		setTimeout(function() {
			$('.model').hide();
			$('#body_mod').removeClass('mod_fil');
		}, 400);
		//		$(".model_box").animate({
		//			height: "hide"
		//		}, 400, function() {
		//			$(".model").hide();
		//			$("#body_mod").removeClass("mod_fil");
		//		});
		run_date = ymdString;
		go_year = year;
		go_month = month;
		go_day = day;
		if(run_date > back_run_date) {
			back_run_date = ymdString;
			back_year = year;
			back_month = month;
			back_day = day;
			$("#back_run_date").text(month + "月" + day + "日");
			$("#back_show_class").text("请选择");
			$("#back_show_class").removeAttr("back_time");
			$("#back_show_class").removeAttr("back_run_id");
			$("#back_show_class").removeAttr("back_cate_name");
			back_car_id = "";

		}
		$("#go_run_date").text(month + "月" + day + "日");
		$("#go_sel_date").text(month + "月" + day + "日");
		console.log(year, month, day, ymdString);
		//		2017 04 12 2017-04-12
		//重新选择日期后班次要重新选
		$("#go_show_class").text("请选择");
		$("#go_show_class").removeAttr("go_time");
		$("#go_show_class").removeAttr("go_run_id");
		$("#go_show_class").removeAttr("go_cate_name");
		car_id = "";

	});
	$(".model").show();
	$('.model_box').show();
	$("#body_mod").addClass("mod_fil");
	$('.model_box').addClass('fadeInUp animated');
	//	$(".model_box").animate({
	//		height: "show"
	//	}, 400);

});

//选择去程班次
$("#go_classes").on("click", function() {
	$('.model_box_car').removeClass('fadeInUp');
	$('.model_box_car').removeClass('animated');
	$('.model_box_car').removeClass('fadeInDown');
	$.ajax({
		url: base_api + "prod/prod/get-bus-stock", //请求地址
		data: {
			pro_cate_id: pro_cate_id,
			date: run_date
		},
		type: "post",
		dataType: "json",
		async: false,
		success: function(data) {
			console.log(data)
			if(data.flag) {
				go_car_html(data.data);
				$(".model_car").show();
				$('.model_box_car').show();
				$("#body_mod").addClass("mod_fil");
				$('.model_box_car').addClass('fadeInUp animated');
				//				$(".model_car").show();
				//				$("#body_mod").addClass("mod_fil");
				//				$(".model_box_car").animate({
				//					height: "show"
				//				}, 400);

			} else {
				if(codeNotLogin == data['code']) {
					alert(infoNotLogin);
					var URL = 'landmark_ticket.html?fx_uid=' + getFxUid();
					URL = encodeURI(URL);
					location.href = data['url'] + URL;
				} else {
					alert(data['msg']);
				}
			}
		},
		error: function(error) {
			console.log(error);
		}
	});
});

//替换去程班次信息
function go_car_html(data) {
	var temp = "";
	var run_status = "";
	var run_count = "";
	for(var key in data.prod_info) {
		var prod_list = data.prod_info[key];
		var p_obj = prod_list[0];
		var may_sel = "";
		var may_info = "";
		var may_col = "";
		var select_car = "";
		run_status = p_obj.run_status;
		run_count = p_obj.count;
		if(run_status == 142) {
			may_sel = "select_kong";
			may_info = "已停运";
			may_col = "text_c_cc";
			select_car = "select_car_off";
		} else if(run_status != "138") {
			may_sel = "select_kong";
			may_info = "已发车";
			may_col = "text_c_cc";
			select_car = "select_car_off";
		} else {
			if(run_count == "0") {
				may_sel = "select_kong";
				may_info = "已售罄";
				may_col = "text_c_cc";
				select_car = "select_car_off";
			} else {
				may_sel = "select_quan";
				may_info = "余票充足";
				may_col = "text_c_80";
				select_car = "select_car_on";
			}
		}
		temp += '<div run_status = "' + p_obj.run_status + '" run_count = "' + run_count + '" cate_name="' + p_obj.station_str + '" id="' + p_obj.run_id + '" go_time="' + p_obj.start_time + '" class="ub ub-ac bor_b_e5 ' + select_car + '">' +
			'<div class="ui_p_t12 ui_p_b12 ui_p_l15 ui_p_r20 ulev1 ' + may_col + '">' + p_obj.start_time + '</div>' +
			'<div class="ub-f1 ' + may_col + '">' + may_info + '</div>' +
			'<div class="ui_p_r15 ui_p_t10 ui_p_b10 ui_p_l15">' +
			'<div class="' + may_sel + ' selected"></div>' +
			'</div>' +
			'</div>'
	}
	$("#sel_car").html(temp);
	if($("#" + car_id).attr("run_status") == "138" && $("#" + car_id).attr("run_count") != "0") {
		$("#" + car_id).find(".selected").removeClass("select_quan");
		$("#" + car_id).find(".selected").addClass("select_gou");
	}
	$(".select_car_on").on("click", function() {
		car_id = $(this).attr("id");
		//获取库存
		if(bus_stock==-1){
			bus_stock = $(this).attr('run_count')-0;
		}else{
			var t_stock = $(this).attr('run_count')-0;
			bus_stock = bus_stock>t_stock?t_stock:bus_stock;
		}
		var go_time = $(this).attr("go_time");
		var go_run_id = $(this).attr("id");
		var go_cate_name = $(this).attr("cate_name");
		$("#sel_car").find(".selected").removeClass("select_gou");
		$("#sel_car").find(".selected").addClass("select_quan");
		$(this).find(".selected").removeClass("select_quan");
		$(this).find(".selected").addClass("select_gou");
		$('.model_box_car').addClass('fadeInDown animated');
		setTimeout(function() {
			$('.model_car').hide();
			$('#body_mod').removeClass('mod_fil');
		}, 400);
		//			$(".model_box_car").animate({
		//				height: "hide"
		//			}, 400, function() {
		//				$(".model_car").hide();
		//				$("#body_mod").removeClass("mod_fil");
		//			});
		$("#go_show_class").text(go_time + "发车");
		$("#go_show_class").attr("go_time", go_time);
		$("#go_show_class").attr("go_run_id", go_run_id);
		$("#go_show_class").attr("go_cate_name", go_cate_name);
	});

}
//、、、、、、、、、、、、、、、、、、、、、去程结束、返程开始、、、、、、、、、、、、、、、、、、//

//选择返程日期
$("#back_date_select").on("click", function() {
	$('.model_box').removeClass('fadeInUp');
	$('.model_box').removeClass('animated');
	$('.model_box').removeClass('fadeInDown');
	$("#go_sel_date").text(back_month + "月" + back_day + "日");
	window.calendar.init({
		startDate: run_date,
		chooseDate: back_run_date
	}, function(year, month, day, ymdString) {
		$('.model_box').addClass('fadeInDown animated');
		setTimeout(function() {
			$('.model').hide();
			$('#body_mod').removeClass('mod_fil');
		}, 400);
		//		$(".model_box").animate({
		//			height: "hide"
		//		}, 400, function() {
		//			$(".model").hide();
		//			$("#body_mod").removeClass("mod_fil");
		//		});
		back_run_date = ymdString;
		back_year = year;
		back_month = month;
		back_day = day;
		if(run_date > back_run_date) {
			back_run_date = ymdString;
			$("#back_run_date").text(month + "月" + day + "日");
		}
		$("#back_run_date").text(month + "月" + day + "日");
		$("#go_sel_date").text(month + "月" + day + "日");

		$("#back_show_class").text("请选择");
		$("#back_show_class").removeAttr("back_time");
		$("#back_show_class").removeAttr("back_run_id");
		$("#back_show_class").removeAttr("back_cate_name");
		back_car_id = "";

	});
	$(".model").show();
	$('.model_box').show();
	$("#body_mod").addClass("mod_fil");
	$('.model_box').addClass('fadeInUp animated');
	//	$(".model_box").animate({
	//		height: "show"
	//	}, 400);

});

//选择返程班次
$("#back_classes").on("click", function() {
	$('.model_box_car').removeClass('fadeInUp');
	$('.model_box_car').removeClass('animated');
	$('.model_box_car').removeClass('fadeInDown');
	$.ajax({
		url: base_api + "prod/prod/get-bus-stock", //请求地址
		data: {
			pro_cate_id: pro_cate_id,
			date: back_run_date,
			if_back: "1"
		},
		type: "post",
		dataType: "json",
		async: false,
		success: function(data) {
			console.log(data)
			if(data.flag) {
				back_car_html(data.data);
				$(".model_car").show();
				$('.model_box_car').show();
				$("#body_mod").addClass("mod_fil");
				$('.model_box_car').addClass('fadeInUp animated');
				//				$(".model_car").show();
				//				$("#body_mod").addClass("mod_fil");
				//				$(".model_box_car").animate({
				//					height: "show"
				//				}, 400);

			} else {
				if(codeNotLogin == data['code']) {
					alert(infoNotLogin);
					var URL = 'landmark_ticket.html?fx_uid=' + getFxUid();
					URL = encodeURI(URL);
					location.href = data['url'] + URL;
				} else {
					alert(data['msg']);
				}
			}
		},
		error: function(error) {
			console.log(error);
		}
	});
});

//替换返程班次信息
function back_car_html(data) {
	var temp = "";
	var run_status = "";
	var run_count = "";
	for(var key in data.prod_info) {
		var prod_list = data.prod_info[key];
		var p_obj = prod_list[0];
		var may_sel = "";
		var may_info = "";
		var may_col = "";
		var select_car = "";
		run_status = p_obj.run_status;
		run_count = p_obj.count;
		if(run_status == 142) {
			may_sel = "select_kong";
			may_info = "已停运";
			may_col = "text_c_cc";
			select_car = "select_car_off";
		} else if(run_status != "138") {
			may_sel = "select_kong";
			may_info = "已发车";
			may_col = "text_c_cc";
			select_car = "select_car_off";
		} else {
			if(run_count == "0") {
				may_sel = "select_kong";
				may_info = "已售罄";
				may_col = "text_c_cc";
				select_car = "select_car_off";
			} else {
				may_sel = "select_quan";
				may_info = "余票充足";
				may_col = "text_c_80";
				select_car = "select_car_on";
			}
		}
		var obj = data.prod_info;
		obj.forEach(function(v, i) {
			v['station_str'] = v['station_str'].replace(/ /g, '');
		})
		temp += '<div dict=' + JSON.stringify(obj) + ' run_status = "' + p_obj.run_status + '" run_count = "' + p_obj.run_count + '" cate_name="' + p_obj.station_str + '" id="' + p_obj.run_id + '" go_time="' + p_obj.start_time + '" class="ub ub-ac bor_b_e5 ' + select_car + '">' +
			'<div class="ui_p_t12 ui_p_b12 ui_p_l15 ui_p_r20 ulev1 ' + may_col + '">' + p_obj.start_time + '</div>' +
			'<div class="ub-f1 ' + may_col + '">' + may_info + '</div>' +
			'<div class="ui_p_r15 ui_p_t10 ui_p_b10 ui_p_l15">' +
			'<div class="' + may_sel + ' selected"></div>' +
			'</div>' +
			'</div>'
	}
	$("#sel_car").html(temp);
	if($("#" + back_car_id).attr("run_status") == "138" && $("#" + back_car_id).attr("run_count") != "0") {
		$("#" + back_car_id).find(".selected").removeClass("select_quan");
		$("#" + back_car_id).find(".selected").addClass("select_gou");
	}
	$(".select_car_on").on("click", function() {
		back_car_id = $(this).attr("id");
		//获取库存
		if(bus_stock==-1){
			bus_stock = $(this).attr('run_count')-0;
		}else{
			var t_stock = $(this).attr('run_count')-0;
			bus_stock = bus_stock>t_stock?t_stock:bus_stock;
		}
		var back_time = $(this).attr("go_time");
		var back_run_id = $(this).attr("id");
		var back_cate_name = $(this).attr("cate_name");
		//update 201705231337
		back_station_prod = $(this).attr('dict');
		back_station_prod = JSON.parse(back_station_prod);
		back_pro_cate_id = data.pro_cate_id;
		$('.single_price').each(function(index, dom) {
			var price = parseInt($(this).attr('data-price')) - 0;

			var price_2 = (parseInt(price) + parseInt(back_station_prod[index]['prod_price'])) - 0;

			//			$(this).attr('data-price', price_2);  //question1.干掉则解决返程重复点击班次价格增加的问题
			$(this).html(price_2 + '<span class="font_price" style="font-size:0.12rem">/张</span>');
		})

		$("#sel_car").find(".selected").removeClass("select_gou");
		$("#sel_car").find(".selected").addClass("select_quan");
		$(this).find(".selected").removeClass("select_quan");
		$(this).find(".selected").addClass("select_gou");
		$('.model_box_car').addClass('fadeInDown animated');
		setTimeout(function() {
			$('.model_car').hide();
			$('#body_mod').removeClass('mod_fil');
		}, 400);
		//			$(".model_box_car").animate({
		//				height: "hide"
		//			}, 400, function() {
		//				$(".model_car").hide();
		//				$("#body_mod").removeClass("mod_fil");
		//			});
		$("#back_show_class").text(back_time + "发车");
		$("#back_show_class").attr("back_time", back_time);
		$("#back_show_class").attr("back_run_id", back_run_id);
		$("#back_show_class").attr("back_cate_name", back_cate_name);
	});

}

function reserve() {
	countTotal();
	var go_time = $("#go_show_class").attr("go_time");
	var back_time = $("#back_show_class").attr("back_time");
	var go_run_id = $("#go_show_class").attr("go_run_id");
	var back_run_id = $("#back_show_class").attr("back_run_id");
	var go_cate_name = $("#go_show_class").attr("go_cate_name");
	var back_cate_name = $("#back_show_class").attr("back_cate_name");
	var fill_order_20170307 = "";
	go_back = $("#if_back").attr("go_back");
	if(total_no == "0") {
		alert("请选择票种数量");
	} else {
		if(bus_stock<total_no){
			alert('库存不足');
			return;
		}
		if(go_back == "0") {
			if(go_run_id) {
				fill_order_20170307 = {
					"pro_cate_id": pro_cate_id,
					"if_back": go_back, //只有去程 0  往返 1
					"prod_arr": prod_Arr,
					"total_money": total_price,
					"go_info": {
						"go_start_date": run_date,
						"go_start_time": go_time,
						"go_run_id": go_run_id,
						"go_pro_cate_name": go_cate_name
					},
					"back_info": {}
				}
				console.log(fill_order_20170307);
				setStorJson("fill_order_20170307", fill_order_20170307);
				window.location.href = "fill_order.html?" + version + "&fx_uid=" + getFxUid();
			} else {
				alert("请选择去程班次");
			}

		} else {
			//往返程票价必须一样，所以可以按*2算，白哥说的。
			if(go_run_id && back_run_id) {
				fill_order_20170307 = {
					"pro_cate_id": pro_cate_id,
					"back_pro_cate_id": back_pro_cate_id,
					"if_back": go_back, //只有去程 0  往返 1
					"prod_arr": prod_Arr,
					"back_prod_arr": back_prod_arr, //update 2017-05-23
					"total_money": total_price * 2,
					"go_info": {
						"go_start_date": run_date,
						"go_start_time": go_time,
						"go_run_id": go_run_id,
						"go_pro_cate_name": go_cate_name
					},
					"back_info": {
						"back_start_date": back_run_date,
						"back_start_time": back_time,
						"back_run_id": back_run_id,
						"back_pro_cate_name": back_cate_name
					}
				}
				console.log(fill_order_20170307);
				setStorJson("fill_order_20170307", fill_order_20170307);
				window.location.href = "fill_order.html?" + version + "&fx_uid=" + getFxUid();
			} else {
				alert("请选择班次");
			}

		}

	}

}

//添加或取消返程
$(".sel_back_btn").on("click", function() {
	go_back = $(this).attr("go_back");
	if(go_back == "0") {
		$("#back_date").animate({
			height: "show"
		}, 200);
		$(this).attr("go_back", "1");
		$(this).text("取消返程");
		$(this).removeClass("sel_back_btn");
		$(this).addClass("cancel_back_btn");

		//		$('.single_price').each(function(index,dom){
		//			var price = parseInt($(this).attr('data-price')) + 0;
		//			var price_2 = price*2 + 0;
		//			
		//			$(this).attr('data-price',price_2);
		//			$(this).html(price_2+'<span class="font_price" style="font-size:0.12rem">/张</span>');
		//		})

	} else {
		if($('#back_show_class').text() != '请选择') {
			$('.single_price').each(function(index, dom) {
				var price = parseInt($(this).attr('data-price')) + 0;
				//				var price_2 = price / 2 + 0;  //question2.不除以2 则还原到去程的价格  修改与question1绑定一起
				var price_2 = price - 0;
				$(this).attr('data-price', price_2);
				$(this).html(price_2 + '<span class="font_price" style="font-size:0.12rem">/张</span>');
			})
		}
		$("#back_date").animate({
			height: "hide"
		}, 200);
		$(this).attr("go_back", "0");
		$(this).text("添加返程");
		$(this).removeClass("cancel_back_btn");
		$(this).addClass("sel_back_btn");
		$("#back_show_class").text("请选择");
		$("#back_show_class").removeAttr("go_time");
		back_car_id = "";

	}
});