<template>
  <view class="points-card">
    <!-- 可用积分背景 -->
    <view class="points-background">
      <image src="/static/可用积分背景图.png" class="bg-image" mode="aspectFill"></image>
      
      <!-- 积分内容 -->
      <view class="points-content">
        <view class="points-text">
          <text class="points-label">可用积分</text>
          <text class="points-value">{{ points }}</text>
        </view>
      
      </view>
      
      <!-- 积分明细按钮 -->
      <view class="points-detail" @click="showPointsDetail">
        <image src="/static/商城_积分明细框.png" class="detail-bg" mode="aspectFit"></image>
        <text class="detail-text">积分明细</text>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  name: 'PointsCard',
  props: {
    points: {
      type: [String, Number],
      default: 1385
    }
  },
  methods: {
    showPointsDetail() {
      // 跳转到积分明细页面
      uni.navigateTo({
        url: '/subPages/shop/pointsDetail'
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.points-card {
  width: 96%;
  margin: 0 auto;
  // margin-top: -80rpx;
  position: relative;
  z-index: 10;
}

.points-background {
  position: relative;
  width: 100%;
  height: 290rpx;
  border-radius: 20rpx;
  overflow: hidden;
  
  .bg-image {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
  }
  
  .points-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40rpx;
    
    .points-text {
      // background: red;
      display: flex;
      flex-direction: column;
      align-items: center;
      // justify-content: center;
      gap: 10rpx;
      .points-label {
        font-size: 30rpx;
        color: #ffffff;
        margin-bottom: 15rpx;
        opacity: 0.9;
      }
      
      .points-value {
        font-size: 58rpx;
        color: #ffffff;
        font-weight: bold;
        line-height: 1;
      }
    }
    
    .points-icon {
      width: 120rpx;
      height: 120rpx;
      
      .icon-image {
        width: 100%;
        height: 100%;
      }
    }
  }
  
  .points-detail {
    position: absolute;
    bottom: 10rpx;
    left: 30rpx;
    width: 160rpx;
    height: 60rpx;
    display: flex;
    align-items: center;
    justify-content: center;
    
    .detail-bg {
      position: absolute;
      width: 100%;
      height: 100%;
      top: 0;
      left: 0;
    }
    
    .detail-text {
      font-size: 24rpx;
      color: $uni-color-primary;
      position: relative;
      z-index: 1;
    }
  }
}
</style>