<!-- Select2 -->
<link rel="stylesheet" href="<?php echo base_url(); ?>public/node_modules/bootstrap-select/dist/css/bootstrap-select.min.css">
<script src="<?php echo base_url(); ?>public/node_modules/bootstrap-select/dist/js/bootstrap-select.min.js"></script>
<div class="content_wrapper">
    <div class="container-fluid ">
        <div class="row">
            <div class="col-sm-12">
                <aside>
                    <header><i class="fa fa-fw fa-file"></i>折扣图标主题配置</header>
                    <section>
                        <form action="" id="adDLRewardForm">
                            <div class="container-fluid">
                                <button type="button" style="width: 80px;" class="btn btn-primary" id="commitBtn">提交
                                </button>
                                <hr>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">折扣图标主题：</label>
                                    <div class="col-sm-3">
                                        <label class="select-inline">
                                            <select name="res" class="form-control">
                                                <option value="">未选择资源</option>
                                                <?php foreach ($resList as $key => $val) { ?>
                                                    <option value="<?php echo $key; ?>" <?php if($key == $res) echo 'selected';?>><?php echo $val; ?></option>
                                                <?php } ?>
                                            </select>
                                        </label>
                                    </div>
                                </div>
                            </div>
                        </form>
                    </section>
                </aside>
            </div>
        </div>
    </div>
</div>


<script>

    //提交表格数据
    $('#commitBtn').click(function () {
        const datas = $('#adDLRewardForm').toObject();

        showLoading()
        $.ajax({
            type: 'POST',
            dataType: 'json',
            data: datas,
            url: 'config/updateActIconRes',
            success: function (data) {
                hideLoading()
                if (data.ret === 0) {
                    window.location.reload()
                } else {
                    msgTip.messager().error(data.msg);
                }
            },
            error: function (xhr, error) {
                alert('请求失败！')
                hideLoading()
                console.log(xhr, error);
            }
        });
    });

</script>

