<template>
  <div>
    <Myheader></Myheader>
    <div class="rc-top"></div>
    <div class="rc-max-width--xl rc-main">
      <div class="usersearch">
        <div class="usercontentshow" ref="usercontent">
          <div class="rc-product ts-scrollable-container">
            <div class="rc-productcat ts-scrollable">
                     <ol>
                  <li
                    v-for="(item, index) in userproduct"
                    :key="index"
                     @click="selectGoods(item, index)"
                   :class="activeIndex == index ? 'active' : 'unactive'"
                    class="ts-standard-btn"
                    ref="userstandard"
                  >
                    <img :src="item.catimage" alt="" />
                    <span>{{ item.title }}</span>
                  </li>
                </ol>
            </div>
          </div>
          <div class="online rc-md-up"></div>
          <div class="ts-scrollable-container">
            <h2>专区:</h2>
            <ol class="ts-scrollable">
              <li
                v-for="(item, index) in prefecture"
                :key="index"
                @click="selectproduct(item, index)"
                :class="item.checked ? 'active' : 'unactive'"
				v-bind="item"
                ref="chosebox"
              >
                {{ item.tagName }}
              </li>
            </ol>
          </div>
          <div class="online rc-md-up"></div>
          <div class="ts-scrollable-container">
            <h2>年龄:</h2>
            <ol class="ts-scrollable">
              <li
                v-for="(item, index) in catage"
                :key="index"
                @click="selectage(item, index)"
                :class="item.checked ? 'active' : 'unactive'"
                ref="chosebox1"
              >
                {{ item.tagName }}
              </li>
            </ol>
          </div>
          <div class="online rc-md-up"></div>
          <div class="ts-scrollable-container">
            <h2>功能:</h2>
            <ol class="ts-scrollable">
              <li
                v-for="(item, index) in catagea"
                :key="index"
                @click="selectagc(item, index)"
                :class="item.checked ? 'active' : 'unactive'"
                ref="cgosebox4"
              >
                {{ item.tagName }}
              </li>
            </ol>
          </div>
          <div class="online rc-md-up"></div>
          <div class="ts-scrollable-container">
            <h2>品种:</h2>
            <ol class="ts-scrollable">
              <li
                v-for="(item, index) in catageb"
                :key="index"
                @click="selectagd(item, index)"
                :class="item.checked ? 'active' : 'unactive'"
                ref="chosebox3"
              >
                {{ item.tagName }}
              </li>
            </ol>
          </div>
          <div class="online rc-md-up"></div>
        </div>
      </div>
    </div>
    <!-- rc-main end -->
    <div class="online bold"></div>
    <!-- rc-main start -->
    <div class="rc-max-width--xl rc-margin-bottom--lg">
      <div class="usersearch">
        <div class="rc-contair">
          <ul class="ts-product-list">
            <li
              v-for="(item, index) in rccontair"
              :key="index"
              class="rc-margin-top--md"
            >
              <div
                class="rc-click rc-margin-bottom--md"
                @click="selectproduce(item)"
              >
                <div class="rc-rccontair">
                  <img :src="item.picture" alt="" />
                </div>
              </div>
              <div class="rc-column">
                <div class="rc-click" @click="selectproduce(item)">
                  <span>{{ item.categoryName }}</span>
                  <i>{{ item.ecPrice?("￥"+item.ecPrice):'' }}</i>
                </div>
                <strong
                  class="
                    ts-standard-btn ts-standard-btn--two
                    rc-margin-y--md
                    center
                  "
                  @click="userbuy()"
                  >立即购买</strong
                >
              </div>
            </li>
          </ul>
        </div>
        <div class="usershow" v-if="openshow">
          <div class="rc-show"></div>
        </div>
      </div>
    </div>
    <!-- rc-main end -->

    <div v-if="isadrond">
      <div class="rc-mubu" v-if="isshow" @click="usershow()"></div>
      <div class="rc-bottom" v-if="isshow">
        <div class="rc-bottoma">
          <div class="rc-productcat ts-scrollable">
            <div
              class="rc-cat"
              v-for="(item, index) in userproduct"
              :key="index"
              @click="selectGoodsa(item, index)"
              :class="activeIndex1 == index ? 'active' : 'unactive'"
            >
              <img :src="item.catimage" alt="" />
              <span>{{ item.tagName }}</span>
            </div>
          </div>
          <div class="rc-prefecture">
            <h2>专区:</h2>
            <ol class="ts-scrollable">
              <li
                v-for="(item, index) in prefecture"
                :key="index"
                @click="selectproduct(item, index)"
                :class="activeIndexb == index ? 'active' : 'unactive'"
                ref="chosebox"
              >
                {{ item.tagName }}
              </li>
            </ol>
          </div>

          <div class="ts-scrollable-container rc-margin-y--md">
            <h2>年龄:</h2>
            <ol class="ts-scrollable">
              <li
                v-for="(item, index) in catage"
                :key="index"
                @click="selectage(item, index)"
                :class="activeIndexc == index ? 'active' : 'unactive'"
                ref="chosebox1"
              >
                {{ item.tagName }}
              </li>
            </ol>
          </div>
          <div class="ts-scrollable-container rc-margin-y--md">
            <h2>功能:</h2>
            <ol class="ts-scrollable">
              <li
                v-for="(item, index) in catagea"
                :key="index"
                @click="selectagc(item, index)"
                :class="activeIndexd == index ? 'active' : 'unactive'"
                ref="cgosebox4"
              >
                {{ item.tagName }}
              </li>
            </ol>
          </div>

          <div class="ts-scrollable-container">
            <h2>品种:</h2>
            <ol class="ts-scrollable">
              <li
                v-for="(item, index) in catageb"
                :key="index"
                @click="selectagd(item, index)"
                :class="activeIndexe == index ? 'active' : 'unactive'"
                ref="chosebox3"
              >
                {{ item.tagName }}
              </li>
            </ol>
          </div>
        </div>
        <div class="rc-footer">
          <span @click="usershow()">取消</span>
          <em @click="usershow()">确定</em>
        </div>
      </div>
    </div>

    <el-dialog :visible.sync="dialogInfo1" hegight="700px" v-if="!isadrond">
      <div class="rc-bottom">
        <div class="rc-bottoma">
          <div class="rc-productcat ts-scrollable">
            <div
              class="rc-cat"
              v-for="(item, index) in userproduct"
              :key="index"
              @click="selectGoodsa(item, index)"
              ref="usercliak"
              :class="activeIndex1 == index ? 'active' : 'unactive'"
            >
              <img :src="item.name" alt="" />
              <span>{{ item.title }}</span>
            </div>
          </div>
          <div class="rc-prefecture">
            <h2>专区:</h2>
            <ol>
              <li
                v-for="(item, index) in prefecture"
                :key="index"
                @click="selectproduct(item, index)"
                :class="activeIndexb == index ? 'active' : 'unactive'"
                ref="chosebox"
              >
                {{ item.tagName }}
              </li>
            </ol>
          </div>

          <div class="ts-scrollable-container rc-margin-y--md">
            <h2>年龄:</h2>
            <ol>
              <li
                v-for="(item, index) in catage"
                :key="index"
                @click="selectage(item, index)"
                :class="activeIndexc == index ? 'active' : 'unactive'"
                ref="chosebox1"
              >
                {{ item.tagName }}
              </li>
            </ol>
          </div>
          <div class="ts-scrollable-container rc-margin-y--md">
            <h2>功能:</h2>
            <ol>
              <li
                v-for="(item, index) in catagea"
                :key="index"
                @click="selectagc(item, index)"
                :class="activeIndexd == index ? 'active' : 'unactive'"
                ref="cgosebox4"
              >
                {{ item.tagName }}
              </li>
            </ol>
          </div>

          <div class="ts-scrollable-container">
            <h2>品种:</h2>
            <ol>
              <li
                v-for="(item, index) in catageb"
                :key="index"
                @click="selectagd(item, index)"
                :class="activeIndexe == index ? 'active' : 'unactive'"
                ref="chosebox3"
              >
                {{ item.tagName }}
              </li>
            </ol>
          </div>
        </div>
      </div>

      <div class="rc-button">
        <span @click="openclose()">取消</span>
        <em>确认</em>
      </div>
    </el-dialog>
		<div v-if="isLoading" class="ts-mask">
			<div class="ts-mask-bg"></div>
			<div class="userloding"></div>
			<span>数据加载中</span>
		</div>
       <MyFooter></MyFooter>
  </div>
