StoreBasicData.nvue 4.19 KB
<template>
  <view class="c-list">
    <view class="c-list_item" v-for="(item,index) in cardData" :key="item.id">
      <view class="c-list_item_title">
        <text class="c-list_item_title_text">{{ item.title }}</text>
      </view>
      <view class="c-list_item_value">
        <text class="c-list_item_value_text">{{ formatStoreValue(item) }}</text>
        <text class="c-list_item_value_unit" v-if="item.chartKey === 'custom_residence_time'">{{ t('maintenance.common.minute') }}</text>
      </view>
      <view class="c-list_item_other">
        <view v-if="cardDataMap?.[item.chartKey]?.lastMonthDayRatio" style="flex-direction: row;">
          <text class="c-list_item_other_text" style="padding-right: 4rpx;">{{ t('iPage.withlastmonth') }}:</text>

<!--          <uv-icon
            v-if="cardDataMap?.[item.chartKey]?.lastMonthDayRatio!== '0'"
           :name="cardDataMap?.[item.chartKey]?.lastMonthDayRatio.startsWith('-')?'arrow-downward':'arrow-upward'"
           :color="cardDataMap?.[item.chartKey]?.lastMonthDayRatio.startsWith('-')?'#FF3000':'#00B274'"
           size="24rpx"
           style="margin: 0 5rpx"
           ></uv-icon> -->

          <text class="c-list_item_other_text"
            :style="{'color': cardDataMap?.[item.chartKey]?.lastMonthDayRatio.startsWith('-')?'#00B274':'#FF3000' }">
            {{cardDataMap?.[item.chartKey]?.lastMonthDayRatio}}</text>
        </view>
        <view v-if="item.chartKey==='mall_customer_group'">
          <text class="c-list_item_other_text">{{t('format.single')}}/{{t('format.double')}}/{{t('format.many')}}</text>
        </view>
        <view v-if="item.chartKey==='mall_reception_customer_rate'">
          <text class="c-list_item_other_text">{{ cardDataMap?.[item.chartKey]?.configStr }}s</text>
        </view>
      </view>
    </view>
  </view>
</template>

<script setup>
  import {
    formatSeconds,
    getStageObj
  } from '@/utils'
  import {
    t
  } from '@/plugins/index.js'
  const props = defineProps({
    cardData: {
      type: Array,
      default: () => []
    },
    cardDataMap: {
      type: Object,
      default: () => ({})
    }
  })

  const formatStoreValue = (item) => {
    // ...率
    const rate_key = ['mall_entry_rate', 'mall_deep_shopping_rate']

    // ...时长
    const time_key = ['custom_residence_time']

    // ...批次
    const batch_key = ['']

    if (rate_key.includes(item.chartKey)) {
      return `${props.cardDataMap?.[item.chartKey]?.month}%`
    }
    if (time_key.includes(item.chartKey)) {
      return props.cardDataMap?.[item.chartKey]?.month
    }
    if (item.chartKey === 'mall_customer_group') {
      const {
        singleGroupNum,
        doubleGroupNum,
        multipleGroupNum
      } = props.cardDataMap?.[item.chartKey] || {}
      return `${singleGroupNum}/${doubleGroupNum}/${multipleGroupNum}`
    }
    // 接待率
    if (item.chartKey === 'mall_reception_customer_rate') {
      return `${props.cardDataMap?.[item.chartKey]?.receptionRateDistribution?.[0] || 0}%`
    }

    return props.cardDataMap?.[item.chartKey]?.month
  }
</script>

<style lang="scss">
  .c-list {
    padding: 28rpx;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;

    &_item {
      width: 320rpx;
      height: 194rpx;
      padding: 24rpx 0 0 24rpx;
      border-radius: 8rpx;
      border: 2rpx solid #EDEFF3;
      margin-bottom: 14rpx;
      display: flex;
      flex-direction: column;

      &_title {
        flex-direction: row;

        &_text {
          font-size: 26rpx;
          color: #656A72;
        }

        &_icon {}
      }

      &_value {
        margin: 14rpx 0;
        display: flex;
        flex-direction: row;
        align-items: flex-end;
        
        &_text {
          font-size: 44rpx;
          color: #202328;
          font-family: D-DIN-PRO-700-Bold;
        }
        &_unit{
          padding-left: 2px;
          font-size: 24rpx;
        }
      }

      &_other {
        &_text {
          font-size: 24rpx;
          color: #90949D;
          flex-direction: row;
        }
      }
    }

  }

  // 	.c-list {
  // 		margin-top: 30rpx;

  // 		.c-list-item_margin {
  // 			margin-bottom: 16rpx;
  // 		}


  // 	}
</style>