爱简收旧衣按件回收前端代码仓库
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.

2661 lines
75 KiB

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