condition.html 12.9 KB
<div class="row">
    <div class="form-group" id="condition_combine">
        <form id="form_condition_combine">
        <label class="col-sm-1"> 如果下面</label>
        <div class="col-sm-14">
            
            <input type="hidden" name="type" value="condition_combine">
            <div class="col-sm-2">
                <select name="aggregator" id="aggregator"  title="" class="form-control" value="">                        
                    <option selected="selected" value="all">全部</option>
                    <option value="any">任意</option>                         
                </select>
            </div>
            <label class="col-sm-1 ">条件为</label>
            <input type="hidden" name="operator" value="=="/>
            <div class="col-sm-2">
                <select class="form-control" name="value" value="">
                    <option value='true'></option>
                    <!--
                    <option value='false'>否</option>
                    -->
                </select>
            </div>
        </div>
        </form>                            
    </div>    

    <div class="form-group" id="rule_condition_0_1">
        <label class="col-sm-1 control-label"><u>第1级操作</u></label>
        <div class="col-sm-14">
            <button class="btn btn-primary" onclick="PromotionEditor.loadTypeSel('condition_combine', 0, 1);">新增</button>
        </div>                 
    </div>
    
</div>

<input type="hidden" id="id" value="[[id]]">                            

<div class="panel-footer">
    <button class="btn btn-primary" id="save_condition">保存</button>
</div>

<script type="text/template" id="fm_condition_operator_add">
    <label class="col-sm-1 control-label">1级操作</label>
    <div class="col-sm-14">
    <button class="btn btn-primary" id="createLevel1">新增</button>
    </div>    
</script>


<script type="text/template" id="fm_condition_type">
    <div class="col-sm-4 col-sm-offset-3">
        <select class="form-control" onchange="PromotionEditor.loadOneCondition(this, [[pnodeindex]], [[curnodeIndex]]);" id="condition_type_[[pnodeindex]]_[[curnodeIndex]]">    
            <option value="">请选择一种条件</option>
            [[each typeList as item __index]]    
                <option value="[[item.name]]">[[item.caption]]</option>
            [[/each]]
        </select>
    </div>
</script>

<script type="text/template" id="fm_condition_payment">
    <div class="form-group" id="rule_condition_[[nodeIndex]]_[[curnodeIndex]]" pnodeIndex="[[nodeIndex]]" nodeIndex="[[curnodeIndex]]">
        <form id="form_[[nodeIndex]]_[[curnodeIndex]]">
        <label class="col-sm-1 control-label"><u>NO.[[curnodeIndex]]</u></label>
        <div class="col-sm-14">
            <input type="hidden" name="type" value="condition_payment"/>
            <label class="col-sm-1 ">支付方式</label>
                
            <div class="col-sm-1">
                <select class="form-control" name="operator" value="">
                    <option value="==">等于</option>
                    <option value="!=">不等于</option>
                </select>
            </div>
            <div class="col-sm-1">
                <select class="form-control" name="value" value="">
                    <option value="cash_online">在线支付</option>
                    <option value="cash_ondelivery ">货到付款</option>
                </select>
            </div>
            <a title="Remove" class="btn btn-danger btn-xs"  href="javascript:void(0)" onclick="PromotionEditor.delCondition([[ nodeIndex ]],[[curnodeIndex]]);">
            删除</a>
        </div>
        </form>
    </div>
</script>

