<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="https://www.thymeleaf.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="https://www.thymeleaf.org ">
<head>
    <title>采美365网-商品列表</title>
    <template th:replace="components/head-link"></template>
    <link th:href="@{/css/product/list.css(v=${version})}" rel="stylesheet" type="text/css">
</head>
<body>
<!-- 引用头部 -->
<template th:replace="components/header"></template>

<!-- 商品列表 -->
<div id="productList">
    <template v-if="isPC && listData && listData.length>0">
        <!-- 面包屑 -->
        <div v-if="searchFlag" class="crumbs">
            <span>搜索结果</span>
            <span>&gt;</span> <a href="javascript:void(0);" @click="toPagination(1)" v-text="params.keyword"></a>
        </div>
        <div v-else class="crumbs">
            <a href="/">首页</a>
            <template v-if="params.bid && params.bid>0">
                <template v-if="params.sid && params.sid>0">
                    <span>&gt;</span> <a :href="'/product/list.html?category='+params.bid+'-0-0'" v-text="bigType"></a>
                    <template v-if="params.tid && params.tid>0">
                        <span>&gt;</span> <a :href="'/product/list.html?category='+params.bid+'-'+params.sid+'-0'" v-text="smallType"></a>
                        <span>&gt;</span> <span v-text="tinyType"></span>
                    </template>
                    <template v-else>
                        <span>&gt;</span> <span v-text="smallType"></span>
                    </template>
                </template>
                <template v-else>
                    <span>&gt;</span> <span v-text="bigType"></span>
                </template>
            </template>
        </div>
        <!--分类-->
        <div v-if="(!searchFlag)" id="listClassify" class="classifyBox">
            <div class="clsTab">
                <template v-for="(big,i) in classify">
                    <a :class="{'on': params.bid==big.bigTypeID}" v-if="big.validFlag==1" href="javascript:void(0);" v-text="big.name"></a>
                </template>
            </div>
            <div class="clsCon">
                <div class="tabItem" v-for="big in classify" :bid="big.bigTypeID" style="display: none;">
                    <div class="line" :class="{'on': params.sid==small.smallTypeID}" v-for="small in big.smalltypeList" v-if="small.validFlag==1">
                        <div class="lft" :class="{'on': params.sid==small.smallTypeID}">
                            <a :href="'/product/list.html?category='+big.bigTypeID+'-'+small.smallTypeID+'-0'" v-text="small.name"></a>
                        </div>
                        <div class="rgt">
                            <template v-for="tiny in small.tinytypeList">
                                <a v-if="tiny.validFlag==1" :class="{'on': params.tid==tiny.tinyTypeID}" :href="'/product/list.html?category='+big.bigTypeID+'-'+small.smallTypeID+'-'+tiny.tinyTypeID" v-text="tiny.name"></a>
                            </template>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </template>
    <!--loading-->
    <div v-if="listLoading" class="loading">
        <img src="/img/base/loading.gif">
    </div>
    <!--数据为空-->
    <div v-else-if="!listLoading && (!listData || listData.length==0)" class="empty">
        <img src="/img/common/empty.png">
        <div class="msg">
            <p>暂未找到你搜索的商品，去<a href="/">商城</a>，逛逛吧~</p>
        </div>
    </div>
    <template v-else>
        <!--排序-->
        <div class="sortBox">
            <ul class="mfc">
                <li :class="{'on':params.sortField == ''}" @click="toSortList('',1)">综合</li>
                <template>
                    <li v-if="params.sortField == 'sales' && params.sortType == 1" class="down"
                        @click="toSortList('sales',0)"><span>销量</span></li>
                    <li v-else-if="params.sortField == 'sales' && params.sortType == 0" class="up"
                        @click="toSortList('sales',1)"><span>销量</span></li>
                    <li v-else @click="toSortList('sales',0)"><span>销量</span></li>
                </template>
                <template>
                    <li v-if="params.sortField == 'favorite' && params.sortType == 1" class="down"
                        @click="toSortList('favorite',0)"><span>人气</span></li>
                    <li v-else-if="params.sortField == 'favorite' && params.sortType == 0" class="up"
                        @click="toSortList('favorite',1)"><span>人气</span></li>
                    <li v-else @click="toSortList('favorite',0)"><span>人气</span></li>
                </template>
                <template>
                    <li v-if="params.sortField == 'price' && params.sortType == 1" class="down"
                        @click="toSortList('price',0)"><span>价格</span></li>
                    <li v-else-if="params.sortField == 'price' && params.sortType == 0" class="up"
                        @click="toSortList('price',1)"><span>价格</span></li>
                    <li v-else @click="toSortList('price',0)"><span>价格</span></li>
                </template>
            </ul>
        </div>
        <!--商品列表-->
        <ul class="productList clear mfw">
            <li class="productItem mfc" v-for="p in listData">
                <div class="item">
                    <a class="image" :href="'/product-'+p.id+'.html'" target="_blank">
                        <img :src="p.image" :alt="p.name">
                    </a>
                    <a class="name" :href="'/product-'+p.id+'.html'" target="_blank">
                        <span v-html="p.name"></span>
                    </a>
                    <div class="price mfhc">
                        <template v-if="GLOBAL_USER_ID && GLOBAL_USER_ID>0">
                            <!--用户身份 0、个人 1、协销 2、会员机构 3、供应商 4,普通机构-->
                            <template v-if="p.priceFlag==1">
                                <em>￥价格未公开</em>
                                <div class="btnBox">
                                    <a href="javascript:void(0)" class="btn cat">价格未公开，请联系 0755-22907771</a>
                                </div>
                            </template>
                            <template v-else>
                                <template v-if="p.priceFlag==0 || p.userIdentity==2 || (p.userIdentity==3 && p.supplierId==GLOBAL_SHOP_ID)">
                                    <em class="p" v-text="'￥'+parseFloat(p.price).toFixed(2)"></em>
                                    <span class="listTag" v-if="p.actStatus==1">{{p.promotions.name}}</span>
                                </template>
                                <template v-else-if="p.priceFlag==2 && p.userIdentity!=2">
                                    <em>￥会员可见</em>
                                    <div class="btnBox">
                                        <a href="/upgrade.html" class="btn">升级会员查看价格</a>
                                    </div>
                                </template>
                                <template v-else>
                                    <em>￥<i :class="'icon mIcon i'+p.priceGrade"></i></em>
                                </template>
                            </template>
                        </template>
                        <template v-else>
                            <em>￥<i :class="'icon mIcon i'+p.priceGrade"></i></em>
                            <div class="btnBox"><a href="javascript:void(0)" class="btn add toLogin">登录查看价格</a></div>
                        </template>
                    </div>
                </div>
            </li>
        </ul>
    </template>
    <!--分页-->
    <div v-if="(!isPC) && noMore" class="noMore">---- 没有更多了 ----</div>
    <div v-if="isPC && pageTotal>1" class="pageWrap clear">
        <a v-if="params.num>1" class="prev" @click="toPagination(params.num*1-1)" href="javascript:void(0);"></a>
        <template v-for="n in showPageBtn">
            <a v-if="n" :class="{'on':(n==params.num)}" @click="toPagination(n)" href="javascript:void(0);" v-text="n"></a>
            <span v-else>···</span>
        </template>
        <a v-if="params.num<pageTotal" class="next" @click="toPagination(params.num*1+1)" href="javascript:void(0);"></a>
        <span>共<b v-text="pageTotal>1?pageTotal:1"></b>页</span>
        <span>跳至</span>
        <input v-model="pageInput" @blur="checkNum()"/>
        <span>页</span>&nbsp;
        <a class="btn" href="javascript:void(0);" @click="toPagination(pageInput)">点击跳转</a>
    </div>
</div>
<!-- 引入底部 -->
<template th:replace="components/footer"></template>
<template th:replace="components/foot-link"></template>
<script charset="utf-8" type="text/javascript" th:src="@{/js/product/list.js(v=${version})}"></script>
</body>
</html>
