Commit dde8bd22 authored by 潘永坪's avatar 潘永坪

单产品下单bug处理

parent e93cc300
...@@ -8,7 +8,7 @@ import commonjs from 'common/common.js' ...@@ -8,7 +8,7 @@ import commonjs from 'common/common.js'
Vue.prototype.$commonjs = commonjs Vue.prototype.$commonjs = commonjs
Vue.prototype.$request = request Vue.prototype.$request = request
Vue.prototype.$wxurl = 'https://lx.pangdly.com/#/' Vue.prototype.$wxurl = 'https://wx.pangdly.com/#/'
Vue.prototype.imageError ='@/static/img/common/pangdingLogo.png' Vue.prototype.imageError ='@/static/img/common/pangdingLogo.png'
Vue.use(uView) Vue.use(uView)
uni.$u.config.unit = 'rpx' uni.$u.config.unit = 'rpx'
......
...@@ -331,15 +331,15 @@ ...@@ -331,15 +331,15 @@
"navigationBarTextStyle": "black" "navigationBarTextStyle": "black"
} }
}, },
{ // {
"path": "vlogface/vlogface", // "path": "vlogface/vlogface",
"style": { // "style": {
"navigationBarTitleText": "扫脸获取视频", // "navigationBarTitleText": "扫脸获取视频",
"enablePullDownRefresh": false, // "enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#ffffff", // "navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black" // "navigationBarTextStyle": "black"
} // }
}, // },
{ {
"path": "scenicList/scenicList", "path": "scenicList/scenicList",
"style": { "style": {
......
<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 channelId=this.getUrlKey('channelId')
let companyId=this.getUrlKey('companyId')
let merchantId=this.getUrlKey('merchantId')
let groupId=this.getUrlKey('groupId')
let groupChannelId=this.getUrlKey('groupChannelId')
let pageType=this.getUrlKey('pageType')
let pdOpenid=uni.getStorageSync('openid')//胖丁小程序openid,临时用,当公众号授权做好之后可以删除
let pdToken=uni.getStorageSync('token')
let pdCreateUserId=uni.getStorageSync('createUserId')
let pdUserId=uni.getStorageSync('userId')
let pageCode=this.getUrlKey('pageCode')//赠送优惠券接口参数
if(pageType==1){//组合
this.outUrl=this.$wxurl+'combiChoose?channelId='+channelId+'&merchantId='+merchantId+'&groupId='+groupId+'&groupChannelId='+groupChannelId+'&companyId='+companyId+'&pdOpenid='+pdOpenid+'&pdToken='+pdToken+'&pdCreateUserId='+pdCreateUserId+'&pdUserId='+pdUserId
}else{//分销
uni.navigateTo({
url:'../distributionCombiChoose/distributionCombiChoose?channelId='+channelId+'&merchantId='+merchantId+'&groupId='+groupId+'&groupChannelId='+groupChannelId+'&companyId='+companyId+'&pageCode'+pageCode
})
}
}else{//小程序页面跳转进入
let channelId=option.channelId||''
let companyId=option.companyId||''
let merchantId=option.merchantId||''
let groupId=option.groupId||''
let groupChannelId=option.groupChannelId||''
let thirdOpenid=option.thirdOpenid||''//第三方openid
let touristType=option.touristType||''//游客类型
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+'combiChoose?thirdOpenid='+thirdOpenid+'&touristType='+touristType
this.outUrl=baseUrl+'&channelId='+channelId+'&merchantId='+merchantId+'&groupId='+groupId+'&groupChannelId='+groupChannelId+'&companyId='+companyId+'&pdOpenid='+pdOpenid+'&pdToken='+pdToken+'&pdCreateUserId='+pdCreateUserId+'&pdUserId='+pdUserId
}
},
methods: {
getUrlKey(name){//---------------------------------------------------------------获取url
return(new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(decodeURIComponent(this.enterUrl)) || [, ''])[1].replace(/\+/g, '%20') || ''
},
}
}
</script>
<style>
</style>
<template> <template>
<view> <view>
<web-view :src="outUrl"></web-view>
</view> </view>
</template> </template>
...@@ -8,60 +8,19 @@ ...@@ -8,60 +8,19 @@
export default { export default {
data() { data() {
return { return {
enterUrl:'',//进入页面路由
outUrl:'',//跳出页面路由
} }
}, },
onLoad(option) { onLoad(option) {
//#ifdef MP-WEIXIN //由于之前配置了这个页面,暂时进入页面直接跳转页面
this.enterUrl=option.q let merchantId=this.$commonjs.getKey(option,'merchantId')||''
//#endif let channelType=this.$commonjs.getKey(option,'channelType')||0
//#ifdef MP-ALIPAY
this.enterUrl=uni.getStorageSync('alipayQrCode')
//#endif
if(this.enterUrl){//普通二维码扫码进入
let channelId=this.getUrlKey('channelId')
let companyId=this.getUrlKey('companyId')
let merchantId=this.getUrlKey('merchantId')
let groupId=this.getUrlKey('groupId')
let groupChannelId=this.getUrlKey('groupChannelId')
let pageType=this.getUrlKey('pageType')
let pdOpenid=uni.getStorageSync('openid')//胖丁小程序openid,临时用,当公众号授权做好之后可以删除
let pdToken=uni.getStorageSync('token')
let pdCreateUserId=uni.getStorageSync('createUserId')
let pdUserId=uni.getStorageSync('userId')
let pageCode=this.getUrlKey('pageCode')//赠送优惠券接口参数
if(pageType==1){//组合
this.outUrl=this.$wxurl+'combiChoose?channelId='+channelId+'&merchantId='+merchantId+'&groupId='+groupId+'&groupChannelId='+groupChannelId+'&companyId='+companyId+'&pdOpenid='+pdOpenid+'&pdToken='+pdToken+'&pdCreateUserId='+pdCreateUserId+'&pdUserId='+pdUserId
}else{//分销
uni.navigateTo({ uni.navigateTo({
url:'../distributionCombiChoose/distributionCombiChoose?channelId='+channelId+'&merchantId='+merchantId+'&groupId='+groupId+'&groupChannelId='+groupChannelId+'&companyId='+companyId+'&pageCode'+pageCode url:`/pages/combination/distributionCombiChoose/distributionCombiChoose?merchantId=${merchantId}&channelType=${channelType}`
}) })
}
}else{//小程序页面跳转进入
let channelId=option.channelId||''
let companyId=option.companyId||''
let merchantId=option.merchantId||''
let groupId=option.groupId||''
let groupChannelId=option.groupChannelId||''
let thirdOpenid=option.thirdOpenid||''//第三方openid
let touristType=option.touristType||''//游客类型
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+'combiChoose?thirdOpenid='+thirdOpenid+'&touristType='+touristType
this.outUrl=baseUrl+'&channelId='+channelId+'&merchantId='+merchantId+'&groupId='+groupId+'&groupChannelId='+groupChannelId+'&companyId='+companyId+'&pdOpenid='+pdOpenid+'&pdToken='+pdToken+'&pdCreateUserId='+pdCreateUserId+'&pdUserId='+pdUserId
}
}, },
methods: { methods: {
getUrlKey(name){//---------------------------------------------------------------获取url
return(new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(decodeURIComponent(this.enterUrl)) || [, ''])[1].replace(/\+/g, '%20') || ''
},
} }
} }
</script> </script>
......
<template>
<!-- 详情 -->
<u-popup :show="showPop" :round="20" @close="showPop = false">
<view class="son-wrap">
<view class="title">
<view style="flex: 1; text-align: center">
明细
</view>
<u-icon name="close" @click="showPop = false"></u-icon>
</view>
<view style="flex: 1;overflow-y: scroll;">
<view class="middle">
<view class="merchantlist" v-for="(item,index) in merchantList" :key="index">
<view class="merchant-title">
{{item.merchantName}}
</view>
<view class="productlist" v-for="(items,a) in item.productlist" :key='a'>
<text>
{{items.name}}
</text>
<text style="font-weight: bold;">
¥{{items.sellingPrice}}
</text>
</view>
</view>
</view>
<view class="bottom">
<view class="bottom-left">
合计:¥
<text style="font-weight: bold;font-size: 40rpx;">{{priceTotal}}</text>
</view>
<view class="bottom-right">
<text class="btn" @click="goFillorder()">
去预订
</text>
</view>
</view>
</view>
</view>
</u-popup>
</template>
<script>
export default {
props: ['chooseProduct'],
data() {
return {
showPop: false, //控制弹窗显示隐藏
priceTotal:0,//总价
merchantList:[],//商家列表
}
},
watch: {
//选中产品的数量变化
chooseProduct: {
handler(newValue, oldValue){
this.priceTotal=0
this.chooseProduct.forEach((item)=>{
this.priceTotal+=item.sellingPrice
})
this.priceTotal=parseFloat(this.priceTotal.toFixed(2))
this.merchantList=[]
this.chooseProduct.forEach(item=>{
if(!this.merchantList.find(item2=>item2.merchantId==item.merchantId)){
this.merchantList.push({
merchantName:item.merchantName,
merchantId:item.merchantId,
productlist:[]
})
}
})
//一级数组转化成二级数组
this.merchantList.forEach(item=>{
this.chooseProduct.forEach(item2=>{
if(item.merchantId==item2.merchantId){
item.productlist.push(item2)
}
})
})
},
deep:true,
immediate: false
},
},
methods: {
//---跳转填写订单页面
goFillorder(){
this.$parent.goFillorder()
}
}
}
</script>
<style scoped="scoped" lang="scss">
.son-wrap{
position: relative;
height:80vh;
display: flex;
flex-direction:column;
}
.title{
display: flex;
font-size: 32rpx;
font-weight: bold;
padding: 30rpx;
background: #fff;
border-radius: 20rpx 20rpx 0 0;
}
.middle {
padding:0 24rpx 100rpx 24rpx;
}
.merchantlist{
border-bottom:2rpx solid #ececec;
padding-bottom: 40rpx;
margin-top: 24rpx;
}
.merchant-title{
font-size: 36rpx;
font-weight: bold;
color: #191919;
}
.productlist{
display: flex;
justify-content: space-between;
font-size: 32rpx;
margin-top: 20rpx;
}
.bottom {
display: flex;
justify-content: space-between;
padding: 0 24rpx;
height: 100rpx;
align-items: center;
position: fixed;
bottom: 0;
width: 100%;
z-index: 9;
background: #FFFFFF;
box-sizing: border-box;
}
.bottom-left{
color:$red;
font-size: 32rpx;
}
.btn{
font-size: 32rpx;
width: 200rpx;
}
</style>
<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 channelId=this.getUrlKey('channelId')
let companyId=this.getUrlKey('companyId')
let merchantId=this.getUrlKey('merchantId')
let groupId=this.getUrlKey('groupId')
let groupChannelId=this.getUrlKey('groupChannelId')
let pageType=this.getUrlKey('pageType')
let pdOpenid=uni.getStorageSync('openid')//胖丁小程序openid,临时用,当公众号授权做好之后可以删除
let pdToken=uni.getStorageSync('token')
let pdCreateUserId=uni.getStorageSync('createUserId')
let pdUserId=uni.getStorageSync('userId')
let pageCode=this.getUrlKey('pageCode')//赠送优惠券接口参数
if(pageType==1){//组合
uni.navigateTo({
url:'../combiChoose/combiChoose?channelId='+channelId+'&merchantId='+merchantId+'&groupId='+groupId+'&groupChannelId='+groupChannelId+'&companyId='+companyId
})
}else{//分销
this.outUrl=this.$wxurl+'distributionCombiChooseS?channelId='+channelId+'&merchantId='+merchantId+'&groupId='+groupId+'&groupChannelId='+groupChannelId+'&companyId='+companyId+'&pdOpenid='+pdOpenid+'&pdToken='+pdToken+'&pdCreateUserId='+pdCreateUserId+'&pdUserId='+pdUserId+'&pageCode'+pageCode
}
}else{//小程序页面跳转进入
let channelId=option.channelId||''
let companyId=option.companyId||''
let merchantId=option.merchantId||''
let groupId=option.groupId||''
let groupChannelId=option.groupChannelId||''
let thirdOpenid=option.thirdOpenid||''//第三方openid
let touristType=option.touristType||''//游客类型
let pageCode=option.pageCode||''//赠送优惠券接口参数
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+'distributionCombiChooseS?thirdOpenid='+thirdOpenid+'&touristType='+touristType
this.outUrl=baseUrl+'&channelId='+channelId+'&merchantId='+merchantId+'&groupId='+groupId+'&groupChannelId='+groupChannelId+'&companyId='+companyId+'&pdOpenid='+pdOpenid+'&pdToken='+pdToken+'&pdCreateUserId='+pdCreateUserId+'&pdUserId='+pdUserId+'&pageCode'+pageCode
}
},
methods: {
getUrlKey(name){//---------------------------------------------------------------获取url
return(new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(decodeURIComponent(this.enterUrl)) || [, ''])[1].replace(/\+/g, '%20') || ''
}
}
}
</script>
<style>
</style>
<template> <template>
<view class="wrap">
<scroll-view @scroll="scroll" style="height: 100%;" scroll-y>
<view class="banner">
<u-swiper :list="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 }}/{{ imgList.length }}</text>
</view>
</u-swiper>
</view>
<view class="middle">
<!-- <view class="tabbar" :style="tabbarObj">
<text v-for="(item, index) in tabbar" :key="index" @click="tabbarChange(index)" :class="{ on: active == index }">
{{ item }}
</text>
</view> -->
<swiper :current="active" @animationfinish="animationfinish" class="swiper-box" :style="{ height: swiperHeight + 'px' }">
<swiper-item class="swiper-item">
<checkbox-group @change="checkboxChange" class="checkbox-box">
<view class="merchant" v-for="(item, index) in scenicList" :key="index">
<view class="merchant-title" @click="clikDetail(item.id)">
<view class="title-left">
<text>{{ item.name }}</text>
<template v-if="item.couponVoList && item.couponVoList.length > 0">
<image src="@/static/img/scenic/coupon.png"></image>
<text class="title-coupon"> 劵惠 </text>
</template>
</view>
<view v-if="showDistance" class="title-right">
距您{{ item.distance ? parseFloat((item.distance / 1000).toFixed(2)) : 0 }}km
<u-icon name="arrow-right" style="margin-left: 4rpx;"></u-icon>
</view>
</view>
<label v-for="(items, a) in item.productListCopy" :key="a" :class="{ off: items.status == 2 }">
<view class="product" :class="{ on: items.ifChangeBg }">
<view class="product-left">
<checkbox
style="transform: scale(0.8)"
class="blue"
:disabled="items.status == 2"
:value="JSON.stringify(items)"
:checked="items.ifChecked"
/>
</view>
<view class="product-right">
<view class="product-name">
<text>{{ items.name }}</text>
<text class="product-status" v-if="items.status == 2">{{ items.statusName }}</text>
</view>
<view class="product-price">
<view style="font-size: 24rpx;display: flex;">
<text class="product-rule" v-if="items.productRefundRuleVo">
<text v-if="items.productRefundRuleVo.refundType == 0">不可退</text>
<text v-if="items.productRefundRuleVo.refundType == 1">规定时间退</text>
<text v-if="items.productRefundRuleVo.refundType == 2">随时可退</text>
</text>
<text class="product-rule"> 无需取票 </text>
<text @click.stop="showBuyKnow(items)">购买须知</text>
<u-icon name="arrow-right"></u-icon>
</view>
<view>
<text class="product-orange"> ¥{{ items.originalPrice }} </text>
<text class="product-sell"> <text style="font-size: 28rpx">¥</text>{{ items.sellingPrice }} </text>
</view>
</view>
</view>
</view>
</label>
<view class="product-more" v-if="index > 0 && item.productList.length > 2">
<view style="display: flex;justify-content: center;" v-if="item.productListCopy.length != item.productList.length" @click="showMoreProduct(item)">
更多
<u-icon name="arrow-down"></u-icon>
</view>
<view style="display: flex;justify-content: center;" v-else @click="retractProduct(item)">
收起
<u-icon name="arrow-up"></u-icon>
</view>
</view>
</view>
</checkbox-group>
<u-empty text="空空如也..." mode="list" v-if="scenicList.length == 0" width="320" height="320"></u-empty>
</swiper-item>
<swiper-item class="swiper-item">
<u-waterfall v-model="albumList" class="waterfall" style="padding-top: 8rpx;">
<template v-slot:left="{leftList}">
<view v-for="(item, index) in leftList" :key="index" class="album-left" @click="goAlbum(index)">
<view class="album-list-top">
<image :src="item.image" mode="widthFix"></image>
</view>
<view class="album-list-bottom" :style="{'background': item.color}">
<view>{{item.title}}</view>
<view>快来定制吧</view>
<view> <view>
<web-view :src="outUrl"></web-view> <view class="album-btn">
点击定制
<u-icon name="arrow-right" style="margin-left: 4rpx;"></u-icon>
</view>
<text class="count">{{item.count}}</text>
</view>
</view>
</view>
</template>
<template v-slot:right="{rightList}">
<view v-for="(item, index) in rightList" :key="index" class="album-right" @click="goAlbum(index)">
<view class="album-list-top">
<image :src="item.image" mode="widthFix"></image>
</view>
<view class="album-list-bottom" :style="{'background': item.color}">
<view>{{item.title}}</view>
<view>快来定制吧</view>
<view>
<view class="album-btn">
点击定制
<u-icon name="arrow-right" style="margin-left: 4rpx;"></u-icon>
</view>
<text class="count">{{item.count}}</text>
</view>
</view>
</view>
</template>
</u-waterfall>
</swiper-item>
<swiper-item class="swiper-item">
<u-empty text="空空如也..." mode="list" width="320" height="320"></u-empty>
</swiper-item>
<swiper-item class="swiper-item">
<u-empty text="空空如也..." mode="list" width="320" height="320"></u-empty>
</swiper-item>
</swiper>
</view>
<view class="bottom">
<view class="bottom-left" @click="showCustomer()">
<u-icon name="chat" size="36"></u-icon>
客服
</view>
<view class="bottom-middle">
<view class="bottom-more" v-show="chooseProduct.length > 0">
组合购更优惠
<text class="bottom-three"></text>
</view>
<view class="bottom-detail" @click="showDetail()" :style="{ top: chooseProduct.length > 0 ? '-28rpx' : '0' }">
<text style="margin-right: 10rpx;"> 明细 </text>
<u-icon name="arrow-up" size="32"></u-icon>
<text class="bottom-number">
{{ chooseProduct.length }}
</text>
</view>
</view>
<view class="bottom-right">
<text class="btn" @click="goFillorder()">去预定</text>
</view>
</view>
<!-- 客服组件 -->
<customer :scenicList="scenicList" ref="customer"></customer>
<!-- 购买须知 -->
<buyKnow :buyKnowData="buyKnowData" ref="buyKnow"></buyKnow>
<!-- 产品明细 -->
<detail :chooseProduct="chooseProduct" ref="detail"></detail>
<!-- 商户详情 -->
<merchantDetail :detailData='detailData' ref='merchantDetail'></merchantDetail>
<!-- 模态框 -->
<u-modal :show="showModal" @confirm="chooseConfirm" @cancel="chooseCancel" title="提示" content="该产品不支持多选" show-cancel-button="true">
</u-modal>
</scroll-view>
</view> </view>
</template> </template>
<script> <script>
import customer from '@/components/customer.vue' //客服
import buyKnow from '@/components/buyKnow.vue' //购买须知
import detail from './components/detail.vue' //购买须知
import UWaterfall from '@/uview-ui/components/u-waterfall/u-waterfall.vue'
import merchantDetail from '@/components/merchantDetail' //详情弹窗
export default { export default {
components: {
customer,
buyKnow,
detail,
UWaterfall,
merchantDetail
},
data() { data() {
return { return {
enterUrl:'',//进入页面路由 detailData:'',//详情数据
outUrl:'',//跳出页面路由 companyId:'',//公司Id
merchantId: '', //商户Id
// tabbar:['热门景点','一日游','摄影/旅拍','文创DIY'],//tabbar标题列表
tabbar: ['热门景点', '摄影/旅拍', '一日游'], //tabbar标题列表
active: 0, //导航栏下标
currentNum:0,//轮播图下标
imgList: [], //图片列表
scenicList: [], //景区数据
showDistance: false, //定位成功显示距离
buyKnowData: '', //购买须知数据
chooseProduct: [], //选中的产品
showModal: false, //是否显示模态框
chooseMerchantProduct: '', //不支持多产品购买时,选中的景区产品
groupId: '', //组合Id
groupChannelId: '', //组合渠道Id
channelType: 0, //渠道类型
swiperHeight: 0 ,//swiper高度
tabbarObj:'',
albumList: [{
title: '精彩瞬间',
count: '10W+',
image: '../static/scenic/wonderfulMoment.png',
color: '#037EFF'
},
{
title: '网红旅拍',
count: '8W+',
image: '../static/scenic/travalphoto.png',
color: '#826847'
},
{
title: '抱枕DIY',
count: '4W+',
image: '../static/scenic/pillow.png',
color: '#1175B4'
},
{
title: '明信片',
count: '4W+',
image: '../static/scenic/postcard.png',
color: '#3478DC'
},
{
title: '旅游台历定制',
count: '4W+',
image: '../static/scenic/deskCalender.png',
color: '#1A9B45'
},
{
title: '定制相册',
count: '4W+',
image: '../static/scenic/customPic.png',
color: '#D48D46'
}
],
}
},
watch: {
//选中产品的数量变化
chooseProduct: {
handler(newValue, oldValue) {
//当选中产品时
if (newValue.length > oldValue.length) {
//找到当前选中的产品
let product = newValue[newValue.length - 1]
//商家一级
let merchant = ''
//通过产品一级找到商家一级
this.scenicList.forEach(item => {
if (item.id == product.merchantId) {
merchant = item
}
})
//当选中产品的景区有2个以上选中产品时
let number = 0
this.chooseProduct.forEach(item => {
if (merchant.id == item.merchantId) {
number += 1
}
})
if (product.isMoreBuy !== 0) {
if (number > 1) {
//显示确认弹窗
this.showModal = true
//当前选中的景区产品,用于确定以及取消方法取值
this.chooseMerchantProduct = product
}
} else {
//支持多产品购买时,删除该景区其他产品不支持多产品购买的产品
this.chooseProduct.forEach((item, index) => {
if (merchant.id == item.merchantId && item.isMoreBuy !== 0) {
//取消选中状态和选中背景颜色
this.scenicList.forEach(item2 => {
item2.productList.forEach(item3 => {
if (item.id == item3.id) {
item3.ifChecked = false
item3.ifChangeBg = false
}
})
})
delete this.chooseProduct[index]
}
})
this.chooseProduct = this.chooseProduct.filter(function (val) {
return val
})
}
}
},
deep: true,
immediate: false
} }
}, },
onLoad(option) { onLoad(option) {
//#ifdef MP-WEIXIN //获取公司Id,保存到本地,支付等逻辑需要入口companyId
this.enterUrl=option.q this.companyId=this.$commonjs.getCompanyId(option)
//#endif this.merchantId = this.$commonjs.getKey(option,'merchantId')|| ''
this.channelType = this.$commonjs.getKey(option,'channelType')|| 0
//#ifdef MP-ALIPAY },
this.enterUrl=uni.getStorageSync('alipayQrCode') onShow() {
//#endif //清空之前选中的数据
this.detailData=''
if(this.enterUrl){//普通二维码扫码进入 this.chooseProduct=[]
let channelId=this.getUrlKey('channelId') let token = uni.getStorageSync('token')
let companyId=this.getUrlKey('companyId') if (token) {
let merchantId=this.getUrlKey('merchantId') uni.getLocation({
let groupId=this.getUrlKey('groupId') type: 'wgs84',
let groupChannelId=this.getUrlKey('groupChannelId') success: res => {
let pageType=this.getUrlKey('pageType') let latitude = res.latitude //纬度
let pdOpenid=uni.getStorageSync('openid')//胖丁小程序openid,临时用,当公众号授权做好之后可以删除 let longitude = res.longitude //经度
let pdToken=uni.getStorageSync('token') this.showDistance = true
let pdCreateUserId=uni.getStorageSync('createUserId') this.initList(latitude, longitude)
let pdUserId=uni.getStorageSync('userId') },
let pageCode=this.getUrlKey('pageCode')//赠送优惠券接口参数 fail: res => {
if(pageType==1){//组合 let latitude = ''
let longitude = ''
this.initList(latitude, longitude)
}
})
}
},
methods: {
//---页面滚动事件
scroll(e) {
if(e.detail.scrollTop>200){
//固定导航栏
this.tabbarObj='top:0;position:fixed;border-radius:0'
}else{
this.tabbarObj='top:-40rpx;position:relative;border-radius:16rpx;'
}
},
//---导航栏切换
tabbarChange(index) {
this.active = index
if(index==0){
this.countSwiper()
}
if(index==1){
this.countSwiper('waterfall')
}
},
//---swiper滑动结束,分别设置tabs和swiper的状态
animationfinish(e) {
let current = e.detail.current
this.active = current
},
//---展示客服组件
showCustomer() {
this.$refs.customer.showPop = true
},
//---展示购买须知
showBuyKnow(data) {
this.buyKnowData = data
this.$refs.buyKnow.showPop = true
},
//---点击详情
clikDetail(merchantId){
this.$refs.merchantDetail.showPop=true
this.initDetail(merchantId)
},
//---初始化详情
initDetail(merchantId){
let data={
userId:uni.getStorageSync('userId')||'',
openid:uni.getStorageSync('openid')||'',
id:merchantId,//商户id
isDetail:1,//商户详情
}
this.detailData=''
this.$request('scenic/user/merchant/findDetailInfo',data).then((res)=>{
if(res.code=='00'){
this.detailData=res.data
}else{
uni.showToast({
title: res.message,
icon: 'none'
})
}
})
},
//---展示明细弹窗
showDetail() {
this.$refs.detail.showPop = true
},
//计算第一个swiper高度
countSwiper(label){
let labels=label||'checkbox-box'
this.$nextTick(() => {
const query = uni.createSelectorQuery().in(this)
query.select(`.${labels}`).boundingClientRect(data => {
this.swiperHeight=data.height
}).exec()
})
},
//---展示更多产品
showMoreProduct(item) {
item.productListCopy = item.productList
this.$forceUpdate()
this.countSwiper()
},
//---收起产品
retractProduct(item) {
item.productListCopy = item.productList.slice(0, 2)
this.$forceUpdate()
this.countSwiper()
},
//---多选框变化
checkboxChange(e) {
let value = e.detail.value
let arr = []
value.forEach(item => {
arr.push(JSON.parse(item))
})
this.chooseProduct = arr
//判断是否选中产品,选中产品的背景颜色需要变化
this.scenicList.forEach(item => {
item.productList.forEach(item2 => {
item2.ifChangeBg = false
this.chooseProduct.forEach(item3 => {
if (item2.id == item3.id) {
item2.ifChangeBg = true
//解决是否支持多产品购买弹窗2次之后,选中状态错误bug,需要在选中时修改状态
item2.ifChecked = true
}
})
})
})
},
//---不支持多选产品,选择确定事件
chooseConfirm() {
this.chooseProduct.forEach((item, index) => {
//删除选中产品以外的其他所有产品
if (this.chooseMerchantProduct.merchantId == item.merchantId && JSON.stringify(item) != JSON.stringify(this.chooseMerchantProduct)) {
//取消选中状态和选中背景颜色
this.scenicList.forEach(item2 => {
item2.productList.forEach(item3 => {
if (item.id == item3.id) {
item3.ifChecked = false
item3.ifChangeBg = false
}
})
})
delete this.chooseProduct[index]
}
})
this.chooseProduct = this.chooseProduct.filter(function (val) {
return val
})
this.showModal = false
},
//---不支持多选产品,选择取消事件
chooseCancel() {
//删除选中产品
this.chooseProduct.forEach((item, index) => {
if (item.id === this.chooseMerchantProduct.id) {
//取消选中状态和选中背景颜色
this.scenicList.forEach(item2 => {
item2.productList.forEach(item3 => {
if (item.id == item3.id) {
item3.ifChecked = false
item3.ifChangeBg = false
}
})
})
this.chooseProduct.splice(index, 1)
}
})
this.showModal = false
},
//---商品列表
initList(latitude, longitude) {
let data = {
merchantId: this.merchantId, //商户id
openid: uni.getStorageSync('openid') || '',
channelType: this.channelType, //渠道类型
latitude,
longitude
}
uni.showLoading({
title: '加载中'
})
this.$request('/scenic/groupGood/getGroupProducts', data)
.then(res => {
uni.hideLoading()
if (res.code == '00') {
this.scenicList = res.data.merchantList || []
this.groupId = res.data.groupId || ''
this.groupChannelId = res.data.groupChannelId || ''
this.scenicList.forEach((item, index) => {
//获取当前景区图片,把当前景区放在第一位
if (item.id == this.merchantId) {
this.imgList = item.imgList
this.scenicList.splice(index, 1)
this.scenicList.unshift(item)
item.productListCopy = item.productList
} else {
item.productListCopy = item.productList.slice(0, 2)
}
//预订时间为当天时,当前时间大于最早预订时间显示未开售,当前时间大于最晚预订时间显示已售罄
let times = new Date().Format('hh:mm:ss')
let timeNumber = parseInt(this.$commonjs.changeTime(times)) //将当前时间转化为数字
item.productList.forEach(item2 => {
item2.timeNumber1 = parseInt(this.$commonjs.changeTime(item2.earlyBookTime))
item2.timeNumber2 = parseInt(this.$commonjs.changeTime(item2.bookTime))
if (item2.aheadBookDays == 0) {
if (item2.status == 2) {
item2.statusName = '已售罄'
} else {
if (timeNumber < item2.timeNumber1) {
item2.status = 2
item2.statusName = '未开售'
}
if (timeNumber > item2.timeNumber2) {
item2.status = 2
item2.statusName = '已售罄'
}
}
}
})
})
this.$nextTick(() => {
this.countSwiper()
})
} else {
uni.showToast({
title: res.message,
icon: 'none'
})
}
})
.catch(err => {
uni.hideLoading()
})
},
//---跳转填写订单页面
goFillorder() {
for (let i = 0; i < this.chooseProduct.length; i++) {
let item = this.chooseProduct[i]
if (item.status == 2) {
uni.showToast({
title: '售罄产品不能进行购买',
icon: 'none'
})
return
}
}
if (this.chooseProduct.length == 0) {
uni.showToast({
title: '请选择至少一个产品',
icon: 'none'
})
return
} else if (this.chooseProduct.length == 1) {
let query = '?merchantId=' + this.chooseProduct[0].merchantId + '&productId=' + this.chooseProduct[0].id + '&orderSource=3'
if (this.chooseProduct[0].ticketType == 2) {
//联票
uni.navigateTo({ uni.navigateTo({
url:'../combiChoose/combiChoose?channelId='+channelId+'&merchantId='+merchantId+'&groupId='+groupId+'&groupChannelId='+groupChannelId+'&companyId='+companyId url: '/pages/scenic/scenicJointOrder/scenicJointOrder' + query
})
} else {
//普通票
uni.navigateTo({
url: '/pages/scenic/scenicOrder/scenicOrder'+ query
}) })
}else{//分销
this.outUrl=this.$wxurl+'distributionCombiChooseS?channelId='+channelId+'&merchantId='+merchantId+'&groupId='+groupId+'&groupChannelId='+groupChannelId+'&companyId='+companyId+'&pdOpenid='+pdOpenid+'&pdToken='+pdToken+'&pdCreateUserId='+pdCreateUserId+'&pdUserId='+pdUserId+'&pageCode'+pageCode
} }
}else{//小程序页面跳转进入 } else {
let channelId=option.channelId||'' let productIdList = this.chooseProduct.map(item => {
let companyId=option.companyId||'' return item.id
let merchantId=option.merchantId||'' })
let groupId=option.groupId||'' let query ='?productIdList=' + JSON.stringify(productIdList) + '&groupId=' + this.groupId + '&groupChannelId=' + this.groupChannelId + '&orderSource=3'
let groupChannelId=option.groupChannelId||'' uni.navigateTo({
let thirdOpenid=option.thirdOpenid||''//第三方openid url: '/pages/combination/combiOrder/combiOrder' + query
let touristType=option.touristType||''//游客类型 })
let pageCode=option.pageCode||''//赠送优惠券接口参数
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+'distributionCombiChooseS?thirdOpenid='+thirdOpenid+'&touristType='+touristType
this.outUrl=baseUrl+'&channelId='+channelId+'&merchantId='+merchantId+'&groupId='+groupId+'&groupChannelId='+groupChannelId+'&companyId='+companyId+'&pdOpenid='+pdOpenid+'&pdToken='+pdToken+'&pdCreateUserId='+pdCreateUserId+'&pdUserId='+pdUserId+'&pageCode'+pageCode
} }
}, },
methods: { //---跳转影集页面
getUrlKey(name){//---------------------------------------------------------------获取url goAlbum(index){
return(new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(decodeURIComponent(this.enterUrl)) || [, ''])[1].replace(/\+/g, '%20') || '' if(index==0){
let data={
openid: uni.getStorageSync('openid')||''
}
this.$request('wechatUser/pdFace/checkScanFace',data).then(res => {
if (res.code === '00') {
let merchantId = this.merchantId || 'z0015605022691a5945bbe463141668c' // 默认长江索道
if (res.data.isScanFace == 0) { //未扫脸
uni.navigateTo({
url:`/pages/album/getPortrait?merchantId=${merchantId}`
})
} else if (res.data.isScanFace == 1) { //已扫脸
let faceIds = JSON.stringify(res.data.faceIds)
let companyId = this.companyId
uni.navigateTo({
url: `/pages/album/myPhotoAlbum/myPhotoAlbum?faceIds=${faceIds}&companyId=${companyId}&merchantId${merchantId}`
})
} }
} else {
uni.showToast({
title: res.message,
icon: 'none'
})
}
})
}
},
} }
} }
</script> </script>
<style> <style lang="scss" scoped>
.wrap {
height: 100%;
display: flex;
flex-direction: column;
background: #fff;
}
.middle {
padding: 0 24rpx 100rpx 24rpx;
display: flex;
flex-direction: column;
// flex: 1;
background: #f7f7f7;
}
.swiper-box {
// flex: 1;
position: relative;
top: -40rpx;
}
.tabbar {
transition:1s;
width: 100%;
left: 0;
z-index: 1;
position: relative;
top: -40rpx;
background: #fff;
box-shadow: 0px 0px 8px 2px rgba(0, 0, 0, 0.08);
border-radius: 16rpx;
display: flex;
justify-content: space-between;
font-size: 32rpx;
text {
padding: 24rpx 32rpx 24rpx 20rpx;
border-radius: 16rpx;
width: 33.3%;
text-align: center;
}
}
.tabbar .on {
// background: url('../../../static/img/scenic/tabbar.png') no-repeat;
background: $theme;
background-size: 100% 100%;
color: #fff;
font-weight: bold;
}
.merchant {
border-radius: 16rpx;
background: #ffffff;
margin-top: 24rpx;
padding: 24rpx;
}
.merchant label.off .product {
background: #f3f3f3;
color: #999999;
}
.merchant label.off .product-name {
color: #999999;
}
.merchant label.off .product-rule {
color: #999999;
}
.merchant-title {
display: flex;
justify-content: space-between;
align-items: center;
padding-bottom: 16rpx;
}
.title-left {
font-size: 32rpx;
margin-right: 10rpx;
font-weight: bold;
image {
width: 36rpx;
height: 36rpx;
position: relative;
top: 6rpx;
margin: 0 8rpx;
}
}
.title-coupon {
color: $red;
font-size: 24rpx;
}
.title-right {
color: $grey;
font-size: 24rpx;
display: flex;
}
.product {
padding: 10rpx 16rpx;
background: #ffffff;
border-radius: 8rpx;
display: flex;
align-items: center;
margin-top: 10rpx;
}
.product.on {
background: #e2eeff;
}
.product-left {
margin-right: 10rpx;
}
.product-right {
flex: 1;
}
.product-name {
font-size: 28rpx;
font-weight: bold;
color: #191919;
display: flex;
justify-content: space-between;
}
.product-status {
padding: 6rpx 12rpx;
border: 2px solid #f40000;
background: #ffffff;
color: #f40000;
font-size: 24rpx;
border-radius: 4rpx;
transform: rotate(-25deg);
position: relative;
top: 30rpx;
right: 80rpx;
}
.product-price {
display: flex;
justify-content: space-between;
align-items: center;
}
.product-rule {
color: $theme;
}
.product-rule::after {
display: inline-block;
content: '';
height: 22rpx;
margin: 0 10rpx;
background: #ccc;
width: 1px;
}
.product-orange {
font-size: 20rpx;
color: $grey;
text-decoration: line-through;
}
.product-sell {
font-size: 40rpx;
color: $red;
font-weight: bold;
margin-left: 10rpx;
}
.product-more {
padding: 10rpx;
text-align: center;
}
.bottom {
position: fixed;
bottom: 0;
width: 100%;
height: 100rpx;
background: #fff;
box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.16);
z-index: 10;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 32rpx;
}
.bottom-left{
display: flex;
flex-direction: column;
align-items: center;
}
.bottom-middle {
position: relative;
padding: 0 40rpx;
}
.bottom-more {
position: relative;
top: -40rpx;
background: #f40000;
border-radius: 28px;
opacity: 0.64;
padding: 10rpx 20rpx;
color: #ffffff;
}
.bottom-three {
width: 14rpx;
height: 14rpx;
display: inline-block;
background: #f40000;
opacity: 0.64;
position: absolute;
right: 42rpx;
bottom: -7rpx;
transform: rotate(45deg);
}
.bottom-detail {
position: relative;
text-align: center;
display: flex;
justify-content: center;
}
.bottom-number {
display: inline-block;
width: 36rpx;
height: 36rpx;
border-radius: 50%;
text-align: center;
background: #f40000;
color: #ffffff;
font-weight: bold;
margin-left: 10rpx;
}
.btn {
font-size: 32rpx;
width: 200rpx;
}
//摄影、旅拍
.album-left{
margin:8rpx 6rpx 0 0;
}
.album-right{
margin: 8rpx 0 0 6rpx;
}
.album-list-top image {
width: 100%;
}
.album-list-bottom{
border-radius: 0 0 16rpx 16rpx;
position: relative;
top: -4px;
padding: 20rpx 16rpx;
color: #fff;
view:first-child{
font-weight: bold;
}
view:nth-child(2){
font-size: 24rpx;
margin-top: 16rpx;
}
view:nth-child(3){
display: flex;
justify-content: space-between;
margin-top: 20rpx;
}
}
.album-btn{
display: flex;
width: 160rpx;
height: 44rpx;
background: #E1E1D9;
border-radius: 20rpx 20rpx 20rpx 20rpx;
font-size: 22rpx;
color: #333333;
align-items: center;
justify-content: center;
padding-left: 8rpx;
}
.swiper-item /deep/ .u-waterfall{
padding-top:8rpx;
}
.swiper-item /deep/ .u-empty{
height: 300px;
}
</style> </style>
...@@ -743,7 +743,7 @@ export default { ...@@ -743,7 +743,7 @@ export default {
}, },
//---展示日历---已修改 //---展示日历---已修改
showCalendar(index) { showCalendar(index) {
this.$refs.calendar.setDefaultDate(this.productList[index].chooseDate)//日历组件选中日期 this.$refs.calendar.defaultDate=this.productList[index].chooseDate//日历组件选中日期
this.moreDateIndex=index this.moreDateIndex=index
this.chooseDateList=this.productList[index].priceStockList this.chooseDateList=this.productList[index].priceStockList
this.$refs.calendar.showPop = true this.$refs.calendar.showPop = true
...@@ -755,7 +755,7 @@ export default { ...@@ -755,7 +755,7 @@ export default {
item.originalPrice=item2.originalPrice//产品原价为当前选中日期的原价 item.originalPrice=item2.originalPrice//产品原价为当前选中日期的原价
item.sellingPrice=item2.sellingPrice//产品卖价为当前选中日期的卖价 item.sellingPrice=item2.sellingPrice//产品卖价为当前选中日期的卖价
item.chooseDate=item2.startTime.substr(0,10) item.chooseDate=item2.startTime.substr(0,10)
this.$refs.calendar.setDefaultDate(item.chooseDate)//日历组件选中日期 this.$refs.calendar.defaultDate=item.chooseDate//日历组件选中日期
item.endDate=item2.endTime//开始日期 item.endDate=item2.endTime//开始日期
item.startDate=item2.startTime//结束日期 item.startDate=item2.startTime//结束日期
if(item.productType==3){ if(item.productType==3){
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
@confirm="onConfirm" @confirm="onConfirm"
@close="showPop=false" @close="showPop=false"
:maxDate="maxDate" :maxDate="maxDate"
:minDate='minDate'
:defaultDate="defaultDate" :defaultDate="defaultDate"
:formatter='formatter' :formatter='formatter'
ref="calendar2" ref="calendar2"
...@@ -21,6 +22,9 @@ export default { ...@@ -21,6 +22,9 @@ export default {
handler(newValue, oldValue){ handler(newValue, oldValue){
if(newValue&&newValue.length>0){ if(newValue&&newValue.length>0){
this.maxDate=newValue[newValue.length-1].startTime.substr(0,10) this.maxDate=newValue[newValue.length-1].startTime.substr(0,10)
//默认和最小日期都为第一天
this.minDate=newValue[0].startTime.substr(0,10)
this.defaultDate=newValue[0].startTime.substr(0,10)
} }
}, },
deep:true, deep:true,
...@@ -32,6 +36,7 @@ export default { ...@@ -32,6 +36,7 @@ export default {
showPop: false, //控制日历显示隐藏 showPop: false, //控制日历显示隐藏
defaultDate:'', //默认日期 defaultDate:'', //默认日期
maxDate:'',//最大日期 maxDate:'',//最大日期
minDate:'',//最小日期
} }
}, },
mounted() { mounted() {
...@@ -39,7 +44,8 @@ export default { ...@@ -39,7 +44,8 @@ export default {
}, },
methods: { methods: {
//---日期确认事件 //---日期确认事件
onConfirm(date) { onConfirm(date){
console.log(date)
this.showPop = false this.showPop = false
this.$emit('dateConfig', date[0]) this.$emit('dateConfig', date[0])
}, },
...@@ -67,11 +73,7 @@ export default { ...@@ -67,11 +73,7 @@ export default {
// } // }
return day return day
}, }
//---设置默认日期
setDefaultDate(val) {
this.defaultDate=val
},
} }
} }
</script> </script>
......
...@@ -591,11 +591,7 @@ export default { ...@@ -591,11 +591,7 @@ export default {
return return
} }
if (this.dateList.length == 1 && this.beforeBookDays == 0) { if (this.dateList.length == 1 && this.beforeBookDays == 0) {
//长度为1而且只能预订当天,默认选中第一个日期 //长度为1而且只能预订当天,默认选中
//真机模拟的时候手机端不显示今天,明天后天,延迟执行
setTimeout(item => {
this.$refs.calendar.defaultDate = this.dateList[0].startTime.substr(0, 10)
}, 1000)
this.maxBookNum = Math.min(this.dateList[0].surplus, this.productIfo.maxBookNum) //剩余量 this.maxBookNum = Math.min(this.dateList[0].surplus, this.productIfo.maxBookNum) //剩余量
this.startDate = this.dateList[0].startTime //开始日期 this.startDate = this.dateList[0].startTime //开始日期
this.endDate = this.dateList[0].endTime //结束日期 this.endDate = this.dateList[0].endTime //结束日期
......
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