<template>
  
  <view class="page__view">

		<navbar title="检测预约" leftClick @leftClick="$utils.navigateBack" color="#191919" bgColor="#FFFFFF" />

    <view class="main">
      <view class="tabs">
        <uv-tabs 
          :list="tabs" 
          :scrollable="false" 
          lineColor="#7451DE"
          lineWidth="48rpx"
          lineHeight="4rpx"
          :activeStyle="{
            'font-family': 'PingFang SC',
            'font-weight': 500,
            'font-size': '32rpx',
            'line-height': 1.4,
            'color': '#7451DE',
          }" 
          :inactiveStyle="{
            'font-family': 'PingFang SC',
            'font-weight': 400,
            'font-size': '32rpx',
            'line-height': 1.4,
            'color': '#181818',
          }" 
          @click="clickTabs"
        ></uv-tabs>
      </view>

      <view class="list">
        <view class="list-item" v-for="item in list" :key="item.id">
          <checkupCard :data="item" @sendBack="openTrackingNoPopup(item.id)"></checkupCard>
        </view>
      </view>
    </view>

    <checkupTrackingNoPopup ref="checkupTrackingNoPopup" @submitted="getData"></checkupTrackingNoPopup>

  </view>
</template>

<script>
	import mixinsList from '@/mixins/list.js'

  import checkupCard from './checkupCard.vue'
  import checkupTrackingNoPopup from '@/pages_order/checkup/checkupTrackingNoPopup.vue'

  export default {
		mixins: [mixinsList],
    components: {
      checkupCard,
      checkupTrackingNoPopup,
    },
    data() {
      return {
        tabs: [
          { name: '全部' },
          { name: '自采' },
          { name: '上门' },
          { name: '到店' },
          { name: '已取消' },
        ],
				mixinsListApi: '',
      }
    },
    methods: {
			//点击tab栏
			clickTabs({ index }) {
				if (index == 0) {
					delete this.queryParams.status
				} else {
					this.queryParams.status = index - 1
				}
				this.getData()
			},
      // todo: delete
      getData() {
        
        this.list = [
          {
            id: '001',
            url: '',
            title: '月度装定制营养包',
            userName: '周小艺',
            phone: '15558661691',
            amount: 688,
            appointmentTime: '2025-04-28 08:14',
            type: 3,
            typeDesc: '到店检测',
            status: 5,
          },
          {
            id: '002',
            url: '',
            title: '青少年体检套餐',
            userName: '周小艺',
            phone: '15558661691',
            amount: 688,
            appointmentTime: '2025-04-28 08:00～09:00',
            type: 3,
            typeDesc: '到店检测',
            status: 3,
          },
          {
            id: '003',
            url: '',
            title: '孕产妇体检套餐',
            userName: '周小艺',
            phone: '15558661691',
            amount: 688,
            createTime: '2025-04-28 08:14',
            type: 1,
            status: 0,
          },
          {
            id: '004',
            url: '',
            title: '青少年体检套餐',
            userName: '周小艺',
            phone: '15558661691',
            amount: 688,
            appointmentTime: null,
            type: 1,
            typeDesc: '自采检测',
            status: 1,
          },
          {
            id: '005',
            url: '',
            title: '青少年体检套餐',
            userName: '周小艺',
            phone: '15558661691',
            amount: 688,
            appointmentTime: '2025-04-28 08:00～09:00',
            type: 2,
            typeDesc: '上门检测',
            status: 2,
          },
        ]
        this.total = this.list.length
      },
      openTrackingNoPopup(id) {
        this.$refs.checkupTrackingNoPopup.open(id)
      },
    },
  }
</script>

<style scoped lang="scss">

  .page__view {
    width: 100vw;
    min-height: 100vh;
    background-color: $uni-bg-color;
    position: relative;
    
    /deep/ .nav-bar__view {
      position: fixed;
      top: 0;
      left: 0;
    }
    
  }

  .main {
    width: 100vw;
    padding: calc(var(--status-bar-height) + 244rpx) 32rpx 40rpx 32rpx;
    box-sizing: border-box;

    .tabs {
      position: fixed;
      top: calc(var(--status-bar-height) + 120rpx);
      left: 0;
      width: 100%;
      height: 84rpx;
      background: #FFFFFF;

      /deep/ .uv-tabs__wrapper__nav__line {
        border-radius: 2rpx;
      }
    }
	}

  .list {
    &-item {
      & + & {
        margin-top: 40rpx;
      }
    }
  }

</style>