<style type="text/css">
    @media (max-width: 375px) {
        .edit-form tr td input {
            width: 100%;
        }

        .edit-form tr th:first-child, .edit-form tr td:first-child {
            width: 20%;
        }

        .edit-form tr th:nth-last-of-type(-n+2), .edit-form tr td:nth-last-of-type(-n+2) {
            display: none;
        }
    }

    .edit-form table > tbody > tr td a.btn-delcfg {
        visibility: hidden;
    }

    .edit-form table > tbody > tr:hover td a.btn-delcfg {
        visibility: visible;
    }

    @media (max-width: 767px) {
        .edit-form table tr th:nth-last-child(-n + 2), .edit-form table tr td:nth-last-child(-n + 2) {
            display: none;
        }

        .edit-form table tr td .msg-box {
            display: none;
        }
    }
    .panel-intro > .panel-heading{
        padding: 0;
        background: #f5f5f5;
    }
    .panel-intro > .panel-heading .nav-tabs > li > a{
        margin-right: 0;
        border: unset;
        background: none;
    }
    .panel-intro > .panel-heading .nav-tabs > li > a {

    }
    .panel-intro > .panel-heading .nav-tabs > li > a:hover,
    .panel-intro > .panel-heading .nav-tabs > li > a:focus {
        border: unset;
        color: #7b8a8b;
        /* background-color: #c9d4dc; */
    }
    .f{
        padding-left: 10px;
        padding-right: 10px;
    }
    .panel-intro > .panel-heading .nav-tabs > li.active > a{
        color: #4397fd;
    }
    @media (min-width: 768px){
        .form-horizontal .control-label {
            text-align: left;
            margin-bottom: 8px;
            padding-top: 7px;
        }
    }
    {if condition="$row.is_sku == 0"}
    .sku-true{
        display: none;
    }
    {else /}
    .sku-false{
        display: none;
    }
    {/if}
