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

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