<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 {
        // 产品类型【选填】（0自采，1上门，2到店，3已取消）
        tabs: [
          { name: '全部' },
          { name: '自采' },
          { name: '上门' },
          { name: '到店' },
          { name: '已取消' },
        ],
				mixinsListApi: 'getSubscribeList',
      }
    },
    methods: {
			//点击tab栏
			clickTabs({ index }) {
				if (index == 0) {
					delete this.queryParams.type
				} else {
					this.queryParams.type = index - 1
				}
				this.getData()
			},
      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>