<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>修改活动</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="feedForm" action="#" style="margin-top: 20px">
                <input type="hidden" class="form-control" name="type" value="13">
                <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="feedsubmitBtn">提交</button>
                            </div>
                        </div>
                    </div>
                    <div class="container-fluid">
                        <?php foreach ($feed as $key => $vl) { ?>
                            <div class="row" style="border: 1px solid #CCC;margin:10px 5px;padding: 5px 0;">
                                <div class="form-group" >
                                    <label class="col-sm-1 control-label">商品GID*: </label>
                                    <div class="col-sm-1">
                                        <input type="text" class="form-control" readonly value="<?php echo $vl['gid'];?>">
                                    </div>
                                    <label class="col-sm-1 control-label">商品名称*: </label>
                                    <div class="col-sm-1">
                                        <input type="text" class="form-control"  name="good[<?php echo $vl['gid'];?>][gname]" value="<?php echo $vl['gname'];?>">
                                    </div>
                                    <label class="col-sm-1 control-label">商品SKU*: </label>
                                    <div class="col-sm-2">
                                        <input type="text" class="form-control"  name="good[<?php echo $vl['gid'];?>][gsku]" value="<?php echo $vl['gsku'];?>">
                                    </div>
                                    <label class="col-sm-1 control-label">商品简介*: </label>
                                    <div class="col-sm-2">
                                        <input type="text" class="form-control"  name="good[<?php echo $vl['gid'];?>][gdesc]" value="<?php echo $vl['gdesc'];?>">
                                    </div>
                                    <label class="col-sm-1 control-label">商品价格*: </label>
                                    <div class="col-sm-1">
                                        <input type="text" class="form-control"  name="good[<?php echo $vl['gid'];?>][gprice]" value="<?php echo $vl['gprice'];?>">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-1 control-label">粮食数量*: </label>
                                    <div class="col-sm-1">
                                        <input type="text" class="form-control"  name="good[<?php echo $vl['gid'];?>][gbaseReward]" value="<?php echo $vl['gbaseReward'];?>">
                                    </div>
                                    <label class="col-sm-1 control-label">经验数量*: </label>
                                    <div class="col-sm-1">
                                        <input type="text" class="form-control"  name="good[<?php echo $vl['gid'];?>][goriginReward]" value="<?php echo $vl['goriginReward'];?>">
                                    </div>
                                    <label class="col-sm-1 control-label">商品配图*: </label>
                                    <div class="col-sm-2">
                                        <select class="form-control" name="good[<?php echo $vl['gid'];?>][gimg]"">
                                            <option value="1" <?php if($vl['gimg'] == 1) echo 'selected'; ?>>普通</option>
                                            <option value="2" <?php if($vl['gimg'] == 2) echo 'selected'; ?>>大量</option>
                                            <option value="3" <?php if($vl['gimg'] == 3) echo 'selected'; ?>>超大量</option>
                                        </select>
                                    </div>
                                    <label class="col-sm-1 control-label">状态*: </label>
                                    <div class="col-sm-2">
                                        <select class="form-control" name="good[<?php echo $vl['gid'];?>][gstatus]"">
                                            <option value="0" <?php if($vl['gstatus'] == 0) echo 'selected'; ?>>下架</option>
                                            <option value="1" <?php if($vl['gstatus'] == 1) echo 'selected'; ?>>上架</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        <?php } ?>
                    </div>
                </section>
            </form>
        </aside>
    </div>
    <div class="container-fluid">
        <aside>
            <form class="form-horizontal" role="form" method="post" enctype="multipart/form-data"  id="expForm" action="#" style="margin-top: 20px">
                <input type="hidden" class="form-control" name="type" value="14">
                <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="expsubmitBtn">提交</button>
                            </div>
                        </div>
                    </div>
                    <div class="container-fluid">
                        <?php foreach ($exp as $key => $vl) { ?>
                            <div class="row" style="border: 1px solid #CCC;margin:10px 5px;padding: 5px 0;">
                                <div class="form-group" >
                                    <label class="col-sm-1 control-label">商品GID*: </label>
                                    <div class="col-sm-1">
                                        <input type="text" class="form-control" readonly value="<?php echo $vl['gid'];?>">
                                    </div>
                                    <label class="col-sm-1 control-label">商品名称*: </label>
                                    <div class="col-sm-1">
                                        <input type="text" class="form-control"  name="good[<?php echo $vl['gid'];?>][gname]" value="<?php echo $vl['gname'];?>">
                                    </div>
                                    <label class="col-sm-1 control-label">商品SKU*: </label>
                                    <div class="col-sm-2">
                                        <input type="text" class="form-control"  name="good[<?php echo $vl['gid'];?>][gsku]" value="<?php echo $vl['gsku'];?>">
                                    </div>
                                    <label class="col-sm-1 control-label">商品简介*: </label>
                                    <div class="col-sm-2">
                                        <input type="text" class="form-control"  name="good[<?php echo $vl['gid'];?>][gdesc]" value="<?php echo $vl['gdesc'];?>">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-1 control-label">商品价格*: </label>
                                    <div class="col-sm-1">
                                        <input type="text" class="form-control"  name="good[<?php echo $vl['gid'];?>][gprice]" value="<?php echo $vl['gprice'];?>">
                                    </div>
                                    <label class="col-sm-1 control-label">商品数量*: </label>
                                    <div class="col-sm-1">
                                        <input type="text" class="form-control"  name="good[<?php echo $vl['gid'];?>][gbaseReward]" value="<?php echo $vl['gbaseReward'];?>">
                                    </div>
                                    <label class="col-sm-1 control-label">状态*: </label>
                                    <div class="col-sm-2">
                                        <select class="form-control" name="good[<?php echo $vl['gid'];?>][gstatus]"">
                                            <option value="0" <?php if($vl['gstatus'] == 0) echo 'selected'; ?>>下架</option>
                                            <option value="1" <?php if($vl['gstatus'] == 1) echo 'selected'; ?>>上架</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        <?php } ?>
                    </div>
                </section>
            </form>
        </aside>
    </div>
</div>
</body>

<script>
    $(function () {
        $('#feedsubmitBtn').click(function () {
            var data = new FormData(document.getElementById("feedForm"));
            $.ajax({
                url: rootPath + 'shop/actionConfig',
                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);
                }
            });
        });
        $('#expsubmitBtn').click(function () {
            var data = new FormData(document.getElementById("expForm"));
            $.ajax({
                url: rootPath + 'shop/actionConfig',
                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>