<script type="text/template" id="fm_condition_product">
    <div class="form-group" id="rule_condition_[[nodeIndex]]_[[curnodeIndex]]" pnodeIndex="[[nodeIndex]]" nodeIndex="[[curnodeIndex]]">
        <form id="form_[[nodeIndex]]_[[curnodeIndex]]">
        <label class="col-sm-1 control-label"><u>NO.[[curnodeIndex]]</u></label>
        <div class="col-sm-14">
            <input type="hidden" name="type" value="condition_product"> 
            
            <label class="col-sm-2 ">如果购物车中符合下面</label>
                
            <div class="col-sm-1">
                <select class="form-control" name="aggregator" value="[[aggregator]]">
                    <option value="all">全部</option>
                    <option value="any">任意</option>
                </select>
            </div>
            <label class="col-sm-1 ">条件的商品的</label>
             
            <div class="col-sm-1">
                <select class="form-control" name="operatobj" value="[[operatobj]]">
                    <option value="num">个数</option>
                    <option value="amount">金额</option>
                </select> 
            </div>
            <div class="col-sm-1">
                <select class="form-control" name="operator" value="[[operator]]">
                    <option value=">" >大于</option>
                    <option value=">=">大于等于</option>
                    <!--
                    <option value="&lt;">小于</option>
                    -->
                    <option value="&lt;=">小于等于</option>
                </select> 
            </div>
            <div class="col-sm-2">
                <input type="text" class="form-control" name="value" value='[[ value ]]'/> 
            </div>
            <span class="col-sm-2">
                <a title="Remove" class="btn btn-danger btn-xs" href="javascript:void(0);" onclick="PromotionEditor.delCondition([[ nodeIndex ]],[[curnodeIndex]]);">
                删除
                </a>
            </span>
        </div>
        </form>
    </div>
</script>

<script type="text/template" id="fm_condition_product_sort">
    <div class="form-group" id="rule_condition_[[nodeIndex]]_[[curnodeIndex]]" pnodeIndex="[[nodeIndex]]" nodeIndex="[[curnodeIndex]]">
        <form id="form_[[nodeIndex]]_[[curnodeIndex]]">
        <label class="col-sm-1 control-label"><u>NO.[[nodeIndex]].[[curnodeIndex]]</u></label>
        <div class="col-sm-14 col-sm-offset-2">
            <input type="hidden" name="type" value="condition_product_sort">
            
            <label class="col-sm-1 ">产品分类</label>            
            
            <div class="col-sm-1">
                <select class="form-control" name="operator" value="[[operator]]">
                    <option value="==">等于</option>
                    <option value="!=">不等于</option>
                </select>
                
            </div>
            <div id="sortTree_[[nodeIndex]]_[[curnodeIndex]]" class="col-sm-4 height40" style="border: 0px; padding: 0px;float:left"></div>
            
            <a title="Remove" class="btn btn-danger btn-xs"  href="javascript:void(0)" onclick="PromotionEditor.delCondition([[nodeIndex]],[[ curnodeIndex ]]);">
            删除</a>
        </div>
        </form>
    </div>
</script>

<script type="text/template" id="fm_condition_product_brand">
    <div class="form-group" id="rule_condition_[[nodeIndex]]_[[curnodeIndex]]" pnodeIndex="[[nodeIndex]]" nodeIndex="[[curnodeIndex]]">
        <form id="form_[[nodeIndex]]_[[curnodeIndex]]">
        <label class="col-sm-1 control-label"><u>NO.[[nodeIndex]].[[curnodeIndex]]</u></label>
        <div class="col-sm-14 col-sm-offset-2">

            <input type="hidden" name="type" value="condition_product_brand">
            
            <label class="col-sm-1 ">品牌</label>
            <div class="col-sm-1">            
                <select class="form-control" name="operator" value="[[operator]]">
                    <option value="==">等于</option><option value="!=">不等于</option>
                </select> 
            </div>
            <select class="col-sm-4" name="value" id="brands_[[nodeIndex]]_[[curnodeIndex]]" value="[[value]]">
            [[if brandList]]
                [[each brandList as brand __index]]
                <option value="[[  brand.id]]">[[  brand.text]]</option>
                [[/each]]
            [[/if]]
            </select> 
            <a title="Remove" class="btn btn-danger btn-xs"  href="javascript:void(0)" onclick="PromotionEditor.delCondition([[nodeIndex]],[[ curnodeIndex ]]);">
            删除
            </a>
        </div>
        </form>
    </div>
</script>


