<!-- 用户信息卡片 -->
<template>
  <view :class="[{ 'border-bottom': props.hasBorderBottom }]"
    class="userinfoai-item ss-flex ss-row-between ss-col-center">
    <view v-if="!isEmpty(props.item)" class="item-left">
      <view class="area-text ss-flex ss-col-center" @click="onSelect">
        <uni-tag v-if="props.item.defaultStatus" class="ss-m-r-10"
          custom-style="background-color: var(--ui-BG-Main); border-color: var(--ui-BG-Main); color: #fff;" size="small"
          text="默认" />
        {{ props.item.textInformation }}
      </view>
    </view>
    <view v-else>
      <view class="userinfoai-text ss-m-b-10">请选择用户信息</view>
    </view>
    <slot>
      <button class="ss-reset-button edit-btn" @tap.stop="onEdit">
        <view class="edit-icon ss-flex ss-row-center ss-col-center">
          <image :src="sheep.$url.static('/static/img/shop/member/userinfoai/edit.png')" />
        </view>
      </button>
    </slot>
  </view>
</template>

<script setup>
/**
 * 基础组件 - 用户信息卡片
 *
 * @param {String}  icon = _icon-edit    - icon
 *
 * @event {Function()} click       - 点击
 * @event {Function()} actionClick     - 点击工具栏
 *
 * @slot                 - 默认插槽
 */
import sheep from '@/sheep';
import { isEmpty } from 'lodash-es';

const props = defineProps({
  item: {
    type: Object,
    default() { },
  },
  hasBorderBottom: {
    type: Boolean,
    defult: true,
  },
});

const onEdit = () => {
  sheep.$router.go('/pages/member/userinfoai/edit', {
    id: props.item.id,
  });
};

const onSelect = () => {
  sheep.$router.go('/pages/member/UserInfoAiEdit', {
    id: props.item.id,
  });
};
</script>

<style lang="scss" scoped>
.userinfoai-item {
  padding: 24rpx 30rpx;

  .item-left {
    width: 600rpx;
  }

  .area-text {
    font-size: 26rpx;
    font-weight: 400;
    color: $dark-9;
  }

  .userinfoai-text {
    font-size: 32rpx;
    font-weight: 500;
    color: #333333;
    line-height: 48rpx;
  }

  .person-text {
    font-size: 28rpx;
    font-weight: 400;
    color: $dark-9;
  }
}

.edit-btn {
  width: 44rpx;
  height: 44rpx;
  background: $gray-f;
  border-radius: 50%;

  .edit-icon {
    width: 24rpx;
    height: 24rpx;
  }
}

image {
  width: 100%;
  height: 100%;
}
</style>
