Merge branch 'master' of gitee.com:beijing_hongye_huicheng/lilishop-ui

master
Yer 2023-09-05 11:28:26 +08:00
commit 4b635735ae
1 changed files with 57 additions and 34 deletions

View File

@ -1,9 +1,10 @@
<template>
<div class="wrapper">
<card _Title="近期收藏" :_Tabs="favoriteWay" @_Change="change" :_Size="16" v-if="!homePage"/>
<card _Title="近期收藏" :_Size="16" :_Tabs="favoriteWay" @_Change="change" _More="全部收藏" _Src="/home/Favorites" v-else></card>
<card _Title="近期收藏" :_Tabs="favoriteWay" @_Change="change" :_Size="16" v-if="!homePage" />
<card _Title="近期收藏" :_Size="16" :_Tabs="favoriteWay" @_Change="change" _More="全部收藏" _Src="/home/Favorites" v-else>
</card>
<div v-if="list.length">
<template v-for="(item) in list">
<div v-for="(item, index) in list" :key="index">
<div class="goodsItem" :key="item.skuId">
<div class="goodsImg hover-pointer" v-if="params.type === 'GOODS'">
<img :src="item.image" />
@ -11,24 +12,26 @@
<div class="goodsImg hover-pointer" v-else>
<img :src="item.storeLogo" />
</div>
<div class="goodsTitle hover-color" v-if="params.type === 'GOODS'" @click="buynow(item.skuId, item.goodsId)">
{{item.goodsName}}
<div class="goodsTitle hover-color" v-if="params.type === 'GOODS'" @click="buynow(item.skuId, item.goodsId,item.id)">
{{ item.goodsName }}
</div>
<div v-else class="goodsTitle hover-pointer">
{{item.storeName}}
<div v-else class="goodsTitle hover-pointer" @click="buynow(item.skuId, item.goodsId,item.id)" >
{{ item.storeName }}
<Tag color="error" class="operated" v-if="item.selfOperated"></Tag>
</div>
<div class="goodsPrice">
<span v-if="params.type === 'GOODS'">{{item.price | unitPrice('')}}</span>
<Tag color="error" v-if="item.selfOperated"></Tag>
<span v-if="params.type === 'GOODS'">{{ item.price | unitPrice('') }}</span>
</div>
<div class="goodsBuy">
<Button size="small" type="primary" @click="buynow(item.skuId, item.goodsId)" v-if="params.type === 'GOODS'"></Button>
<Button size="small" type="primary" @click="buynow(item.skuId, item.goodsId)"
v-if="params.type === 'GOODS'">立即购买</Button>
<Button size="small" type="primary" @click="goShop(item.id)" v-else></Button>
<Button size="small" v-if="params.type === 'GOODS'" @click="cancel(item.skuId)"></Button>
<Button size="small" v-if="params.type === 'STORE'" @click="cancelStore(item.id)"></Button>
</div>
</div>
</template>
</div>
<Spin size="large" fix v-if="spinShow"></Spin>
</div>
<empty v-else />
@ -36,7 +39,7 @@
</template>
<script>
import { collectList, cancelCollect,storeCollectList,cancelStoreCollect} from '@/api/member.js'
import { collectList, cancelCollect, storeCollectList, cancelStoreCollect } from '@/api/member.js'
export default {
name: 'Favorites',
props: {
@ -45,7 +48,7 @@ export default {
default: false
}
},
data () {
data() {
return {
favoriteWay: ['收藏商品', '收藏店铺'], //
list: [], //
@ -60,25 +63,25 @@ export default {
},
methods: {
getList () { //
getList() { //
this.spinShow = true
collectList(this.params).then(res => {
this.spinShow = false
if (res.success) this.list = res.result.records;
})
},
getStoreList () { //
getStoreList() { //
this.spinShow = true
storeCollectList(this.params).then(res => {
this.spinShow = false
if (res.success) this.list = res.result.records;
})
},
change (index) { // tab
if (index === 0) { this.params.type = 'GOODS',this.getList()}
if (index === 1) { this.params.type = 'STORE',this.getStoreList()}
change(index) { // tab
if (index === 0) { this.params.type = 'GOODS', this.getList() }
if (index === 1) { this.params.type = 'STORE', this.getStoreList() }
},
cancel (id) { //
cancel(id) { //
let typeName = this.params.type === 'GOODS' ? '商品' : '店铺'
this.$Modal.confirm({
title: 'Title',
@ -92,7 +95,7 @@ export default {
}
});
},
cancelStore (id) { //
cancelStore(id) { //
let typeName = this.params.type === 'GOODS' ? '商品' : '店铺'
this.$Modal.confirm({
title: 'Title',
@ -106,22 +109,33 @@ export default {
}
});
},
buynow (skuId, goodsId) { //
let url = this.$router.resolve({
path: '/goodsDetail',
query: {skuId, goodsId}
})
buynow(skuId, goodsId,storeId) { //
console.log(this.params.type)
let url
if (this.params.type === 'STORE') {
url = this.$router.resolve({
path: '/Merchant',
query: { 'id': storeId }
})
} else {
url = this.$router.resolve({
path: '/goodsDetail',
query: { skuId, goodsId }
})
}
window.open(url.href, '_blank')
},
goShop (id) { //
goShop(id) { //
let url = this.$router.resolve({
path: '/merchant',
query: {id}
query: { id }
})
window.open(url.href, '_blank')
}
},
mounted () {
mounted() {
if (this.homePage) this.params.pageSize = 5;
this.getList()
@ -137,46 +151,55 @@ export default {
.goodsTitle {
margin: 0 6px;
}
.operated {
margin-left: 10px;
}
.wrapper {
margin-bottom: 40px;
}
.goodsItem {
display: flex;
height: 60px;
line-height: 60px;
margin-bottom: 10px;
> .goodsImg {
>.goodsImg {
width: 60px;
height: 60px;
overflow: hidden;
> img {
>img {
width: 100%;
height: 100%;
}
}
> .goodsPrice,
>.goodsPrice,
.goodsShop {
width: 150px;
text-align: center;
}
> .goodsTitle {
>.goodsTitle {
width: 400px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
.goodsBuy {
margin-left: 80px;
>*{
>* {
margin: 0 4px;
}
}
.page-size{
.page-size {
text-align: right;
}
</style>