<style>
    .full_reduce{
        display: none;
    }
    .discount{
        display: none;
    }
</style>
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
    <input name="row[type]" type="hidden" value="2">
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Coupon_name')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-coupon_name" class="form-control" data-rule="required" name="row[coupon_name]" type="text" value="">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Is_new')}:</label>
        <div class="col-xs-12 col-sm-8">
            {:build_select('row[is_new]', $is_new, null, ['class'=>'form-control', 'required'=>''])}
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Goods')}:</label>
        <div class="col-xs-12 col-sm-8">
            {:build_select('row[bg_id]', $goods, null, ['class'=>'form-control', 'required'=>''])}
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('C_type')}:</label>
        <div class="col-xs-12 col-sm-8">
            {:build_select('row[c_type]', $c_type, null, ['class'=>'form-control c_type', 'required'=>''])}
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Coupon_type')}:</label>
        <div class="col-xs-12 col-sm-8">
            {:build_select('row[coupon_type]', $coupon_type, null, ['class'=>'form-control coupon_type', 'required'=>''])}
        </div>
    </div>
    <div class="form-group full_reduce">
        <label class="control-label col-xs-12 col-sm-2">{:__('Full_reduce')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-full_reduce" class="form-control" step="0.01" name="row[full_reduce]" type="number" value="0.00">
        </div>
    </div>
    <div class="form-group reduce">
        <label class="control-label col-xs-12 col-sm-2">{:__('Reduce')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-reduce" class="form-control" step="0.01" name="row[reduce]" type="number" value="0.00">
        </div>
    </div>
    <div class="form-group discount">
        <label class="control-label col-xs-12 col-sm-2">{:__('Discount')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-discount" data-rule="range(1~10)" class="form-control" name="row[discount]" type="number" value="1">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Coupon_number')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-coupon_number" data-rule="required" class="form-control" name="row[coupon_number]" type="number" value="0">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Start_time')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-start_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[start_time]" type="text" value="">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('End_time')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-end_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[end_time]" type="text" value="">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Gift')}:</label>
        <div class="col-xs-12 col-sm-8">
            {:build_select('row[gift]', $gift, null, ['class'=>'form-control', 'required'=>''])}
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Sort')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-sort" data-rule="required range(0~)" class="form-control" name="row[sort]" type="number" value="0">
        </div>
    </div>
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>
<script src="https://code.jquery.com/jquery-3.0.0.min.js"></script>
<script>
    $(function(){
        //无门槛,有门槛
        $('.c_type').change(function(){
            var t_value = $(this).children('option:selected').val();//这就是selected的值
            c_type(t_value);
        });
        //减少券,折扣券
        $('.coupon_type').change(function(){
            var coupon_value = $(this).children('option:selected').val();//这就是selected的值
            coupon_type(coupon_value);
        })
    });

    function c_type(t_value){
        if(t_value == 0){
            //无门槛,不显示
            $('.full_reduce').css('display','none');
        }else{
            //有门槛,显示
            $('.full_reduce').css('display','block');
        }
    }
    //优惠类型
    function coupon_type(coupon_value){
        if(coupon_value == 0){
            //减少券,减少金额显示,折扣金额隐藏
            $('.reduce').css('display','block');
            $('.discount').css('display','none');
        }else{
            //折扣券,折扣金额显示,减少金额隐藏
            $('.reduce').css('display','none');
            $('.discount').css('display','block');
        }
    }
</script>