<template>
  <view class="themes-activity position-a" :style="{height: 'calc(100vh - ' + hearHeight + ')' }">
    <view class="" >
      <view class="title-box flex al-item-center j-center" style="background: linear-gradient(180deg, #FFF2D4 0%, rgba(255,255,255,0) 100%);">
        <image
        :src="event_rul + '/static/theme/tuangou-title.png'"
        class="img-n"
        mode="widthFix"
        />

      </view>
      
      <view class="nav-list flex j-between al-item-center">
      
        <view
        @tap.stop="sortClick"
        class="search-navbar-item"
        :style="!field || field == 'sort' ? 'color:' + '#ED5925' : ''"
        data-field="sort"
        data-order="desc"
        >推荐</view
        >
        <view
        @tap.stop="sortClick"
        class="search-navbar-item"
        :style="field == 'sales' ? 'color:' + '#ED5925' : ''"
        data-field="sales"
        data-order="desc"
        >销量</view
        >
        <view
        @tap.stop="sortClick"
        class="search-navbar-item"
        data-field="sell_price"
        :data-order="order == 'asc' ? 'desc' : 'asc'"
        >
        <text :style="field == 'sell_price' ? 'color:' + '#ED5925' : ''"
          >价格</text
        >
        <text
          style="font-size: 26rpx"
          class="iconfont icon-danbianjiantou1"
          :style="{
          color:
            field == 'sell_price' && order == 'asc' ? '#ED5925' : '#999',
          }"
        ></text>
        <text
          style="font-size: 26rpx; margin-left: -10rpx"
          class="iconfont icon-danbianjiantou"
          :style="{
          color:
            field == 'sell_price' && order == 'desc' ? '#ED5925' : '#999',
          }"
        ></text>
        </view>
        <view @tap="open" >筛选 <text class="iconfont icon-shaixuan" style="font-size: 26rpx; margin-left: 4rpx;color: #999;"></text></view>
      </view>
    </view>
    <scroll-view
      class="scroll-list lise-t"
      :scroll-y="true"
      @scrolltolower="getmorecomment"
      v-if="shopTuangou && shopTuangou.length > 0"
    >
      <themes-tuangou-item v-if="isActivity" :data="shopTuangou" :timestamp="timestamp" :menuindex="menuindex"></themes-tuangou-item>
      <view class="flex flex-colum" v-else>
        <image class="n-thing" :src="event_rul + '/static/images/n-thing.png'" mode="widthFix"></image>
        <view class="text-center color-gray">暂无活动～</view>
      </view>
    <view
      v-if="visibleSync"
      :class="{ 'uni-drawer--visible': showDrawer }"
      class="uni-drawer"
      @touchmove.stop.prevent="clear"
    >
      <view
        class="uni-drawer__mask"
        :class="{ 'uni-drawer__mask--visible': showDrawer && mask }"
        @tap="close('mask')"
      />
      <view
        class="uni-drawer__content"
        :class="{
          'uni-drawer--right': rightMode,
          'uni-drawer--left': !rightMode,
          'uni-drawer__content--visible': showDrawer,
        }"
        style="width: 100vw"
      >
        <view class="bolting-box">
          <!-- <view class="name">筛选</view> -->
          <view class="title">商品分类</view>
          <view class="content flex flex-w">
        <view class="content-itm">
          <view
            class="text"
            :style="{
              color: boltingListIndex === 0 ? '#EA4E34' : '',
            backgroundColor: boltingListIndex === 0 ? '#FFDCD9' : '#F7F7F7 ',
            }"
            @tap="bolting(0)"
            >全部</view
          >
          <block v-for="(item, idx) in boltingList" :key="idx">
            <view
              class="text"
              v-show="boltingList.length != 0"
              :style="{
                color: boltingListIndex === idx + 1 ? '#EA4E34' : '',
              backgroundColor: boltingListIndex === idx + 1 ? '#FFDCD9' : '#F7F7F7 ',
              }"
              @tap="bolting(idx + 1)"
              >{{ item.name }}</view
            >
          </block>
        </view>
          </view>
          <view class="bolting-box-b flex">
            <view class="res btn" @tap="boltingAll()">重置</view>
            <view
              class="comf btn flex1"
              :style="{ 'background-color': '' }"
              @tap="filterConfirm(cpid)"
              >确定</view
            >
          </view>
        </view>
      </view>
    </view>
    </scroll-view>
    <loading v-if="loading"></loading>
    <nodata text="没有查找到相关商品" v-if="nodata"></nodata>
    <loading v-if="loading"></loading>
  </view>
</template>

