<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('租赁商品管理新增')" />
    <th:block th:include="include :: ztree-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-role-add">
        <div class="row">
            <div class="col-sm-12">
                <div class="form-group">
                    <!--is-required 增加星号 显示为必填-->
                            <label class="col-sm-3 control-label">商品编码:</label>
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <input name="productCode" id="productCode" class="styled-input" type="text" maxlength="255" >
                                </div>
                            </div>
                            <label class="col-sm-3 control-label">商品名称:</label>
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <input name="productName" id="productName" class="styled-input" type="text" maxlength="255" >
                                </div>
                            </div>
                            <label class="col-sm-3 control-label">商品价格:</label>
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <input name="productPrice" id="productPrice" class="styled-input" type="text" maxlength="255" >
                                </div>
                            </div>
                            <label class="col-sm-3 control-label">支付分门槛:</label>
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <input name="paymentScoreThreshold" id="paymentScoreThreshold" class="styled-input" type="text" maxlength="255" >
                                </div>
                            </div>
                            <label class="col-sm-3 control-label">租赁上限:</label>
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <input name="rentalLimit" id="rentalLimit" class="styled-input" type="text" maxlength="255" >
                                </div>
                            </div>
                </div>
            </div>

        </div>
    </form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: ztree-js" />
<script type="text/javascript">

    function submitHandler() {
        if ($.validate.form()) {
            add();
        }
    }

    function add() {
           var productCode = $("input[name='productCode']").val();
           var productName = $("input[name='productName']").val();
           var productPrice = $("input[name='productPrice']").val();
           var paymentScoreThreshold = $("input[name='paymentScoreThreshold']").val();
           var rentalLimit = $("input[name='rentalLimit']").val();

        $.ajax({
            cache : true,
            type : "POST",
            url : ctx + "spgl/sspglproductattributes/sSpglProductattributesAdd",
            data : {
                "productCode": productCode,
                "productName": productName,
                "productPrice": productPrice,
                "paymentScoreThreshold": paymentScoreThreshold,
                "rentalLimit": rentalLimit,
            },
            async : false,
            error : function(request) {
                $.modal.alertError("系统错误");
            },
            success : function(data) {
                $.operate.successCallback(data);
            }
        });
    }
</script>
</body>
</html>
