scenicProduct.vue 10.8 KB
Newer Older
1 2
<template>
	<view>
3 4 5 6 7 8 9 10
		<view class="banner" v-if="detailData">
			<u-swiper :list="detailData.imgList" @change="e => currentNum = e.current" indicatorStyle="right: 20px;bottom:25px" height="400" circular>
				<view slot="indicator" class="indicator-num">
						<text class="indicator-num__text">{{ currentNum + 1 }}/{{detailData.imgList.length}}</text>
				</view>
			</u-swiper>
		</view>
		<view class="middle">
潘永坪's avatar
潘永坪 committed
11
			<view class="middle-introduce" v-if="detailData">
12 13 14 15 16 17
				<view class="introduce-one" @click="showDetail()">
					<view class="merchantname">
						{{detailData.name}}
					</view>
					<view class="businesstime">
						<view style="font-size: 24rpx;">
潘永坪's avatar
潘永坪 committed
18
							<text style="color: #3688ff;margin-right: 20rpx;">{{tagStatus}}</text>
19 20 21 22 23 24 25 26 27 28 29 30
							<text style="color: #999;">
							{{detailData.businessStart?detailData.businessStart.substr(0,5):""}}~{{detailData.businessStart?detailData.businessEnd.substr(0,5):""}}
							</text>
						</view>
						<view style="display: flex;">
							<text>详情</text>
							<u-icon name='arrow-right'></u-icon>
						</view>
					</view>
				</view>
				<view class='introduce-two'>
					<text>
潘永坪's avatar
潘永坪 committed
31
						{{detailData.score||4.9}}
32 33
					</text>
					<text>
潘永坪's avatar
潘永坪 committed
34
						{{detailData.comments.length>0?detailData.comments.length:'100+'}}条好评
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
					</text>
				</view>
				
				<view class="introduce-three">
					<view style="flex: 1;margin-right: 20rpx;">
					{{detailData.address}}
					</view>
					<view class="introduce-icon">
						<u-icon name='map-fill' color='#3688ff' size='44' @click="navigation()"></u-icon>
						<text></text>
						<u-icon name='phone-fill' color='#3688ff' size='44' @click="makePhone()"></u-icon>
					</view>
				</view>
			</view>
			
			<view class="middle-product">
				<view class="product-title">
					<view>
						景区门票
					</view>
					<view class="title-tag">
						<text v-for="(item,index) of tagArr" :key='index'>
						  {{item}}
						  <text class="tag-line" v-if="index != tagArr.length-1">|</text>
						</text>
					</view>
				</view>
				
				<view class="product-list" @click="goOrder(item)" v-for="(item,index) of ticketList" :key="index">
					<view class="list-left">
						<view>{{item.name}}</view>
						<view class="list-buyknow" @click.stop="showBuyKnow(item.id)">
							购票须知
							<u-icon name="arrow-right" size='26' color='#B4B4B4'></u-icon>
						</view>
					</view>
					
					<view class="list-right">
						<view>
							<text class="small-price">
								¥{{parseFloat(parseFloat(item.originalPrice).toFixed(2))}}
							</text>
							<text class="big-price">
								<text style="font-size: 28rpx;">¥</text>
								{{parseFloat(parseFloat(item.sellingPrice).toFixed(2))}}
							</text>
						</view>
						<view style="margin-top: 15rpx;">
							<text class="btn">购买</text>
						</view>
					</view>
					<view v-if="item.status==2" class="sellout">
						已售罄
					</view>
				</view>
				<view class="nomore" v-if="ticketList.length>0">
					没有更多了
				</view>
				
				<view style="padding: 30rpx;" v-else>
					<u-empty iconSize='180' textSize='28'>
						
					</u-empty>
				</view>
				
			</view>
		</view>
		<!-- 购买须知 -->
		<buyKnow :buyKnowData="buyKnowData" ref="buyKnow"></buyKnow>
		<!-- 商户详情 -->
		<merchantDetail :detailData='detailData' ref='merchantDetail'></merchantDetail>
106 107 108 109
	</view>
</template>

