|
|
- <template>
- <view class="shop-page">
- <!-- 导航栏 -->
- <HomePageNav />
-
- <!-- 可用积分卡片 -->
- <PointsCard :points="userPoints" />
-
- <!-- 商城内容 -->
- <ShopContent ref="shopContentRef" />
- </view>
- </template>
-
- <script>
- import HomePageNav from '@/pages/components/HomePageNav.vue'
- import PointsCard from '@/pages/components/shop/PointsCard.vue'
- import ShopContent from '@/pages/components/shop/ShopContent.vue'
-
- export default {
- name: 'Shop',
- components: {
- HomePageNav,
- PointsCard,
- ShopContent
- },
- data() {
- return {
- userPoints: 1385
- }
- },
- onLoad() {
- // 获取用户积分
- this.getUserPoints()
- },
- methods: {
- async getUserPoints() {
- // 模拟获取用户积分
- // 实际项目中这里应该调用API
- // const res = await this.$api.shop.getPoints()
- this.userPoints = 6666
- }
- },
- async onShow() {
- // 获取用户积分
- await this.getUserPoints()
- this.$refs.shopContentRef.getGoodsList()
- },
- async onPullDownRefresh() {
- // 下拉刷新时调用
- this.$refs.shopContentRef.initData()
- await this.$refs.shopContentRef.getGoodsList()
- uni.stopPullDownRefresh()
- },
- onReachBottom() {
- // 上拉加载更多时调用
- this.$refs.shopContentRef.getGoodsList()
- }
- }
- </script>
-
- <style lang="scss" scoped>
- .shop-page {
- min-height: 100vh;
- background: #f8f8f8;
- }
- </style>
|