<style>
	.storeDetails{
		width: 100%;
		height: 100vh;
		background: #FFF;
	}
	.details-box{
		width: 100%;
		height: 100%;
		
	}
	.storeDetails .headStatus {
		  overflow: hidden;
		  position: relative;
		  width: 140vw;
		  padding-right: 40vw;
		  padding-bottom: 10px;
		  position: fixed;
		  left: 0;
		  right: 0;
		  top: 0;
		  display: flex;
		  flex-direction: row;
		  align-items: center;
		  justify-content: space-between;
		 
	}

	.storeDetails .arrow {
		  height: 24px;
		  margin: 5px 10px;
		  width: 24px;
	}
	.arrow2{
		position: absolute;
		left: 0;
		top:24px;
		height: 24px;
		margin: 5px 10px;
		width: 24px;
	}
	.storeDetails .storeNews{
		width: 100%;
		background: #FFF;
		padding: 15px;
		border-top-left-radius: 15px;
		border-top-right-radius: 15px;
		margin-top: -12px;
		position: relative;
	}
	.storeDetails .store-name{
		width: 100%;
		display: flex;
		flex-direction: row;
	}
	.storeDetails .store-name .sName{
		width: 1;
		flex: 1;
		font-size: 18px;
		color: #000000;
		font-weight: bold;
	}
	.storeDetails .store-name .sN-r{
		
		
		font-size: 11px;
		color: #FFC86D;
		text-align: right;
	}
	.storeDetails .store-news{
		width: 100%;
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		padding: 15px 0;
		border-bottom: 1px solid #E2E2E2;
	}
	.storeDetails .good-rb-box{
		display: flex;
		flex-direction: row;
		align-items: flex-start;
	}
	.storeDetails .good-rb-text{
		font-size: 11px;
		color: #121212;
		margin-right: 2px;
	}
	.storeDetails  .right {
	  width: 30px;
	  margin-left: 20px;
	  height: 100%;
	  font-size: 12px;
	  color: #333;
	  position: relative;
	}
	.storeDetails .store-news  .right .share-icon {
	  width: 22px;
	  height: 22px;
	  margin-bottom: 12rpx;
	}
	.storeDetails .store-address{
		padding-top: 15px;
		width: 100%;
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
	}
	.storeDetails .store-sticky{
		width: 100%;
		position: fixed;
		left: 0;
		z-index: 9;
	}
	
	.storeDetails .title-c{
		font-size: 14px;color: #1B1D1E;font-weight: bold;
		height: 40px;
		width: 100%;
		padding: 0 15px;
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
	}
	.storeDetails .setmeal-box{
		display: flex;width:100%;flex-direction: row;overflow-x: auto;
		padding-bottom: 15px;
		
	}
	.storeDetails .cardbag{
		display: flex;width:100%;flex-direction: row;overflow-x: auto;
		padding-bottom: 15px;
		
	}
	
	.storeDetails .setmeal-item{
		width: 200px;
		/* height: 98px; */
		
		background: #FFF;
		border-radius: 6px;
		box-shadow:0 6px 10px 1px #F2F2F2;
		overflow: hidden;
	}
	.storeDetails .setmeal-item-top{
		width: 100%;
		height: 75px;
		background: #221818;
		padding: 8px 15px;
		color: #EFDCCB;
		background-image: url('https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/cpoun.png');
		background-repeat: no-repeat;
		background-size: cover;
		position: relative;
		
	}
	.storeDetails .setmeal-pl{
		position: absolute;
		top:28.5px;
		width: 18px;
		height: 18px;
		border-radius: 9px;
		background: #FFF;
	}
	.storeDetails .setmeal-item-bottom{
		display: flex;
		align-items: center;
		justify-content: center;
		height: 23px;
		font-size: 10px;
		color: #221818;
		background: #FAF8F9;
		font-family: aa;
	}
	.storeDetails .setmeal-name{
		width: 1;
		flex: 1;
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
		
	}
	.storeDetails .setmeal-price{
		display: flex;
		flex-direction: row;
		align-items: flex-end;
	}
	.storeDetails .designer{
		padding:0 15px;
	}
	.storeDetails .designer-item{
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		padding: 15px 0;
		border-bottom: 1px solid #E2E2E2;
	}
	.storeDetails .designer-name{
		display: flex;
		flex-direction: column;
		justify-content: space-around;
		height: 55px;
		margin-left: 10px;
		
	}
	.storeDetails .designer-btn{
		width: 69px;
		height: 26px;
		border-radius: 4px;
		display: flex;
		align-items: center;
		justify-content: center;
		color: #FFF;
		font-size: 13px;
	}
	.designer-flex{
		display: flex;
		flex-direction: row;
		align-items: center;
	}
	.storeDetails .richtext{
		padding: 15px;
		
	
	}
	.storeDetails .richtext2{
		padding: 15px;
		margin-bottom: 80px;

	}
	.storeDetails .comment {
	  background: #fff;
	  font-family: aa;
	    padding: 15px;
	}
	.storeDetails .comment .content {
	  display: flex;
	  flex-direction: column;
	  
	  margin-bottom: 15px;
	}
	.storeDetails .comment .content .u-box {
	  display: flex;
	  margin-bottom: 10px;
	  align-items: center;
	}
	.storeDetails .comment .content .u-box .user {
	  flex: 1;
	  font-size: 13px;
	  color: #111111;
	  font-weight: bold;
	  align-items: center;
	  display: flex;
	}
	.storeDetails .comment .content .u-box .timer {
	  font-size: 12px;
	  color: #999999;
	  text-align: right;
	  
	}
	.storeDetails .comment .content .u-box .ucontent {
	  font-size: 11px;
	  color: #000;
	  margin-top: 10px;
	}
	.storeDetails .comment .content .u-box .plimg{
		display: flex;
		flex-direction: row;
		flex-wrap: wrap;
		margin-top: 10px;
	}
	.storeDetails  .plimg-item{
		margin-right: 3px;
		/* margin-bottom: 3px; */
	}
	.storeDetails .reply{
		width: 100%;
		padding: 10px;
		background: #F5F6F7;
		border-radius: 3px;
		margin-top: 10px;
		
	}
	.storeDetails .btn{
		width: 100%;
		padding: 15px;
		position: fixed;
		left: 0;
		bottom: 0;
		background: #FFF;
		z-index: 99;
	}
	.storeDetails .btn-box{
		width: 100%;
		height: 45px;
		border-radius: 6px;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 14px;
		color: #FFFFFF;
	}
	.d-t-box{
		width: 150px;
		height: 75px;
		border-radius: 6px;
		overflow: hidden;
		background-repeat: no-repeat;
		background-size: cover;
		position: relative;
	}
	 .bj {
		width: 100%;
		height: 100%;
		position: absolute;
		left: 0;
		top: 0;
		background: rgba(0, 0, 0, 0.2);
		border-radius: 6px;
	}
	.btext{
		width: 100%;
		height: 100%;
		position: absolute;
		left: 0;
		top: 0;
		font-size: 12px;
		color: #FFF;
		padding: 5px;
	}
