This commit is contained in:
Gdpao
2020-08-01 11:16:53 +08:00
parent f30c4f4922
commit 5b31193750
11 changed files with 279 additions and 125 deletions

View File

@@ -2,10 +2,17 @@
<u-popup v-model="show" mode="bottom" length="782" border-radius="20">
<view class="top">
<text>全部商品</text>
<image></image>
<u-icon name="close" color="#999999" :size="30" @click="toggerList"></u-icon>
</view>
<scroll-view :scroll-y="true" style="padding:0 30rpx;height:692rpx">
<sitem v-for="i in 10"></sitem>
<scroll-view :scroll-y="true" class="scroll-box">
<view v-for="(item,index) in cartList" :key="index" class="item">
<image :src="item.goods_image" mode="aspectFill"></image>
<view>
<text class="title">{{ item.goods_advword }}</text>
<text class="name">{{ item.goods_name }}{{ item.goods_name }}{{ item.goods_name }}{{ item.goods_name }}{{ item.goods_name }}</text>
<text class="price">{{ item.goods_promotion_price }}</text>
</view>
</view>
</scroll-view>
</u-popup>
</template>
@@ -13,20 +20,30 @@
import sitem from "./item"
export default {
name:'shoplist',
props: ['list'],
components:{
sitem
},
data(){
return {
show: true
show: true,
cartList: this.list || [],
}
}
},
watch: {
list() {
this.cartList = this.list;
}
},
methods: {
toggerList() {
this.show = false;
this.$emit("hideCart",this.show);
}
}
}
</script>
<style lang="scss" scoped>
image{
background-color: #0f0;
}
.top{
height: 88rpx;
width: 100%;
@@ -39,9 +56,41 @@ image{
font-size: 30rpx;
color: #333;
}
>image{
width: 33rpx;
height: 33rpx;
}
}
.scroll-box {
.item {
display: flex;
padding: 20rpx;
border-bottom: 1px solid #ECECEC;
& > image {
flex-shrink: 0;
width: 160rpx;
height: 160rpx;
margin-right: 14rpx;
border-radius: 10rpx;
}
& > view {
display: flex;
flex-direction: column;
justify-content: space-between;
color: #333;
font-size: 28rpx;
.title {
}
.name {
width: 500rpx;
height: 80rpx;
font-size: 24rpx;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
.price {
color: #FF3131;
}
}
}
}
</style>

View File

@@ -9,16 +9,13 @@
</view>
</template>
<style lang="scss" scoped>
image{
background-color: #0f0;
}
.shopone{
display: flex;
width: 442rpx;
height: 200rpx;
background:rgba(0,0,0,0.4);
padding: 20rpx;
display: flex;
border-radius: 10rpx;
background:rgba(0,0,0,0.4);
>image{
width: 160rpx;
height: 160rpx;

View File

@@ -1,30 +1,32 @@
<template>
<view class="userinfo">
<view class="userhead">
<image :src="list.member_avatar"></image>
<text>+</text>
<image :src="item.member_avatar"></image>
<text class="follow" v-if="!is_follow" @click="following(item.member_id)">+</text>
<u-icon v-else name="checkbox-mark" color="#ffffff" :size="28" class="follow" @click="following(item.member_id)"></u-icon>
</view>
<view class="zan">
<image></image>
<text>{{list.like_num}}</text>
<!-- 点赞 -->
<view class="operat zan">
<u-icon name="thumb-up-fill" :color=" is_like ? '#FF7807' : '#ffffff' " :size="50" @click="likeType(item.article_id)"></u-icon>
<text>{{item.like_num}}</text>
</view>
<view class="shoucang">
<image></image>
<text>{{list.collect_num}}</text>
<!-- 收藏 -->
<view class="operat shoucang">
<u-icon name="star-fill" :color=" is_collect ? '#FF7807' : '#ffffff' " :size="50" @click="collecting(item.article_id)"></u-icon>
<text>{{item.collect_num}}</text>
</view>
<view class="pinglun">
<image></image>
<text>{{list.comment_num}}</text>
<!-- 评论 -->
<view class="operat pinglun">
<u-icon name="more-circle-fill" color="#ffffff" :size="50" @click="editing()"></u-icon>
<text>{{item.comment_num}}</text>
</view>
<view class="gouwu">
<image></image>
<!-- 购物车 -->
<view class="operat gouwu">
<u-icon name="shopping-cart-fill" :color=" is_cart ? '#FF7807' : '#ffffff' " :size="50" @click="carting()"></u-icon>
</view>
</view>
</template>
<style lang="scss" scoped>
image{
background-color: #0f0;
}
.userinfo{
width: 110rpx;
height: 570rpx;
@@ -32,53 +34,110 @@ image{
flex-direction: column;
justify-content: space-between;
align-items: center;
>view{
display: flex;
flex-direction: column;
align-items: center;
font-size: 28rpx;
color: #fff;
>text{
margin-top: 17rpx;
}
>image{
width: 50rpx;
height: 50rpx;
}
}
>view:first-child{
.userhead{
position: relative;
display: flex;
position: relative;
align-items: center;
>image{
width: 110rpx;
height: 110rpx;
border-radius: 50%;
border: 2rpx solid #fff;
}
>text{
width: 36rpx;
height: 36rpx;
font-size: 36rpx;
background-color: #FF780F;
position: absolute;
top: 75rpx;
border-radius: 50%;
line-height: 36rpx;
text-align: center;
}
&>image{
width: 110rpx;
height: 110rpx;
border-radius: 50%;
border: 2rpx solid #fff;
}
.follow {
position: absolute;
top: 90rpx;
left: 35%;
width: 36rpx;
height: 36rpx;
text-align: center;
line-height: 36rpx;
font-size: 36rpx;
border-radius: 50%;
color: #fff;
background-color: #FF780F;
}
}
.operat {
display: flex;
align-items: center;
flex-direction: column;
& > text {
margin-top: 10rpx;
font-size: 28rpx;
color: #fff;
}
}
}
</style>
<script>
export default {
name:'userinfo',
props:['list','cart'],
data(){
return {
is_follow: this.list.is_attention || false,
is_like: this.list.is_like || false,
is_collect: this.list.is_collect || false,
is_content: false,
is_cart: this.cart || false,
item: this.list || []
}
},
props:['list']
watch: {
list(newValue,old) {
console.log(newValue,old);
},
cart(newValue,old) {
// console.log(newValue,old);
this.is_cart = newValue;
},
deep: true
},
methods: {
// 关注
following(id) {
this.is_follow = !this.is_follow;
this.$u.api.attentionMember({member_id: id}).then(res => {
if (res.errCode == 0) {
this.$u.toast(res.message);
}
})
},
// 点赞
likeType(id) {
// console.log(id);
this.is_like = !this.is_like;
this.$u.post("article/articleLike",{article_id: id}).then(res => {
if (res.errCode == 0) {
// console.log(res);
this.list.like_num = res.data.num;
} else {
this.$u.toast(res.message);
}
})
},
// 收藏
collecting(id) {
this.is_collect = !this.is_collect;
this.$u.post("article/articleCollect",{article_id: id}).then(res => {
if (res.errCode == 0) {
// console.log(res);
this.list.collect_num = res.data.num;
} else {
this.$u.toast(res.message);
}
})
},
// 评论
editing() {},
// 购物车
carting() {
this.is_cart = !this.is_cart;
// console.log(this.is_cart);
this.$emit("openCart",this.is_cart);
},
}
}
</script>