<table>
    <thead>
        <tr>
            <th style="min-width:72px;text-align:left;">
                {{if !select && crmActivityType !== 2}}
                <span class="cd-ui-checkbox J_check-all {{
                (function(){
                    var check = 'checked';
                        if(materialPlanList && materialPlanList.length && materialPlanList[versionIndex] && materialPlanList[versionIndex].materialList.length){
                            for(var i = 0, l = materialPlanList[versionIndex].materialList.length; i < l; i++){
                                if(!materialPlanList[versionIndex].materialList[i].check){
                                    check = '';
                                    return;
                                }
                            }
                        }else{
                            check = '';
                        }
                    return check;
                })()
            }}"></span>
            {{/if}}
            快捷排序</th>
            <th>促销ID</th>
           
            <th>商品图</th>
            <th style="width: 260px">名称{{if !select && crmActivityType !== 2}}<span class="gray">(选填)</span>{{/if}}</th>
            <th style="width:60px;">促销价</th>
            <th style="width:190px;">角标及促销标签{{if !select && crmActivityType !== 2}}<span class="gray">(选填)</span>{{/if}}</th>
            <th style="min-width:115px;">BI排序干预</th>
            {{if !select && crmActivityType !== 2}}
            <th style="width:200px;">操作</th>
            {{/if}}
        </tr>
    </thead>
    <tbody class="J_product-group">
        {{each materialPlanList item index}}
            {{if index === versionIndex}}
                {{if item.materialList && item.materialList.length > 0}}
                {{each item.materialList subItem subIndex}}
                <tr data-index="{{subIndex}}">
                    <td class="black">
                        {{if !select && crmActivityType !== 2}}
                        <span class="cd-ui-checkbox J_ui-checkbox {{if subItem.check}}checked{{/if}}"></span>
                            <select name="" value="{{subIndex+1}}">
                                <% for(var i = 0; i < item.materialList.length; i++){ %>
                                    <option {{if subIndex == i}}selected="selected"{{/if}} value="{{i+1}}">{{i+1}}</option>
                                <% } %>
                            </select>
                        {{else}}
                            {{subIndex+1}}
                        {{/if}}
                    </td>
                    <td class="black center">{{subItem.promoId}}</td>
                    
                    <td class="center">
                      <div class="J_image image-item" data-path="materialPlanList[{{index}}].materialList[{{subIndex}}].jshopImageUrl">
                       <img src="{{(subItem.jshopImageUrl && subItem.jshopImageUrl.length) ? subItem.jshopImageUrl : ((subItem.imageurl && subItem.imageurl.indexOf('360buyimg') >0) ? subItem.imageurl : '//img10.360buyimg.com/cms/'+subItem.imageurl)}}" class="img" alt="">
                       {{if !select && crmActivityType !== 2}} 
                       <div class="mask">
                          <span class="J_upload-image">上传图片</span>
                          <hr>
                          <span class="J_select-image">选择图片</span>
                        </div>
                        {{/if}}
                      </div>
                    </td>
                    <td>
                      <div class="product-name J_edite-toggle" data-path="materialPlanList[{{index}}].materialList[{{subIndex}}]">
                        <textarea disabled data-limit="1-45" data-msg="商品名称可输入范围是1到45个字符!" data-path="materialPlanList[{{index}}].materialList[{{subIndex}}].jshopName">{{subItem.jshopName ? subItem.jshopName : subItem.wname}}</textarea>
                        <div class="tool">
                          <span class="J_reset-name reset-name"><i class="icon-reset icon"></i>复位</span>
                          <span class="J_enable-edit edit-name"><i class="icon-edit icon"></i>编辑</span>
                          <span class="J-enable-save save-name"><i class="icon-complete icon"></i>保存</span>
                          <span class="J_cancel-edit cancel-name"><i class="icon-close icon"></i>取消</span>
                          {{if subItem.jshopName}}
                          <strong class="name-num"><span class="J_limit-num">{{(subItem.jshopName && subItem.jshopName.length) ? 45 - (subItem.nameLength || subItem.jshopName.length) : 0}}</span>/45</strong>
                          {{/if}}
                        </div>
                      </div>
                    </td>

                    <td class="center">{{subItem.promoPrice === -1 ? '暂无价格' : '￥ '+ subItem.promoPrice}}</td>
                    <td class="center">
                        {{if !select && crmActivityType !== 2}}
                        <div style="margin-bottom: 5px;"><input placeholder="角标文案上" class="cd-text-input J_input-edit" data-path="materialPlanList[{{index}}].materialList[{{subIndex}}].tag1" type="text" value="{{subItem.tag1}}"></div>
                        <div style="margin-bottom: 5px;"><input placeholder="角标文案下" class="cd-text-input J_input-edit" data-path="materialPlanList[{{index}}].materialList[{{subIndex}}].tag2" type="text" value="{{subItem.tag2}}"></div>
                        <div><input placeholder="促销运营语" class="cd-text-input J_input-edit" data-path="materialPlanList[{{index}}].materialList[{{subIndex}}].promTag" type="text" value="{{subItem.promTag}}"></div>
                        {{else}}
                        <div style="margin-bottom: 5px;">角标文案上: {{subItem.tag1}}</div>
                        <div style="margin-bottom: 5px;">角标文案下: {{subItem.tag2}}</div>
                        <div>促销运营语 :{{subItem.promTag}}</div>
                        {{/if}}
                    </td>
                     <td><span class="cd-ui-checkbox J_addBiSort {{if subItem.keepBiOrder}}checked{{/if}}"></span>BI后保持当前排序</td>
                    {{if !select && crmActivityType !== 2}}
                    <td class="left">
                        <div class="tool black">
                            <span class="transition03 J_top {{if subIndex === 0}}disabled{{/if}}">上移</span>
                            <span class="transition03 J_bottom {{if subIndex+1 === item.materialList.length}}disabled{{/if}}">下移</span>
                            <span class="transition03 J_to-top {{if subIndex === 0}}disabled{{/if}}">置顶</span>
                            <span class="transition03 J_to-bottom {{if subIndex+1 === item.materialList.length}}disabled{{/if}}">置底</span>
                            <span class="transition03 J_delete-item">删除</span>
                        </div>
                    </td>
                    {{/if}}
                </tr>
                {{/each}}
                {{else}}
                <tr>
                    <td style="text-align:center;" colspan="{{select ? 7 : 8}}">暂无数据</td>
                </tr>
                {{/if}}
            {{/if}}
        {{/each}}
    </tbody>
</table>