</style>
<template>
	<view class='storeDetails'
			
	>
		<view class="details-box u-skeleton" >
			
			<view
			  class="headStatus"
			  v-if="scrollTop > 50 "
			  :style="[
			    headStyle,
			    {
			      zIndex: scrollTop < 10 ? 'unset' : 2,
			      opacity: scrollTop < 10 ? '100' : scrollTop,
				  background:'#FFF'
			    },
			  ]"
			>
			  <view class="arrow" @click="goback">
			    <u-icon name="arrow-left" size="48" color="#000"></u-icon>
			  </view>
			  <view class="title" style="color: #000000;" v-if="scrollTop > 50">{{pageTitle}}</view>
			  <view class="arrow"></view>
			</view>
			<view style="width: 100%;height: 210px;position: relative;" class="u-skeleton-rect">
				<image style="width: 100%;height: 210px;position: relative;" mode="aspectFill" :src="g.storeCoverImg?g.storeCoverImg:''"/>
				<!-- <swiper
				  indicator-dots
				  :autoplay="false"
				  :interval="1000"
				  style="height:210px;"
				>
				  <block v-for="(item, index) in g.storeNavImg" :key="index">
					<swiper-item>
					   <image @click="previewImage(index)" style="width:100%;height:100%;"  :src="item.pic_url" mode=""></image>
					</swiper-item>
				  </block>
				</swiper> -->
				<view
				  class="headStatus"
				  :style="[
				    headStyle,
				  ]"
				>
				  <view class="arrow" @click="goback">
				    <u-icon name="arrow-left" size="48" color="#FFF"></u-icon>
				  </view>
				  <view class="title" style="color: #000000;" ></view>
				  <view class="arrow"></view>
				</view>
			</view>
			
			<!-- 店铺的基本信息 -->
			<view class="storeNews">
				<view class="store-name u-skeleton-rect">
					<view class="sName">
						{{g.storeName?g.storeName:'无'}}
					</view>
					<view class="sN-r">
						{{g.consumptionObj && g.consumptionObj.consumptionStoreName?g.consumptionObj.consumptionStoreName:''}}
					</view>
				</view>
				<view class="store-news u-skeleton-rect">
					<view class="store-news-l">
						<view class="good-rb-box" >
						    <text class="good-rb-text">{{g.storeScore?g.storeScore.toFixed(1):'5.0'}}分</text>
							<u-rate
								:current="g.storeScore!=null &&g.storeScore>0?g.storeScore:'5'"
								active-color="#FEC471" inactive-color="#DDDDDD"
								active-icon="star"
								inactive-icon="star-o"
								size="26"
								:disabled="true"
							></u-rate>
						 </view>
						 <view style="font-size: 11px;color: #111111;margin-top: 10px;" class="u-skeleton-rect">
							 营业时间  {{g.storeServiceTime?g.storeServiceTime:'全天'}}营业
						 </view>
					</view>
					<view class="right u-skeleton-rect" @click="openShare">
					  <image src="@/static/images/icon/icon-share.png" class="share-icon" />
					  <text>分享</text>
					  <button 
					  v-if="u"
						style="width: 100%;height: 100%;position: absolute;left: 0;top: 0;opacity: 0;"
						open-type="share"
					  ></button>
					</view>
				</view>
				<!-- location-o -->
				<view class="store-address">
					<view class="store-news-l u-skeleton-rect" @click="lookLocation(g.storeAddress)">
						<view class="good-rb-box " style="font-size: 11px;color: #111111;">
						    {{g.storeAddress?g.storeAddress:''}}
						 </view>
						 <view style="font-size: 11px;color: #999999;margin-top: 5px;">
							 距离你当前位置{{g.distance>1?g.distance+'km':(g.distance*1000)+'m'}}
						 </view>
					</view>
					<view class="right u-skeleton-rect" @click="gophone" style="height: 34px;display: flex;flex-direction: column;align-items: center;justify-content: space-between;">
					  <image mode="aspectFill" style="width: 11px;height: 11px;"  src='https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/osTel.png'/>
					  <text>电话</text>
					</view>
				</view>
			</view>
			<view style="width: 100%;height: 15px;background: #FAF8F9;"></view>
		
			<!-- tabs的切换 -->
			<view class="store-tabs">
				<u-tabs :list="list" :is-scroll="list.length>5?true:false" :current="current" @change="change" :active-color="mc"></u-tabs>
			</view>
			<!-- 吸顶的时候出现 -->
			<view class="store-sticky u-skeleton-rect" v-if="showSticky==true" :style="{'top':headH+'px'}">
				<u-tabs :list="list" :is-scroll="list.length>5?true:false" :current="current" @change="change" :active-color="mc"></u-tabs>
			</view>
			<view class="title-c" v-if="allCoupon.length>0">
				商家套餐卡
			</view>
			
			<view class="setmeal-box" v-if="allCoupon.length>0">
				<view v-if="allCoupon.length==0" style="width: 100%;height: 50px;line-height: 50px;text-align: center;" >
					暂无任何优惠~
				</view>
				<view v-for="(cl, ci) in allCoupon" :key="ci" @click="gocoupon(cl)" v-if="allCoupon.length>0">
					<view class="setmeal-item u-skeleton-rect" :style="{'margin-left':ci==0?'15px':'0','margin-right': ci+1==allCoupon.length?'15px':'5px'}">
						<view class="setmeal-item-top">
							<view style="font-size: 14px;" class="setmeal-name">{{cl.Name}}</view>
							<view style="font-size: 11px;color: rgba(239, 220, 203, 0.6);margin: 3px 0;" class="setmeal-name">{{cl.Describe}}</view>
							<view class="setmeal-price">
								<text style="font-size: 13px;">核销次数:{{cl.HeXiao}}次</text>
							</view>
							<view class="setmeal-pl" style="left: -9px;"></view>
							<view class="setmeal-pl" style="right: -9px;"> </view>
						</view>
						<view class="setmeal-item-bottom">
							有效期：{{cl.IndateType==1?'领取后'+cl.IndateDay+'天内有效':cl.StartDate.split(' ')[0]+'至'+cl.EndDate.split(' ')[0]}}
						</view>
					</view>
				</view>
			</view>
			<view class="title-c" v-if="vipList.length>0">
				会员卡
			</view>
			
			<view class="cardbag" v-if="vipList.length>0">
				<view v-if="vipList.length==0" style="width: 100%;height: 50px;line-height: 50px;text-align: center;" >
					暂无任何会员卡~
				</view>
				<view v-for="(cl, ci) in vipList" :key="ci" @click="govipD(cl)" v-if="vipList.length>0">
					<view class="setmeal-item u-skeleton-rect" :style="{'margin-left':ci==0?'15px':'0','margin-right': ci+1==vipList.length?'15px':'5px','width':'150px'}">
						<view class="d-t-box">
							<image mode="aspectFill" :src="cl.CardBagIco" style="width: 100%;height: 100%;border-radius: 6px;"></image>
							<!-- <view class="bj"></view> -->
						<!-- 	<view class="btext">
								<text>{{cl.Name}}</text>
							</view> -->
						</view>
					</view>
				</view>
			</view>
			
			<view class="title-c" @click="goPersonal" v-if="personalList.length>0">
				<text>设计师</text>
				<u-icon name="arrow" :size="30" color="#666666"></u-icon>
			</view>
			<view class="designer u-skeleton-rect" v-if="personalList.length>0">
				<view class="designer-item" v-for="(x, ci2) in personalList" :key="ci2" v-if="personalList.length>0" @click="godesigner(x)">
					<view class="designer-flex" style="width: calc(100vw - 100px);">
						<u-avatar :src="x.ServiceLogo" size="110"></u-avatar>
						<view class="designer-name">
							<view class="designer-flex">
								<image v-if="x.Gender==1" style="width: 13px;height: 13px;" src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/male.png"></image>
								<image v-if="x.Gender==2" style="width: 13px;height: 13px;" src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/female.png"></image>
								<text style="margin-left: 5px;max-width: 400rpx;">{{x.Name}}</text>
							</view>
							<view class="designer-flex">
								<u-rate
									:current="x.storeScore!=null &&x.storeScore>0?x.storeScore:'5'"
									active-color="#FEC471" inactive-color="#DDDDDD"
									active-icon="star"
									inactive-icon="star-o"
									size="26"
									:disabled="true"
								></u-rate>
								<text style="font-size: 11px;color: #999999;">（{{x.CommentNum}}评价）</text>
							</view>
						</view>
					</view>
					<view class="designer-btn" v-if="g.IsHaveGoods>0" :style="{'background':mc}" @click.stop="gosubscribe(x)">
						预约
					</view>
				</view>
				<view v-if="personalList.length==0" style="width: 100%;height: 50px;line-height: 50px;text-align: center;" >
					暂无设计师数据~
				</view>
			</view>
			<view class="title-c classcomment" @click="gocomment()" >
				
				<text>
					评价{{count>0?'('+count+')':''}}
				</text>
				<u-icon name="arrow" :size="30" color="#666666"></u-icon>
			</view>
			<view class="comment u-skeleton-rect" v-if="comments.length>0">
				<view class="content" v-for="(item, index) in comments" :key='index'>
				  <view class="u-box">
				    <view class="user">
				      <u-avatar :src="item.UserPhotoPath" :size="50"></u-avatar>
				      <text style="margin:0 10px;overflow: hidden; white-space: nowrap;max-width: 200rpx;text-overflow: ellipsis;margin-bottom: 2px;">{{ item.UserName }}</text>
						  <u-rate
						    :current="item.CommentScore"
						    active-color="#FFC86D"
						    inactive-color="#b2b2b2"
						    active-icon="star"
						    inactive-icon="star-o"
						    size="26"
						  	:disabled="true"
						  ></u-rate>
				    </view>
				    <view class="timer">{{ item.CreateDate }}</view>
				  </view>
				  <view class="ucontent" style="line-height: 22px;">{{ item.Content }}</view>
				  <view class="plimg">
						<image v-for="(x, j) in item.CommentImgList" :key="j" class="plimg-item" mode="aspectFill" :src="x"
						   @click="previewImage2(j,item.CommentImgList)" :style="{'width':san,'height':san}" />
					  
				  </view>
				  <view class="reply" v-if="item.Reply!=''">
					  <view style="font-size: 12px;color: #121212;">回复:</view>
					  <view style="font-size: 12px;color: #9A9A9A;margin-top: 3px;">{{item.Reply}}</view>
				  </view>
				</view>
			</view>
			<view v-if="comments.length==0" style="width: 100%;height: 50px;line-height: 50px;text-align: center;" >
				暂无评价信息~
			</view>
			<view class="title-c" >
				价目表
			</view>
			<view class="richtext" >
				<h-parse :content="detailContent" @navigate="clickDescription"></h-parse>
			</view>
			<view class="title-c" >
				门店介绍
			</view>
			<view class="richtext2" >
				<h-parse :content="detailContent2" @navigate="clickDescription"></h-parse>
			</view>
			<view class="btn" v-if="g.IsHaveGoods>0">
				<view class="btn-box" :style="{'background':mc}" @click="gosubscribe2()">
					预约
				</view>
			</view>
		</view>
		
		<u-skeleton :loading="loading" :animation="true" bgColor="#FFF"></u-skeleton>
			
		
		<coupon
		  v-if="showCoupons"
		  :coupon-message="couponMessage"
		  @goLook="goLook"
		  @closeBtn="closeBtn"
		></coupon>
		<auth v-if="showAuth" @changeuserinfo="reloadUserinfo" @gbAuth="gbAuth"></auth>
	</view>