<script>
110 111
import buyKnow from '@/components/buyKnow.vue' //购买须知
import merchantDetail from '@/components/merchantDetail' //详情弹窗
112
export default {
113 114 115 116
  components: {
	  buyKnow,
	  merchantDetail
  },
117 118
  data() {
    return {
119 120 121 122
      ticketList:[],//门票列表
      detailData:'',//详情数据
      currentNum:0,//轮播图下标
      tagArr:[],//标签数组
潘永坪's avatar
潘永坪 committed
123
      tagStatus:'',//标签状态,开园或者闭园
124 125 126
      buyKnowData:'',//购票须知数据
      companyId:'',//公司Id
      openid:uni.getStorageSync('openid')||'',//openid
127 128 129
    }
  },
  onLoad(option) {
130 131 132 133 134 135
    this.nowTime=parseInt(new Date().Format('hhmm'))
    this.companyId=this.$commonjs.getCompanyId(option)||''
    this.merchantId = this.$commonjs.getKey(option,'merchantId')|| ''
    this.channelType = this.$commonjs.getKey(option,'channelType')|| 0
    this.initProduct()
    this.initDetail()
136 137
  },
  methods: {
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258
    //---展示详情
    showDetail(){
      this.$refs.merchantDetail.showPop=true
    },
    //---导航
    navigation(){
		  uni.openLocation({
		    latitude:this.detailData.latitude,
		    longitude:this.detailData.longitude,
		    name:this.detailData.name,
		    address:this.detailData.address,
		    success: function () {
		      
		    }
		  })
    },
    //---拨打电话
    makePhone() {
		  uni.makePhoneCall({
		    phoneNumber:this.detailData.phone
		  })
    },
    //---跳转订单页面
    goOrder(item){
		  if(item.status!='2'){//未售罄
		    let data={
		      chooseGroupGoodList:[{
		        productId:item.id,
		        merchantCode:item.merchantCode,
		        extendContent:'{"openid":'+'"'+this.openid+'"'+'}'
		      }],
		      companyId:this.companyId,
		    }
		    this.$request('scenic/groupGood/checkProductChangeList',data).then((res)=>{
		      if(res.code=='00'){
		        let jumpType=''
		        if(res.data.length>0){
		          jumpType=res.data[0].jumpType
		        }
            let productId=''
            if(jumpType===0){//变产品id
						  productId=res.data[0].afterProductId||item.id
            }else{//不变
						  productId=item.id
            }
		        if(item.ticketType==2){//景区联票
		          let query=`?merchantId=${this.merchantId}&productId=${productId}`
		          uni.navigateTo({
		            url: '/pages/scenic/scenicJointOrder/scenicJointOrder'+ query
		          })
		        }
		        if(item.ticketType!=2){//景区单票
		          let query=`?merchantId=${this.merchantId}&productId=${productId}`
              uni.navigateTo({
							  url: '/pages/scenic/scenicSingleOrder/scenicSingleOrder'+ query
              })
		        }
		      }else{
		        uni.showToast({
		          title: res.message,
		          icon: 'none'
		        })
		      }
		    })
		  }
    },
    //---展示购买须知
    showBuyKnow(id) {
      let data={id}
      this.$request('scenic/groupGood/loadProduct',data).then((res)=>{
        if(res.code=='00'){
          this.buyKnowData = res.data
          this.$refs.buyKnow.showPop = true
        }else{
          uni.showToast({
            title: res.message,
            icon: 'none'
          })
        }
      })
    },
    //---产品加载
    initProduct(){
      this.ticketList=[]
      let data={
        merchantId:this.merchantId,//商户id
        type:1,//类型:1景区、2酒店、3餐饮
        channelType:this.channelType,//渠道Id
      }
      this.$request('scenic/user/product/findProductList',data).then((res)=>{
        if(res.code=='00'){
          let list=res.data.list||[]
          list.forEach((item,index)=>{
            //营业时间重新组成
            if(item.businessTime){
              item.businessTime=item.businessTime.split(';')
            }
            //等于7为特价
            if(item.channelType!=7){
              this.ticketList.push(item)
            }
          })
        }else{
          uni.showToast({
            title: res.message,
            icon: 'none'
          })
        }
      })
    },
    //---详情加载
    initDetail(){
      let data={
        userId:uni.getStorageSync('userId')||'',
        openid:this.openid,
        id:this.merchantId,//商户id
        isDetail:1,//商户详情
      }
      this.$request('scenic/user/merchant/findDetailInfo',data).then((res)=>{
        if(res.code=='00'){
          this.detailData=res.data
潘永坪's avatar
潘永坪 committed
259 260 261 262
          //解决详情里面图片太宽超出屏幕宽度出现滚动条的问题
          if(this.detailData.introduce){
					  this.detailData.introduce=this.detailData.introduce.replace(/\<img/gi, '<img style="max-width:100%;height:auto;"')
          }
263 264 265 266 267 268 269 270 271 272 273 274
          if(this.detailData.tag){
            this.tagArr=this.detailData.tag.split(',')
          }
          let start=''
          let end=''
          if(this.detailData.businessStart){
            start=parseInt(this.$commonjs.changeTime(this.detailData.businessStart.substr(0,5)))
          }
          if(this.detailData.businessEnd){
            end=parseInt(this.$commonjs.changeTime(this.detailData.businessEnd.substr(0,5)))
          }
          if(start<this.nowTime<end){
潘永坪's avatar
潘永坪 committed
275
            this.tagStatus='开园中'
276
          }else{
潘永坪's avatar
潘永坪 committed
277
            this.tagStatus='闭园中'
278 279 280 281 282 283 284 285 286
          }
        }else{
          uni.showToast({
            title: res.message,
            icon: 'none'
          })
        }
    
      })
287 288 289 290 291
    },
  }
}
</script>

