index.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761
  1. <template>
  2. <view class="container" :style="{ '--font-scale': fontScale }">
  3. <!-- 通用登录浮层(未登录点击开通会员时先登录) -->
  4. <login-sheet ref="loginSheet" @success="onSheetLoginSuccess" />
  5. <!-- Member Upgrade Banner -->
  6. <view v-if="!isMember" class="member-banner" @click="goUpgrade">
  7. <view class="member-banner-content">
  8. <text class="member-banner-icon">👑</text>
  9. <view class="member-banner-texts">
  10. <text class="member-banner-title">开通会员</text>
  11. <text class="member-banner-desc">享专属折扣与成长服务</text>
  12. </view>
  13. </view>
  14. <text class="member-banner-action">立即开通 ›</text>
  15. </view>
  16. <!-- 搜索栏 + 购物车 -->
  17. <view class="search-row">
  18. <view class="search-bar" @click="goSearch">
  19. <text class="search-icon">🔍</text>
  20. <text class="search-placeholder">搜索商品</text>
  21. </view>
  22. <view class="cart-btn" @click="goCart">
  23. <text class="cart-icon">🛒</text>
  24. <text v-if="cartCount > 0" class="cart-badge">{{ cartCount > 99 ? '99+' : cartCount }}</text>
  25. </view>
  26. </view>
  27. <!-- Level 1 分类:横向滚动chips -->
  28. <scroll-view
  29. scroll-x
  30. enable-flex
  31. show-scrollbar="false"
  32. class="cat-level1-scroll"
  33. >
  34. <view class="cat1-chips">
  35. <view
  36. v-for="cat in categories"
  37. :key="cat.id"
  38. :class="['cat1-chip', currentCat1 && currentCat1.id === cat.id ? 'active' : '']"
  39. @click="onCat1Select(cat)"
  40. >{{ cat.name }}</view>
  41. </view>
  42. </scroll-view>
  43. <!-- Level 2 子分类:横向滚动chips -->
  44. <scroll-view
  45. v-if="currentCat1 && currentCat1.children && currentCat1.children.length"
  46. scroll-x
  47. enable-flex
  48. show-scrollbar="false"
  49. class="cat-level2-scroll"
  50. >
  51. <view class="cat2-chips">
  52. <view
  53. :class="['cat2-chip', !currentCat2 ? 'active' : '']"
  54. @click="onCat2Select(null)"
  55. >全部</view>
  56. <view
  57. v-for="child in currentCat1.children"
  58. :key="child.id"
  59. :class="['cat2-chip', currentCat2 && currentCat2.id === child.id ? 'active' : '']"
  60. @click="onCat2Select(child)"
  61. >{{ child.name }}</view>
  62. </view>
  63. </scroll-view>
  64. <!-- 排序栏:综合 / 价格↑ / 价格↓ -->
  65. <view class="sort-bar">
  66. <view
  67. :class="['sort-item', sortType === 'default' ? 'active' : '']"
  68. @click="onSortSelect('default')"
  69. >综合</view>
  70. <view
  71. :class="['sort-item', sortType === 'price_asc' ? 'active' : '']"
  72. @click="onSortSelect('price_asc')"
  73. >价格↑</view>
  74. <view
  75. :class="['sort-item', sortType === 'price_desc' ? 'active' : '']"
  76. @click="onSortSelect('price_desc')"
  77. >价格↓</view>
  78. </view>
  79. <!-- 商品列表 -->
  80. <scroll-view
  81. scroll-y
  82. class="product-list"
  83. @scrolltolower="onLoadMore"
  84. refresher-enabled
  85. :refresher-triggered="refreshing"
  86. @refresherrefresh="onRefresh"
  87. >
  88. <!-- 推荐商品 -->
  89. <view class="recommend-section" v-if="recommended.length > 0">
  90. <view class="recommend-header">
  91. <text class="recommend-title">🔥 推荐商品</text>
  92. </view>
  93. <scroll-view scroll-x enable-flex show-scrollbar="false" class="recommend-scroll">
  94. <view
  95. v-for="item in recommended"
  96. :key="item.id"
  97. class="recommend-card"
  98. @click="goDetail(item.id)"
  99. >
  100. <image
  101. class="recommend-img"
  102. :src="getImageUrl(item.image || item.coverImage) || '/static/default-product.png'"
  103. mode="aspectFill"
  104. lazy-load />
  105. <text class="recommend-name">{{ item.name }}</text>
  106. <text class="recommend-price">{{ formatPriceWithSymbol(item.price) }}</text>
  107. </view>
  108. </scroll-view>
  109. </view>
  110. <!-- Loading skeleton -->
  111. <view v-if="loading && products.length === 0" class="skeleton-grid">
  112. <view class="skeleton-card" v-for="n in 6" :key="n">
  113. <view class="skeleton-img"></view>
  114. <view class="skeleton-body">
  115. <view class="skeleton-line skeleton-title"></view>
  116. <view class="skeleton-line skeleton-price"></view>
  117. <view class="skeleton-line skeleton-vendor"></view>
  118. </view>
  119. </view>
  120. </view>
  121. <view v-else-if="products.length === 0" class="empty-wrap">
  122. <text class="empty-icon">📦</text>
  123. <text class="empty-text">暂无商品</text>
  124. </view>
  125. <view v-else class="grid fade-in">
  126. <view
  127. v-for="item in products"
  128. :key="item.id"
  129. class="product-card"
  130. @click="goDetail(item.id)"
  131. >
  132. <image
  133. class="cover"
  134. :src="getImageUrl(item.image || item.coverImage) || '/static/default-product.png'"
  135. mode="aspectFill"
  136. lazy-load />
  137. <view class="card-body">
  138. <text class="product-name">{{ item.name }}</text>
  139. <view class="price-row">
  140. <text class="price">{{ formatPriceWithSymbol(item.price) }}</text>
  141. <text v-if="item.memberPrice" class="member-price">会员{{ formatPriceWithSymbol(item.memberPrice) }}</text>
  142. <text v-if="item.giftLevelName" class="gift-badge">🎁</text>
  143. </view>
  144. <text class="vendor-name">{{ item.brandName || '平台官方' }}</text>
  145. </view>
  146. </view>
  147. </view>
  148. <view v-if="loadingMore" class="loading-more">
  149. <text class="loading-text">加载中...</text>
  150. </view>
  151. <view v-if="noMore && products.length > 0" class="no-more">
  152. <text class="no-more-text">— 没有更多了 —</text>
  153. </view>
  154. <view v-if="!isLoggedIn" class="login-hint-bar">
  155. <text class="login-hint-text">🔒 登录查看全部商品和会员价</text>
  156. </view>
  157. <view class="bottom-spacer"></view>
  158. </scroll-view>
  159. </view>
  160. </template>
  161. <script>
  162. import { goodsCategory, productList, getMyMembership, cartCount, reportAppEnter} from '@/utils/api.js'
  163. import config from '@/config.js'
  164. import fontScaleMixin from '@/mixins/font-scale.js'
  165. export default {
  166. mixins: [fontScaleMixin],
  167. data() {
  168. return {
  169. categories: [],
  170. currentCat1: null,
  171. currentCat2: null,
  172. sortType: 'default',
  173. products: [],
  174. page: 1,
  175. size: 20,
  176. loading: false,
  177. loadingMore: false,
  178. refreshing: false,
  179. noMore: false,
  180. isLoggedIn: false,
  181. isMember: false,
  182. recommended: [],
  183. cartCount: 0
  184. }
  185. },
  186. onLoad() {
  187. reportAppEnter('shop');
  188. this.checkMemberStatus()
  189. this.isLoggedIn = !!uni.getStorageSync('token')
  190. this.loadCategories()
  191. this.loadProducts()
  192. this.loadRecommended()
  193. this.loadCartCount()
  194. this._onLoadFired = true
  195. },
  196. onShow() {
  197. if (this._onLoadFired) {
  198. this._onLoadFired = false
  199. } else {
  200. this.checkMemberStatus()
  201. this.isLoggedIn = !!uni.getStorageSync('token')
  202. this.loadCartCount()
  203. }
  204. },
  205. methods: {
  206. loadCategories() {
  207. goodsCategory('0').then(res => {
  208. if (res.code === 200 && res.data) {
  209. this.categories = res.data || []
  210. }
  211. }).catch(() => {})
  212. },
  213. onCat1Select(cat) {
  214. if (this.currentCat1 && this.currentCat1.id === cat.id) return
  215. this.currentCat1 = cat
  216. this.currentCat2 = null
  217. this.page = 1
  218. this.products = []
  219. this.noMore = false
  220. this.loadProducts()
  221. },
  222. onCat2Select(cat) {
  223. this.currentCat2 = cat
  224. this.page = 1
  225. this.products = []
  226. this.noMore = false
  227. this.loadProducts()
  228. },
  229. buildSort() {
  230. if (this.sortType === 'price_asc') return [{ column: 'price', order: 'asc' }]
  231. if (this.sortType === 'price_desc') return [{ column: 'price', order: 'desc' }]
  232. return []
  233. },
  234. onSortSelect(type) {
  235. if (type === this.sortType) return
  236. this.sortType = type
  237. this.page = 1
  238. this.products = []
  239. this.noMore = false
  240. this.loadProducts()
  241. },
  242. loadProducts() {
  243. if (this.loading) return
  244. this.loading = true
  245. const params = { page: this.page, size: this.size }
  246. if (this.currentCat2) {
  247. params.categoryId = this.currentCat2.id
  248. } else if (this.currentCat1) {
  249. params.categoryId = this.currentCat1.id
  250. }
  251. const sort = this.buildSort()
  252. if (sort.length) params.sort = sort
  253. productList(params).then(res => {
  254. this.loading = false
  255. this.refreshing = false
  256. if (res.code === 200 && res.data) {
  257. const records = res.data.records || []
  258. if (this.page === 1) {
  259. this.products = records
  260. } else {
  261. this.products = this.products.concat(records)
  262. }
  263. const total = res.data.total || 0
  264. this.noMore = this.products.length >= total
  265. }
  266. }).catch(() => {
  267. this.loading = false
  268. this.refreshing = false
  269. })
  270. },
  271. onRefresh() {
  272. this.refreshing = true
  273. this.page = 1
  274. this.noMore = false
  275. this.loadProducts()
  276. },
  277. onLoadMore() {
  278. if (this.noMore || this.loadingMore) return
  279. this.page++
  280. this.loadingMore = true
  281. const params = { page: this.page, size: this.size }
  282. if (this.currentCat2) {
  283. params.categoryId = this.currentCat2.id
  284. } else if (this.currentCat1) {
  285. params.categoryId = this.currentCat1.id
  286. }
  287. const sort = this.buildSort()
  288. if (sort.length) params.sort = sort
  289. productList(params).then(res => {
  290. this.loadingMore = false
  291. if (res.code === 200 && res.data) {
  292. const records = res.data.records || []
  293. this.products = this.products.concat(records)
  294. const total = res.data.total || 0
  295. this.noMore = this.products.length >= total
  296. }
  297. }).catch(() => {
  298. this.loadingMore = false
  299. })
  300. },
  301. checkMemberStatus() {
  302. if (!uni.getStorageSync('token')) {
  303. this.isMember = false
  304. return
  305. }
  306. var that = this
  307. getMyMembership().then(function(res) {
  308. if (res.data && res.data.memberLevel) {
  309. that.isMember = res.data.memberLevel !== 'FREE'
  310. }
  311. }).catch(function() {
  312. that.isMember = false
  313. })
  314. },
  315. goUpgrade() {
  316. // 未登录:先弹出登录浮层,登录成功后再进入会员开通页
  317. if (!uni.getStorageSync('token')) {
  318. this._pendingUpgrade = true
  319. this.openLoginSheet({ redirect: '/pages/membership/upgrade' })
  320. return
  321. }
  322. uni.navigateTo({ url: '/pages/membership/upgrade' })
  323. },
  324. // 登录成功回调(login-sheet @success → 全局 mixin onSheetLoginSuccess → 此处)
  325. onLoginSuccess() {
  326. if (this._pendingUpgrade) {
  327. this._pendingUpgrade = false
  328. uni.navigateTo({ url: '/pages/membership/upgrade' })
  329. }
  330. },
  331. goDetail(id) {
  332. uni.navigateTo({ url: '/pages/discover-detail/product-detail/product-detail?id=' + id })
  333. },
  334. goSearch() {
  335. uni.navigateTo({ url: '/pages/shop/search/search' })
  336. },
  337. goCart() {
  338. uni.navigateTo({ url: '/pages/shop/cart/cart' })
  339. },
  340. loadCartCount() {
  341. if (!uni.getStorageSync('token')) {
  342. this.cartCount = 0
  343. return
  344. }
  345. cartCount().then(res => {
  346. if (res.code === 200) {
  347. this.cartCount = res.data || 0
  348. }
  349. }).catch(() => {})
  350. },
  351. loadRecommended() {
  352. productList({ page: 1, size: 6, sort: 'sales' }).then(res => {
  353. if (res.code === 200 && res.data) {
  354. this.recommended = res.data.records || []
  355. }
  356. }).catch(() => {})
  357. },
  358. formatPriceWithSymbol(price) {
  359. if (price === null || price === undefined) return ''
  360. return '¥' + (Number(price) / 100).toFixed(2)
  361. },getImageUrl: function(path) {
  362. if (!path || path === 'null' || path === 'undefined' || path === '/null') return ''
  363. var s = String(path).trim()
  364. if (!s || s === 'null' || s === '/null') return ''
  365. if (s.indexOf('http://') === 0 || s.indexOf('https://') === 0) return s
  366. return config.API_BASE_URL + (s.charAt(0) === '/' ? s : '/' + s)
  367. }
  368. }
  369. }
  370. </script>
  371. <style scoped lang="scss">
  372. .container {
  373. display: flex;
  374. flex-direction: column;
  375. height: 100vh;
  376. background: $facade-fill-2;
  377. }
  378. /* ==================== 分类布局 ==================== */
  379. /* Level 1 分类:横向滚动chips */
  380. .cat-level1-scroll {
  381. background: $app-surface;
  382. white-space: nowrap;
  383. padding: 12rpx 16rpx;
  384. border-bottom: 1rpx solid $facade-hairline-2;
  385. }
  386. .cat1-chips {
  387. display: inline-flex;
  388. gap: 12rpx;
  389. padding: 0 4rpx;
  390. }
  391. .cat1-chip {
  392. display: inline-block;
  393. padding: 10rpx 28rpx;
  394. font-size: calc(26rpx * var(--font-scale, 1));
  395. color: $facade-text-body;
  396. background: $facade-fill;
  397. border-radius: 24rpx;
  398. flex-shrink: 0;
  399. }
  400. .cat1-chip.active {
  401. background: $brand-primary;
  402. color: $app-surface;
  403. font-weight: 500;
  404. }
  405. /* 搜索栏 + 购物车 */
  406. .search-row {
  407. display: flex;
  408. align-items: center;
  409. margin: 16rpx 16rpx 0;
  410. gap: 16rpx;
  411. }
  412. .search-bar {
  413. flex: 1;
  414. display: flex;
  415. align-items: center;
  416. background: $app-surface;
  417. padding: 16rpx 24rpx;
  418. border-radius: 24rpx;
  419. border: 1rpx solid $facade-hairline-2;
  420. }
  421. .search-icon {
  422. font-size: calc(32rpx * var(--font-scale, 1));
  423. margin-right: 12rpx;
  424. }
  425. .search-placeholder {
  426. font-size: calc(26rpx * var(--font-scale, 1));
  427. color: $facade-text-ghost-light;
  428. }
  429. .cart-btn {
  430. position: relative;
  431. width: 72rpx;
  432. height: 72rpx;
  433. border-radius: 50%;
  434. background: $app-surface;
  435. border: 1rpx solid $facade-hairline-2;
  436. display: flex;
  437. align-items: center;
  438. justify-content: center;
  439. flex-shrink: 0;
  440. }
  441. .cart-icon {
  442. font-size: calc(36rpx * var(--font-scale, 1));
  443. }
  444. .cart-badge {
  445. position: absolute;
  446. top: -6rpx;
  447. right: -6rpx;
  448. min-width: 32rpx;
  449. height: 32rpx;
  450. line-height: 32rpx;
  451. padding: 0 8rpx;
  452. border-radius: 16rpx;
  453. background: $status-danger-2;
  454. color: $app-surface;
  455. font-size: calc(20rpx * var(--font-scale, 1));
  456. text-align: center;
  457. box-sizing: border-box;
  458. }
  459. /* Member Upgrade Banner */
  460. .member-banner {
  461. display: flex;
  462. align-items: center;
  463. justify-content: space-between;
  464. background: linear-gradient(135deg, $uni-primary-pale, $facade-brand-tint-2);
  465. margin: 16rpx;
  466. padding: 20rpx 24rpx;
  467. border-radius: 16rpx;
  468. border: 2rpx solid $brand-primary-light-2;
  469. }
  470. .member-banner-content {
  471. display: flex;
  472. align-items: center;
  473. }
  474. .member-banner-icon {
  475. font-size: calc(40rpx * var(--font-scale, 1));
  476. margin-right: 16rpx;
  477. }
  478. .member-banner-texts {
  479. display: flex;
  480. flex-direction: column;
  481. }
  482. .member-banner-title {
  483. font-size: calc(28rpx * var(--font-scale, 1));
  484. font-weight: bold;
  485. color: $brand-primary-deep;
  486. }
  487. .member-banner-desc {
  488. font-size: calc(22rpx * var(--font-scale, 1));
  489. color: $brand-primary;
  490. margin-top: 4rpx;
  491. }
  492. .member-banner-action {
  493. font-size: calc(26rpx * var(--font-scale, 1));
  494. color: $brand-primary;
  495. font-weight: 500;
  496. }
  497. /* 推荐商品 */
  498. .recommend-section {
  499. background: $app-surface;
  500. border-radius: 16rpx;
  501. margin: 16rpx;
  502. padding: 20rpx;
  503. }
  504. .recommend-header {
  505. margin-bottom: 16rpx;
  506. }
  507. .recommend-title {
  508. font-size: calc(28rpx * var(--font-scale, 1));
  509. font-weight: bold;
  510. color: $facade-text-strong;
  511. }
  512. .recommend-scroll {
  513. white-space: nowrap;
  514. padding-bottom: 8rpx;
  515. }
  516. .recommend-card {
  517. display: inline-flex;
  518. flex-direction: column;
  519. width: 160rpx;
  520. margin-right: 12rpx;
  521. flex-shrink: 0;
  522. }
  523. .recommend-img {
  524. width: 160rpx;
  525. height: 160rpx;
  526. border-radius: 8rpx;
  527. background: $facade-fill;
  528. margin-bottom: 6rpx;
  529. }
  530. .recommend-name {
  531. font-size: calc(22rpx * var(--font-scale, 1));
  532. color: $facade-text-strong;
  533. lines: 1;
  534. overflow: hidden;
  535. text-overflow: ellipsis;
  536. white-space: nowrap;
  537. margin-bottom: 4rpx;
  538. }
  539. .recommend-price {
  540. font-size: calc(24rpx * var(--font-scale, 1));
  541. color: $brand-primary;
  542. font-weight: bold;
  543. }
  544. /* Level 2 子分类:横向滚动chips */
  545. .cat-level2-scroll {
  546. background: $app-surface;
  547. white-space: nowrap;
  548. padding: 12rpx 16rpx;
  549. border-bottom: 1rpx solid $facade-fill;
  550. }
  551. .cat2-chips {
  552. display: inline-flex;
  553. gap: 12rpx;
  554. padding: 0 4rpx;
  555. }
  556. .cat2-chip {
  557. display: inline-block;
  558. padding: 8rpx 24rpx;
  559. font-size: calc(24rpx * var(--font-scale, 1));
  560. color: $facade-text-body;
  561. background: $facade-fill;
  562. border-radius: 24rpx;
  563. flex-shrink: 0;
  564. }
  565. .cat2-chip.active {
  566. background: $brand-primary;
  567. color: $app-surface;
  568. }
  569. /* ==================== 排序栏 ==================== */
  570. .sort-bar {
  571. display: flex;
  572. align-items: center;
  573. gap: $uni-space-lg;
  574. padding: $uni-space-sm $uni-space-lg;
  575. margin-bottom: $uni-space-sm;
  576. background: $app-surface;
  577. border-bottom: 1rpx solid $facade-hairline-2;
  578. }
  579. .sort-item {
  580. display: inline-block;
  581. padding: $uni-space-2xs $uni-space-xs;
  582. font-size: calc(26rpx * var(--font-scale, 1));
  583. color: $facade-text-body;
  584. border-radius: $uni-space-xs;
  585. }
  586. .sort-item.active {
  587. color: $facade-violet;
  588. font-weight: 600;
  589. }
  590. /* ==================== 商品列表 ==================== */
  591. .product-list {
  592. flex: 1;
  593. min-height: 0;
  594. }
  595. .login-hint-bar {
  596. text-align: center;
  597. padding: 20rpx;
  598. background: $hint-cream-bg;
  599. border-top: 1rpx solid $hint-cream-border;
  600. }
  601. .login-hint-text {
  602. font-size: calc(24rpx * var(--font-scale, 1));
  603. color: $hint-gold-ink;
  604. }
  605. .bottom-spacer {
  606. height: 120rpx;
  607. }
  608. .grid {
  609. display: flex;
  610. flex-wrap: wrap;
  611. padding: 20rpx;
  612. justify-content: space-between;
  613. }
  614. .product-card {
  615. width: 49%;
  616. background: $app-surface;
  617. border-radius: 16rpx;
  618. overflow: hidden;
  619. margin-bottom: 20rpx;
  620. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.06);
  621. }
  622. .cover {
  623. width: 100%;
  624. height: 320rpx;
  625. background: $facade-fill;
  626. }
  627. .card-body {
  628. padding: 16rpx;
  629. }
  630. .product-name {
  631. display: block;
  632. font-size: calc(28rpx * var(--font-scale, 1));
  633. color: $facade-text-strong;
  634. lines: 2;
  635. overflow: hidden;
  636. text-overflow: ellipsis;
  637. display: -webkit-box;
  638. -webkit-line-clamp: 2;
  639. -webkit-box-orient: vertical;
  640. margin-bottom: 12rpx;
  641. }
  642. .price-row {
  643. display: flex;
  644. align-items: baseline;
  645. margin-bottom: 8rpx;
  646. }
  647. .price {
  648. font-size: calc(32rpx * var(--font-scale, 1));
  649. color: $brand-primary;
  650. font-weight: bold;
  651. margin-right: 12rpx;
  652. }
  653. .member-price {
  654. font-size: calc(22rpx * var(--font-scale, 1));
  655. color: $facade-text-muted;
  656. }
  657. .vendor-name {
  658. font-size: calc(22rpx * var(--font-scale, 1));
  659. color: $facade-text-muted;
  660. }
  661. .loading-wrap,
  662. .empty-wrap {
  663. display: flex;
  664. flex-direction: column;
  665. align-items: center;
  666. padding-top: 200rpx;
  667. }
  668. .loading-text {
  669. font-size: calc(26rpx * var(--font-scale, 1));
  670. color: $facade-text-muted;
  671. }
  672. .empty-icon {
  673. font-size: calc($uni-font-size-6xl * var(--font-scale, 1));
  674. margin-bottom: $uni-space-lg;
  675. }
  676. .empty-text {
  677. font-size: calc(28rpx * var(--font-scale, 1));
  678. color: $facade-text-muted;
  679. }
  680. .loading-more,
  681. .no-more {
  682. text-align: center;
  683. padding: $uni-space-page;
  684. }
  685. .loading-text {
  686. font-size: calc(24rpx * var(--font-scale, 1));
  687. color: $facade-text-muted;
  688. }
  689. .no-more-text {
  690. font-size: calc(24rpx * var(--font-scale, 1));
  691. color: $facade-text-ghost;
  692. }
  693. /* Loading skeleton grid */
  694. .skeleton-grid {
  695. display: flex;
  696. flex-wrap: wrap;
  697. padding: 20rpx;
  698. justify-content: space-between;
  699. }
  700. .skeleton-card {
  701. width: 49%;
  702. background: $app-surface;
  703. border-radius: 16rpx;
  704. overflow: hidden;
  705. margin-bottom: 20rpx;
  706. }
  707. .skeleton-img {
  708. width: 100%;
  709. height: 320rpx;
  710. background: linear-gradient(90deg, $facade-fill 25%, $facade-fill-4 50%, $facade-fill 75%);
  711. background-size: 200% 100%;
  712. animation: shimmer 1.5s infinite;
  713. }
  714. .skeleton-body {
  715. padding: 16rpx;
  716. }
  717. .skeleton-line {
  718. height: 24rpx;
  719. border-radius: 8rpx;
  720. background: linear-gradient(90deg, $facade-fill 25%, $facade-fill-4 50%, $facade-fill 75%);
  721. background-size: 200% 100%;
  722. animation: shimmer 1.5s infinite;
  723. }
  724. .skeleton-title { width: 70%; margin-bottom: 12rpx; }
  725. .skeleton-price { width: 40%; margin-bottom: 8rpx; }
  726. .skeleton-vendor { width: 50%; }
  727. @keyframes shimmer {
  728. 0% { background-position: 200% 0; }
  729. 100% { background-position: -200% 0; }
  730. }
  731. /* Product grid fade-in */
  732. .grid.fade-in {
  733. animation: gridFadeIn 0.3s ease-out;
  734. }
  735. @keyframes gridFadeIn {
  736. from { opacity: 0; transform: translateY(10rpx); }
  737. to { opacity: 1; transform: translateY(0); }
  738. }
  739. </style>