滚动请求

master
2022-12-28 14:54:57 +08:00
parent 61c44af5a0
commit 84d3dd247d
4 changed files with 275 additions and 222 deletions

View File

@ -1,20 +1,20 @@
<template> <template>
<el-tabs v-model="activeName" @tab-click="handleClick" type="card"> <el-tabs v-model="activeName" @tab-click="handleClick" type="card">
<el-tab-pane :label="toUser.storeFlag ? '想要咨询' : '他的足迹'" name="history"> <el-tab-pane :label="toUser.storeFlag ? '正在咨询' : '他的足迹'" name="history">
<div style="margin-left: 12px;" v-if="toUser.storeFlag"> <div style="margin-left: 12px;" v-if="toUser.storeFlag">
<GoodsLink :goodsDetail="goodsDetail" v-if="toUser.userId === goodsDetail.storeId"/> <GoodsLink :goodsDetail="goodsDetail" v-if="toUser.userId === goodsDetail.storeId" />
<FootPrint :list="footPrintList"/> <FootPrint :list="footPrintList" @loadMore="loadMoreFootPrint()" />
</div> </div>
<div v-else> <div v-else>
</div> </div>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="店铺信息" name="UserInfo" v-if="toUser.storeFlag"> <el-tab-pane label="店铺信息" name="UserInfo" v-if="toUser.storeFlag">
<div v-if="toUser.storeFlag"> <div v-if="toUser.storeFlag">
<StoreDetail :storeInfo="storeInfo"/> <StoreDetail :storeInfo="storeInfo" />
</div> </div>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</template> </template>
<script> <script>
@ -25,106 +25,114 @@ import StoreDetail from "@/components/chat/panel/template/storeDetail.vue";
import FootPrint from "@/components/chat/panel/template/footPrint.vue"; import FootPrint from "@/components/chat/panel/template/footPrint.vue";
import GoodsLink from "@/components/chat/panel/template/goodsLink.vue"; import GoodsLink from "@/components/chat/panel/template/goodsLink.vue";
export default { export default {
components: { components: {
"el-tabs": Tabs, "el-tabs": Tabs,
"el-tab-pane": TabPane, "el-tab-pane": TabPane,
StoreDetail, StoreDetail,
FootPrint, FootPrint,
GoodsLink GoodsLink
},
props: {
toUser: {
type: Object,
default: null,
}, },
props: { id: {
toUser: { type: String,
type: Object, default: '',
default: null,
},
id: {
type: String,
default: '',
},
goodsParams: {
type: Object,
default: null,
},
}, },
data() { goodsParams: {
return { type: Object,
activeName: 'history', default: null,
storeInfo: {}, //
memberInfo: {}, //
footPrintParams: {
memberId: '',
storeId: '',
},
goodsDetail: {},
footPrintList: [],
}
}, },
mounted() { },
console.log(this.id) data () {
console.log(this.toUser) return {
if(this.toUser.storeFlag){ activeName: 'history',
this.getStoreDetail() storeInfo: {}, //
}else{ memberInfo: {}, //
this.getMemberDetail() footPrintParams: {
} pageSize: 10,
this.getFootPrint() pageNumber: 1,
if(this.goodsParams){ memberId: '',
this.getGoodsDetail() storeId: '',
} },
}, goodsDetail: {},
methods: { footPrintList: [],
getStoreDetail() {
ServeGetStoreDetail(this.toUser.userId).then(res => {
if (res.success) {
this.storeInfo = res.result
}
})
},
handleClick(){},
getMemberDetail() {
ServeGetUserDetail(this.toUser.userId).then(res => {
if (res.success) {
this.memberInfo = res.result
}
})
},
getGoodsDetail(){
ServeGetGoodsDetail(this.goodsParams).then(res => {
if(res.success){
this.goodsDetail = res.result.data
}
})
},
getFootPrint(){
if(this.toUser.storeFlag){
this.footPrintParams.memberId = this.id
this.footPrintParams.storeId = this.toUser.userId
}else{
this.footPrintParams.memberId = this.toUser.userId
this.footPrintParams.storeId = this.id
}
console.log(this.footPrintParams)
ServeGetFootPrint(this.footPrintParams).then(res => {
res.result.records.forEach((item,index) => {
if(item.goodsId === this.goodsParams.goodsId){
res.result.records.splice(index,1)
}
});
this.footPrintList = res.result.records
})
//
},
} }
},
mounted () {
console.log(this.id)
console.log(this.toUser)
if (this.toUser.storeFlag) {
this.getStoreDetail()
} else {
this.getMemberDetail()
}
this.getFootPrint()
if (this.goodsParams) {
this.getGoodsDetail()
}
},
methods: {
getStoreDetail () {
ServeGetStoreDetail(this.toUser.userId).then(res => {
if (res.success) {
this.storeInfo = res.result
}
})
},
loadMoreFootPrint (e) {
//
this.footPrintParams.pageNumber++
this.getFootPrint()
},
handleClick () { },
getMemberDetail () {
ServeGetUserDetail(this.toUser.userId).then(res => {
if (res.success) {
this.memberInfo = res.result
}
})
},
getGoodsDetail () {
ServeGetGoodsDetail(this.goodsParams).then(res => {
if (res.success) {
this.goodsDetail = res.result.data
}
})
},
getFootPrint () {
if (this.toUser.storeFlag) {
this.footPrintParams.memberId = this.id
this.footPrintParams.storeId = this.toUser.userId
} else {
this.footPrintParams.memberId = this.toUser.userId
this.footPrintParams.storeId = this.id
}
ServeGetFootPrint(this.footPrintParams).then(res => {
res.result.records.forEach((item, index) => {
if (item.goodsId === this.goodsParams.goodsId) {
res.result.records.splice(index, 1)
}
});
console.log(this.footPrintParams, 'this.footPrintParamsthis.footPrintParamsthis.footPrintParams');
this.footPrintList.push(...res.result.records)
})
//
},
}
} }
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
/deep/ .el-tabs__nav { /deep/ .el-tabs__nav {
height: 60px; height: 60px;
line-height: 60px; line-height: 60px;
} }
/deep/ .el-tab-pane { /deep/ .el-tab-pane {
margin-left: 12px; margin-left: 12px;
} }
</style> </style>