292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436
<style scoped lang="scss">
.middle{
	position: relative;
	top: -40rpx;
}
.middle-introduce{
	background: #FFFFFF;
	padding: 30rpx 20rpx 0 20rpx;
	border-radius: 24rpx 24rpx 0 0;
}
.introduce-one{
	border-bottom: 1px solid #e5e5e5;
	padding-bottom: 20rpx;
}
.merchantname{
	font-size:30rpx;
	font-weight: bold;
}
.businesstime{
	display: flex;
	justify-content: space-between;
	margin-top: 10rpx;
}
.introduce-two{
	border-bottom: 1px solid #e5e5e5;
	padding: 20rpx 0;
	font-size: 24rpx;
}
.introduce-two text:first-child{
	color:$red;
	font-weight: bold
}
.introduce-two text:first-child::after{
	display: inline-block;
	width: 2rpx;
	height: 20rpx;
	background: #999999;
	content: '';
	margin: 0 10rpx;
}
.introduce-two text:last-child{
	color:#999999;
}
.introduce-three{
	display: flex;
	justify-content: space-between;
	padding: 20rpx 0;
	color: #666666;
	font-size: 24rpx;
	align-items: center;
}
.introduce-icon{
	display: flex;
	align-items: center;
}
.introduce-icon text{
	display: inline-block;
	margin: 0 12rpx;
	width: 1px;
	background: #e5e5e5;
	height: 30rpx;
}
.middle-list{
	background: #FFFFFF;
	margin-top: 20rpx;
}
.middle-product{
	background: #FFFFFF;
	margin-top: 20rpx;
}
.product-title{
	padding: 24rpx 20rpx;
	font-size:30rpx;
	font-weight: bold;
	border-bottom: 1rpx solid #e6e6e6;
}
.title-tag{
	font-size: 24rpx;
	color: #999;
	font-weight: 400;
	margin-top: 10rpx;
}
.title-tag>text:first-child{
	color: #f9690e;
}
.tag-line{
	color: #e5e5e5;
	margin: 0 10rpx;
}
.product-list{
	display: flex;
	padding: 30rpx 20rpx;
	border-bottom: 1rpx solid #e6e6e6;
	align-items: center;
	position: relative;
}
.sellout{
	position: absolute;
	left: 0;
	top: 0;
	right: 0;
	bottom: 0;
	z-index: 1;
	background: rgba(0, 0, 0, 0.1);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 32rpx;
	color: $red;
	font-weight: bold;
}
.list-left{
	flex: 1;
	padding-right: 20rpx;
}
.list-buyknow{
	display: flex;
	margin-top:25rpx;
	align-items: center;
	width: 160rpx;
}
.list-right{
	text-align: right;
}
.small-price{
	font-size: 24rpx;
	color: $grey;
	text-decoration: line-through;
}
.big-price{
	font-size: 32rpx;
	color: $red;
	font-weight: bold;
	margin-left: 10rpx;
}
.btn{
	width: 120rpx;
	height: 60rpx;
	line-height: 60rpx;
}
.nomore{
	padding: 30rpx;
	text-align: center;
	color: $red;
}
437
</style>