国外MOSE官网
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.

65 lines
1.4 KiB

4 days ago
4 days ago
4 days ago
4 days ago
4 days ago
  1. <template>
  2. <view class="shop-page">
  3. <!-- 导航栏 -->
  4. <HomePageNav />
  5. <!-- 可用积分卡片 -->
  6. <PointsCard :points="userPoints" />
  7. <!-- 商城内容 -->
  8. <ShopContent ref="shopContentRef" />
  9. </view>
  10. </template>
  11. <script>
  12. import HomePageNav from '@/pages/components/HomePageNav.vue'
  13. import PointsCard from '@/pages/components/shop/PointsCard.vue'
  14. import ShopContent from '@/pages/components/shop/ShopContent.vue'
  15. export default {
  16. name: 'Shop',
  17. components: {
  18. HomePageNav,
  19. PointsCard,
  20. ShopContent
  21. },
  22. data() {
  23. return {
  24. userPoints: 1385
  25. }
  26. },
  27. onLoad() {
  28. // 获取用户积分
  29. this.getUserPoints()
  30. },
  31. methods: {
  32. async getUserPoints() {
  33. // 模拟获取用户积分
  34. // 实际项目中这里应该调用API
  35. // const res = await this.$api.shop.getPoints()
  36. this.userPoints = 6666
  37. }
  38. },
  39. async onShow() {
  40. // 获取用户积分
  41. await this.getUserPoints()
  42. this.$refs.shopContentRef.getGoodsList()
  43. },
  44. async onPullDownRefresh() {
  45. // 下拉刷新时调用
  46. this.$refs.shopContentRef.initData()
  47. await this.$refs.shopContentRef.getGoodsList()
  48. uni.stopPullDownRefresh()
  49. },
  50. onReachBottom() {
  51. // 上拉加载更多时调用
  52. this.$refs.shopContentRef.getGoodsList()
  53. }
  54. }
  55. </script>
  56. <style lang="scss" scoped>
  57. .shop-page {
  58. min-height: 100vh;
  59. background: #f8f8f8;
  60. }
  61. </style>