View File

@ -1,78 +1,125 @@
<template> <template>
<div> <div class="box" @scroll="scrollBottom">
最近浏览 <div class="tab">
<dl> <el-tabs v-model="activeName" @tab-click="handleClick">
<dd v-for="item in list" v-infinite-scroll="loadMore()"> <el-tab-pane label="最近浏览" name="first"></el-tab-pane>
<div class="base" @click="linkToGoods(item.goodsId,item.id)"> </el-tabs>
<div>
<img :src="item.thumbnail" class="image" />
</div>
<div style="margin-left: 13px">
<a>{{ item.goodsName }}</a>
<div>
<span style="color: red;">{{ item.price }}</span>
</div>
</div>
</div>
</dd>
</dl>
</div> </div>
<dl>
<dd v-for="item in list" v-infinite-scroll="loadMore">
<div class="base" @click="linkToGoods(item.goodsId, item.id)">
<div>
<img :src="item.thumbnail" class="image" />
</div>
<div style="margin-left: 13px">
<a>{{ item.goodsName }}</a>
<div>
<span style="color: red;">{{ item.price }}</span>
</div>
</div>
</div>
</dd>
</dl>
</div>
</template> </template>
<script> <script>
import { Tag, button } from 'element-ui' import { Tag, button, Tabs, TabPane, InfiniteScroll } from 'element-ui'
export default { export default {
data() { directives: {
return { "infinite-scroll": InfiniteScroll,
} },
data () {
return {
activeName: 'first'
}
},
components: {
"el-tag": Tag,
"el-button": button,
"el-tabs": Tabs,
"el-tab-pane": TabPane,
},
methods: {
scrollBottom (e) {
const { scrollTop, scrollHeight, clientHeight } = e.srcElement
if (scrollTop + clientHeight >= scrollHeight) {
if (this.noMore) return
this.$emit('loadMore')
}
}, },
components: { loadMore () {
"el-tag": Tag,
"el-button": button,
}, },
methods:{ handleClick (tab, event) {
loadMore(){ console.log(tab, event);
this.$emit('loadMore') }
}, },
}, props: {
props: { list: {
list: { type: Array,
type: Array, default: [],
default: [],
},
}, },
},
mounted () {
console.log(this.list, 'list');
}
} }
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
/deep/ .el-tabs__item.is-top:last-child {
color: black;
}
/deep/.el-tabs__active-bar {
background-color: #f23030;
}
/deep/ .el-tabs__nav.is-top {
height: 50px;
}
.tab {
display: flex;
justify-content: center;
align-items: center;
}
.box {
height: 500px;
overflow: auto;
width: 350px;
}
.store-button { .store-button {
background-color: white; background-color: white;
border-color: #F56C6C; border-color: #F56C6C;
} }
.base { .base {
margin-top: 5px; margin-top: 5px;
height: 120px; height: 120px;
display: flex; display: flex;
div { div {
overflow: hidden; overflow: hidden;
text-overflow:ellipsis; text-overflow: ellipsis;
margin-top: 8px; margin-top: 8px;
white-space: nowrap; white-space: nowrap;
margin-top: 4px; margin-top: 4px;
} }
.image { .image {
height: 100px; height: 100px;
margin-top: 3px; margin-top: 3px;
width: 100px width: 100px
} }
} }
.separate { .separate {
margin-top: 8px; margin-top: 8px;
} }
</style> </style>

