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