<!-- 继承公共的 form -->
{{extend name="../../../module/view/form_table/detail" /}}

<!-- 重写数据模块 -->
{{block name="detail_data"}}
    {{:ModuleInclude('public/detail_nav_switch_tabs', [
        'nav_data' => [
            [
                'name' => MyLang('form_base_data_title'),
                'key'  => 'base',
            ],
            [
                'name' => MyLang('order.detail_goods_title'),
                'key'  => 'order-detail-goods',
            ],
            [
                'name'     => MyLang('common_service.order.delivery_express_info'),
                'key'      => 'order-detail-express',
                'is_show'  => $data['order_model'] == 0 ? 1 : 0,
            ],
            [
                'name'     => $data['order_model'] == 2 ? MyLang('order.detail_take_address_title') : MyLang('order.detail_user_address_title'),
                'key'      => 'order-detail-user-address',
                'is_show'  => in_array($data['order_model'], [0,1,2]) ? 1 : 0,
            ],
            [
                'name'     => MyLang('order.detail_service_title'),
                'key'      => 'order-detail-service',
                'is_show'  => $data['order_model'] == 1 ? 1 : 0,
            ],
            [
                'name'     => MyLang('order.detail_fictitious_title'),
                'key'      => 'order-detail-fictitious',
                'is_show'  => $data['order_model'] == 3 ? 1 : 0,
            ]
        ]
    ])}}
    <div class="detail-content-switch-data-item">
        <!-- 父级内容 -->
        <div class="item am-active" data-key="base">
            {__block__}
        </div>

        <!-- 订单商品 -->
        <div class="item" data-key="order-detail-goods">
            <div class="am-padding-sm">
                {{if !empty($data['items'])}}
                    {{:ModuleInclude('order/module/goods', $data)}}
                {{else /}}
                    {{:ModuleInclude('public/not_data')}}
                {{/if}}
            </div>
        </div>

        <!-- 订单快递信息 -->
        <div class="item" data-key="order-detail-express">
            <div class="am-padding-sm">
                {{if !empty($data['express_data'])}}
                    <div class="am-scrollable-horizontal">
                        <table class="am-table am-text-left am-margin-bottom-0 am-text-nowrap">
                            <thead>
                                <tr class="am-color-grey">
                                    <th>{{:MyLang('order.form_table_express.name')}}</th>
                                    <th>{{:MyLang('order.form_table_express.number')}}</th>
                                    <th>{{:MyLang('order.form_table_express.note')}}</th>
                                    <th>{{:MyLang('order.form_table_express.time')}}</th>
                                </tr>
                            </thead>
                            <tbody>
                                {{foreach $data.express_data as $v}}
                                    <tr>
                                        <td>
                                            {{if empty($v['express_website_url'])}}
                                                {{if !empty($v['express_icon'])}}
                                                    <img src="{{$v.express_icon}}" class="am-img-thumbnail am-radius am-vertical-align-middle" width="20" height="20" alt="{{$v.express_name}}" />
                                                {{/if}}
                                                <span class="am-vertical-align-middle">{{$v.express_name}}</span>
                                            {{else /}}
                                                <a href="{{$v.express_website_url}}" target="_blank">
                                                    {{if !empty($v['express_icon'])}}
                                                        <img src="{{$v.express_icon}}" class="am-img-thumbnail am-radius am-vertical-align-middle" width="20" height="20" alt="{{$v.express_name}}" />
                                                    {{/if}}
                                                    <span class="am-vertical-align-middle">{{$v.express_name}}</span>
                                                </a>
                                            {{/if}}
                                        </td>
                                        <td>
                                            <span class="text-copy-submit">{{$v.express_number}}</span>
                                        </td>
                                        <td>{{$v.note}}</td>
                                        <td>{{$v.add_time}}</td>
                                    </tr>
                                {{/foreach}}
                            </tbody>
                        </table>
                    </div>
                {{else /}}
                    {{:ModuleInclude('public/not_data')}}
                {{/if}}
            </div>
        </div>

        <!-- 收货/自提地址 -->
        <div class="item" data-key="order-detail-user-address">
            <div class="am-padding-sm">
                {{if !empty($data['address_data'])}}
                    {{if $data['order_model'] eq 2}}
                        <!-- 取货地址 -->
                        <div class="am-alert">
                            <p>
                                <span>{{:MyLang('order.detail_take_address_contact')}}：</span>
                                <span class="text-copy-submit">{{$data.address_data.name}}</span>
                                <span> / </span>
                                <span class="text-copy-submit">{{$data.address_data.tel}}</span>
                            </p>
                            <p>
                                <span>{{:MyLang('order.detail_take_address_value')}}：</span>
                                <span class="text-copy-submit">{{$data.address_data.province_name}}{{$data.address_data.city_name}}{{$data.address_data.county_name}}{{$data.address_data.address}}</span>
                                {{if isset($data['address_data']['lng']) and isset($data['address_data']['lat']) and $data['address_data']['lng'] neq 0 and $data['address_data']['lat'] neq 0}}
                                    <a href="javascript:;" class="submit-map-popup am-color-blue am-margin-left-xs" data-lng="{{$data.address_data.lng}}" data-lat="{{$data.address_data.lat}}" data-title="{{:MyLang('map_title')}}" data-full-max="1" data-full-max-size="xs">
                                        <i class="iconfont icon-map-position"></i>
                                        <span>{{:MyLang('map_title')}}</span>
                                    </a>
                                {{/if}}
                            </p>
                            {{if !empty($data['address_data']['extraction_contact_name']) or !empty($data['address_data']['extraction_contact_tel']) or !empty($data['address_data']['appoint_time'])}}
                                <hr data-am-widget="divider" class="am-divider am-divider-dashed am-margin-vertical-xs">
                                {{if !empty($data['address_data']['extraction_contact_name']) or !empty($data['address_data']['extraction_contact_tel'])}}
                                    <p>
                                        <span>{{:MyLang('customer_info_title')}}：</span>
                                        {{if !empty($data['address_data']['extraction_contact_name'])}}
                                            <span class="text-copy-submit am-margin-right-sm">{{$data.address_data.extraction_contact_name}}</span>
                                        {{/if}}
                                        {{if !empty($data['address_data']['extraction_contact_tel'])}}
                                            <span class="text-copy-submit am-margin-right-sm">{{$data.address_data.extraction_contact_tel}}</span>
                                        {{/if}}
                                    </p>
                                {{/if}}
                                {{if !empty($data['address_data']['appoint_time'])}}
                                    <p>
                                        <span>{{:MyLang('appoint_time_title')}}：</span>
                                        <span class="text-copy-submit am-color-red">{{$data.address_data.appoint_time}}</span>
                                    </p>
                                {{/if}}
                            {{/if}}
                        </div>
                        <!-- 取货码 -->
                        {{if !empty($data['extraction_data'])}}
                            {{if !empty($data['extraction_data']['images'])}}
                                <p class="am-margin-bottom-xs">
                                    <img class="am-img-thumbnail am-radius am-block common-annex-view-event" src="{{$data.extraction_data.images}}" width="105" height="105" data-is-download="1" />
                                </p>
                            {{/if}}
                            <p>
                                <span>{{:MyLang('order.form_item_take')}}：</span>
                                {{if empty($data['extraction_data']['code'])}}
                                    <span class="am-text-danger">{{:MyLang('no_data')}}</span>
                                {{else /}}
                                    <span class="am-badge am-badge-success am-radius am-margin-0 text-copy-submit">{{$data.extraction_data.code}}</span>
                                {{/if}}
                            </p>
                        {{/if}}
                    {{else /}}
                        <!-- 收货地址 -->
                        <p>
                            <span>{{:MyLang('order.detail_user_address_name')}}：</span>
                            <span class="text-copy-submit">{{$data.address_data.name}}</span>
                        </p>
                        <p>
                            <span>{{:MyLang('order.detail_user_address_tel')}}：</span>
                            <span class="text-copy-submit">{{$data.address_data.tel}}</span>
                        </p>
                        <p>
                            <span>{{:MyLang('order.detail_user_address_value')}}：</span>
                            <span class="text-copy-submit">{{$data.address_data.province_name}}{{$data.address_data.city_name}}{{$data.address_data.county_name}}{{$data.address_data.address}}</span>
                            {{if !empty($data['address_data']['lng']) and !empty($data['address_data']['lat']) and $data['address_data']['lng'] neq 0 and $data['address_data']['lat'] neq 0}}
                                <a href="javascript:;" class="submit-map-popup am-color-blue am-margin-left-xs" data-lng="{{$data.address_data.lng}}" data-lat="{{$data.address_data.lat}}" data-title="{{:MyLang('map_title')}}" data-full-max="1" data-full-max-size="xs">
                                    <i class="iconfont icon-map-position"></i>
                                    <span>{{:MyLang('map_title')}}</span>
                                </a>
                            {{/if}}
                        </p>
                        {{if !empty($data['address_data']['extraction_contact_name']) or !empty($data['address_data']['extraction_contact_tel']) or !empty($data['address_data']['appoint_time'])}}
                            {{if !empty($data['address_data']['extraction_contact_name']) or !empty($data['address_data']['extraction_contact_tel'])}}
                                <hr data-am-widget="divider" class="am-divider am-divider-dashed am-margin-vertical-xs">
                                <p>
                                    <span>{{:MyLang('customer_info_title')}}：</span>
                                    {{if !empty($data['address_data']['extraction_contact_name'])}}
                                        <span class="text-copy-submit am-margin-right-sm">{{$data.address_data.extraction_contact_name}}</span>
                                    {{/if}}
                                    {{if !empty($data['address_data']['extraction_contact_tel'])}}
                                        <span class="text-copy-submit am-margin-right-sm">{{$data.address_data.extraction_contact_tel}}</span>
                                    {{/if}}
                                </p>
                            {{/if}}
                            {{if !empty($data['address_data']['appoint_time'])}}
                                <p>
                                    <span>{{:MyLang('appoint_time_title')}}：</span>
                                    <span class="text-copy-submit am-color-red">{{$data.address_data.appoint_time}}</span>
                                </p>
                            {{/if}}
                        {{/if}}
                        {{if !empty($data['address_data']['idcard_name']) or !empty($data['address_data']['idcard_number']) or !empty($data['address_data']['idcard_front']) or !empty($data['address_data']['idcard_back'])}}
                            <div class="am-alert am-alert-secondary">
                                <p class="am-margin-bottom-xs"><strong>{{:MyLang('order.detail_user_address_idcard')}}</strong></p>
                                <hr data-am-widget="divider" style="" class="am-divider am-divider-dashed am-margin-vertical-0" />
                                <div class="am-margin-top-xs">
                                    <p>
                                        <span>{{:MyLang('order.detail_user_address_idcard_name')}}：</span>
                                        <span class="text-copy-submit">{{$data.address_data.idcard_name}}</span>
                                    </p>
                                    <p>
                                        <span>{{:MyLang('order.detail_user_address_idcard_number')}}：</span>
                                        <span class="text-copy-submit">{{$data.address_data.idcard_number}}</span>
                                    </p>
                                    {{if !empty($data['address_data']['idcard_front']) or !empty($data['address_data']['idcard_back'])}}
                                        <p class="am-nbfc"><span class="am-fl">{{:MyLang('order.detail_user_address_idcard_pic')}}：</span>{{if !empty($data['address_data']['idcard_front'])}}<img width="50" height="68" src="{{$data.address_data.idcard_front}}" class="am-img-thumbnail am-radius am-fl am-margin-right-xs common-annex-view-event" data-is-download="1" />{{/if}} {{if !empty($data['address_data']['idcard_back'])}}<img width="50" height="68" src="{{$data.address_data.idcard_back}}" class="am-img-thumbnail am-radius am-fl common-annex-view-event" data-is-download="1" />{{/if}}</p>
                                    {{/if}}
                                </div>
                            </div>
                        {{/if}}
                    {{/if}}
                {{else /}}
                    {{:ModuleInclude('public/not_data')}}
                {{/if}}
            </div>
        </div>

        <!-- 同城订单 - 服务信息 -->
        <div class="item" data-key="order-detail-service">
            <div class="am-padding-sm">
                {{if $data['order_model'] eq 1 and !empty($data['service_data'])}}
                    <div class="am-scrollable-horizontal">
                        <table class="am-table am-text-left am-margin-bottom-0 am-text-nowrap">
                            <thead>
                                <tr class="am-color-grey">
                                    <th>{{:MyLang('order.form_item_service_name')}}</th>
                                    <th>{{:MyLang('order.form_item_service_mobile')}}</th>
                                    <th>{{:MyLang('order.form_item_service_time')}}</th>
                                    <th>{{:MyLang('order.form_item_note')}}</th>
                                </tr>
                            </thead>
                            <tbody>
                                {{foreach $data.service_data as $v}}
                                    <tr>
                                        <td>
                                            <span class="text-copy-submit">{{$v.service_name}}</span>
                                        </td>
                                        <td>
                                            <span class="text-copy-submit">{{$v.service_mobile}}</span>
                                        </td>
                                        <td>
                                            <span class="text-copy-submit">
                                                {{if !empty($v['service_duration_minute_text'])}}
                                                    <span class="am-fr"><i class="am-icon-history"></i> {{$v.service_duration_minute_text}}</span>
                                                {{/if}}
                                                {{if !empty($v['service_start_time'])}}
                                                    <p>{{$v.service_start_time}}</p>
                                                {{/if}}
                                                {{if !empty($v['service_end_time'])}}
                                                    <p>{{$v.service_end_time}}</p>
                                                {{/if}}
                                            </span>
                                        </td>
                                        <td>{{$v.note}}</td>
                                    </tr>
                                {{/foreach}}
                            </tbody>
                        </table>
                    </div>
                {{else /}}
                    {{:ModuleInclude('public/not_data')}}
                {{/if}}
            </div>
        </div>

        <!-- 虚拟订单 - 密钥信息 -->
        <div class="item" data-key="order-detail-fictitious">
            <div class="am-padding-sm">
                {{if $data['order_model'] eq 3 and !empty($data['items'])}}
                    <ul class="am-list am-list-static am-margin-bottom-0 fictitious-container">
                        {{foreach $data.items as $goods}}
                            <li class="am-g am-list-item-desced">
                                <div class="am-u-sm-2">
                                    <img src="{{$goods.images}}" alt="{{$goods.title}}" class="am-img-thumbnail am-radius" />
                                </div>
                                <div class="am-u-sm-10">
                                    {{if !empty($goods['spec_text'])}}
                                        <p>
                                            <strong>{{$goods.spec_text}}</strong>
                                        </p>
                                    {{/if}}
                                    {{if empty($goods['fictitious_goods_value'])}}
                                        <span class="am-text-grey am-text-xs">{{:MyLang('no_config_data_tips')}}</span>
                                    {{else /}}
                                        {{$goods.fictitious_goods_value|raw}}
                                    {{/if}}
                                </div>
                            </li>
                        {{/foreach}}
                    </ul>
                {{else /}}
                    {{:ModuleInclude('public/not_data')}}
                {{/if}}
            </div>
        </div>
    </div>
{{/block}}