View File

@ -1,5 +1,5 @@
<template> <template>
<div> <div style="width: 350px;">
当前浏览 当前浏览
<div class="base"> <div class="base">
<div> <div>
@ -158,11 +158,7 @@ export default {
height: 120px; height: 120px;
display: flex; display: flex;
<<<<<<< HEAD div { div {
margin-top: 8px;
}
=======div {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
margin-top: 8px; margin-top: 8px;
@ -170,7 +166,7 @@ export default {
margin-top: 8px; margin-top: 8px;
} }
>>>>>>>aa4dbc1bbd212aedbdfbecefb3f5f977aec0cc14 .image { .image {
height: 100px; height: 100px;
margin-top: 3px; margin-top: 3px;
width: 100px width: 100px

View File

@ -1,75 +1,77 @@
<template> <template>
<div> <div style="width: 362px;">
<div class="base" > <div class="base">
<div> <div>
<img :src="storeInfo.storeLogo" class="image"/> <img :src="storeInfo.storeLogo" class="image" />
</div> </div>
<div style="margin-left: 13px"> <div style="margin-left: 13px">
<div class="div-zoom"> <div class="div-zoom">
{{ storeInfo.storeName }} {{ storeInfo.storeName }}
<el-tag type="danger" v-if=" storeInfo.selfOperated " size="mini"></el-tag> <el-tag type="danger" v-if="storeInfo.selfOperated" size="mini"></el-tag>
</div>
<div>
联系方式: {{ storeInfo.memberName }}
</div>
<div>
<el-button class="store-button" type="danger" @click="linkToStore(storeInfo.id)" size="mini" plain >进入店铺</el-button>
</div>
</div>
</div> </div>
<hr class="separate"/> <div>
<div class="separate">店铺评分: <span>{{ storeInfo.serviceScore }}</span></div> 联系方式: {{ storeInfo.memberName }}
<div class="separate">服务评分: <span>{{ storeInfo.descriptionScore }}</span></div> </div>
<div class="separate">物流评分: <span>{{ storeInfo.deliveryScore }}</span></div> <div>
<el-button class="store-button" type="danger" @click="linkToStore(storeInfo.id)" size="mini"
plain>进入店铺</el-button>
</div>
</div>
</div> </div>
<hr class="separate" />
<div class="separate">店铺评分: <span>{{ storeInfo.serviceScore }}</span></div>
<div class="separate">服务评分: <span>{{ storeInfo.descriptionScore }}</span></div>
<div class="separate">物流评分: <span>{{ storeInfo.deliveryScore }}</span></div>
</div>
</template> </template>
<script> <script>
import { Tag,button } from 'element-ui' import { Tag, button } from 'element-ui'
export default { export default {
data() { data () {
return { return {
} }
}, },
components: { components: {
"el-tag": Tag, "el-tag": Tag,
"el-button": button, "el-button": button,
}, },
methods:{ methods: {
}, },
props: { props: {
storeInfo: { storeInfo: {
type: Object, type: Object,
default: null, default: null,
},
}, },
},
} }
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
.store-button{ .store-button {
background-color: white; background-color: white;
border-color: #F56C6C; border-color: #F56C6C;
} }
.base{ .base {
margin-top: 5px; margin-top: 5px;
height: 120px; height: 120px;
display: flex; display: flex;
div { div {
margin-top: 8px; margin-top: 8px;
} }
.image{ .image {
height: 100px; height: 100px;
margin-top: 3px; margin-top: 3px;
width: 100px width: 100px
} }
} }
.separate{
margin-top: 8px; .separate {
} margin-top: 8px;
}
</style> </style>