<script>
import { myMixin } from '../logic/activity.js';
import themesShop from "./components/themes-shop.vue";
import themesTuangouItem from "./components/themes-tuangou-item.vue";

export default {
  mixins: [myMixin],
  components: {
    themesShop,
    themesTuangouItem
  }
};
</script>

<style lang="scss" scoped>
.themes-activity {
  display: flex;
  flex-direction: column;
  width: 100%;
  background: #FAF8F8;
  overflow: hidden;
  border-radius: 20rpx 20rpx 0;
  flex: 1;
  left: 0;
  right: 0;
}
.title-box {
  flex-shrink: 0;
  padding-top: 20rpx;
  height: 60rpx;

  .img-n {
    width: 256rpx;
    // height: 36rpx;
  }

  .txt {
    padding: 0 30rpx;
  }
}
.nav-list {
  flex-shrink: 0;
  // height: 80rpx;
  padding: 34rpx 30rpx 34rpx;
  .actived {
    color: #efbd6f;
  }
  .selec {
    // font-size: 32rpx;
    transform: scale(1.1);
  }
}
.scroll-list {
  flex: 1;
  overflow-y: scroll;
  // padding: 14rpx 0 20rpx;
  & ::-webkit-scrollbar {
    display: none;
  }
}
.n-thing {
	width: 282rpx;
	margin: 100rpx auto 0;
}
.lise-t {
  // height: calc(100% - 140rpx);
}
.lise-h {
  height: 100%;
  padding-top: 10rpx;
}

.select-box {
  width: 100%;
  height: calc(100% - 80rpx);
  position: absolute;
  left: 0;
  top: 80rpx;
  .select-mxk {
    width: 100%;
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;
    z-index: 66;
    background-color: rgba(0, 0, 0, 0.4);
  }

  .select-box-content {
    width: 100%;
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;
    z-index: 68;

    .content-item {
      border-top: 2rpx solid #f2f2f4;
    }
  }
}
// 筛选
.uni-drawer {
  height: 100%;
  width: 100%;
  /* #ifndef APP-NVUE */
  display: block;
  /* #endif */
  position: absolute;
  // top: 0;
  // left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  z-index: 999;
}

.uni-drawer__content {
  /* #ifndef APP-NVUE */
  display: block;
  /* #endif */
  position: absolute;
  top: 0;
  width: 220px;
  // bottom: 0;
  background-color: #ffffff;
  transition: transform 0.3s ease;
}

.uni-drawer--left {
  left: 0;
  /* #ifdef APP-NVUE */
  transform: translateY(-220px);
  /* #endif */
  /* #ifndef APP-NVUE */
  transform: translateY(-100%);
  /* #endif */
}

.uni-drawer--right {
  right: 0;
  /* #ifdef APP-NVUE */
  transform: translateY(220px);
  /* #endif */
  /* #ifndef APP-NVUE */
  transform: translateY(300%);
  /* #endif */
}

.uni-drawer__content--visible {
  transform: translateY(0px);
}

.uni-drawer__mask {
  width: 100%;
  height: 100%;
  /* #ifndef APP-NVUE */
  display: block;
  /* #endif */
  opacity: 0;
  position: absolute;
  // top: 0;
  // left: 0;
  bottom: 0;
  right: 0;
  background-color: rgba(0, 0, 0, 0.4);
  transition: opacity 0.3s;
}

.uni-drawer__mask--visible {
  /* #ifndef APP-NVUE */
  display: block;
  /* #endif */
  opacity: 1;
}

.bolting-box {
  // padding: 30rpx;

  .name {
    font-size: 32rpx;
  }
  .title {
   padding: 28rpx;
   font-size: 24rpx;
   color: #999;
  }
  .content {
    width: 100%;
	min-height: 186rpx;
	padding: 0 28rpx;
	
	.content-itm {
		padding-left: 12rpx;
	}
    .text {
	  width: 150rpx;
	  height: 60rpx;
	  line-height: 60rpx;
	  text-align: center;
      margin-right: 20rpx;
      margin-bottom: 30rpx;
	  font-size: 24rpx;
      // padding: 8rpx 16rpx;
      border-radius: 4rpx;
      // background-color: #FFDCD9;
    }
  }
  .bolting-box-b {
    width: 100%;
	height: 96rpx;
    // padding-top: 60rpx;
    border-top: 2rpx solid #ECECEC;
    .btn {
      // width: 220rpx;
      height: 100%;
      line-height: 96rpx;
      text-align: center;
      // border-radius: 12rpx;
    }
    .res {
		width: 200rpx;
        border-right: 2rpx solid #ECECEC;
    }
    .comf {
		color: #EA4E34;
    }
  }
}
</style>