</template>

<script>
import Myheader from "~/components/header.vue";
import MyFooter from '~/components/rc-footer.vue'
import {
  userstype,
  biaome,
  biaomessage,
  searchchanpin,
  userquery
} from "../../ajax/getData";
export default {
  data() {
    return {
      value: "",
      isLoading: false,
      userstype: [],
      activeIndex: 0,
      allacindex: 0,
      userishwo: true,
      userishwo4: true,
      userserachlist: [
        {
          categoryName: [], //专区
          tagUsedAge: [], //年龄
          tagFunction: [], //功能
          tagBreed: [], //品种
        },
      ],
      activeIndex1: 0,
      activeIndexa: "-1",
      dialogInfo1: false,
      activeIndexb: "-1",
      activeIndexc: "-1",
      activeIndexd: "-1",
      activeIndexe: "-1",
      activeIndexf: "-1",
      isadrond: true,
      isshow: false,
      openshow: false,
      direction: "btt",
      searchdata: [
        {
          title: "猫罐头",
          ordernum: "1",
        },

        {
          title: "犬罐头",
          ordernum: "2",
        },
        {
          title: "布偶猫",
          ordernum: "3",
        },
        {
          title: "博美犬",
          ordernum: "4",
        },
      ],

      userproduct: [
        {
          title: "猫产品",
          ordernum: "1",
          catimage: require("../../assets/image/rc-cat.png"),
        },

        {
          title: "犬产品",
          ordernum: "2",
          catimage: require("../../assets/image/rc-dog.png"),
        },
      ],

      catproduct: [
        {
          title: "猫产品",
          ordernum: "1",
          catimage: require("../../assets/image/rc-cat.png"),
        },

        {
          title: "犬产品",
          ordernum: "2",
          catimage: require("../../assets/image/rc-dog.png"),
        },
      ],

      extraPrefecture: [
        {
          tagName: "处方粮",
          ordernum: "99",
          catimage: require("../../assets/image/rc-dog.png"),
		  isRxGoods:1
        },
      ],
	  prefecture: [
	    
	  ],
      catage: [
        {
          title: "<4月龄",
          ordernum: "1",
        },
        {
          title: "4-12月龄",
          ordernum: "2",
        },
        {
          title: "1-7岁",
          ordernum: "3",
        },
        {
          title: ">7岁",
          ordernum: "4",
        },
      ],
      catagea: [
        {
          title: "绝育呵护",
          ordernum: "1",
        },
        {
          title: "口腔呵护",
          ordernum: "2",
        },
        {
          title: "美毛呵护",
          ordernum: "3",
        },
        {
          title: "去毛球",
          ordernum: "4",
        },
      ],
      catageb: [
        {
          title: "英短",
          ordernum: "1",
        },
        {
          title: "美短",
          ordernum: "2",
        },
        {
          title: "布偶",
          ordernum: "3",
        },
        {
          title: "暹罗",
          ordernum: "4",
        },
      ],

      rccontair: [
        {
          title: "",
          price: "",
          ordernum: 1,
          catimage: '',
        },
      ],
	  routeParams:[],
	  rxGoodsIndexPointer:0
    };
  },
  components: {
    Myheader,
    MyFooter
  },
  created() {
	  this.routeParams=this.$route.query;
	  if(this.routeParams.stype)
		this.activeIndex = this.routeParams.stype;//Initialized pet type selection
  },
  mounted() {
	let stype = this.routeParams.stype;
	this.$nextTick(() => {
		this.$refs.userstandard[0].style.margin = 0 + "px";
	});
	let tagSettingPromise = this.userst();
	let _self = this;
	tagSettingPromise.then(function(resolve){
		_self.chooseDefaultOptions();
		//_self.usetmessage();
	});
	/*
	if (stype !== "" && stype !== undefined) {
		this.onmessage(stype);//Wont happen
	} else {
		this.usetmessage();
	}
	*/
  },
  methods: {
    async usersearch(stype, usertype) {
		this.isLoading=true;
		let data = undefined;
		if(this.prefecture[this.rxGoodsIndexPointer].checked==true){
			data = await userquery(usertype, 1, 10);
		}
		else{
			let searchCriteria=[{}];
			for(let key in stype[0]){
				if(stype[0][key].length>0){
					if(typeof stype[0][key] == 'string') {
						searchCriteria[0][key]=stype[0][key];
					}
					else {
						searchCriteria[0][key]=stype[0][key].join(',');
					}
					if(key=='categoryName' && searchCriteria[0][key].indexOf("湿")>-1){
						searchCriteria[0]['tagStatus']=2;
					}
				}
			}
			data = await searchchanpin(searchCriteria, usertype, 1, 10);
		}
		if (data) {
			this.rccontair = data;
			this.isLoading=false;
		}
    },
    async userst() {
      this.isLoading = true;
      let pinzhong = [];
      let zhuanqu = [];
      let age = [];
      let gonneg = [];
      let data = await userstype();
      if (data) {
        this.userstype = data;
        this.isLoading = false;
      }
      this.usercatlist = this.userstype.filter((item) => item.petType == "0");
      this.usercatlist.map((element) => {
        if (element.name == "品种") {
          pinzhong.push(element);
          this.catageb = pinzhong;
          this.catageb.forEach((element) => {
            element.checked = false;
          });
        }
        if (element.name == "功能") {
          gonneg.push(element);
          this.catagea = gonneg;
          this.catagea.forEach((element) => {
            element.checked = false;
          });
        }
        if (element.name == "年龄") {
          age.push(element);
          this.catage = age;
          this.catage.forEach((element) => {
            element.checked = false;
          });
        }
        if (element.name == "专区") {
          zhuanqu.push(element);
          this.prefecture = zhuanqu;
          this.prefecture.forEach((element) => {
            element.checked = false;
          });
        }
        console.log(pinzhong);
        //  debugger
      });
	  let _self = this;
	  this.extraPrefecture.forEach(function(ele){
		  _self.prefecture.push(ele);
		  _self.rxGoodsIndexPointer = _self.prefecture.length-1;
	  });
      this.userdoglisgt = this.userstype.filter((item) => item.petType == "1");
    },

    async usetmessage() {
      this.isLoading = true;
      let data = await biaome(this.activeIndex1, "", 1, 10);
      if (data) {
        this.rccontair = data;
        this.isLoading = false;
      }
    },
    async onmessage(stype) {
      this.isLoading = true;
      let data = await biaomessage(stype, "", 1, 10);
      if (data) {
        this.rccontair = data;
        this.isLoading = false;
      }
    },
	chooseDefaultOptions(){
		let tagStatus = this.routeParams.tagStatus;
		let categoryName = this.routeParams.categoryName;
		let rxgoods = this.routeParams.rxgoods;
		
		let tagUsedAge = this.routeParams.tagUsedAge;
		
		let key = this.routeParams.key;
		let _self = this;
		
		
		if(tagStatus && tagStatus.length>0) {
			tagStatus=='1'?1:2;//1:干粮, 2:湿粮
		} else {
			tagStatus = 0;
		}
		if(rxgoods && rxgoods.length>0) {
			rxgoods=='1'?1:0;
		} else {
			rxgoods = 0;
		}
		if(categoryName && categoryName.length>0) {
			categoryName = categoryName.split(",");
		} else {
			categoryName = [];
		}
		if(tagUsedAge && tagUsedAge.length>0) {
			tagUsedAge = tagUsedAge.split(",");
		} else {
			tagUsedAge = [];
		}
		
		
		
		//RxGood handling
		if(rxgoods) {
			this.checkRxGoods(true);
			this.usersearch([],this.activeIndex);
			return;
		}
		//RxGood handling
		
		//Category Handling
		if(tagStatus || categoryName.length>0) {
			for(let item of this.prefecture){
				if(item.tagName.indexOf('湿')>-1){
					if(tagStatus==2) {
						item.checked=true;
					}
				} else {
					if(tagStatus==1 && item.tagName!=this.prefecture[this.rxGoodsIndexPointer].tagName){
						item.checked=true;
					}
				}
				if(categoryName.indexOf(item.tagName)>-1) {
					item.checked=true;
				}
			}
			if(tagStatus)
				this.userserachlist[0].tagStatus=tagStatus;
			if(categoryName.length>0)
				this.userserachlist[0].categoryName=categoryName;
		}
		//Category Handling end
		
		//Age Handling
		if(tagUsedAge.length>0) {
			this.catage.forEach(function(item,index){
				if(tagUsedAge.indexOf(item.tagName)>-1) {
					item.checked=true;
				}
			});
			this.userserachlist[0].tagUsedAge=tagUsedAge;
		}
		//Age Handling end		
		
		//go query
		this.usersearch(this.userserachlist,this.activeIndex1);
	},
	checkRxGoods(toggleSwitch){
		let _self = this;
		let categoriesSelectionEles=this.prefecture;
		let functionalSelectionEles=this.catagea;
		let ageSelectionEles=this.catage;
		let breedSelectionEles=this.catageb;
		let allSelectionEles=categoriesSelectionEles.concat(functionalSelectionEles,ageSelectionEles,breedSelectionEles);
		
		if(toggleSwitch)
		{
			allSelectionEles.forEach(function(tmp,index){
				tmp.checked=false;
				if(tmp.isRxGoods)
				{
					tmp.checked=true;
				}
			});
		}
		else
			this.prefecture[this.rxGoodsIndexPointer].checked=false;
	},
    userbuy() {
      this.$router.push({
        path: "/myorder/userrecord",
        query: {
          stype: 1,
        },
      });
    },
    openclose() {
      this.dialogInfo1 = false;
    },
    selectproduce() {
      this.$router.push({
        path: "/productdetails/producted",
        query: {
          stype: 1,
        },
      });
    },
    ifadroind() {
      var sUserAgent = navigator.userAgent.toLowerCase();
      var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
      var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
      var bIsMidp = sUserAgent.match(/midp/i) == "midp";
      var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
      var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
      var bIsAndroid = sUserAgent.match(/android/i) == "android";
      var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
      var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";

      if (
        !(
          bIsIpad ||
          bIsIphoneOs ||
          bIsMidp ||
          bIsUc7 ||
          bIsUc ||
          bIsAndroid ||
          bIsCE ||
          bIsWM
        )
      ) {
        //console.log("当前是电脑打开");
        this.$nextTick(() => {
			this.isadrond = false;
			this.dialogInfo1 = true;
			this.isadrond = false;
			this.isshow = false;
        });
      } else {
        //console.log("当前是手机打开");
        this.$nextTick(() => {
			this.isadrond = true;
			this.isshow = true;
			this.$refs.usercontent.style.display = "none  ";
			this.dialogInfo1 = false;
        });
      }
    },

    selectGoods(item, index) {
      this.activeIndex1 = index;
      this.activeIndex = index;
      this.allacindex = index;
      this.usersearch(this.userserachlist, this.activeIndex1);
      // for (let i = 0; i < this.userserachlist.length; i++) {
      //   if (!this.userserachlist.includes(petType)) {
      //     this.userserachlist.push(petType);
      //   }
      // }
		this.userserachlist = [
			{
				categoryName: [], //专区
				tagUsedAge: [], //年龄
				tagFunction: [], //功能
				tagBreed: [], //品种
			},
		];
      let pinzhong = [];
      let zhuanqu = [];
      let age = [];
      let gonneg = [];
      if (this.activeIndex1 == 0) {
        this.usercatlist.map((element) => {
          if (element.name == "品种") {
            pinzhong.push(element);
            this.catageb = pinzhong;
          }
          if (element.name == "功能") {
            gonneg.push(element);
            this.catagea = gonneg;
          }
          if (element.name == "年龄") {
            age.push(element);
            this.catage = age;
          }
          if (element.name == "专区") {
            zhuanqu.push(element);
            this.prefecture = zhuanqu;
          }
        });
      } else if (this.activeIndex1 == 1) {
        this.userdoglisgt.map((element) => {
          if (element.name == "品种") {
            pinzhong.push(element);
            this.catageb = pinzhong;
            this.catageb.forEach((element) => {
              element.checked = false;
            });
          }
          if (element.name == "功能") {
            gonneg.push(element);
            this.catagea = gonneg;
            this.catagea.forEach((element) => {
              element.checked = false;
            });
          }
          if (element.name == "年龄") {
            age.push(element);
            this.catage = age;
            this.catage.forEach((element) => {
              element.checked = false;
            });
          }
          if (element.name == "专区") {
            zhuanqu.push(element);
            this.prefecture = zhuanqu;
            this.prefecture.forEach((element) => {
              element.checked = false;
            });
          }
        });
      }

		let _self = this;
		this.extraPrefecture.forEach(function(ele){
			_self.prefecture.push(ele);
			_self.rxGoodsIndexPointer = _self.prefecture.length-1;
		});
		this.activeIndex = index;
    },
    selectGoodsa(item, index) {
      this.activeIndex1 = index;
    },
    userselect() {
      this.$nextTick(() => {
        this.ifadroind();
      });
    },
    usershow() {
      this.$nextTick(() => {
        this.isshow = false;
        // dom元素更新后执行，因此这里能正确打印更改之后的值
        this.$refs.usercontent.style.display = "block  ";
      });
    },
	utilSimpleArrayRemove(haystack,needle){
		if(haystack.length<=0)
			return false;
		let index=haystack.indexOf(needle);
		if(index>-1)
		{
			haystack.splice(index,1);
			return true;
		}
		return false;
	},
    selectsearch(item, index) {
      this.activeIndexa = index;
    },
    selectage(item, index) {
		this.checkRxGoods(false);
		if(this.activeIndex=='-1'){
			this.activeIndex=0;
		}
		let tagUsedAge = {};
		this.activeIndexc = index;
		item.checked = !item.checked;
		if (item.checked == false) {
			this.utilSimpleArrayRemove(this.userserachlist[0].tagUsedAge,item.tagName);
		} else {
			this.userserachlist[0].tagUsedAge.push(item.tagName);
		}

		// for (let i = 0; i < this.userserachlist.length; i++) {
		//   if (!this.userserachlist.includes(tagUsedAge)) {
		//     this.userserachlist.push(tagUsedAge);
		//   }
		// }
		this.usersearch(this.userserachlist, this.activeIndex1);
    },
    selectagc(item, index) {
		this.checkRxGoods(false);
		// let tagFunction = {};
		if(this.activeIndex=='-1'){
			this.activeIndex=0;
		}
		this.activeIndexd = index;
		item.checked = !item.checked;
		if (item.checked == false) {
			this.utilSimpleArrayRemove(this.userserachlist[0].tagFunction,item.tagName);
		} else {
			this.userserachlist[0].tagFunction.push(item.tagName);
		}
		
		// if (this.userishwo2 == false) {
		//   tagFunction = {
		//     petType: this.allacindex,
		//     tagFunction: item.tagName,
		//   };
		// } else {
		//   console.log("这是false");
		//   tagFunction = {
		//     petType: this.allacindex,
		//   };
		// }
		// for (let i = 0; i < this.userserachlist.length; i++) {
		//   if (!this.userserachlist.includes(tagFunction)) {
		//     this.userserachlist.push(tagFunction);
		//   }
		// }
		this.usersearch(this.userserachlist, this.activeIndex1);
    },
    selectagd(item, index) {
		this.checkRxGoods(false);
		if(this.activeIndex=='-1'){
			this.activeIndex=0;
		}
		let tagBreed = {};
		this.activeIndexe = index;	
		item.checked = !item.checked;
		if (item.checked == false) {
			this.utilSimpleArrayRemove(this.userserachlist[0].tagBreed,item.tagName);
		} else {
			this.userserachlist[0].tagBreed.push(item.tagName);
		}
		// this.$refs.chosebox3[index].className = "unactive";
		// for (let i = 0; i < this.userserachlist.length; i++) {
		//   if (!this.userserachlist.includes(tagBreed)) {
		//     this.userserachlist.push(tagBreed);
		//   }
		// }
		this.usersearch(this.userserachlist, this.activeIndex1);
    },
	//Fetching Categories Products
    selectproduct(item, index) {
		if(this.activeIndex=='-1'){
			this.activeIndex=0;
		}
		this.activeIndexb = index;
		let _self=this;
		//Handling Rx Goods
		if(item.isRxGoods==1)
		{
			this.checkRxGoods(true);
		}
		//Handling Rx Goods end
		
		//Handling other options
		else {
			//  console.log(this.userishwo=!this.userishwo)
			this.checkRxGoods(false);
			
			//item.checked = !item.checked;
			//this.prefecture[index].checked = item.checked;
			item.checked = !item.checked;
			this.prefecture[index].checked = item.checked;
			if (item.checked == false) {
				this.utilSimpleArrayRemove(this.userserachlist[0].categoryName,item.tagName);
			} else {
				this.userserachlist[0].categoryName.push(item.tagName);
			}

		}
		//Handling other options end
      // if (this.userishwo == false) {
      //   console.log("====");
      //   categoryName = {
      //     petType: this.allacindex,
      //     categoryName: item.tagName,
      //   };
      // } else {
      //   categoryName = {
      //     petType: this.allacindex,
      //   };
      // }
      // this.$refs.chosebox[index].className = "unactive";
      // for (let i = 0; i < this.userserachlist.length; i++) {
      //   if (!this.userserachlist.includes(categoryName)) {
      //     this.userserachlist.push(categoryName);
      //   }
      // }
	  this.usersearch(this.userserachlist, this.activeIndex1);
    },
    //弹框的显示隐藏
  },
};
</script>

<style lang="less" scoped >
@import url("../../assets/css/global.less");
@import url("../../assets/css/product-list.less");
</style>