比价模式切换keyword+筛选弹窗品相去掉改为输入搜索
This commit is contained in:
parent
4722f20248
commit
a821e66961
@ -620,44 +620,20 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="popup-body">
|
<view class="popup-body">
|
||||||
<view class="filter-group">
|
<view class="filter-group">
|
||||||
<text class="group-title">品相</text>
|
|
||||||
<view class="tag-list">
|
|
||||||
<view
|
|
||||||
class="tag-item"
|
|
||||||
v-for="(item, index) in conditionList"
|
|
||||||
:key="'c'+index"
|
|
||||||
:class="{ active: filterCondition === item }"
|
|
||||||
@click="filterCondition = filterCondition === item ? '' : item"
|
|
||||||
>
|
|
||||||
<text class="tag-text">{{ item }}</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="filter-group" v-if="filterPublishers.length > 0">
|
|
||||||
<text class="group-title">出版社</text>
|
<text class="group-title">出版社</text>
|
||||||
<view class="tag-list">
|
<input class="filter-search-input" v-model="filterPress" placeholder="输入出版社名称筛选" @input="onFilterPressInput" />
|
||||||
<view
|
<view class="filter-suggest" v-if="filterPress && filterPressSuggestions.length > 0">
|
||||||
class="tag-item"
|
<view class="suggest-item" v-for="(item, idx) in filterPressSuggestions" :key="'ps'+idx" @click="selectFilterPress(item)">
|
||||||
v-for="(item, index) in filterPublishers"
|
<text class="suggest-text">{{ item }}</text>
|
||||||
:key="'p'+index"
|
|
||||||
:class="{ active: filterPress === item }"
|
|
||||||
@click="filterPress = filterPress === item ? '' : item"
|
|
||||||
>
|
|
||||||
<text class="tag-text">{{ item }}</text>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="filter-group" v-if="filterAuthors.length > 0">
|
<view class="filter-group">
|
||||||
<text class="group-title">作者</text>
|
<text class="group-title">作者</text>
|
||||||
<view class="tag-list">
|
<input class="filter-search-input" v-model="filterAuthor" placeholder="输入作者名称筛选" @input="onFilterAuthorInput" />
|
||||||
<view
|
<view class="filter-suggest" v-if="filterAuthor && filterAuthorSuggestions.length > 0">
|
||||||
class="tag-item"
|
<view class="suggest-item" v-for="(item, idx) in filterAuthorSuggestions" :key="'as'+idx" @click="selectFilterAuthor(item)">
|
||||||
v-for="(item, index) in filterAuthors"
|
<text class="suggest-text">{{ item }}</text>
|
||||||
:key="'a'+index"
|
|
||||||
:class="{ active: filterAuthor === item }"
|
|
||||||
@click="filterAuthor = filterAuthor === item ? '' : item"
|
|
||||||
>
|
|
||||||
<text class="tag-text">{{ item }}</text>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -805,9 +781,10 @@ export default {
|
|||||||
|
|
||||||
// 筛选
|
// 筛选
|
||||||
showFilterPopup: false,
|
showFilterPopup: false,
|
||||||
filterCondition: '',
|
|
||||||
filterPress: '',
|
filterPress: '',
|
||||||
filterAuthor: '',
|
filterAuthor: '',
|
||||||
|
filterPressSuggestions: [],
|
||||||
|
filterAuthorSuggestions: [],
|
||||||
|
|
||||||
// 仓库弹窗
|
// 仓库弹窗
|
||||||
showWarehousePicker: false,
|
showWarehousePicker: false,
|
||||||
@ -878,15 +855,12 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
sortedProductList() {
|
sortedProductList() {
|
||||||
let list = [...this.productList]
|
let list = [...this.productList]
|
||||||
// 筛选
|
// 筛选(模糊匹配)
|
||||||
if (this.filterCondition) {
|
|
||||||
list = list.filter(item => item.condition === this.filterCondition)
|
|
||||||
}
|
|
||||||
if (this.filterPress) {
|
if (this.filterPress) {
|
||||||
list = list.filter(item => item.shopName === this.filterPress)
|
list = list.filter(item => (item.shopName || '').toLowerCase().includes(this.filterPress.toLowerCase()))
|
||||||
}
|
}
|
||||||
if (this.filterAuthor) {
|
if (this.filterAuthor) {
|
||||||
list = list.filter(item => item.author === this.filterAuthor)
|
list = list.filter(item => (item.author || '').toLowerCase().includes(this.filterAuthor.toLowerCase()))
|
||||||
}
|
}
|
||||||
// 排序
|
// 排序
|
||||||
if (this.sortBy === 'total') {
|
if (this.sortBy === 'total') {
|
||||||
@ -969,35 +943,47 @@ export default {
|
|||||||
|
|
||||||
// ISBN搜索 - 查询图书中心 + 孔网市场
|
// ISBN搜索 - 查询图书中心 + 孔网市场
|
||||||
searchISBN() {
|
searchISBN() {
|
||||||
if (!this.isbn) {
|
let keyword = ''
|
||||||
uni.showToast({ title: '请输入ISBN', icon: 'none' })
|
if (this.compareType === 'isbn') {
|
||||||
return
|
if (!this.isbn) {
|
||||||
|
uni.showToast({ title: '请输入ISBN', icon: 'none' })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
keyword = this.isbn
|
||||||
|
} else {
|
||||||
|
if (!this.bookName) {
|
||||||
|
uni.showToast({ title: '请输入书名', icon: 'none' })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
keyword = this.bookName
|
||||||
}
|
}
|
||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
this.productList = []
|
this.productList = []
|
||||||
|
|
||||||
// 1. 查询图书中心 - 获取图书详情
|
// 1. 查询图书中心 - 获取图书详情(仅ISBN模式)
|
||||||
searchBookByIsbn(this.isbn).then(data => {
|
if (this.compareType === 'isbn') {
|
||||||
if (data.book_name) this.bookName = data.book_name
|
searchBookByIsbn(this.isbn).then(data => {
|
||||||
if (data.author) this.author = data.author
|
if (data.book_name) this.bookName = data.book_name
|
||||||
if (data.publisher) this.publisher = data.publisher
|
if (data.author) this.author = data.author
|
||||||
if (data.fix_price && data.fix_price > 0) {
|
if (data.publisher) this.publisher = data.publisher
|
||||||
this.fixPrice = (data.fix_price / 100).toFixed(2)
|
if (data.fix_price && data.fix_price > 0) {
|
||||||
}
|
this.fixPrice = (data.fix_price / 100).toFixed(2)
|
||||||
if (data.publication_time) this.printTime = data.publication_time
|
}
|
||||||
if (data.binding_layout) this.noIsbnFormat = data.binding_layout
|
if (data.publication_time) this.printTime = data.publication_time
|
||||||
console.log('图书中心查询成功:', data)
|
if (data.binding_layout) this.noIsbnFormat = data.binding_layout
|
||||||
}).catch(err => {
|
console.log('图书中心查询成功:', data)
|
||||||
console.log('图书中心查询无结果:', err)
|
}).catch(err => {
|
||||||
})
|
console.log('图书中心查询无结果:', err)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 2. 搜索孔夫子 - 获取在售商品信息
|
// 2. 搜索孔夫子 - 获取在售商品信息
|
||||||
const phpsessid = this.kongfzToken || uni.getStorageSync('kongfz_phpsessid') || ''
|
const phpsessid = this.kongfzToken || uni.getStorageSync('kongfz_phpsessid') || ''
|
||||||
// 并行请求:商品列表 + 品相统计(在售)+ 品相统计(已售)
|
// 并行请求:商品列表 + 品相统计(在售)+ 品相统计(已售)
|
||||||
Promise.all([
|
Promise.all([
|
||||||
searchProducts(this.isbn, { phpsessid }),
|
searchProducts(keyword, { phpsessid }),
|
||||||
searchFacet(this.isbn, { phpsessid, dataType: 0 }),
|
searchFacet(keyword, { phpsessid, dataType: 0 }),
|
||||||
searchFacet(this.isbn, { phpsessid, dataType: 1 })
|
searchFacet(keyword, { phpsessid, dataType: 1 })
|
||||||
]).then(([productsData, onSaleFacet, soldFacet]) => {
|
]).then(([productsData, onSaleFacet, soldFacet]) => {
|
||||||
this.isLoading = false
|
this.isLoading = false
|
||||||
if (productsData && productsData.total > 0) {
|
if (productsData && productsData.total > 0) {
|
||||||
@ -1236,7 +1222,6 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
resetFilter() {
|
resetFilter() {
|
||||||
this.filterCondition = ''
|
|
||||||
this.filterPress = ''
|
this.filterPress = ''
|
||||||
this.filterAuthor = ''
|
this.filterAuthor = ''
|
||||||
},
|
},
|
||||||
@ -1263,6 +1248,28 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 筛选 - 出版社输入提示
|
||||||
|
onFilterPressInput() {
|
||||||
|
const kw = this.filterPress.toLowerCase()
|
||||||
|
this.filterPressSuggestions = this.filterPublishers.filter(p => p.toLowerCase().includes(kw)).slice(0, 10)
|
||||||
|
},
|
||||||
|
|
||||||
|
selectFilterPress(val) {
|
||||||
|
this.filterPress = val
|
||||||
|
this.filterPressSuggestions = []
|
||||||
|
},
|
||||||
|
|
||||||
|
// 筛选 - 作者输入提示
|
||||||
|
onFilterAuthorInput() {
|
||||||
|
const kw = this.filterAuthor.toLowerCase()
|
||||||
|
this.filterAuthorSuggestions = this.filterAuthors.filter(a => a.toLowerCase().includes(kw)).slice(0, 10)
|
||||||
|
},
|
||||||
|
|
||||||
|
selectFilterAuthor(val) {
|
||||||
|
this.filterAuthor = val
|
||||||
|
this.filterAuthorSuggestions = []
|
||||||
|
},
|
||||||
|
|
||||||
// 提交上传
|
// 提交上传
|
||||||
submitUpload() {
|
submitUpload() {
|
||||||
if (this.isSubmitting) return
|
if (this.isSubmitting) return
|
||||||
@ -2155,6 +2162,57 @@ export default {
|
|||||||
color: #409eff;
|
color: #409eff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 筛选弹窗 - 搜索输入框 */
|
||||||
|
.filter-search-input {
|
||||||
|
background: #f5f6fa;
|
||||||
|
border: 2rpx solid #dcdfe6;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
height: 64rpx;
|
||||||
|
padding: 0 16rpx;
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #303133;
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
-webkit-appearance: none;
|
||||||
|
appearance: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-search-input:focus {
|
||||||
|
border-color: #409eff;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-search-input::placeholder {
|
||||||
|
color: #c0c4cc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-suggest {
|
||||||
|
background: #ffffff;
|
||||||
|
border: 2rpx solid #e4e7ed;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
margin-top: 6rpx;
|
||||||
|
max-height: 300rpx;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.suggest-item {
|
||||||
|
padding: 16rpx 20rpx;
|
||||||
|
border-bottom: 2rpx solid #f0f2f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.suggest-item:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.suggest-text {
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #303133;
|
||||||
|
}
|
||||||
|
|
||||||
|
.suggest-item:active {
|
||||||
|
background-color: #ecf5ff;
|
||||||
|
}
|
||||||
|
|
||||||
.popup-footer {
|
.popup-footer {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 16rpx;
|
gap: 16rpx;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user