|
@ -119,12 +119,14 @@ |
|
|
|
|
|
|
|
|
<!-- 不可回收商品 --> |
|
|
<!-- 不可回收商品 --> |
|
|
<view class="other-unrecycle-card"> |
|
|
<view class="other-unrecycle-card"> |
|
|
<image class="other-unrecycle-img" src="/static/回收/衣物.png" mode="aspectFit" /> |
|
|
|
|
|
|
|
|
<!-- 使用商品分类数据中的icon --> |
|
|
|
|
|
<image class="other-unrecycle-img" :src="categories[currentCategory]?.icon" mode="aspectFit" /> |
|
|
<view class="other-unrecycle-info"> |
|
|
<view class="other-unrecycle-info"> |
|
|
<view class="other-unrecycle-title">其他上衣(需咨询顾问)(暂不回收)</view> |
|
|
|
|
|
<view class="other-unrecycle-desc">需连线回收顾问筛选</view> |
|
|
|
|
|
|
|
|
<!-- 主标题和副标题用接口返回的otherTitle和otherSubTitle --> |
|
|
|
|
|
<view class="other-unrecycle-title">{{ categories[currentCategory]?.otherTitle }}</view> |
|
|
|
|
|
<view class="other-unrecycle-desc">{{ categories[currentCategory]?.otherSubTitle }}</view> |
|
|
<view class="other-unrecycle-price-row"> |
|
|
<view class="other-unrecycle-price-row"> |
|
|
<text class="other-unrecycle-price">¥ — /件</text> |
|
|
|
|
|
|
|
|
<text class="other-unrecycle-price">¥ — /{{ categories[currentCategory]?.unit || '件' }}</text> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
<button class="other-unrecycle-btn" open-type="contact">+</button> |
|
|
<button class="other-unrecycle-btn" open-type="contact">+</button> |
|
@ -288,12 +290,12 @@ |
|
|
<view v-if="showRulePopup" class="rule-popup-mask" @click.self="handleRulePopupMaskClick"> |
|
|
<view v-if="showRulePopup" class="rule-popup-mask" @click.self="handleRulePopupMaskClick"> |
|
|
<view class="rule-popup"> |
|
|
<view class="rule-popup"> |
|
|
<view class="rule-popup-title">回收规则</view> |
|
|
<view class="rule-popup-title">回收规则</view> |
|
|
<scroll-view class="rule-popup-content" scroll-y @scroll="onRuleContentScroll"> |
|
|
|
|
|
<uv-parse :content="ruleHtml"></uv-parse> |
|
|
|
|
|
|
|
|
<scroll-view class="rule-popup-content" scroll-y @scroll="onRuleContentScroll" @scrolltolower="onRuleScrollToLower"> |
|
|
|
|
|
<uv-parse :content="ruleHtml" @ready="onRuleContentReady"></uv-parse> |
|
|
<view class="rule-content-bottom-indicator"></view> |
|
|
<view class="rule-content-bottom-indicator"></view> |
|
|
</scroll-view> |
|
|
</scroll-view> |
|
|
<view v-if="!hasScrolledToBottom" class="scroll-tip">请滚动到底部阅读完整内容</view> |
|
|
<view v-if="!hasScrolledToBottom" class="scroll-tip">请滚动到底部阅读完整内容</view> |
|
|
<button class="rule-popup-btn" :class="{ disabled: !hasScrolledToBottom }" @click="closeRulePopup">我知道了</button> |
|
|
|
|
|
|
|
|
<button class="rule-popup-btn" :class="{ disabled: !hasScrolledToBottom }" :disabled="!hasScrolledToBottom" @click.stop="closeRulePopup">我知道了</button> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
|
|
@ -581,13 +583,18 @@ export default { |
|
|
}, |
|
|
}, |
|
|
// 动态生成品牌字母索引,只显示有品牌的字母 |
|
|
// 动态生成品牌字母索引,只显示有品牌的字母 |
|
|
brandIndexList() { |
|
|
brandIndexList() { |
|
|
const set = new Set() |
|
|
|
|
|
|
|
|
const letters = new Set() |
|
|
|
|
|
let hasSharp = false |
|
|
this.brandList.forEach(b => { |
|
|
this.brandList.forEach(b => { |
|
|
if (b.letter && /^[A-Z]$/.test(b.letter)) set.add(b.letter) |
|
|
|
|
|
|
|
|
if (b.letter && /^[A-Z]$/.test(b.letter)) { |
|
|
|
|
|
letters.add(b.letter) |
|
|
|
|
|
} else { |
|
|
|
|
|
letters.add('#') |
|
|
|
|
|
hasSharp = true |
|
|
|
|
|
} |
|
|
}) |
|
|
}) |
|
|
const arr = Array.from(set).sort() |
|
|
|
|
|
// 如果没有A-Z分组,兜底显示#分组 |
|
|
|
|
|
if (arr.length === 0 && this.brandList.length > 0) return ['#'] |
|
|
|
|
|
|
|
|
const arr = Array.from(letters).filter(l => l !== '#').sort() |
|
|
|
|
|
if (hasSharp) arr.push('#') |
|
|
return arr |
|
|
return arr |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
@ -990,9 +997,17 @@ export default { |
|
|
}, |
|
|
}, |
|
|
openRulePopup() { |
|
|
openRulePopup() { |
|
|
this.showRulePopup = true |
|
|
this.showRulePopup = true |
|
|
|
|
|
// 弹窗显示后主动判断内容是否需要滚动 |
|
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
|
const query = uni.createSelectorQuery().in(this) |
|
|
|
|
|
query.select('.rule-popup-content').boundingClientRect(rect => { |
|
|
|
|
|
if (rect && rect.height && rect.scrollHeight && rect.scrollHeight <= rect.height + 10) { |
|
|
|
|
|
this.hasScrolledToBottom = true |
|
|
|
|
|
} |
|
|
|
|
|
}).exec() |
|
|
|
|
|
}) |
|
|
}, |
|
|
}, |
|
|
closeRulePopup() { |
|
|
closeRulePopup() { |
|
|
// 如果还没有滚动到底部,显示提示 |
|
|
|
|
|
if (!this.hasScrolledToBottom) { |
|
|
if (!this.hasScrolledToBottom) { |
|
|
uni.showToast({ |
|
|
uni.showToast({ |
|
|
title: '请阅读完整回收规则', |
|
|
title: '请阅读完整回收规则', |
|
@ -1000,19 +1015,15 @@ export default { |
|
|
}) |
|
|
}) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
this.showRulePopup = false; |
|
|
this.showRulePopup = false; |
|
|
this.hasScrolledToBottom = false; // 重置滚动状态 |
|
|
this.hasScrolledToBottom = false; // 重置滚动状态 |
|
|
|
|
|
|
|
|
// 如果是在等待品牌选择的状态下关闭规则弹窗,则接着打开品牌选择 |
|
|
// 如果是在等待品牌选择的状态下关闭规则弹窗,则接着打开品牌选择 |
|
|
if (this.isWaitingForBrandSelection) { |
|
|
if (this.isWaitingForBrandSelection) { |
|
|
this.isWaitingForBrandSelection = false; // 清除等待状态 |
|
|
this.isWaitingForBrandSelection = false; // 清除等待状态 |
|
|
const categoryId = this.categories[this.currentCategory]?.id; |
|
|
const categoryId = this.categories[this.currentCategory]?.id; |
|
|
const item = this.allProducts[categoryId]?.[this.pendingBrandIndex]; |
|
|
const item = this.allProducts[categoryId]?.[this.pendingBrandIndex]; |
|
|
|
|
|
|
|
|
// 记录该商品的规则已被查看 |
|
|
// 记录该商品的规则已被查看 |
|
|
this.viewedRuleItems.add(item.id); |
|
|
this.viewedRuleItems.add(item.id); |
|
|
|
|
|
|
|
|
this.getGoodsBrandList(item.id); |
|
|
this.getGoodsBrandList(item.id); |
|
|
this.showBrandPopup = true; // 打开品牌索引弹窗 |
|
|
this.showBrandPopup = true; // 打开品牌索引弹窗 |
|
|
} else if (this.pendingBrandIndex !== null) { |
|
|
} else if (this.pendingBrandIndex !== null) { |
|
@ -1041,11 +1052,14 @@ export default { |
|
|
|
|
|
|
|
|
// 监听规则内容滚动 |
|
|
// 监听规则内容滚动 |
|
|
onRuleContentScroll(e) { |
|
|
onRuleContentScroll(e) { |
|
|
const { scrollTop, scrollHeight, deltaY } = e.detail |
|
|
|
|
|
const containerHeight = 500 // 大概的容器高度,单位rpx转换后的px |
|
|
|
|
|
|
|
|
|
|
|
// 判断是否滚动到底部(留一些余量) |
|
|
|
|
|
if (scrollTop + containerHeight >= scrollHeight - 20) { |
|
|
|
|
|
|
|
|
const { scrollTop, scrollHeight, clientHeight, height } = e.detail |
|
|
|
|
|
const h = clientHeight || height |
|
|
|
|
|
// 内容高度不够,无需滚动,直接允许 |
|
|
|
|
|
if (scrollHeight <= h + 10) { |
|
|
|
|
|
this.hasScrolledToBottom = true |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
if (scrollTop + h >= scrollHeight - 20) { |
|
|
this.hasScrolledToBottom = true |
|
|
this.hasScrolledToBottom = true |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
@ -1111,7 +1125,6 @@ export default { |
|
|
if (searchName.trim()) { |
|
|
if (searchName.trim()) { |
|
|
params.name = searchName.trim() |
|
|
params.name = searchName.trim() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
this.$api('getGoodsBrandList', params, res => { |
|
|
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) { |
|
@ -1126,14 +1139,10 @@ export default { |
|
|
isPin: item.isPin |
|
|
isPin: item.isPin |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
// 缓存到对应商品的品牌列表中 |
|
|
// 缓存到对应商品的品牌列表中 |
|
|
this.$set(this.brandCache, productId, brandList) |
|
|
this.$set(this.brandCache, productId, brandList) |
|
|
|
|
|
|
|
|
// 同时更新当前显示的brandList(用于弹窗显示) |
|
|
// 同时更新当前显示的brandList(用于弹窗显示) |
|
|
this.brandList = brandList |
|
|
|
|
|
|
|
|
|
|
|
// console.log(this.brandList,'this.brandList') |
|
|
|
|
|
|
|
|
this.brandList = [...brandList] |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
@ -1259,6 +1268,22 @@ export default { |
|
|
getApp().globalData.shouldClearRecycle = false |
|
|
getApp().globalData.shouldClearRecycle = false |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
onRuleContentReady() { |
|
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
|
const query = uni.createSelectorQuery().in(this) |
|
|
|
|
|
query.select('.rule-popup-content').boundingClientRect(rect => { |
|
|
|
|
|
query.select('.rule-popup-content').scrollOffset(scroll => { |
|
|
|
|
|
// 只有内容高度小于等于可视高度时才点亮 |
|
|
|
|
|
if (scroll.scrollHeight <= rect.height + 1) { |
|
|
|
|
|
this.hasScrolledToBottom = true |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}).exec() |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
onRuleScrollToLower() { |
|
|
|
|
|
this.hasScrolledToBottom = true |
|
|
|
|
|
}, |
|
|
}, |
|
|
}, |
|
|
created() { |
|
|
created() { |
|
|
this.currentCategory = 0 |
|
|
this.currentCategory = 0 |
|
@ -1583,8 +1608,8 @@ export default { |
|
|
border-bottom: 1rpx solid #f5f5f5; |
|
|
border-bottom: 1rpx solid #f5f5f5; |
|
|
|
|
|
|
|
|
.goods-item-img { |
|
|
.goods-item-img { |
|
|
width: 120rpx; |
|
|
|
|
|
height: 120rpx; |
|
|
|
|
|
|
|
|
width: 180rpx; |
|
|
|
|
|
height: 180rpx; |
|
|
border-radius: 24rpx; |
|
|
border-radius: 24rpx; |
|
|
background: #f8f8f8; |
|
|
background: #f8f8f8; |
|
|
margin-right: 28rpx; |
|
|
margin-right: 28rpx; |
|
|