web/im/src/components/chat/panel/OtherLink.vue

138 lines
3.5 KiB
Vue
Raw Normal View History

2022-12-28 10:08:51 +08:00
<template>
2022-12-28 14:54:57 +08:00
<el-tabs v-model="activeName" @tab-click="handleClick" type="card">
<el-tab-pane :label="toUser.storeFlag ? '正在咨询' : '他的足迹'" name="history">
<div style="margin-left: 12px;" v-if="toUser.storeFlag">
<GoodsLink :goodsDetail="goodsDetail" v-if="toUser.userId === goodsDetail.storeId" />
<FootPrint :list="footPrintList" @loadMore="loadMoreFootPrint()" />
</div>
<div v-else>
</div>
</el-tab-pane>
<el-tab-pane label="店铺信息" name="UserInfo" v-if="toUser.storeFlag">
<div v-if="toUser.storeFlag">
<StoreDetail :storeInfo="storeInfo" />
</div>
</el-tab-pane>
</el-tabs>
2022-12-28 10:08:51 +08:00
</template>
<script>
import { Tabs, TabPane } from 'element-ui'
import { ServeGetStoreDetail, ServeGetUserDetail, ServeGetFootPrint } from '@/api/user'
import { ServeGetGoodsDetail } from '@/api/goods'
import StoreDetail from "@/components/chat/panel/template/storeDetail.vue";
import FootPrint from "@/components/chat/panel/template/footPrint.vue";
import GoodsLink from "@/components/chat/panel/template/goodsLink.vue";
export default {
2022-12-28 14:54:57 +08:00
components: {
"el-tabs": Tabs,
"el-tab-pane": TabPane,
StoreDetail,
FootPrint,
GoodsLink
},
props: {
toUser: {
type: Object,
default: null,
},
id: {
type: String,
default: '',
2022-12-28 10:08:51 +08:00
},
2022-12-28 14:54:57 +08:00
goodsParams: {
type: Object,
default: null,
2022-12-28 10:08:51 +08:00
},
2022-12-28 14:54:57 +08:00
},
data () {
return {
activeName: 'history',
storeInfo: {}, //店铺信息
memberInfo: {}, //会员信息
footPrintParams: {
pageSize: 10,
pageNumber: 1,
memberId: '',
storeId: '',
},
goodsDetail: {},
footPrintList: [],
}
},
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
2022-12-28 10:08:51 +08:00
}
2022-12-28 14:54:57 +08:00
})
2022-12-28 10:08:51 +08:00
},
2022-12-28 14:54:57 +08:00
loadMoreFootPrint (e) {
//触底再次调接口
this.footPrintParams.pageNumber++
this.getFootPrint()
},
handleClick () { },
getMemberDetail () {
ServeGetUserDetail(this.toUser.userId).then(res => {
if (res.success) {
this.memberInfo = res.result
2022-12-28 10:08:51 +08:00
}
2022-12-28 14:54:57 +08:00
})
},
getGoodsDetail () {
ServeGetGoodsDetail(this.goodsParams).then(res => {
if (res.success) {
this.goodsDetail = res.result.data
2022-12-28 10:08:51 +08:00
}
2022-12-28 14:54:57 +08:00
})
2022-12-28 10:08:51 +08:00
},
2022-12-28 14:54:57 +08:00
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)
})
//删除掉刚加入的商品
},
}
2022-12-28 10:08:51 +08:00
}
</script>
<style scoped lang="less">
/deep/ .el-tabs__nav {
2022-12-28 14:54:57 +08:00
height: 60px;
line-height: 60px;
2022-12-28 10:08:51 +08:00
}
2022-12-28 14:54:57 +08:00
2022-12-28 10:08:51 +08:00
/deep/ .el-tab-pane {
2022-12-28 14:54:57 +08:00
margin-left: 12px;
2022-12-28 10:08:51 +08:00
}
</style>