<template>
  <view class="page__view">

		<navbar :title="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="comment">
        <view class="comment-item" v-for="item in list" :key="item.id">
          <commentCard :data="item"></commentCard>
        </view>
      </view>
    </view>

  </view>
</template>

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

  import commentCard from '@/pages_order/comment/commentCard.vue'

  export default {
		mixins: [mixinsList],
    components: {
      commentCard,
    },
    data() {
      return {
        title: '用户评价',
        tabs: [
          { name: '全部' },
          { name: '有图/视频' },
          { name: '最新' },
        ],
        id: null,
        creator: null,
				mixinsListApi: '',
      }
    },
    onShow() {
      console.log('onShow')
    },
    onLoad(arg) {
      console.log('onLoad')
      const { title, id, creator } = arg

      title && (this.title = title)

      this.id = id
      this.creator = creator
      
      // todo set queryParams

      this.getData()
    },
    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',
            userName: '战斗世界',
            avatar: '/pages_order/static/report/avatar.png',
            countDesc: '三月装',
            createTime: '2023-04-18',
            content: '包装很精致，性价比非常高，终于收到啦，期待效果，每日一包，超级方便，真的能坚持服用',
            images: [
              '/pages_order/static/index/medicine-1.png',
              '/pages_order/static/index/medicine-2.png',
              '/pages_order/static/index/medicine-3.png',
            ],
            productServeScore: 5,
            questionExperienceScore: 4,
            deliverySpeedScore: 4.5,
          },
          {
            id: '002',
            userName: '战斗世界',
            avatar: '/pages_order/static/report/avatar.png',
            countDesc: '三月装',
            createTime: '2023-04-18',
            content: '包装很精致，性价比非常高，终于收到啦，期待效果，每日一包，超级方便，真的能坚持服用',
            images: [
              '/pages_order/static/index/medicine-1.png',
              '/pages_order/static/index/medicine-2.png',
              '/pages_order/static/index/medicine-3.png',
            ],
            productServeScore: 5,
            questionExperienceScore: 4,
            deliverySpeedScore: 4.5,
          },
          {
            id: '003',
            userName: '战斗世界',
            avatar: '/pages_order/static/report/avatar.png',
            countDesc: '三月装',
            createTime: '2023-04-18',
            content: '包装很精致，性价比非常高，终于收到啦，期待效果，每日一包，超级方便，真的能坚持服用',
            images: [
              '/pages_order/static/index/medicine-1.png',
              '/pages_order/static/index/medicine-2.png',
              '/pages_order/static/index/medicine-3.png',
            ],
            productServeScore: 5,
            questionExperienceScore: 4,
            deliverySpeedScore: 4.5,
          },
        ]
        this.total = this.list.length
      },
    },
  }
</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-top: calc(var(--status-bar-height) + 204rpx);
    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;
        bottom: 0;
      }
    }
	}

  
  .comment {
    padding: 40rpx 32rpx;
    
    &-item {
      & + & {
        margin-top: 40rpx;
      }
    }
  }

</style>