<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>vip配置</title>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="<?php echo base_url();?>public/js/bootstrap/bootstrap.min.css" >
    <link rel="stylesheet" href="<?php echo base_url();?>public/js/vendor/bootstrap-datepicker/css/bootstrap-datepicker.standalone.min.css">
    <link rel="stylesheet" href="<?php echo base_url();?>public/css/jquery.timepicker.min.css">
    <!-- Select2 -->
    <link rel="stylesheet" href="<?php echo base_url();?>public/js/vendor/select2/select2.min.css">

    <style type="text/css">
        .thumbnail {
            margin:10px;
        }

        .lang-name {
            margin-left:42px;
        }

        .upimg {
            cursor: pointer;
        }

    </style>
</head>
<body>
<div id="msg-tip">

</div>
<div class="content_wrapper">
    <div class="container-fluid">
        <aside>
            <form class="form-horizontal" role="form" method="post" enctype="multipart/form-data"  id="form" action="#" style="margin-top: 20px">
                <header><i class="fa fa-fw fa-file"></i>宝箱概率配置修改</header>
                <section>
                    <div class="container-fluid">
                        <div class="row">
                            <div class="col-sm-12">
                                <button type="button" class="btn btn-success" id="submitBtn">提交</button>
                            </div>
                        </div>
                    </div>
                    <div class="container-fluid">
                        <div style="border: 1px solid #CCC;margin:10px 5px;padding: 5px 0;">
                            <div class="row form-group" >
                                <label class="col-sm-1 control-label">一星级概率</label>
                                <div class="col-sm-1">
                                    <input type="text" class="form-control"  name="config[star][1]" value="<?php echo $pro[1]['v'];?>">
                                </div>
                                <label class="col-sm-1 control-label">二星级概率</label>
                                <div class="col-sm-1">
                                    <input type="text" class="form-control"  name="config[star][2]" value="<?php echo $pro[2]['v'];?>">
                                </div>
                                <label class="col-sm-1 control-label">三星级概率</label>
                                <div class="col-sm-1">
                                    <input type="text" class="form-control"  name="config[star][3]" value="<?php echo $pro[3]['v'];?>">
                                </div>
                                <label class="col-sm-1 control-label">四星级概率</label>
                                <div class="col-sm-1">
                                    <input type="text" class="form-control"  name="config[star][4]" value="<?php echo $pro[4]['v'];?>">
                                </div>
                                <label class="col-sm-1 control-label">五星级概率</label>
                                <div class="col-sm-1">
                                    <input type="text" class="form-control"  name="config[star][5]" value="<?php echo $pro[5]['v'];?>">
                                </div>
                            </div>
                            <div class="row form-group" >
                                <label class="col-sm-2 control-label">金卡数量(-1,不设限制)</label>
                                <div class="col-sm-1">
                                    <input type="text" class="form-control"  name="config[maxGoldCard]" value="<?php echo $maxGoldCard;?>">
                                </div>
                                <label class="col-sm-2 control-label">黑金卡数量(-1,不设限制)</label>
                                <div class="col-sm-1">
                                    <input type="text" class="form-control" name="config[maxBlackGoldCard]" value="<?php echo $maxBlackGoldCard ?? -1; ?>">
                                </div>
                                <label class="col-sm-1 control-label">黑卡保底值</label>
                                <div class="col-sm-1">
                                    <input type="text" class="form-control" name="config[blackGoldCardKValue]" value="<?php echo $blackGoldCardKValue ?? 0; ?>">
                                </div>
                                <label class="col-sm-1 control-label">开卡类型</label>
                                <div class="col-sm-1">
                                    <select class="form-control" name="config[cardType]">
                                        <?php foreach ($cardTypes as $cardTypeKey => $text){ ?>
                                            <option value="<?=$cardTypeKey?>" <?php if($cardTypeKey == $cardType){echo 'selected';}?>><?=$text?></option>
                                        <?php }?>
                                    </select>
                                </div>
                            </div>
                        </div>
                    </div>
                </section>
            </form>
        </aside>
    </div>
</div>
</body>

<script>
    $(function () {
        $('#submitBtn').click(function () {
            var data = new FormData(document.getElementById("form"));
            $.ajax({
                url: rootPath + 'Config/actionCardTypePro/<?php echo $id;?>',
                type: 'POST',
                data: data,
                dataType: 'json',
                contentType: false, //必须
                processData: false, //必须
                success: function (data) {
                    alert(data.msg);
                    window.location.reload();
                },
                error: function (msg) {
                    alert(data.msg);
                }
            });
        });
    });
</script>
</html>
