{{:ModuleInclude('public/header')}}

<!-- right content start  -->
<div class="content-right">
    <div class="content">
        <!-- form start -->
        <form class="am-form form-validation am-form-popup-sticky" action="{{:MyUrl('admin/site/save')}}" method="POST" request-type="ajax-view" request-value="{{:MyUrl('admin/site/index', ['nav_type'=>'sitetype'])}}" enctype="multipart/form-data">
            {{:ModuleInclude('public/nav_switch_btn', [
                'nav_data' => [
                    [
                        'name' => MyLang('base_config_title'),
                        'key'  => 'base-config-title',
                    ],
                    [
                        'name' => MyLang('site.base_item_self_extraction_title'),
                        'key'  => 'site-self-extraction',
                    ],
                    [
                        'name' => MyLang('site.base_item_fictitious_title'),
                        'key'  => 'site-item-fictitious',
                    ]
                ]
            ])}}
            <div class="nav-content">
                <!-- 提示 -->
                {{if is_array(MyLang('site.sitetype_top_tips_list'))}}
                    <div class="am-operate-stretch-tips">
                        <div class="title">
                            <i class="iconfont icon-tips"></i>
                            <strong title="{{:MyLang('operate_list_tips_msg')}}">{{:MyLang('operate_list_tips_button_text')}}</strong>
                            <i class="iconfont icon-retract-diagonal contract" title="{{:MyLang('operate_list_tips_retract_text')}}"></i> 
                        </div>
                        <p>{{:implode('</p><p>', MyLang('site.sitetype_top_tips_list'))}}</p>
                    </div>
                {{/if}}
                <!-- 基础配置 -->
                <div class="item am-active" data-key="base-config-title">
                    <!-- 展示型 -->
                    <div class="am-form-group">
                        <label class="am-block">{{$data.common_is_exhibition_mode_btn_text.name}}</label>
                        <input type="text" name="{{$data.common_is_exhibition_mode_btn_text.only_tag}}" placeholder="{{$data.common_is_exhibition_mode_btn_text.name}}" data-validation-message="{{$data.common_is_exhibition_mode_btn_text.error_tips}}" class="am-radius" {{if !empty($data)}}value="{{$data.common_is_exhibition_mode_btn_text.value}}"{{/if}} />
                        <div class="am-tips-card">
                            <p>{{$data.common_is_exhibition_mode_btn_text.describe}}</p>
                        </div>
                    </div>

                    <!-- 站点类型 -->
                    <div class="am-form-group platform-list-value-container">
                        <label class="am-block am-margin-bottom-sm">{{$data.common_site_type.name}}<span class="am-form-group-label-tips">{{$data.common_site_type.describe}}</span></label>
                        <div class="site-type-list am-flex am-flex-warp am-gap-2 am-margin-top-sm">
                            {{foreach $common_platform_type as $k=>$v}}
                                <div class="am-flex am-flex-row am-gap-2">
                                    <span class="am-text-right">{{$v.name}}</span>
                                    {{if !empty($common_site_type_list)}}
                                        <div class="am-radio-group">
                                            {{foreach $common_site_type_list as $site}}
                                                <label class="am-radio-inline">
                                                    <input type="radio" value="{{$site.value}}" name="{{$data.common_site_type.only_tag}}[{{$v.value}}]" data-validation-message="{{:MyLang('site.site_setup_choice_payment_message', ['name'=>$v['name']])}}" {{if (!empty($data['common_site_type']) and !empty($data['common_site_type']['value']) and isset($data['common_site_type']['value'][$v['value']]) and $data['common_site_type']['value'][$v['value']] eq $site['value']) or ((empty($data['common_site_type']) or empty($data['common_site_type']['value']) or !isset($data['common_site_type']['value'][$v['value']])) and isset($site['checked']) and $site['checked'] eq true)}}checked{{/if}}  data-am-ucheck>{{$site.name}}
                                                </label>
                                            {{/foreach}}
                                        </div>
                                    {{/if}}
                                </div>
                            {{/foreach}}
                        </div>
                    </div>
                </div>

                <!-- 自提点 -->
                <div class="item" data-key="site-self-extraction">
                    <div class="am-form-group">
                        <div class="card-grey">
                            <div class="am-flex am-flex-col am-gap-1">
                                <label class="am-block">{{:MyLang('site.base_item_self_extraction_title')}}</label>
                                <ul class="address-list am-nbfc am-radius am-padding-0">
                                    {{if !empty($extraction_address_list) and is_array($extraction_address_list)}}
                                        {{foreach $extraction_address_list as $address}}
                                            <li class="am-flex am-flex-justify-between am-flex-items-center am-gap-12">
                                                <div class="am-flex am-flex-items-center am-flex-1 am-flex-width">
                                                    {{if !empty($address['logo'])}}
                                                        <img src="{{$address.logo}}" alt="{{$address.name}}" class="am-img-thumbnail am-radius address-logo" />
                                                    {{/if}}
                                                    <span class="address-content">
                                                        <span class="address-text">{{$address.province_name}} {{$address.city_name}} {{$address.county_name}} {{$address.address}}（{{$address.name}}-{{$address.tel}}）</span>
                                                        {{if !empty($address['alias'])}}
                                                        <span class="am-badge am-radius-sm am-badge-success am-margin-left-xs">{{$address.alias}}</span>
                                                        {{/if}}
                                                    </span>
                                                </div>
                                                <div>
                                                    <span class="edit-submit"><i class="iconfont icon-edit am-text-xs"></i>{{:MyLang('edit_title')}}</span>
                                                    <span class="delete-submit"><i class="iconfont icon-btn-del am-text-xs"></i>{{:MyLang('remove_title')}}</span>
                                                </div>
                                            </li>
                                        {{/foreach}}
                                    {{/if}}
                                </ul>
                            </div>
                            <div class="am-flex">
                                <input type="hidden" name="{{$data.common_self_extraction_address.only_tag}}" value="{{if !empty($extraction_address_list) and is_array($extraction_address_list)}}{{:urlencode(base64_encode(json_encode($extraction_address_list, JSON_UNESCAPED_UNICODE)))}}{{/if}}" class="self-extraction-address-value" />
                                <button type="button" class="am-btn am-btn-primary-light-plain am-radius am-btn-xs address-submit-add"> 
                                    <i class="iconfont icon-add am-text-xs"></i>
                                    <span>{{:MyLang('site.add_self_extraction_address_title')}}</span>
                                </button>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 虚拟销售 -->
                <div class="item" data-key="site-item-fictitious">
                    <div class="am-form-group">
                        <label class="am-block">{{$data.common_site_fictitious_title.name}}</label>
                        <input type="text" name="{{$data.common_site_fictitious_title.only_tag}}" placeholder="{{$data.common_site_fictitious_title.name}}" data-validation-message="{{$data.common_site_fictitious_title.error_tips}}" class="am-radius" {{if !empty($data)}}value="{{$data.common_site_fictitious_title.value}}"{{/if}} />
                        <div class="am-tips-card">
                            <p>{{$data.common_site_fictitious_title.describe}}</p>
                        </div>
                    </div>
                    <div class="am-form-group">
                        <label class="am-block">{{$data.common_site_fictitious_use_tips.name}}</label>
                        <textarea rows="4" name="{{$data.common_site_fictitious_use_tips.only_tag}}" class="am-radius" placeholder="{{$data.common_site_fictitious_use_tips.name}}" data-validation-message="{{$data.common_site_fictitious_use_tips.error_tips}}">{{if !empty($data)}}{{$data.common_site_fictitious_use_tips.value}}{{/if}}</textarea>
                        <div class="am-tips-card">
                            <p>{{$data.common_site_fictitious_use_tips.describe}}</p>
                        </div>
                    </div>
                </div>
            </div>

            <div class="am-form-popup-submit">
                <input type="hidden" name="nav_type" value="{{$nav_type}}" />
                <button type="submit" class="am-btn am-btn-primary am-radius am-btn-xs btn-loading-example" data-am-loading="{spinner: 'circle-o-notch', loadingText:'{{:MyLang('save_title')}}'}">
                    <i class="am-icon-save"></i>
                    <span>{{:MyLang('save_title')}}</span>
                </button>
            </div>
        </form>
        <!-- form end -->

        <!-- 自提点地址添加弹层 -->
        <div class="am-popup am-radius" id="popup-address-win">
            <div class="am-popup-inner">
                <div class="am-popup-hd">
                    <h4 class="am-popup-title">{{:MyLang('site.form_take_address_title')}}</h4>
                    <span data-am-modal-close class="am-close">&times;</span>
                </div>
                <div class="am-popup-bd">
                    <form class="am-form form-validation-address am-form-full-screen am-form-popup-fixed" method="post" request-type="sync" request-value="ViewAddressModalBack">
                        <div class="am-form-group row am-form-file">
                            <label class="am-block">
                                {{:MyLang('site.form_take_address_logo')}}
                                <a href="javascript:;" class="am-icon-question-circle am-margin-left-xs" data-am-popover="{content: '{{:MyLang('site.form_take_address_logo_tips')}}', trigger: 'hover focus', theme: 'sm'}"></a>
                            </label>
                            <div class="am-form-file-upload-container">
                                <ul class="plug-file-upload-view sitetype-logo" data-form-name="logo" data-max-number="1" data-dialog-type="images">
                                    <li class="plug-file-upload-submit" data-view-tag="ul.sitetype-logo">
                                        <i class="iconfont icon-add"></i>
                                    </li>
                                </ul>
                            </div>
                        </div>
                        <div class="am-form-group row">
                            <label class="am-block">{{:MyLang('site.form_take_address_alias')}}</label>
                            <input type="text" name="alias" placeholder="{{:MyLang('site.form_take_address_alias_message')}}" minlength="0" maxlength="16" data-validation-message="{{:MyLang('site.form_take_address_alias_message')}}" class="am-radius" />
                        </div>
                        <div class="am-form-group row">
                            <label class="am-block">{{:MyLang('site.form_take_address_name')}}<span class="am-form-group-label-tips-must">*</span></label>
                            <input type="text" name="name" placeholder="{{:MyLang('site.form_take_address_name_message')}}" minlength="1" maxlength="60" data-validation-message="{{:MyLang('site.form_take_address_name_message')}}" class="am-radius" required />
                        </div>
                        <div class="am-form-group row">
                            <label class="am-block">{{:MyLang('site.form_take_address_tel')}}<span class="am-form-group-label-tips-must">*</span></label>
                            <input type="text" name="tel" placeholder="{{:MyLang('site.form_take_address_tel')}}" minlength="6" maxlength="30" data-validation-message="{{:MyLang('site.form_take_address_tel_message')}}" class="am-radius" required />
                        </div>
        
                        {{:ModuleInclude('lib/region_linkage', [], ['is_row'=>1])}}
                        <div class="am-form-group row">
                            <label class="am-block">{{:MyLang('site.form_take_address_address')}}<span class="am-form-group-label-tips-must">*</span></label>
                            <div class="am-flex am-flex-items-center am-width am-pr">
                                <input type="hidden" name="lng" id="form-lng" />
                                <input type="hidden" name="lat" id="form-lat" />
                                <input type="text" name="address" id="form-address" data-is-clearout="0" placeholder="{{:MyLang('site.form_take_address_address')}}" minlength="2" maxlength="80" data-validation-message="{{:MyLang('site.form_take_address_address_message')}}" class="am-radius am-map-positioning-input" required />
                                <i class="iconfont icon-map-position am-map-positioning-icon" id="map-location-submit"></i>
                            </div>
                        </div>
                        <div id="map" data-level="17" class="am-radius-lg"></div>
                        <div class="am-form-popup-submit">
                            <button type="button" class="am-btn am-btn-warning am-radius am-btn-xs" data-am-modal-close>
                                <i class="am-icon-paint-brush"></i>
                                <span>{{:MyLang('cancel_title')}}</span>
                            </button>
                            <button type="submit" class="am-btn am-btn-primary am-radius am-btn-xs btn-loading-example" data-am-loading="{spinner: 'circle-o-notch', loadingText:'{{:MyLang('confirm_title')}}'}">
                                <i class="am-icon-check"></i>
                                <span>{{:MyLang('confirm_title')}}</span>
                            </button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- right content end  -->

<!-- footer start -->
{{:ModuleInclude('public/footer')}}
<script type="text/javascript">
// 返回处理
function ViewAddressModalBack(data)
{
    AddressModalHandle(data);
}
</script>