爱简收旧衣按件回收前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2453 lines
72 KiB

5 months ago
2 months ago
5 months ago
4 months ago
2 months ago
5 months ago
4 months ago
5 months ago
4 months ago
5 months ago
2 months ago
5 months ago
2 months ago
2 months ago
2 months ago
2 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
5 months ago
5 months ago
2 months ago
5 months ago
5 months ago
5 months ago
2 months ago
2 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
2 months ago
2 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
4 months ago
5 months ago
3 months ago
5 months ago
5 months ago
2 months ago
5 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
5 months ago
5 months ago
2 months ago
2 months ago
4 months ago
5 months ago
2 months ago
2 months ago
2 months ago
3 months ago
2 months ago
2 months ago
2 months ago
5 months ago
2 months ago
2 months ago
5 months ago
5 months ago
2 months ago
5 months ago
4 months ago
2 months ago
5 months ago
2 months ago
2 months ago
2 months ago
4 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
5 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
5 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
4 months ago
2 months ago
2 months ago
2 months ago
2 months ago
5 months ago
4 months ago
4 months ago
2 months ago
4 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
2 months ago
2 months ago
5 months ago
2 months ago
5 months ago
2 months ago
2 months ago
5 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
5 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
5 months ago
5 months ago
4 months ago
5 months ago
2 months ago
2 months ago
4 months ago
4 months ago
2 months ago
4 months ago
2 months ago
4 months ago
2 months ago
4 months ago
4 months ago
4 months ago
2 months ago
4 months ago
5 months ago
5 months ago
4 months ago
5 months ago
4 months ago
5 months ago
2 months ago
5 months ago
4 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
4 months ago
5 months ago
4 months ago
2 months ago
2 months ago
2 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
4 months ago
2 months ago
5 months ago
4 months ago
5 months ago
4 months ago
2 months ago
2 months ago
5 months ago
2 months ago
2 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
4 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
2 months ago
2 months ago
2 months ago
2 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
5 months ago
2 months ago
5 months ago
5 months ago
2 months ago
5 months ago
5 months ago
2 months ago
5 months ago
5 months ago
2 months ago
5 months ago
5 months ago
2 months ago
5 months ago
5 months ago
2 months ago
5 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
5 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
5 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
5 months ago
5 months ago
2 months ago
5 months ago
5 months ago
5 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
5 months ago
2 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
2 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
5 months ago
2 months ago
2 months ago
5 months ago
2 months ago
5 months ago
5 months ago
2 months ago
5 months ago
2 months ago
2 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
5 months ago
2 months ago
5 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
2 months ago
5 months ago
5 months ago
2 months ago
5 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
  1. <template>
  2. <view class="container">
  3. <!-- 顶部banner -->
  4. <banner-swiper :banner-list="bannerList" height="320rpx" :fallback-image="recycle_banner"
  5. video-id-prefix="recycle-video"></banner-swiper>
  6. <!-- 商品列表 -->
  7. <view class="goods-list">
  8. <!-- 左侧分类导航 -->
  9. <view class="category-nav">
  10. <view v-for="(category, index) in categories" :key="category.id || index" class="category-item"
  11. :class="{ active: currentCategory === index }" @click="switchCategory(index)">
  12. <view class="category-dot" v-if="getCategoryItemCount(index) > 0">{{ getCategoryItemCount(index) }}</view>
  13. {{ category.title }}
  14. </view>
  15. </view>
  16. <!-- 右侧商品列表 -->
  17. <scroll-view class="goods-content" scroll-y @scrolltolower="loadMoreGoods">
  18. <view class="goods-section">
  19. <view class="goods-item" v-for="(item, index) in recycleList" :key="index">
  20. <view class="goods-img-container">
  21. <image v-if="item.image" :src="item.image" class="goods-item-img" mode="aspectFit" />
  22. <!-- 品牌标签 -->
  23. <view class="brand-tag" v-if="item.isPin === 'Y'">品牌</view>
  24. </view>
  25. <view class="goods-info-wrap">
  26. <view class="goods-header">
  27. <text class="goods-name">{{ item.name }}</text>
  28. </view>
  29. <text class="goods-desc">{{ item.service }}</text>
  30. <view class="rules-brand-row">
  31. <view class="rules-link" @click="showRules(item)" v-if="item.isRecycleRules == '1'">
  32. <view class="rules">
  33. <text>回收规则</text>
  34. <uni-icons type="right" size="14" color="#999"></uni-icons>
  35. </view>
  36. </view>
  37. <!-- <view class="brand-check-placeholder" v-if="item.isPin === 'Y'">
  38. <view class="brand-check" @click="checkBrand(index)">
  39. <text>查看品牌</text>
  40. <uni-icons type="right" size="12" color="#ff7a0e"></uni-icons>
  41. </view>
  42. </view> -->
  43. </view>
  44. <view class="goods-info">
  45. <view class="price-info">
  46. <text class="price-symbol">¥</text>
  47. <text class="price-value" v-if="!item.maxPrice || item.maxPrice == item.price">{{ item.price }}</text>
  48. <text class="price-value" v-else>{{ item.price }}-{{ item.maxPrice }}</text>
  49. <text class="price-unit">/{{ item.unit || '件' }}</text>
  50. </view>
  51. <view class="quantity-control">
  52. <button class="btn-minus" @click="updateQuantity(index, -1)">-</button>
  53. <text class="quantity">{{ getItemTotalQuantity(item) }}</text>
  54. <button class="btn-plus" @click="updateQuantity(index, 1)">+</button>
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. <!-- 不可回收商品 -->
  61. <view class="other-unrecycle-card">
  62. <!-- 使用商品分类数据中的icon -->
  63. <image class="other-unrecycle-img" :src="categories[currentCategory]?.icon" mode="aspectFit" />
  64. <view class="other-unrecycle-info">
  65. <!-- 主标题和副标题用接口返回的otherTitle和otherSubTitle -->
  66. <view class="other-unrecycle-title">{{ categories[currentCategory]?.otherTitle }}</view>
  67. <view class="other-unrecycle-desc">{{ categories[currentCategory]?.otherSubTitle }}</view>
  68. <view class="other-unrecycle-price-row">
  69. <text class="other-unrecycle-price">¥ /{{ categories[currentCategory]?.unit || '件' }}</text>
  70. </view>
  71. </view>
  72. <button class="other-unrecycle-btn" open-type="contact">+</button>
  73. </view>
  74. <view v-if="loadingMore" class="loading-more">加载中...</view>
  75. <view v-else-if="finished" class="loading-more">没有更多了</view>
  76. </scroll-view>
  77. </view>
  78. <!-- 固定底部区域 -->
  79. <view class="fixed-bottom-wrap" v-if="!showDetailPanel">
  80. <view class="green-tip-bar">
  81. 回收范围仅支持回收以上品类按件回收预计比称重回收多
  82. <text class="tip-highlight"> {{ extraRecycleAmount.display }}</text>
  83. </view>
  84. <view class="bottom-bar">
  85. <view class="bottom-left">
  86. <view class="summary-row">
  87. <text class="summary-label">已选 <text class="summary-count">{{ totalCount }}</text> {{ totalUnitText }}
  88. 预计回收可得</text>
  89. <uni-icons type="help" size="18" color="#b2b2b2" style="margin: 0 8rpx;" @tap="showPriceInfoPopups" />
  90. </view>
  91. <view class="amount-row" @click="toggleDetailPanel">
  92. <uni-icons :type="showDetailPanel ? 'up' : 'down'" size="18" color="#5e5e5e"
  93. style="margin-right: 8rpx;vertical-align: middle;" />
  94. <text class="amount" v-if="priceRange.min === priceRange.max">¥{{ priceRange.min }}</text>
  95. <text class="amount" v-else>¥{{ priceRange.min }}-{{ priceRange.max }}</text>
  96. </view>
  97. </view>
  98. <button class="submit-btn" @click="submitOrder">预约上门取件</button>
  99. </view>
  100. <view class="bottom-bar-divider"></view>
  101. </view>
  102. <!-- 明细弹窗遮罩和弹窗 -->
  103. <view v-if="showDetailPanel" class="detail-popup-mask" @click.self="toggleDetailPanel">
  104. <view class="detail-popup" @click.stop>
  105. <view class="detail-popup-close" @click="toggleDetailPanel">×</view>
  106. <view class="green-tip-bar popup-green-tip">
  107. 回收范围仅支持回收以上品类按件回收预计比称重回收多
  108. <text class="tip-highlight"> {{ extraRecycleAmount.display }}</text>
  109. </view>
  110. <view class="panel-header">
  111. <text class="panel-title">已选商品明细</text>
  112. </view>
  113. <scroll-view class="panel-list popup-panel-list" scroll-y>
  114. <!-- @click="openProductDetail(item)" -->
  115. <view v-for="(item, idx) in selectedProducts" :key="item.uniqueKey || idx"
  116. class="panel-item">
  117. <view class="panel-img-container">
  118. <image v-if="item.styleImage || item.image" :src="item.styleImage || item.image" class="panel-item-img" mode="aspectFit" />
  119. <!-- 品牌标签 -->
  120. <view class="panel-brand-tag" v-if="item.brandId">品牌</view>
  121. </view>
  122. <view class="panel-item-info">
  123. <!-- <text class="panel-item-name">{{ item.name }}</text> -->
  124. <!-- <text class="panel-item-desc" v-if="item.brandName && item.styleName">品牌{{ item.brandName }} | 款式{{ item.styleName }}</text> -->
  125. <text class="panel-item-name">{{ item.brandName || item.name }}</text>
  126. <text class="panel-item-desc" v-if="item.styleName">{{ item.name }} | {{ item.styleName }}</text>
  127. <text class="panel-item-desc" v-else>{{ item.service }}</text>
  128. <text class="panel-item-price" v-if="!item.maxPrice || item.maxPrice == item.price">¥{{ item.price }}/{{
  129. item.unit || '件' }}</text>
  130. <text class="panel-item-price" v-else>¥{{ item.price }}-{{ item.maxPrice }}/{{ item.unit || '' }}</text>
  131. </view>
  132. <view class="panel-quantity-control">
  133. <button class="btn-minus" @click.stop="updateQuantityByProduct(item, -1)">-</button>
  134. <!-- <button class="btn-minus">-</button> -->
  135. <text class="quantity">{{ item.quantity }}</text>
  136. <button class="btn-plus" @click.stop="updateQuantityByProduct(item, 1)">+</button>
  137. <!-- <button class="btn-plus">+</button> -->
  138. </view>
  139. </view>
  140. </scroll-view>
  141. <view class="popup-bottom-bar">
  142. <view class="bottom-left">
  143. <view class="summary-row">
  144. <text class="summary-label">已选 <text class="summary-count">{{ totalCount }}</text> {{ totalUnitText }}
  145. 预计回收可得</text>
  146. <uni-icons type="help" size="18" color="#b2b2b2" style="margin: 0 8rpx;" @tap="showPriceInfoPopups" />
  147. </view>
  148. <view class="amount-row" @click="toggleDetailPanel">
  149. <uni-icons :type="showDetailPanel ? 'up' : 'down'" size="18" color="#5e5e5e"
  150. style="margin-right: 8rpx;vertical-align: middle;" />
  151. <text class="amount" v-if="priceRange.min === priceRange.max">¥{{ priceRange.min }}</text>
  152. <text class="amount" v-else>¥{{ priceRange.min }}-{{ priceRange.max }}</text>
  153. </view>
  154. </view>
  155. <button class="submit-btn" @click="submitOrder">预约上门取件</button>
  156. </view>
  157. <!-- 添加衣物浮窗按钮 -->
  158. <view class="floating-add-btn" @click="addMoreItems">
  159. <text class="floating-btn-text">继续添加衣物</text>
  160. </view>
  161. </view>
  162. </view>
  163. <!-- 价格说明弹窗 -->
  164. <view v-if="showPriceInfoPopup" class="price-info-popup-mask" @click.self="closePriceInfoPopup">
  165. <view class="price-info-popup">
  166. <view class="price-info-popup-title">回收规则</view>
  167. <scroll-view class="price-info-popup-content" scroll-y>
  168. <!-- <view class="price-info-section">
  169. <view class="price-info-heading">关于旧衣质检</view>
  170. <view class="price-info-text">请确认本次回收旧衣是可以进行二次穿着的程度如回收旧衣有破损磨损开线变形起球发黄染色污渍配饰脱落或款式老旧等问题无法通过质检</view>
  171. </view>
  172. <view class="price-info-section">
  173. <view class="price-info-heading">质检报告</view>
  174. <view class="price-info-text">回收商收到衣后1-3个工作日内完成衣质检报告</view>
  175. </view>
  176. <view class="price-info-section">
  177. <view class="price-info-heading">质检结果与回收价格</view>
  178. <view class="price-info-text">若回收旧衣质检通过质检价格与用户提交订单时的预估价格一致回收商将按照预估价打款至您的小程序账户余额</view>
  179. </view> -->
  180. <uv-parse :content="huodong_text"></uv-parse>
  181. </scroll-view>
  182. <button class="price-info-popup-btn" @click="closePriceInfoPopup">我知道了</button>
  183. </view>
  184. </view>
  185. <!-- 根据角色显示不同的导航栏 -->
  186. <tabbar v-if="ishow" select="recycle"></tabbar>
  187. <!-- 品牌选择组件 -->
  188. <brand-selector ref="brandSelector" @brand-confirm="onBrandConfirm" @reduce-select="onReduceSelect"
  189. @close="onBrandSelectorClose" @get-existing-quantities="getExistingQuantities"></brand-selector>
  190. <!-- 规则弹窗组件 -->
  191. <rule-popup ref="rulePopup" :confirm-content="recycle_toast" @rule-confirm="onRuleConfirm"
  192. @pickup-cancel="handlePickupCancel" @pickup-confirm="handlePickupAgree"></rule-popup>
  193. <!-- 商品明细弹窗组件 -->
  194. <product-detail-popup ref="productDetailPopup" @confirm-changes="onDetailConfirmChanges" @close="onDetailPopupClose"></product-detail-popup>
  195. </view>
  196. </template>
  197. <script>
  198. import tabBarMixin from '../mixins/tabBarMixin.js'
  199. import { pinyin } from '../../utils/pinyin.js'
  200. import tabbar from '../../compoent/base/tabbar.vue'
  201. import brandSelector from '../../compoent/recycle/brand-selector.vue'
  202. import bannerSwiper from '../../compoent/base/banner-swiper.vue'
  203. import rulePopup from '../../compoent/base/rule-popup.vue'
  204. import productDetailPopup from '../../compoent/recycle/product-detail-popup.vue'
  205. export default {
  206. mixins: [tabBarMixin],
  207. components: {
  208. tabbar,
  209. brandSelector,
  210. bannerSwiper,
  211. rulePopup,
  212. productDetailPopup
  213. },
  214. data() {
  215. return {
  216. value: 1,
  217. ishow: true,
  218. // 动态数据
  219. allProducts: {}, // { [categoryId]: [商品数组] }
  220. allProductsPage: {}, // { [categoryId]: 当前已加载页码 }
  221. allProductsTotal: {}, // { [categoryId]: 总数 }
  222. pageSize: 10,
  223. currentCategory: 0,
  224. tabbarHeight: 0,
  225. showDetailPanel: false,
  226. ruleImgUrl: '/static/回收/回收规则.png',
  227. brandCache: {}, // 为每个商品缓存品牌信息 { productId: [brandList] }
  228. loadingMore: false,
  229. finished: false,
  230. pendingBrandIndex: null, // 记录待加一的品牌商品index
  231. showPriceInfoPopup: false,
  232. isWaitingForBrandSelection: false, // 等待品牌选择的标志
  233. reduceItem: null, // 待减少数量的商品
  234. viewedRuleItems: new Set(), // 已查看过规则的商品ID集合
  235. loadOptions: null, // 保存options参数
  236. userInfo: null, // 用户信息
  237. isUserBlacklisted: false, // 用户是否被拉黑
  238. currentProductId: null, // 当前查看品牌的商品ID
  239. searchTimer: null, // 搜索防抖定时器
  240. isFromPickupFlow: false, // 标记是否来自预约流程
  241. hasShownFirstTimeRules: false // 标记是否已显示过首次访问规则
  242. }
  243. },
  244. computed: {
  245. recycle_banner() {
  246. const item = getApp().globalData.configData.find(i => i.keyName === 'recycle_banner')
  247. return item ? item.keyContent : ''
  248. },
  249. re_key_numer() {
  250. const item = getApp().globalData.configData.find(i => i.keyName === 're_key_numer')
  251. return item ? parseFloat(item.keyContent) : 0.066
  252. },
  253. recycle_toast() {
  254. const item = getApp().globalData.configData.find(i => i.keyName === 'recycle_toast')
  255. return item ? item.keyContent : ''
  256. },
  257. huodong_text() {
  258. const item = getApp().globalData.configData.find(i => i.keyName === 'huodong_text')
  259. return item ? item.keyContent : ''
  260. },
  261. // 当前分类的商品列表
  262. recycleList() {
  263. const currentCategoryId = this.categories[this.currentCategory]?.id
  264. return this.allProducts[currentCategoryId] || []
  265. },
  266. // 计算总数量
  267. totalCount() {
  268. return Object.values(this.allProducts).reduce((total, categoryItems) => {
  269. return total + categoryItems.reduce((sum, item) => {
  270. // 如果商品有品牌款式数量,汇总所有品牌款式的数量
  271. if (item.brandStyleQuantities && Object.keys(item.brandStyleQuantities).length > 0) {
  272. return sum + Object.values(item.brandStyleQuantities).reduce((styleSum, qty) => styleSum + qty, 0)
  273. }
  274. // 如果商品有品牌数量,汇总所有品牌的数量
  275. if (item.brandQuantities && Object.keys(item.brandQuantities).length > 0) {
  276. return sum + Object.values(item.brandQuantities).reduce((brandSum, qty) => brandSum + qty, 0)
  277. }
  278. // 否则使用原来的quantity字段
  279. return sum + (item.quantity || 0)
  280. }, 0)
  281. }, 0)
  282. },
  283. // 计算总单位文本
  284. totalUnitText() {
  285. // 获取所有已选商品的单位
  286. const units = new Set()
  287. Object.values(this.allProducts).forEach(categoryItems => {
  288. categoryItems.forEach(item => {
  289. let hasQuantity = false
  290. if (item.brandStyleQuantities && Object.keys(item.brandStyleQuantities).length > 0) {
  291. hasQuantity = Object.values(item.brandStyleQuantities).some(qty => qty > 0)
  292. } else if (item.brandQuantities && Object.keys(item.brandQuantities).length > 0) {
  293. hasQuantity = Object.values(item.brandQuantities).some(qty => qty > 0)
  294. } else {
  295. hasQuantity = (item.quantity || 0) > 0
  296. }
  297. if (hasQuantity) {
  298. units.add(item.unit || '件')
  299. }
  300. })
  301. })
  302. // 如果只有一种单位,显示单位;如果混合多种单位,显示"项"
  303. if (units.size === 0) return '件'
  304. if (units.size === 1) return Array.from(units)[0]
  305. return '项'
  306. },
  307. // 计算总价格范围
  308. totalPriceRange() {
  309. const result = Object.values(this.allProducts).reduce((categoryTotal, categoryItems) => {
  310. return categoryItems.reduce((sum, item) => {
  311. // 如果商品有品牌款式数量,使用款式价格计算
  312. if (item.brandStyleQuantities && Object.keys(item.brandStyleQuantities).length > 0) {
  313. Object.entries(item.brandStyleQuantities).forEach(([uniqueKey, quantity]) => {
  314. if (quantity > 0 && item.styleCache && item.styleCache[uniqueKey]) {
  315. const styleInfo = item.styleCache[uniqueKey].styleInfo
  316. const minPrice = Number(styleInfo.minPrice) || 0
  317. const maxPrice = Number(styleInfo.maxPrice) || Number(styleInfo.minPrice) || 0
  318. sum.min += quantity * minPrice
  319. sum.max += quantity * maxPrice
  320. }
  321. })
  322. } else {
  323. let itemQuantity = 0
  324. // 如果商品有品牌数量,汇总所有品牌的数量
  325. if (item.brandQuantities && Object.keys(item.brandQuantities).length > 0) {
  326. itemQuantity = Object.values(item.brandQuantities).reduce((brandSum, qty) => brandSum + qty, 0)
  327. } else {
  328. itemQuantity = item.quantity || 0
  329. }
  330. if (itemQuantity > 0) {
  331. const minPrice = Number(item.price) || 0
  332. const maxPrice = Number(item.maxPrice) || Number(item.price) || 0
  333. sum.min += itemQuantity * minPrice
  334. sum.max += itemQuantity * maxPrice
  335. }
  336. }
  337. return sum
  338. }, categoryTotal)
  339. }, { min: 0, max: 0 })
  340. return {
  341. min: result.min.toFixed(1),
  342. max: result.max.toFixed(1)
  343. }
  344. },
  345. // 计算总价格 (保持兼容性,使用最低价格)
  346. totalPrice() {
  347. return this.totalPriceRange.min
  348. },
  349. // 计算价格范围
  350. priceRange() {
  351. if (this.totalCount === 0) {
  352. return {
  353. min: '0.0',
  354. max: '0.0'
  355. }
  356. }
  357. return this.totalPriceRange
  358. },
  359. selectedProducts() {
  360. // 返回所有分类下所有已选商品,按品牌款式分组
  361. const products = []
  362. Object.values(this.allProducts).flat().forEach(item => {
  363. if (item.brandStyleQuantities && Object.keys(item.brandStyleQuantities).length > 0) {
  364. // 按品牌款式分别添加
  365. Object.entries(item.brandStyleQuantities).forEach(([uniqueKey, quantity]) => {
  366. if (quantity > 0 && item.styleCache && item.styleCache[uniqueKey]) {
  367. const { brandInfo, styleInfo } = item.styleCache[uniqueKey]
  368. products.push({
  369. ...item,
  370. quantity: quantity,
  371. brandId: brandInfo.id,
  372. brandName: brandInfo.name,
  373. brandImage: brandInfo.logo,
  374. styleId: styleInfo.id,
  375. styleName: styleInfo.name,
  376. styleImage: styleInfo.image,
  377. price: styleInfo.minPrice, // 使用款式价格
  378. maxPrice: styleInfo.maxPrice,
  379. name: item.name, // 保持原商品名称
  380. uniqueKey: `${item.id}_${uniqueKey}` // 用于区分同商品不同品牌款式
  381. })
  382. }
  383. })
  384. } else if (item.brandQuantities && Object.keys(item.brandQuantities).length > 0) {
  385. // 按品牌分别添加(兼容旧数据)
  386. Object.entries(item.brandQuantities).forEach(([brandId, quantity]) => {
  387. if (quantity > 0) {
  388. const brandInfo = this.getBrandInfo(brandId)
  389. products.push({
  390. ...item,
  391. quantity: quantity,
  392. brandId: brandId,
  393. brandName: brandInfo ? brandInfo.name : '未知品牌',
  394. brandImage: brandInfo ? brandInfo.logo : '',
  395. uniqueKey: `${item.id}_${brandId}` // 用于区分同商品不同品牌
  396. })
  397. }
  398. })
  399. } else if (item.quantity > 0) {
  400. // 没有品牌的商品
  401. products.push({
  402. ...item,
  403. uniqueKey: item.id
  404. })
  405. }
  406. })
  407. return products
  408. },
  409. bannerList() {
  410. return getApp().globalData.bannerList || []
  411. },
  412. categories() {
  413. const list = getApp().globalData.pricePreviewList || []
  414. return list.sort((a, b) => a.sort - b.sort)
  415. // return list.filter(item => item.pid === '0').sort((a, b) => a.sort - b.sort)
  416. },
  417. minMoney() {
  418. const config = getApp().globalData.configData || [];
  419. const item = config.find(i => i.keyName === 'min_money');
  420. return item ? parseFloat(item.keyContent) : 0;
  421. },
  422. maxPrice() {
  423. const config = getApp().globalData.configData || [];
  424. const item = config.find(i => i.keyName === 'max_price');
  425. return item ? parseFloat(item.keyContent) : 0;
  426. },
  427. minMumber() {
  428. const config = getApp().globalData.configData || [];
  429. const item = config.find(i => i.keyName === 'min_number');
  430. return item ? parseFloat(item.keyContent) : 0;
  431. },
  432. // 计算比预计回收多的金额(商品回收价格 - (商品回收价格 * 0.066))
  433. extraRecycleAmount() {
  434. const minPrice = parseFloat(this.priceRange.min) || 0;
  435. const maxPrice = parseFloat(this.priceRange.max) || 0;
  436. if (minPrice === 0 && maxPrice === 0) {
  437. return {
  438. min: '0.00',
  439. max: '0.00',
  440. display: '0.00元'
  441. };
  442. }
  443. let re_key_numer = this.re_key_numer || 0.066
  444. // 计算减去6.6%后的金额
  445. const minExtra = minPrice - (minPrice * re_key_numer);
  446. const maxExtra = maxPrice - (maxPrice * re_key_numer);
  447. // 如果最小值和最大值相等,显示单个值
  448. if (minPrice === maxPrice) {
  449. return {
  450. min: minExtra.toFixed(2),
  451. max: maxExtra.toFixed(2),
  452. display: `${minExtra.toFixed(2)}`
  453. };
  454. }
  455. // 显示区间
  456. return {
  457. min: minExtra.toFixed(2),
  458. max: maxExtra.toFixed(2),
  459. display: `${minExtra.toFixed(2)}-${maxExtra.toFixed(2)}`
  460. };
  461. },
  462. },
  463. methods: {
  464. showPriceInfoPopups() {
  465. console.log('showPriceInfoPopup called');
  466. this.isFromPickupFlow = false // 标记是从帮助按钮触发
  467. this.showPriceInfoPopup = true
  468. },
  469. getSelectKey() {
  470. const keys = ['home', 'recycle', 'my']
  471. return keys[this.value] || 'recycle'
  472. },
  473. fetchGoodsList(categoryId, page = 1, callback) {
  474. this.$api('getClassGoodsList', {
  475. classId: categoryId,
  476. pageNo: page,
  477. pageSize: this.pageSize
  478. }, res => {
  479. if (res.code === 200 && res.result && Array.isArray(res.result.records)) {
  480. const oldList = this.allProducts[categoryId] || []
  481. const newList = page === 1 ? res.result.records : oldList.concat(res.result.records)
  482. this.$set(this.allProducts, categoryId, newList)
  483. this.$set(this.allProductsPage, categoryId, page)
  484. this.$set(this.allProductsTotal, categoryId, res.result.total)
  485. }
  486. if (callback) callback()
  487. })
  488. },
  489. // 获取分类商品总数
  490. getCategoryItemCount(index) {
  491. const categoryId = this.categories[index]?.id
  492. const categoryItems = this.allProducts[categoryId] || []
  493. return categoryItems.reduce((sum, item) => {
  494. if (item.brandStyleQuantities && Object.keys(item.brandStyleQuantities).length > 0) {
  495. return sum + Object.values(item.brandStyleQuantities).reduce((styleSum, qty) => styleSum + qty, 0)
  496. }
  497. if (item.brandQuantities && Object.keys(item.brandQuantities).length > 0) {
  498. return sum + Object.values(item.brandQuantities).reduce((brandSum, qty) => brandSum + qty, 0)
  499. }
  500. return sum + (item.quantity || 0)
  501. }, 0)
  502. },
  503. // 切换分类
  504. switchCategory(index) {
  505. this.currentCategory = index
  506. this.loadingMore = false
  507. this.finished = false
  508. const categoryId = this.categories[index]?.id
  509. // console.log(categoryId,'switchCategory')
  510. if (!this.allProducts[categoryId]) {
  511. this.fetchGoodsList(categoryId, 1)
  512. }
  513. },
  514. // 更新商品数量
  515. updateQuantity(index, delta) {
  516. const categoryId = this.categories[this.currentCategory]?.id
  517. const item = this.allProducts[categoryId]?.[index]
  518. if (!item) return
  519. // 如果是减少数量且delta为负数
  520. if (delta < 0) {
  521. // 检查是否有多个品牌款式
  522. if (item.brandStyleQuantities && Object.keys(item.brandStyleQuantities).length > 1) {
  523. // 有多个品牌款式,显示选择弹窗
  524. this.reduceItem = { item, index, delta }
  525. const reduceStyleList = Object.entries(item.brandStyleQuantities)
  526. .filter(([uniqueKey, quantity]) => quantity > 0)
  527. .map(([uniqueKey, quantity]) => {
  528. const cacheInfo = item.styleCache[uniqueKey]
  529. return {
  530. uniqueKey,
  531. quantity,
  532. name: cacheInfo ? `${cacheInfo.brandInfo.name} - ${cacheInfo.styleInfo.name}` : '未知款式',
  533. logo: cacheInfo ? cacheInfo.brandInfo.logo : ''
  534. }
  535. })
  536. this.$refs.brandSelector.openReducePopup(reduceStyleList)
  537. return
  538. } else if (item.brandStyleQuantities && Object.keys(item.brandStyleQuantities).length === 1) {
  539. // 只有一个品牌款式,直接减少
  540. const uniqueKey = Object.keys(item.brandStyleQuantities)[0]
  541. const currentQty = item.brandStyleQuantities[uniqueKey] || 0
  542. const newQty = Math.max(0, currentQty + delta)
  543. this.$set(item.brandStyleQuantities, uniqueKey, newQty)
  544. // 如果数量为0,删除该品牌款式
  545. if (newQty === 0) {
  546. delete item.brandStyleQuantities[uniqueKey]
  547. if (item.styleCache && item.styleCache[uniqueKey]) {
  548. delete item.styleCache[uniqueKey]
  549. }
  550. }
  551. return
  552. } else if (item.brandQuantities && Object.keys(item.brandQuantities).length > 1) {
  553. // 有多个品牌,显示选择弹窗(兼容旧数据)
  554. this.reduceItem = { item, index, delta }
  555. const reduceBrandList = Object.entries(item.brandQuantities)
  556. .filter(([brandId, quantity]) => quantity > 0)
  557. .map(([brandId, quantity]) => {
  558. const brandInfo = this.getBrandInfo(brandId)
  559. return {
  560. brandId,
  561. quantity,
  562. name: brandInfo ? brandInfo.name : '未知品牌',
  563. logo: brandInfo ? brandInfo.logo : ''
  564. }
  565. })
  566. this.$refs.brandSelector.openReducePopup(reduceBrandList)
  567. return
  568. } else if (item.brandQuantities && Object.keys(item.brandQuantities).length === 1) {
  569. // 只有一个品牌,直接减少(兼容旧数据)
  570. const brandId = Object.keys(item.brandQuantities)[0]
  571. const currentQty = item.brandQuantities[brandId] || 0
  572. const newQty = Math.max(0, currentQty + delta)
  573. this.$set(item.brandQuantities, brandId, newQty)
  574. // 如果数量为0,删除该品牌
  575. if (newQty === 0) {
  576. delete item.brandQuantities[brandId]
  577. }
  578. return
  579. } else {
  580. // 没有品牌数量,使用原来的逻辑
  581. let newQuantity = (item.quantity || 0) + delta
  582. if (newQuantity < 0) newQuantity = 0
  583. this.$set(item, 'quantity', newQuantity)
  584. return
  585. }
  586. }
  587. // 品牌商品且数量为0且加一时
  588. if (item.isPin === 'Y' && (item.quantity || 0) === 0 && delta > 0) {
  589. this.pendingBrandIndex = index
  590. // 检查是否需要显示回收规则
  591. if (item.isRecycleRules === 'Y') {
  592. this.isWaitingForBrandSelection = true;
  593. this.showRules(item); // 先显示回收规则
  594. } else {
  595. // 不需要显示规则,直接打开品牌选择
  596. this.$refs.brandSelector.open(item.id)
  597. }
  598. return
  599. }
  600. // 无品牌商品,数量为0且加一时
  601. if (item.isPin !== 'Y' && (item.quantity || 0) === 0 && delta > 0) {
  602. this.pendingBrandIndex = index
  603. // 检查是否需要显示回收规则
  604. if (item.isRecycleRules === 'Y') {
  605. this.isWaitingForBrandSelection = false; // 标记为无品牌
  606. this.showRules(item)
  607. } else {
  608. // 不需要显示规则,直接加数量
  609. let newQuantity = (item.quantity || 0) + delta
  610. if (newQuantity < 0) newQuantity = 0
  611. this.$set(item, 'quantity', newQuantity)
  612. this.pendingBrandIndex = null
  613. }
  614. return
  615. }
  616. // 其它情况直接加数量
  617. let newQuantity = (item.quantity || 0) + delta
  618. if (newQuantity < 0) newQuantity = 0
  619. this.$set(item, 'quantity', newQuantity)
  620. },
  621. // 处理品牌确认事件(新的款式选择流程)
  622. onBrandConfirm(data) {
  623. if (this.pendingBrandIndex !== null) {
  624. const categoryId = this.categories[this.currentCategory]?.id
  625. const item = this.allProducts[categoryId]?.[this.pendingBrandIndex]
  626. if (item && data.selectedStyles && data.selectedStyles.length > 0) {
  627. // 初始化品牌款式数量对象
  628. if (!item.brandStyleQuantities) {
  629. this.$set(item, 'brandStyleQuantities', {})
  630. }
  631. // 清理当前品牌的所有款式数据
  632. const brandPrefix = `${data.brandInfo.id}_`
  633. Object.keys(item.brandStyleQuantities).forEach(key => {
  634. if (key.startsWith(brandPrefix)) {
  635. delete item.brandStyleQuantities[key]
  636. if (item.styleCache && item.styleCache[key]) {
  637. delete item.styleCache[key]
  638. }
  639. }
  640. })
  641. // 为每个选中的款式设置数量(只保存有数量的款式)
  642. data.selectedStyles.forEach(style => {
  643. if (style.quantity > 0) {
  644. const uniqueKey = `${data.brandInfo.id}_${style.id}`
  645. this.$set(item.brandStyleQuantities, uniqueKey, style.quantity)
  646. // 缓存款式信息用于后续显示
  647. if (!item.styleCache) {
  648. this.$set(item, 'styleCache', {})
  649. }
  650. this.$set(item.styleCache, uniqueKey, {
  651. brandInfo: data.brandInfo,
  652. styleInfo: style
  653. })
  654. }
  655. })
  656. // 清除原来的quantity和brandQuantities(如果存在)
  657. if (item.quantity) {
  658. this.$set(item, 'quantity', 0)
  659. }
  660. if (item.brandQuantities) {
  661. this.$set(item, 'brandQuantities', {})
  662. }
  663. // 品牌选择完成后自动打开商品明细弹窗
  664. this.$nextTick(() => {
  665. this.showDetailPanel = true
  666. })
  667. }
  668. this.pendingBrandIndex = null
  669. }
  670. },
  671. // 处理减少品牌选择事件
  672. onReduceSelect(selectInfo) {
  673. const { item, index, delta } = this.reduceItem
  674. if (selectInfo.uniqueKey) {
  675. // 新的品牌款式减少逻辑
  676. const currentQty = item.brandStyleQuantities[selectInfo.uniqueKey] || 0
  677. const newQty = Math.max(0, currentQty + delta)
  678. this.$set(item.brandStyleQuantities, selectInfo.uniqueKey, newQty)
  679. // 如果数量为0,删除该品牌款式
  680. if (newQty === 0) {
  681. delete item.brandStyleQuantities[selectInfo.uniqueKey]
  682. if (item.styleCache && item.styleCache[selectInfo.uniqueKey]) {
  683. delete item.styleCache[selectInfo.uniqueKey]
  684. }
  685. }
  686. } else if (selectInfo.brandId) {
  687. // 兼容旧的品牌减少逻辑
  688. const currentQty = item.brandQuantities[selectInfo.brandId] || 0
  689. const newQty = Math.max(0, currentQty + delta)
  690. this.$set(item.brandQuantities, selectInfo.brandId, newQty)
  691. // 如果数量为0,删除该品牌
  692. if (newQty === 0) {
  693. delete item.brandQuantities[selectInfo.brandId]
  694. }
  695. }
  696. this.reduceItem = null
  697. },
  698. // 处理品牌选择器关闭事件
  699. onBrandSelectorClose() {
  700. // 如果用户取消品牌选择,重置状态
  701. this.pendingBrandIndex = null
  702. this.isWaitingForBrandSelection = false
  703. },
  704. // 获取已有的款式数量
  705. getExistingQuantities(brandId, callback) {
  706. if (this.pendingBrandIndex !== null) {
  707. const categoryId = this.categories[this.currentCategory]?.id
  708. const item = this.allProducts[categoryId]?.[this.pendingBrandIndex]
  709. if (item && item.brandStyleQuantities) {
  710. // 过滤出当前品牌的款式数量
  711. const existingQuantities = {}
  712. Object.entries(item.brandStyleQuantities).forEach(([uniqueKey, quantity]) => {
  713. if (uniqueKey.startsWith(`${brandId}_`)) {
  714. existingQuantities[uniqueKey] = quantity
  715. }
  716. })
  717. callback(existingQuantities)
  718. } else {
  719. callback({})
  720. }
  721. } else {
  722. callback({})
  723. }
  724. },
  725. // 打开商品明细弹窗
  726. openProductDetail(selectedItem) {
  727. if (!selectedItem.brandId || !selectedItem.styleId) {
  728. uni.showToast({
  729. title: '该商品无法查看明细',
  730. icon: 'none'
  731. })
  732. return
  733. }
  734. // 查找原始商品信息
  735. const originalItem = this.findOriginalItem(selectedItem.id)
  736. if (!originalItem) {
  737. uni.showToast({
  738. title: '商品信息不存在',
  739. icon: 'none'
  740. })
  741. return
  742. }
  743. // 构建商品信息
  744. const productInfo = {
  745. id: originalItem.id,
  746. name: originalItem.name,
  747. image: originalItem.image
  748. }
  749. // 构建品牌信息
  750. const brandInfo = {
  751. id: selectedItem.brandId,
  752. name: selectedItem.brandName,
  753. logo: selectedItem.brandImage
  754. }
  755. // 获取该品牌下的所有款式数量
  756. const existingQuantities = {}
  757. if (originalItem.brandStyleQuantities) {
  758. Object.entries(originalItem.brandStyleQuantities).forEach(([uniqueKey, quantity]) => {
  759. if (uniqueKey.startsWith(`${selectedItem.brandId}_`)) {
  760. existingQuantities[uniqueKey] = quantity
  761. }
  762. })
  763. }
  764. // 打开商品明细弹窗
  765. this.$refs.productDetailPopup.open(productInfo, brandInfo, existingQuantities, originalItem.styleCache || {})
  766. },
  767. // 处理商品明细确认修改事件
  768. onDetailConfirmChanges(data) {
  769. const { productInfo, brandInfo, updatedStyles } = data
  770. // 查找原始商品
  771. const originalItem = this.findOriginalItem(productInfo.id)
  772. if (!originalItem) return
  773. // 清理当前品牌的所有款式数据
  774. const brandPrefix = `${brandInfo.id}_`
  775. if (originalItem.brandStyleQuantities) {
  776. Object.keys(originalItem.brandStyleQuantities).forEach(key => {
  777. if (key.startsWith(brandPrefix)) {
  778. delete originalItem.brandStyleQuantities[key]
  779. if (originalItem.styleCache && originalItem.styleCache[key]) {
  780. delete originalItem.styleCache[key]
  781. }
  782. }
  783. })
  784. }
  785. // 重新设置款式数据
  786. if (!originalItem.brandStyleQuantities) {
  787. this.$set(originalItem, 'brandStyleQuantities', {})
  788. }
  789. if (!originalItem.styleCache) {
  790. this.$set(originalItem, 'styleCache', {})
  791. }
  792. updatedStyles.forEach(style => {
  793. if (style.quantity > 0) {
  794. const uniqueKey = `${brandInfo.id}_${style.id}`
  795. this.$set(originalItem.brandStyleQuantities, uniqueKey, style.quantity)
  796. this.$set(originalItem.styleCache, uniqueKey, {
  797. brandInfo: brandInfo,
  798. styleInfo: style
  799. })
  800. }
  801. })
  802. // uni.showToast({
  803. // title: '修改成功',
  804. // icon: 'success'
  805. // })
  806. },
  807. // 处理商品明细弹窗关闭事件
  808. onDetailPopupClose() {
  809. // 弹窗关闭时的处理逻辑
  810. },
  811. // 处理规则确认事件
  812. onRuleConfirm() {
  813. // 如果是在等待品牌选择的状态下关闭规则弹窗,则接着打开品牌选择
  814. if (this.isWaitingForBrandSelection) {
  815. this.isWaitingForBrandSelection = false; // 清除等待状态
  816. const categoryId = this.categories[this.currentCategory]?.id;
  817. const item = this.allProducts[categoryId]?.[this.pendingBrandIndex];
  818. // 记录该商品的规则已被查看
  819. this.viewedRuleItems.add(item.id);
  820. this.$refs.brandSelector.open(item.id); // 打开品牌索引弹窗
  821. } else if (this.pendingBrandIndex !== null) {
  822. // 无品牌商品,规则弹窗关闭后加数量
  823. const categoryId = this.categories[this.currentCategory]?.id;
  824. const item = this.allProducts[categoryId]?.[this.pendingBrandIndex];
  825. if (item) {
  826. let newQuantity = (item.quantity || 0) + 1
  827. this.$set(item, 'quantity', newQuantity)
  828. }
  829. this.pendingBrandIndex = null
  830. }
  831. },
  832. // 获取品牌信息
  833. getBrandInfo(brandId) {
  834. // 从所有商品的品牌缓存中查找品牌信息
  835. for (const productId in this.brandCache) {
  836. const brandInfo = this.brandCache[productId].find(brand => brand.id === brandId)
  837. if (brandInfo) {
  838. return brandInfo
  839. }
  840. }
  841. // 如果缓存中没有找到,也从当前brandList中查找(兼容性)
  842. return this.brandList.find(brand => brand.id === brandId)
  843. },
  844. // 获取商品的总数量(所有品牌款式)
  845. getItemTotalQuantity(item) {
  846. if (item.brandStyleQuantities && Object.keys(item.brandStyleQuantities).length > 0) {
  847. return Object.values(item.brandStyleQuantities).reduce((sum, qty) => sum + qty, 0)
  848. }
  849. if (item.brandQuantities && Object.keys(item.brandQuantities).length > 0) {
  850. return Object.values(item.brandQuantities).reduce((sum, qty) => sum + qty, 0)
  851. }
  852. return item.quantity || 0
  853. },
  854. // 显示回收规则
  855. showRules(item) {
  856. // 检查是否需要显示回收规则
  857. if (item.isRecycleRules !== 'Y') {
  858. // 不需要显示规则,直接添加数量
  859. if (item.isPin === 'Y') {
  860. // 品牌商品,直接打开品牌选择
  861. this.pendingBrandIndex = this.recycleList.findIndex(i => i.id === item.id)
  862. this.$refs.brandSelector.open(item.id)
  863. } else {
  864. // 非品牌商品,直接加数量
  865. let newQuantity = (item.quantity || 0) + 1
  866. this.$set(item, 'quantity', newQuantity)
  867. }
  868. return
  869. }
  870. // isPin=Y: 弹规则,读到底部后自动弹品牌;isPin=N: 只弹规则
  871. if (item.isPin === 'Y') {
  872. // 检查该商品是否已经查看过规则
  873. if (this.viewedRuleItems.has(item.id)) {
  874. // 如果已经查看过,直接跳过规则弹窗,进入品牌选择
  875. this.isWaitingForBrandSelection = false;
  876. this.$refs.brandSelector.open(item.id);
  877. return;
  878. }
  879. // 获取回收规则富文本
  880. this.$api('getGoodsRecycleRule', { goodsId: item.id }, res => {
  881. const ruleContent = (res.code === 200 && res.result) ? res.result : '<p>暂无回收规则</p>'
  882. this.$refs.rulePopup.openRulePopup(ruleContent)
  883. // 规则弹窗关闭后自动弹品牌弹窗逻辑在onRuleConfirm已实现
  884. })
  885. } else {
  886. // isPin=N 只弹规则
  887. this.$api('getGoodsRecycleRule', { goodsId: item.id }, res => {
  888. const ruleContent = (res.code === 200 && res.result) ? res.result : '<p>暂无回收规则</p>'
  889. this.$refs.rulePopup.openRulePopup(ruleContent)
  890. // 不弹品牌弹窗
  891. this.isWaitingForBrandSelection = false;
  892. })
  893. }
  894. },
  895. showMore() {
  896. uni.showToast({
  897. title: '更多规则请咨询客服',
  898. icon: 'none'
  899. })
  900. },
  901. submitOrder() {
  902. // 检查用户是否被拉入黑名单
  903. if (this.isUserBlacklisted) {
  904. uni.showModal({
  905. title: '提示',
  906. content: '您的账户已被限制使用回收服务,如有疑问请联系客服。',
  907. showCancel: false,
  908. confirmText: '我知道了'
  909. })
  910. return
  911. }
  912. if (this.totalCount < this.minMumber || Number(this.totalPrice) < this.minMoney) {
  913. uni.showToast({
  914. title: `各品类混合需要满${this.minMumber}${this.totalUnitText}并且各品类混合需要满${this.minMoney}元才能回收哦`,
  915. icon: 'none'
  916. })
  917. return
  918. }
  919. // 检查最高回收金额是否达到配置的maxPrice要求
  920. if (this.maxPrice > 0 && Number(this.priceRange.max) < this.maxPrice) {
  921. uni.showToast({
  922. title: `最高回收金额需要达到${this.maxPrice}元才能预约回收`,
  923. icon: 'none',
  924. duration: 3000
  925. })
  926. return
  927. }
  928. // 关闭商品明细弹窗
  929. this.showDetailPanel = false
  930. this.$refs.rulePopup.openConfirmPopup();
  931. },
  932. handlePickupCancel() {
  933. // 取消回收的处理逻辑
  934. },
  935. handlePickupAgree() {
  936. // 显示总的回收规则弹窗
  937. this.showGeneralRulesPopup()
  938. },
  939. // 显示总的回收规则弹窗
  940. showGeneralRulesPopup() {
  941. this.isFromPickupFlow = true // 标记是从预约流程触发
  942. this.showPriceInfoPopup = true
  943. },
  944. // 关闭价格说明弹窗的方法
  945. closePriceInfoPopup() {
  946. console.log('closePriceInfoPopup called');
  947. this.showPriceInfoPopup = false
  948. // 如果是从预约流程触发的,关闭弹窗后执行跳转逻辑
  949. if (this.isFromPickupFlow) {
  950. this.isFromPickupFlow = false // 重置标志
  951. this.executePickupFlow()
  952. }
  953. },
  954. // 执行预约流程
  955. executePickupFlow() {
  956. uni.showLoading({
  957. title: '提交中...'
  958. })
  959. setTimeout(() => {
  960. uni.hideLoading()
  961. uni.showToast({
  962. title: '预约成功',
  963. icon: 'success'
  964. })
  965. this.goToPickup()
  966. }, 1500)
  967. },
  968. goToPickup() {
  969. // 获取所有选中的衣物(所有分类)
  970. const selectedItems = this.selectedProducts.map(item => {
  971. let desc = '允许脏破烂,160码以上'
  972. if (item.brandName && item.styleName) {
  973. desc = `品牌:${item.brandName} | 款式:${item.styleName}`
  974. } else if (item.brandName) {
  975. desc = `品牌:${item.brandName}`
  976. } else if (item.styleName) {
  977. desc = `款式:${item.styleName}`
  978. }
  979. const baseItem = {
  980. id: item.id,
  981. name: item.name,
  982. icon: item.image,
  983. quantity: item.quantity,
  984. unitPrice: item.price,
  985. maxPrice: item.maxPrice,
  986. desc: desc
  987. }
  988. // 如果有品牌信息,添加品牌相关字段
  989. if (item.brandId) {
  990. baseItem.brandId = item.brandId
  991. baseItem.brandName = item.brandName
  992. baseItem.brandImage = item.brandImage
  993. }
  994. // 如果有款式信息,添加款式相关字段
  995. if (item.styleId) {
  996. baseItem.styleId = item.styleId
  997. baseItem.styleName = item.styleName
  998. baseItem.styleImage = item.styleImage
  999. }
  1000. return baseItem
  1001. })
  1002. const itemsStr = encodeURIComponent(JSON.stringify(selectedItems))
  1003. uni.navigateTo({
  1004. url: `/pages/subcomponent/pickup?fromRecycle=true&items=${itemsStr}`
  1005. })
  1006. },
  1007. checkBrand(index) {
  1008. const categoryId = this.categories[this.currentCategory]?.id
  1009. const item = this.allProducts[categoryId]?.[index]
  1010. if (item?.id) {
  1011. this.pendingBrandIndex = index
  1012. this.$refs.brandSelector.open(item.id)
  1013. }
  1014. },
  1015. // 添加下拉刷新方法
  1016. async refreshData() {
  1017. try {
  1018. // 这里可以添加刷新数据的逻辑,比如重新获取商品列表等
  1019. // 示例:重新初始化数据
  1020. this.currentCategory = 0
  1021. Object.values(this.allProducts).forEach(categoryItems => {
  1022. categoryItems.forEach(item => {
  1023. item.quantity = 0
  1024. if (item.brandQuantities) {
  1025. item.brandQuantities = {}
  1026. }
  1027. if (item.brandStyleQuantities) {
  1028. item.brandStyleQuantities = {}
  1029. }
  1030. if (item.styleCache) {
  1031. item.styleCache = {}
  1032. }
  1033. })
  1034. })
  1035. // 清空已查看规则的记录
  1036. this.viewedRuleItems.clear()
  1037. // 清空品牌缓存
  1038. this.brandCache = {}
  1039. // 模拟网络请求延迟
  1040. await new Promise(resolve => setTimeout(resolve, 1000))
  1041. uni.showToast({
  1042. title: '刷新成功',
  1043. icon: 'success'
  1044. })
  1045. } catch (error) {
  1046. uni.showToast({
  1047. title: '刷新失败',
  1048. icon: 'none'
  1049. })
  1050. } finally {
  1051. // 停止下拉刷新动画
  1052. uni.stopPullDownRefresh()
  1053. }
  1054. },
  1055. toggleDetailPanel() {
  1056. this.showDetailPanel = !this.showDetailPanel
  1057. },
  1058. // 添加更多衣物
  1059. addMoreItems() {
  1060. this.showDetailPanel = false
  1061. },
  1062. // 检查新用户首次访问规则
  1063. checkFirstTimeRules() {
  1064. // 从本地存储检查是否已显示过首次规则
  1065. const hasShown = uni.getStorageSync('hasShownFirstTimeRules')
  1066. if (!hasShown && !this.hasShownFirstTimeRules) {
  1067. this.showFirstTimeRulesPopup()
  1068. }
  1069. },
  1070. // 显示新用户首次访问规则弹窗
  1071. showFirstTimeRulesPopup() {
  1072. // 显示价格说明弹窗
  1073. this.showPriceInfoPopup = true
  1074. // 标记已显示过首次规则
  1075. this.hasShownFirstTimeRules = true
  1076. uni.setStorageSync('hasShownFirstTimeRules', true)
  1077. },
  1078. fetchUserInfo() {
  1079. if (uni.getStorageSync('token')) {
  1080. this.login_status = getApp().globalData.login_status;
  1081. this.$api("getUserByToken", {}, (res) => {
  1082. if (res.code == 200) {
  1083. this.userInfo = res.result
  1084. // 检查用户是否被拉入黑名单
  1085. this.isUserBlacklisted = res.result.isBlack === 'Y'
  1086. // isTuiType 为0用户,1推广达人,2推广大使
  1087. }
  1088. })
  1089. } else {
  1090. this.login_status = false;
  1091. }
  1092. },
  1093. updateQuantityByProduct(item, delta) {
  1094. // 在明细弹窗中更新数量
  1095. if (item.brandId && item.styleId) {
  1096. // 有品牌和款式ID的商品(新的品牌款式逻辑)
  1097. const originalItem = this.findOriginalItem(item.id)
  1098. if (originalItem && originalItem.brandStyleQuantities) {
  1099. const uniqueKey = `${item.brandId}_${item.styleId}`
  1100. const currentQty = originalItem.brandStyleQuantities[uniqueKey] || 0
  1101. const newQty = Math.max(0, currentQty + delta)
  1102. if (newQty > 0) {
  1103. this.$set(originalItem.brandStyleQuantities, uniqueKey, newQty)
  1104. } else {
  1105. // 如果数量为0,删除该品牌款式
  1106. delete originalItem.brandStyleQuantities[uniqueKey]
  1107. if (originalItem.styleCache && originalItem.styleCache[uniqueKey]) {
  1108. delete originalItem.styleCache[uniqueKey]
  1109. }
  1110. }
  1111. // 同步更新显示的数量
  1112. item.quantity = newQty
  1113. }
  1114. } else if (item.brandId) {
  1115. // 有品牌ID但没有款式ID的商品(兼容旧逻辑)
  1116. const originalItem = this.findOriginalItem(item.id)
  1117. if (originalItem && originalItem.brandQuantities) {
  1118. const currentQty = originalItem.brandQuantities[item.brandId] || 0
  1119. const newQty = Math.max(0, currentQty + delta)
  1120. if (newQty > 0) {
  1121. this.$set(originalItem.brandQuantities, item.brandId, newQty)
  1122. } else {
  1123. // 如果数量为0,删除该品牌
  1124. delete originalItem.brandQuantities[item.brandId]
  1125. }
  1126. // 同步更新显示的数量
  1127. item.quantity = newQty
  1128. }
  1129. } else {
  1130. // 没有品牌的商品
  1131. if (!item.quantity) item.quantity = 0
  1132. item.quantity = Math.max(0, item.quantity + delta)
  1133. // 同步到原商品
  1134. const originalItem = this.findOriginalItem(item.id)
  1135. if (originalItem) {
  1136. this.$set(originalItem, 'quantity', item.quantity)
  1137. }
  1138. }
  1139. },
  1140. // 查找原始商品对象
  1141. findOriginalItem(itemId) {
  1142. for (const categoryItems of Object.values(this.allProducts)) {
  1143. const item = categoryItems.find(i => i.id === itemId)
  1144. if (item) return item
  1145. }
  1146. return null
  1147. },
  1148. loadMoreGoods() {
  1149. const categoryId = this.categories[this.currentCategory]?.id
  1150. const page = (this.allProductsPage[categoryId] || 1) + 1
  1151. const total = this.allProductsTotal[categoryId] || 0
  1152. const loaded = (this.allProducts[categoryId] || []).length
  1153. if (this.loadingMore || this.finished) return
  1154. if (loaded < total) {
  1155. this.loadingMore = true
  1156. this.fetchGoodsList(categoryId, page, () => {
  1157. this.loadingMore = false
  1158. // 判断是否加载完
  1159. const newLoaded = (this.allProducts[categoryId] || []).length
  1160. this.finished = newLoaded >= (this.allProductsTotal[categoryId] || 0)
  1161. })
  1162. } else {
  1163. this.finished = true
  1164. }
  1165. },
  1166. // 初始化页面数据的方法
  1167. initializePageData() {
  1168. const options = this.loadOptions || {}
  1169. if (options && options.categoryId) {
  1170. const idx = this.categories.findIndex(c => c.id == options.categoryId)
  1171. if (idx !== -1) this.currentCategory = idx
  1172. }
  1173. if (this.categories.length > 0) {
  1174. this.fetchGoodsList(this.categories[this.currentCategory].id, 1)
  1175. }
  1176. uni.$on('bannerListUpdated', () => {
  1177. this.$forceUpdate && this.$forceUpdate()
  1178. })
  1179. if (getApp().globalData.bannerList && getApp().globalData.bannerList.length > 0) {
  1180. this.$forceUpdate && this.$forceUpdate()
  1181. }
  1182. // 检查全局清空标志(兼容 reLaunch)
  1183. if (getApp().globalData.shouldClearRecycle) {
  1184. Object.values(this.allProducts).forEach(categoryItems => {
  1185. categoryItems.forEach(item => {
  1186. this.$set(item, 'quantity', 0)
  1187. if (item.brandQuantities) {
  1188. this.$set(item, 'brandQuantities', {})
  1189. }
  1190. if (item.brandStyleQuantities) {
  1191. this.$set(item, 'brandStyleQuantities', {})
  1192. }
  1193. if (item.styleCache) {
  1194. this.$set(item, 'styleCache', {})
  1195. }
  1196. })
  1197. })
  1198. // 清空已查看规则的记录
  1199. this.viewedRuleItems.clear()
  1200. this.showDetailPanel = false
  1201. this.brandCache = {} // 清空品牌缓存
  1202. this.$forceUpdate()
  1203. getApp().globalData.shouldClearRecycle = false
  1204. }
  1205. },
  1206. },
  1207. created() {
  1208. this.currentCategory = 0
  1209. this.$nextTick(() => {
  1210. if (this.categories.length > 0) {
  1211. const firstCategoryId = this.categories[0]?.id
  1212. if (firstCategoryId) {
  1213. this.fetchGoodsList(firstCategoryId, 1)
  1214. }
  1215. }
  1216. })
  1217. },
  1218. mounted() {
  1219. this.$nextTick(() => {
  1220. const query = uni.createSelectorQuery().in(this)
  1221. query.select('.uv-tabbar').boundingClientRect(rect => {
  1222. if (rect && rect.height) {
  1223. this.tabbarHeight = rect.height
  1224. } else {
  1225. this.tabbarHeight = uni.upx2px ? uni.upx2px(95) : 45
  1226. }
  1227. // console.log(this.tabbarHeight,'tabbarHeight')
  1228. }).exec()
  1229. })
  1230. },
  1231. onLoad(options) {
  1232. // 保存options参数
  1233. this.loadOptions = options
  1234. // 检查App数据是否已经准备好
  1235. if (!getApp().globalData.isAppDataReady) {
  1236. // 显示加载状态
  1237. uni.showLoading({
  1238. title: '加载中...',
  1239. mask: true
  1240. })
  1241. // 监听App数据准备完成事件
  1242. uni.$on('appDataReady', () => {
  1243. uni.hideLoading()
  1244. this.initializePageData()
  1245. })
  1246. } else {
  1247. // App数据已经准备好,直接初始化页面数据
  1248. this.initializePageData()
  1249. }
  1250. },
  1251. onUnload() {
  1252. uni.$off('bannerListUpdated')
  1253. // 移除事件监听
  1254. uni.$off('clearRecycleOrderData')
  1255. },
  1256. onShow() {
  1257. // 获取用户信息,检查黑名单状态
  1258. this.fetchUserInfo()
  1259. // 检查是否为新用户首次访问,显示回收规则
  1260. this.checkFirstTimeRules()
  1261. const id = getApp().globalData.targetRecycleCategoryId
  1262. if (id) {
  1263. const trySwitch = () => {
  1264. if (this.categories.length > 0) {
  1265. const idx = this.categories.findIndex(c => String(c.id) === String(id))
  1266. if (idx !== -1) {
  1267. this.currentCategory = idx
  1268. const categoryId = this.categories[idx]?.id
  1269. if (categoryId && !this.allProducts[categoryId]) {
  1270. this.loadingMore = false
  1271. this.finished = false
  1272. this.fetchGoodsList(categoryId, 1)
  1273. }
  1274. }
  1275. getApp().globalData.targetRecycleCategoryId = null
  1276. } else {
  1277. setTimeout(trySwitch, 100)
  1278. }
  1279. }
  1280. trySwitch()
  1281. }
  1282. // 检查全局清空标志
  1283. if (getApp().globalData.shouldClearRecycle) {
  1284. Object.values(this.allProducts).forEach(categoryItems => {
  1285. categoryItems.forEach(item => {
  1286. this.$set(item, 'quantity', 0)
  1287. if (item.brandQuantities) {
  1288. this.$set(item, 'brandQuantities', {})
  1289. }
  1290. if (item.brandStyleQuantities) {
  1291. this.$set(item, 'brandStyleQuantities', {})
  1292. }
  1293. if (item.styleCache) {
  1294. this.$set(item, 'styleCache', {})
  1295. }
  1296. })
  1297. })
  1298. // 清空已查看规则的记录
  1299. this.viewedRuleItems.clear()
  1300. this.showDetailPanel = false
  1301. this.brandCache = {} // 清空品牌缓存
  1302. this.$forceUpdate()
  1303. getApp().globalData.shouldClearRecycle = false
  1304. }
  1305. // 监听清除订单数据的事件
  1306. uni.$on('clearRecycleOrderData', () => {
  1307. // 清除所有商品的选中数量,保证响应式
  1308. Object.values(this.allProducts).forEach(categoryItems => {
  1309. categoryItems.forEach(item => {
  1310. this.$set(item, 'quantity', 0)
  1311. if (item.brandQuantities) {
  1312. this.$set(item, 'brandQuantities', {})
  1313. }
  1314. if (item.brandStyleQuantities) {
  1315. this.$set(item, 'brandStyleQuantities', {})
  1316. }
  1317. if (item.styleCache) {
  1318. this.$set(item, 'styleCache', {})
  1319. }
  1320. })
  1321. })
  1322. // 清空已查看规则的记录
  1323. this.viewedRuleItems.clear()
  1324. // 清空品牌缓存
  1325. this.brandCache = {}
  1326. // 重置其他相关数据
  1327. this.showDetailPanel = false
  1328. this.$forceUpdate()
  1329. })
  1330. },
  1331. watch: {
  1332. categories(newVal) {
  1333. const id = getApp().globalData.targetRecycleCategoryId
  1334. const idx = newVal.findIndex(c => String(c.id) === String(id))
  1335. if (id && newVal.length > 0 && idx !== -1) {
  1336. this.currentCategory = idx
  1337. getApp().globalData.targetRecycleCategoryId = null
  1338. // 自动加载右侧商品
  1339. const categoryId = newVal[idx]?.id
  1340. if (categoryId && !this.allProducts[categoryId]) {
  1341. this.loadingMore = false
  1342. this.finished = false
  1343. this.fetchGoodsList(categoryId, 1)
  1344. }
  1345. }
  1346. }
  1347. },
  1348. }
  1349. </script>
  1350. <style lang="scss" scoped>
  1351. .container {
  1352. display: flex;
  1353. flex-direction: column;
  1354. height: 100vh;
  1355. background-color: #f5f5f5;
  1356. overflow: hidden;
  1357. }
  1358. .goods-list {
  1359. // flex: 1;
  1360. display: flex;
  1361. position: relative;
  1362. height: calc(110vh - 320rpx - 160rpx - env(safe-area-inset-bottom));
  1363. /* 减去banner、底部栏和绿色提示条的高度 */
  1364. margin-top: -10rpx;
  1365. z-index: 2;
  1366. border-radius: 20rpx 20rpx 0 0;
  1367. overflow: hidden;
  1368. padding: 30rpx;
  1369. box-shadow: 0 -4rpx 8rpx rgba(0, 0, 0, 0.05);
  1370. background: linear-gradient(to bottom, #fff7e8, 20%, #ffffff);
  1371. .category-nav {
  1372. width: 20%;
  1373. background: #ffffff;
  1374. height: 100%;
  1375. border-right: 1rpx solid rgba(255, 126, 14, 0.1);
  1376. margin: 1rpx;
  1377. border-radius: 20rpx 0 0 0;
  1378. margin-right: 20rpx;
  1379. overflow-y: auto;
  1380. scrollbar-width: none;
  1381. /* Firefox */
  1382. -ms-overflow-style: none;
  1383. /* IE and Edge */
  1384. &::-webkit-scrollbar {
  1385. width: 0 !important;
  1386. display: none;
  1387. /* Chrome, Safari, Opera */
  1388. }
  1389. .category-item {
  1390. position: relative;
  1391. padding: 28rpx 20rpx;
  1392. text-align: center;
  1393. font-family: PingFang SC;
  1394. font-weight: 600;
  1395. font-size: 15px;
  1396. line-height: 100%;
  1397. letter-spacing: 0px;
  1398. color: #666;
  1399. .category-dot {
  1400. position: absolute;
  1401. top: 15rpx;
  1402. right: 15rpx;
  1403. min-width: 32rpx;
  1404. height: 32rpx;
  1405. padding: 0 6rpx;
  1406. background: #ff7a0e;
  1407. border-radius: 16rpx;
  1408. color: #fff;
  1409. font-size: 20rpx;
  1410. text-align: center;
  1411. line-height: 32rpx;
  1412. box-sizing: border-box;
  1413. }
  1414. &.active {
  1415. color: #ff7a0e;
  1416. font-weight: bold;
  1417. background: #fff7e8;
  1418. position: relative;
  1419. &::before {
  1420. content: '';
  1421. position: absolute;
  1422. left: 0;
  1423. top: 50%;
  1424. transform: translateY(-50%);
  1425. width: 6rpx;
  1426. height: 36rpx;
  1427. background: #ff7a0e;
  1428. border-radius: 3rpx;
  1429. }
  1430. }
  1431. }
  1432. }
  1433. .goods-content {
  1434. flex: 1;
  1435. height: 100%;
  1436. padding: 0 0 180rpx 0;
  1437. /* 添加底部padding,为固定底部栏预留空间 */
  1438. background: #ffffff;
  1439. width: 70%;
  1440. margin: 1rpx;
  1441. margin-left: 0;
  1442. border-radius: 0 20rpx 0 0;
  1443. overflow-y: auto;
  1444. box-sizing: border-box;
  1445. scrollbar-width: none;
  1446. /* Firefox */
  1447. -ms-overflow-style: none;
  1448. /* IE and Edge */
  1449. &::-webkit-scrollbar {
  1450. width: 0 !important;
  1451. display: none;
  1452. /* Chrome, Safari, Opera */
  1453. }
  1454. }
  1455. }
  1456. .goods-item {
  1457. display: flex;
  1458. align-items: flex-start;
  1459. padding: 30rpx 0;
  1460. border-bottom: 1rpx solid #f5f5f5;
  1461. .goods-img-container {
  1462. position: relative;
  1463. width: 180rpx;
  1464. height: 180rpx;
  1465. margin-right: 28rpx;
  1466. flex-shrink: 0;
  1467. }
  1468. .goods-item-img {
  1469. width: 100%;
  1470. height: 100%;
  1471. border-radius: 24rpx;
  1472. background: #f8f8f8;
  1473. object-fit: contain;
  1474. }
  1475. .brand-tag {
  1476. position: absolute;
  1477. top: 0rpx;
  1478. left: 0rpx;
  1479. background: rgba(0, 0, 0, 0.8);
  1480. color: #fff;
  1481. font-size: 20rpx;
  1482. padding: 4rpx 8rpx;
  1483. border-radius: 8rpx;
  1484. z-index: 2;
  1485. }
  1486. .goods-info-wrap {
  1487. flex: 1;
  1488. display: flex;
  1489. flex-direction: column;
  1490. justify-content: center;
  1491. min-width: 0;
  1492. }
  1493. .goods-header {
  1494. display: flex;
  1495. justify-content: space-between;
  1496. align-items: center;
  1497. margin-bottom: 10rpx;
  1498. }
  1499. .goods-name {
  1500. font-family: PingFang SC;
  1501. font-weight: 500;
  1502. font-size: 14px;
  1503. line-height: 140%;
  1504. letter-spacing: 0%;
  1505. vertical-align: middle;
  1506. color: #333;
  1507. font-weight: bold;
  1508. flex-shrink: 1;
  1509. flex-grow: 1;
  1510. }
  1511. .brand-check-placeholder {
  1512. flex-shrink: 0;
  1513. margin-left: 10rpx;
  1514. }
  1515. .brand-check {
  1516. display: flex;
  1517. flex-direction: row;
  1518. align-items: center;
  1519. justify-content: center;
  1520. border: 1px solid #f8a01d;
  1521. border-radius: 8rpx;
  1522. color: #ff7a0e;
  1523. font-family: PingFang SC;
  1524. font-weight: 400;
  1525. font-size: 12px;
  1526. padding: 4rpx 10rpx;
  1527. line-height: 1;
  1528. white-space: nowrap;
  1529. text {
  1530. margin-right: 4rpx;
  1531. }
  1532. }
  1533. .goods-desc {
  1534. font-size: 20rpx;
  1535. color: #999;
  1536. display: block;
  1537. // margin-bottom: 20rpx;
  1538. white-space: nowrap;
  1539. overflow: hidden;
  1540. text-overflow: ellipsis;
  1541. }
  1542. .goods-info {
  1543. display: flex;
  1544. justify-content: space-between;
  1545. align-items: center;
  1546. flex-wrap: nowrap;
  1547. gap: 5rpx;
  1548. margin-top: 10rpx;
  1549. }
  1550. .price-info {
  1551. display: flex;
  1552. align-items: baseline;
  1553. white-space: nowrap;
  1554. flex-shrink: 0;
  1555. .price-symbol {
  1556. font-size: 24rpx;
  1557. color: #ff7a0e;
  1558. }
  1559. .price-value {
  1560. font-size: 36rpx;
  1561. color: #ff7a0e;
  1562. font-weight: bold;
  1563. margin: 0 0rpx;
  1564. white-space: nowrap;
  1565. }
  1566. .price-unit {
  1567. font-size: 24rpx;
  1568. color: #999;
  1569. white-space: nowrap;
  1570. }
  1571. }
  1572. .quantity-control {
  1573. display: flex;
  1574. align-items: center;
  1575. flex-shrink: 0;
  1576. white-space: nowrap;
  1577. button {
  1578. width: 60rpx;
  1579. height: 60rpx;
  1580. padding: 0;
  1581. margin: 0;
  1582. display: flex;
  1583. align-items: center;
  1584. justify-content: center;
  1585. font-size: 28rpx;
  1586. color: #666;
  1587. background: #ffffff;
  1588. border: none;
  1589. border-radius: 50%;
  1590. &::after {
  1591. border: none;
  1592. }
  1593. &:active {
  1594. opacity: 0.8;
  1595. }
  1596. }
  1597. .quantity {
  1598. width: 50rpx;
  1599. text-align: center;
  1600. font-size: 32rpx;
  1601. color: #333;
  1602. }
  1603. }
  1604. .rules-brand-row {
  1605. display: flex;
  1606. align-items: center;
  1607. margin-top: 20rpx;
  1608. gap: 16rpx;
  1609. .rules-link {
  1610. margin-top: 0;
  1611. .rules {
  1612. display: inline-flex;
  1613. align-items: center;
  1614. font-family: PingFang SC;
  1615. font-weight: 400;
  1616. font-size: 12px;
  1617. color: #666;
  1618. white-space: nowrap;
  1619. }
  1620. }
  1621. .brand-check-placeholder {
  1622. margin-left: 12rpx;
  1623. }
  1624. }
  1625. }
  1626. .other-unrecycle-card {
  1627. display: flex;
  1628. align-items: center;
  1629. background: #fff;
  1630. border-radius: 24rpx;
  1631. box-shadow: 0 4rpx 24rpx rgba(0, 0, 0, 0.06);
  1632. padding: 30rpx 30rpx 30rpx 30rpx;
  1633. margin: 30rpx 0 0 0;
  1634. }
  1635. .other-unrecycle-img {
  1636. width: 120rpx;
  1637. height: 120rpx;
  1638. border-radius: 24rpx;
  1639. background: #f8f8f8;
  1640. margin-right: 28rpx;
  1641. object-fit: contain;
  1642. flex-shrink: 0;
  1643. }
  1644. .other-unrecycle-info {
  1645. flex: 1;
  1646. display: flex;
  1647. flex-direction: column;
  1648. justify-content: center;
  1649. min-width: 0;
  1650. overflow: hidden;
  1651. }
  1652. .other-unrecycle-title {
  1653. font-size: 30rpx;
  1654. color: #222;
  1655. font-weight: bold;
  1656. margin-bottom: 8rpx;
  1657. white-space: nowrap;
  1658. overflow: hidden;
  1659. text-overflow: ellipsis;
  1660. }
  1661. .other-unrecycle-desc {
  1662. font-size: 24rpx;
  1663. color: #999;
  1664. margin-bottom: 12rpx;
  1665. text-overflow: ellipsis;
  1666. overflow: hidden;
  1667. white-space: nowrap;
  1668. }
  1669. .other-unrecycle-price-row {
  1670. display: flex;
  1671. align-items: center;
  1672. white-space: nowrap;
  1673. }
  1674. .other-unrecycle-price {
  1675. font-size: 28rpx;
  1676. color: #ff9c00;
  1677. font-weight: bold;
  1678. white-space: nowrap;
  1679. }
  1680. .other-unrecycle-btn {
  1681. width: 60rpx;
  1682. height: 60rpx;
  1683. margin-left: 24rpx;
  1684. border-radius: 50%;
  1685. background: #fff;
  1686. color: #666;
  1687. font-size: 36rpx;
  1688. border: none;
  1689. display: flex;
  1690. align-items: center;
  1691. justify-content: center;
  1692. }
  1693. .fixed-bottom-wrap {
  1694. position: fixed;
  1695. padding-bottom: 120rpx;
  1696. left: 0;
  1697. bottom: calc(env(safe-area-inset-bottom));
  1698. // bottom: calc(v-bind('tabbarHeight + "rpx"') + env(safe-area-inset-bottom));
  1699. width: 100vw;
  1700. z-index: 100;
  1701. background: transparent;
  1702. box-sizing: border-box;
  1703. pointer-events: auto;
  1704. }
  1705. .bottom-bar-divider {
  1706. width: 100%;
  1707. height: 1px;
  1708. background: #f0f0f0;
  1709. position: absolute;
  1710. left: 0;
  1711. bottom: 0;
  1712. z-index: 1;
  1713. }
  1714. .green-tip-bar {
  1715. width: 100%;
  1716. background: #eaffea;
  1717. color: #13ac47;
  1718. font-size: 20rpx;
  1719. padding: 8rpx 30rpx;
  1720. box-sizing: border-box;
  1721. text-align: center;
  1722. display: flex;
  1723. align-items: center;
  1724. justify-content: center;
  1725. line-height: 1.4;
  1726. min-height: 40rpx;
  1727. .tip-highlight {
  1728. color: #ff9c00;
  1729. font-weight: bold;
  1730. font-size: 20rpx;
  1731. }
  1732. }
  1733. .bottom-bar {
  1734. width: 100%;
  1735. background-color: #fff;
  1736. display: flex;
  1737. align-items: center;
  1738. justify-content: space-between;
  1739. padding: 0 30rpx;
  1740. box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.05);
  1741. height: 120rpx;
  1742. border-top-left-radius: 0;
  1743. border-top-right-radius: 0;
  1744. border-bottom-left-radius: env(safe-area-inset-bottom);
  1745. border-bottom-right-radius: env(safe-area-inset-bottom);
  1746. .bottom-left {
  1747. // flex: 1;
  1748. display: flex;
  1749. flex-direction: column;
  1750. justify-content: center;
  1751. .summary-row {
  1752. display: flex;
  1753. align-items: center;
  1754. font-size: 26rpx;
  1755. color: #333;
  1756. .summary-label {
  1757. color: #333;
  1758. }
  1759. .summary-count {
  1760. color: #ff9c00;
  1761. font-weight: bold;
  1762. font-size: 28rpx;
  1763. }
  1764. }
  1765. .amount-row {
  1766. display: flex;
  1767. align-items: center;
  1768. margin-top: 4rpx;
  1769. .amount {
  1770. color: #ff9c00;
  1771. font-size: 44rpx;
  1772. font-weight: bold;
  1773. vertical-align: middle;
  1774. }
  1775. }
  1776. }
  1777. .submit-btn {
  1778. width: 300rpx;
  1779. height: 88rpx;
  1780. background: linear-gradient(to right, #ffd01e, #ff8917);
  1781. border-radius: 44rpx;
  1782. color: #fff;
  1783. font-size: 32rpx;
  1784. font-weight: bold;
  1785. display: flex;
  1786. align-items: center;
  1787. justify-content: center;
  1788. border: none;
  1789. // margin-left: 0rpx;
  1790. box-shadow: 0 4rpx 16rpx rgba(255, 156, 0, 0.08);
  1791. &::after {
  1792. border: none;
  1793. }
  1794. &:active {
  1795. opacity: 0.9;
  1796. }
  1797. }
  1798. }
  1799. .detail-popup-mask {
  1800. position: fixed;
  1801. left: 0;
  1802. right: 0;
  1803. top: 0;
  1804. bottom: 0;
  1805. // padding-bottom: calc(env(safe-area-inset-bottom));
  1806. // bottom: calc(120rpx + env(safe-area-inset-bottom));
  1807. // bottom: calc(90rpx + env(safe-area-inset-bottom));
  1808. /* tabbar高度+安全区 */
  1809. background: rgba(0, 0, 0, 0.35);
  1810. z-index: 9999;
  1811. display: flex;
  1812. align-items: flex-end;
  1813. justify-content: center;
  1814. }
  1815. .detail-popup {
  1816. width: 100vw;
  1817. max-width: none;
  1818. background: #fff;
  1819. border-radius: 48rpx 48rpx 0 0;
  1820. box-shadow: 0 8rpx 48rpx rgba(0, 0, 0, 0.18);
  1821. display: flex;
  1822. flex-direction: column;
  1823. align-items: stretch;
  1824. position: relative;
  1825. padding: 0;
  1826. padding-bottom: calc(env(safe-area-inset-bottom));
  1827. overflow: hidden;
  1828. min-height: 80vh;
  1829. bottom: 0;
  1830. }
  1831. .detail-popup-close {
  1832. position: absolute;
  1833. right: 36rpx;
  1834. top: 36rpx;
  1835. font-size: 36rpx;
  1836. color: #bbb;
  1837. z-index: 2;
  1838. }
  1839. .popup-green-tip {
  1840. border-radius: 48rpx 48rpx 0 0;
  1841. font-size: 20rpx;
  1842. padding: 24rpx 30rpx 0 30rpx;
  1843. background: #eaffea;
  1844. color: #13ac47;
  1845. text-align: left;
  1846. }
  1847. .panel-header {
  1848. display: flex;
  1849. align-items: center;
  1850. justify-content: center;
  1851. font-size: 32rpx;
  1852. font-weight: bold;
  1853. padding: 40rpx 36rpx 0 36rpx;
  1854. background: #fff;
  1855. position: relative;
  1856. }
  1857. .panel-title {
  1858. font-size: 32rpx;
  1859. color: #222;
  1860. font-weight: bold;
  1861. text-align: center;
  1862. flex: 1;
  1863. }
  1864. .popup-panel-list {
  1865. // flex: 1;
  1866. width: 710rpx;
  1867. overflow-y: auto;
  1868. height: 70vh !important;
  1869. padding: 0 24rpx;
  1870. scrollbar-width: none;
  1871. /* Firefox */
  1872. -ms-overflow-style: none;
  1873. /* IE and Edge */
  1874. &::-webkit-scrollbar {
  1875. width: 0 !important;
  1876. display: none;
  1877. /* Chrome, Safari, Opera */
  1878. }
  1879. }
  1880. .panel-item {
  1881. display: flex;
  1882. align-items: center;
  1883. justify-content: flex-start;
  1884. padding: 32rpx 0;
  1885. border-bottom: 1px solid #f0f0f0;
  1886. cursor: pointer;
  1887. &:active {
  1888. // background: #f8f8f8;
  1889. }
  1890. }
  1891. .panel-img-container {
  1892. position: relative;
  1893. width: 120rpx;
  1894. height: 120rpx;
  1895. margin-right: 24rpx;
  1896. flex-shrink: 0;
  1897. }
  1898. .panel-item-img {
  1899. width: 100%;
  1900. height: 100%;
  1901. border-radius: 16rpx;
  1902. background: #f8f8f8;
  1903. }
  1904. .panel-brand-tag {
  1905. position: absolute;
  1906. top: 0rpx;
  1907. left: 0rpx;
  1908. background: rgba(0, 0, 0, 0.8);
  1909. color: #fff;
  1910. font-size: 18rpx;
  1911. padding: 2rpx 6rpx;
  1912. border-radius: 6rpx;
  1913. z-index: 2;
  1914. }
  1915. .panel-item-info {
  1916. flex: 1;
  1917. display: flex;
  1918. flex-direction: column;
  1919. justify-content: center;
  1920. min-width: 0;
  1921. }
  1922. .panel-item-name {
  1923. font-size: 28rpx;
  1924. color: #222;
  1925. font-weight: bold;
  1926. margin-bottom: 4rpx;
  1927. text-overflow: ellipsis;
  1928. overflow: hidden;
  1929. white-space: nowrap;
  1930. }
  1931. .panel-item-desc {
  1932. font-size: 24rpx;
  1933. color: #999;
  1934. margin-bottom: 4rpx;
  1935. text-overflow: ellipsis;
  1936. overflow: hidden;
  1937. white-space: nowrap;
  1938. }
  1939. .panel-item-price {
  1940. font-size: 26rpx;
  1941. color: #ff9c00;
  1942. margin-top: 2rpx;
  1943. }
  1944. .panel-quantity-control {
  1945. display: flex;
  1946. align-items: center;
  1947. margin-left: 20rpx;
  1948. // margin-right: 30rpx;
  1949. flex-shrink: 0;
  1950. }
  1951. .panel-quantity-control button {
  1952. width: 48rpx;
  1953. height: 48rpx;
  1954. padding: 0;
  1955. margin: 0 8rpx;
  1956. display: flex;
  1957. align-items: center;
  1958. justify-content: center;
  1959. font-size: 32rpx;
  1960. color: #666;
  1961. background: #ffffff;
  1962. border: none;
  1963. border-radius: 50%;
  1964. &::after {
  1965. border: none;
  1966. }
  1967. &:active {
  1968. opacity: 0.8;
  1969. }
  1970. }
  1971. .panel-quantity-control .quantity {
  1972. width: 30rpx;
  1973. text-align: center;
  1974. font-size: 28rpx;
  1975. color: #333;
  1976. }
  1977. .popup-bottom-bar {
  1978. width: 100%;
  1979. background-color: #fff;
  1980. display: flex;
  1981. align-items: center;
  1982. justify-content: space-between;
  1983. padding: 0 30rpx;
  1984. box-sizing: border-box;
  1985. box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.05);
  1986. height: 120rpx;
  1987. border-top: 1px solid #f0f0f0;
  1988. border-bottom-left-radius: 48rpx;
  1989. border-bottom-right-radius: 48rpx;
  1990. // padding-bottom: env(safe-area-inset-bottom);
  1991. .bottom-left {
  1992. display: flex;
  1993. flex-direction: column;
  1994. justify-content: center;
  1995. .summary-row {
  1996. display: flex;
  1997. align-items: center;
  1998. font-size: 26rpx;
  1999. color: #333;
  2000. .summary-label {
  2001. color: #333;
  2002. }
  2003. .summary-count {
  2004. color: #ff9c00;
  2005. font-weight: bold;
  2006. font-size: 28rpx;
  2007. }
  2008. }
  2009. .amount-row {
  2010. display: flex;
  2011. align-items: center;
  2012. margin-top: 4rpx;
  2013. .amount {
  2014. color: #ff9c00;
  2015. font-size: 44rpx;
  2016. font-weight: bold;
  2017. vertical-align: middle;
  2018. }
  2019. }
  2020. }
  2021. .submit-btn {
  2022. width: 300rpx;
  2023. height: 88rpx;
  2024. background: linear-gradient(to right, #ffd01e, #ff8917);
  2025. border-radius: 44rpx;
  2026. color: #fff;
  2027. font-size: 32rpx;
  2028. font-weight: bold;
  2029. display: flex;
  2030. align-items: center;
  2031. justify-content: center;
  2032. border: none;
  2033. box-shadow: 0 4rpx 16rpx rgba(255, 156, 0, 0.08);
  2034. &::after {
  2035. border: none;
  2036. }
  2037. &:active {
  2038. opacity: 0.9;
  2039. }
  2040. }
  2041. }
  2042. /* 添加衣物浮窗按钮 */
  2043. .floating-add-btn {
  2044. position: absolute;
  2045. left: 50%;
  2046. transform: translateX(-50%);
  2047. bottom: calc(120rpx + env(safe-area-inset-bottom));
  2048. width: 220rpx;
  2049. height: 80rpx;
  2050. background: linear-gradient(to right, #ffd01e, #ff8917);
  2051. border-radius: 40rpx;
  2052. display: flex;
  2053. align-items: center;
  2054. justify-content: center;
  2055. box-shadow: 0 8rpx 24rpx rgba(255, 156, 0, 0.3);
  2056. z-index: 10;
  2057. &:active {
  2058. opacity: 0.9;
  2059. transform: translateX(-50%) scale(0.95);
  2060. }
  2061. .floating-btn-text {
  2062. color: #fff;
  2063. font-size: 28rpx;
  2064. font-weight: bold;
  2065. line-height: 1;
  2066. text-align: center;
  2067. }
  2068. }
  2069. .uv-tabbar {
  2070. z-index: 1000;
  2071. }
  2072. .loading-more {
  2073. text-align: center;
  2074. color: #999;
  2075. padding: 20rpx 0;
  2076. font-size: 26rpx;
  2077. }
  2078. .price-info-popup-mask {
  2079. position: fixed;
  2080. left: 0;
  2081. right: 0;
  2082. top: 0;
  2083. bottom: 0;
  2084. background: rgba(0, 0, 0, 0.4);
  2085. z-index: 996000;
  2086. display: flex;
  2087. align-items: center;
  2088. justify-content: center;
  2089. }
  2090. .price-info-popup {
  2091. width: 85vw;
  2092. max-width: 600rpx;
  2093. background: #fff;
  2094. border-radius: 24rpx;
  2095. box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.12);
  2096. display: flex;
  2097. flex-direction: column;
  2098. align-items: center;
  2099. position: relative;
  2100. padding: 40rpx 40rpx;
  2101. .price-info-popup-title {
  2102. font-size: 34rpx;
  2103. color: #333;
  2104. font-weight: bold;
  2105. text-align: center;
  2106. margin-bottom: 30rpx;
  2107. }
  2108. .price-info-popup-content {
  2109. width: 100%;
  2110. max-height: 50vh;
  2111. .price-info-section {
  2112. margin-bottom: 30rpx;
  2113. &:last-child {
  2114. margin-bottom: 0;
  2115. }
  2116. .price-info-heading {
  2117. font-size: 28rpx;
  2118. color: #333;
  2119. font-weight: 500;
  2120. margin-bottom: 15rpx;
  2121. }
  2122. .price-info-text {
  2123. font-size: 26rpx;
  2124. color: #666;
  2125. line-height: 1.6;
  2126. }
  2127. }
  2128. }
  2129. .price-info-popup-btn {
  2130. width: 100%;
  2131. height: 88rpx;
  2132. background: linear-gradient(to right, #ffd01e, #ff8917);
  2133. border-radius: 44rpx;
  2134. color: #fff;
  2135. font-size: 32rpx;
  2136. font-weight: bold;
  2137. display: flex;
  2138. align-items: center;
  2139. justify-content: center;
  2140. border: none;
  2141. margin-top: 40rpx;
  2142. box-shadow: 0 4rpx 16rpx rgba(255, 156, 0, 0.08);
  2143. &::after {
  2144. border: none;
  2145. }
  2146. &:active {
  2147. opacity: 0.9;
  2148. }
  2149. }
  2150. }
  2151. .rules-link {
  2152. min-width: 90rpx;
  2153. padding: 0 12rpx;
  2154. .rules {
  2155. font-size: 15px;
  2156. white-space: normal;
  2157. overflow: visible;
  2158. }
  2159. }
  2160. // ... existing code ...
  2161. .rules-brand-row {
  2162. display: flex;
  2163. align-items: center;
  2164. margin-top: 20rpx;
  2165. gap: 24rpx; // 增大间距
  2166. .rules-link {
  2167. margin-top: 0;
  2168. }
  2169. .brand-check-placeholder {
  2170. margin-left: 16rpx;
  2171. }
  2172. }
  2173. // ... existing code ...
  2174. .price-info {
  2175. display: flex;
  2176. align-items: baseline;
  2177. white-space: nowrap;
  2178. flex-shrink: 0;
  2179. gap: 12rpx; // 增大间距
  2180. .price-symbol {
  2181. font-size: 32rpx; // 增大符号
  2182. color: #ff7a0e;
  2183. }
  2184. .price-value {
  2185. font-size: 44rpx; // 增大数字
  2186. color: #ff7a0e;
  2187. font-weight: bold;
  2188. margin: 0 6rpx;
  2189. white-space: nowrap;
  2190. }
  2191. .price-unit {
  2192. font-size: 28rpx;
  2193. color: #999;
  2194. white-space: nowrap;
  2195. }
  2196. }
  2197. .quantity-control {
  2198. display: flex;
  2199. align-items: center;
  2200. flex-shrink: 0;
  2201. white-space: nowrap;
  2202. gap: 0rpx; // 增大间距
  2203. button {
  2204. width: 30rpx; // 增大按钮
  2205. height: 72rpx;
  2206. padding: 0;
  2207. margin: 0;
  2208. display: flex;
  2209. align-items: center;
  2210. justify-content: center;
  2211. font-size: 36rpx; // 增大符号
  2212. color: #666;
  2213. background: #ffffff;
  2214. border: none;
  2215. border-radius: 50%;
  2216. &::after {
  2217. border: none;
  2218. }
  2219. &:active {
  2220. opacity: 0.8;
  2221. }
  2222. }
  2223. .quantity {
  2224. width: 60rpx;
  2225. text-align: center;
  2226. font-size: 36rpx; // 增大数字
  2227. color: #333;
  2228. }
  2229. }
  2230. </style>