<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<html>
<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" />
</head>
<body>
<form class="layui-form" action="" style="width: 70%">
    <input name="id" value="${entity.id}" hidden/>

    <div class="layui-form-item">
        <label class="layui-form-label">主商户名</label>
        <div class="layui-input-block" style="margin-left:0px">
            <div class="layui-input-block">
                <input name="chieMerchantName" value="${merchant.alias}"  readonly placeholder="主商户名" autocomplete="off" class="layui-input layui-disabled"/>
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">主商户号</label>
        <div class="layui-input-block" style="margin-left:0px">
            <div class="layui-input-block">
                <input name="chieMerchantCode" value="${merchant.merchantCode}" lay-verify="required"  readonly placeholder="主商户号" autocomplete="off" class="layui-input layui-disabled"/>
            </div>
        </div>
    </div>

    <div class="layui-form-item" style="display: none">
        <label class="layui-form-label">主通道商编</label>
        <div class="layui-input-block" style="margin-left:0px">
            <div class="layui-input-block">
                <input name="chieMerchantId" value="${channel.merchantId}" lay-verify="required"  readonly placeholder="主通道商户编号" autocomplete="off" class="layui-input layui-disabled"/>
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">原订单分账</label>
        <div class="layui-input-block" style="margin-left:0px">
            <div class="layui-input-block">
                <select name="isDivistion" class="layui-select" lay-verify="required">
                    <option value="">请选择</option>
                    <option value="01" ${empty entity or entity.isDivistion == '01' ? 'selected' : ''}>是</option>
                    <option value="02" ${entity.isDivistion == '02' ? 'selected' : ''}>否</option>
                </select>
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">分账模式</label>
        <div class="layui-input-block" style="margin-left:0px">
            <div class="layui-input-block">
                <select name="divisionMode" class="layui-select" lay-verify="required">
                    <option value="">请选择</option>
                    <option value="01" ${empty entity or entity.divisionMode == '01' ? 'selected' : ''}>比例</option>
                    <option value="02" ${entity.divisionMode == '02' ? 'selected' : ''}>金额</option>
                </select>
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">分账商户号</label>
        <div class="layui-input-block" style="margin-left:0px">
            <div class="layui-input-block">
                <input name="diviMerchantCode" value="${entity.diviMerchantCode}" lay-verify="required"  placeholder="分账商户号" autocomplete="off" class="layui-input"/>
            </div>
        </div>
    </div>

    <div class="layui-form-item" style="display: none">
        <label class="layui-form-label">分账通道号</label>
        <div class="layui-input-block" style="margin-left:0px">
            <div class="layui-input-block">
                <input name="diviMerchantId" value="${entity.diviMerchantId}"  placeholder="分账通道商户号" autocomplete="off" class="layui-input"/>
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">分账金额</label>
        <div class="layui-input-block" style="margin-left:0px">
            <div class="layui-input-block">
                <input name="divAmt" type="number" value="${entity.divAmt}"   placeholder="分账金额" autocomplete="off" class="layui-input"/>
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">分账比例</label>
        <div class="layui-input-block" style="margin-left:0px">
            <div class="layui-input-block">
                <input name="divRatio" type="number" value="${entity.divRatio}"   placeholder="分账比例" autocomplete="off" class="layui-input"/>
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">手续费</label>
        <div class="layui-input-block" style="margin-left:0px">
            <div class="layui-input-block">
                <select name="isChargeFee" class="layui-select" >
                    <option value="">请选择</option>
                    <option value="01" ${empty entity or entity.isChargeFee == '01' ? 'selected' : ''}>是</option>
                    <option value="02" ${entity.isChargeFee == '02' ? 'selected' : ''}>否</option>
                </select>
            </div>
        </div>
    </div>


    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
            <button type="button" id="close" class="layui-btn layui-btn-primary">关闭</button>
        </div>
    </div>
</form>

<script>
    //Demo
    layui.use(['form','layer'], function(){
        var form = layui.form;
        var layer = layui.layer;
        $('#close').click(function() {
            parent.layer.closeAll();
        });
            //监听提交
        form.on('submit(formDemo)', function(data){
            var index = layer.load(1,{shade: [0.1,'#000'] });
            $.ajax({
                url: '${ctx}/mercSplitSetting/save',
                method: 'post',
                data: JSON.stringify(data.field),
                dataType: 'JSON',
                contentType:"application/json",
                success: function(res) {
                    layer.close(index);
                    if(res.code == 200) {
                        layer.msg(res.message, { icon: 1, time: 1000 }, function () {
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.layui.table.reload('mercSplitSetting');
                            parent.layer.close(index);
                        });
                    } else {
                        layer.msg(res.message, {
                            icon: 2
                        });
                    }
                }
            })
            return false;
        });
    });
</script>
</body>
</html>
