<template>
  <view class="page__view">
		<navbar title="选择对比的报告" leftClick @leftClick="$utils.navigateBack" color="#191919" bgColor="#FFFFFF" />

    <view class="main">
      <uv-radio-group 
        v-model="selectedId" 
        placement="column"
        shape="circle"
        size="36rpx"
        iconSize="36rpx"
        activeColor="#7451DE"
      >
        <reportRecordCard 
          v-for="item in list" 
          :key="item.id" 
          :data="item"
        ></reportRecordCard>
      </uv-radio-group>
    </view>

    <view class="flex bottom">
      <button :class="['btn', selectedId ? '' : 'is-disabled']" :disabled="!selectedId" @click="onCompare">开始对比</button>
    </view>
  </view>
</template>

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

  import reportRecordCard from './reportRecordCard.vue';

  export default {
		// mixins: [mixinsList],
    components: {
      reportRecordCard,
    },
    data() {
      return {
        paperId: null,
        reportId: null,
        list: [],
        selectedId: null,
        // queryParams: {
        //   pageNo: 1,
        //   pageSize: 10,
        //   // todo
        //   status: 1,
        // },
				// mixinsListApi: '',
      }
    },
    onLoad(arg) {
      console.log('onLoad', arg)
      const { paperId, reportId } = arg
      this.paperId = paperId
      this.reportId = reportId
      this.getData()
    },
    methods: {
      async getData() {
        try {
          this.list = await this.$fetch('getReportByPaperId', { id: this.paperId })
        } catch (err) {
         console.log('getReportByPaperId err', err) 
        }
      },
      onCompare() {
        let selectedIds = [this.reportId, this.selectedId]
        this.$utils.navigateTo(`/pages_order/report/compare/result?ids=${JSON.stringify(selectedIds)}`)
      },
    },
  }
</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 {
    padding: calc(var(--status-bar-height) + 128rpx) 32rpx 272rpx 32rpx;
  }

  .bottom {
    width: 100%;
    position: fixed;
    left: 0;
    bottom: 0;
    padding: 24rpx 40rpx;
		padding-bottom: calc(env(safe-area-inset-bottom) + 24rpx);
    box-sizing: border-box;
    background: #FFFFFF;
    column-gap: 16rpx;

    .btn {
      width: 100%;
      padding: 16rpx 0;
      font-family: PingFang SC;
      font-size: 36rpx;
      font-weight: 500;
      line-height: 1;
      color: #FFFFFF;
      background-image: linear-gradient(to right, #4B348F, #845CFA);
      border-radius: 41rpx;
    }
  }

</style>