{{include file="public/header" /}}

<!-- nav start -->
{{include file="public/nav" /}}
<!-- nav end -->

<!-- header top nav -->
{{include file="public/header_top_nav" /}}

<!-- search -->
{{include file="public/nav_search" /}}

<!-- header nav -->
{{include file="public/header_nav" /}}

<!-- goods category -->
{{include file="public/goods_category" /}}

<!-- content -->
<div class="am-container user-main user-center">

    <!-- user menu start -->
    {{include file="public/user_menu" /}}
    <!-- user menu end -->

    <!-- content start -->
    <div class="user-content">
        <div class="user-content-body">
            <!-- 用户中心顶部钩子 -->
            {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true}}
                <div class="plugins-tag">
                    <span>plugins_view_user_center_top</span>
                </div>
            {{/if}}
            {{if !empty($plugins_view_user_center_top_data) and is_array($plugins_view_user_center_top_data)}}
                {{foreach $plugins_view_user_center_top_data as $hook}}
                    {{if is_string($hook) or is_int($hook)}}
                        {{$hook|raw}}
                    {{/if}}
                {{/foreach}}
            {{/if}}

            <!-- 基础信息 -->
            <div class="user-base">
                <div class="user-base-left">
                    <div class="user-avatar">
                        <img src="{{$user.avatar}}" class="avatar" />
                        <div class="user-name">
                            {{if !empty($user['icon'])}}
                                <img src="{{$user.icon}}" class="common-user-icon" {{if !empty($user['icon_title'])}}title="{{$user.icon_title}}"{{/if}} />
                            {{/if}}
                            <span>{{$user.user_name_view}}</span>
                        </div>
                    </div>
                    <div class="items">
                        <a href="javascript:;" class="am-icon-camera-retro" data-am-modal="{target:'#user-avatar-popup'}"> 修改头像</a>
                        <a href="{{:MyUrl('index/personal/index')}}" class="am-icon-edit"> 修改资料</a>
                        <a href="{{:MyUrl('index/useraddress/index')}}" class="am-icon-street-view"> 我的地址</a>
                    </div>
                </div>
                <div class="user-base-right">
                    <a href="{{:MyUrl('index/message/index')}}" class="am-icon-bell-o message"> 消息 {{if $common_message_total gt 0}}{{$common_message_total}}{{/if}}</a>
                </div>
                {{if !empty($mini_navigation)}}
                    <ul class="user-base-icon">
                        {{foreach $mini_navigation as $nav}}
                            <li>
                                <a href="{{$nav.url}}">
                                    <p>{{$nav.value}}</p>
                                    <p>{{$nav.name}}</p>
                                </a>
                            </li>
                        {{/foreach}}
                    </ul>
                {{/if}}
            </div>

            <!-- 基础信息底部钩子 -->
            {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true}}
                <div class="plugins-tag">
                    <span>plugins_view_user_base_bottom</span>
                </div>
            {{/if}}
            {{if !empty($plugins_view_user_base_bottom_data) and is_array($plugins_view_user_base_bottom_data)}}
                {{foreach $plugins_view_user_base_bottom_data as $hook}}
                    {{if is_string($hook) or is_int($hook)}}
                        {{$hook|raw}}
                    {{/if}}
                {{/foreach}}
            {{/if}}

            <!-- 订单信息 -->
            <div class="order-nav">
                <a href="{{:MyUrl('index/order/index')}}">
                    <span class="nav-name">
                        <i class="order-icon"></i>
                        我的订单
                    </span>
                    <span class="am-fr icon-tips">
                        查看全部订单
                        <i class="am-icon-angle-right"></i>
                    </span>
                </a>
            </div>
            {{if !empty($user_order_status)}}
                <ul class="order-base">
                    {{foreach $user_order_status as $v}}
                        {{if in_array($v['status'], [1,2,3])}}
                            <li>
                                <a href="{{:MyUrl('index/order/index', [$form_search_order_status_form_key=>$v['status']])}}">
                                    <i class="icon-{{$v.status}}"></i>
                                    <p>{{$v.name}}</p>
                                    {{if !empty($v.count)}}
                                        <span class="am-badge am-badge-danger am-round">{{$v.count}}</span>
                                    {{/if}}
                                </a>
                            </li>
                        {{elseif in_array($v['status'], [100]) /}}
                            <li>
                                <a href="{{:MyUrl('index/order/index', [$form_search_order_status_form_key=>4, $form_search_order_user_is_comments_form_key=>0])}}">
                                    <i class="icon-{{$v.status}}"></i>
                                    <p>{{$v.name}}</p>
                                    {{if !empty($v.count)}}
                                        <span class="am-badge am-badge-danger am-round">{{$v.count}}</span>
                                    {{/if}}
                                </a>
                            </li>
                        {{elseif in_array($v['status'], [101]) /}}
                            <li>
                                <a href="{{:MyUrl('index/orderaftersale/index')}}">
                                    <i class="icon-{{$v.status}}"></i>
                                    <p>{{$v.name}}</p>
                                    {{if !empty($v.count)}}
                                        <span class="am-badge am-badge-danger am-round">{{$v.count}}</span>
                                    {{/if}}
                                </a>
                            </li>
                        {{/if}}
                    {{/foreach}}
                </ul>
            {{/if}}

            <!-- 聚合内容顶部钩子 -->
            {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true}}
                <div class="plugins-tag">
                    <span>plugins_view_user_various_top</span>
                </div>
            {{/if}}
            {{if !empty($plugins_view_user_various_top_data) and is_array($plugins_view_user_various_top_data)}}
                {{foreach $plugins_view_user_various_top_data as $hook}}
                    {{if is_string($hook) or is_int($hook)}}
                        {{$hook|raw}}
                    {{/if}}
                {{/foreach}}
            {{/if}}

            <!-- 聚合内容 -->
            <div class="am-g various">
                <!-- 聚合内容里面顶部钩子 -->
                {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true}}
                    <div class="plugins-tag">
                        <span>plugins_view_user_various_inside_top</span>
                    </div>
                {{/if}}
                {{if !empty($plugins_view_user_various_inside_top_data) and is_array($plugins_view_user_various_inside_top_data)}}
                    {{foreach $plugins_view_user_various_inside_top_data as $hook}}
                        {{if is_string($hook) or is_int($hook)}}
                            {{$hook|raw}}
                        {{/if}}
                    {{/foreach}}
                {{/if}}

                <!-- 进行中的订单 -->
                <div class="am-u-md-8">
                    <div class="am-panel am-panel-default">
                        <div class="am-panel-hd">
                            <i></i>交易提醒
                            {{if !empty($order_list)}}
                                <a class="am-fr more-tips" href="{{:MyUrl('index/order/index')}}" target="_blank">
                                    更多 <span class="am-icon-angle-double-right"></span>
                                </a>
                            {{/if}}
                        </div>
                        <div class="am-panel-bd order-list">
                            {{if !empty($order_list)}}
                                {{foreach $order_list as $order}}
                                    {{foreach $order.items as $key=>$goods}}
                                        {{if $key eq 0}}
                                            <div class="goods-detail">
                                                <a href="{{:MyUrl('index/order/detail', ['id'=>$order['id']])}}" target="_blank">
                                                    <img src="{{$goods.images}}" alt="{{$goods.title}}" class="am-img-thumbnail am-radius" />
                                                </a>
                                                <div class="goods-base">
                                                    <a href="{{:MyUrl('index/order/detail', ['id'=>$order['id']])}}" target="_blank" class="goods-title am-text-truncate">{{$goods.title}}</a>
                                                    <ul>
                                                        <li>
                                                            <span>{{$order.add_time_time}}</span>
                                                            <span class="line-price">{{$order.currency_data.currency_symbol}}{{$order.price}}</span>
                                                        </li>
                                                        <li>
                                                            <span>{{$order.status_name}}</span>
                                                            {{if $order['items_count'] gt 1}}
                                                                <span class="items-count">
                                                                    <em>等</em>
                                                                    <em>{{$order.items_count}}</em>
                                                                    <em>种商品</em>
                                                                </span>
                                                            {{/if}}
                                                        </li>
                                                    </ul>
                                                </div>
                                                {{if in_array($order['status'], [1])}}
                                                    <a class="am-btn am-btn-primary am-btn-xs am-radius am-fr order-submit" href="{{:MyUrl('index/order/detail', ['id'=>$order['id'], 'ids'=>$order['id'], 'is_pay_auto'=>1])}}" target="_blank">支付</a>
                                                {{/if}}
                                                {{if in_array($order['status'], [3])}}
                                                    <button type="button" class="am-btn am-btn-success am-btn-xs am-radius am-fr order-submit submit-ajax submit-confirm" data-url="{{:MyUrl('index/order/Collect')}}" data-id="{{$order.id}}" data-view="reload" data-msg="请仔细确认已收到货物、确认继续吗？">收货</button>
                                                {{/if}}
                                                {{if in_array($order['status'], [4]) and $order['user_is_comments'] eq 0}}
                                                    <a href="{{:MyUrl('index/order/Comments', ['id'=>$order['id']])}}" target="_blank" class="am-btn am-btn-warning am-btn-xs am-radius am-fr order-submit">评价</a>
                                                {{/if}}
                                            </div>
                                        {{/if}}
                                    {{/foreach}}
                                {{/foreach}}
                            {{/if}}
                            {{if empty($order_list)}}
                                <div class="table-no">
                                    <i class="am-icon-cube am-icon-lg block"></i>
                                    <p class="tips-name">查看全部订单</p>
                                    <p class="tips-msg">交易提醒可帮助您了解订单状态和物流情况</p>
                                </div>
                            {{/if}}
                        </div>
                    </div>
                </div>

                <!-- 购物车 -->
                <div class="am-u-md-4">
                    <div class="am-panel am-panel-default">
                        <div class="am-panel-hd">
                            <i></i>购物车
                            {{if !empty($cart_list)}}
                                <a class="am-fr more-tips" href="{{:MyUrl('index/cart/index')}}" target="_blank">
                                    更多 <span class="am-icon-angle-double-right"></span>
                                </a>
                            {{/if}}
                        </div>
                        <div class="am-panel-bd cart-list">
                            {{if !empty($cart_list)}}
                                {{foreach $cart_list as $key=>$goods}}
                                    {{if $key lt 3}}
                                        <div class="goods-detail">
                                            <a href="{{:MyUrl('index/goods/index', ['id'=>$goods['goods_id']])}}" target="_blank">
                                                <img src="{{$goods.images}}" alt="{{$goods.title}}" class="am-img-thumbnail am-radius" />
                                            </a>
                                            <div class="goods-base">
                                                <a href="{{:MyUrl('index/goods/index', ['id'=>$goods['goods_id']])}}" target="_blank" class="goods-title am-text-truncate">{{$goods.title}}</a>
                                                <ul>
                                                    <li>
                                                        <span class="line-price">{{$currency_symbol}}{{$goods.price}}</span>
                                                        <span>x{{$goods.stock}}</span>
                                                    </li>
                                                </ul>
                                            </div>
                                        </div>
                                    {{/if}}
                                {{/foreach}}
                            {{/if}}
                            {{if empty($cart_list)}}
                                <div class="table-no">
                                    <i class="am-icon-opencart am-icon-lg block"></i>
                                    <p class="tips-name">您的购物车还是空的</p>
                                    <p class="tips-msg">将想买的商品放进购物车，一起结算更轻松</p>
                                </div>
                            {{/if}}
                        </div>
                    </div>
                </div>

                <!-- 收藏商品 -->
                <div class="am-u-md-8">
                    <div class="am-panel am-panel-default">
                        <div class="am-panel-hd">
                            <i></i>商品收藏
                            {{if !empty($goods_favor_list)}}
                                <a class="am-fr more-tips" href="{{:MyUrl('index/usergoodsfavor/index')}}" target="_blank">
                                    更多 <span class="am-icon-angle-double-right"></span>
                                </a>
                            {{/if}}
                        </div>
                        <div class="am-panel-bd goods-favor-list">
                            {{if !empty($goods_favor_list)}}
                                <ul data-am-widget="gallery" class="am-gallery am-avg-sm-2 am-avg-md-4 am-gallery-overlay" data-am-gallery="{}">
                                    {{foreach $goods_favor_list as $goods}}
                                        <li>
                                            <div class="am-gallery-item">
                                                <a href="{{:MyUrl('index/goods/index', ['id'=>$goods['goods_id']])}}" target="_blank">
                                                    <img src="{{$goods.images}}" alt="{{$goods.title}}" class="am-img-thumbnail am-radius" />
                                                    <h3 class="am-gallery-title">{{$goods.title}}</h3>
                                                    <div class="am-gallery-desc line-price">{{$currency_symbol}}{{$goods.min_price}}</div>
                                                </a>
                                            </div>
                                        </li>
                                    {{/foreach}}
                                </ul>
                            {{/if}}
                            {{if empty($goods_favor_list)}}
                                <div class="table-no">
                                    <i class="am-icon-heart-o am-icon-lg block"></i>
                                    <p class="tips-name">您还没有收藏商品</p>
                                    <p class="tips-msg">收藏的商品将显示最新的促销活动和降价情况</p>
                                </div>
                            {{/if}}
                        </div>
                    </div>
                </div>

                <!-- 浏览足迹 -->
                <div class="am-u-md-4">
                    <div class="am-panel am-panel-default">
                        <div class="am-panel-hd">
                            <i></i>我的足迹
                            {{if !empty($goods_browse_list)}}
                                <a class="am-fr more-tips" href="{{:MyUrl('index/usergoodsbrowse/index')}}" target="_blank">
                                    更多 <span class="am-icon-angle-double-right"></span>
                                </a>
                            {{/if}}
                        </div>
                        <div class="am-panel-bd goods-browse-list">
                            {{if !empty($goods_browse_list)}}
                                <ul data-am-widget="gallery" class="am-gallery am-avg-sm-3 am-avg-md-3 am-avg-lg-3 am-gallery-default data-am-gallery="{}">
                                    {{foreach $goods_browse_list as $goods}}
                                        <li>
                                            <div class="am-gallery-item">
                                                <a href="{{:MyUrl('index/goods/index', ['id'=>$goods['goods_id']])}}" target="_blank">
                                                    <img src="{{$goods.images}}" alt="{{$goods.title}}" class="am-img-thumbnail am-circle" />
                                                    <h3 class="am-gallery-title">{{$goods.title}}</h3>
                                                </a>
                                                <div class="am-gallery-desc line-price">{{$currency_symbol}}{{$goods.min_price}}</div>
                                            </div>
                                        </li>
                                    {{/foreach}}
                                </ul>
                            {{/if}}
                            {{if empty($goods_browse_list)}}
                                <div class="table-no">
                                    <i class="am-icon-lastfm am-icon-lg block"></i>
                                    <p class="tips-name">您的商品浏览记录为空</p>
                                    <p class="tips-msg">赶紧去商城看看促销活动吧</p>
                                </div>
                            {{/if}}
                        </div>
                    </div>
                </div>

                <!-- 聚合内容里面底部钩子 -->
                {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true}}
                    <div class="plugins-tag">
                        <span>plugins_view_user_various_inside_bottom</span>
                    </div>
                {{/if}}
                {{if !empty($plugins_view_user_various_inside_bottom_data) and is_array($plugins_view_user_various_inside_bottom_data)}}
                    {{foreach $plugins_view_user_various_inside_bottom_data as $hook}}
                        {{if is_string($hook) or is_int($hook)}}
                            {{$hook|raw}}
                        {{/if}}
                    {{/foreach}}
                {{/if}}
            </div>

            <!-- 聚合内容底部钩子 -->
            {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true}}
                <div class="plugins-tag">
                    <span>plugins_view_user_various_bottom</span>
                </div>
            {{/if}}
            {{if !empty($plugins_view_user_various_bottom_data) and is_array($plugins_view_user_various_bottom_data)}}
                {{foreach $plugins_view_user_various_bottom_data as $hook}}
                    {{if is_string($hook) or is_int($hook)}}
                        {{$hook|raw}}
                    {{/if}}
                {{/foreach}}
            {{/if}}
        </div>
    </div>
    <!-- content end -->
</div>

{{include file="public/footer" /}}