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

<div class="am-padding-sm">
    {{if empty($data)}}
        {{:ModuleInclude('public/not_data')}}
    {{else /}}
        <!-- form start -->
        <form class="am-form form-validation am-form-full-screen am-form-popup-fixed" action="{{:MyUrl('admin/order/delivery')}}" method="POST" request-type="ajax-reload" request-value="parent">
            <div class="am-form-group express-list">
                <ul class="am-list am-list-static am-list-border am-list-striped am-margin-bottom-0 am-radius am-nbfc">
                    {{if !empty($data['express_data']) and is_array($data['express_data'])}}
                        {{foreach $data['express_data'] as $k=>$v}}
                            <li>
                                <span>{{$v.express_name}} / {{$v.express_number}}</span>
                                <a href="javascript:;" class="am-text-xs am-text-blue edit-submit"> {{:MyLang('edit_title')}}</a>
                                <a href="javascript:;" class="am-text-xs am-text-blue delete-submit"> {{:MyLang('remove_title')}}</a>
                            </li>
                        {{/foreach}}
                    {{/if}}
                </ul>
                <input type="hidden" name="express_data" value="{{if !empty($data['express_data'])}}{{:urlencode(json_encode($data.express_data))}}{{/if}}" />
                <div>
                    <button type="button" class="am-btn am-btn-primary-light-plain am-radius am-btn-xs am-margin-top-sm express-submit-add"> 
                        <i class="iconfont icon-add"></i>
                        <span>{{:MyLang('order.form_item_express_add_name')}}</span>
                    </button>
                </div>
            </div>

            <div class="am-form-popup-submit">
                <input type="hidden" name="id" value="{{$data.id}}"/>
                <input type="hidden" name="user_id" value="{{$data.user_id}}"/>
                <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('submit_title')}}'}">
                    <i class="am-icon-save"></i>
                    <span>{{:MyLang('submit_title')}}</span>
                </button>
            </div>
        </form>
        <!-- form end -->
    {{/if}}
</div>

<!-- 快递添加弹层 -->
<div class="am-modal" tabindex="-1" id="popup-express-win">
    <div class="am-modal-dialog">
        <div class="am-modal-hd">
            <span>{{:MyLang('order.form_item_express_choice_win_name')}}</span>
            <a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close>&times;</a>
        </div>
        <div class="am-modal-bd am-text-left">
            <form class="am-form form-validation-express" method="post" request-type="sync" request-value="ViewExpressModalBack">
                <div class="am-form-group">
                    <label>{{:MyLang('order.form_item_express_id')}}<span class="am-form-group-label-tips-must">*</span></label>
                    <div>
                        <select name="express_id" class="am-radius chosen-select" data-placeholder="{{:MyLang('please_select_tips')}}" data-validation-message="{{:MyLang('common_service.order.delivery_express_id_message')}}" required>
                            <option value="">{{:MyLang('please_select_tips')}}</option>
                            {{if !empty($express_list)}}
                                {{foreach $express_list as $v}}
                                    <option value="{{$v.id}}">{{$v.name}}</option>
                                {{/foreach}}
                            {{/if}}
                        </select>
                    </div>
                </div>
                <div class="am-form-group">
                    <label>{{:MyLang('order.form_item_express_number')}}<span class="am-form-group-label-tips-must">*</span></label>
                    <input type="text" autocomplete="off" name="express_number" placeholder="{{:MyLang('order.form_item_express_number')}}" minlength="1" data-validation-message="{{:MyLang('common_service.order.delivery_express_number_message')}}" class="am-radius" required />
                </div>
                <div class="am-form-group">
                    <label>{{:MyLang('order.form_item_note')}}</label>
                    <input type="text" autocomplete="off" name="note" placeholder="{{:MyLang('order.form_item_note')}}" maxlength="230" data-validation-message="{{:MyLang('order.form_item_note_message')}}" class="am-radius" />
                </div>

                <div class="am-form-group am-margin-top-sm">
                    <button type="submit" class="am-btn am-btn-primary am-radius am-btn-sm am-btn-block">{{:MyLang('confirm_title')}}</button>
                </div>
            </form>
        </div>
    </div>
</div>

<!-- footer start -->
{{:ModuleInclude('public/footer')}}

<script type="text/javascript">
// 返回处理
function ViewExpressModalBack(data)
{
    ExpressModalHandle(data);
}
</script>