<script type="text/template" id="fm_condition_product_shop">
    <div class="form-group" id="rule_condition_[[nodeIndex]]_[[curnodeIndex]]" pnodeIndex="[[nodeIndex]]" nodeIndex="[[curnodeIndex]]">
        <form id="form_[[nodeIndex]]_[[curnodeIndex]]">
            <label class="col-sm-1 control-label"><u>NO.[[nodeIndex]].[[curnodeIndex]]</u></label>
            <div class="col-sm-14 col-sm-offset-2">

                <input type="hidden" name="type" value="condition_product_shop">

                <label class="col-sm-1 ">店铺</label>
                <div class="col-sm-1">
                    <select class="form-control" name="operator" value="[[operator]]">
                        <option value="==">等于</option><option value="!=">不等于</option>
                    </select>
                </div>
                <select class="col-sm-4" name="value" id="shops_[[nodeIndex]]_[[curnodeIndex]]" value="[[value]]">
                    [[if shopList]]
                    [[each shopList as shop __index]]
                    <option value="[[  shop.id]]">[[  shop.text]]</option>
                    [[/each]]
                    [[/if]]
                </select>
                <a title="Remove" class="btn btn-danger btn-xs"  href="javascript:void(0)" onclick="PromotionEditor.delCondition([[nodeIndex]],[[ curnodeIndex ]]);">
                    删除
                </a>
            </div>
        </form>
    </div>
</script>

<script type="text/template" id="fm_condition_promotion_flag">
    <div class="form-group" id="rule_condition_[[nodeIndex]]_[[curnodeIndex]]" pnodeIndex="[[nodeIndex]]" nodeIndex="[[curnodeIndex]]">
        <form id="form_[[nodeIndex]]_[[curnodeIndex]]">
        <label class="col-sm-1 control-label"><u>NO.[[nodeIndex]].[[curnodeIndex]]</u></label>
        <div class="col-sm-14 col-sm-offset-2">
            <input type="hidden" name="type" value="condition_promotion_flag">
            
            <label class="col-sm-1 ">促销标记</label>
            <div class="col-sm-1">               
                <select class="form-control" name="operator" value="[[operator]]">
                    <option value="==">等于</option><option value="!=">不等于</option>
                </select>
                
            </div>
            <div class="col-sm-4">
                <select class="form-control" name="value" value="[[value]]" id="promotions_[[nodeIndex]]_[[curnodeIndex]]"> 
                    [[if promotionFlagList]]   
                        [[each promotionFlagList as flag __index]]
                        <option value="[[ flag.flagValue]]">[[flag.title]]</option>
                        [[/each]]
                    [[/if]]
                </select>
            </div>
            
            <a title="Remove" class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="PromotionEditor.delCondition([[nodeIndex]],[[ curnodeIndex ]]);">
                删除
            </a>
        </div>
        </form>
    </div>
</script>

<script type="text/template" id="fm_condition_special_product">
    <div class="form-group" id="rule_condition_[[nodeIndex]]_[[curnodeIndex]]" pnodeIndex="[[nodeIndex]]" nodeIndex="[[curnodeIndex]]">
        <form id="form_[[nodeIndex]]_[[curnodeIndex]]">
        <label class="col-sm-1 control-label"><u>NO.[[nodeIndex]].[[curnodeIndex]]</u></label>
        <div class="col-sm-14 col-sm-offset-2">
            <input type="hidden" name="type" value="condition_special_product">
            
            <label class="col-sm-1 ">特定商品</label>
            <div class="col-sm-1">               
                <select class="form-control" name="operator" value="[[operator]]">
                    <option value="!()">不属于</option><option value="()">属于</option><option value="==">等于</option>
                    <option value="!=">不等于</option>
                </select>
                
            </div>
            <textarea rows="" cols="" style="width: 320px; height: 70px;" name="value"></textarea>
            
            <a title="Remove" class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="PromotionEditor.delCondition([[nodeIndex]],[[ curnodeIndex ]]);">
                删除
            </a>
        </div>
        </form>
    </div>
</script>

<script type="text/template" id="fm_add_level_1">
    <div class="form-group" id="rule_condition_0_[[nextIndex]]">
        <label class="col-sm-1 control-label"><u>1级操作</u></label>
        <div class="col-sm-14 col-sm-offset-4">
            <button class="btn btn-primary" onclick="PromotionEditor.loadTypeSel('condition_combine', 0, [[nextIndex]]);">新增第一级</button>
        </div>    
    </div>    
</script>