commit message

This commit is contained in:
Chopper
2021-05-13 11:03:32 +08:00
commit 23804939eb
2158 changed files with 149684 additions and 0 deletions

View File

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,7 @@
.box2 {
padding: calc(32rpx) 40rpx 32rpx !important;
}
.uNumber{
display: flex;
}

View File

@@ -0,0 +1,317 @@
<template>
<view class="category-wrap">
<u-navbar class="navbar" :is-back="false">
<div class="title"> 商品分类</div>
<u-search class="nav-search" disabled @click.native="search" placeholder="搜索商品" :show-action="false"></u-search>
</u-navbar>
<view class="content">
<scroll-view scroll-y :scroll-top="num" scroll-with-animation class="left-aside">
<view v-for="(item, index) in flist" :key="item.id" class="f-item b-b" :class="{ active: item.id === currentId }" @click="tabtap(item, index)">
{{ item.name }}
</view>
</scroll-view>
<scroll-view scroll-with-animation :scroll-top="rightNum" scroll-y class="right-aside" @scroll="asideScroll" @scrolltolower="nextList('bottom')" :upper-threshold="-100" :lower-threshold="-100"
@scrolltoupper="nextList('top')">
<!-- 右边显示区域顶部热门精选的图片 -->
<!-- <view v-show="showTopTip" class="bottomTip">下拉浏览上一页</view> -->
<view class="top-img" id="main-top">
<u-image width="500rpx" height="230rpx" @click="navigateToList(topImg.id,topImg.id)" :src="topImg.image" mode="">
</u-image>
</view>
<view v-for="item in tlist" :key="item.id" class="s-list" :id="'main-' + item.id">
<text class="s-item">{{ item.name }}</text>
<view class="t-list">
<view @click="navigateToList(item.id, titem.id)" v-if="titem.parentId === item.id" class="t-item" v-for="(titem, cIndex) in item.children" :key="titem.id"
:class="{ 'margin-right': (cIndex + 1) % 3 == 0 }">
<u-image width="70px" height="70px" :src="titem.image" :lazy-load="true">
</u-image>
<text>{{ titem.name }}</text>
</view>
</view>
</view>
<!-- #todo 暂未实现此功能 -->
<!-- <view v-show="showBottomTip" class="bottomTip">上拉继续浏览</view> -->
</scroll-view>
</view>
</view>
</template>
<script>
import { getCategory, getCategoryList } from "@/api/goods.js";
export default {
data() {
return {
sizeCalcState: false,
tabScrollTop: 0,
currentId: 0,
flist: [],
slist: [],
tlist: [],
topImg: "",
showBottomTip: false,
showTopTip: false,
num: 0,
rightNum: 0,
};
},
onLoad() {
this.loadData();
},
watch: {
currentId(val) {
this.flist.forEach((item, index) => {
if (item.id == val) {
// console.log(index)
this.showBottomTip = false;
this.showTopTip = false;
this.num = index * 30;
if (index < 7) {
this.num = 0;
}
}
});
},
},
methods: {
search() {
uni.navigateTo({
url: "/pages/navigation/search/searchPage",
});
},
async loadData() {
let list = await getCategoryList(0);
this.flist = list.data.result;
this.currentId = list.data.result[0].id;
this.loadListContent(0);
// 获取右边显示区域顶部热门精选的图片
},
loadListContent(index) {
console.log(this.flist[index]);
this.topImg = this.flist[index];
this.tlist = this.flist[index].children;
},
nextList(type) {
//通过type 判断是上拉还是下拉top为加载上一页bottom为下一页
let list = JSON.parse(JSON.stringify(this.flist));
if (type == "top") {
for (let i = 0; i < list.length; i++) {
if (list[i].id == this.currentId && i != 0) {
this.currentId = list[i - 1].id;
this.loadListContent();
break;
}
}
} else {
for (let i = 0; i < list.length; i++) {
if (list[i].id == this.currentId && i != list.length - 1) {
this.currentId = list[i + 1].id;
this.loadListContent();
// this.rightNum = 250;
break;
}
}
}
},
//一级分类点击
tabtap(item, i) {
if (item.id != this.currentId) {
this.currentId = item.id;
this.loadListContent(i);
}
},
//右侧栏滚动
asideScroll(e) {
let top = e.detail.scrollTop;
if (top < 0 && this.currentId != this.flist[0].id) {
this.showTopTip = true;
}
if (
top > e.detail.scrollHeight - 500 &&
this.currentId != this.flist[this.flist.length - 1].id
) {
this.showBottomTip = true;
}
},
//计算右侧栏每个tab的高度等信息
calcSize() {
let h = 0;
uni
.createSelectorQuery()
.select("#main-top")
.fields(
{
size: true,
},
(data) => {
h = data.height;
}
)
.exec();
this.slist.forEach((item) => {
let view = uni.createSelectorQuery().select("#main-" + item.id);
view
.fields(
{
size: true,
},
(data) => {
item.top = h;
h += data.height;
item.bottom = h;
}
)
.exec();
});
this.sizeCalcState = true;
},
navigateToList(sid, tid) {
uni.navigateTo({
url: `/pages/navigation/search/searchPage?category=${tid}`,
});
},
},
};
</script>
<style>
page {
height: 100%;
background-color: #fdfaff;
}
/* 解决小程序和app滚动条的问题 */
/* #ifdef MP-WEIXIN || APP-PLUS */
::-webkit-scrollbar {
display: none;
}
/* #endif */
/* 解决H5 的问题 */
/* #ifdef H5 */
uni-scroll-view .uni-scroll-view::-webkit-scrollbar {
/* 隐藏滚动条,但依旧具备可以滚动的功能 */
display: none;
}
/* #endif */
</style>
<style lang="scss" scoped>
.status_bar {
height: var(--status-bar-height);
background-color: #f1f1f1;
width: 100%;
}
.nav-search {
padding-left: 30rpx !important;
padding-right: 20rpx !important;
}
.title {
display: block;
width: 200rpx;
text-align: center;
font-size: 34rpx;
letter-spacing: 2rpx;
// #ifdef MP-WEIXIN
margin-left: 26rpx;
// #endif
}
.category-wrap {
height: 100%;
.content {
height: calc(100vh - 94px);
display: flex;
color: #333;
font-size: 28rpx;
background: #fff;
}
.left-aside {
flex-shrink: 0;
width: 200rpx;
height: 100%;
background-color: #f7f7f7;
}
.f-item {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 97rpx;
position: relative;
&.active {
font-weight: bold;
color: $light-color;
background: #fff;
}
}
.right-aside {
flex: 1;
overflow: hidden;
padding: 40rpx 0 0 30rpx;
}
.top-img {
width: 500rpx;
height: 230rpx;
border-radius: 8px;
overflow: hidden;
image {
width: 100%;
height: 100%;
}
}
.bottomTip {
color: #999999;
text-align: center;
margin: 10rpx;
font-size: $font-sm;
}
.s-item {
display: flex;
align-items: center;
height: 70rpx;
padding-top: 16rpx;
font-weight: 500;
}
.t-list {
display: flex;
flex-wrap: wrap;
width: 100%;
padding-top: 12rpx;
}
.margin-right {
margin-right: 0 !important;
}
.t-item {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
/* width: 33%; */
width: 150rpx;
margin-right: 25rpx;
font-size: 24rpx;
padding-bottom: 20rpx;
image {
width: 140rpx;
height: 140rpx;
border-radius: 8px;
margin-bottom: 20rpx;
}
/deep/ .u-image {
width: 140rpx !important;
height: 140rpx !important;
border-radius: 8px !important;
margin-bottom: 20rpx !important;
}
}
}
</style>

View File

