<template>
  <view class="memberManage">
    <view class="membere-title">会员列表</view>
    <template v-if="accountList.length > 0">
      <view class="membere-list">
      <view
        class="member-item"
        v-for="(item, index) in accountList"
        :key="index"
      >
        <view class="item-top">
          <view class="img-box">
            <image
              :src="item.headImage"
              mode="aspectFit|aspectFill|widthFix"
              lazy-load="true"
            />
          </view>
          <view class="text-box">
            <view class="name">
              <view>{{ item.nickName }}</view>
              <template v-if="item.level == '团长'">
                <view class="tuan">{{ item.level }}</view>
              </template>
              <template v-else-if="item.level == '合伙人'">
                <view class="hehuo">{{ item.level }}</view>
              </template>
              <template v-else>
                <view>{{ item.level }}</view>
              </template>
            </view>
            <view class="phone">{{ item.phone }}</view>
          </view>
        </view>
        <view class="item-bottom">
          <view class="bottom-contact">
            <image
              src="@/static/image/user/business_user.png"
              mode="aspectFit|aspectFill|widthFix"
              lazy-load="true"
            />
            <text>查看邀请人</text>
          </view>
          <view class="bottom-contact">
            <image
              src="@/static/image/user/business_phone.png"
              mode="aspectFit|aspectFill|widthFix"
              lazy-load="true"
            />
            <text>电话联系</text>
          </view>
        </view>
      </view>
    </view>
    </template>
   <template v-else>
    <view class="empty">
      <image class="" src="@/static/image/order/empty.png" />
      <text>该商家下面没有会员</text>
    </view>
   </template>
   
  </view>
</template>

<script>
import { getBuyerList } from "@/config/index";
export default {
  created() {
    // this.accountInfo = uni.getStorageSync("storage_info");
    // this.queryData.phone = this.accountInfo.phone
    this.getList();
  },
  data() {
    return {
      accountInfo: {},
      queryData: {
        page: "1",
        pageSize: "10",
        phone: "",
      },
      accountList: [],
      total: 0,
    };
  },
  methods: {
    //  获取会员列表
    async getList() {
      this.$loading.show("获取中...");
      try {
        let { data, total } = await getBuyerList(this.queryData);
        this.accountList = [...this.accountList, ...data.list];
        this.total = total;
      } finally {
        this.$loading.hide();
      }
    },
  },
  //  触底加载
  onReachBottom() {
    if (this.accountList.length >= this.total) return;
    this.queryData.page++;
    this.getList();
  },
};
</script>

<style lang="scss" scoped>
@import "./index.scss";
</style>
