<div class="commonrightnavigation-right-nav">
    <!-- 用户中心 -->
    <a href="{{if empty($user)}}javascript:;{{else /}}{{:MyUrl('index/user/index')}}{{/if}}" class="user-content {{$login_event_class}}">
        <div class="base-nav user-center">
            <img src="{{if empty($user['avatar'])}}{{:config('shopxo.attachment_host')}}/static/index/default/images/default-user-avatar.jpg{{else /}}{{$user.avatar}}{{/if}}" class="user-avatar">
            <div class="mui-mbar-tab-tip am-animation-slide-left">
                用户中心
                <div class="mui-mbar-arr mui-mbar-tab-tip-arr">◆</div>
            </div>
        </div>
    </a>
    
    <!-- 我的足迹 -->
    <a href="{{if empty($user)}}javascript:;{{else /}}{{:MyUrl('index/usergoodsbrowse/index')}}{{/if}}" class="browse-content {{$login_event_class}}">
        <div class="base-nav browse">
            <i class="am-icon-lastfm"></i>
            <div class="mui-mbar-tab-tip am-animation-slide-left">
                我的足迹
                <div class="mui-mbar-arr mui-mbar-tab-tip-arr">◆</div>
            </div>
        </div>
    </a>

    <!-- 我的收藏 -->
    <a href="{{if empty($user)}}javascript:;{{else /}}{{:MyUrl('index/userfavor/goods')}}{{/if}}" class="favor-content {{$login_event_class}}">
        <div class="base-nav favor">
            <i class="am-icon-star-o"></i>
            <div class="mui-mbar-tab-tip am-animation-slide-left">
                我的收藏
                <div class="mui-mbar-arr mui-mbar-tab-tip-arr">◆</div>
            </div>
        </div>
    </a>

    <!-- 购物车 -->
    <div class="base-nav cart commonrightnavigation-cart" data-cart-ajax-url="{{:PluginsHomeUrl('commonrightnavigation', 'index', 'cart')}}" data-cart-delete-ajax-url="{{:MyUrl('index/cart/delete')}}">
        <a href="{{if empty($user)}}javascript:;{{else /}}{{:MyUrl('index/cart/index')}}{{/if}}" class="nav-a {{$login_event_class}} {{if isset($data['is_goods_page_show_cart']) and $data['is_goods_page_show_cart'] eq 1 and $module_controller_action eq 'indexgoodsindex'}} cart-show{{/if}}">
            <i class="am-icon-opencart"></i>
            <div class="cart-text">
                购物车
                <div class="cart-count common-cart-total {{if $cart_total gt 0}}am-badge am-badge-danger{{/if}}">{{if $cart_total > 9}}9+{{else /}}{{$cart_total}}{{/if}}</div>
            </div>
        </a>
        {{if !isset($module_controller_action) or $module_controller_action != 'indexcartindex'}}
            <div class="mui-mbar-popup am-animation-slide-left cart-content">
                <!-- 商品列表 -->
                <div class="cart-items" style="display: {{if !empty($cart_list)}}block{{else /}}none{{/if}};">
                    {{if !empty($cart_list)}}
                        <table class="am-table">
                            {{foreach $cart_list as $goods}}
                                <tr id="data-list-{{$goods.id}}" data-id="{{$goods.id}}" data-goods-id="{{$goods.goods_id}}" class="{{if $goods['is_shelves'] neq 1}}am-warning{{/if}} {{if $goods['is_delete_time'] neq 0}}am-danger{{/if}}">
                                    <td class="base">
                                        <div class="goods-detail">
                                            <a href="{{$goods.goods_url}}" target="_blank">
                                                <img src="{{$goods.images}}">
                                            </a>
                                            <div class="goods-base">
                                                <a href="{{$goods.goods_url}}" target="_blank" class="goods-title">{{$goods.title}}</a>
                                                {{if !empty($goods.spec)}}
                                                    <ul class="goods-attr">
                                                        {{foreach $goods.spec as $spec}}
                                                            <li>{{$spec.type}}：{{$spec.value}}</li>
                                                        {{/foreach}}
                                                    </ul>
                                                {{/if}}
                                            </div>
                                        </div>
                                    </td>
                                    <td class="total-price">
                                        <strong class="total-price-content">￥{{$goods.total_price}}</strong>
                                        <span class="cart-number">x{{$goods.stock}}</span>
                                    </td>
                                    <td class="operation">
                                        <a href="javascript:;" class="submit-delete" data-url="{{:MyUrl('index/cart/delete')}}" data-id="{{$goods.id}}" data-view="fun" data-value="PluginsCartViewDeleteBack" data-is-confirm="0">删除</a>
                                    </td>
                                </tr>
                            {{/foreach}}
                        </table>
                    {{/if}}
                </div>

                <!-- 导航 -->
                <div class="cart-nav" style="display: {{if !empty($cart_list)}}block{{else /}}none{{/if}};">
                    <form action="{{:MyUrl('index/buy/index')}}" method="post">
                        <span class="selected-tips">共 <strong>{{$base.cart_count}}</strong> 种商品</span>
                        <span class="total-price-tips">共计：</span>
                        <strong class="nav-total-price">￥{{$base.total_price}}</strong>
                        <input type="hidden" name="ids" value="{{$base.ids}}" />
                        <input type="hidden" name="buy_type" value="cart" />
                        <button type="submit" class="am-btn am-btn-primary separate-submit am-fr">结算</button>
                    </form>
                </div>

                <!-- 空购物车 -->
                <div class="mixed-tips" style="display: {{if empty($cart_list)}}block{{else /}}none{{/if}};">
                    <i class="am-icon-cart-plus am-fl icon"></i>
                    <div class="mixed-tips-content am-fl">
                        <h1>您的购物车还是空的，您可以</h1>
                        <ul>
                            <li>
                               <span>看看</span>
                                <a href="{{if empty($user)}}javascript:;{{else /}}{{:MyUrl('index/userfavor/goods')}}{{/if}}" class="{{if empty($user)}}login-event{{/if}}">我的收藏夹</a> 
                            </li>
                            <li>
                               <span>看看</span>
                                <a href="{{if empty($user)}}javascript:;{{else /}}{{:MyUrl('index/order/index')}}{{/if}}" class="{{if empty($user)}}login-event{{/if}}">我的订单</a> 
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
        {{/if}}
    </div>

    <!-- 二维码 -->
    {{if !empty($data['alipay_mini_qrcode_images']) or !empty($data['alipay_fuwu_qrcode_images']) or !empty($data['weixin_mini_qrcode_images']) or !empty($data['weixin_fuwu_qrcode_images'])}}
        <a href="javascript:;">
            <div class="base-nav qrcode-content">
                <i class="am-icon-qrcode"></i>
                <div class="mui-mbar-popup qrcode-items am-animation-slide-left">
                    <ul>
                        {{if !empty($data['alipay_mini_qrcode_images'])}}
                            <li>
                                <p>支付宝小程序</p>
                                <img src="{{$data.alipay_mini_qrcode_images}}" alt="支付宝小程序">
                            </li>
                        {{/if}}
                        {{if !empty($data['alipay_fuwu_qrcode_images'])}}
                            <li>
                                <p>支付宝生活号</p>
                                <img src="{{$data.alipay_fuwu_qrcode_images}}" alt="支付宝生活号">
                            </li>
                        {{/if}}
                        {{if !empty($data['weixin_mini_qrcode_images'])}}
                            <li>
                                <p>微信小程序</p>
                                <img src="{{$data.weixin_mini_qrcode_images}}" alt="微信小程序">
                            </li>
                        {{/if}}
                        {{if !empty($data['weixin_fuwu_qrcode_images'])}}
                            <li>
                                <p>微信公众号</p>
                                <img src="{{$data.weixin_fuwu_qrcode_images}}" alt="微信公众号">
                            </li>
                        {{/if}}
                    </ul>
                </div>
            </div>
        </a>
    {{/if}}

    <!-- 在线留言 -->
    <a href="javascript:;">
        <div class="base-nav answer-content">
            <i class="am-icon-edit"></i>
            <div class="mui-mbar-popup am-animation-slide-left">
                <form class="am-form form-validation-plugins-commonrightnavigation-answer view-save" action="{{:PluginsHomeUrl('commonrightnavigation', 'index', 'answer')}}" method="POST" request-type="ajax-reload">
                    <legend>
                        <span class="fs-16">在线留言</span>
                    </legend>
                    <div class="am-form-group">
                        <label>姓名</label>
                        <input type="text" name="name" placeholder="姓名" data-validation-message="请填写姓名" class="am-radius" required />
                    </div>
                    <div class="am-form-group">
                        <label>电话</label>
                        <input type="text" name="tel" placeholder="电话" data-validation-message="请填写电话" class="am-radius" required />
                    </div>
                    <div class="am-form-group">
                        <label>内容</label>
                        <textarea class="am-radius am-validate" name="content" rows="3" minlength="5" maxlength="300" placeholder="内容至少5个字" data-validation-message="内容格式 5~300 个字符之间" required></textarea>
                    </div>
                    <div class="am-form-group">
                        <button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm w100" data-am-loading="{loadingText:'处理中...'}">提交</button>
                    </div>
                </form>
            </div>
        </div>
    </a>

    <!-- 回顶部 -->
    <a href="javascript:;">
        <div class="base-nav go-top" data-am-smooth-scroll id="plugins-commonrightnavigation">
            <i class="am-icon-arrow-up"></i>
            <div class="mui-mbar-tab-tip am-animation-slide-left">
                返回顶部
                <div class="mui-mbar-arr mui-mbar-tab-tip-arr">◆</div>
            </div>
        </div>
    </a>
</div>

<script type="text/javascript">
    // 返回处理
    function PluginsCartViewDeleteBack(e)
    {
        if(e.code == 0)
        {
            $.AMUI.progress.done();
            Prompt(e.msg, 'success');
            $('#data-list-'+e.data_id).remove();
            HomeCartNumberTotalUpdate(parseInt(e.data));

            // 为空的时候处理
            if(e.data <= 0)
            {
                var $this = $('.commonrightnavigation-cart');
                $this.find('.mixed-tips').show();
                $this.find('.cart-nav').hide();
                $this.find('.cart-items').hide();
                $this.find('.cart-nav .selected-tips strong').text(0);
                $this.find('.cart-nav .nav-total-price').text('￥0.00');
                $this.find('.cart-nav input[name="ids"]').val('');
            }
        } else {
            $.AMUI.progress.done();
            Prompt(e.msg);
        }
    }
</script>