@@ -0,0 +1,185 @@
<template>
<view class="content">
<view class="con" :style="{width: windowWidth + 'px',height: windowHeight + 'px' }"><image :src="imgSrc" mode="scaleToFill" > </image></view>
<view class="btn" id="timer">
<view id="info"> </view>
<view class="circleProgress_wrapper btn">
<view class="wrapper right"><view class="circleProgress rightcircle"></view></view>
<view class="wrapper left"><view class="circleProgress leftcircle"></view></view>
</view>
</view>
</view>
</template>
<script>
import { getAdvertisement } from '@/api/home.js';
function getRandom(start, end, fixed = 0) {
let differ = end - start;
let random = Math.random();
return (start + differ * random).toFixed(fixed);
}
export default {
data() {
return {
imgSrc: '',
windowWidth: 0,
windowHeight: 0
};
},
onLoad() {
const res = uni.getSystemInfoSync();
this.windowWidth = res.windowWidth;
this.windowHeight = res.windowHeight;
this.init();
},
methods: {
init() {
getAdvertisement().then(res => {
if (res.statusCode === 200) {
const ads = res.data[getRandom(0, res.data.length - 1)];
this.imgSrc = ads.pic_url;
console.warn(this.imgSrc);
}
});
}
}
};
</script>
<style lang="less" scoped>
.content {
width: 100%;
height: 100%;
.con {
display: flex;
align-items: center;
image {
width: 100%;
height: 100%;
}
}
}
#timer {
display: inline-block;
position: fixed;
top: 40px;
right: 10px;
}
#info {
position: absolute;
top: 0;
left: 0;
width: 36px;
height: 36px;
line-height: 36px;
border-radius: 50%;
background-color: rgba(0, 0, 0, 0.3);
text-align: center;
color: #ffffff;
font-size: 12px;
}
.circleProgress_wrapper {
width: 36px;
height: 36px;
position: relative;
}
.wrapper {
width: 18px;
height: 36px;
position: absolute;
top: 0;
overflow: hidden;
}
.right {
right: 0;
}
.left {
left: 0;
}
.circleProgress {
width: 32px;
height: 32px;
border: 2px solid #ffffff;
border-radius: 50%;
position: absolute;
top: 0;
-webkit-transform: rotate(45deg);
}
.rightcircle {
border-top: 2px solid #03a9f4;
border-right: 2px solid #03a9f4;
right: 0;
-webkit-animation: circleProgressLoad_right 4s linear;
/*动画停留在最后一帧*/
animation-fill-mode: forwards;
-moz-animation-fill-mode: forwards;
-webkit-animation-fill-mode: forwards;
-o-animation-fill-mode: forwards;
}
.leftcircle {
border-bottom: 2px solid #03a9f4;
border-left: 2px solid #03a9f4;
left: 0;
-webkit-animation: circleProgressLoad_left 4s linear;
/*动画停留在最后一帧*/
animation-fill-mode: forwards;
-moz-animation-fill-mode: forwards;
-webkit-animation-fill-mode: forwards;
-o-animation-fill-mode: forwards;
}
@-webkit-keyframes circleProgressLoad_right {
0% {
border-top: 2px solid #03a9f4;
border-right: 2px solid #03a9f4;
-webkit-transform: rotate(45deg);
}
50% {
border-top: 2px solid #03a9f4;
border-right: 2px solid #03a9f4;
border-left: 2px solid #ffffff;
border-bottom: 2px solid #ffffff;
-webkit-transform: rotate(225deg);
}
100% {
border-left: 2px solid #ffffff;
border-bottom: 2px solid #ffffff;
-webkit-transform: rotate(225deg);
}
}
@-webkit-keyframes circleProgressLoad_left {
0% {
border-bottom: 2px solid #03a9f4;
border-left: 2px solid #03a9f4;
-webkit-transform: rotate(45deg);
}
50% {
border-bottom: 2px solid #03a9f4;
border-left: 2px solid #03a9f4;
border-top: 2px solid #ffffff;
border-right: 2px solid #ffffff;
-webkit-transform: rotate(45deg);
}
100% {
border-top: 2px solid #ffffff;
border-right: 2px solid #ffffff;
-webkit-transform: rotate(225deg);
}
}
</style>

View File

