<template>
  <view class="shipping-notice" v-if="lines.length > 0">
    <view class="shipping-notice__header">
      <image class="shipping-notice__icon" src="/static/ic_notice.png" mode="aspectFit" />
      <text class="shipping-notice__title">发货公告：</text>
    </view>
    <view class="shipping-notice__body">
      <text v-for="(line, i) in lines" :key="i" class="shipping-notice__item">{{ line }}</text>
    </view>
  </view>
</template>

<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { get } from '../utils/request'

const lines = ref<string[]>([])

onMounted(async () => {
  try {
    const data = await get<string[]>('/api/config/shipping_notice')
    if (Array.isArray(data)) {
      lines.value = data
    }
  } catch { /* fallback: no notice */ }
})
</script>

<style scoped>
.shipping-notice {
  background: #fce4ec;
  border-radius: 20rpx;
  padding: 28rpx 30rpx;
  margin: 20rpx 24rpx 0;
}
.shipping-notice__header {
  display: flex;
  align-items: center;
  margin-bottom: 20rpx;
}
.shipping-notice__icon {
  width: 36rpx;
  height: 36rpx;
  margin-right: 10rpx;
}
.shipping-notice__title {
  font-size: 28rpx;
  font-weight: 600;
  color: #e91e63;
}
.shipping-notice__body {
  display: flex;
  flex-direction: column;
  gap: 8rpx;
}
.shipping-notice__item {
  font-size: 26rpx;
  color: #e91e63;
  line-height: 1.6;
}
</style>