</style>
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
    <div class="f  col-lg-8">
        <div class="panel panel-default panel-intro">
            <div class="panel-heading">
                {:build_heading(null, false)}
                <ul class="nav nav-tabs">
                    <li class="active"><a href="#tab-1" data-toggle="tab">基础信息</a></li>
                    <li><a href="#tab-2" data-toggle="tab">规格属性</a></li>
                    <li><a href="#tab-3" data-toggle="tab">商品详情</a></li>
                    <li><a href="#tab-4" data-toggle="tab">营销设置</a></li>
                    <li><a href="#tab-5" data-toggle="tab">附加选项</a></li>
                    <li><a href="#tab-6" data-toggle="tab">更多信息</a></li>
                </ul>
            </div>
            <div class="panel-body">
                <div id="myTabContent" class="tab-content">
                    <div class="tab-pane fade active in" id="tab-1">
                        <div class="widget-body no-padding">
                            <div class="form-group">
                                <label class="control-label col-xs-12 col-sm-12">商品类型</label>
                                <div class="col-xs-12 col-sm-12">
                                    {:build_radios('row[type]', ['alone'=>__('独立卡密'), 'fixed'=>__('固定卡密'), 'invented'=>'虚拟商品'], $row.type)}
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-xs-12 col-sm-12">商品名称</label>
                                <div class="col-xs-12 col-sm-12">
                                    <input id="c-name" class="form-control" name="row[name]" type="text" value="{$row.name}">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-xs-12 col-sm-12">商品类目</label>
                                <div class="col-xs-12 col-sm-12">
                                    <select id="c-category_id" class="form-control selectpicker" name="row[category_id]">
                                        {volist name="category" id="vo"}
                                        <option value="{$vo.id}" {if condition="$vo.id == $row.category_id"}selected{/if}>{$vo.name}</option>
                                        {/volist}
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-xs-12 col-sm-12">封面图</label>
                                <div class="col-xs-12 col-sm-12">
                                    <div class="input-group">
                                        <input id="c-cover" class="form-control" size="50" name="row[cover]" type="text" value="{$row.cover}">
                                        <div class="input-group-addon no-border no-padding">
                                            <span><button type="button" id="faupload-cover" class="btn btn-danger faupload" data-input-id="c-cover" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-cover"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                                            <span><button type="button" id="fachoose-cover" class="btn btn-primary fachoose" data-input-id="c-cover" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                                        </div>
                                        <span class="msg-box n-right" for="c-cover"></span>
                                    </div>
                                    <ul class="row list-inline faupload-preview" id="p-cover"></ul>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-xs-12 col-sm-12">商品单位</label>
                                <div class="col-xs-12 col-sm-12">
                                    <input id="c-unit" class="form-control" name="row[unit]" type="text" placeholder="留空默认为【个】" value="{$row.unit}">
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="tab-pane fade" id="tab-2">
                        <div class="widget-body no-padding">
                            <div class="form-group">
                                <label class="control-label col-xs-12 col-sm-12">规格类型</label>
                                <div class="col-xs-12 col-sm-12">
                                    {:build_radios('row[is_sku]', ['0'=>__('单规格'), '1'=>__('多规格')], $row.is_sku)}
                                </div>
                            </div>
                            <div class="form-group sku-true">
                                <label class="control-label col-xs-12 col-sm-12">规格名称</label>
                                <div class="col-xs-12 col-sm-12">
                                    <input id="c-sku_name" class="form-control" name="row[sku_name]" type="text" placeholder="" value="{$row.sku_name}">
                                </div>
                            </div>
                            <div class="form-group sku-true">
                                <div class="col-xs-12 col-sm-12">
                                    <dl class="fieldlist" data-name="row[sku]" data-template="sku_tpl">
                                        <dd>
                                            {volist name="user_agency" id="vo"}
                                            {/volist}
                                        </dd>
                                        <dd>
                                            <a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> 追加</a>
                                        </dd>
                                        <textarea name="row[sku]" class="form-control hide" cols="30" rows="5">{$row.sku}</textarea>
                                    </dl>
                                    <!--定义模板，模板语法使用Art-Template模板语法-->
                                    <script type="text/html" id="sku_tpl">
                                        <dd class="form-inline">
                                            <input placeholder="属性值" style="width: 100px;" type="text" name="row[<%=name%>][<%=index%>][name]" class="form-control" value="<%=row['name']%>">
                                            <input placeholder="sku—id" style="width: 100px;" type="hidden" name="row[<%=name%>][<%=index%>][id]" class="form-control" value="<%=row['id']%>">
                                            <input placeholder="原价" style="width: 100px;" type="number" name="row[<%=name%>][<%=index%>][crossed_price]" class="form-control" value="<%=row['crossed_price']%>">
                                            <input placeholder="成本价" style="width: 100px;" type="number" name="row[<%=name%>][<%=index%>][cost_price]" class="form-control" value="<%=row['cost_price']%>">
                                            <input placeholder="售价" style="width: 100px;" type="number" name="row[<%=name%>][<%=index%>][sale_price]" class="form-control" value="<%=row['sale_price']%>">
                                            {volist name="user_agency" id="vo"}
                                            <input placeholder="{$vo.name}" style="width: 100px;" type="number" name="row[<%=name%>][<%=index%>][agency_price_{$vo.id}]" class="form-control" value="<%=row['agency_price_{$vo.id}']%>">
                                            {/volist}
                                            <span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span> <span class="btn btn-sm btn-primary btn-dragsort"><i class="fa fa-arrows"></i></span>
                                        </dd>
                                    </script>
                                </div>
                            </div>
                            <div class="form-group hide">
                                <label class="control-label col-xs-12 col-sm-12">sku-id</label>
                                <div class="col-xs-12 col-sm-12">
                                    <input id="c-sku_id" class="form-control" name="row[sku_id]" type="number" placeholder="" value="{$row.price.id|default=''}">
                                </div>
                            </div>
                            <div class="form-group sku-false">
                                <label class="control-label col-xs-12 col-sm-12">原价</label>
                                <div class="col-xs-12 col-sm-12">
                                    <input id="c-crossed_price" class="form-control" name="row[crossed_price]" type="number" placeholder="商品的划线价" value="{$row.price.crossed_price|default=''}">
                                </div>
                            </div>
                            <div class="form-group sku-false">
                                <label class="control-label col-xs-12 col-sm-12">成本价</label>
                                <div class="col-xs-12 col-sm-12">
                                    <input id="c-cost_price" class="form-control" name="row[cost_price]" type="number" value="{$row.price.cost_price|default=''}" placeholder="请输入商品的成本价格，用于统计销售利润">
                                </div>
                            </div>

                            <div class="form-group sku-false">
                                <label class="control-label col-xs-12 col-sm-12">售价</label>
                                <div class="col-xs-12 col-sm-12">
                                    <input id="c-sale_price" class="form-control" name="row[sale_price]" value="{$row.price.sale_price|default=''}" type="number" placeholder="请输入商品销售价格">
                                </div>
                            </div>

                            {volist name="user_agency" id="vo"}
                            <div class="form-group sku-false">
                                <label class="control-label col-xs-12 col-sm-12">{$vo.name}</label>
                                <div class="col-xs-12 col-sm-12">
                                    <input id="c-agency_price_{$vo.id}" class="form-control" name="row[agency_price_{$vo.id}]" value="{:$row.is_sku ? '' : (isset($row['price']['agency_price_' . $vo.id]) ? $row['price']['agency_price_' . $vo.id] : '')}" type="number" placeholder="请输入{$vo.name}购买的价格">
                                </div>
                            </div>
                            {/volist}
                        </div>
                    </div>
                    <div class="tab-pane fade" id="tab-3">
                        <div class="widget-body no-padding">

                            <div class="form-group">
                                <label class="control-label col-xs-12 col-sm-12">详细内容</label>
                                <div class="col-xs-12 col-sm-12">
                                    <textarea id="c-detail" class="form-control editor" rows="5" name="row[detail]" cols="50">{$row.detail}</textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="tab-pane fade" id="tab-4">
                        <div class="widget-body no-padding">
                            <div class="form-group">
                                <label class="control-label col-xs-12 col-sm-12">{:__('虚拟销量')}</label>
                                <div class="col-xs-12 col-sm-12">
                                    <input id="c-invented_sales" class="form-control" name="row[invented_sales]" type="number" placeholder="留空则使用真实销量" value="{$row.invented_sales}">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-xs-12 col-sm-12">{:__('批发优惠')}</label>
                                <div class="col-xs-12 col-sm-12">
                                    <dl class="fieldlist" data-name="row[wholesale]" data-template="wholesale_tpl">
                                        <dd></dd>
                                        <dd>
                                            <a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> 追加</a>
                                        </dd>
                                        <textarea name="row[wholesale]" class="form-control hide" cols="30" rows="5">{$row.wholesale}</textarea>
                                    </dl>
                                    <!--定义模板，模板语法使用Art-Template模板语法-->
                                    <script type="text/html" id="wholesale_tpl">
                                        <dd class="form-inline">
                                            <input style="width: 30%;" placeholder="请输入批发数量" type="number" name="row[<%=name%>][<%=index%>][number]" class="form-control" value="<%=row['number']%>">
                                            <input style="width: 40%;" placeholder="请输入每件优惠金额" type="number" name="row[<%=name%>][<%=index%>][offer]" class="form-control" value="<%=row['offer']%>">
                                            <span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span> <span class="btn btn-sm btn-primary btn-dragsort"><i class="fa fa-arrows"></i></span>
                                        </dd>
                                    </script>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="tab-pane fade" id="tab-5">
                        <div class="widget-body no-padding">

                            <div class="form-group">
                                <label class="control-label col-xs-12 col-sm-12">附加选项</label>
                                <div class="col-xs-12 col-sm-12">
                                    <dl class="fieldlist" data-name="row[attach]" data-template="attach_tpl">
                                        <dd>
                                            <ins style="width: 30%;">标题</ins>
                                            <ins style="width: 40%;">提示内容</ins>
                                            <ins style="width: 10%; text-align: center;">必填</ins>
                                        </dd>
                                        <dd>
                                            <a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> 追加</a>
                                        </dd>
                                        <textarea name="row[attach]" class="form-control hide" cols="30" rows="5">{$row.attach}</textarea>
                                    </dl>
                                    <!--定义模板，模板语法使用Art-Template模板语法-->
                                    <script type="text/html" id="attach_tpl">
                                        <dd class="form-inline">
                                            <input style="width: 30%;" type="text" name="row[<%=name%>][<%=index%>][title]" class="form-control" value="<%=row['title']%>">
                                            <input style="width: 40%;" type="text" name="row[<%=name%>][<%=index%>][placeholder]" class="form-control" value="<%=row['placeholder']%>">
                                            <input style="width: 10%; margin-top: 12px;" type="checkbox" name="row[<%=name%>][<%=index%>][checked]" <% if(row['checked'] == 'on'){ %> checked <% } %>>
                                            <span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span> <span class="btn btn-sm btn-primary btn-dragsort"><i class="fa fa-arrows"></i></span>
                                        </dd>
                                    </script>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="tab-pane fade" id="tab-6">
                        <div class="widget-body no-padding">
                            <div class="form-group">
                                <label class="control-label col-xs-12 col-sm-12">{:__('Course')}</label>
                                <div class="col-xs-12 col-sm-12">
                                    <textarea id="c-course" class="form-control editor" rows="5" name="row[course]" cols="50">{$row.course}</textarea>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-xs-12 col-sm-12">{:__('Pop_content')}</label>
                                <div class="col-xs-12 col-sm-12">
                                    <textarea id="c-pop_content" class="form-control editor" rows="5" name="row[pop_content]" cols="50">{$row.pop_content|default=''}</textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="form-group layer-footer">
                    <label class="control-label col-xs-12 col-sm-12"></label>
                    <div class="col-xs-12 col-sm-12">
                        <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
                        <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
                    </div>
                </div>

            </div>
        </div>
    </div>
    <div class="f col-lg-4">
        <div class="panel panel-default">
            <div class="panel-heading">其他设置</div>
            <div class="panel-body">
                <div class="form-group">
                    <label class="control-label col-xs-12 col-sm-12">{:__('Weigh')}</label>
                    <div class="col-xs-12 col-sm-12">
                        <input id="c-weigh" class="form-control" name="row[weigh]" type="number" placeholder="数值越大越靠前" value="{$row.weigh}">
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label col-xs-12 col-sm-12">{:__('Start_number')}</label>
                    <div class="col-xs-12 col-sm-12">
                        <input id="c-start_number" class="form-control" name="row[start_number]" type="number" placeholder="留空则不限制数量" value="{$row.start_number}">
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label col-xs-12 col-sm-12">{:__('Quota')}</label>
                    <div class="col-xs-12 col-sm-12">
                        <input id="c-quota" class="form-control" name="row[quota]" type="number" placeholder="根据客户端IP限制购买数量" value="{$row.quota}">
                    </div>
                </div>
            </div>
        </div>
    </div>
</form>