@@ -0,0 +1,118 @@
<template>
<view class="container">
<view class="status_bar"><!-- 这里是状态栏 --></view>
<view class="header">{{ agreement.article_name }}</view>
<view class="u-update-content">
<view class="about-us"><view v-html="agreement.content"></view></view>
</view>
<view class="bottom-btn">
<view class="disagree-btn">不同意</view>
<view class="agree-btn" @click="closeModal">同意</view>
</view>
<u-loading mode="flower" size="100" :show="loading"></u-loading>
</view>
</template>
<script>
0;
import { getArticleDetail } from '@/api/article.js';
export default {
data() {
return {
show: true,
loading: true,
agreement: {}
};
},
onReady() {
this.show = true;
},
onLoad(options) {
this.init();
},
methods: {
init() {
getArticleDetail(111).then(res => {
if (res.statusCode === 200) {
this.agreement = res.data;
this.loading = false;
}
});
},
cancel() {
this.closeModal();
},
confirm() {
this.closeModal();
},
closeModal() {
uni.setStorage({
key: 'launchFlag',
data: true
});
uni.switchTab({
url: '/pages/tabbar/home/index'
});
}
}
};
</script>
<style scoped lang="scss">
.container {
background-color: #ffffff;
display: flex;
flex-direction: column;
align-items: center;
}
.status_bar {
position: fixed;
top: 0px;
height: var(--status-bar-height);
width: 100%;
background: #1abc9c;
}
.header {
width: 100%;
margin-top: var(--status-bar-height);
display: flex;
justify-content: center;
align-items: center;
font-size: 34rpx;
font-weight: 400;
height: 100rpx;
}
.u-full-content {
background-color: #00c777;
}
.bottom-btn {
position: fixed;
z-index: 999;
bottom: 0px;
left: 0px;
width: 100%;
height: 100rpx;
background-color: #ffffff;
display: flex;
align-items: center;
justify-content: center;
view {
width: 50%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.agree-btn {
background-color: #1abc9c;
color: #ffffff;
}
}
.u-update-content {
padding: 10rpx;
font-size: 26rpx;
}
</style>

View File

@@ -0,0 +1,30 @@
<template>
<div class="wrapper">
<tpl />
</div>
</template>
<script>
import tpl from "@/pages/tabbar/home/views.vue";
export default {
data() {
return {
background: {
backgroundColor: "#fff",
},
};
},
components: {
tpl,
},
};
</script>
<style lang="scss" scoped>
.slot-wrap {
display: flex;
align-items: center;
flex: 1;
padding: 0 30rpx;
}
</style>

View File

@@ -0,0 +1,667 @@
<template>
<view class="new-goods">
<view class="status_bar">
<!-- 这里是状态栏 -->
</view>
<!-- 标题栏 -->
<view class="header">
<u-icon @click="leftBackBtn" size="40" name="arrow-left"></u-icon>
<view class="head-bar">
<view @click="currentIndex=0" :class="{'bar-active':currentIndex==0}">新品</view>
<view @click="currentIndex=1" :class="{'bar-active':currentIndex==1}">预告</view>
</view>
<view @click="goCart" class="alifont icon-gouwuche1" style="font-weight: bold;"></view>
</view>
<swiper :current="currentIndex" class="swiper-box" @change="ontabchange" :interval="3000" :duration="500">
<swiper-item>
<scroll-view class="scroll-v" lower-threshold="200" enableBackToTop="true" scroll-with-animation scroll-y @scrolltolower="loadMore">
<!-- 推荐商品图 -->
<image class="recommend-img" src="/pages/floor/imgs/recommend/head-sample.png"></image>
<!-- 排序 start-->
<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 || '综合排序'" :contentTopReduse="44" 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 || '分类'" :contentTopReduse="44" 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"
:key="index">{{ item }}</view>
<view class="dropdown-tag cancel-btn" @click="setTags('分类')">取消</view>
</view>
</ms-dropdown-item>
</view>
<!-- 排序 end-->
<!-- 商品列表 -->
<view class="index-items">
<view class="index-item" v-for="(item, index) in goods" :key="index">
<view class="index-item-tag">新品</view>
<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.point ? '+' + item.point + '积分' : '' }} -->
¥{{ item.price | unitPrice }}
<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>
</scroll-view>
</swiper-item>
<swiper-item>
<scroll-view class="scroll-v" lower-threshold="200" enableBackToTop="true" scroll-with-animation scroll-y @scrolltolower="loadMore">
<!-- 推荐商品图 -->
<image class="recommend-img" src="/pages/floor/imgs/recommend/head-sample.png"></image>
<!-- 排序 start-->
<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 || '综合排序'" :contentTopReduse="44" ref="dropdownItem11">
<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 || '分类'" :contentTopReduse="44" ref="dropdownItem22">
<view class="dropdown-tags">
<view class="dropdown-tag" :class="{ 'dropdown-tag-active': current_tag == item }" @click="setTags(item)" v-for="(item, index) in tags"
:key="index">{{ item }}</view>
<view class="dropdown-tag cancel-btn" @click="setTags('分类')">取消</view>
</view>
</ms-dropdown-item>
</view>
<!-- 排序 end-->
<!-- 商品列表 -->
<view class="index-items">
<view class="index-item" v-for="(item, index) in goods" :key="index">
<view class="index-item-tag">即将上架</view>
<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.point ? '+' + item.point + '积分' : '' }} -->
¥{{ item.price | unitPrice }}
<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>
</scroll-view>
</swiper-item>
</swiper>
</view>
</template>
<script>
import msDropdownItem from '@/components/ms-dropdown/dropdown-item.vue';
import {
getCategory,
getTagGoods
} from '@/api/goods.js';
import storage from '@/utils/storage.js';
export default {
components: {
msDropdownItem
},
data() {
return {
currentIndex: 0,
goods: [],
originalGoods:[],
nav: 1,
sale: '',
price: '',
sortType: '',
tags: [],
current_tag: '',
typeSort1: true,
typeSort2: false
};
},
watch:{
currentIndex(val,oVal){
this.nav = 1;
this.originalGoods = []
this.getData()
}
},
onLoad(options) {
this.getData()
this.initCategory();
},
methods: {
leftBackBtn() {
uni.navigateBack()
},
toProduct(goods_id) {//跳转商品详情
uni.navigateTo({
url: '/pages/product/goods?id=' + goods_id
});
},
goCart() { //跳转购物车
let obj = {
from: 'newGoods',
id: ''
};
storage.setCartBackbtn(obj);
uni.switchTab({
url: '/pages/tabbar/cart/cartList'
});
},
ontabchange(e){ //swiper切换
this.currentIndex = e.detail.current
},
handledropdown(val) {
// 如果没有值的话就是全部关闭
if (!val) {
this.$refs.dropdownItem2.closePopup()
this.$refs.dropdownItem1.closePopup()
this.$refs.dropdownItem22.closePopup()
this.$refs.dropdownItem11.closePopup()
}
this.sale = '';
this.price = '';
// 如果等于1点击综合排序
if (val == 1) {
this.nav = 1
this.$refs.dropdownItem2.closePopup()
this.$refs.dropdownItem22.closePopup()
} else {
this.nav = 2
this.$refs.dropdownItem1.closePopup()
this.$refs.dropdownItem11.closePopup()
}
},
async getData() { //获取数据
let response = await getTagGoods(-1, this.mark, 9999);
this.originalGoods.push(...response.data);
this.reRank();
},
loadMore(){ //加载更多
// this.getData()
},
cateSort(type) { //按照所选分类过滤,返回过滤后展示列表
let sortData = [];
for (let i = 0; i < this.originalGoods.length; i++) {
if (this.originalGoods[i].category_name == type) {
sortData.push(this.originalGoods[i]);
}
}
this.goods = 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);
}
},
// 销量排序
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'));
},
//
setSortType(value) {
this.nav = 1;
this.sortType = value;
// 新品排序
if (value == '新品排序') {
this.originalGoods.sort(this.sortDec('goods_id'));
} else {
this.getData();
}
this.$refs.dropdownItem1.closePopup();
this.$refs.dropdownItem11.closePopup()
},
setTags(value) {
this.current_tag = value;
this.$refs.dropdownItem2.closePopup();
this.$refs.dropdownItem22.closePopup()
if (value === '分类') {
this.nav = 1;
this.reRank();
} else {
this.nav = 2;
this.cateSort(value);
}
},
async initCategory() { //初始化分类列表项
let res = await getCategory();
if(res.statusCode != 200) return ;
console.log(res)
let tags = res.data;
let result = [];
for (let i = 0; i < tags.length; i++) {
result.push(tags[i].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>
page{
height: 100%;
}
</style>
<style lang="scss" scoped>
.status_bar {
height: var(--status-bar-height);
width: 100%;
position: relative;
background: #1abc9c;
z-index: 100;
}
.new-goods {
width: 100%;
height: 100%;
}
.header {
display: flex;
height: 88rpx;
width: 750rpx;
justify-content: space-between;
align-items: center;
// padding-top: var(--status-bar-height);
position: relative;
.u-icon,
.alifont {
width: 40rpx;
margin: 20rpx;
color: #FFFFFF;
}
.head-bar {
flex: 1;
display: flex;
justify-content: center;
align-items: center;
view {
width: 150rpx;
height: 50rpx;
line-height: 50rpx;
text-align: center;
background-color: #8DDBCB;
font-size: 28rpx;
}
view:nth-child(1) {
border-radius: 24rpx 0 0 24rpx;
}
view:nth-child(2) {
border-radius: 0 24rpx 24rpx 0;
}
.bar-active {
background-color: #FFFFFF;
}
}
}
.swiper-box {
height: calc(100% - 88rpx - var(--status-bar-height));
.scroll-v {
width: 750rpx;
height: 100%;
}
}
.recommend-img {
width: 100%;
height: 280rpx;
}
.index-navs {
height: 80rpx;
padding: 0 52rpx;
background-color: #fff;
display: flex;
align-items: center;
justify-content: space-between;
}
.index-nav {
color: #999;
font-size: 28rpx;
display: flex;
justify-content: center;
align-items: center;
&-active {
color: #1abc9c;
font-weight: 700;
.index-nav-desc {
color: #1abc9c;
}
}
}
.index-nav-desc {
margin-top: 8rpx;
font-size: 22rpx;
color: #999;
}
.index-nav-divider {
height: 64rpx;
border-left: 1px solid #dddcdf;
}
.index-items {
margin-top: 20rpx;
padding-left: 20rpx;
background-color: #f7f7f7;
display: flex;
align-items: center;
flex-wrap: wrap;
}
.index-item {
width: 346rpx;
background-color: #fff;
margin: 0 18rpx 20rpx 0;
border-radius: 8rpx;
box-sizing: border-box;
// overflow: hidden;
position: relative;
&-tag{
position: absolute;
right: -8rpx;
top: -7rpx;
z-index: 1;
width: 98rpx;
height: 40rpx;
color: #FFFFFF;
text-align: center;
font-size: 22rpx;
line-height: 40rpx;
background: linear-gradient(194deg,#ff9f0e 7%, #ffbb00 92%);
border-radius: 0 0 0 20rpx;
&::after{
content: "";
position: absolute;
top: 40rpx;
right: 0;
z-index: 1;
width: 0;
height: 0;
border-top: 8rpx solid #D95E00;
border-right: 8rpx solid transparent;
}
}
}
.index-item-img {
image {
width: 346rpx;
height: 320rpx;
border-radius: 8rpx 8rpx 0 0 ;
}
}
.index-item-title {
font-size: 26rpx;
color: #333333;
padding: 20rpx 0 0 20rpx;
box-sizing: border-box;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.index-item-title-desc {
font-size: 24rpx;
color: #c0c4cc;
margin: 10rpx 20rpx;
display: flex;
justify-content: space-between;
}
.index-item-price {
overflow: hidden;
font-size: 30rpx;
color: #ff5a10;
padding: 20rpx 0 0 20rpx;
}
.tipsMkt {
float: right;
color: #c0c4cc;
text-decoration: line-through;
margin-right: 20rpx;
font-size:24rpx;
line-height:40rpx;
}
.index-nav-arrows {
margin-top: 4rpx;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
.index-nav-arrow {
image {
width: 32rpx;
height: 32rpx;
}
}
.index-nav-arrow:last-child {
margin-top: -14rpx;
}
.index-nav-arrow:first-child {
margin-bottom: -14rpx;
}
.dropdown-list {
width: 100%;
height: 88rpx;
padding-left: 40rpx;
font-size: 30rpx;
color: #999;
font-weight: normal;
display: flex;
align-items: center;
&-active {
color: #1abc9c;
}
}
.dropdown-tags {
padding:30rpx;
box-sizing: border-box;
display: flex;
align-items: center;
flex-wrap: wrap;
}
.dropdown-tag {
padding: 10rpx 20rpx;
height: 60rpx;
margin:0 22rpx 22rpx 0;
border-radius: 60rpx;
background-color: #f9f9f9;
font-size: 30rpx;
color: #999;
display: flex;
align-items: center;
flex-wrap: wrap;
&-active {
background-color: #fff;
border: 1px solid #ed4743;
color: #ed4743;
}
}
.cancel-btn {
background-color: #e4e1e6;
}
</style>

View File

@@ -0,0 +1,57 @@
.position-box{
position: absolute;
right: 0;
bottom: 0;
}
.join-box {
display: flex;
}
.item-price {
> span {
font-size: 15px;
font-weight: 500;
color: #e1212b;
}
}
.join-item {
flex: 1;
}
.item-img {
width: 75px;
height: 75px;
margin: 0 auto;
display: block;
}
.item-img-box {
position: relative;
}
.item-line-through {
> span {
font-size: 10px;
font-weight: 400;
text-decoration: line-through;
color: #999;
}
}
.item-position-tips {
position: absolute;
right: 0;
color: #fff;
font-size: 12px;
bottom: 0;
}
.join-title {
display: flex;
justify-content: space-between;
align-items: center;
background: #fff;
height: 50px;
> div:nth-of-type(1) {
font-size: 16px;
font-weight: bold;
}
> div:nth-of-type(2) {
font-size: 12px;
color: #999;
}
}

View File

@@ -0,0 +1,87 @@
/** 配置楼层模块的跳转 */
export function modelnavigateTo(item) {
let val = item.url;
switch (val.___type) {
case "goods":
uni.navigateTo({
url: "/pages/product/goods?id=" + val.id + "&goodsId=" + val.goodsId,
});
break;
case "category":
uni.navigateTo({
url: `/pages/navigation/search/searchPage?category=${val.id}`,
});
break;
case "stores":
uni.navigateTo({
url: `/pages/product/shopPage?id=${val.id}`,
});
break;
// 活动
case "marketing":
uni.navigateTo({
url: "/pages/product/goods?id=" + val.skuId + "goodsId=" + val.goodsId,
});
break;
case "pages":
uni.navigateTo({
url: val.___path + "?id=" + val.id + "&title=" + val.title,
});
break;
case "other":
switch (val.title) {
case "首页":
uni.switchTab({
url: `/`,
});
break;
case "购物车":
uni.switchTab({
url: `/pages/tabbar/cart/cartList`,
});
return;
case "个人中心":
uni.switchTab({
url: `/pages/tabbar/user/my`,
});
break;
case "收藏商品":
uni.navigateTo({
url: `/pages/mine/myCollect`,
});
break;
case "我的订单":
uni.navigateTo({
url: `/pages/order/myOrder?status=0`,
});
break;
case "领券中心":
uni.navigateTo({
url: `/pages/cart/coupon/couponCenter`,
});
break;
case "签到":
uni.navigateTo({
url: `/pages/mine/signIn`,
});
break;
case "秒杀频道":
uni.navigateTo({
url: `/pages/promotion/seckill`,
});
break;
case "拼团频道":
uni.navigateTo({
url: `/pages/promotion/joinGroup`,
});
break;
case "积分商城":
uni.switchTab({
url: `/pages/navigation/point/point-mall`,
});
break;
}
break;
}
}

View File

@@ -0,0 +1,31 @@
.image-mode {
max-width: 100%;
height: auto;
display: block;
padding: 2rpx;
}
.layout {
padding: 16rpx;
margin: 8rpx 0;
background: #fff;
}
.layout,
.view-height-75,
.view-height-150 {
overflow: hidden;
}
.view-width-100 {
width: 100%;
}
.view-height-75 {
height: 150rpx;
}
.view-height-150 {
height: 300rpx;
flex: 1;
}
.view-height-85 {
height: 170rpx;
flex: 1;
}

View File

@@ -0,0 +1,37 @@
<template>
<div class="layout">
<div class="box">
<u-swiper @click="clickSwiper" interval="5000" duration="500" height="300" v-if="res" name="img" :list="res.list">
<u-loading slot="loading"></u-loading>
</u-swiper>
</div>
</div>
</template>
<script>
import { modelnavigateTo } from "./tpl";
export default {
title: "导航栏",
props: ["res"],
watch: {
res: {
handler(newValue, oldValue) {
this.$set(this, "res", newValue);
},
deep: true,
},
},
mounted() {
},
methods: {
clickSwiper(index) {
modelnavigateTo(this.res.list[index]);
},
},
};
</script>
<style lang="scss" scoped>
@import "./tpl.scss";
</style>

View File

@@ -0,0 +1,33 @@
<template>
<div class="layout">
<u-image width="140rpx" height="140rpx" @click="modelnavigateTo(item)" class="image-mode" v-for="(item,index) in res.list" :key="index" :src="item.img" alt="">
<u-loading slot="loading"></u-loading>
</u-image>
</div>
</template>
<script>
import { modelnavigateTo } from "./tpl";
export default {
title: "五列单行图片模块",
props: ["res"],
data() {
return {
modelnavigateTo,
};
},
mounted() {
console.log(this.res);
},
};
</script>
<style lang="scss" scoped>
@import "./tpl.scss";
.layout {
display: flex;
align-items: center;
justify-content: center;
background-size: cover;
}
</style>

View File

@@ -0,0 +1,39 @@
<template>
<div class="layout">
<u-image height="175rpx" width="175rpx" @click="modelnavigateTo(item)" class="image-mode" :src="item.img" v-for="(item,index) in res.list" :key="index" >
<u-loading slot="loading"></u-loading>
</u-image>
</div>
</template>
<script>
import {modelnavigateTo} from './tpl'
export default {
title: "四列单行图片模块",
props: ["res"],
data () {
return {
modelnavigateTo,
}
},
mounted() {
console.log(this.res);
}
};
</script>
<style lang="scss" scoped>
@import "./tpl.scss";
.layout {
height: 84px;
display: flex;
align-items: center;
justify-content: center;
background-size: cover;
}
img{
width: 84px;
}
</style>

View File

@@ -0,0 +1,31 @@
<template>
<div class="layout">
<div class="flex-one" @click="modelnavigateTo(res.list[0])">
<u-image width="100%" height="280rpx" :src="res.list[0].img" alt=""></u-image>
</div>
</div>
</template>
<script>
import { modelnavigateTo } from "./tpl";
export default {
data() {
return {
modelnavigateTo,
};
},
props: ["res"],
};
</script>
<style lang="scss" scoped>
@import "./tpl.scss";
.flex-one {
width: 100%;
display: block;
overflow: hidden;
> img {
width: 100%;
height: 100%;
}
}
</style>

View File

@@ -0,0 +1,38 @@
<template>
<div class="layout">
<u-image @click="modelnavigateTo(item)" height="240rpx" width="240rpx" class="image-mode" :src="item.img" v-for="(item, index) in res.list" :key="index">
<u-loading slot="loading"></u-loading>
</u-image>
</div>
</template>
<script>
import { modelnavigateTo } from "./tpl";
export default {
title: "三列单行图片模块",
props: ["res"],
mounted() {
console.log(this.res);
},
data() {
return {
modelnavigateTo,
};
},
};
</script>
<style lang="scss" scoped>
@import "./tpl.scss";
.layout {
height: 110px;
display: flex;
align-items: center;
justify-content: center;
background-size: cover;
}
img {
width: 111px;
}
</style>

View File

@@ -0,0 +1,49 @@
<template>
<div class="layout">
<div class="flex-two">
<div class="flex-item" @click="modelnavigateTo(res.list[0])">
<u-image height="325rpx" width="100%" mode="scaleToFill" :src="res.list[0].img" alt>
<u-loading slot="loading"></u-loading>
</u-image>
</div>
<div class="flex-item" @click="modelnavigateTo(res.list[1])">
<u-image height="325rpx" width="100%" mode="scaleToFill" :src="res.list[1].img" alt>
<u-loading slot="loading"></u-loading>
</u-image>
</div>
</div>
</div>
</template>
<script>
import uImage from "@/uview-ui/components/u-image/u-image.vue";
import { modelnavigateTo } from "./tpl";
export default {
components: { uImage },
title: "两张横图",
props: ["res"],
mounted() {
console.log("123");
},
data() {
return {
modelnavigateTo,
};
},
};
</script>
<style lang="scss" scoped>
@import "./tpl.scss";
.flex-two {
width: 100%;
display: flex;
overflow: hidden;
}
.flex-item {
width: 50%;
> img {
display: block;
max-width: 100%;
height: 100%;
}
}
</style>

View File

@@ -0,0 +1,181 @@
<template>
<div class="layout">
<div class="goods-cell-title">
<div
class="goods-item-title"
:class="{ 'selected-title': selected.index == index }"
@click="handleClickTitle(title, index)"
v-for="(title, index) in res.list[0].titleWay"
:key="index"
>
<h4 class="h4">{{ title.title }}</h4>
<div>{{ title.desc }}</div>
</div>
</div>
<div class="goods-list">
<div
v-if="selected.val == item.type"
@click="handleClick(item)"
class="goods-item"
v-for="(item, item_index) in res.list[0].listWay"
:key="item_index"
>
<div class="goods-img">
<u-image :src="item.img" height="350rpx" mode="aspectFit" width="100%">
<u-loading slot="loading"></u-loading
></u-image>
</div>
<div class="goods-desc">
<div class="goods-title">
{{ item.title }}
</div>
<div class="goods-bottom">
<div class="goods-price">{{ item.price | unitPrice }}</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import uImage from "@/uview-ui/components/u-image/u-image.vue";
export default {
components: { uImage },
data() {
return {
selected: {
index: 0,
val: "精选",
},
};
},
props: ["res"],
mounted() {},
methods: {
handleClick(item) {
console.log(item);
uni.navigateTo({
url: `/pages/product/goods?id=${item.id}&goodsId=${item.goodsId}`,
});
},
closeGoods(val, index) {
this.res.list[0].listWay.splice(index, 1);
},
handleClickTitle(val, index) {
this.selected.index = index;
this.selected.val = val.title;
},
},
};
</script>
<style lang="scss" scoped>
$w_94: 94%;
.layout {
padding: 8px 0;
background: #f9f9f9;
}
.selected-title {
> h4 {
font-size: 30rpx;
color: #000 !important;
}
> div {
font-weight: bold;
color: $main-color !important;
}
}
.goods-cell-title {
padding: 10px;
transition: 0.35s;
display: flex;
cursor: pointer;
> .goods-item-title {
flex: 1;
text-align: center;
> h4 {
font-size: 32rpx;
}
> div {
color: #999;
font-size: 24rpx;
}
}
}
.goods-list {
width: 100%;
display: flex;
flex-wrap: wrap;
}
.goods-item {
width: 50%;
margin-bottom: 10px;
border-radius: 0.4em;
overflow: hidden;
}
.goods-img {
position: relative;
margin: 0 auto;
// width: 158px;
width: $w_94;
border-top-left-radius: 20rpx;
border-top-right-radius: 20rpx;
overflow: hidden;
> img {
width: 100%;
height: 100%;
}
}
.goods-desc {
border-bottom-left-radius: 20rpx;
border-bottom-right-radius: 20rpx;
width: $w_94;
background: #fff;
padding: 8rpx 0 8rpx 8rpx;
margin: 0 auto;
> .goods-title {
font-size: 24rpx;
height: 70rpx;
display: -webkit-box;
font-weight: 500;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}
> .goods-bottom {
display: flex;
font-weight: bold;
> .goods-price {
line-height: 2;
color: $main-color;
}
}
}
.goods-icon {
right: 10rpx;
top: 10rpx;
position: absolute;
}
</style>

View File

@@ -0,0 +1,46 @@
<template>
<div class="layout">
<div class="join-list">
<div class="join-title">
<div>{{ res.list[0].title }}</div>
<div>更多</div>
</div>
<div class="join-box">
<div class="join-item" @click="modelnavigateTo(item)" v-for="item in 4" :key="item">
<div class="item-img-box">
<img
class="item-img"
src="https://picsum.photos/id/268/200/200"
alt
/>
</div>
<div class="item-price">
<span>120.00</span>
</div>
<div class="item-line-through">
<span>190.00</span>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import {modelnavigateTo} from './tpl'
export default {
props: ["res"],
data () {
return {
modelnavigateTo,
}
},
};
</script>
<style lang="scss" scoped>
@import "./tpl.scss";
@import './advertising.scss';
</style>

View File

@@ -0,0 +1,89 @@
<template>
<div class="layout">
<div class="join-list">
<div class="join-title">
<div>{{ res.list[0].title }}</div>
<div>更多</div>
</div>
<div class="join-box">
<div class="join-item" v-for="item in 4" :key="item">
<div class="item-img-box">
<img
class="item-img"
src="https://picsum.photos/id/268/200/200"
alt
/>
</div>
<div class="item-price">
<span>20积分</span>
</div>
<div class="item-line-through">
<span>30积分</span>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
props: ["res"],
};
</script>
<style lang="scss" scoped>
@import "./tpl.scss";
.join-box {
display: flex;
}
.item-price {
> span {
font-size: 15px;
font-weight: 500;
color: #e1212b;
}
}
.join-item {
flex: 1;
}
.item-img {
width: 75px;
height: 75px;
margin: 0 auto;
display: block;
}
.item-img-box {
position: relative;
}
.item-line-through {
> span {
font-size: 10px;
font-weight: 400;
text-decoration: line-through;
color: #999;
}
}
.item-position-tips {
position: absolute;
right: 0;
color: #fff;
font-size: 12px;
bottom: 0;
}
.join-title {
display: flex;
justify-content: space-between;
align-items: center;
background: #fff;
height: 50px;
> div:nth-of-type(1) {
font-size: 16px;
font-weight: bold;
}
> div:nth-of-type(2) {
font-size: 12px;
color: #999;
}
}
</style>

View File

@@ -0,0 +1,89 @@
<template>
<div class="layout">
<div class="join-list">
<div class="join-title">
<div>{{ res.list[0].title }}</div>
<div>更多</div>
</div>
<div class="join-box">
<div class="join-item" v-for="item in 4" :key="item">
<div class="item-img-box">
<img
class="item-img"
src="https://picsum.photos/id/268/200/200"
alt
/>
<div class="item-position-tips">2人团</div>
</div>
<div class="item-price">
<span>120.00</span>
</div>
<div class="item-line-through">
<span>120.00</span>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
props: ["res"],
};
</script>
<style lang="scss" scoped>
@import "./tpl.scss";
.join-box {
display: flex;
}
.item-price {
> span {
font-size: 15px;
font-weight: 500;
color: #e1212b;
}
}
.join-item {
flex: 1;
}
.item-img {
width: 75px;
height: 75px;
margin: 0 auto;
display: block;
}
.item-img-box {
position: relative;
}
.item-line-through {
> span {
font-size: 10px;
font-weight: 400;
text-decoration: line-through;
color: #999;
}
}
.item-position-tips {
position: absolute;
right: 0;
color: #fff;
font-size: 12px;
bottom: 0;
}
.join-title {
display: flex;
justify-content: space-between;
align-items: center;
background: #fff;
height: 50px;
> div:nth-of-type(1) {
font-size: 16px;
font-weight: bold;
}
> div:nth-of-type(2) {
font-size: 12px;
color: #999;
}
}
</style>

View File

@@ -0,0 +1,49 @@
<template>
<div class="layout">
<div class="view-height-150" @click="modelnavigateTo(res.list[0])">
<u-image width="100%" height="300rpx" class="image-mode" :src="res.list[0].img" >
<u-loading slot="loading"></u-loading>
</u-image>
</div>
<div class="view-height-150">
<div class="view-height-75" @click="modelnavigateTo(res.list[1])">
<u-image width="100%" height="150rpx" class="image-mode" :src="res.list[1].img" alt >
<u-loading slot="loading"></u-loading>
</u-image>
</div>
<div class="view-height-75" @click="modelnavigateTo(res.list[2])">
<u-image width="100%" height="150rpx" class="image-mode" :src="res.list[2].img" alt >
<u-loading slot="loading"></u-loading>
</u-image>
</div>
</div>
</div>
</template>
<script>
import {modelnavigateTo} from './tpl'
export default {
title: "左一右二",
props: ["res"],
data () {
return {
modelnavigateTo,
}
},
mounted() {
}
};
</script>
<style lang="scss" scoped>
@import "./tpl.scss";
.layout {
display: flex;
align-items: center;
justify-content: center;
background-size: cover;
}
</style>

View File

@@ -0,0 +1,44 @@
<template>
<div class="layout ">
<div class="view-height-150">
<div class="view-height-75" @click="modelnavigateTo(res.list[0])">
<u-image class="image-mode" width="100%" height="150rpx" :src="res.list[0].img" ></u-image>
</div>
<div class="view-height-75" @click="modelnavigateTo(res.list[1])">
<u-image class="image-mode" width="100%" height="150rpx" :src="res.list[1].img" ></u-image>
</div>
</div>
<div class="view-height-150" @click="modelnavigateTo(res.list[2])">
<u-image class="image-mode" width="100%" height="300rpx" :src="res.list[2].img" ></u-image>
</div>
</div>
</template>
<script>
import {modelnavigateTo} from './tpl'
export default {
title: "左二右一",
props: ["res"],
data () {
return {
modelnavigateTo,
}
},
mounted() {
}
};
</script>
<style lang="scss" scoped>
@import "./tpl.scss";
.layout {
height: 167px;
display: flex;
align-items: center;
justify-content: center;
background-size: cover;
}
</style>

View File

@@ -0,0 +1,54 @@
<template>
<div class="layout">
<div class="menu-list">
<div class="menu-item" @click="modelnavigateTo(item)" v-for="(item, index) in res.list" :key="index">
<div>
<u-image
width="88rpx"
height="88rpx"
class="menu-img"
:src="item.img"
>
<u-loading slot="loading"></u-loading>
</u-image>
</div>
<div class="menu-title">{{ item.title }}</div>
</div>
</div>
</div>
</template>
<script>
import {modelnavigateTo} from './tpl'
export default {
props: ["res"],
data () {
return {
modelnavigateTo,
}
}
};
</script>
<style lang="scss" scoped>
@import "./tpl.scss";
.menu-list {
display: flex;
align-items: center;
flex-wrap: wrap;
> .menu-item {
text-align: center;
width: 20%;
// flex: 1;
margin: 20rpx 0;
}
}
.menu-img {
display: flex;
margin: 0 auto;
width: 88rpx;
height: 88rpx;
}
.menu-title {
font-size: 24rpx;
}
</style>

View File

@@ -0,0 +1,37 @@
<template>
<div class="layout">
<div class="search" @click="handleSearch">
<u-icon name="search"></u-icon>
{{ res.list[0].title }}
</div>
</div>
</template>
<script>
export default {
props: ["res"],
methods: {
handleSearch() {
uni.navigateTo({
url: "/pages/navigation/search/searchPage",
});
},
},
};
</script>
<style lang="scss" scoped>
@import "./tpl.scss";
.search {
height: 64rpx;
border-radius: 10rpx;
display: flex;
align-items: center;
justify-content: center;
background: #ededed;
}
.layout {
background: #fff;
padding: 0 16rpx;
}
</style>

View File

@@ -0,0 +1,39 @@
<template>
<div class="layout">
<div class="join-list">
<div class="join-title">
<div>{{ res.list[0].title }}</div>
<div>更多</div>
</div>
<div class="join-box">
<div class="join-item" v-for="item in 4" :key="item">
<div class="item-img-box">
<img
class="item-img"
src="https://picsum.photos/id/268/200/200"
alt
/>
</div>
<div class="item-price">
<span>120.00</span>
</div>
<div class="item-line-through">
<span>190.00</span>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
props: ["res"],
};
</script>
<style lang="scss" scoped>
@import "./tpl.scss";
@import './advertising.scss';
</style>

View File

@@ -0,0 +1,101 @@
<template>
<div class="layout">
<div class="view-list">
<div class="view-item" @click="modelnavigateTo(res.list[0])">
<div class="-item-tilte">{{res.list[0].title}}</div>
<div class="-item-image">
<u-image width="120rpx" mode="scaleToFill" height="120rpx" :src="res.list[0].img" alt ></u-image>
</div>
</div>
<div class="view-item" @click="modelnavigateTo(res.list[1])">
<div class="-item-tilte">{{res.list[1].title}}</div>
<div class="-item-image">
<u-image width="120rpx" mode="scaleToFill" height="120rpx" :src="res.list[1].img" alt ></u-image>
</div>
</div>
</div>
<div class="view-list">
<div class="view-item" @click="modelnavigateTo(res.list[2])">
<div class="-item-tilte">{{res.list[2].title}}</div>
<div class="-item-image">
<u-image width="120rpx" mode="scaleToFill" height="120rpx" :src="res.list[2].img" alt ></u-image>
</div>
</div>
<div class="view-item" @click="modelnavigateTo(res.list[3])">
<div class="-item-tilte">{{res.list[3].title}}</div>
<div class="-item-image">
<u-image width="120rpx" mode="scaleToFill" height="120rpx" :src="res.list[3].img" alt ></u-image>
</div>
</div>
</div>
</div>
</template>
<script>
import {modelnavigateTo} from './tpl'
export default {
title: "文字图片模板",
props: ["res"],
data () {
return {
modelnavigateTo,
}
},
mounted() {
console.log(this.res);
}
};
</script>
<style lang="scss" scoped>
@import "./tpl.scss";
.layout {
display: flex;
background: #e8e8e8;
align-items: center;
justify-content: center;
background-size: cover;
padding: 0;
}
.-item-image{
padding: 10px ;
>img{
width: 100%;
}
}
.-item-tilte {
background: $aider-light-color;
height: 60rpx;
color: #fff;
font-size: 14px;
text-align: center;
line-height: 30px;
}
.view-list {
width: 48%;
margin: 0 auto;
display: flex;
background: #fff;
border-top-left-radius: 0.8em;
border-top-right-radius: 0.8em;
border: 1px solid #ededed;
> .view-item {
width: 50%;
}
> .view-item:nth-of-type(1) {
> .-item-tilte {
border-top-left-radius: 0.8em;
}
}
> .view-item:nth-of-type(2) {
> .-item-tilte {
border-top-right-radius: 0.8em;
}
}
}
</style>

View File

@@ -0,0 +1,51 @@
<template>
<div class="layout">
<div class="background">
<div class="title" :style="{ color: res.list[0].color }">
{{ res.list[0].title }}
</div>
</div>
</div>
</template>
<script>
export default {
title: "标题栏",
props: ["res"],
mounted() {
},
};
</script>
<style lang="scss" scoped>
@import "./tpl.scss";
.background {
background: url("/static/title.png") no-repeat;
position: absolute;
z-index: 2;
width: 100%;
height: 84rpx;
background-position-x: center;
background-position-y: center;
background-size: cover;
}
.layout {
text-align: center;
position: relative;
height: 84rpx;
display: flex;
align-items: center;
justify-content: center;
background: #ffffff;
}
.title {
line-height: 84rpx;
font-size: 30rpx;
font-weight: bold;
}
</style>

View File

@@ -0,0 +1,72 @@
<template>
<div class="layout">
<div class="view-width-100" @click="modelnavigateTo(res.list[0])">
<u-image class="image-mode" width="100%" height="200rpx" :src="res.list[0].img">
<u-loading slot="loading"></u-loading>
</u-image>
</div>
<div class="view-width-100" @click="modelnavigateTo(res.list[1])">
<div class="view-height-85">
<u-image class="image-mode" width="100%" height="170rpx" :src="res.list[1].img">
<u-loading slot="loading"></u-loading>
</u-image>
</div>
<div class="view-height-85" @click="modelnavigateTo(res.list[2])">
<u-image class="image-mode" width="100%" height="170rpx" :src="res.list[2].img">
<u-loading slot="loading"></u-loading>
</u-image>
</div>
</div>
</div>
</template>
<script>
import { modelnavigateTo } from "./tpl";
export default {
title: "上一下二",
props: ["res"],
data() {
return {
modelnavigateTo,
};
},
mounted() {},
};
</script>
<style lang="scss" scoped>
@import "./tpl.scss";
.layout {
display: flex;
align-items: center;
justify-content: center;
background-size: cover;
flex-direction: column;
}
// img {
// width: 100% !important;
// height: 85px !important;
// }
.view-width-100 {
padding: 1px 0;
display: flex;
height: 200rpx;
width: 100%;
> img {
width: 100%;
height: 100%;
}
}
.view-height-85 {
padding: 0 1px;
width: 50%;
> img {
width: 100%;
height: 100%;
}
}
.image-mode{
width: 100%;
}
</style>

View File

@@ -0,0 +1,79 @@
<template>
<div class="layout">
<div class="view-width-100">
<div class="view-height-85" @click="modelnavigateTo(res.list[0])">
<u-image
class="image-mode"
height="170rpx"
width="100%"
:src="res.list[0].img"
alt
><u-loading slot="loading"></u-loading
></u-image>
</div>
<div class="view-height-85" @click="modelnavigateTo(res.list[1])">
<u-image
class="image-mode"
height="170rpx"
width="100%"
:src="res.list[1].img"
alt
><u-loading slot="loading"></u-loading
></u-image>
</div>
</div>
<div class="view-width-100" @click="modelnavigateTo(res.list[2])">
<u-image
class="image-mode"
height="200rpx"
width="100%"
:src="res.list[2].img"
><u-loading slot="loading"></u-loading
></u-image>
</div>
</div>
</template>
<script>
import {modelnavigateTo} from './tpl'
export default {
title: "上二下一",
props: ["res"],
data () {
return {
modelnavigateTo,
}
},
mounted() {
},
};
</script>
<style lang="scss" scoped>
@import "./tpl.scss";
.layout {
display: flex;
align-items: center;
justify-content: center;
background-size: cover;
// height: 260rpx;
flex-direction: column;
}
// img {
// width: 100% !important;
// height: 85px !important;
// }
.view-width-100 {
padding: 1px 0;
display: flex;
height: 200rpx;
width: 100%;
}
.view-height-85 {
padding: 0 1px;
width: 50%;
}
.image-mode{
width: 100%;
}
</style>

View File

@@ -0,0 +1,17 @@
<template>
<div class="layout">请选择风格</div>
</template>
<script>
export default {
destroyed(){
}
}
</script>
<style scoped lang="scss">
@import './tpl.scss';
.layout{
height: 100px;
}
</style>

107
pages/tabbar/home/views.vue Normal file
View File

@@ -0,0 +1,107 @@
<template>
<div class="wrapper">
<!-- uni 中不能使用 vue component 所以用if判断每个组件 -->
<!-- <u-navbar :is-back="false" title="首页"></u-navbar> -->
<div v-for="(item,index) in pageData.list" :key="index">
<u-navbar v-if="item.type == 'search'" :is-back="false">
<search style="width:100%" :res="item.options" />
</u-navbar>
<carousel v-if="item.type == 'carousel'" :res="item.options" />
<titleLayout v-if="item.type == 'title'" :res="item.options" />
<leftOneRightTwo v-if="item.type == 'leftOneRightTwo'" :res="item.options" />
<leftTwoRightOne v-if="item.type == 'leftTwoRightOne'" :res="item.options" />
<topOneBottomTwo v-if="item.type == 'topOneBottomTwo'" :res="item.options" />
<topTwoBottomOne v-if="item.type == 'topTwoBottomOne'" :res="item.options" />
<flexThree v-if="item.type == 'flexThree'" :res="item.options" />
<flexFive v-if="item.type == 'flexFive'" :res="item.options" />
<flexFour v-if="item.type == 'flexFour'" :res="item.options" />
<flexTwo v-if="item.type == 'flexTwo'" :res="item.options" />
<textPicture v-if="item.type == 'textPicture'" :res="item.options" />
<menuLayout v-if="item.type == 'menu'" :res="item.options" />
<joinGroup v-if="item.type == 'joinGroup'" :res="item.options" />
<flexOne v-if="item.type == 'flexOne'" :res="item.options" />
<goods v-if="item.type == 'goods'" :res="item.options" />
<integral v-if="item.type == 'integral'" :res="item.options" />
<spike v-if="item.type == 'spike'" :res="item.options" />
<group v-if="item.type == 'group'" :res="item.options" />
</div>
<u-no-network></u-no-network>
</div>
</template>
<script>
// 引用组件
import tpl_banner from "@/pages/tabbar/home/template/tpl_banner";
import tpl_title from "@/pages/tabbar/home/template/tpl_title";
import tpl_left_one_right_two from "@/pages/tabbar/home/template/tpl_left_one_right_two";
import tpl_left_two_right_one from "@/pages/tabbar/home/template/tpl_left_two_right_one";
import tpl_top_one_bottom_two from "@/pages/tabbar/home/template/tpl_top_one_bottom_two";
import tpl_top_two_bottom_one from "@/pages/tabbar/home/template/tpl_top_two_bottom_one";
import tpl_flex_one from "@/pages/tabbar/home/template/tpl_flex_one";
import tpl_flex_two from "@/pages/tabbar/home/template/tpl_flex_two";
import tpl_flex_three from "@/pages/tabbar/home/template/tpl_flex_three";
import tpl_flex_five from "@/pages/tabbar/home/template/tpl_flex_five";
import tpl_flex_four from "@/pages/tabbar/home/template/tpl_flex_four";
import tpl_text_picture from "@/pages/tabbar/home/template/tpl_text_picture";
import tpl_menu from "@/pages/tabbar/home/template/tpl_menu";
import tpl_search from "@/pages/tabbar/home/template/tpl_search";
import tpl_join_group from "@/pages/tabbar/home/template/tpl_join_group";
import tpl_integral from "@/pages/tabbar/home/template/tpl_integral";
import tpl_spike from "@/pages/tabbar/home/template/tpl_spike";
import tpl_group from "@/pages/tabbar/home/template/tpl_group";
import tpl_ad_list from "@/pages/tabbar/home/template/tpl_view_list";
import tpl_activity_list from "@/pages/tabbar/home/template/tpl_view_list";
import tpl_goods from "@/pages/tabbar/home/template/tpl_goods";
// 结束引用组件
import { getFloorData } from "@/api/home";
export default {
data() {
return {
pageData: "",
};
},
components: {
carousel: tpl_banner,
titleLayout: tpl_title,
leftOneRightTwo: tpl_left_one_right_two,
leftTwoRightOne: tpl_left_two_right_one,
topOneBottomTwo: tpl_top_one_bottom_two,
topTwoBottomOne: tpl_top_two_bottom_one,
flexThree: tpl_flex_three,
flexFive: tpl_flex_five,
flexFour: tpl_flex_four,
flexTwo: tpl_flex_two,
textPicture: tpl_text_picture,
menuLayout: tpl_menu,
search: tpl_search,
joinGroup: tpl_join_group,
flexOne: tpl_flex_one,
goods: tpl_goods,
integral: tpl_integral,
spike: tpl_spike,
group: tpl_group,
tpl_ad_list,
tpl_activity_list,
},
mounted() {
this.init();
},
methods: {
/**
* 实例化首页数据楼层
*/
init() {
getFloorData().then((res) => {
if (res.data.success) {
this.pageData = JSON.parse(res.data.result.pageData);
}
});
},
},
};
</script>
<style>
</style>

388
pages/tabbar/user/my.vue Normal file
View File

@@ -0,0 +1,388 @@
<template>
<view class="user">
<!-- 个人信息 -->
<view class="status_bar">
<!-- 这里是状态栏 -->
</view>
<view class="header" @click="userDetail">
<view class="head-1">
<image :src="userInfo.face || '/static/missing-face.png'"></image>
</view>
<view class="head-2" v-if="userInfo.id">
<view class="user-name">{{ userInfo.nickName }}</view>
</view>
<view class="head-2" v-else>
<view class="user-name">登录/注册</view>
</view>
<u-icon name="arrow-right"></u-icon>
</view>
<!-- 积分优惠券关注 -->
<div class="pointBox">
<u-row text-align="center" gutter="16" class="point">
<u-col text-align="center" span="4" @click="navigateTo('/pages/mine/deposit/index')">
<view>预存款</view>
<view class="money">{{ walletNum | unitPrice}}</view>
</u-col>
<u-col text-align="center" span="4" @click="navigateTo('/pages/cart/coupon/myCoupon')">
<view>优惠券</view>
<view>{{ couponNum || 0 }}</view>
</u-col>
<u-col text-align="center" span="4" @click="navigateTo('/pages/mine/myTracks')">
<view>足迹</view>
<view>{{ footNum || 0 }}</view>
</u-col>
</u-row>
</div>
<!-- 我的订单代付款 -->
<view class="order">
<view class="order-item" @click="navigateTo('/pages/order/myOrder?status=0')">
<div class="bag bag1">
<u-icon name="order" size="35" color="#fff"></u-icon>
</div>
<view>我的订单</view>
</view>
<view class="order-item" @click="navigateTo('/pages/order/myOrder?status=1')">
<div class="bag bag2">
<u-icon name="bag-fill" size="35" color="#fff"></u-icon>
</div>
<view>待付款</view>
<!-- <view class="corner" v-if="cornerForm.stay_pay_order > 0">{{ cornerForm.stay_pay_order}}</view> -->
</view>
<view class="order-item" @click="navigateTo('/pages/order/myOrder?status=3')">
<div class="bag bag3">
<u-icon name="car-fill" size="35" color="#fff"></u-icon>
</div>
<view>待收货</view>
<!-- <view class="corner" v-if="cornerForm.stay_receiving_order > 0">{{ cornerForm.stay_receiving_order}}</view> -->
</view>
<view class="order-item" @click="navigateTo('/pages/order/evaluate/myEvaluate')">
<div class="bag bag4">
<u-icon name="star-fill" size="35" color="#fff"></u-icon>
</div>
<view>待评价</view>
<!-- <view class="corner" v-if="cornerForm.pending_comment_count > 0">{{ cornerForm.pending_comment_count}}</view> -->
</view>
<view class="order-item" @click="navigateTo('/pages/order/afterSales/afterSales')">
<div class="bag bag5">
<u-icon name="server-fill" size="35" color="#fff"></u-icon>
</div>
<view>售后服务</view>
<!-- <view class="corner" v-if="cornerForm.after_order > 0">{{ cornerForm.after_order}}</view> -->
</view>
</view>
<!-- 常用工具 -->
<tool />
</view>
</template>
<script>
import storage from "@/utils/storage.js";
import tool from "@/pages/tabbar/user/utils/tool.vue";
import { getCouponsNum, getFootprintNum } from "@/api/members.js";
import { getUserInfo, getUserWallet } from "@/api/members";
let startY = 0,
moveY = 0,
pageAtTop = true;
export default {
components: {
tool,
},
data() {
return {
coverTransform: "translateY(0px)",
coverTransition: "0s",
moving: false,
userInfo: {},
couponNum: "",
footNum: "",
walletNum: "",
};
},
onLoad() {},
onShow() {
this.userInfo = this.$options.filters.isLogin();
if (this.$options.filters.isLogin("auth")) {
this.getUserOrderNum();
}
},
onPullDownRefresh() {
this.getUserOrderNum();
this.userInfo = this.$options.filters.isLogin();
},
// #ifndef MP
onNavigationBarButtonTap(e) {
const index = e.index;
if (index === 0) {
this.navigateTo("/pages/mine/set/setUp");
}
},
// #endif
mounted() {},
methods: {
/**
* 统一跳转接口,拦截未登录路由
* navigator标签现在默认没有转场动画所以用view
*/
navigateTo(url) {
uni.navigateTo({
url,
});
},
userDetail() {
this.userInfo.id
? this.navigateTo("/pages/mine/set/personMsg")
: this.navigateTo("/pages/passport/login");
},
/**
* 会员卡下拉和回弹
* 1.关闭bounce避免ios端下拉冲突
* 2.由于touchmove事件的缺陷以前做小程序就遇到比如20跳到40h5反而好很多下拉的时候会有掉帧的感觉
* transition设置0.1秒延迟让css来过渡这段空窗期
* 3.回弹效果可修改曲线值来调整效果推荐一个好用的bezier生成工具 http://cubic-bezier.com/
*/
coverTouchstart(e) {
if (pageAtTop === false) {
return;
}
this.coverTransition = "transform .1s linear";
startY = e.touches[0].clientY;
},
coverTouchmove(e) {
moveY = e.touches[0].clientY;
let moveDistance = moveY - startY;
if (moveDistance < 0) {
this.moving = false;
return;
}
this.moving = true;
if (moveDistance >= 80 && moveDistance < 100) {
moveDistance = 80;
}
if (moveDistance > 0 && moveDistance <= 80) {
this.coverTransform = `translateY(${moveDistance}px)`;
}
},
coverTouchend() {
if (this.moving === false) {
return;
}
this.moving = false;
this.coverTransition = "transform 0.3s cubic-bezier(.21,1.93,.53,.64)";
this.coverTransform = "translateY(0px)";
},
async getUserOrderNum() {
uni.stopPullDownRefresh();
Promise.all([
getCouponsNum(), //优惠券
getFootprintNum(), //浏览数量
getUserWallet(), //预存款
]).then((res) => {
this.couponNum = res[0].data.result;
this.footNum = res[1].data.result;
this.walletNum = res[2].data.result.memberWallet;
});
},
},
};
</script>
<style lang="scss" scoped>
html,
body {
overflow: auto;
}
.money {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.uiconRed {
position: relative;
&::before {
content: "";
background: red;
width: 10rpx;
height: 10rpx;
border-radius: 50%;
position: absolute;
right: 0;
top: 0;
}
}
.user {
.status_WEIXIN {
background: $light-color;
overflow: hidden;
> .status_WEIXIN_R {
float: right;
margin-right: 20rpx;
}
> .status_WEIXIN_L {
float: left;
margin-left: 20rpx;
}
}
.header {
max-width: 100%;
padding: calc(50rpx + var(--status-bar-height)) 30rpx 0 115rpx;
height: calc(var(--status-bar-height) + 360rpx);
background-size: cover;
border-bottom-left-radius: 20rpx;
border-bottom-right-radius: 20rpx;
background-image: url("/static/img/main-bg.png");
background-position: bottom;
background-repeat: no-repeat;
color: #ffffff;
display: flex;
justify-content: space-between;
.head-1 {
text-align: center;
width: 144rpx;
position: relative;
margin-top: 40rpx;
image {
width: 144rpx;
height: 144rpx;
border-radius: 50%;
margin-bottom: 30rpx;
border: 3px solid #fff;
}
.edti-head {
position: absolute;
width: 40rpx;
height: 40rpx;
border-radius: 50%;
background-color: rgba(255, 255, 255, 0.3);
top: 100rpx;
right: 0;
image {
width: 100%;
height: 100%;
}
}
.certificate {
font-size: 20rpx;
border: 1px solid #ffffff;
border-radius: 1em;
width: 91rpx;
margin: 0 auto;
}
}
.head-2 {
flex: 1;
margin-left: 30rpx;
line-height: 2em;
margin-top: 60rpx;
}
.u-icon {
margin-top: -120rpx;
}
}
.pointBox {
transform: translateY(-30rpx);
width: 94%;
margin: 0 3%;
background: #fff;
border-radius: 0.4em;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04);
height: 160rpx;
}
.point {
text-align: center;
height: 160rpx;
border-bottom: 1px solid $border-color-light;
color: #999;
font-size: $font-sm;
// #ifdef MP-WEIXIN
padding: 24rpx;
// #endif
.u-col {
line-height: 1.5em view {
color: $u-main-color;
font-size: 28rpx;
}
view:last-child {
margin-top: 8rpx;
color: $main-color;
font-size: $font-lg;
}
}
}
.order {
height: 140rpx;
text-align: center;
font-size: $font-sm;
display: flex;
justify-content: space-around;
align-items: center;
padding: 0 3%;
color: #999;
.order-item {
position: relative;
line-height: 2em;
width: 96rpx;
:first-child {
font-size: 48rpx;
margin-bottom: 10rpx;
}
.corner {
position: absolute;
right: 14rpx;
top: -6rpx;
width: 30rpx;
height: 30rpx;
background-color: red;
color: #fff;
border-radius: 50%;
line-height: 30rpx;
}
}
}
}
.user-name {
font-size: 34rpx;
}
.nickname {
font-size: 24rpx;
}
.bag {
width: 56rpx;
height: 56rpx;
border-radius: 50%;
margin: 0 auto;
}
.bag1 {
background: #ff4a48;
}
.bag2 {
background: #ff992f;
}
.bag3 {
background: #009ee0;
}
.bag4 {
background: #00d5d5;
}
.bag5 {
background: #28ccb0;
}
</style>

View File

@@ -0,0 +1,187 @@
<template>
<view class="similar-goods">
<view class="goods" @click="goDetail(goods.goods_id)">
<image :src="goods.goods_img" mode=""></image>
<view class="goods-intro">
<view>{{goods.goodsName}}</view>
<view>{{goods.goods_sn}}</view>
<view>¥{{goods.goods_price | unitPrice}}</view>
</view>
<!-- <button>找相似</button> -->
</view>
<view class="title">相似好货&nbsp;为您推荐</view>
<view class="scroll-con">
<view v-if="nomsg">没有相似商品</view>
<view v-else class="con" v-for="(item,index) in goodsList" :key="index" @click="goDetail(item)">
<image :src="item.thumbnail" mode=""></image>
<view class="nowrap">{{item.name}}</view>
<view>
<text>{{item.price | unitPrice}}
<!-- <text v-if="item.point">+{{item.point || 0}}积分</text> -->
</text>
<text>{{item.mktprice}}</text>
</view>
<view>
<text>已售{{item.buy_count}}</text>
<text>{{item.grade}}%好评</text>
</view>
</view>
</view>
<uni-load-more :status="loadStatus"></uni-load-more>
</view>
</template>
<script>
import {
getGoodsList
} from '@/api/goods.js';
export default {
data() {
return {
loadStatus: 'more',
params: {
pageNumber: 1,
pageSize: 10,
keyword: ''
},
goods: {},
goodsList: [],
nomsg: false,
};
},
methods: {
getList() {
uni.showLoading({
title: "加载中"
})
this.params.keyword = this.goods.goodsName;
getGoodsList(this.params).then(res => {
uni.hideLoading()
if (res.statusCode == 200) {
let data = res.data;
if (data.data_total == 0) {
// this.nomsg = true;
this.loadStatus = 'noMore';
} else if (data.data_total < 10) {
this.loadStatus = 'noMore'
this.goodsList.push(...data.data)
} else {
this.goodsList.push(...data.data);
if (data.data.length < 10) this.loadStatus = 'noMore'
}
}
})
},
goDetail(item) {
uni.navigateTo({
url: '/pages/product/goods?id=' + item.id + "&goodsId=" +item.goodsId
})
},
loadData() {
if(this.loadStatus!='noMore'){
this.params.pageNumber++;
this.getList()
}
},
},
onLoad(option) {
this.goods = JSON.parse(decodeURIComponent(option.goods))
console.log(this.goods)
this.getList()
},
onReachBottom() { //触底事件,页面整个滚动使用
this.loadData()
}
}
</script>
<style lang="scss" scoped>
@import './collect.scss';
.title {
height: 110rpx;
line-height: 110rpx;
text-align: center;
color: #333;
background-color: #F1F1F1;
margin-top: 20rpx;
font-size: $font-base;
}
.goods {
padding: 0 30rpx;
}
.scroll-con {
width: 750rpx;
flex-wrap: wrap;
.con {
width: 345rpx;
margin: 20rpx 0 0 20rpx;
background-color: #FFFFFF;
border-radius: 10rpx;
box-sizing: border-box;
display: inline-block;
font-size: $font-sm;
// line-height: 1.5em;
image {
width: 100%;
height: 320rpx;
border-radius: 8rpx 8rpx 0 0;
}
view{
padding: 0 20rpx;
&::after{
content: '';
display: block;
clear: right;
}
text {
display: inline-block;
color: #999;
}
text:nth-child(2) {
float: right;
text-align: right;
}
}
view:last-child{
margin-bottom: 20rpx;
}
.nowrap {
position: relative;
line-height: 1.4em;
max-height: 2.8em; //height是line-height的整数倍防止文字显示不全
overflow: hidden;
}
view:nth-child(2) {
font-size: 26rpx;
}
view:nth-child(3) {
margin-top: 10rpx;
font-weight: bold;
text:nth-child(1) {
color: #f56c6c;
}
text:nth-child(2) {
color: #d7d7d7;
text-decoration: line-through;
}
}
view:nth-child(4) {
margin-top: 10rpx;
}
}
}
</style>

View File

@@ -0,0 +1,157 @@
<template>
<view>
<!-- 常用工具 -->
<view class="interact-tools" style="margin-bottom: 15px">
<view class="interact-title">常用工具</view>
<div class="paddingBox">
<view class="interact-container">
<view class="interact-item" @click="navigateTo('/pages/mine/signIn')">
<image src="/static/mine/sign.png" mode=""></image>
<view>每日签到</view>
</view>
<view class="interact-item" @click="navigateTo('/pages/mine/point/myPoint')">
<image src="/static/mine/mypoint.png" mode=""></image>
<view>我的积分</view>
</view>
<view class="interact-item" @click="navigateTo('/pages/cart/coupon/myCoupon')">
<image src="/static/mine/mycoupon.png" mode=""></image>
<view>优惠券</view>
</view>
<view class="interact-item" @click="navigateTo('/pages/mine/myCollect')">
<image src="/static/mine/myfavorite.png" mode=""></image>
<view>我的关注</view>
</view>
<view class="interact-item" @click="navigateTo('/pages/mine/myTracks')">
<image src="/static/mine/myhistory.png" mode=""></image>
<view>我的足迹</view>
</view>
<view class="interact-item" @click="navigateTo('/pages/order/evaluate/myEvaluate')">
<image src="/static/mine/mycommit.png" mode=""></image>
<view>我的评价</view>
</view>
<view class="interact-item" @click="navigateTo('/pages/order/complain/complainList')">
<image src="/static/mine/shensu.png" mode=""></image>
<view>我的投诉</view>
</view>
<view class="interact-item" @click="navigateTo('/pages/mine/set/feedBack')">
<image src="/static/mine/feedback.png" mode=""></image>
<view>意见反馈</view>
</view>
<view class="interact-item" @click="navigateTo('/pages/cart/coupon/couponCenter')">
<image src="/static/mine/couponcenter.png" mode=""></image>
<view>领券中心</view>
</view>
<view class="interact-item" @click="navigateTo('/pages/mine/address/addressManage')">
<image src="/static/mine/myaddress.png" mode=""></image>
<view>地址管理</view>
</view>
<view class="interact-item" @click="navigateTo('/pages/mine/set/setUp')">
<image src="/static/mine/setting.png" mode=""></image>
<view>设置</view>
</view>
<view class="interact-item" @click="distribution">
<image src="/static/mine/distribution.png" mode=""></image>
<view>我的分销</view>
</view>
</view>
</div>
</view>
</view>
</template>
<script>
import { distribution } from "@/api/goods";
export default {
methods: {
navigateTo(url) {
uni.navigateTo({
url,
});
},
distribution() {
distribution().then((res) => {
if (res.data.result) {
let type = res.data.result.distributionStatus;
if (type == "PASS") {
uni.navigateTo({
url: "/pages/mine/distribution/home",
});
} else if (type == "RETREAT" || type == "REFUSE") {
uni.navigateTo({
url: "/pages/mine/distribution/auth",
});
} else {
uni.showToast({
title: "您的信息正在审核",
duration: 2000,
icon: "none",
});
}
} else if (!res.data.success && res.data.code == 22000) {
uni.showToast({
title: '分销功能暂未开启',
duration: 2000,
icon: "none",
});
} else {
// 没有资格申请 先去实名认证
uni.navigateTo({
url: "/pages/mine/distribution/auth",
});
}
});
},
},
};
</script>
<style lang="scss" scoped>
.interact-tools {
border-left: none;
border-right: none;
margin-top: 30rpx;
.interact-title {
background: #f2f2f2;
height: 96rpx;
line-height: 96rpx;
font-size: 28rpx;
color: #333;
font-weight: bold;
padding-left: 30rpx;
margin: 0 20rpx;
border-radius: 14rpx 14rpx 0 0;
}
.interactBox {
height: 156rpx;
}
.interact-container {
margin: 0 20rpx;
background: #fff;
border-radius: 0 0 14rpx 14rpx;
.interact-item-img {
width: 52rpx !important;
height: 52rpx !important;
// margin-bottom: !important;
margin: 0 auto 6rpx auto !important;
}
image {
width: 52rpx;
height: 52rpx;
margin-bottom: 6rpx;
}
display: flex;
align-items: center;
flex-wrap: wrap;
text-align: center;
.interact-item {
font-size: $font-sm;
width: 25%;
height: 160rpx;
padding: 30rpx;
}
}
}
</style>