mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-uniapp.git
synced 2025-12-17 07:55:53 +08:00
删除冗余组件,修改搜索商品样式
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<div class="feedBack">
|
||||
<div class="feedBack-box">
|
||||
<h4>猜你想问</h4>
|
||||
<div class="feedBack-item" @click="handleClick(index)" v-for="(item,index) in list" :key="index">
|
||||
<div class="feedBack-item" :class="{'active':feedBack.type == item.value }" @click="handleClick(index)" v-for="(item,index) in list" :key="index">
|
||||
{{item.text}}
|
||||
</div>
|
||||
</div>
|
||||
@@ -130,6 +130,10 @@ export default {
|
||||
margin: 0 auto;
|
||||
border-radius: 100px;
|
||||
}
|
||||
.active{
|
||||
color: $light-color !important;
|
||||
font-weight: bold;
|
||||
}
|
||||
.feedBack {
|
||||
padding-bottom: 100rpx;
|
||||
}
|
||||
|
||||
@@ -35,13 +35,6 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/deep/ .u-row {
|
||||
// #ifdef MP-WEIXIN
|
||||
padding: 0 5%;
|
||||
// #endif
|
||||
}
|
||||
|
||||
.status_bar {
|
||||
height: var(--status-bar-height);
|
||||
background: #fff !important;
|
||||
@@ -121,7 +114,7 @@ page {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.flex {
|
||||
margin: 30rpx 0;
|
||||
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
> .sort-brand-item {
|
||||
@@ -138,47 +131,36 @@ page {
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
}
|
||||
.storeSellerBox {
|
||||
// #ifndef MP-WEIXIN
|
||||
padding: 16rpx !important;
|
||||
|
||||
// #endif
|
||||
}
|
||||
.goodsClass {
|
||||
padding: 0 20rpx;
|
||||
|
||||
/deep/ .u-row {
|
||||
}
|
||||
}
|
||||
|
||||
.index-nav-arrow:last-child {
|
||||
margin-top: -22rpx;
|
||||
}
|
||||
|
||||
.line1-store-name{
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
.to-store{
|
||||
font-size: 24rpx;
|
||||
color: #333;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
.img {
|
||||
width: 26rpx;
|
||||
height: 26rpx;
|
||||
}
|
||||
.goodsRow {
|
||||
/deep/ .u-row {
|
||||
// #ifdef MP-WEIXIN
|
||||
padding: 0%;
|
||||
background: #fff;
|
||||
// padding: 16rpx;
|
||||
border-radius: 0.4em;
|
||||
margin: 0 !important;
|
||||
|
||||
// #endif
|
||||
}
|
||||
|
||||
.goods-row {
|
||||
background: #fff;
|
||||
border-radius: 0.4em;
|
||||
margin: 20rpx 0;
|
||||
// #ifdef MP-WEIXIN
|
||||
margin: 10rpx 0;
|
||||
// #endif
|
||||
padding: 0 16rpx;
|
||||
width: 100%;
|
||||
padding: 16rpx;
|
||||
|
||||
>.goods-col{
|
||||
display: flex;
|
||||
>.goods-img{
|
||||
flex: 4;
|
||||
}
|
||||
>.goods-detail{
|
||||
flex: 7;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.add1 {
|
||||
@@ -192,21 +174,14 @@ page {
|
||||
border-bottom: 1px solid #eeeeee;
|
||||
}
|
||||
|
||||
.logimg {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.clamp3 {
|
||||
padding-top: 30rpx;
|
||||
margin-bottom: 10rpx;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
|
||||
font-weight: 400;
|
||||
display: -webkit-box;
|
||||
line-height: 40rpx;
|
||||
height: 80rpx;
|
||||
-webkit-box-orient: vertical;
|
||||
|
||||
-webkit-line-clamp: 2 !important;
|
||||
@@ -217,25 +192,12 @@ page {
|
||||
}
|
||||
}
|
||||
|
||||
.switchType1 {
|
||||
width: 50%;
|
||||
overflow: hidden;
|
||||
text-align: center;
|
||||
|
||||
> .img {
|
||||
width: 182rpx;
|
||||
height: 200rpx;
|
||||
}
|
||||
}
|
||||
.imgGoods {
|
||||
width: 182rpx;
|
||||
height: 200rpx;
|
||||
}
|
||||
view {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.storeSellerName {
|
||||
.store-seller-name {
|
||||
color: #666;
|
||||
overflow: hidden;
|
||||
|
||||
@@ -248,7 +210,7 @@ view {
|
||||
}
|
||||
}
|
||||
|
||||
.countConfig {
|
||||
.count-config {
|
||||
padding: 10rpx 0;
|
||||
color: #666;
|
||||
display: flex;
|
||||
@@ -635,16 +597,15 @@ view {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.countConfig,
|
||||
.storeSellerName {
|
||||
.count-config,
|
||||
.store-seller-name {
|
||||
font-size: $font-sm;
|
||||
}
|
||||
|
||||
.textHidden {
|
||||
.text-hidden {
|
||||
|
||||
overflow: hidden;
|
||||
|
||||
text-overflow: ellipsis;
|
||||
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,53 +82,49 @@
|
||||
<div v-if="isSWitch">
|
||||
<scroll-view :style="{ height: goodsHeight }" enableBackToTop="true" lower-threshold="250"
|
||||
@scrolltolower="loadmore()" scroll-with-animation scroll-y class="scoll-page">
|
||||
<div class="goodsClass">
|
||||
<u-row v-for="(item, index) in goodsList" :key="index" class="goodsRow">
|
||||
<u-col :span="4" @click.native="navigateToDetailPage(item)" class="switchType1">
|
||||
<u-image width="182rpx" height="200rpx" class="imgGoods" :src="item.content.thumbnail">
|
||||
<u-loading slot="loading"></u-loading>
|
||||
</u-image>
|
||||
</u-col>
|
||||
<u-col :span="8" @click.native="navigateToDetailPage(item)" class="switchType2">
|
||||
<div class="title clamp3" style="">{{ item.content.goodsName }}</div>
|
||||
<view class="price-box">
|
||||
<div class="price" v-if="item.content.price!=undefined">
|
||||
¥<span>{{ formatPrice(item.content.price )[0] }} </span>.{{
|
||||
<div class="goods-class">
|
||||
<div v-for="(item, index) in goodsList" :key="index" class="goods-row">
|
||||
<div class="flex goods-col">
|
||||
<div class="goods-img" @click="navigateToDetailPage(item)">
|
||||
<u-image width="230rpx" height="230rpx" :src="item.content.thumbnail">
|
||||
<u-loading slot="loading"></u-loading>
|
||||
</u-image>
|
||||
</div>
|
||||
<div class="goods-detail">
|
||||
<div class="title clamp3" @click="navigateToDetailPage(item)">{{ item.content.goodsName }}</div>
|
||||
<view class="price-box" @click="navigateToDetailPage(item)">
|
||||
<div class="price" v-if="item.content.price!=undefined">
|
||||
¥<span>{{ formatPrice(item.content.price )[0] }} </span>.{{
|
||||
formatPrice(item.content.price )[1]
|
||||
}}
|
||||
</div>
|
||||
</view>
|
||||
<div class="promotion" @click="navigateToDetailPage(item)">
|
||||
<div v-for="(promotionItem,promotionIndex) in getPromotion(item)" :key="promotionIndex">
|
||||
<span v-if="promotionItem.indexOf('COUPON') != -1">劵</span>
|
||||
<span v-if="promotionItem.indexOf('FULL_DISCOUNT') != -1">满减</span>
|
||||
<span v-if="promotionItem.indexOf('SECKILL') != -1">秒杀</span>
|
||||
</div>
|
||||
</div>
|
||||
</view>
|
||||
<div class="promotion">
|
||||
<div v-for="(promotionItem,promotionIndex) in getPromotion(item)" :key="promotionIndex">
|
||||
<div style="overflow: hidden" @click="navigateToDetailPage(item)" class="count-config">
|
||||
<span style="float: left; font-size: 22rpx">已售 {{ item.content.buyCount || '0' }}</span>
|
||||
<span style="float: right; font-size: 22rpx">{{ item.content.commentNum || '0' }}条评论</span>
|
||||
</div>
|
||||
<div style="overflow: hidden" @click="navigateToStoreDetailPage(item)" class="count-config">
|
||||
<div class="text-hidden">
|
||||
<u-tag style="margin-right: 10rpx" size="mini" mode="dark" v-if="item.selfOperated" text="自营"
|
||||
type="error" />
|
||||
<span class="line1-store-name">{{ item.content.storeName }}</span>
|
||||
<span class="to-store">进店<u-icon size="24" name="arrow-right" color="#666"></u-icon></span>
|
||||
</div>
|
||||
<span>
|
||||
<u-icon name="arrow-right" color="#c5c5c5"></u-icon>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<span v-if="promotionItem.indexOf('COUPON') != -1">劵</span>
|
||||
<span v-if="promotionItem.indexOf('FULL_DISCOUNT') != -1">满减</span>
|
||||
<span v-if="promotionItem.indexOf('SECKILL') != -1">秒杀</span>
|
||||
</div>
|
||||
</div>
|
||||
<div style="overflow: hidden" class="countConfig">
|
||||
<span style="float: left; font-size: 22rpx">已售 {{ item.buyCount || '0' }}</span>
|
||||
<span style="float: right; font-size: 22rpx">{{ item.commentNum || '0' }}条评论</span>
|
||||
</div>
|
||||
</u-col>
|
||||
<u-col :span="12" class="storeSellerBox">
|
||||
<div class="storeSellerName" @click="clickTostore()">
|
||||
<div class="textHidden">
|
||||
<u-tag style="margin-right: 10rpx" size="mini" mode="dark" v-if="item.selfOperated" text="自营"
|
||||
type="error" />
|
||||
|
||||
<span style="
|
||||
color: #333333;
|
||||
font-size: 28rpx;
|
||||
padding-left: 17rpx;
|
||||
">{{ item.storeName }}</span>
|
||||
</div>
|
||||
<span>
|
||||
<u-icon name="arrow-right" color="#c5c5c5"></u-icon>
|
||||
</span>
|
||||
</div>
|
||||
</u-col>
|
||||
</u-row>
|
||||
</div>
|
||||
</div>
|
||||
<uni-load-more :status="loadingType" @loadmore="loadmore()"></uni-load-more>
|
||||
</scroll-view>
|
||||
@@ -153,36 +149,33 @@
|
||||
<scroll-view :style="{ height: goodsHeight }" scroll-anchoring enableBackToTop="true"
|
||||
@scrolltolower="loadmore()" scroll-with-animation scroll-y lower-threshold="250" class="scoll-page">
|
||||
<view class="goods-list">
|
||||
<view v-for="(item, index) in goodsList" :key="index" class="goods-item"
|
||||
@click="navigateToDetailPage(item)">
|
||||
<view class="image-wrapper">
|
||||
<view v-for="(item, index) in goodsList" :key="index" class="goods-item">
|
||||
<view class="image-wrapper" @click="navigateToDetailPage(item)">
|
||||
<image :src="item.content.thumbnail" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="goods-detail">
|
||||
<div class="title clamp">{{ item.content.goodsName }}</div>
|
||||
<view class="price-box">
|
||||
<div class="title clamp" @click="navigateToDetailPage(item)">{{ item.content.goodsName }}</div>
|
||||
<view class="price-box" @click="navigateToDetailPage(item)">
|
||||
<div class="price" v-if="item.content.price!=undefined">
|
||||
|
||||
¥<span>{{ formatPrice(item.content.price )[0] }} </span>.{{
|
||||
formatPrice(item.content.price )[1]
|
||||
}}
|
||||
</div>
|
||||
</view>
|
||||
|
||||
<div class="promotion">
|
||||
<div class="promotion" @click="navigateToDetailPage(item)">
|
||||
<div v-for="(promotionItem,promotionIndex) in getPromotion(item)" :key="promotionIndex">
|
||||
|
||||
<span v-if="promotionItem.indexOf('COUPON') != -1">劵</span>
|
||||
<span v-if="promotionItem.indexOf('FULL_DISCOUNT') != -1">满减</span>
|
||||
<span v-if="promotionItem.indexOf('SECKILL') != -1">秒杀</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="countConfig">
|
||||
<div class="count-config" @click="navigateToDetailPage(item)">
|
||||
<span>已售 {{ item.content.buyCount || "0" }}</span>
|
||||
<span>{{ item.content.commentNum || "0" }}条评论</span>
|
||||
</div>
|
||||
<div class="storeSellerName">
|
||||
<div class="textHidden">
|
||||
<div class="store-seller-name" @click="navigateToStoreDetailPage(item)">
|
||||
<div class="text-hidden">
|
||||
<u-tag style="margin-right: 10rpx" size="mini" mode="dark" v-if="item.selfOperated" text="自营"
|
||||
type="error" />
|
||||
<span>{{ item.content.storeName || "暂无" }}</span>
|
||||
@@ -275,6 +268,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
<u-back-top :scroll-top="scrollTop"></u-back-top>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -287,6 +281,7 @@ import storage from "@/utils/storage";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
scrollTop: 0,
|
||||
loadIndex: 10,
|
||||
oldKeywordIndex: "",
|
||||
selectedWay: {
|
||||
@@ -345,9 +340,13 @@ export default {
|
||||
routerVal: "",
|
||||
};
|
||||
},
|
||||
onPageScroll(e) {
|
||||
console.log(e)
|
||||
this.scrollTop = e.scrollTop;
|
||||
},
|
||||
onLoad(val) {
|
||||
this.init();
|
||||
// this.initSortGoods();
|
||||
// this.initSortGoods();
|
||||
// 接收分类的数据
|
||||
|
||||
this.routerVal = val;
|
||||
@@ -367,7 +366,6 @@ export default {
|
||||
this.isShowSeachGoods = true;
|
||||
}
|
||||
this.loadData();
|
||||
|
||||
},
|
||||
components: {
|
||||
mSearch,
|
||||
@@ -546,11 +544,18 @@ export default {
|
||||
delta: 1,
|
||||
});
|
||||
},
|
||||
// 跳转到商品详情
|
||||
navigateToDetailPage(item) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/product/goods?id=${item.content.id}&goodsId=${item.content.goodsId}`,
|
||||
});
|
||||
},
|
||||
// 跳转地址
|
||||
navigateToStoreDetailPage(item) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/product/shopPage?id=${item.content.storeId}`,
|
||||
});
|
||||
},
|
||||
loadmore() {
|
||||
this.params.pageNumber++;
|
||||
this.loadData();
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<view class="select-title">退货</view>
|
||||
<view class="select-sub-title">
|
||||
退回收到的商品
|
||||
<uni-icons color="#BABABA" type="arrowright"></uni-icons>
|
||||
<u-icon name="arrow-right" color="#bababa"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -46,7 +46,7 @@
|
||||
<view class="select-title">退款</view>
|
||||
<view class="select-sub-title">
|
||||
退款商品返还金额
|
||||
<uni-icons color="#BABABA" type="arrowright"></uni-icons>
|
||||
<u-icon name="arrow-right" color="#bababa"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -55,13 +55,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import UniIcons from "@/components/uni-icons/uni-icons.vue";
|
||||
|
||||
import { getAfterSaleInfo } from "@/api/after-sale";
|
||||
export default {
|
||||
components: {
|
||||
UniIcons,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
sn: "",
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
logs[0].message
|
||||
}}</view>
|
||||
</view>
|
||||
<uni-icons type="arrowright" style="margin-right: 5px"></uni-icons>
|
||||
<u-icon name="arrow-right" style="margin-right: 5px" size="30" color="#999"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="goods-info">
|
||||
@@ -201,12 +201,7 @@ import {
|
||||
getAfterSaleLog,
|
||||
getAfterSaleReason,
|
||||
} from "@/api/after-sale.js";
|
||||
import UniIcons from "@/components/uni-icons/uni-icons.vue";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
UniIcons,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
reason: "", //申请原因
|
||||
|
||||
@@ -1,617 +0,0 @@
|
||||
<template>
|
||||
<view class="recommend" :style="styleWay">
|
||||
<view class="status_bar">
|
||||
<!-- 这里是状态栏 -->
|
||||
</view>
|
||||
|
||||
<view class="prohibition" style="overscroll-behavior: unset;">
|
||||
<view class="header" :style="'height:' + header.height + 'px;'">
|
||||
<view class="left">
|
||||
<u-icon @click="goMainPage" size="40" name="arrow-left"></u-icon>
|
||||
</view>
|
||||
{{ title }}
|
||||
<view @click="goCart" class="right"><text class="alifont icon-gouwuche1" style="font-size: 40rpx;"></text></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="recommend-head" :style="'margin-top:' + header.height + 'px;'">
|
||||
<image src="/pages/floor/imgs/recommend/head-sample.png" mode="aspectFill"></image>
|
||||
</view>
|
||||
|
||||
<view class="index-navs">
|
||||
<ms-dropdown-item class="index-nav" :class="{ 'index-nav-active': nav == 1 }" v-model="sortType" @click.native="handledropdown(1)"
|
||||
:hasSlot="true" :title="sortType || '综合排序'" ref="dropdownItem1">
|
||||
<view class="dropdown-item-content">
|
||||
<view class="dropdown-list" :class="{ 'dropdown-list-active': sortType == '综合排序' }" @click="setSortType('综合排序')">综合排序</view>
|
||||
<view class="dropdown-list" :class="{ 'dropdown-list-active': sortType == '新品排序' }" @click="setSortType('新品排序')">新品排序</view>
|
||||
</view>
|
||||
</ms-dropdown-item>
|
||||
<view class="index-nav-divider"></view>
|
||||
<view class="index-nav" :class="{ 'index-nav-active': nav == 3 }" @click="setNav(3)">
|
||||
销量
|
||||
<view class="index-nav-arrows">
|
||||
<view class="index-nav-arrow">
|
||||
<image class="img" src="/static/index/arrow-up-1.png" v-if="sale === 'asc'" mode="aspectFit"></image>
|
||||
<image class="img" src="/static/index/arrow-up.png" v-else mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="index-nav-arrow">
|
||||
<image class="img" src="/static/index/arrow-down.png" v-if="sale === 'dec'" mode="aspectFit"></image>
|
||||
<image class="img" src="/static/index/arrow-down-1.png" v-else mode="aspectFit"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="index-nav-divider"></view>
|
||||
<view class="index-nav" :class="{ 'index-nav-active': nav == 4 }" @click="setNav(4)">
|
||||
价格
|
||||
<view class="index-nav-arrows">
|
||||
<view class="index-nav-arrow">
|
||||
<image class="img" src="/static/index/arrow-up-1.png" v-if="price === 'asc'" mode="aspectFit"></image>
|
||||
<image class="img" src="/static/index/arrow-up.png" v-else mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="index-nav-arrow">
|
||||
<image class="img" src="/static/index/arrow-down.png" v-if="price === 'dec'" mode="aspectFit"></image>
|
||||
<image class="img" src="/static/index/arrow-down-1.png" v-else mode="aspectFit"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="index-nav-divider"></view>
|
||||
<ms-dropdown-item class="index-nav" :class="{ 'index-nav-active': nav == 2 }" @click.native="handledropdown(2)"
|
||||
v-model="current_tag" :hasSlot="true" :title="current_tag || '分类'" ref="dropdownItem2">
|
||||
|
||||
<view class="dropdown-tags">
|
||||
<view class="dropdown-tag" :class="{ 'dropdown-tag-active': current_tag == item }" @click="setTags(item)" v-for="(item, index) in tags">{{ item }}</view>
|
||||
<view class="dropdown-tag cancel-btn" @click="setTags('分类')">取消</view>
|
||||
</view>
|
||||
</ms-dropdown-item>
|
||||
</view>
|
||||
|
||||
<view class="index-items">
|
||||
<view class="index-item" v-for="(item, index) in goods" :key="index">
|
||||
<view class="index-item-img" @click="toProduct(item.goods_id)">
|
||||
<image :src="item.thumbnail" mode="aspectFill"></image>
|
||||
<view class="index-item-title">{{ item.goodsName }}</view>
|
||||
<view class="index-item-price">
|
||||
¥{{ item.price | unitPrice }}
|
||||
<!-- ¥{{ item.price | unitPrice }}{{ item.point ? '+' + item.point + '积分' : '' }} -->
|
||||
<span class="tipsMkt">¥{{ item.mktprice }}</span>
|
||||
</view>
|
||||
<view class="index-item-title-desc">
|
||||
<view>已售 {{ item.buy_count }}</view>
|
||||
<view>好评率 {{ item.grade }}%</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import msDropdownItem from '@/components/ms-dropdown/dropdown-item.vue';
|
||||
import {
|
||||
getTagGoods
|
||||
} from '@/api/goods.js';
|
||||
import storage from '@/utils/storage.js';
|
||||
export default {
|
||||
components: {
|
||||
msDropdownItem
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
styleWay: {
|
||||
'height': "100%",
|
||||
'overflow': 'auto',
|
||||
|
||||
},
|
||||
style_flag: false,
|
||||
header: {
|
||||
top: 0,
|
||||
height: 40
|
||||
},
|
||||
originalGoods: [],
|
||||
|
||||
oldOriginalGoods: [],
|
||||
// 分类的数据
|
||||
sortData: [],
|
||||
goods: [],
|
||||
title: '',
|
||||
mark: 'hot',
|
||||
nav: 1,
|
||||
sale: '',
|
||||
price: '',
|
||||
sortType: '',
|
||||
tags: [],
|
||||
current_tag: '',
|
||||
typeSort1: true,
|
||||
typeSort2: false,
|
||||
|
||||
};
|
||||
},
|
||||
async onLoad(options) {
|
||||
if (options.title) {
|
||||
this.title = options.title;
|
||||
}
|
||||
if (options.mark) {
|
||||
this.mark = options.mark;
|
||||
}
|
||||
let response = await getTagGoods(-1, this.mark, 9999);
|
||||
this.originalGoods = response.data;
|
||||
this.reRank();
|
||||
this.initCategory();
|
||||
},
|
||||
|
||||
onNavigationBarButtonTap() {
|
||||
uni.switchTab({
|
||||
url: '/pages/tabbar/cart/cartList'
|
||||
});
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
handledropdown(val) {
|
||||
|
||||
if (!this.style_flag) {
|
||||
|
||||
this.styleWay = {
|
||||
'overflow': "hidden",
|
||||
'height': "100vh"
|
||||
}
|
||||
} else {
|
||||
|
||||
this.styleWay = {
|
||||
'overflow': "auto",
|
||||
'height': "100%"
|
||||
}
|
||||
}
|
||||
|
||||
this.style_flag = !this.style_flag
|
||||
// 如果没有值的话就是全部关闭
|
||||
if (!val) {
|
||||
this.$refs.dropdownItem2.closePopup()
|
||||
this.$refs.dropdownItem1.closePopup()
|
||||
|
||||
}
|
||||
this.sale = '';
|
||||
this.price = '';
|
||||
// 如果等于1点击综合排序
|
||||
if (val == 1) {
|
||||
this.nav = 1
|
||||
this.$refs.dropdownItem2.closePopup()
|
||||
|
||||
} else {
|
||||
this.nav = 2
|
||||
this.$refs.dropdownItem1.closePopup()
|
||||
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
|
||||
async getData() {
|
||||
let response = await getTagGoods(-1, this.mark, 9999);
|
||||
this.originalGoods = response.data;
|
||||
this.reRank();
|
||||
this.initCategory();
|
||||
},
|
||||
toProduct(goods_id) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/product/goods?id=' + goods_id
|
||||
});
|
||||
},
|
||||
goMainPage() {
|
||||
uni.navigateBack()
|
||||
},
|
||||
goCart() {
|
||||
let obj = {
|
||||
from: 'recommend',
|
||||
id: ''
|
||||
};
|
||||
storage.setCartBackbtn(obj);
|
||||
uni.switchTab({
|
||||
url: '/pages/tabbar/cart/cartList'
|
||||
});
|
||||
},
|
||||
// 销量排序
|
||||
saleSort(type) {
|
||||
type == 'asc' ? this.originalGoods.sort(this.sortAsc('buy_count')) : this.originalGoods.sort(this.sortDec(
|
||||
'buy_count'));
|
||||
},
|
||||
|
||||
// 价格排序
|
||||
priceSort(type) {
|
||||
type == 'asc' ? this.originalGoods.sort(this.sortAsc('price')) : this.originalGoods.sort(this.sortDec('price'));
|
||||
},
|
||||
|
||||
// 按照分类
|
||||
cateSort(type) {
|
||||
this.sortData = [];
|
||||
// this.originalGoods =[]
|
||||
for (let i = 0; i < this.originalGoods.length; i++) {
|
||||
if (this.originalGoods[i].category_name == type) {
|
||||
this.sortData.push(this.originalGoods[i]);
|
||||
}
|
||||
}
|
||||
this.goods = this.sortData;
|
||||
},
|
||||
|
||||
// 降序
|
||||
sortDec(prop) {
|
||||
return function(obj1, obj2) {
|
||||
var val1 = obj1[prop];
|
||||
var val2 = obj2[prop];
|
||||
if (val1 < val2) {
|
||||
return 1;
|
||||
} else if (val1 > val2) {
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
// 升序
|
||||
sortAsc(prop) {
|
||||
return function(obj1, obj2) {
|
||||
var val1 = obj1[prop];
|
||||
var val2 = obj2[prop];
|
||||
if (val1 < val2) {
|
||||
return -1;
|
||||
} else if (val1 > val2) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
setNav(type) {
|
||||
this.handledropdown();
|
||||
this.nav = type;
|
||||
if (type == 3) {
|
||||
// 销量 默认降序
|
||||
this.typeSort1 ? this.setSort('sale', 'dec') : this.setSort('sale', 'asc');
|
||||
|
||||
this.typeSort1 = !this.typeSort1;
|
||||
} else if (type == 4) {
|
||||
// 价格 默认升序
|
||||
this.typeSort2 ? this.setSort('price', 'asc') : this.setSort('price', 'dec');
|
||||
|
||||
this.typeSort2 = !this.typeSort2;
|
||||
}
|
||||
},
|
||||
setSort(key, type) {
|
||||
this.handledropdown();
|
||||
if (key === 'sale') {
|
||||
this.nav = 3;
|
||||
this.saleSort(type);
|
||||
|
||||
this.$set(this, 'price', '');
|
||||
}
|
||||
if (key === 'price') {
|
||||
this.nav = 4;
|
||||
this.priceSort(type);
|
||||
|
||||
this.$set(this, 'sale', '');
|
||||
}
|
||||
|
||||
if (this[key] === type) {
|
||||
this.$set(this, key, '');
|
||||
} else {
|
||||
this.$set(this, key, type);
|
||||
}
|
||||
},
|
||||
|
||||
//
|
||||
setSortType(value) {
|
||||
|
||||
this.nav = 1;
|
||||
this.sortType = value;
|
||||
// 新品排序
|
||||
if (value == '新品排序') {
|
||||
this.originalGoods.sort(this.sortDec('goods_id'));
|
||||
} else {
|
||||
this.getData();
|
||||
}
|
||||
|
||||
this.$refs.dropdownItem1.closePopup();
|
||||
|
||||
},
|
||||
setTags(value) {
|
||||
|
||||
|
||||
|
||||
this.current_tag = value;
|
||||
this.$refs.dropdownItem2.closePopup();
|
||||
|
||||
|
||||
if (value === '分类') {
|
||||
this.nav = 1;
|
||||
this.reRank();
|
||||
|
||||
} else {
|
||||
this.nav = 2;
|
||||
this.cateSort(value);
|
||||
|
||||
}
|
||||
},
|
||||
initCategory() {
|
||||
let goods = this.goods;
|
||||
let result = [];
|
||||
for (var i = 0; i < goods.length; i++) {
|
||||
result.push(goods[i].category_name);
|
||||
}
|
||||
this.tags = this.unique(result);
|
||||
},
|
||||
unique(arr) {
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
for (var j = i + 1; j < arr.length; j++) {
|
||||
if (arr[i] == arr[j]) {
|
||||
//第一个等同于第二个,splice方法删除第二个
|
||||
arr.splice(j, 1);
|
||||
j--;
|
||||
}
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
},
|
||||
reRank() {
|
||||
this.goods = this.originalGoods;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.index {
|
||||
padding-top: var(--status-bar-height);
|
||||
}
|
||||
|
||||
.prohibition {
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
z-index: 100;
|
||||
top: var(--status-bar-height);
|
||||
}
|
||||
|
||||
.status_bar {
|
||||
position: fixed;
|
||||
top: 0px;
|
||||
height: var(--status-bar-height);
|
||||
width: 100%;
|
||||
background: #1abc9c;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.header {
|
||||
background: #1abc9c;
|
||||
position: relative;
|
||||
color: #fff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 26rpx;
|
||||
font-size: 34rpx;
|
||||
height: 80rpx;
|
||||
|
||||
.left,
|
||||
.right {
|
||||
position: absolute;
|
||||
width: max-content;
|
||||
height: max-content;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.left {
|
||||
float: left;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 20rpx;
|
||||
}
|
||||
|
||||
.right {
|
||||
float: right;
|
||||
right: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.tipsMkt {
|
||||
float: right;
|
||||
color: #c0c4cc;
|
||||
text-decoration: line-through;
|
||||
margin-right: 20rpx;
|
||||
font-size: 24rpx;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
|
||||
.img {
|
||||
width: 13px !important;
|
||||
height: 13px !important;
|
||||
}
|
||||
|
||||
.recommend {
|
||||
width: 100%;
|
||||
padding-top: var(--status-bar-height);
|
||||
}
|
||||
|
||||
.recommend-head {
|
||||
image {
|
||||
width: 3710 rpx;
|
||||
height: 280 rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.index-navs {
|
||||
height: 80 rpx;
|
||||
padding: 0 52 rpx;
|
||||
background-color: #f7f7f7;
|
||||
display: -webkit-box;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.index-nav {
|
||||
color: #999;
|
||||
font-size: 28 rpx;
|
||||
display: -webkit-box;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
&-active {
|
||||
color: #1abc9c;
|
||||
font-weight: 700;
|
||||
|
||||
.index-nav-desc {
|
||||
color: #1abc9c;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.index-nav-desc {
|
||||
margin-top: 8 rpx;
|
||||
font-size: 22 rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.index-nav-divider {
|
||||
height: 64 rpx;
|
||||
border-left: 1px solid #dddcdf;
|
||||
}
|
||||
|
||||
.index-items {
|
||||
margin-top: 20 rpx;
|
||||
padding-left: 20 rpx;
|
||||
background-color: #f7f7f7;
|
||||
display: -webkit-box;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.index-item {
|
||||
width: 346 rpx;
|
||||
background-color: #fff;
|
||||
margin: 0 18 rpx 20 rpx 0;
|
||||
border-radius: 16 rpx;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.index-item-img {
|
||||
image {
|
||||
width: 346 rpx;
|
||||
height: 320 rpx;
|
||||
border-radius: 8rpx 8rpx 0 0;
|
||||
}
|
||||
}
|
||||
|
||||
.index-item-title {
|
||||
font-size: 26 rpx;
|
||||
color: #333333;
|
||||
padding: 10 rpx 0 0 20 rpx;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
|
||||
text-overflow: ellipsis;
|
||||
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.index-item-title-desc {
|
||||
font-size: 25 rpx;
|
||||
color: #c0c4cc;
|
||||
margin: 10rpx 20rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.index-item-price {
|
||||
overflow: hidden;
|
||||
font-size: 110 rpx;
|
||||
color: #ff5a10;
|
||||
padding: 20 rpx 0 0 20 rpx;
|
||||
}
|
||||
|
||||
.index-nav-arrows {
|
||||
margin-top: 4 rpx;
|
||||
display: -webkit-box;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.index-nav-arrow {
|
||||
image {
|
||||
width: 32 rpx;
|
||||
height: 32 rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.index-nav-arrow:last-child {
|
||||
margin-top: - 14 rpx;
|
||||
}
|
||||
|
||||
.index-nav-arrow:first-child {
|
||||
margin-bottom: - 14 rpx;
|
||||
}
|
||||
|
||||
.dropdown-list {
|
||||
width: 100%;
|
||||
height: 88 rpx;
|
||||
padding-left: 40 rpx;
|
||||
font-size: 110 rpx;
|
||||
color: #999;
|
||||
font-weight: normal;
|
||||
display: -webkit-box;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
&-active {
|
||||
color: #1abc9c;
|
||||
}
|
||||
}
|
||||
|
||||
.dropdown-tags {
|
||||
padding: 110 rpx;
|
||||
box-sizing: border-box;
|
||||
display: -webkit-box;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
z-index: 9;
|
||||
}
|
||||
|
||||
.dropdown-tag {
|
||||
// width: 710 rpx;
|
||||
padding: 10rpx 20rpx;
|
||||
height: 60 rpx;
|
||||
margin: 0 22 rpx 22 rpx 0;
|
||||
border-radius: 60 rpx;
|
||||
background-color: #f9f9f9;
|
||||
font-size: 110 rpx;
|
||||
color: #999;
|
||||
display: -webkit-box;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
&-active {
|
||||
background-color: #fff;
|
||||
border: 1px solid #ed4743;
|
||||
color: #ed4743;
|
||||
}
|
||||
}
|
||||
|
||||
.cancel-btn {
|
||||
background-color: #e4e1e6;
|
||||
}
|
||||
</style>
|
||||
@@ -1,251 +0,0 @@
|
||||
<template>
|
||||
<view class="sale">
|
||||
<view class="status_bar">
|
||||
<!-- 这里是状态栏 -->
|
||||
</view>
|
||||
|
||||
<view class="prohibition" :style="'overscroll-behavior: unset;height:' + header.height + 'px;'">
|
||||
<view class="header">
|
||||
<view class="left">
|
||||
<u-icon @click="goMainPage()" size="40" name="arrow-left"></u-icon>
|
||||
</view>
|
||||
特惠推荐
|
||||
<view @click="goCart" class="right"><text class="alifont icon-gouwuche1"
|
||||
style="font-size: 40rpx;"></text></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="sale-head">
|
||||
<image :style="'margin-top:' + header.height + 'px;'" src="/pages/floor/imgs/recommend/head-sample.png"
|
||||
mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="sale-title">
|
||||
<view>今日特惠</view>
|
||||
</view>
|
||||
<view class="sale-items">
|
||||
<view class="sale-item" v-for="item in goods" @click="navigateTo(item)">
|
||||
<view class="sale-item-img">
|
||||
<image :src="item.thumbnail" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="sale-item-content">
|
||||
<view class="sale-item-title">
|
||||
{{ item.name }}
|
||||
<view class="sale-item-title-desc">{{ item.category }}</view>
|
||||
</view>
|
||||
<view class="sale-item-price">
|
||||
<text class="sale-item-price-now">¥{{ item.price | unitPrice }}
|
||||
<!-- <text v-if="item.point">+{{ item.point || 0 }}积分</text> -->
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getPlateformTagGoods
|
||||
} from '@/api/goods.js';
|
||||
import storage from '@/utils/storage.js';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
header: {
|
||||
top: 0,
|
||||
height: 40
|
||||
},
|
||||
goods: [],
|
||||
tag_id: 1,
|
||||
loadStatus: 'more'
|
||||
};
|
||||
},
|
||||
async onLoad(options) {
|
||||
if (options.title) {
|
||||
uni.setNavigationBarTitle({
|
||||
title: options.title
|
||||
});
|
||||
}
|
||||
let response = await getPlateformTagGoods(this.tag_id);
|
||||
this.goods = response.data;
|
||||
},
|
||||
onBackPress() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
// 跳转
|
||||
navigateTo(item) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/product/goods?id=' + item.goods_id
|
||||
});
|
||||
},
|
||||
goCart() {
|
||||
//跳转购物车
|
||||
let obj = {
|
||||
from: 'sale',
|
||||
id: ''
|
||||
};
|
||||
storage.setCartBackbtn(obj);
|
||||
uni.preloadPage({
|
||||
url: '/pages/tabbar/cart/cartList'
|
||||
});
|
||||
},
|
||||
goMainPage() {
|
||||
//莫名其妙的,无法后退,尝试追加参数解决缓存问题
|
||||
uni.switchTab({
|
||||
url: '/pages/tabbar/home/index'
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.sale {
|
||||
width: 100%;
|
||||
min-height: 100vh;
|
||||
background-color: #f7f7f7;
|
||||
}
|
||||
|
||||
.index {
|
||||
padding-top: var(--status-bar-height);
|
||||
}
|
||||
|
||||
.prohibition {
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
z-index: 100;
|
||||
top: var(--status-bar-height);
|
||||
}
|
||||
|
||||
.status_bar {
|
||||
position: fixed;
|
||||
top: 0px;
|
||||
height: var(--status-bar-height);
|
||||
width: 100%;
|
||||
background: #1abc9c;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.header {
|
||||
background: #1abc9c;
|
||||
position: relative;
|
||||
color: #fff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 26rpx;
|
||||
font-size: 34rpx;
|
||||
height: 80rpx;
|
||||
|
||||
.left,
|
||||
.right {
|
||||
position: absolute;
|
||||
width: max-content;
|
||||
height: max-content;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.left {
|
||||
float: left;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 20rpx;
|
||||
}
|
||||
|
||||
.right {
|
||||
float: right;
|
||||
right: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.sale-head {
|
||||
padding-top: var(--status-bar-height);
|
||||
|
||||
image {
|
||||
width: 750 rpx;
|
||||
height: 280 rpx;
|
||||
border-radius: 0px;
|
||||
}
|
||||
|
||||
margin-bottom: 20 rpx;
|
||||
}
|
||||
|
||||
.sale-title {
|
||||
width: 710 rpx;
|
||||
height: 100 rpx;
|
||||
margin: 0 auto;
|
||||
font-size: 28 rpx;
|
||||
color: #666;
|
||||
border-radius: 14 rpx 14 rpx 0 0;
|
||||
background-color: #f1f1f1;
|
||||
display: -webkit-box;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
justify-content: start;
|
||||
|
||||
view {
|
||||
margin-left: 40 rpx;
|
||||
font-size: 28rpx;
|
||||
font-family: PingFang SC, PingFang SC-Regular;
|
||||
font-weight: 400;
|
||||
}
|
||||
}
|
||||
|
||||
.sale-items {
|
||||
display: -webkit-box;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
flex-direction: column;
|
||||
margin: 0 20rpx;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.sale-item {
|
||||
width: 710 rpx;
|
||||
padding: 0 20rpx;
|
||||
height: 180 rpx;
|
||||
border-bottom: 1px solid #eeeeee;
|
||||
// position: relative;
|
||||
display: -webkit-box;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: start;
|
||||
}
|
||||
|
||||
.sale-item-img {
|
||||
margin-right: 20 rpx;
|
||||
|
||||
image {
|
||||
width: 124 rpx;
|
||||
height: 124 rpx;
|
||||
border-radius: 8 rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.sale-item-content {
|
||||
line-height: 1.5em;
|
||||
}
|
||||
|
||||
.sale-item-title {
|
||||
font-size: 28 rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.sale-item-title-desc {
|
||||
font-size: 25 rpx;
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
.sale-item-price-now {
|
||||
font-size: 28 rpx;
|
||||
color: #ff5a10;
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user