</template>

<script>
	import hParse from "@/components/u-parse/parse.vue";
	import auth from "@/components/auth/index";
	export default{
		components: {
		  auth,
		  hParse,
		},
		data(){
			return{
				showAuth:false,
				pageTitle: "门店详情",
				scrollTop:0,
				headStyle:{},
				nav:0,
				mc:'',
				u:{},
				pricecolor:'',
				secondary:'',
				loading:true,
				show:false,
				showCoupons: false,
				couponMessage: "",
				list:[
					{name: '优惠'},
					{name: '会员卡'},
					{name: '设计师'},
					{name: '评价'},
					{name: '价目表'},
					{name: '详情'},
					
				],
				san: '100px',
				current: 0,
				headH:68,
				stickyH:0,
				setmealH:0,//套餐卡的高度
				cardbagH:0,//会员卡的高度
				designerH:0,//设计师的高度
				richtextH:0,//富文本的高度
				richtextH2:0,//富文本的高度
				commentH:0,//评论的高度
				showSticky:false,//是否吸顶
				intoscrollTop:0,
				id:0,
				g:{},
				comments:[],
				detailContent: "",
				detailContent2:'',
				personalList:[],
				allCoupon:[],
				vipList:[],
				count:0,
				positionObj:{} //位置
			}
		},
		onLoad(option){
			console.log(option, "option");
			if (option && option.id) {
			  this.id = option.id ? option.id : 2; 
			} else {
			  this.id = option.GoodsId ? option.GoodsId : 2; 
			}
			
			if (option && option.custom_params) {
			  let custom_params = JSON.parse(decodeURIComponent(option.custom_params));
			  if (custom_params.user_id) {
			    uni.setStorageSync("pid", { pid: custom_params.user_id });
			  }
			  if (custom_params.Up) {//分享进入校园id
			    uni.setStorageSync("Up", { Up: custom_params.Up });
			  }
			}
			if (option && option.user_id) {
			  uni.setStorageSync("pid", { pid: option.user_id });
			}
			if (option && option.SmallShopId) {
			  uni.setStorageSync("SmallShopId", { SmallShopId: option.SmallShopId });
			}
			if (uni.getStorageSync("AnchorName")) {
			  //如果有主播名称了先清除
			  uni.removeStorageSync("AnchorName");
			}
			if (option && option.Up) {//分享进入校园id
			  uni.setStorageSync("Up", { Up: option.Up });
			}
			this.Up = uni.getStorageSync("mall_UserInfo")?uni.getStorageSync("mall_UserInfo").UserPageType:0;//用于分享出去的参数
			if (option && option.AnchorName) {
			  //当传过来有主播名称的时候 存入缓存
			  uni.setStorageSync("AnchorName", { AnchorName: option.AnchorName });
			}
			this.positionObj = uni.getStorageSync("position");
		
			this.u = uni.getStorageSync("mall_UserInfo");
			this.init();
			
			
			wx.showShareMenu({
			  withShareTicket: true,
			  menus: ["shareAppMessage", "shareTimeline"],
			});
			let windowWidth = this.$utils.SystemInfo().windowWidth
			this.san=(windowWidth - 30-9) / 3 + 'px'
		},
		onShareTimeline() {
		  setTimeout(() => {
		    console.log("分享调用");
		    this.getReceive();
		  }, 2500);
			let mall_UserInfo = uni.getStorageSync("mall_UserInfo")
			let uid = mall_UserInfo ? mall_UserInfo.UserId : 0;
			if(uid==0){
				uid = uni.getStorageSync("pid")?uni.getStorageSync("pid").pid:0
			}
			let SmallShopId = mall_UserInfo ? mall_UserInfo.SmallShopId : 0;
				if(SmallShopId == 0){//如果微店id为0 去找所属微店id
					SmallShopId = mall_UserInfo ? mall_UserInfo.UserSmallShopId : 0;
				}
		  let title =this.g.storeName;
		  let imageUrl =this.g.storeCoverImg;
		  let id = this.id;
		  
		  return {
		    title: title,
		    query: "id=" + this.id + "&user_id=" + uid+ "&SmallShopId=" + SmallShopId+ "&Up=" + this.Up,
		    imageUrl: imageUrl,
		  };
		},
		onShareAppMessage(res) {
		  setTimeout(() => {
		    console.log("分享朋友圈调用");
		    this.getReceive();
		  }, 2500);
		  let u = uni.getStorageSync("mall_UserInfo");
		  let uid = u.UserId ? u.UserId : 0;
			if(uid==0){
				uid = uni.getStorageSync("pid")?uni.getStorageSync("pid").pid:0
			}
		  let SmallShopId = u.SmallShopId ? u.SmallShopId : 0;
			if(SmallShopId == 0){//如果微店id为0 去找所属微店id
				SmallShopId = u.UserSmallShopId? u.UserSmallShopId:0
			}
		  return {
		    title: this.g.storeName,
		    path: "/pages/index/index?id=" + this.id + "&user_id=" + uid+ "&SmallShopId=" + SmallShopId+ "&Up=" + this.Up+'&JumpType=7',
		    imageUrl:this.g.storeCoverImg,
		  };
		},
		created() {
			this.mc = this.$uiConfig.mainColor;
			this.pricecolor = this.$uiConfig.pricecolor;
			this.secondary = this.$uiConfig.secondary;
			this.nav = uni.getMenuButtonBoundingClientRect().top;
			this.headStyle.paddingTop = this.nav +'px';
			
			
		},
	
		
		onPageScroll(e){
			
			this.scrollTop = e.scrollTop;
			if(this.scrollTop>=this.stickyH-this.headH){
				this.showSticky=true
			}
			if(this.stickyH-this.headH>this.scrollTop){
				this.showSticky=false
			}
		},
		mounted() {
			this.$utils.getRect('.headStatus').then(res => {
				if(res && res.height){
					this.headH = res.height
				}
			})
			this.$utils.getRect('.store-tabs').then(res => {
				if(res && res.top){
					this.stickyH = res.top
					
				}
			})
			
			
		},
		methods:{
			getTop(){
				setTimeout(()=>{
					this.$utils.getRect('.setmeal-box').then(res => {
						if(res && res.top){
							this.setmealH = res.top
						}
					})
					this.$utils.getRect('.cardbag').then(res => {
						if(res && res.top){
							this.cardbagH = res.top
						}
					})
					
					this.$utils.getRect('.designer').then(res => {
						if(res && res.top){
							this.designerH = res.top
						}
					})
					this.$utils.getRect('.classcomment').then(res => {
						if(res && res.top){
							this.commentH = res.top
						}
					})
					this.$utils.getRect('.richtext').then(res => {
						
						if(res && res.top){
							this.richtextH = res.top
						}
					})
					this.$utils.getRect('.richtext2').then(res => {
						
						if(res && res.top){
							this.richtextH2 = res.top
						}
					})
				},1000)
			},
			getRect(){
				return uni.createSelectorQuery().select(selector).boundingClientRect(data=>{
				if(data && data.top){
					this.stickyH = data.top
				}
			}).exec();
			},
			init() {
			  this.loading = true;
			  this.request2(
			    {
			      url: "/api/AppletStores/GetStoreInfo",
			      data: {
			        storeId: this.id,
					position: this.positionObj.position
			      },
			    },
			    (res) => {
			      if (res.resultCode == 1) {
			        this.g = res.data.storeInfo;
			        var richtext = this.g.storeProject;
			        this.detailContent = richtext;
					this.detailContent2 =  this.g.storeIntro
			        
			
			        //登录在调用评论接口
			        if (this.u) {
			          // this.initComments();
					  this.getGoodsComment()
					  
			        }else{
						this.getSPList()//获取服务人员列表
					}
			        
			      } else {
			        
			      }
			    }
			  );
			  
			},
			getSPList(){
				this.request2({
						url: '/api/AppletStores/GetServicePersonalList',
						data: {pageIndex:1,pageSize:5,StoreId:this.id}
					},
					res => {
						if (res.resultCode == 1) {
							this.personalList = res.data.pageData;
							if(this.personalList.length==0){
								for(let i=0;i<this.list.length;i++){
									if(this.list[i].name=='设计师'){
										this.list.splice(i,1)
									}
								}
							}
						}
						this.loading = false;
					}
				);
				this.getTop()
			},
			getAllCPList(){
				this.request2({
						url: '/api/AppletStores/GetAllCouponPageList',
						data: {pageIndex:1,pageSize:999,StoreId:this.id}
					},
					res => {
						
						if (res.resultCode == 1) {
							this.allCoupon = res.data.pageData
							if(this.allCoupon.length==0){
								for(let i=0;i<this.list.length;i++){
									if(this.list[i].name=='优惠'){
										this.list.splice(i,1)
									}
								}
							}
							this.getViplist()
						}
					}
				);
				
			},
			getViplist(){
				this.request2({
						url: '/api/AppletStores/GetAllCardBagList',
						data: {pageIndex:1,pageSize:999,StoreId:this.id}
					},
					res => {
						
						if (res.resultCode == 1) {
							this.vipList = res.data.pageData
							if(this.vipList.length==0){
								for(let i=0;i<this.list.length;i++){
									if(this.list[i].name=='会员卡'){
										this.list.splice(i,1)
									}
								}
							}
							
						}
					}
				);
				this.getSPList()//获取服务人员列表
			},
			getGoodsComment(){//获取评论
				this.request2({
						url: '/api/AppletStores/GetAppletGoodsCommentPageList',
						data: {pageIndex:1,pageSize:5,StoreId:this.id,GoodsId:0,ServicePersonalId:0}
					},
					res => {
						
						if (res.resultCode == 1) {
							this.comments = res.data.pageData
							this.count = res.data.count
						}
					}
				);
				this.getAllCPList()//获取门店套餐卡
			},
			
			goback(){
				uni.navigateBack({})
			},
		
			change(e){
				this.current= e;
				let scrollTop= 0;
				let that = this
				if(that.list[e].name=='优惠'){
					uni.pageScrollTo({
						scrollTop: that.setmealH - that.headH -40-30
					})
				}else if(that.list[e].name=='会员卡'){
					uni.pageScrollTo({
						scrollTop: that.cardbagH - that.headH -40-30
					})
				}else if(that.list[e].name=='设计师'){
					uni.pageScrollTo({
						scrollTop: that.designerH - that.headH -40-30
					})
				}else if(that.list[e].name=='评价'){
					uni.pageScrollTo({
						scrollTop: that.commentH - that.headH -40-30
					})
				}else if(that.list[e].name=='价目表'){
					uni.pageScrollTo({
						scrollTop: that.richtextH - that.headH -40-30
					})
				}else if(that.list[e].name=='详情'){
					uni.pageScrollTo({
						scrollTop: that.richtextH2 - that.headH -40-30
					})
				}
				
				// if(e==0){
				// 	uni.pageScrollTo({
				// 		scrollTop: that.setmealH - that.headH -40-30
				// 	})
				// }else if(e==1){
				// 	uni.pageScrollTo({
				// 		scrollTop: that.cardbagH - that.headH -40-30
				// 	})
				// }else if(e==2){
				// 	uni.pageScrollTo({
				// 		scrollTop: that.designerH - that.headH -40-30
				// 	})
				// }else if(e==3){
				// 	uni.pageScrollTo({
				// 		scrollTop: that.commentH - that.headH -40
				// 	})
				// }else if(e==4){
				// 	uni.pageScrollTo({
				// 		scrollTop: that.richtextH - that.headH -40-30
				// 	})
				// }
				// else if(e==5){
				// 	uni.pageScrollTo({
				// 		scrollTop: that.richtextH2 - that.headH -40-30
				// 	})
				// }
				
			},
			gophone(){
				uni.makePhoneCall({
				    phoneNumber: this.g.storeTel //仅为示例
				});
			},
			//图片预览
			previewImage2(index, images) {
				uni.previewImage({
					urls: images,
					current: index,
				});
			},
			getReceive() {
			  //分享进入调取领券接口
			  // 1-分享，2-购买并付款
			  this.request2(
			    {
			      url: "/api/AppletStores/ShareEducationCoupon",
			      data: {
			        TriggerType: 1,
					StoreId:this.id
					
			      },
			    },
			    (res) => {
			      if (res.couponResultCode == 1) {
			        this.couponMessage = res.couponMessage;
			        this.showCoupons = true;
			      }
			    }
			  );
			},
			goLook() {
			  this.showCoupons = true;
			  uni.navigateTo({
			    url: "/pages/reserve/personal/cardList",
			  });
			},
			closeBtn() {
			  this.showCoupons = false;
			},
			goPersonal(){//跳转到设计师列表
				uni.navigateTo({
					url: "/pages/reserve/personalList?id="+this.id,
				})
			},
			gocomment(){//评论列表
				uni.navigateTo({
					url: "/pages/reserve/commentList?StoreId="+this.id,
				})
			},
			gosubscribe(x){
				if (this.u) {
				  uni.navigateTo({
				  	url: "/pages/reserve/subscribe?id="+this.id+'&servicePersionId='+x.ID,
				  })
				} else {
				  this.showAuth = true;
				}
			},
			gosubscribe2(){
				if (this.u) {
				  uni.navigateTo({
				  	url: "/pages/reserve/subscribe?id="+this.id,
				  })
				} else {
				  this.showAuth = true;
				}
			},
			openShare(){
				if (!this.u) {
					this.showAuth = true;
				} 
			},
			reloadUserinfo() {
			  this.u = uni.getStorageSync("mall_UserInfo");
			   this.getGoodsComment()
			   this.getAllCPList()//获取门店套餐卡
			  
			},
			//关闭登录窗口
			gbAuth() {
			  this.showAuth = false;
			},
			gocoupon(item){//优惠券详情
				uni.navigateTo({
					url: "/pages/reserve/personal/couponDetail?ID="+item.CouponId+'&storeId='+this.id,
				})
			},
			godesigner(item){//设计师详情
				uni.navigateTo({
					url: "/pages/reserve/designerDetail?ID="+item.ID+'&storeId='+this.id,
				})
			},
			govipD(item){//会员卡详情
				uni.navigateTo({
					url: "/pages/reserve/personal/vipDetail?ID="+item.CouponId+'&storeId='+this.id,
				})
			},
			
			lookLocation(storeAddress){
				uni.openLocation({
				    latitude: '',
				    longitude: '',
					address:storeAddress,
				    success: function () {
				        console.log('success');
				    }
				});
			}
		}
	}
</script>


