| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853 | <template>	<view class="content">		<!-- <view class="img-box"  @click="showImg()">			<image  :src="item.imgUrl"></image>		</view> -->		<!-- 购买轮播列表 -->		 <view class="buy-lists" v-if="notics&¬ics.length>0" :style="{height: boxHeight+'px'}">			<view :class="{'buy-top': animate == true }" :style="{marginTop: animate == true ? `-${marginTop}px`:'0'}">				<view class="buy-list buy-txtbox" v-for="(item,index) in notics" :key="index">					<view class="buy-item"><text class="textOne buy-name" >{{item.fsUserName|| ''}}</text><text>{{item.timeTxt}} 已下单</text></view>				</view>			</view>		 </view>		<view class="cont-box">			<view class="goods-banner" @click="showImg()">				<swiper					class="swiper" 					:indicator-dots="false" 					:circular="true" 					:autoplay="true" 					:interval="3000" 					:duration="1000"					indicator-color="rgba(255, 255, 255, 0.6)"					indicator-active-color="#ffffff"					@change="swiperChange"				>					<swiper-item  class="swiper-item" v-for="(item,index) in  imgs" :key="index">						<image :src="item" mode="aspectFit"></image>					</swiper-item>				</swiper>				<!-- 数量 -->				<view class="num-box">{{ activeImg }}/{{ imgs.length }}</view>			</view>			<view class="package-box">				<view class="title">{{item.packageName}}</view>				<view class="desc">					<view class="cycle" v-if="item.cycle>0">服务周期{{item.cycle}}天</view>					<view class="duration" v-if="item.duration>0">签约时长{{item.duration}}天</view>				</view>				<view class="num-box">					<view class="price-box">						<view class="price"  v-if="item!=null">¥{{item.price.toFixed(2)}}元/日</view>						<view class="price"  v-if="item!=null&&item.packageSubType==1">咨询包</view>						<view class="price"  v-if="item!=null&&item.packageSubType==2">治疗包</view>						<view class="price"  v-if="item!=null&&item.packageSubType==3">产品包</view>					</view>					<view class="count">{{item.sales}}人已购</view>				</view>			</view>			<view class="drug-box" v-if="products.length>0 ">				<view class="title-box">					<view class="line"></view>					<view class="title">处方列表</view>				</view>				<view class="drug-list"  >					<view  v-for="(product,index) in products"  class="drug-item" >						<view class="drug" v-if="displayMore==0?index<2:true" >							<view class="img-box">								<image :src="product.image" mode="aspectFill"></image>							</view>							<view class="drug-info"   >								<view>									<view class="name-box ellipsis2">										{{product.productName}} 									</view>									<view class="spec">{{product.sku}}</view>								</view>								<view class="num-box">									<view class="use">										{{product.usageMethod}}									</view>									<view class="price">																				<!-- <text class="unit">¥</text>										<text class="num">{{product.price.toFixed(2)}}</text> -->									</view>									<!-- <view class="amount">x{{product.count}}</view> -->								</view>							</view>						</view>											</view>				</view>				<view v-if="products.length>2" class="display-more" @click="showMore()" >{{displayText}}</view>							</view>			<view class="desc-box" v-if="describe.use!=null">				<view class="title-box">					<view class="line"></view>					<view class="title">疗程</view>				</view>				<view class="desc" v-if="describe!=null" v-html="describe.use">				</view>			</view>			<view class="desc-box">				<view class="title-box">					<view class="line"></view>					<view class="title">疗法详情</view>				</view>				<view class="desc" v-html="item.desc">				</view>			</view>			<view class="desc-box" v-if="item.indication!=null">				<view class="title-box">					<view class="line"></view>					<view class="title">功能主治</view>				</view>				<view class="desc" v-if="item!=null" v-html="item.indication">				</view>			</view>			<view class="desc-box" v-if="describe.usageMethod!=null">				<view class="title-box">					<view class="line"></view>					<view class="title">服用/使用方式</view>				</view>				<view class="desc" v-html="describe.usageMethod">				</view>			</view>			<view class="desc-box" v-if="describe.forPeople!=null">				<view class="title-box">					<view class="line"></view>					<view class="title">适宜人群</view>				</view>				<view class="desc" v-html="describe.forPeople">				</view>			</view>			<view class="desc-box" v-if="describe.tabooPeople!=null">				<view class="title-box">					<view class="line"></view>					<view class="title">禁忌人群</view>				</view>				<view class="desc" v-html="describe.tabooPeople">				</view>			</view>			<view class="desc-box" v-if="item.explain!=null">				<view class="title-box">					<view class="line"></view>					<view class="title">方解/搭配优势</view>				</view>				<view class="desc" v-html="item.explain">				</view>			</view>		</view>		<view class="btn-foot">			<view class="p-price-box">				<view class="p-name">¥</view>				<view class="p-price" v-if="item!=null">{{item.totalPrice.toFixed(2)}}</view>			</view>			<view class="btn-box">				<view class="btn buy"   >					分享					<button class="contact-btn"   data-name="shareBtn" open-type="share">分享</button>				</view>							</view>		</view>	</view> </template><script>	import { caculateTimeago } from '@/pages/TUIKit/utils/date.ts';	import {getConfigByKey} from '@/api/common'	import {getPackageById,getPackageDoctorList,getNewOrderByPackageId} from '@/api/package.js'	export default {		data() {			return {				displayText:"查看更多",				displayMore:0,				imgs:[],				activeImg: 1,				doctorShow:false,				doctors:[],				products:[],				packageId:null,				item:{},				describe:null,				doctorId:null,				doctorPageNum:1,				doctorLastPage:false,				doctorTotal:0,				choose: 0,				boxHeight: 94,				marginTop: 30,				animate:false,				timer:null,				notics:[],			};		},		onLoad(option) {			this.packageId=option.packageId;			this.companyId=uni.getStorageSync('companyId');			this.companyUserId=uni.getStorageSync('companyUserId');				},		onReady() {			this.getNewOrderByPackageId()		},		onUnload() {			if(this.timer) clearInterval(this.timer)		},		onShow() {			this.getPackageById();			this.getPackageDoctorList();			if(this.packageId) {				this.getConfigByKey()			}		},		onShareAppMessage(res) {			return {				title: this.item.packageName,				path: '/pages_index/packageDetails?packageId='+this.packageId+"&companyId="+this.companyId+"&companyUserId="+this.companyUserId+'&choose='+this.choose|| '',				imageUrl: this.item.imgUrl //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4			}		},		methods:{			getNewOrderByPackageId() {				if(this.timer) clearInterval(this.timer)				getNewOrderByPackageId({packageId:this.packageId}).then(res=>{					if(res.code== 200) {						this.notics = res.data						if(res.data&&res.data.length > 0) {							this.notics = res.data.map(item=>({								...item,								timeTxt: caculateTimeago(new Date(item.payTime).getTime(),1)							}))														this.getText()							this.timer = setInterval(this.scroll, 1200);						}					} else {						this.notics = []					}				})			},			scroll() {				this.animate = true;				setTimeout(() => {					this.notics.push(this.notics[0]);					this.notics.shift();					this.animate = false;				}, 1000);			},			getText() {				const query = uni.createSelectorQuery().in(this);				query				  .select(".buy-txtbox")				  .boundingClientRect((data) => {					this.marginTop = data.height + 7					if(this.notics.length>2) {						this.boxHeight = this.marginTop * 3 + 4					} else {						this.boxHeight = this.marginTop * this.notics.length + 4					}				  })				  .exec();			},			showMore(){				this.displayMore=this.displayMore==1?0:1;				this.displayText=this.displayMore==1?'收起':'查看更多'				console.log(this.displayText)			},			swiperChange(event) {				this.activeImg = event.detail.current + 1			},			handleDoctorClick(item){				this.doctorShow=false;				this.doctorId=item.doctorId				uni.navigateTo({					url:"/pages_index/packageForm?packageId="+this.packageId+"&doctorId="+this.doctorId				})							},			lower(event) {				if(this.doctorTotal>this.doctors.length){					this.doctorPageNum++;					this.getPackageDoctorList();				}			},			 			doctorOpen(){				this.doctorShow=true;			},			doctorClose(){				this.doctorShow=false;			},			showImg() {				 //预览图片				 uni.previewImage({				 	urls: this.imgs,				 	current: this.imgs[0]				 });			},			getPackageDoctorList(){				if(this.doctorLastPage){					return;				}				var data = {					packageId:this.packageId,					pageNum: this.doctorPageNum,					pageSize: 10				};				var that=this;				getPackageDoctorList(data).then(					res => {						if(res.code==200){							//设置列表数据							if (this.doctorPageNum == 0) {								that.doctors = res.data.list; 															} else {								that.doctors = that.doctors.concat(res.data.list);								 							}							this.doctorLastPage=res.data.isLastPage;							this.doctorTotal=res.data.total							console.log(that.doctors)							 						}else{							uni.showToast({								icon:'none',								title: "请求失败",							});						}					},					rej => {}				);			},			getPackageById(){				let data = {packageId:this.packageId};				getPackageById(data).then(					res => {						if(res.code==200){							this.item=res.data;							if(res.data.images!=null){								this.imgs=res.data.images.split(",")							}							else{								this.activeImg=0;							}							this.describe=JSON.parse(this.item.describeJson);							if(this.item.productJson!=null){								this.products=JSON.parse(this.item.productJson);							}							console.log(this.imgs)						}else{							uni.showToast({								icon:'none',								title: "请求失败",							});						}					},					rej => {}				);			},			getConfigByKey(){				let param = {key:"app.config"};				getConfigByKey(param).then(					res => {						if(res.code==200){							let data=res.data ? JSON.parse(res.data) : {};							const fsPackage = data.fsPackage&&data.fsPackage.length > 0 ? data.fsPackage[0] : {}							this.choose = fsPackage&&fsPackage.packageId == this.packageId ? 2 : 0						}else{							uni.showToast({								icon:'none',								title: "请求失败",							});						}					},					rej => {}				);			},		}	}</script><style lang="scss">	page{		height: 100%;	}	.textOne {		overflow: hidden;		white-space: nowrap;		text-overflow: ellipsis;	}	.buy-lists{		height: 94px;		background-color:transparent;		overflow: hidden;		width: 60%;		position: absolute;		z-index: 99;		top: 20vh;		left: 20rpx;	}	.buy-list{		height: 23px;		font-size: 26rpx;		margin-top: 7px;		overflow: hidden;		color: #fff;		.buy-item {			display: inline-flex;			align-items: center;			height: 100%;			line-height: 100%;			overflow: hidden;			background-color: rgba(0, 0, 0, 0.35);			border-radius: 10rpx;			padding: 0 20rpx;			box-sizing: border-box;			word-break: break-all;			white-space: nowrap;		}		.buy-name {			width: 50%;			margin-right: 10rpx;		}		text {			word-break: break-all;			white-space: nowrap;		}	}	.buy-top {	    transition: all 0.8s ease-in;	    margin-top: -30px;	  }	.content{		height: 100%;		display: flex;		flex-direction: column;		 		.cont-box{			padding-bottom: 121rpx;			.package-box{				background-color: #fff;				padding: 20rpx;				width: 100%;				display: flex;				flex-direction: column;				align-items: flex-start;				justify-content: flex-start;				 				.title{					font-weight: bold;					font-size: 34upx;					font-family: PingFang SC;					color: #111;				}				.desc{					margin-top: 15rpx;					display: flex;					align-items: flex-start;					justify-content: flex-start;					.cycle{						background-color: #eee;						border-radius: 30rpx;						padding: 5rpx 15rpx;						font-size: 26upx;						font-family: PingFang SC;						color: #C39A58;					}					.duration{						margin-left: 10rpx;						background-color: #eee;						border-radius: 30rpx;						padding: 5rpx 15rpx;						font-size: 26upx;						font-family: PingFang SC;						color: #C39A58;					}									}				.num-box{					margin-top: 15rpx;					flex: 1;					display: flex;					align-items: flex-end;					justify-content: space-between;					width: 100%;					.price-box{						display: flex;						align-items: center;						justify-content: flex-start;						.price{							margin-right: 10rpx;							padding: 5rpx 10rpx;							background-color: #C39A58;							border-radius: 30rpx;							font-size: 20upx;							font-family: PingFang SC;							color: #ffffff;						}					}					.count{						font-size: 24upx;						font-family: PingFang SC;						color: #333333;					}									}								 			}			.desc-box{				background-color: #fff;				padding: 20rpx;				margin-top: 10rpx;				.title-box{					display: flex;					flex-direction: row;					align-items: center;					justify-content: flex-start;					.title{						font-size: 32upx;						font-family: PingFang SC;						font-weight: bold;						color: #111111;					}					.line{						margin-right: 15rpx;						height: 30rpx;						width: 6rpx;						background-color: #C39A58;											}					 				}				.desc{					margin-top: 15rpx;					font-size: 28upx;					font-family: PingFang SC;					color: #9a9a9c;				}			}			.drug-box{				background-color: #fff;				padding: 20rpx;				margin-top: 10rpx;				.title-box{					display: flex;					flex-direction: row;					align-items: center;					justify-content: flex-start;					.title{						font-size: 32upx;						font-family: PingFang SC;						font-weight: bold;						color: #111111;					}					.line{						margin-right: 15rpx;						height: 30rpx;						width: 6rpx;						background-color: #C39A58;											}					 				}				.drug-list{					margin-top: 15rpx;					.drug-item{						.drug{							padding-bottom: 15upx;							border-bottom: 1px soli #F0F0F0;							display: flex;							align-items: center;							.img-box{								width: 160upx;								height: 160upx;								margin-right: 30upx;								flex-shrink: 0;								image{									width: 100%;									height: 100%;								}							}							.drug-info{								width: calc(100% - 190upx);								height: 160upx;								display: flex;								flex-direction: column;								justify-content: space-between;								.name-box{									font-size: 28upx;									font-family: PingFang SC;									font-weight: 500;									color: #111111;									line-height: 40upx;									.tag{										display: inline-block;										padding: 0 6upx;										height: 30upx;										background: linear-gradient(90deg, #2BC7B9 0%, #2BC7A4 100%);										border-radius: 4upx;										margin-right: 10upx;										font-size: 22upx;										font-family: PingFang SC;										font-weight: bold;										color: #FFFFFF;										line-height: 30upx;										float: left;										margin-top: 7upx;									}								}								.spec{									font-size: 24upx;									font-family: PingFang SC;									font-weight: 500;									color: #999999;									line-height: 1;									margin-top: 10upx;								}								.num-box{									display: flex;									align-items: center;									justify-content: space-between;									.price{										display: flex;										align-items: flex-end;										.unit{											font-size: 24upx;											font-family: PingFang SC;											font-weight: 500;											color: #111111;											line-height: 1.2;											margin-right: 4upx;										}										.num{											font-size: 32upx;											font-family: PingFang SC;											font-weight: 500;											color: #111111;											line-height: 1;										}									}									.use{										font-size: 24upx;										font-family: PingFang SC;										color: #999999;									}									.amount{										font-size: 24upx;										font-family: PingFang SC;										font-weight: 500;										color: #999999;										line-height: 1;									}								}							}						}											}				}				.display-more{					font-size: 24upx;					font-family: PingFang SC;					font-weight: 500;					color: #999999;					display: flex;					align-items: center;					justify-content: center;				}			}		}	}	 	.btn-foot{		box-sizing: border-box;		width: 100%;		height: 121upx;		background: #FFFFFF;		padding: 0 32upx 0 28upx;		display: flex;		align-items: center;		justify-content: space-between;		position: fixed;		left: 0;		bottom: 0;		z-index: 99;		.p-price-box{			display: flex;			align-items: center;			.p-name{				font-size: 28upx;				font-family: PingFang SC;				font-weight: 500;				color: #FF6633;			}			.p-price{				margin-left: 10rpx;				color: #FF6633;				font-size: 32upx;				font-family: PingFang SC;				font-weight: bold;							}		}		 		.btn-box{			display: flex;			align-items: center;			.btn{				width: 200upx;				height: 88upx;				line-height: 88upx;				text-align: center;				border-radius: 44upx;				margin-left: 20upx;				font-size: 30upx;				font-family: PingFang SC;				font-weight: bold;				color: #FFFFFF;				&:first-child{					margin-left: 0;				}			 				&.buy{					background: #C39A58;				}				.contact-btn{					display: inline-block;					position: absolute;					top: 0;					left: 0;					width: 100%;					height: 100%;					opacity: 0;					z-index: 9999;				}			}					}	}	.doctors{		overflow-y: auto;		padding: 20rpx;		height: 650rpx;		width: 100%;		display: flex;		flex-direction: column;		align-items: flex-start;		justify-content: flex-start;		box-sizing: border-box;		.scroll-list{			height: 650upx;		}		.doctor{			width: 100%;			margin-bottom: 15rpx;			background: #f9f8fe;			padding: 20rpx;			display: flex;			flex-direction: column;			align-items: flex-start;			justify-content: flex-start;			&:last-child{				margin-bottom: 0rpx;			}			.item{				width: 100%;				display: flex;				align-items: center;				justify-content: space-between;				.left{					flex: 1;					width: 100%;					display: flex;					align-items: flex-start;					justify-content: flex-start;					.doc-img{						width:80rpx;						height:80rpx;						border-radius: 50%;					}					.right{						width: calc(100% - 100rpx); 						margin-left: 20rpx;						display: flex;						flex-direction: column;						align-items: flex-start;						justify-content: flex-start;						.doc-box{							display: flex;							align-items: center;							justify-content: space-between;							.doc-name{								font-size: 28upx;								font-family: PingFang SC;								font-weight: bold;								color: #111111;															}							.doc-position{								margin-left: 50rpx;								font-size: 26upx;								font-family: PingFang SC;								color: #2d2b36;							}						}						.hospital{							margin-top: 10rpx;							font-size: 24upx;							font-family: PingFang SC;							color: #9a9a9c;						}					}				}				.btn{					padding: 10rpx 30rpx;					text-align: center;					border-radius: 30upx;					font-size: 28upx;					font-family: PingFang SC;					color: #C39A58;					border:1rpx solid  #C39A58;					 				}							}					}	}	.goods-banner{		height: 756upx;		background-color: #FFFFFF;		position: relative;		.swiper-item{			box-sizing: border-box;		}		.swiper,		.swiper-item,		.swiper-item image{			width: 100%;			height: 100%;		}		.num-box{			width: 80upx;			height: 44upx;			line-height: 44upx;			text-align: center;			font-size: 24upx;			font-family: PingFang SC;			font-weight: 500;			color: #FFFFFF;			background: rgba(0, 0, 0, .3);			border-radius: 22upx;			position: absolute;			right: 30upx;			bottom: 30upx;			z-index: 10;		}	}</style>
 |