<template>
  <view class="public-page-empty">
    <image class="image" :class="emptyImage == 'addr' || emptyImage == 'permission' ? 'permission' : ''" :src="emptyImages[emptyImage]['image']"></image>
    <text class="txt">{{ pagingListNoListDataText }} <text v-if="emptyImage == 'addr' || emptyImage == 'permission'">,</text> <text v-if="emptyImage == 'addr'" style="color: dodgerblue;" @click="handlePermission(1)">去获取</text>  <text @click="handlePermission(-1)" style="color: dodgerblue;" v-if="emptyImage == 'permission'">去设置</text></text>
  </view>
</template>

<script>
/**
 * @author 刘欢
 * @description 空布局组件
 * @property {String} pagingListNoListDataText 提示语 默认: 暂无数据
 * @param {String} pagingListNoListDataText 提示语 默认: 暂无数据
 * @param {String} emptyImage 空布局的类型,有两种样式: order和collection 默认: order
 * @example <fu-empty-ui pagingListNoListDataText="" emptyImage=""></fu-empty-ui>
 * */
export default {
  name: 'fu-empty-ui',
  props: {
    pagingListNoListDataText: {
      type: String,
      default() {
        return '暂无数据'
      },
    },
    emptyImage: {
      type: String,
      default: 'order',
    },
  },
  data() {
    return {
      emptyImages: Object.freeze({
        cart: {
          // 购物车
          image: '/static/empty/cart.png',
        },
        collection: {
          // 收藏
          image: '/static/empty/collect.png',
        },
        order: {
          // 订单
          image: '/static/empty/order.png',
        },
        message: {
          // 消息
          image: '/static/empty/message.png',
        },
        coupons: {
          // 优惠券
          image: '/static/empty/coupon.png',
        },
        addr: {
          // 优惠券
          image: '/static/empty/addr.png',
        },
        permission: {
          // 优惠券
          image: '/static/empty/permission.png',
        },
      }),
    }
  },
  methods: {
    handlePermission(type) {
      this.$emit('permission', type)
    }
  }
}
</script>

<style lang="scss" scoped>
.public-page-empty {
  display: flex;
  justify-content: center;
  flex-direction: column;
  align-items: center;
  padding: 120upx 0 0 0;

}
.image {
    width: 328rpx;
    height: 260rpx;

  }
  .permission {
    width: 300rpx;
    height: 215rpx;
  }

  .txt {
    font-size: 28rpx;
    color: #333;
    text-align: center;
    line-height: 100upx;
    color: #999;
  }
</style>
