|
|
|
@ -27,7 +27,7 @@
|
|
|
|
|
|
|
|
|
|
<view class="collectionGoods" v-if="collectProductList.length > 0"> |
|
|
|
|
<view class="item" v-for="(item, collectProductListIndex) in collectProductList" :key="collectProductListIndex" :data-index="collectProductListIndex" @touchstart="drawStart" @touchmove="drawMove" @touchend="drawEnd" :style="'right:' + item.right + 'rpx'"> |
|
|
|
|
<view class="info-box acea-row row-between-wrapper" @click="goGoodsCon(item)"> |
|
|
|
|
<view v-if="navType==0" class="info-box acea-row row-between-wrapper" @click="goGoodsCon(item)"> |
|
|
|
|
<view class="pictrue"> |
|
|
|
|
<image :src="item.image" /> |
|
|
|
|
</view> |
|
|
|
@ -40,11 +40,37 @@
|
|
|
|
|
<view class="money" v-else>¥{{ item.price }}</view> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="delete" @tap.stop="delCollection(collectProductListIndex)" :style="item.right?'right: -122rpx;':''">删除</view> |
|
|
|
|
<!-- 评测 --> |
|
|
|
|
<view v-else class="review-box acea-row row-between" @click="goEvaluation(item)"> |
|
|
|
|
<view class="left acea-row row-column-between"> |
|
|
|
|
<view class="acea-row row-column-between"> |
|
|
|
|
<view class="title"> |
|
|
|
|
BEJjjjjSII |
|
|
|
|
</view> |
|
|
|
|
<view class="title1"> |
|
|
|
|
OISJFSJIJ |
|
|
|
|
</view> |
|
|
|
|
<view class="title2"> |
|
|
|
|
给你电话和 |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
<view @tap.stop="goMore" class="more"> |
|
|
|
|
MORE |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="right"> |
|
|
|
|
<image src="../../../static/images/earth-white.png" mode=""></image> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
<view class="delete" @tap.stop="delCollection(collectProductListIndex)" :style="item.right?'right: -122rpx;':''" :class="{'del-height':navType==1}">删除</view> |
|
|
|
|
|
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<Loading :loaded="loadend" :loading="loading"></Loading> |
|
|
|
|
|
|
|
|
|
</view> |
|
|
|
@ -62,6 +88,7 @@
|
|
|
|
|
<script> |
|
|
|
|
import Recommend from '@/components/Recommend' |
|
|
|
|
import { getCollectUser, getCollectDel } from '@/api/user' |
|
|
|
|
import {delUserCollection} from '@/api/store.js' |
|
|
|
|
import Loading from '@/components/Loading' |
|
|
|
|
export default { |
|
|
|
|
name: 'GoodsCollection', |
|
|
|
@ -86,10 +113,10 @@ export default {
|
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
mounted: function() { |
|
|
|
|
this.get_user_collect_product() |
|
|
|
|
this.get_user_collect_product(this.navType) |
|
|
|
|
}, |
|
|
|
|
onReachBottom() { |
|
|
|
|
!this.loading && this.get_user_collect_product() |
|
|
|
|
!this.loading && this.get_user_collect_product(this.navType) |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
changeType(i) { |
|
|
|
@ -98,6 +125,7 @@ export default {
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
drawStart(e) { |
|
|
|
|
console.log(155555); |
|
|
|
|
var touch = e.touches[0]; |
|
|
|
|
// let index = e.currentTarget.dataset.index; |
|
|
|
|
for (var index in this.collectProductList) { |
|
|
|
@ -147,12 +175,32 @@ export default {
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
get_user_collect_product: function() { |
|
|
|
|
|
|
|
|
|
goEvaluation(item){ |
|
|
|
|
this.$yrouter.push({ |
|
|
|
|
// 跳转评测详情 |
|
|
|
|
path: 'pages/shop/Evaluations/EvaluationDetail/index', |
|
|
|
|
query: { id: item.pid }, |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
goMore(){ |
|
|
|
|
this.$yrouter.push({ |
|
|
|
|
// 跳转评测详情 |
|
|
|
|
path: 'pages/shop/Evaluations/index', |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
get_user_collect_product: function(navType,clear) { |
|
|
|
|
let that = this |
|
|
|
|
// if(clear){ |
|
|
|
|
// that.collectProductList=[] |
|
|
|
|
// that.page=1 |
|
|
|
|
// that.limit=20 |
|
|
|
|
// } |
|
|
|
|
if (that.loading) return //阻止下次请求(false可以进行请求); |
|
|
|
|
if (that.loadend) return //阻止结束当前请求(false可以进行请求); |
|
|
|
|
that.loading = true |
|
|
|
|
getCollectUser(that.page, that.limit, that.type).then(res => { |
|
|
|
|
if(navType===0){ |
|
|
|
|
getCollectUser(that.page, that.limit, that.type).then(res => { |
|
|
|
|
that.loading = false |
|
|
|
|
//apply();js将一个数组插入另一个数组; |
|
|
|
|
var arr = []; |
|
|
|
@ -167,13 +215,34 @@ export default {
|
|
|
|
|
that.loadend = res.data.length < that.limit //判断所有数据是否加载完成; |
|
|
|
|
that.page = that.page + 1 |
|
|
|
|
}) |
|
|
|
|
}else{ |
|
|
|
|
// 获取评测收藏 collectEvaluation/user |
|
|
|
|
getCollectEvaluation(that.page, that.limit, that.type).then(res => { |
|
|
|
|
that.loading = false |
|
|
|
|
//apply();js将一个数组插入另一个数组; |
|
|
|
|
var arr = []; |
|
|
|
|
for(var i in res.data){ |
|
|
|
|
res.data[i].right = 0; |
|
|
|
|
arr.push(res.data[i]) |
|
|
|
|
}; |
|
|
|
|
that.collectProductList.push.apply(that.collectProductList, arr) |
|
|
|
|
// this.collectProductList.forEach(val => { |
|
|
|
|
// val.right = 0; |
|
|
|
|
// }) |
|
|
|
|
that.loadend = res.data.length < that.limit //判断所有数据是否加载完成; |
|
|
|
|
that.page = that.page + 1 |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
//删除收藏; |
|
|
|
|
delCollection: function(index) { |
|
|
|
|
let that = this, |
|
|
|
|
id = that.collectProductList[index].pid, |
|
|
|
|
category = that.collectProductList[index].category |
|
|
|
|
getCollectDel(id, category).then(function() { |
|
|
|
|
|
|
|
|
|
if(that.navType===0){ |
|
|
|
|
getCollectDel(id, category).then(function() { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: '删除成功', |
|
|
|
|
icon: 'success', |
|
|
|
@ -184,11 +253,98 @@ export default {
|
|
|
|
|
}, |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
}else{ |
|
|
|
|
// 取消评测收藏 |
|
|
|
|
delUserCollection(id, category).then(function() { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: '删除成功', |
|
|
|
|
icon: 'success', |
|
|
|
|
duration: 2000, |
|
|
|
|
complete: () => { |
|
|
|
|
that.collectProductList.splice(index, 1) |
|
|
|
|
that.$set(that, 'collectProductList', that.collectProductList) |
|
|
|
|
}, |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
</script> |
|
|
|
|
<style lang="less" scoped> |
|
|
|
|
.review-box{ |
|
|
|
|
padding: 30rpx 30rpx 20rpx 30rpx; |
|
|
|
|
width: 687rpx; |
|
|
|
|
height: 250rpx; |
|
|
|
|
border-radius: 16rpx; |
|
|
|
|
background: #F5F6F8; |
|
|
|
|
box-shadow: 0rpx 10rpx 16rpx 0rpx rgba(0,0,0,0.15); |
|
|
|
|
.left{ |
|
|
|
|
max-width: 460rpx; |
|
|
|
|
|
|
|
|
|
.title{ |
|
|
|
|
font-size: 36rpx; |
|
|
|
|
font-weight: 500; |
|
|
|
|
text-transform: uppercase; |
|
|
|
|
} |
|
|
|
|
.title1{ |
|
|
|
|
margin: 10rpx 0 5rpx 0; |
|
|
|
|
font-size: 24rpx; |
|
|
|
|
text-transform: uppercase; |
|
|
|
|
} |
|
|
|
|
.title2{ |
|
|
|
|
font-size: 28rpx; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
.more{ |
|
|
|
|
font-size: 24rpx; |
|
|
|
|
position: relative; |
|
|
|
|
} |
|
|
|
|
.more::before{ |
|
|
|
|
position: absolute; |
|
|
|
|
border-bottom: 1rpx solid black; |
|
|
|
|
bottom: -8rpx; |
|
|
|
|
left: -4rpx; |
|
|
|
|
content: ''; |
|
|
|
|
width: 100rpx; |
|
|
|
|
background-color: black; |
|
|
|
|
height: 1rpx; |
|
|
|
|
} |
|
|
|
|
.more::after{ |
|
|
|
|
margin-left: 10rpx; |
|
|
|
|
content: ''; |
|
|
|
|
display: inline-block; |
|
|
|
|
width: 0; |
|
|
|
|
height: 0; |
|
|
|
|
border-top: 10rpx solid transparent; |
|
|
|
|
border-left: 10rpx solid black; |
|
|
|
|
border-bottom: 10rpx solid transparent; |
|
|
|
|
border-right: 10rpx solid transparent; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
.right{ |
|
|
|
|
image{ |
|
|
|
|
width: 200rpx; |
|
|
|
|
height: 100%; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.header { |
|
|
|
|
.tab-title { |
|
|
|
|
font-size: 32rpx; |
|
|
|
@ -304,5 +460,9 @@ export default {
|
|
|
|
|
text-align: center; |
|
|
|
|
text-shadow: 0rpx 10rpx 16rpx rgba(0,0,0,0.15); |
|
|
|
|
} |
|
|
|
|
.del-height{ |
|
|
|
|
height: 250rpx !important; |
|
|
|
|
line-height: 250rpx !important; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
</style> |
|
|
|
|