|
@ -232,13 +232,13 @@ |
|
|
<text class="brand-popup-title">可回收的品牌</text> |
|
|
<text class="brand-popup-title">可回收的品牌</text> |
|
|
</view> |
|
|
</view> |
|
|
<view class="brand-popup-search"> |
|
|
<view class="brand-popup-search"> |
|
|
<input class="brand-search-input" v-model="brandSearch" placeholder="请输入要查询的内容" /> |
|
|
|
|
|
|
|
|
<input class="brand-search-input" v-model="brandSearch" placeholder="请输入要查询的内容" @input="onBrandSearchInput" /> |
|
|
</view> |
|
|
</view> |
|
|
<scroll-view class="brand-popup-list" scroll-y :scroll-into-view="scrollToView"> |
|
|
<scroll-view class="brand-popup-list" scroll-y :scroll-into-view="scrollToView"> |
|
|
<view v-for="letter in brandIndexList" :key="letter" :id="'brand-letter-' + letter"> |
|
|
<view v-for="letter in brandIndexList" :key="letter" :id="'brand-letter-' + letter"> |
|
|
<view class="brand-letter">{{letter}}</view> |
|
|
<view class="brand-letter">{{letter}}</view> |
|
|
<view v-for="brand in filteredBrandList.filter(b => b.letter === letter)" :key="brand.name" class="brand-item" @click="openBrandConfirm(brand)"> |
|
|
<view v-for="brand in filteredBrandList.filter(b => b.letter === letter)" :key="brand.name" class="brand-item" @click="openBrandConfirm(brand)"> |
|
|
<image :src="brand.image" class="brand-logo" mode="aspectFit" /> |
|
|
|
|
|
|
|
|
<image :src="brand.logo" class="brand-logo" mode="aspectFit" /> |
|
|
<text class="brand-name">{{brand.name}}</text> |
|
|
<text class="brand-name">{{brand.name}}</text> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
@ -286,7 +286,7 @@ |
|
|
<view class="brand-confirm-popup"> |
|
|
<view class="brand-confirm-popup"> |
|
|
<view class="brand-confirm-title">品牌确认提示</view> |
|
|
<view class="brand-confirm-title">品牌确认提示</view> |
|
|
<view class="brand-confirm-logo-wrap"> |
|
|
<view class="brand-confirm-logo-wrap"> |
|
|
<image :src="brandConfirmInfo.image" class="brand-confirm-logo" mode="aspectFit" /> |
|
|
|
|
|
|
|
|
<image :src="brandConfirmInfo.logo" class="brand-confirm-logo" mode="aspectFit" /> |
|
|
</view> |
|
|
</view> |
|
|
<view class="brand-confirm-name">{{ brandConfirmInfo.name }}</view> |
|
|
<view class="brand-confirm-name">{{ brandConfirmInfo.name }}</view> |
|
|
<view class="brand-confirm-desc">请确认所选品牌是否与实物品牌信息一致,否则将无法进行回收。</view> |
|
|
<view class="brand-confirm-desc">请确认所选品牌是否与实物品牌信息一致,否则将无法进行回收。</view> |
|
@ -306,7 +306,7 @@ |
|
|
</view> |
|
|
</view> |
|
|
<scroll-view class="brand-reduce-popup-list" scroll-y> |
|
|
<scroll-view class="brand-reduce-popup-list" scroll-y> |
|
|
<view v-for="brand in reduceBrandList" :key="brand.brandId" class="brand-item" @click="selectReduceBrand(brand)"> |
|
|
<view v-for="brand in reduceBrandList" :key="brand.brandId" class="brand-item" @click="selectReduceBrand(brand)"> |
|
|
<image :src="brand.image" class="brand-logo" mode="aspectFit" /> |
|
|
|
|
|
|
|
|
<image :src="brand.logo" class="brand-logo" mode="aspectFit" /> |
|
|
<text class="brand-name">{{brand.name}}</text> |
|
|
<text class="brand-name">{{brand.name}}</text> |
|
|
</view> |
|
|
</view> |
|
|
</scroll-view> |
|
|
</scroll-view> |
|
@ -338,7 +338,7 @@ export default { |
|
|
showPickupConfirm: false, |
|
|
showPickupConfirm: false, |
|
|
showBrandConfirm: false, |
|
|
showBrandConfirm: false, |
|
|
brandConfirmInfo: { |
|
|
brandConfirmInfo: { |
|
|
image: '', |
|
|
|
|
|
|
|
|
logo: '', |
|
|
name: '' |
|
|
name: '' |
|
|
}, |
|
|
}, |
|
|
brandList: [], |
|
|
brandList: [], |
|
@ -359,6 +359,8 @@ export default { |
|
|
loadOptions: null, // 保存options参数 |
|
|
loadOptions: null, // 保存options参数 |
|
|
userInfo: null, // 用户信息 |
|
|
userInfo: null, // 用户信息 |
|
|
isUserBlacklisted: false, // 用户是否被拉黑 |
|
|
isUserBlacklisted: false, // 用户是否被拉黑 |
|
|
|
|
|
currentProductId: null, // 当前查看品牌的商品ID |
|
|
|
|
|
searchTimer: null, // 搜索防抖定时器 |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
computed: { |
|
|
computed: { |
|
@ -472,7 +474,7 @@ export default { |
|
|
quantity: quantity, |
|
|
quantity: quantity, |
|
|
brandId: brandId, |
|
|
brandId: brandId, |
|
|
brandName: brandInfo ? brandInfo.name : '未知品牌', |
|
|
brandName: brandInfo ? brandInfo.name : '未知品牌', |
|
|
brandImage: brandInfo ? brandInfo.image : '', |
|
|
|
|
|
|
|
|
brandImage: brandInfo ? brandInfo.logo : '', |
|
|
uniqueKey: `${item.id}_${brandId}` // 用于区分同商品不同品牌 |
|
|
uniqueKey: `${item.id}_${brandId}` // 用于区分同商品不同品牌 |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
@ -488,9 +490,7 @@ export default { |
|
|
return products |
|
|
return products |
|
|
}, |
|
|
}, |
|
|
filteredBrandList() { |
|
|
filteredBrandList() { |
|
|
if (!this.brandSearch) return this.brandList |
|
|
|
|
|
const keyword = this.brandSearch.trim().toLowerCase() |
|
|
|
|
|
return this.brandList.filter(b => b.name.toLowerCase().includes(keyword)) |
|
|
|
|
|
|
|
|
return this.brandList |
|
|
}, |
|
|
}, |
|
|
bannerList() { |
|
|
bannerList() { |
|
|
return getApp().globalData.bannerList || [] |
|
|
return getApp().globalData.bannerList || [] |
|
@ -585,7 +585,7 @@ export default { |
|
|
brandId, |
|
|
brandId, |
|
|
quantity, |
|
|
quantity, |
|
|
name: brandInfo ? brandInfo.name : '未知品牌', |
|
|
name: brandInfo ? brandInfo.name : '未知品牌', |
|
|
image: brandInfo ? brandInfo.image : '' |
|
|
|
|
|
|
|
|
logo: brandInfo ? brandInfo.logo : '' |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
this.showBrandReducePopup = true |
|
|
this.showBrandReducePopup = true |
|
@ -765,6 +765,13 @@ export default { |
|
|
// 如果用户取消品牌选择,重置状态 |
|
|
// 如果用户取消品牌选择,重置状态 |
|
|
this.pendingBrandIndex = null; |
|
|
this.pendingBrandIndex = null; |
|
|
this.isWaitingForBrandSelection = false; |
|
|
this.isWaitingForBrandSelection = false; |
|
|
|
|
|
// 清理搜索状态 |
|
|
|
|
|
this.brandSearch = '' |
|
|
|
|
|
this.currentProductId = null |
|
|
|
|
|
if (this.searchTimer) { |
|
|
|
|
|
clearTimeout(this.searchTimer) |
|
|
|
|
|
this.searchTimer = null |
|
|
|
|
|
} |
|
|
}, |
|
|
}, |
|
|
scrollToLetter(letter) { |
|
|
scrollToLetter(letter) { |
|
|
this.currentLetter = letter |
|
|
this.currentLetter = letter |
|
@ -903,7 +910,7 @@ export default { |
|
|
openBrandConfirm(brand) { |
|
|
openBrandConfirm(brand) { |
|
|
this.brandConfirmInfo = { |
|
|
this.brandConfirmInfo = { |
|
|
id: brand.id, |
|
|
id: brand.id, |
|
|
image: brand.image, |
|
|
|
|
|
|
|
|
logo: brand.logo, |
|
|
name: brand.name |
|
|
name: brand.name |
|
|
} |
|
|
} |
|
|
this.showBrandConfirm = true |
|
|
this.showBrandConfirm = true |
|
@ -936,8 +943,14 @@ export default { |
|
|
this.pendingBrandIndex = null |
|
|
this.pendingBrandIndex = null |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
getGoodsBrandList(productId) { |
|
|
|
|
|
this.$api('getGoodsBrandList', { productId }, res => { |
|
|
|
|
|
|
|
|
getGoodsBrandList(productId, searchName = '') { |
|
|
|
|
|
this.currentProductId = productId |
|
|
|
|
|
const params = { productId } |
|
|
|
|
|
if (searchName.trim()) { |
|
|
|
|
|
params.name = searchName.trim() |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.$api('getGoodsBrandList', params, res => { |
|
|
// console.log(res,'res') |
|
|
// console.log(res,'res') |
|
|
if (res && res.success && res.result && res.result.records) { |
|
|
if (res && res.success && res.result && res.result.records) { |
|
|
this.brandList = res.result.records.map(item => { |
|
|
this.brandList = res.result.records.map(item => { |
|
@ -973,6 +986,23 @@ export default { |
|
|
|
|
|
|
|
|
return '#' |
|
|
return '#' |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 品牌搜索输入事件处理 |
|
|
|
|
|
onBrandSearchInput(e) { |
|
|
|
|
|
const searchValue = e.detail.value |
|
|
|
|
|
|
|
|
|
|
|
// 清除之前的定时器 |
|
|
|
|
|
if (this.searchTimer) { |
|
|
|
|
|
clearTimeout(this.searchTimer) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 设置防抖,500ms后执行搜索 |
|
|
|
|
|
this.searchTimer = setTimeout(() => { |
|
|
|
|
|
if (this.currentProductId) { |
|
|
|
|
|
this.getGoodsBrandList(this.currentProductId, searchValue) |
|
|
|
|
|
} |
|
|
|
|
|
}, 500) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
// 初始化页面数据的方法 |
|
|
// 初始化页面数据的方法 |
|
|
initializePageData() { |
|
|
initializePageData() { |
|
|