1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513 |
- <template>
- <view class="content">
- <view class="fixed_top_status_bar"></view>
- <view class="top_part">
- <!-- 搜索头部分 start -->
- <view class='sea_input_part'>
- <!-- #ifndef MP-->
- <text class="back_icon iconfont iconziyuan2" @click="navBack"></text>
- <!-- #endif -->
- <view class="search_center" @click="search">
- <image class="search_icon" :src="imgUrl+'search.png'"></image>
- <input disabled class='sea_input' type='text' :value="searchParams.keyword" :placeholder="$L('请输入关键词')"></input>
- <image v-if='searchParams.keyword' class='clear_content' v-show="searchParams.keyword" :src="imgUrl+'input_clear.png'"
- @click.stop="clearInput" />
- </view>
- </view>
- <!-- 搜索头部分 end -->
- <!-- 头部搜索nav start -->
- <view class="navbar">
- <view class="nav-item complex" :class="{current: filterIndex === 0||filterIndex === 3||filterIndex === 4||filterIndex === 5}"
- @click="showSelect">
- <text>{{$L('综合')}}</text>
- <text class="iconfont iconziyuan14"></text>
- </view>
- <view class="nav-item" :class="{current: filterIndex === 1}" @click="tabClick(1)">
- {{$L('销量')}}
- </view>
- <view class="nav-item" :class="{current: filterIndex === 2}" @click="tabClick(2)">
- {{$L('店铺')}}
- </view>
- <view class="nav-item default" v-if="showStoreList">
- <text>{{$L('筛选')}}</text>
- <text class="filter_icon iconfont iconshaixuan"></text>
- </view>
- <view v-else class="nav-item" @click="toggleCateMask('show')">
- <text>{{$L('筛选')}}</text>
- <text class="filter_icon iconfont iconshaixuan"></text>
- </view>
- <text v-if="showStoreList" class="cate_item iconfont iconliebiao1 default"></text>
- <text v-else :class="{cate_item:loadingState, iconfont:loadingState, iconfenlei1:gridFlag,iconliebiao1:!gridFlag,grid_icon:gridFlag}"
- @click="tabShowStyle"></text>
- </view>
- </view>
- <!-- 头部搜索nav end -->
- <view v-if="(loadingState!='first_loading'&&!showStoreList&&goodsList.length == 0)||(loadingState!='first_loading'&&showStoreList&&store_list.length==0)" class="empty_part flex_column_start_center">
- <image :src="imgUrl+'empty_goods.png'" />
- <text>{{$L('暂无数据')}}</text>
- </view>
- <view class="pricearea" :hidden="pricearea" @tap.stop="showSelect" id="pricearea-wrap" catchtouchmove="touchmove">
- <view class="pri-content">
- <view :class="'pri-item ' + (seleindex==0?'current':'')" data-order data-key data-index="0" @tap.stop="changeSort(0)">
- <text>{{$L('综合排序')}}</text>
- <image :src="imgUrl+'good_search/order_sel.png'" v-if="seleindex==0"></image>
- </view>
- <view :class="'pri-item ' + (seleindex==5?'current':'')" data-index="5" @tap.stop="changeSort(5)">
- <text>{{$L('人气排序从高到低')}}</text>
- <image :src="imgUrl+'good_search/order_sel.png'" v-if="seleindex==5"></image>
- </view>
- <view :class="'pri-item ' + (seleindex==4?'current':'')" data-index="4" @tap.stop="changeSort(4)">
- <text>{{$L('价格排序从高到低')}}</text>
- <image :src="imgUrl+'good_search/order_sel.png'" v-if="seleindex==4"></image>
- </view>
- <view :class="'pri-item ' + (seleindex==3?'current':'')" data-index="3" @tap.stop="changeSort(3)">
- <text>{{$L('价格排序从低到高')}}</text>
- <image :src="imgUrl+'good_search/order_sel.png'" v-if="seleindex==3"></image>
- </view>
- </view>
- </view>
- <scroll-view v-if="goodsList.length&&!showStoreList" class="goods_part" scroll-y @scrolltolower='getMoreData'>
- <view v-if='gridFlag' class="goods_list_another flex_row_start_start">
- <goodsListItemV v-for="(item,index) in goodsList" :goods_info="item" :key='index' />
- </view>
- <view v-if='!gridFlag' class="goods_list flex_row_start_start">
- <goodsItemH v-for="(item,index) in goodsList" :goods_info="item" :key='index' />
- </view>
- <loadingState v-if="loadingState == 'first_loading'||goodsList.length > 0" :state='loadingState' />
- </scroll-view>
- <scroll-view v-if="showStoreList&&store_list.length>0" class="shop_lists" scroll-y @scrolltolower='getMoreStoreData'>
- <view class="" v-if="showStoreList&&store_list.length>0">
- <storeItem v-for="(item, index) in store_list" :store_info='item' :key="index"></storeItem>
- <loadingState v-if="loadingState == 'first_loading'||store_list.length > 0" :state='loadingState' />
- </view>
- </scroll-view>
- <view class="cate-mask" :class="cateMaskState===0 ? 'none' : cateMaskState===1 ? 'show' : ''" @click="toggleCateMask">
- <view class="cate-content" @click.stop.prevent="stopPrevent" @touchmove.stop.prevent="stopPrevent">
- <view class="filter_title">
- {{$L('筛选')}}
- </view>
- <scroll-view scroll-y class="cate-list flex_column_start_start">
- <view class="wrap">
- <view class="part price_part">
- <view class="title flex_row_between_center">
- <text class="left">{{$L('价格区间')}}</text>
- </view>
- <view class="detail price_area flex_row_start_center">
- <input type='number' :value="searchParams.lowPrice" class="amount low" :placeholder="$L('最低价')" placeholder-class="price_input_placeholder"
- data-key='lowPrice' @input="inputPrice" />
- <input type='number' :value="searchParams.highPrice" class="amount hight" :placeholder="$L('最高价')" placeholder-class="price_input_placeholder"
- data-key='highPrice' @input="inputPrice" />
- </view>
- </view>
- <!-- 分类 -->
- <view v-if='cateList.length>0' class="part" style="margin-top: 20rpx;">
- <view class="title flex_row_between_center">
- <text class="left">{{$L('分类')}}</text>
- <text v-if="cateList.length>cateLimit||cateLimit==999999" :class="{iconfont:true, iconziyuan11:true,up:cateFlag=='up',down:cateFlag=='down',}"
- @click="viewMoreCate"></text>
- <view v-if="cateList.length>cateLimit||cateLimit==999999" class="attributr_sel_con">
- <text class="attributr_sel_text">{{selectCateText}}</text>
- </view>
- </view>
- <view class="detail flex_row_start_center">
- <template v-for="(itemCat,index) in cateList">
- <view v-if="index<cateLimit" :class="{item:true, sel:searchParams.cateId == itemCat.categoryId}" @click="selCat('cateId',itemCat.categoryId,itemCat.categoryName)">
- <text class="brand_name">{{itemCat.categoryName}}</text></view>
- </template>
- </view>
- </view>
- <!-- 品牌 selectBrandText-->
- <view class="part" style="margin-top: 20rpx;" v-if="brandList.length>0">
- <view class="title flex_row_between_center">
- <text class="left">{{$L('品牌')}}</text>
- <text v-if="brandList.length>brandLimit||brandLimit==999999" :class="{iconfont:true, iconziyuan11:true,up:brandFlag=='up',down:brandFlag=='down',}"
- @click="viewMoreBrand"></text>
- <view v-if="brandList.length>brandLimit||brandLimit==999999" class="attributr_sel_con">
- <text class="attributr_sel_text" v-for="(item,index) in selectBrandText">{{item}}<text v-if="(index+1)!=selectBrandText.length">,</text></text>
- </view>
- </view>
- <view class="detail flex_row_start_center">
- <template v-for="(item,index) in brandList">
- <view v-if='index<brandLimit' :class="{item:true, sel:searchParams.brandId.indexOf(item.brandId)>-1}" @click="selBrand(item.brandId,item.brandName)"><text
- class="brand_name">{{item.brandName}}</text></view>
- </template>
- </view>
- </view>
- <!-- 商品属性 -->
- <view class="part" v-for="(attribute,index) in attributeList" style="margin-top: 20rpx;" v-if="attributeList.length>0">
- <view class="title flex_row_between_center">
- <text class="left">{{attribute.attributeName}}</text>
- <!-- <text :class="{iconfont:true, iconziyuan11:true,up:arrowFlag=='up',down:arrowFlag=='down',}" -->
- <text v-if="attribute.attributeValueList.length>attribute.showLimit||attribute.showLimit==999999" :class="{iconfont:true, iconziyuan11:true,up:attribute.showFlag=='up',down:attribute.showFlag=='down',}"
- @click="viewMoreAttridute(attribute)"></text>
- <view v-if="attribute.attributeValueList.length>attribute.showLimit||attribute.showLimit==999999" class="attributr_sel_con">
- <text class="attributr_sel_text" v-for="(item,index) in attribute.select_text_list">{{item}}<text v-if="(index+1)!=attribute.select_text_list.length">,</text></text>
- </view>
- </view>
- <view class="detail flex_row_start_center">
- <template v-for="(item,index) in attribute.attributeValueList">
- <view v-if="index<attribute.showLimit" :class="{item:true, sel:attribute.select_text_list.indexOf(item.attributeValue)>-1}"
- @click="selAttribude(attribute,item.attributeValue)"><text class="brand_name">{{item.attributeValue}}</text></view>
- </template>
- <!-- <view v-if='brandLimit==17' :class="{item:true}" @click="viewBrand"><text class="brand_name">查看全部品牌</text></view> -->
- </view>
- </view>
- </view>
- </scroll-view>
- <view class="bottom flex_row_end_center">
- <text class="btn reset flex_row_center_center" @click="resetSel">{{$L('重置')}}</text>
- <text class="btn confirm flex_row_center_center" @click="confirmSel">{{$L('确认')}}</text>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script module="filters" lang="wxs" src="@/utils/filter.wxs"></script>
- <script>
- import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
- import goodsListItemV from "@/components/goods_list_item_v.vue";
- import storeItem from "@/components/store_item.vue";
- import goodsItemH from "@/components/goods_item_h.vue";
- import loadingState from "@/components/loading-state.vue";
- export default {
- components: {
- uniLoadMore,
- goodsListItemV,
- goodsItemH,
- loadingState,
- storeItem
- },
- data() {
- return {
- midPrice: '', //筛选切换用
- imgUrl: getApp().globalData.imgUrl,
- source: '', //页面来源(从哪个页面进入的),如果是搜素页,点击该页顶部搜素的时候会返回上级页面,否则会跳转
- searchParams: {
- brandId: [], //选中的品牌,多选
- categoryIds: '', //选中的分类
- lowPrice: '', //筛选的最低价
- highPrice: '', //筛选的最高价
- attribudeId: '',
- keyword: '',
- storeId:'',
- goodsIds:'',
- cateId:''
- }, //搜索的参数
- stopPullDownRefresh: false, //是否下拉刷新中
- cateMaskState: 0, //分类面板展开状态
- headerPosition: "fixed",
- filterIndex: 0,
- priceOrder: 0, //1 价格从低到高 2价格从高到低
- cateList: [], //分类列表
- brandList: [], //品牌列表
- brandLimit: 6, //筛选条件展示
- cateLimit: 6, //筛选条件展示
- arrowFlag: '',
- goodsList: [],
- loadingState: 'first_loading',
- pageSize: 10,
- current: 1,
- loading: false, //是否加载数据
- hasMore: true, //是否还有数据
- gridFlag: false, //是否网格形式展示,默认item形式展示
- options: {},
- pricearea: true,
- seleindex: 0,
- store_list: [],
- store_info: {
- pageSize: 10,
- current: 1,
- hasMore: false
- },
- showStoreList: false,
- attributeList: [], //商品属性列表
- cateFlag: 'up',
- brandFlag: 'up',
- selectCateText: '', //已选分类名称
- selectBrandText: [], //已选品牌列表
- keyword:''
- };
- },
- onLoad(options) {
- this.options = options;
- // this.getBrandList();
- // if (options.source) {
- // this.source = options.source;
- // }
- this.keyword = decodeURIComponent(options.keyword)
- if (options.keyword) { //关键词
- this.searchParams.keyword = decodeURIComponent(options.keyword)
- }
- if (options.goodsIds) { //关键词
- this.searchParams.goodsIds = decodeURIComponent(options.goodsIds)
- }
- if (options.storeId) { //店铺id
- this.searchParams.storeId = decodeURIComponent(options.storeId)
- }
- if (options.categoryId) { //接受分类
- this.searchParams.categoryIds = options.categoryId;
- if(!options.source){//如果是优惠券进来的分类,不调取筛选条件中的品牌等
- this.getcateList(options.categoryId);
- }
- }
- if(options.brandId){ //品牌id
- this.searchParams.brandIds = decodeURIComponent(options.brandId)
- }
- if(options.storeInnerLabelId){ //店铺内分类id
- this.searchParams.storeInnerLabelId = decodeURIComponent(options.storeInnerLabelId)
- }
- this.getGoodsList();
- },
-
- onShow() {
- },
- onPageScroll(e) {
- //兼容iOS端下拉时顶部漂移
- if (e.scrollTop >= 0) {
- this.headerPosition = "fixed";
- } else {
- this.headerPosition = "absolute";
- }
- },
- //下拉刷新
- onPullDownRefresh() {
- this.current = 1;
- this.stopPullDownRefresh = true; //下拉刷新状态
- this.getGoodsList();
- },
- methods: {
- changeSort(index) {
- this.seleindex = index
- this.filterIndex = index
- this.pricearea = !this.pricearea
- this.current=1
- this.getGoodsList()
- },
- getGoodsList() {
- uni.showLoading({
- title:'加载中',
- icon:'none'
- })
- //处理属性选择
- let attributeInfo = []
- this.attributeList.map(item => {
- if (item.select_list.length > 0) {
- item.select_list.map(item => {
- attributeInfo.push(item)
- })
- }
- })
- let param = {};
- param.url = 'v3/goods/front/goods/goodsList';
- param.data = {};
- param.data.pageSize = this.pageSize;
- param.data.current = this.current;
- param.data.sort = this.filterIndex;
- if (this.searchParams.categoryIds) {
- param.data.categoryIds = this.searchParams.categoryIds
- }
- if(this.searchParams.cateId){
- param.data.categoryIds = this.searchParams.cateId
- }
- if (attributeInfo.length > 0) {
- param.data.attributeInfo = attributeInfo.join(',')
- }
- if (this.searchParams.highPrice) {
- param.data.highPrice = this.searchParams.highPrice
- }
- if (this.searchParams.lowPrice) {
- param.data.lowPrice = this.searchParams.lowPrice;
- }
- if(param.data.lowPrice > param.data.highPrice) {
- this.midPrice = param.data.lowPrice
- param.data.lowPrice = param.data.highPrice
- param.data.highPrice = this.midPrice
- this.searchParams.lowPrice = param.data.lowPrice;
- this.searchParams.highPrice = param.data.highPrice;
- }
- if (this.searchParams.keyword) {
- param.data.keyword = this.searchParams.keyword
- }
- // if (this.searchParams.brandId.join(',')) {
- // param.data.brandIds = this.searchParams.brandId.join(',')
- // }
- if (this.searchParams.storeId) {
- param.data.storeId = this.searchParams.storeId
- }
- if (this.searchParams.goodsIds) {
- param.data.goodsIds = this.searchParams.goodsIds
- }
- if(this.searchParams.brandIds){
- param.data.brandIds = this.searchParams.brandIds
- }
- if(this.searchParams.storeInnerLabelId){
- param.data.storeInnerLabelId = this.searchParams.storeInnerLabelId
- }
- this.loadingState = this.loadingState == 'first_loading' ? this.loadingState : 'loading';
- this.$request(param).then(res => {
- if (res.state == 200) {
- if (this.current == 1) {
- this.goodsList = res.data.list;
- } else {
- this.goodsList = this.goodsList.concat(res.data.list);
- }
- this.hasMore = this.$checkPaginationHasMore(res.data.pagination); //是否还有数据
- if (this.hasMore) {
- this.current++;
- this.loadingState = 'allow_loading_more';
- } else {
- this.loadingState = 'no_more_data';
- }
- uni.hideLoading()
- } else {
- uni.hideLoading()
- //错误提示
- }
- if (this.stopPullDownRefresh) {
- this.stopPullDownRefresh = false;
- uni.stopPullDownRefresh();
- }
- })
- },
- //加载更多事件
- getMoreData() {
- if (this.hasMore) {
- this.getGoodsList();
- }
- },
- getMoreStoreData(){
- if (this.store_info.hasMore) {
- this.getShopList();
- }
- },
- //切换页面展示风格
- tabShowStyle() {
- this.gridFlag = !this.gridFlag;
- },
- //加载商品 ,带下拉刷新和上滑加载
- async loadData(type = 'add', loading) {
- //没有更多直接返回
- if (type === 'add') {
- if (this.loadingType === 'nomore') {
- return;
- }
- this.loadingType = 'loading';
- } else {
- this.loadingType = 'more'
- }
- let goodsList = await this.$api.json('goodsList');
- if (type === 'refresh') {
- this.goodsList = [];
- }
- //筛选,测试数据直接前端筛选了
- if (this.filterIndex === 1) {
- goodsList.sort((a, b) => b.sales - a.sales)
- }
- if (this.filterIndex === 2) {
- goodsList.sort((a, b) => {
- if (this.priceOrder == 1) {
- return a.price - b.price;
- }
- return b.price - a.price;
- })
- }
- this.goodsList = this.goodsList.concat(goodsList);
- //判断是否还有下一页,有是more 没有是nomore(测试数据判断大于20就没有了)
- this.loadingType = this.goodsList.length > 20 ? 'nomore' : 'more';
- if (type === 'refresh') {
- if (loading == 1) {
- uni.hideLoading()
- } else {
- uni.stopPullDownRefresh();
- }
- }
- },
- //筛选点击
- tabClick(index) {
- if (this.filterIndex === index) {
- return;
- }
- this.filterIndex = index;
- //根据筛选条件重新请求
- this.loadingState = 'first_loading';
- this.goodsList = [];
- this.current = 1;
- if (index == 2) {
- this.getShopList()
- this.showStoreList = true
- } else {
- this.getGoodsList();
- this.showStoreList = false
- }
- },
- //获取店铺列表
- getShopList(index) {
- uni.showLoading({
- title:'加载中',
- icon:'none'
- })
- let param = {};
- param.url = 'v3/seller/front/store/list';
- param.data = {};
- param.data.pageSize = this.store_info.pageSize;
- param.data.current = this.store_info.current;
- param.data.keyword = this.searchParams.keyword
- this.loadingState = this.loadingState == 'first_loading' ? this.loadingState : 'loading';
- this.$request(param).then(res => {
- if (res.state == 200) {
- if (this.store_info.current == 1) {
- this.store_list = res.data.list;
- } else {
- this.store_list = this.store_list.concat(res.data.list);
- }
- this.store_info.hasMore = this.$checkPaginationHasMore(res.data.pagination); //是否还有数据
- if (this.store_info.hasMore) {
- this.store_info.current++;
- this.loadingState = 'allow_loading_more';
- } else {
- this.loadingState = 'no_more_data';
- }
- uni.hideLoading()
- } else {
- uni.hideLoading()
- this.$api.msg(res.msg)
- //错误提示
- }
- if (this.stopPullDownRefresh) {
- this.stopPullDownRefresh = false;
- uni.stopPullDownRefresh();
- }
- })
- },
- showSelect() {
- const {
- pricearea
- } = this;
- this.pricearea = !pricearea
- },
- //显示分类面板
- toggleCateMask(type) {
- let timer = type === 'show' ? 10 : 300;
- let state = type === 'show' ? 1 : 0;
- this.cateMaskState = 2;
- setTimeout(() => {
- this.cateMaskState = state;
- }, timer)
- },
- //详情
- navToDetailPage(item) {
- //测试数据没有写id,用title代替
- let id = item.title;
- uni.navigateTo({
- url: `/pages/product/product?id=${id}`
- })
- },
- stopPrevent() {},
- //点击顶部搜索事件
- search() {
- let pages = getCurrentPages(); //获取所有页面栈实例列
- let prevPage = pages[pages.length - 2]; //上一页页面实例
- if(prevPage.route=='pages/search/search'){
- prevPage.$vm.input_val = this.keyword;
- uni.navigateBack({
- delta:1
- })
- }else{
- uni.navigateTo({
- url:'/pages/search/search'
- })
- }
-
-
-
- // url: '/pages/search/search'
-
-
-
- },
- navBack() {
- uni.navigateBack();
- },
- //查看更多品牌
- viewMoreBrand() {
- let curFlag = this.brandFlag;
- if (curFlag == '' || curFlag == 'down') {
- this.brandFlag = 'up';
- } else if (curFlag == 'up') {
- this.brandFlag = 'down';
- }
- this.brandLimit = this.brandLimit == 6 ? 999999 : 6
- },
- //查看更多分类
- viewMoreCate() {
- let curFlag = this.cateFlag;
- if (curFlag == '' || curFlag == 'down') {
- this.cateFlag = 'up';
- } else if (curFlag == 'up') {
- this.cateFlag = 'down';
- }
- this.cateLimit = this.cateLimit == 6 ? 999999 : 6
- },
- //查看更多属性
- viewMoreAttridute(attribute) {
- let curFlag = attribute.showFlag;
- if (curFlag == '' || curFlag == 'down') {
- attribute.showFlag = 'up';
- } else if (curFlag == 'up') {
- attribute.showFlag = 'down';
- }
- attribute.showLimit = attribute.showLimit == 6 ? 999999 : 6
- },
- //选择分类
- selCat(type, id, name) {
- this.selectCateText = name
- if (this.searchParams[type] == id) {
- //选中的话取消选中
- this.searchParams[type] = '';
- } else {
- this.searchParams[type] = id;
- }
- },
- //选择品牌
- selBrand(id, name) {
- let tmp_data = this.searchParams.brandId;
- let position = tmp_data.indexOf(id);
- if (position > -1) {
- //选中的话取消选中
- this.searchParams.brandId.splice(position, 1);
- this.selectBrandText.splice(position, 1)
- } else {
- if (this.searchParams.brandId == 5) {
- uni.showToast({
- title: '品牌最多选择五条',
- icon: 'none'
- })
- return
- }
- this.selectBrandText.push(name)
- this.searchParams.brandId.push(id);
- }
- },
- //选择属性
- selAttribude(attribute, attributeValue) {
- let attributedata = ''
- let position = attribute.select_text_list.indexOf(attributeValue);
- if (position > -1) {
- //选中的话取消选中
- attribute.select_text_list.splice(position, 1);
- attribute.select_list.splice(position, 1)
- } else {
- if (attribute.select_text_list.length == 5) {
- uni.showToast({
- title: '属性值最多选择五条',
- icon: 'none'
- })
- return
- }
- attributedata = attribute.attributeName + '_' + attributeValue
- attribute.select_list.push(attributedata)
- attribute.select_text_list.push(attributeValue)
- }
- },
- //根据二级分类获取三级分类
- getcateList(id) {
- this.$request({
- url: 'v3/goods/front/goods/category/screenList',
- data: {
- categoryId: id
- },
- }).then(res => {
- if (res.state == 200) {
- if (res.data.categoryList != null) {
- this.cateList = res.data.categoryList;
- this.cateList.map(item => {
- if (item.categoryId == this.searchParams.categoryIds) {
- this.selectCateText = item.categoryName
- }
- })
- }
- if (res.data.brandList != null) {
- this.brandList = res.data.brandList;
- }
- if (res.data.attributeList != null) {
- this.attributeList = res.data.attributeList;
- this.attributeList.map(item => {
- this.$set(item, 'select_list', [])
- this.$set(item, 'select_text_list', [])
- this.$set(item, 'showFlag', 'up')
- this.$set(item, 'showLimit', 6)
- })
- }
- } else {
- this.$api.msg(res.msg);
- }
- }).catch((e) => {
- //异常处理
- })
- },
- //重置筛选条件
- resetSel() {
- this.searchParams.cateId = '' || this.options.cateId; //路径里带过来的
- this.cateMaskState = 0
- this.searchParams.lowPrice = ''
- this.searchParams.highPrice = ''
- this.searchParams.brandId = []
- this.attributeList.map(item => {
- item.select_text_list = []
- item.select_list = []
- })
- this.getGoodsList();
- },
- //弹层的确认事件
- confirmSel() {
- //关闭弹层
- this.toggleCateMask();
- this.goodsList = [];
- this.current = 1;
- this.getGoodsList();
- },
- //价格输入事件
- inputPrice(e) {
- this.searchParams[e.currentTarget.dataset.key] = e.detail.value;
- },
- //清空输入框的值
- clearInput(e) {
- this.searchParams.keyword = '';
- this.$forceUpdate();
- const pages = getCurrentPages();
- const prevPage = pages[pages.length - 2];
- prevPage.$vm.input_val = '';
- uni.navigateBack({
- delta: 1
- })
- },
- },
- }
- </script>
- <style lang="scss">
- page,
- .content {
- background: $bg-color-split;
- display: flex;
- width: 750rpx;
- flex: 1;
- margin: 0 auto;
- }
- uni-page-body {
- display: flex;
- height: 100%;
- }
- .sea_input_part {
- position: fixed;
- display: flex;
- align-items: center;
- height: 88rpx;
- background-color: #fff;
- width: 750rpx;
- padding-right: 20rpx;
- top: 0;
- right: 0;
- left: 0;
- margin: 0 auto;
- /* #ifdef APP-PLUS */
- top: var(--status-bar-height);
- /* #endif */
- .back_icon {
- padding-left: 20rpx;
- }
- .sea_input {
- flex: 1;
- height: 65rpx;
- font-size: 28rpx;
- color: #333;
- }
- .search_center {
- display: flex;
- align-items: center;
- border: none;
- flex: 1;
- height: 65rpx;
- margin-left: 20rpx;
- padding-left: 20rpx;
- border-radius: 32.5rpx;
- background-color: #f5f5f5;
- .search_icon {
- width: 30rpx;
- height: 30rpx;
- margin-right: 22rpx;
- }
- }
- .clear_content {
- width: 45rpx !important;
- height: 45rpx !important;
- margin-right: 15rpx !important;
- }
- .sea_btn {
- font-size: 28rpx;
- color: #2D2D2D;
- padding: 10rpx 25rpx;
- flex-shrink: 0;
- }
- &:after {
- position: absolute;
- content: '';
- left: 0;
- bottom: 0;
- width: 100%;
- height: 1rpx;
- background-color: #eee;
- transform: scaleY(0.5);
- }
- }
- .top_part {
- top: var(--window-top);
- position: fixed;
- z-index: 9;
- }
- .navbar {
- position: fixed;
- left: 0;
- right: 0;
- margin: 0 auto;
- top: var(--window-top);
- display: flex;
- width: 750rpx;
- height: 80rpx;
- background: #fff;
- z-index: 10;
- margin-top: 87rpx;
- /* #ifdef APP-PLUS */
- margin-top: calc(var(--status-bar-height) + 87rpx);
- /* #endif */
- .complex .iconfont {
- font-size: 16rpx;
- transform: scale(0.5, 0.5);
- }
- .nav-item {
- flex: 1;
- display: flex;
- justify-content: center;
- align-items: center;
- height: 100%;
- font-size: 30upx;
- color: $font-color-dark;
- position: relative;
- .iconfont {
- color: $main-font-color;
- &.active {
- color: $main-color;
- }
- }
- .synthesize_icon {
- font-size: 16rpx;
- transform: scale(0.5, 0.5)
- }
- .filter_icon {
- font-size: 24rpx;
- margin-left: 9rpx;
- transform: scale(0.8, 0.8);
- margin-top: 6rpx;
- }
- &.current {
- // color: $main-color;
- color: #FC1C1C !important;
- .iconziyuan14 {
- color: #FC1C1C !important
- }
- &:after {
- content: '';
- position: absolute;
- left: 50%;
- bottom: 0;
- transform: translateX(-50%);
- width: 120upx;
- height: 0;
- }
- }
- }
- .p-box {
- display: flex;
- flex-direction: column;
- font-size: 16rpx;
- transform: scale(0.3, 0.3);
- margin-left: -9rpx;
- .price_up {
- margin-bottom: 4rpx;
- }
- .price_down {
- margin-top: 4rpx;
- }
- }
- .cate_item {
- display: flex;
- justify-content: center;
- align-items: center;
- height: 100%;
- width: 80upx;
- position: relative;
- font-size: 55rpx;
- color: $main-font-color;
- &.grid_icon {
- font-size: 36rpx;
- }
- &:after {
- content: '';
- position: absolute;
- left: 0;
- top: 50%;
- transform: translateY(-50%);
- border-left: 1px solid rgba(0, 0, 0, .1);
- width: 0;
- height: 36upx;
- }
- }
- }
- .goods_part {
- position: absolute;
- top: 166rpx;
- height: calc(100vh - 168rpx);
- /* #ifdef APP-PLUS */
- top: calc(var(--status-bar-height) + 168rpx);
- /* #endif */
- /* #ifdef APP-PLUS||MP-WEIXIN */
- padding-bottom: constant(safe-area-inset-bottom); /*兼容 IOS<11.2*/
- padding-bottom: env(safe-area-inset-bottom); /*兼容 IOS>11.2*/
- /* #endif */
-
- }
- .goods_list {
- flex-wrap: wrap;
- width: 750rpx;
- }
- .goods_list_another {
- margin-top: 20rpx;
- flex-wrap: wrap;
- width: 750rpx;
- }
- /* 分类 */
- .wrap {
- display: flex;
- flex-direction: column;
- height: 100%;
- }
- .cate-mask {
- position: fixed;
- left: 0;
- right: 0;
- margin: 0 auto;
- top: var(--window-top);
- bottom: 0;
- width: 750rpx;
- background: rgba(0, 0, 0, 0);
- z-index: 95;
- transition: .3s;
- overflow: hidden;
- .cate-content {
- width: 600rpx;
- height: 100%;
- background: $bg-color-split;
- float: right;
- transform: translateX(100%);
- transition: .3s;
- .bottom {
- position: fixed;
- left: 0;
- bottom: 0;
- right: 0;
- height: 100rpx;
- background: #fff;
- box-shadow: 0px 0px 15rpx 0px rgba(86, 86, 86, 0.1);
- .btn {
- width: 150rpx;
- height: 50rpx;
- border-radius: 25rpx;
- }
- .reset {
- border: 1rpx solid #ADADAD;
- color: #333333;
- font-size: 26rpx;
- }
- .confirm {
- background: #F30300;
- // box-shadow: 0px 3rpx 15rpx 0px rgba(215, 163, 53, 0.2);
- color: #fff;
- font-size: 26rpx;
- margin-right: 30rpx;
- margin-left: 20rpx;
- }
- }
- }
- &.none {
- display: none;
- }
- &.show {
- background: rgba(0, 0, 0, .4);
- .cate-content {
- transform: translateX(0);
- }
- }
- }
- .cate-list {
- height: calc(100vh - 98rpx - 100rpx);
- .part {
- padding: 30rpx;
- background: #fff;
- .title {
- margin-bottom: 10rpx;
- .left {
- color: $main-font-color;
- font-size: 28rpx;
- font-weight: bold;
- }
- .iconfont {
- font-size: 16rpx;
- transform: rotate(90deg);
- -ms-transform: rotate(90deg);
- /* IE 9 */
- -webkit-transform: rotate(90deg);
- /* Safari and Chrome */
- &.up {
- -webkit-animation: moveUp 0.6 ease-in-out 0.2s forwards;
- }
- &.down {
- -webkit-animation: moveDown 0.6 ease-in-out 0.2s forwards;
- }
- @-webkit-keyframes moveUp {
- 0% {
- -webkit-transform: rotate(90deg);
- }
- 100% {
- -webkit-transform: rotate(360deg);
- }
- }
- @-webkit-keyframes moveDown {
- 0% {
- -webkit-transform: rotate(360deg);
- }
- 100% {
- -webkit-transform: rotate(495deg);
- }
- }
- }
- }
- .detail {
- flex-wrap: wrap;
- position: relative;
- &.price_area:after {
- position: absolute;
- content: '';
- width: 25rpx;
- height: 1rpx;
- background-color: rgba(45, 45, 45, .4);
- margin: 10rpx 38rpx 0 258rpx;
- }
- .item {
- display: flex;
- justify-content: center;
- align-items: center;
- background-color: $bg-color-split;
- height: 70rpx;
- border-radius: 35rpx;
- width: 167rpx;
- color: #2D2D2D;
- font-size: 22rpx;
- margin-right: 20rpx;
- margin-top: 20rpx;
- line-height: 70rpx;
- overflow: hidden;
- .brand_name {
- max-width: 147rpx;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- &:nth-child(3n+3) {
- margin-right: 0;
- }
- &.sel {
- color: $main-color;
- background-color: rgba(252, 28, 28, .05);
- }
- }
- .amount {
- margin-top: 20rpx;
- text-align: center;
- width: 220rpx;
- height: 70rpx;
- background: $bg-color-split;
- border-radius: 35rpx;
- font-size: 24rpx;
- color: #2D2D2D;
- &.hight {
- margin-left: 100rpx;
- }
- }
- .price_input_placeholder {
- color: $main-third-color;
- font-size: 22rpx;
- text-align: center;
- }
- }
- &.price_part {
- // flex: 1;
- // padding-bottom: 130rpx;
- }
- }
- }
- /* 商品列表 */
- .goods-list {
- display: flex;
- flex-wrap: wrap;
- padding: 0 30upx;
- background: #fff;
- .goods-item {
- display: flex;
- flex-direction: column;
- width: 48%;
- padding-bottom: 40upx;
- &:nth-child(2n+1) {
- margin-right: 4%;
- }
- }
- .image-wrapper {
- width: 100%;
- height: 330upx;
- border-radius: 3px;
- overflow: hidden;
- image {
- width: 100%;
- height: 100%;
- opacity: 1;
- }
- }
- .title {
- font-size: $font-lg;
- color: $font-color-dark;
- line-height: 80upx;
- }
- .price-box {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding-right: 10upx;
- font-size: 24upx;
- color: $font-color-light;
- }
- .price {
- font-size: $font-lg;
- color: $uni-color-primary;
- line-height: 1;
- &:before {
- content: '¥';
- font-size: 26upx;
- }
- }
- }
- .empty_part {
- margin-top: 276rpx;
- width: 100%;
- image {
- width: 210rpx;
- height: 210rpx;
- }
- text {
- color: $main-third-color;
- font-size: 26rpx;
- margin-top: 57rpx;
- }
- button {
- width: 245rpx;
- height: 66rpx;
- background: rgba(252, 28, 28, .05);
- border-radius: 33rpx;
- color: $main-color;
- font-size: 30rpx;
- font-weight: bold;
- margin-top: 29rpx;
- }
- uni-button:after {
- border-radius: 200rpx;
- border-color: #fff;
- }
- }
- .fixed_top_status_bar {
- position: fixed;
- /* #ifdef APP-PLUS */
- height: var(--status-bar-height);
- /* #endif */
- /* #ifndef APP-PLUS */
- height: 0;
- /* #endif */
- top: 0;
- left: 0;
- right: 0;
- z-index: 99;
- background: #fff;
- }
- .pricearea {
- position: fixed;
- /* #ifdef APP-PLUS */
- top: var(--status-bar-height);
- /* #endif */
- /* #ifndef APP-PLUS */
- top: 0;
- /* #endif */
- left: 0;
- right: 0;
- width: 750rpx;
- height: 100vh;
- padding-top: 159rpx;
- box-sizing: border-box;
- background-color: rgba(0, 0, 0, 0.5);
- z-index: 8;
- margin: 0 auto;
- }
- .pricearea .pri-content {
- padding: 25rpx 25rpx 15rpx 36rpx;
- background-color: #F8F8F8;
- border-radius: 0 0 14rpx 14rpx;
- }
- .pricearea .pri-item {
- display: flex;
- align-items: center;
- justify-content: space-between;
- height: 80rpx;
- color: #2D2D2D;
- font-size: 28rpx;
- }
- .pricearea .pri-item.current {
- color: #E1251B;
- }
- .pricearea .pri-item.current image {
- width: 23rpx;
- height: 16rpx;
- }
- .shop_lists {
- margin-top : 168rpx;
- width: 100%;
- background: #F5F5F5;
- padding: 20rpx 0;
- box-sizing: border-box;
- height: 100%;
- // #ifdef APP-PLUS
- padding: 60rpx 0;
- //#endif
- }
- .shop_pre {
- width: 710rpx;
- background: rgba(255, 255, 255, 1);
- border-radius: 15rpx;
- margin: 0 auto;
- box-sizing: border-box;
- margin-bottom: 20rpx;
- padding: 0 21rpx;
- }
- .pre_top {
- display: flex;
- width: 100%;
- height: 140rpx;
- justify-content: space-between;
- align-items: center;
- }
- .shop_left {
- display: flex;
- align-items: center;
- }
- .shop_avatar_img {
- width: 80rpx;
- height: 80rpx;
- border-radius: 50%;
- margin-right: 20rpx;
- background: #F8F8F8;
- }
- .shop_avatar {
- width: 80rpx;
- height: 80rpx;
- border-radius: 50%;
- margin-right: 20rpx;
- }
- .shop_des {
- display: flex;
- flex-direction: column;
- }
- .des_top {
- display: flex;
- margin-bottom: 20rpx;
- }
- .shop_name {
- max-width: 323rpx;
- font-size: 30rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: rgba(45, 45, 45, 1);
- line-height: 32rpx;
- white-space: nowrap;
- text-overflow: ellipsis;
- overflow: hidden;
- word-break: break-all;
- }
- .shop_type {
- width: 56rpx;
- height: 30rpx;
- background: #FB1B1B;
- border-radius: 15rpx;
- font-size: 22rpx;
- font-family: PingFang SC;
- font-weight: 600;
- color: #FFFFFF;
- line-height: 32rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .des_bottom {
- display: flex;
- }
- .popularity {
- font-size: 24rpx;
- font-family: PingFang SC;
- font-weight: 600;
- color: #999999;
- line-height: 32rpx;
- margin-left: 10rpx;
- }
- .line {
- height: 24rpx;
- color: #999999;
- font-size: 24rpx;
- margin: 0 15rpx;
- }
- .payer_number {
- font-size: 24rpx;
- font-family: PingFang SC;
- font-weight: 600;
- color: #999999;
- line-height: 32rpx;
- }
- .go_shop {
- width: 100rpx;
- height: 50rpx;
- border: 1rpx solid #FF0000;
- border-radius: 25rpx;
- font-size: 28rpx;
- font-family: PingFang SC;
- font-weight: 600;
- color: #FB1B1B;
- line-height: 32rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .pre_content {
- display: flex;
- }
- .commodity {
- width: 216rpx;
- height: 216rpx;
- position: relative;
- margin-right: 10rpx;
- margin-bottom: 21rpx;
- background: #F5F5F5;
- border-radius: 10rpx;
- }
- .commodity:nth-of-type(3) {
- margin-right: 0;
- }
- .commodity_images {
- width: 216rpx;
- height: 216rpx;
- border-radius: 10rpx;
- margin-bottom: 20rpx;
- background: #F8F8F8;
- }
- .commodity_img {
- width: 216rpx;
- height: 216rpx;
- border-radius: 10rpx;
- margin-bottom: 20rpx;
- }
- .commodity_price {
- font-size: 24rpx;
- font-family: PingFang SC;
- font-weight: 600;
- color: #FFFFFF;
- line-height: 24rpx;
- position: absolute;
- width: 100%;
- bottom: 0;
- z-index: 10;
- text-align: center;
- height: 36rpx;
- background: rgba(0, 0, 0, 0.3);
- border-radius: 0 0 10rpx 10rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .commodity_price text:nth-child(1),
- .commodity_price text:nth-last-child(1) {
- font-size: 20rpx;
- }
- .filter_title {
- margin-top: 40rpx;
- margin: 28rpx;
- }
- .default {
- color: #dddddd !important;
- }
- .default .iconfont {
- color: #dddddd !important;
- }
- .attributr_sel_con {
- position: absolute;
- right: 65rpx;
- width: 370rpx;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- color: red;
- text-align: right;
- font-size: 18rpx;
- }
- </style>
|