<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<meta name="renderer" content="webkit">
<!-- 移动设备 viewport -->
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<jsp:include page="../../common.jsp" />
<script type="text/javascript">
	//require("userApp/userAppDetails.js");
</script>
<title>切换通道</title>
</head>
<body class="lgraybg">
	<div class="    container-fluid animated fadeInRight col-sm-12">
		<div class="panel-toolbar mt10 mb10 pt5 pb5 pl10 bdd whitebg">
			<div class="buttons"></div>
		</div>
		<div class="tabs-container whitebg">
			<div class="pt10 pl5 pr5">

				<div class="tab-content pt30 p30">

					<form class="layui-form whitebg pb10 pt10" action="" id="data_form">
						<div class="tab-pane active">
							<div class="panel-body">
								<div class="wrapper wrapper-content">
									<div class="panel-form animated fadeInRight wp60 fc"
										id="tongdao">

										<!-- <div class="layui-form-item     has-error">
											<label class="layui-form-label">商户名称</label>
											<div class="layui-input-block">
												<input type="text" name="merchantName" id="merchantName"
													readonly="readonly" lay-verify="title" autocomplete="off"
													placeholder="请输入内容" class="layui-input" value="">
											</div>
										</div> -->
										
										<div class="layui-form-item     has-error">
                                            <label class="layui-form-label">当前通道</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="nowAisleSwitch" id="nowAisleSwitch"
                                                    readonly="readonly" lay-verify="title" autocomplete="off"
                                                    placeholder="请输入内容" class="layui-input" value="${aisleSwitchValue }">
                                            </div>
                                        </div>
                                        
										<!-- <div class="form-group">
											<div class="layui-form-item">
												<label class="layui-form-label">切换通道</label>
												<div class="layui-input-block">
													<select name="selectAisleSwitch" id="selectAisleSwitch">
														<option value="">请选择</option>
														<option value="0">支付宝，微信官方通道</option>
														<option value="1">乐刷通道</option>
													</select>
												</div>
											</div>
										</div> -->
                          <%--  <center><a href="javascript:void(0);" onclick="updateAisleSwitch()"><span>切换通道</span></a></center> --%>
									</div>
								</div>
							</div>
						</div>
					</form>


				</div>
			</div>
		</div>
	</div>
</body>
<script type="text/javascript">
	//form表单样式
	layui.use([ 'layer', 'form' ], function() {
		var layer = layui.layer, form = layui.form;
		form.render();
	});
</script>
<script type="text/javascript">
$(function(){
	//loadAisleSwitchDetail();
})

/* function loadAisleSwitchDetail(){
	$.ajax({
        url : ctx + "/userApp/aisleSwitchDetail",
        type : "post",
        success : function(res) {
            if (res.code == '1') {
                var userApp = res.userApp;
                $("#merchantName").val(userApp.merchantName);
                var aisleSwitch = userApp.aisleSwitch;
                if(aisleSwitch=='0'){
                    aisleSwitch="支付宝，微信官方通道";
                }else if(aisleSwitch=='1'){
                    aisleSwitch="乐刷通道";
                }
                $("#nowAisleSwitch").val(aisleSwitch);
            } else {
                $("#tongdao").empty();
                var html = '';
                html += '<center>尚未开通商户</center>';
                $("#tongdao").append(html);
            }
        }
    })
} */
	
	
	function updateAisleSwitch(){
		var selectAisleSwitch=$("#selectAisleSwitch").val();
		if(StringUtil.isBlank(selectAisleSwitch)){
			layer.msg('请选择通道');
			return;
		}
		
		layer.confirm('确定切换通道吗？', {
            btn: ['确认','取消'] //按钮
          }, function(){
        	  $.ajax({
                  url:ctx+"/userApp/updateAisleSwitch",
                  data:{
                      "aisleSwitch":selectAisleSwitch,
                  },
                  dataType:"json",
                  type:"post",
                  success:function(res){
                      if(res.code=='1'){
                          layer.msg('切换成功');
                          if(res.aisleSwitchValue==0){
                          $("#nowAisleSwitch").val("支付宝，微信官方通道");
                          }else if(res.aisleSwitchValue==1){
                        	  $("#nowAisleSwitch").val("乐刷通道");
                          }
                      }else{
                          layer.msg('切换失败');
                      }
                  }
              })
          }, function(){         
              layer.closeAll();
      });
	}
</script>
</html>


