|
|
@@ -49,18 +49,18 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="consult-content">
|
|
|
- <div class="consult-list-wrapper">
|
|
|
+ <div class="consult-list-wrapper" v-if="consultList.length">
|
|
|
<a
|
|
|
class="consult-item"
|
|
|
v-for="item in consultList"
|
|
|
:key="item.uid"
|
|
|
- href="">
|
|
|
+ :href="`/frontend/consult/detail/${item.uid}`">
|
|
|
<div class="owner-info">
|
|
|
<img :src="item.avatar" class="avatar" alt="avatar">
|
|
|
<div class="owner-content">
|
|
|
<div class="nickname">{{ item.nickname }}</div>
|
|
|
<div class="company">{{ item.company }} {{ item.title }}</div>
|
|
|
- <div class="price">¥<span>起</span></div>
|
|
|
+ <div class="price">¥{{ item.zxPriceMin }}<span>起</span></div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="consult-info">
|
|
|
@@ -72,28 +72,82 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="stats-info">
|
|
|
- <div><span class="num">{{ item.zxTotalNum }}</span> 人咨询过</div>
|
|
|
- <div class="line"></div>
|
|
|
- <div>响应率:<span class="rate">高</span></div>
|
|
|
+ <div v-if="item.zxTotalNum"><span class="num">{{ item.zxTotalNum }}</span> 人咨询过</div>
|
|
|
+ <div v-if="item.zxTotalNum && item.zxRating" class="line"></div>
|
|
|
+ <div v-if="item.zxRating">响应率:<span class="rate">高</span></div>
|
|
|
</div>
|
|
|
</a>
|
|
|
</div>
|
|
|
- <div class="pagination-wrapper" v-if="pagination.total > pagination.pagesize">
|
|
|
+ <div class="result-empty-wrapper" v-else>
|
|
|
+ <img src="@/assets/img/common/empty@2x.png" alt="empty">
|
|
|
+ <span>暂无搜索内容</span>
|
|
|
+ </div>
|
|
|
+ <div class="pagination-wrapper" v-if="pagination.pageCount > 1">
|
|
|
<el-pagination
|
|
|
background
|
|
|
layout="prev, pager, next"
|
|
|
:current-page="pagination.page"
|
|
|
- :total="pagination.total"
|
|
|
- :page-size="pagination.pagesize"
|
|
|
+ :page-count="pagination.pageCount"
|
|
|
@current-change="handlePageChange">
|
|
|
</el-pagination>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="consult-wrapper-mobile" v-else>
|
|
|
- <div class="filter-wrapper" @click="handleClickFilter">
|
|
|
- <span>筛选</span>
|
|
|
- <img src="@/assets/img/skill/arrow-down@2x.png" alt="arrow">
|
|
|
+ <div class="consult-category">
|
|
|
+ <div class="consult-category-one">
|
|
|
+ <div class="category-scroller">
|
|
|
+ <div
|
|
|
+ class="consult-category-one-item"
|
|
|
+ :class="!pagination.selectedCateIdOne ? 'active' : ''"
|
|
|
+ @click="handleClickCategoryOne(0)">
|
|
|
+ 全部
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ class="consult-category-one-item"
|
|
|
+ :class="pagination.selectedCateIdOne == category.value ? 'active' : ''"
|
|
|
+ v-for="(category) in consultCate"
|
|
|
+ :key="`category-one-${category.value}`"
|
|
|
+ @click="handleClickCategoryOne(category.value)">
|
|
|
+ {{ category.label }}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- filter -->
|
|
|
+ <div class="filter-bg"></div>
|
|
|
+ <div class="filter-wrapper" @click="handleShowCategoryDrawer">
|
|
|
+ <img src="@/assets/img/works/filter-icon@2x.png" alt="filter">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="consult-category-two">
|
|
|
+ <!-- 全部二级分类 -->
|
|
|
+ <div
|
|
|
+ class="consult-category-two-wrapper"
|
|
|
+ v-show="!pagination.selectedCateIdOne">
|
|
|
+ <div
|
|
|
+ class="consult-category-two-item"
|
|
|
+ :class="pagination.selectedCateIdTwo == category.value ? 'active' : ''"
|
|
|
+ v-for="category in consultCateAll"
|
|
|
+ :key="`category-all-${category.value}`"
|
|
|
+ @click="handleClickCategoryTwo(category.value)">
|
|
|
+ {{ category.label }}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- 接口返回的二级分类 -->
|
|
|
+ <div
|
|
|
+ class="consult-category-two-wrapper"
|
|
|
+ v-for="(category) in consultCate"
|
|
|
+ :key="`category-two-wrapper-${category.value}`"
|
|
|
+ v-show="pagination.selectedCateIdOne === category.value">
|
|
|
+ <div
|
|
|
+ class="consult-category-two-item"
|
|
|
+ :class="pagination.selectedCateIdTwo == categoryChild.value ? 'active' : ''"
|
|
|
+ v-for="categoryChild in category.children"
|
|
|
+ :key="`category-two-${categoryChild.value}`"
|
|
|
+ @click="handleClickCategoryTwo(categoryChild.value)">
|
|
|
+ {{ categoryChild.label }}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div class="consult-list" :class="showWxHeader ? 'consult-list__showWxHeader' : ''">
|
|
|
<ul
|
|
|
@@ -101,24 +155,40 @@
|
|
|
v-infinite-scroll="handleLoadMoreConsult"
|
|
|
:infinite-scroll-disabled="pagination.noMore"
|
|
|
:infinite-scroll-immediate="false">
|
|
|
- <a
|
|
|
+ <div
|
|
|
class="consult-item"
|
|
|
v-for="item in consultList"
|
|
|
- :key="item.sale_id"
|
|
|
- :href="`/frontend/consult/detail/${item.sale_id}`">
|
|
|
- <img class="cover" :src="item.coverImage" alt="consultCover,cover">
|
|
|
- <div class="owner-wrapper">
|
|
|
- <img class="avatar" :src="item.user.icon_url" alt="avatar">
|
|
|
- <div class="nickname">{{ item.user.nickname }}</div>
|
|
|
+ :key="item.uid"
|
|
|
+ @click="handleClickConsultItem(item.uid)">
|
|
|
+ <div class="owner-content">
|
|
|
+ <img class="avatar" :src="item.avatar" alt="avatar">
|
|
|
+ <div class="owner-info">
|
|
|
+ <div class="nickname">{{ item.nickname }}</div>
|
|
|
+ <div class="company">{{ item.company }} {{ item.title }}</div>
|
|
|
+ <div class="price">¥{{ item.zxPriceMin }}<span>起</span></div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="consult-info">
|
|
|
+ <div
|
|
|
+ class="consult-info-item"
|
|
|
+ v-for="(consultItem, index) in item.saleList"
|
|
|
+ :key="index">
|
|
|
+ · {{ consultItem.title }}
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- <div class="title">{{ item.title }}</div>
|
|
|
- <div class="price-wrapper">
|
|
|
- <div class="price-text">¥{{ item.price }}</div>
|
|
|
- <div class="right-info">{{ item.buy_num }}人已学习</div>
|
|
|
+ <div class="stats-info">
|
|
|
+ <div v-if="item.zxTotalNum"><span class="num">{{ item.zxTotalNum }}</span> 人咨询过</div>
|
|
|
+ <div v-if="item.zxTotalNum && item.zxRating" class="line"></div>
|
|
|
+ <div v-if="item.zxRating">响应率:<span class="rate">高</span></div>
|
|
|
</div>
|
|
|
- </a>
|
|
|
+ </div>
|
|
|
+ <!-- 空数据 -->
|
|
|
+ <div class="result-empty-wrapper" v-if="!consultList.length && !pagination.loading">
|
|
|
+ <img src="@/assets/img/common/empty@2x.png" alt="empty">
|
|
|
+ <span>暂无搜索内容</span>
|
|
|
+ </div>
|
|
|
<p v-if="pagination.loading" class="consult-list-tips">加载中...</p>
|
|
|
- <p v-if="pagination.noMore" class="consult-list-tips">没有更多了</p>
|
|
|
+ <p v-if="consultList.length && pagination.noMore" class="consult-list-tips">没有更多了</p>
|
|
|
</ul>
|
|
|
</div>
|
|
|
<!-- 弹出的分类选择 -->
|
|
|
@@ -257,25 +327,39 @@ export default {
|
|
|
_getConsultList () {
|
|
|
const self = this
|
|
|
const data = {
|
|
|
- type: 1,
|
|
|
page: this.pagination.page,
|
|
|
- page_size: this.pagination.pagesize,
|
|
|
- cate_id: this.pagination.selectedCateIdTwo,
|
|
|
- status: 2,
|
|
|
- owner_type: 1
|
|
|
+ sale_zx_open: 1,
|
|
|
+ cate_id_two_zx: this.pagination.selectedCateIdTwo || ''
|
|
|
}
|
|
|
|
|
|
this.pagination.loading = true
|
|
|
this.pagination.noMore = false
|
|
|
|
|
|
- this.$axios.$post('/api/sale/saleList', data).then(res => {
|
|
|
+ this.$axios.$post('https://dev.test.proginn.com/api/user_list/list', data).then(res => {
|
|
|
if (Number(res.status) === 1) {
|
|
|
let consultList = res.data.list || []
|
|
|
- consultList.forEach((item) => {
|
|
|
- let imageList = item.image.split(',')
|
|
|
- item.coverImage = imageList[0] || ''
|
|
|
- imageList.splice(0, 1)
|
|
|
- item.imageList = imageList
|
|
|
+ consultList = consultList.map(item => {
|
|
|
+ let zxRating = item.zx_rating || ''
|
|
|
+ let zxRatingText = ''
|
|
|
+ if (zxRating >= 0.7) {
|
|
|
+ zxRatingText = '高'
|
|
|
+ } else if (zxRating >= 0.3) {
|
|
|
+ zxRatingText = '一般'
|
|
|
+ } else {
|
|
|
+ zxRatingText = '较慢'
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ uid: item.uid || '',
|
|
|
+ nickname: item.nickname || '',
|
|
|
+ avatar: item.icon_url || '',
|
|
|
+ lineStatus: item.lineStatus || '',
|
|
|
+ company: item.company || '',
|
|
|
+ title: item.title || '',
|
|
|
+ saleList: item.sale_list || [],
|
|
|
+ zxTotalNum: item.zx_total_num || 0,
|
|
|
+ zxRating: item.zx_rating || '',
|
|
|
+ zxPriceMin: item.zx_price_min || '0.00'
|
|
|
+ }
|
|
|
})
|
|
|
|
|
|
if (self.mobile) {
|
|
|
@@ -284,15 +368,17 @@ export default {
|
|
|
self.consultList = consultList
|
|
|
}
|
|
|
|
|
|
- self.pagination.total = res.data.total
|
|
|
- self.pagination.pagesize = res.data.page_size || 9
|
|
|
- if (self.pagination.page * self.pagination.pagesize >= self.pagination.total) {
|
|
|
- console.log('noMore true', self.pagination)
|
|
|
- self.pagination.noMore = true
|
|
|
+ this.pagination.total = res.data.total
|
|
|
+ this.pagination.pageCount = res.data.pages
|
|
|
+ // 当前页码 大于等于 页面总数:已加载所有数据
|
|
|
+ if (this.pagination.page >= this.pagination.pageCount) {
|
|
|
+ this.pagination.noMore = true
|
|
|
} else {
|
|
|
- console.log('noMore false', self.pagination)
|
|
|
- self.pagination.noMore = false
|
|
|
+ this.pagination.noMore = false
|
|
|
}
|
|
|
+ } else {
|
|
|
+ // 查询错误时
|
|
|
+ this.pagination.noMore = true
|
|
|
}
|
|
|
}).then(() => {
|
|
|
self.pagination.loading = false
|
|
|
@@ -329,10 +415,30 @@ export default {
|
|
|
* 点击 mobile 分类 drawer 一级分类
|
|
|
*/
|
|
|
handleClickDrawerCategoryOne (id) {
|
|
|
+ console.log(id)
|
|
|
+ if (id === 0) {
|
|
|
+ this.showCategoryDrawer = false
|
|
|
+ return
|
|
|
+ }
|
|
|
if (id !== this.currentDrawerCategoryIndex) {
|
|
|
this.currentDrawerCategoryIndex = id
|
|
|
}
|
|
|
},
|
|
|
+ /** 点击二级分类时:移动端 */
|
|
|
+ handleClickCategoryTwo (id) {
|
|
|
+ if (this.pagination.selectedCateIdTwo === id) {
|
|
|
+ this.pagination.selectedCateIdTwo = ''
|
|
|
+ this.currentDrawerCategoryId = ''
|
|
|
+ } else {
|
|
|
+ this.pagination.selectedCateIdTwo = id
|
|
|
+ this.currentDrawerCategoryId = id
|
|
|
+ }
|
|
|
+ this.pagination.page = 1
|
|
|
+ this.consultList = []
|
|
|
+ window.scroll({ top: 0 })
|
|
|
+
|
|
|
+ this._getConsultList()
|
|
|
+ },
|
|
|
/**
|
|
|
* 点击 mobile 分类 drawer 二级分类
|
|
|
*/
|
|
|
@@ -349,6 +455,23 @@ export default {
|
|
|
window.scroll({ top: 0 })
|
|
|
|
|
|
this._getConsultList()
|
|
|
+ },
|
|
|
+ /** 点击筛选时 */
|
|
|
+ handleShowCategoryDrawer () {
|
|
|
+ this.showCategoryDrawer = true
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 点击 mobile 的一项咨询服务时
|
|
|
+ */
|
|
|
+ handleClickConsultItem (uid) {
|
|
|
+ if (this.deviceType.android || this.deviceType.ios) {
|
|
|
+ // 端跳转
|
|
|
+ let jumpUrl = `${this.baseUrl}/frontend/consult/detail/${uid}`
|
|
|
+ location.href = `proginn://webview?url=${jumpUrl}`
|
|
|
+ } else {
|
|
|
+ // web 跳转
|
|
|
+ location.href = `/frontend/consult/detail/${uid}`
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|