Commit 3cbcf4c1 authored by 潘永坪's avatar 潘永坪

小程序优化

parent 0396f0b8
......@@ -70,10 +70,8 @@ export default {
})
},
onShow: function() {
},
onHide: function() {
}
}
</script>
......
......@@ -79,7 +79,6 @@
<text class="travel-left">
{{item.childTitle}}
</text>
<view class="travel-right">
<text v-for="(items,b) of item.contentList" :key="b">
{{items.content}}
......@@ -89,7 +88,6 @@
</view>
</view>
</view>
</view>
</u-popup>
</template>
......@@ -158,6 +156,8 @@ export default {
uni.openLocation({
latitude:this.detailData.latitude,
longitude:this.detailData.longitude,
name:this.detailData.name,
address:this.detailData.address,
success: function () {
}
......
......@@ -340,6 +340,10 @@ export default {
//清空之前选中的数据以及状态
this.detailData=''
this.chooseProduct=[]
if(this.$refs.merchantDetail){
//解决支付宝小程序报错问题
this.$refs.merchantDetail.showPop=false
}
if(this.$refs.detail){
//解决支付宝小程序报错问题
this.$refs.detail.showPop = false
......
<template>
<view>
<web-view :src="outUrl"></web-view>
</view>
</template>
<script>
export default {
data() {
return {
enterUrl:'',//进入页面路由
outUrl:'',//跳出页面路由
}
},
onLoad(option) {
//#ifdef MP-WEIXIN
this.enterUrl=option.q
//#endif
//#ifdef MP-ALIPAY
this.enterUrl=uni.getStorageSync('alipayQrCode')
//#endif
if(this.enterUrl){//普通二维码扫码进入
let merchantId=this.getUrlKey('merchantId')
let companyId=this.getUrlKey('companyId')
let channelType=this.getUrlKey('channelType')
let pdOpenid=uni.getStorageSync('openid')//胖丁小程序openid,临时用,当公众号授权做好之后可以删除
let pdToken=uni.getStorageSync('token')
let pdCreateUserId=uni.getStorageSync('createUserId')
let pdUserId=uni.getStorageSync('userId')
let baseUrl=this.$wxurl+'scenicProduct?pdOpenid='+pdOpenid+'&pdToken='+pdToken+'&pdCreateUserId='+pdCreateUserId+'&pdUserId='+pdUserId
let url='&merchantId='+merchantId+'&companyId='+companyId+'&channelType='+channelType
this.outUrl=baseUrl+url
}else{//小程序页面跳转进入
let merchantId=option.merchantId||''
let companyId=option.companyId||''
let channelType=option.channelType||0
let ifyukuaiCode=option.ifyukuaiCode||''//是否是渝快码跳入,渝快码跳入需要在H5端另外走流程
let pdOpenid=uni.getStorageSync('openid')//胖丁小程序openid,临时用,当公众号授权做好之后可以删除
let pdToken=uni.getStorageSync('token')
let pdCreateUserId=uni.getStorageSync('createUserId')
let pdUserId=uni.getStorageSync('userId')
let baseUrl=this.$wxurl+'scenicProduct?pdOpenid='+pdOpenid+'&pdToken='+pdToken+'&pdCreateUserId='+pdCreateUserId+'&pdUserId='+pdUserId
let url='&merchantId='+merchantId+'&companyId='+companyId+'&ifyukuaiCode='+ifyukuaiCode+'&channelType='+channelType
this.outUrl=baseUrl+url
}
},
methods: {
getUrlKey(name){//---------------------------------------------------------------获取url
return(new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(decodeURIComponent(this.enterUrl)) || [, ''])[1].replace(/\+/g, '%20') || ''
},
}
}
</script>
<style>
</style>
\ No newline at end of file
<template>
<view>
<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">
<view class="middle-introduce">
<view class="introduce-one">
<view class="merchantname">
重庆湖广会馆
</view>
<view class="businesstime">
<view style="font-size: 24rpx;">
<text style="color: #3688ff;margin-right: 20rpx;">开园中</text>
<text style="color: #999;">09:00~18:30</text>
</view>
<view style="display: flex;">
<text>详情</text>
<u-icon name='arrow-right'></u-icon>
</view>
</view>
</view>
<view class='introduce-two'>
<text>
5分
</text>
<text>
0条好评
</text>
</view>
<view class="introduce-three">
<view style="flex: 1;margin-right: 20rpx;">
重庆市市辖区渝中区联合国际大厦
</view>
<view class="introduce-icon">
<u-icon name='map-fill' color='#3688ff' size='44'></u-icon>
<text></text>
<u-icon name='phone-fill' color='#3688ff' size='44'></u-icon>
</view>
</view>
</view>
<view class="middle-list">
<view>
<view>
景区门票
</view>
<view>
<text>无需换票</text>
<text></text>
<text>随时可退</text>
</view>
</view>
<view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
ticketList:[],//门票列表
detailData:'',//详情数据
currentNum:0,//轮播图下标
}
},
onLoad(option) {
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()
},
methods: {
//---产品加载
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:uni.getStorageSync('openid')||'',
id:this.merchantId,//商户id
isDetail:1,//商户详情
}
this.$request('scenic/user/merchant/findDetailInfo',data).then((res)=>{
if(res.code=='00'){
this.detailData=res.data
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){
this.status='开园中'
}else{
this.status='闭园中'
}
}else{
uni.showToast({
title: res.message,
icon: 'none'
})
}
})
},
}
}
</script>
<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;
}
</style>
\ No newline at end of file
<template>
<view>
<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">
<view class="middle-introduce">
<view>
<view>
重庆湖广会馆
</view>
<view>
<view>
<text>开园中</text>
<text>09:00~18:30</text>
</view>
<view>
<text>详情</text>
<u-icon name='arrow-right'></u-icon>
</view>
</view>
</view>
<view>
</view>
<view>
</view>
</view>
<view class="middle-list">
</view>
</view>
<web-view :src="outUrl"></web-view>
</view>
</template>
......@@ -44,97 +8,53 @@
export default {
data() {
return {
ticketList:[],//门票列表
detailData:'',//详情数据
currentNum:0,//轮播图下标
enterUrl:'',//进入页面路由
outUrl:'',//跳出页面路由
}
},
onLoad(option) {
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()
},
methods: {
//---产品加载
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)
//#ifdef MP-WEIXIN
this.enterUrl=option.q
//#endif
//#ifdef MP-ALIPAY
this.enterUrl=uni.getStorageSync('alipayQrCode')
//#endif
if(this.enterUrl){//普通二维码扫码进入
let merchantId=this.getUrlKey('merchantId')
let companyId=this.getUrlKey('companyId')
let channelType=this.getUrlKey('channelType')
let pdOpenid=uni.getStorageSync('openid')//胖丁小程序openid,临时用,当公众号授权做好之后可以删除
let pdToken=uni.getStorageSync('token')
let pdCreateUserId=uni.getStorageSync('createUserId')
let pdUserId=uni.getStorageSync('userId')
let baseUrl=this.$wxurl+'scenicProduct?pdOpenid='+pdOpenid+'&pdToken='+pdToken+'&pdCreateUserId='+pdCreateUserId+'&pdUserId='+pdUserId
let url='&merchantId='+merchantId+'&companyId='+companyId+'&channelType='+channelType
this.outUrl=baseUrl+url
}else{//小程序页面跳转进入
let merchantId=option.merchantId||''
let companyId=option.companyId||''
let channelType=option.channelType||0
let ifyukuaiCode=option.ifyukuaiCode||''//是否是渝快码跳入,渝快码跳入需要在H5端另外走流程
let pdOpenid=uni.getStorageSync('openid')//胖丁小程序openid,临时用,当公众号授权做好之后可以删除
let pdToken=uni.getStorageSync('token')
let pdCreateUserId=uni.getStorageSync('createUserId')
let pdUserId=uni.getStorageSync('userId')
let baseUrl=this.$wxurl+'scenicProduct?pdOpenid='+pdOpenid+'&pdToken='+pdToken+'&pdCreateUserId='+pdCreateUserId+'&pdUserId='+pdUserId
let url='&merchantId='+merchantId+'&companyId='+companyId+'&ifyukuaiCode='+ifyukuaiCode+'&channelType='+channelType
this.outUrl=baseUrl+url
}
})
}else{
uni.showToast({
title: res.message,
icon: 'none'
})
}
})
},
//---详情加载
initDetail(){
let data={
userId:uni.getStorageSync('userId')||'',
openid:uni.getStorageSync('openid')||'',
id:this.merchantId,//商户id
isDetail:1,//商户详情
}
this.$request('scenic/user/merchant/findDetailInfo',data).then((res)=>{
if(res.code=='00'){
this.detailData=res.data
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){
this.status='开园中'
}else{
this.status='闭园中'
}
}else{
uni.showToast({
title: res.message,
icon: 'none'
})
}
})
methods: {
getUrlKey(name){//---------------------------------------------------------------获取url
return(new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(decodeURIComponent(this.enterUrl)) || [, ''])[1].replace(/\+/g, '%20') || ''
},
}
}
</script>
<style scoped lang="scss">
.middle{
position: relative;
top: -60rpx;
}
.middle-introduce{
background: #FFFFFF;
padding: 30rpx 20rpx 0 20rpx;
border-radius: 24rpx 24rpx 0 0;
}
<style>
</style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment