Commit 2fc01097 authored by 潘永坪's avatar 潘永坪

组合下单开发

parent ee1335c0
...@@ -11,21 +11,20 @@ ...@@ -11,21 +11,20 @@
</view> </view>
<view class="ticket-timer">游玩当日{{orderRefundRuleTimer}}之前未使用可退</view> <view class="ticket-timer">游玩当日{{orderRefundRuleTimer}}之前未使用可退</view>
</view> </view>
<view class="apply-user general-Box"> <!-- <view class="apply-user general-Box">
<view class="user-title"> <view class="user-title">
<view class="title-name">用户选择</view> <view class="title-name">用户选择</view>
<checkbox-group @change="checkedAll"> <u-checkbox @change="checkedAll" v-model="applyClickAll" >全选</u-checkbox>
<label>
<checkbox value="val" :checked="applyClickAll" style="transform:scale(0.7);" class="list-uCheck" :class="applyClickAll==true?'list-uCheckAct':''" />全选
</label>
</checkbox-group>
</view>
<checkbox-group @change="checkboxGroupChange" v-if="applyUserListType">
<label style="margin-right: 15rpx;margin-bottom: 15rpx;" v-for="(item,index) in applyUserList" :key="index">
<checkbox :value="item.id" :checked="item.checkType" style="transform:scale(0.7);" class="list-uCheck" :class="item.checkType==true?'list-uCheckAct':''" />{{item.name}}
</label>
</checkbox-group>
</view> </view>
<u-checkbox-group @change="checkboxGroupChange">
<u-checkbox
@change="checkboxChange"
v-model="item.checked"
v-for="(item, index) in applyUserList" :key="index"
:name="item.name"
>{{item.name}}</u-checkbox>
</u-checkbox-group>
</view> -->
<view class="apply-moneyBox general-Box"> <view class="apply-moneyBox general-Box">
<view class="moneyBox-list"> <view class="moneyBox-list">
<view class="list-name">订单实付</view> <view class="list-name">订单实付</view>
...@@ -33,7 +32,7 @@ ...@@ -33,7 +32,7 @@
</view> </view>
<view class="moneyBox-list"> <view class="moneyBox-list">
<view class="list-name">退款金额</view> <view class="list-name">退款金额</view>
<view class="list-money list-clolrOrange">{{orderInfo.unitPrice*refundNum}}</view> <view class="list-money list-clolrOrange">{{parseFloat(orderInfo.pdOrderMoney)-parseFloat(orderInfo.refundFee)}}</view>
</view> </view>
</view> </view>
<view class="apply-cause general-Box"> <view class="apply-cause general-Box">
...@@ -72,17 +71,15 @@ export default { ...@@ -72,17 +71,15 @@ export default {
merchantId:'',//景区ID merchantId:'',//景区ID
applyClickAll:false,//是否全选 applyClickAll:false,//是否全选
applyUserList:[ applyUserList:[
// { {
// name:'张三', name:'张三',
// checked:false, checked:false,
// }, },
// { {
// name:'李四', name:'李四',
// checked:false, checked:false,
// }, },
],//用户信息 ],//用户信息
applyUserListType:true,
refundNum:0,//选择多少人
causeList:[ causeList:[
{ {
name:'更改出行日期', name:'更改出行日期',
...@@ -119,7 +116,7 @@ export default { ...@@ -119,7 +116,7 @@ export default {
onLoad(option) { onLoad(option) {
this.id = option.orderId||'' this.id = option.orderId||''
this.openId = uni.getStorageSync('openid') //openid oroHZ5FaUQ_SOOC_uQQP92fJpBRE oh2UV1lyYABHMZ1rMlgjhVHyyYDQ this.openId = uni.getStorageSync('openid') //openid oroHZ5FaUQ_SOOC_uQQP92fJpBRE oh2UV1lyYABHMZ1rMlgjhVHyyYDQ
//this.openId = 'oh2UV1lyYABHMZ1rMlgjhVHyyYDQ'//oh2UV1lyYABHMZ1rMlgjhVHyyYDQ oroHZ5FaUQ_SOOC_uQQP92fJpBRE //this.openId = 'oroHZ5FaUQ_SOOC_uQQP92fJpBRE'//oh2UV1lyYABHMZ1rMlgjhVHyyYDQ oroHZ5FaUQ_SOOC_uQQP92fJpBRE
this.getDetail() this.getDetail()
}, },
methods: { methods: {
...@@ -156,22 +153,15 @@ export default { ...@@ -156,22 +153,15 @@ export default {
}) })
return false return false
} }
var orderTouristVoList = []
this.applyUserList.forEach((item)=>{
if(item.checkType==true){
orderTouristVoList.push(item)
}
})
var data = { var data = {
orderId:this.orderInfo.id, orderId:this.orderInfo.id,
userId:this.openId, userId:this.openId,
refundReason:this.reason, refundReason:this.reason,
refundNum:this.refundNum, refundNum:this.orderInfo.orderNum,
refundMoney:this.orderInfo.unitPrice*this.refundNum, refundMoney:parseFloat(this.orderInfo.pdOrderMoney)-parseFloat(this.orderInfo.depositReceived),
pdRefundMoney:this.orderInfo.unitPrice*this.refundNum, pdRefundMoney:parseFloat(this.orderInfo.pdOrderMoney),
refundType:0, refundType:0,
pdRefundFee:this.orderInfo.depositReceived, pdRefundFee:this.orderInfo.depositReceived,
orderTouristVoList:orderTouristVoList,
} }
this.$request('order/userOrder/refundTicket',data).then((res)=>{ this.$request('order/userOrder/refundTicket',data).then((res)=>{
if(res.code == '00'){ if(res.code == '00'){
...@@ -233,16 +223,6 @@ export default { ...@@ -233,16 +223,6 @@ export default {
if(this.getNowTime()>this.orderRefundRuleTimer){ if(this.getNowTime()>this.orderRefundRuleTimer){
this.orderRefundRuleTimerType = true this.orderRefundRuleTimerType = true
} }
this.orderInfo.orderTouristList.forEach((item)=>{
item['checkType']=false
})
this.applyUserList =[]
this.orderInfo.orderTouristList.forEach((item)=>{
if(item.visitorStatus==0||item.visitorStatus==4){
this.applyUserList.push(item)
}
})
}else{ }else{
uni.showToast({ uni.showToast({
title: res.message, title: res.message,
...@@ -255,35 +235,32 @@ export default { ...@@ -255,35 +235,32 @@ export default {
clickNewFun(labelNum){ clickNewFun(labelNum){
this.causeNum = labelNum this.causeNum = labelNum
}, },
checkboxGroupChange(e){//刷新显示 // // 选中某个复选框时,由checkbox时触发 可以获取当前选择值的所有信息
this.applyUserListType = false // checkboxChange(e) {
this.applyUserList.forEach((item)=>{ // // console.log(e)
item.checkType=false // },
e.detail.value.forEach(item2=>{ // // 选中任一checkbox时,由checkbox-group触发 已经选择了多少选项
if(item.id==item2){ // checkboxGroupChange(e) {
this.$set(item,'checkType',true) // // console.log(e)
} // if(this.applyUserList.length==e.length){
}) // this.applyClickAll = true
}) // }else{
this.refundNum = e.detail.value.length // this.applyClickAll =false
this.applyUserListType = true // }
}, // },
checkedAll(e){//全选 // // 全选
if(this.applyClickAll ==false){ // checkedAll(e) {
this.applyClickAll = true // console.log(e)
this.applyUserList.forEach((item)=>{ // if(e.value==true){
item.checkType=true // this.applyUserList.map(val => {
}) // val.checked = true
this.refundNum = this.applyUserList.length // })
}else{ // }else{
this.applyClickAll = false // this.applyUserList.map(val => {
this.applyUserList.forEach((item)=>{ // val.checked = false
item.checkType=false // })
}) // }
this.refundNum = 0 // },
}
},
getNowTime() {//获取当前时间(HH-MM-SS) getNowTime() {//获取当前时间(HH-MM-SS)
var date = new Date() var date = new Date()
var seperator1 = '-' var seperator1 = '-'
...@@ -384,14 +361,6 @@ export default { ...@@ -384,14 +361,6 @@ export default {
/deep/ .u-checkbox__label{ /deep/ .u-checkbox__label{
width: 160rpx; width: 160rpx;
} }
.list-uCheckAct{
/deep/ .wx-checkbox-input,
/deep/ .uni-checkbox-input{
background-color: #3688FF !important;
border-color: #3688FF !important;
color: #ffffff !important;
}
}
} }
.apply-moneyBox{ .apply-moneyBox{
padding: 0 24rpx 0 24rpx; padding: 0 24rpx 0 24rpx;
......
...@@ -4,22 +4,22 @@ ...@@ -4,22 +4,22 @@
<view class="middle"> <view class="middle">
<view class="middle-top"> <view class="middle-top">
<!-- --------------------------------------------产品信息部分------------------------------------- --> <!-- --------------------------------------------产品信息部分------------------------------------- -->
<view class="middle-Product" v-for="(item,Index) in productList" :key='item.id'> <view class="middle-Product">
<view class="merchantName"> <view class="merchantName">
<text class="title-text"> <text class="title-text">
{{ item.merchantName || '' }} {{ productIfo.merchantName || '' }}
</text> </text>
<text> <text>
{{ item.name || '' }} {{ productIfo.name || '' }}
</text> </text>
</view> </view>
<view @click="showBuyKnow()" class="buyKnow"> <view @click="showBuyKnow()" class="buyKnow">
<view> <view>
<text v-if="item.backChangeRule == 0">不可退换</text> <text v-if="productIfo.backChangeRule == 0">不可退换</text>
<text v-if="item.backChangeRule == 1">可退</text> <text v-if="productIfo.backChangeRule == 1">可退</text>
<text v-if="item.backChangeRule == 2">随时可退</text> <text v-if="productIfo.backChangeRule == 2">随时可退</text>
<text v-if="item.isFetch == 1">无需取号</text> <text v-if="productIfo.isFetch == 1">无需取号</text>
</view> </view>
<view> <view>
购买须知 购买须知
...@@ -28,11 +28,11 @@ ...@@ -28,11 +28,11 @@
</view> </view>
</view> </view>
<!--需要排队并且站点数大于1--> <!--需要排队并且站点数大于1-->
<view class="middle-place" @click="openArea()" v-if="item.isFetch == 1 && item.productAreaList.length > 1 && showOpenArea"> <view class="middle-place" @click="openArea()" v-if="productIfo.isFetch == 1 && productIfo.productAreaList.length > 1 && showOpenArea">
<view> 出发站点 </view> <view> 出发站点 </view>
<view> <view>
{{ item.areaObj.areaName || '请选择站点' }} {{ areaObj.areaName || '请选择站点' }}
</view> </view>
<view> <view>
...@@ -55,17 +55,17 @@ ...@@ -55,17 +55,17 @@
<view class="middle-Date"> <view class="middle-Date">
<view class="title-text">游玩日期</view> <view class="title-text">游玩日期</view>
<view class="middle-Datelist"> <view class="middle-Datelist">
<scroll-view class="date-content" scroll-x="true" :scroll-left="dateScroll" v-if="item.priceStockList.length > 0"> <scroll-view class="date-content" scroll-x="true" :scroll-left="dateScroll" v-if="dateList.length > 0">
<view class="date-list" v-for="(item2,index2) of item.priceStockList" :class="{ on: active == index2 }" @click="dateChoose(item,item2,index2)" :key="index2"> <view class="date-list" v-for="(item, index) of dateList" :class="{ on: active == index }" @click="dateChoose(index)" :key="index">
<view v-if="item2.week"> <view v-if="item.week">
<text v-if="item2.week != '今天' && item2.week != '明天' && item2.week != '后天'"></text> <text v-if="item.week != '今天' && item.week != '明天' && item.week != '后天'"></text>
{{ item2.week }} {{ item.week }}
</view> </view>
<view> <view>
{{ item2.startTime ? item2.startTime.substr(5, 5) : '' }} {{ item.startTime ? item.startTime.substr(5, 5) : '' }}
</view> </view>
<view class="date-price"> <view class="date-price">
¥<text style="font-weight: bold;">{{ item2.sellingPrice }}</text> ¥<text style="font-weight: bold;">{{ item.sellingPrice }}</text>
</view> </view>
<view v-if="active == index" class="date-icon"> <view v-if="active == index" class="date-icon">
...@@ -87,22 +87,26 @@ ...@@ -87,22 +87,26 @@
<view class="middle-time" v-if="productIfo.productType == 3"> <view class="middle-time" v-if="productIfo.productType == 3">
<view class="title-text"> 场次 </view> <view class="title-text"> 场次 </view>
<view class="middle-timelist"> <view class="middle-timelist">
<scroll-view class="time-content" scroll-x="true" :scroll-left="timeScroll" v-if="item.timeList.length> 0"> <scroll-view class="time-content" scroll-x="true" :scroll-left="timeScroll" v-if="timeList.length> 0">
<view class="time-list" v-for="(item2,index2) of item.timeList" @click="chooseTime(item,item2,index2)" :class="{ on:item.timeActive == index2 }" :key="index2"> <view class="time-list" v-for="(item, index) of timeList" @click="chooseTime(index)" :class="{ on: timeActive == index }" :key="index">
<view> <view>
{{ item2.startPlanTime ? item2.startPlanTime.substr(0, 5) : '' }} {{ item.startPlanTime ? item.startPlanTime.substr(0, 5) : '' }}
<text v-if="item2.endPlanTime">-</text> <text v-if="item.endPlanTime&&!item.saleOnlyShowFromDate">
{{ item2.endPlanTime ? item2.endPlanTime.substr(0, 5) : '' }} -{{ item.endPlanTime ? item.endPlanTime.substr(0, 5) : '' }}
</text>
</view>
<view>
<text v-if="item.copyLast!='余票充足'&&item.copyLast!='售罄'">剩余:</text>
{{ item.last }}
</view> </view>
<view> 剩余:{{ item2.last }} </view> <view v-if="timeActive == index" class="date-icon">
<view v-if="item.timeActive == index" class="date-icon">
<u-icon name="checkmark" color="#ffffff"></u-icon> <u-icon name="checkmark" color="#ffffff"></u-icon>
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
<text class="no-time" v-if="item.timeList&&item.timeList.length==0"> 该日票种已售罄,请选择其他日期 </text> <text class="no-time" v-if="startDate && endDate && timeList.length == 0"> 该日票种已售罄,请选择其他日期 </text>
<text class="no-time" v-if="!item.startDate || !item.endDate"> 请先选游玩日期 </text> <text class="no-time" v-if="!startDate || !endDate"> 请先选游玩日期 </text>
<view class="timeMore" @click="showTime(item,index)"> <view class="timeMore" @click="showTime()">
<view class="time-more-content"> <view class="time-more-content">
<view>更多</view> <view>更多</view>
<view>场次</view> <view>场次</view>
...@@ -118,11 +122,11 @@ ...@@ -118,11 +122,11 @@
<view class="middle-Number"> <view class="middle-Number">
<view class="title-text"> 购买数量 </view> <view class="title-text"> 购买数量 </view>
<view> <view>
<u-number-box v-model="item.buyNum" @change='buyNumChange'> <u-number-box v-model="buyNum" @change='buyNumChange'>
<view slot="minus" class="number-minus" > <view slot="minus" class="number-minus" >
<u-icon name="minus" color="#FFFFFF" size="32"></u-icon> <u-icon name="minus" color="#FFFFFF" size="32"></u-icon>
</view> </view>
<text slot="input" class="number-input">{{item.buyNum}}</text> <text slot="input" class="number-input">{{buyNum}}</text>
<view slot="plus" class="number-plus"> <view slot="plus" class="number-plus">
<u-icon name="plus" color="#FFFFFF" size="32"></u-icon> <u-icon name="plus" color="#FFFFFF" size="32"></u-icon>
</view> </view>
...@@ -134,33 +138,33 @@ ...@@ -134,33 +138,33 @@
</view> </view>
<!-- 有可用优惠券,并且未选中 --> <!-- 有可用优惠券,并且未选中 -->
<template v-if="item.couponData.masterSlaveCouponList&&item.couponData.masterSlaveCouponList.length>0&&!item.chooseCouponObj"> <template v-if="couponData.masterSlaveCouponList&&couponData.masterSlaveCouponList.length>0&&!chooseCouponObj">
<view> <view>
{{item.couponData.masterSlaveCouponList[0].couponName}} {{couponData.masterSlaveCouponList[0].couponName}}
</view> </view>
<view > <view >
未使用优惠券 未使用优惠券
</view> </view>
</template> </template>
<!-- 有可用优惠券 --> <!-- 有可用优惠券 -->
<template v-if="item.chooseCouponObj&&item.savedMoney>0"> <template v-if="chooseCouponObj&&savedMoney>0">
<view> <view>
{{item.chooseCouponObj.couponName}} {{chooseCouponObj.couponName}}
</view> </view>
<view style="font-size: 32rpx;"> <view style="font-size: 32rpx;">
<text style="font-size: 24rpx;position: relative;top: 6rpx;">¥</text> <text style="font-size: 24rpx;position: relative;top: 6rpx;">¥</text>
{{parseFloat(item.savedMoney.toFixed(2))}} {{parseFloat(savedMoney.toFixed(2))}}
</view> </view>
</template> </template>
<!-- 可用优惠券条件--> <!-- 可用优惠券条件-->
<template v-if="item.ableConpon"> <template v-if="ableConpon">
<view> <view>
{{item.ableConpon.couponName}} {{ableConpon.couponName}}
</view> </view>
<view> <view>
{{item.ableConpon.couponRule}} {{ableConpon.couponRule}}
</view> </view>
</template> </template>
<u-icon name="arrow-right" color="#3688FF"></u-icon> <u-icon name="arrow-right" color="#3688FF"></u-icon>
...@@ -213,12 +217,12 @@ ...@@ -213,12 +217,12 @@
</view> </view>
<!-- ---------------------------------------------游客信息-------------------------------------------- --> <!-- ---------------------------------------------游客信息-------------------------------------------- -->
<view class="middle-bottom" v-if="item.tripTemplateFlag != 2"> <view class="middle-bottom" v-if="productIfo.tripTemplateFlag != 2">
<view class="middle-visitor"> <view class="middle-visitor">
<view class="visitorTitle"> <view class="visitorTitle">
<text class="title-text"> 用户信息 </text> <text class="title-text"> 用户信息 </text>
<text> <text>
需填<text class="title-bold">{{item.contactNum }}</text>位出行人 需填<text class="title-bold">{{ contactNum }}</text>位出行人
<!-- <text class="title-bold" v-if="contactNum - chooseContact.length > 0">,还需{{ contactNum - chooseContact.length }}位</text> --> <!-- <text class="title-bold" v-if="contactNum - chooseContact.length > 0">,还需{{ contactNum - chooseContact.length }}位</text> -->
</text> </text>
</view> </view>
...@@ -247,40 +251,40 @@ ...@@ -247,40 +251,40 @@
<text style="margin-left:16rpx;">新增</text> <text style="margin-left:16rpx;">新增</text>
</view> </view>
<view class="visitorEdit" v-show="item.chooseContact.length > 0"> <view class="visitorEdit" v-show="chooseContact.length > 0">
<view class="edit-list" v-for="(item2, index) of item.chooseContact" :key="item.id"> <view class="edit-list" v-for="(item, index) of chooseContact" :key="item.id">
<view @click="delChooseContact(item2, index)"> <view @click="delChooseContact(item, index)">
<u-icon name="close-circle" color="#3688ff" size="40"></u-icon> <u-icon name="close-circle" color="#3688ff" size="40"></u-icon>
</view> </view>
<view> <view>
{{ item2.name }} {{ item.name }}
</view> </view>
<view> <view>
{{ item2.credentialNumber ? item2.credentialNumber.substr(0, 3) + '****' + item2.credentialNumber.substr(14, 4) : '' }} {{ item.credentialNumber ? item.credentialNumber.substr(0, 3) + '****' + item.credentialNumber.substr(14, 4) : '' }}
</view> </view>
<view @click="showEdit(item2)"> <view @click="showEdit(item)">
<u-icon name="edit-pen-fill" color="#3688ff" size="48"></u-icon> <u-icon name="edit-pen-fill" color="#3688ff" size="48"></u-icon>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<!-- <view class="middle-phone" v-if="productIfo.tripTemplateFlag != 2"> <view class="middle-phone" v-if="productIfo.tripTemplateFlag != 2">
<text> 联系电话: </text> <text> 联系电话: </text>
<input type="number" maxlength="11" placeholder="请输入联系电话" v-model.trim="ticketPhone" /> <input type="number" maxlength="11" placeholder="请输入联系电话" v-model.trim="ticketPhone" />
</view> --> </view>
</view> </view>
<!-- ---------------------------------------------产品押金部分---------------------------------------- --> <!-- ---------------------------------------------产品押金部分---------------------------------------- -->
<view class="productDeposit" v-if="item.deposit"> <view class="productDeposit" v-if="productIfo.deposit">
<view> <view>
{{ item.name }} {{ productIfo.name }}
<text style="color: #FC6703;margin-left: 10rpx;">押金</text> <text style="color: #FC6703;margin-left: 10rpx;">押金</text>
</view> </view>
<view style="color: #FC6703"> {{ item.deposit }}元 </view> <view style="color: #FC6703"> {{ productIfo.deposit }}元 </view>
</view> </view>
</view> </view>
...@@ -299,9 +303,9 @@ ...@@ -299,9 +303,9 @@
</view> </view>
<view class="bottom-btn" :style="{ background: payBackground }"> <view class="bottom-btn" :style="{ background: payBackground }">
<text v-if="orderStatus == 1">已下架</text> <text v-if="productIfo.status == 1">已下架</text>
<text v-if="parseInt(maxBookNum) <1" style="background: #c0c0c0">暂无库存</text> <text v-if="parseInt(maxBookNum) <1" style="background: #c0c0c0">暂无库存</text>
<text v-if="orderStatus!= 1 && parseInt(maxBookNum) >= 1" @click="goPay()">去支付</text> <text v-if="productIfo.status != 1 && parseInt(maxBookNum) >= 1" @click="goPay()">去支付</text>
</view> </view>
</view> </view>
</view> </view>
...@@ -387,6 +391,7 @@ export default { ...@@ -387,6 +391,7 @@ export default {
}, },
data() { data() {
return { return {
defaultAreaCode: '', //默认站点
sortArr: [], //多个站点排号信息列表 sortArr: [], //多个站点排号信息列表
sortIfo: '', //单个站点排号信息 sortIfo: '', //单个站点排号信息
sortInforPop: false, //一个站点时获取排队信息弹窗 sortInforPop: false, //一个站点时获取排队信息弹窗
...@@ -394,18 +399,34 @@ export default { ...@@ -394,18 +399,34 @@ export default {
showArea: false, //控制选择站点显示隐藏 showArea: false, //控制选择站点显示隐藏
showOpenArea: false, //是否可以显示选择站点 showOpenArea: false, //是否可以显示选择站点
chooseDate: '', //选择的日期 chooseDate: '', //选择的日期
active: 10000, //日期下标
timeActive: 10000, //时间下标,默认不选中 timeActive: 10000, //时间下标,默认不选中
buyNum: 1, //订单数量
maxBookNum: 999, //最大预订数量
dateList: [], //日期列表
timeList: [], //时间列表
buyKnowData: '', //购买须知数据 buyKnowData: '', //购买须知数据
editContact: '', //编辑联系人传值对象 editContact: '', //编辑联系人传值对象
productId: '', //产品Id
merchantId: '', //商户Id merchantId: '', //商户Id
ticketPhone: '', //联系电话 ticketPhone: '', //联系电话
productIfo: '', //初始化产品基本信息
originalPrice: 0, //原价单价
sellingPrice: 0, //卖价单价
interfaceCode: '', //接口编号 interfaceCode: '', //接口编号
merchantCode: '', //商户code
productCode: '', //产品code productCode: '', //产品code
contactTotal: [], //所有联系人列表
chooseContact: [], //选中的游客信息列表 chooseContact: [], //选中的游客信息列表
contactNum: 1, //需要选择几位联系人数量
cruisePlanId: '', //班次Id cruisePlanId: '', //班次Id
chooseTimeData: '', //选中的时间传给子组件
timeNumber: '', //当前时间转化为数字 timeNumber: '', //当前时间转化为数字
startDate: '', //开始日期
endDate: '', //结束日期
startPlayTime: '', //开始时间 startPlayTime: '', //开始时间
endPlayTime: '', //结束时间 endPlayTime: '', //结束时间
areaObj: '', //区域组件的传值
templateList: [], //该产品联系人必须要填写的信息 templateList: [], //该产品联系人必须要填写的信息
timeFlag: '', //setTimeout函数 timeFlag: '', //setTimeout函数
savedMoney: 0, //优惠价格 savedMoney: 0, //优惠价格
...@@ -417,6 +438,7 @@ export default { ...@@ -417,6 +438,7 @@ export default {
productDepositTotal: 0, //产品总押金 productDepositTotal: 0, //产品总押金
orderSource: '', //订单来源 1公众号平台、2公众号组合页面1、3公众号组合页面2、4胖丁伙伴app、5第三方自助机、6第三方票房窗口 orderSource: '', //订单来源 1公众号平台、2公众号组合页面1、3公众号组合页面2、4胖丁伙伴app、5第三方自助机、6第三方票房窗口
thirdOpenid: '', //第三方openid thirdOpenid: '', //第三方openid
beforeBookDays: '', //需提前预定天数
companyId: '', //公司Id companyId: '', //公司Id
docQuery: '', //元素变量 docQuery: '', //元素变量
payBackground: '', //支付按钮背景颜色 payBackground: '', //支付按钮背景颜色
...@@ -426,11 +448,6 @@ export default { ...@@ -426,11 +448,6 @@ export default {
couponData:[], //所有劵数据 couponData:[], //所有劵数据
chooseCouponObj: '', //默认选中最优价格优惠券 chooseCouponObj: '', //默认选中最优价格优惠券
ableConpon: '', //没有可用优惠券时,达到一定条件可用,显示达到的条件 ableConpon: '', //没有可用优惠券时,达到一定条件可用,显示达到的条件
productIdList:[],//产品id列表入参
productList:[],//初始化产品数据
orderStatus:'',//上下架状态,任何一个产品状态为下架,该状态为下架
chooseTimeList:[],//选中产品时间列表
chooseTimeData: '', //选中的时间传给子组件
} }
}, },
onLoad(option) { onLoad(option) {
...@@ -439,14 +456,8 @@ export default { ...@@ -439,14 +456,8 @@ export default {
this.companyId = option.companyId || '' this.companyId = option.companyId || ''
this.orderSource = option.orderSource || '' this.orderSource = option.orderSource || ''
this.thirdOpenid = option.thirdOpenid || '' //第三方openid this.thirdOpenid = option.thirdOpenid || '' //第三方openid
this.productId = option.productId || ''
this.merchantId = option.merchantId || '' this.merchantId = option.merchantId || ''
let idList=JSON.parse(option.productIdList)
this.productIdList=idList.map((item)=>{
return {productId:item}
})
console.log(this.productIdList)
this.initData() //页面初始化数据 this.initData() //页面初始化数据
this.docQuery = uni.createSelectorQuery().in(this) this.docQuery = uni.createSelectorQuery().in(this)
}, },
...@@ -463,7 +474,7 @@ export default { ...@@ -463,7 +474,7 @@ export default {
if (this.chooseService[i].depositType == 1) { if (this.chooseService[i].depositType == 1) {
//等于1,押金金额跟数量没关系 //等于1,押金金额跟数量没关系
singleProduct = this.chooseService[i].deposit singleProduct = this.chooseService[i].deposit
} else if (this.chooseService[i].depositType == 2){ } else if (this.chooseService[i].depositType == 2) {
//等于2,押金单价乘购买数量 //等于2,押金单价乘购买数量
singleProduct = parseFloat((this.chooseService[i].deposit * this.buyNum).toFixed(2)) singleProduct = parseFloat((this.chooseService[i].deposit * this.buyNum).toFixed(2))
} }
...@@ -553,44 +564,23 @@ export default { ...@@ -553,44 +564,23 @@ export default {
showCalendar() { showCalendar() {
this.$refs.calendar.show = true this.$refs.calendar.show = true
}, },
//---日期选择---已改 //---日期选择
dateChoose(item,item2,index) { dateChoose(index) {
item.active=index//修改选中样式 this.active = index //修改选中样式
item.maxBookNum=Math.min(item2.maxBookNum,item2.surplus) //剩余量变化 this.maxBookNum = Math.min(this.dateList[index].surplus, this.productIfo.maxBookNum) //剩余量变化
item.originalPrice=item2.originalPrice//产品原价为当前选中日期的原价 this.originalPrice = this.dateList[index].originalPrice //原价变化
item.sellingPrice=item2.sellingPrice//产品卖价为当前选中日期的卖价 this.sellingPrice = this.dateList[index].sellingPrice //卖家变化
item.chooseDate=item2.startTime.substr(0,10) this.chooseDate = this.dateList[index].startTime.substr(0, 10) //日历组件选中日期
this.$refs.calendar.getDefaultDate(item.chooseDate)//日历组件选中日期 this.endDate = this.dateList[index].endTime //开始日期
item.endDate=item2.endTime//开始日期 this.startDate = this.dateList[index].startTime //结束日期
item.startDate=item2.startTime//结束日期 this.$refs.calendar.defaultDate = this.chooseDate
this.chooseTimeData=''//清除之前选中的时间 if (this.productIfo.productType == 3) {
if(item.productType==3){ //如果为班次票,点击时,请求班次票接口
//productType=3为场次票 this.cruisePlanId = '' //清空班次id
item.cruisePlanId='' this.timeActive = 10000
item.timeActive=10000 uni.$u.throttle(this.getTimeStock, 3000)
this.timeActive=10000
this.getTimeStock(item)
} }
this.initCoupon()
// this.computedPrice()
// this.initCoupon(Item.id,Item.buyNum,Item.sellingPrice,Item.merchantId,Index)
// this.$forceUpdate()
//下面是单票代码
// this.active = index //修改选中样式
// this.maxBookNum = Math.min(this.dateList[index].surplus, this.productIfo.maxBookNum) //剩余量变化
// this.originalPrice = this.dateList[index].originalPrice //原价变化
// this.sellingPrice = this.dateList[index].sellingPrice //卖家变化
// this.chooseDate = this.dateList[index].startTime.substr(0, 10) //日历组件选中日期
// this.endDate = this.dateList[index].endTime //开始日期
// this.startDate = this.dateList[index].startTime //结束日期
// this.$refs.calendar.defaultDate = this.chooseDate
// if (this.productIfo.productType == 3) {
// //如果为班次票,点击时,请求班次票接口
// this.cruisePlanId = '' //清空班次id
// this.timeActive = 10000
// uni.$u.throttle(this.getTimeStock, 3000)
// }
// this.initCoupon()
}, },
//---日历确认事件 //---日历确认事件
dateConfig(data) { dateConfig(data) {
...@@ -602,28 +592,20 @@ export default { ...@@ -602,28 +592,20 @@ export default {
this.dateScroll = (data[index].width + 4) * index this.dateScroll = (data[index].width + 4) * index
}).exec() }).exec()
}, },
//---展示更多时间---已改好 //---展示更多时间
showTime(item,index) { showTime() {
this.chooseTimeList=item.timeList
this.moreTimeIndex=index
if(item.timeActive>=0){
this.timeActive=item.timeActive//组件的默认下标
}else{
this.timeActive=10000
}
this.$refs.times.showPop = true this.$refs.times.showPop = true
}, },
//---时间选择---已改好,数据更新需要测试 //---时间选择
chooseTime(item,item2,index) { chooseTime(i) {
if(item2.copyLast!='售罄'){ if(this.timeList[i].copyLast!='售罄'){
item.timeActive=index this.timeActive = i
item.cruisePlanId=item2.cruisePlanId//获取班次Id this.cruisePlanId = this.timeList[i].cruisePlanId //获取班次Id
this.chooseTimeData=item2.startPlanTime this.chooseTimeData = this.timeList[i].startPlanTime
item.maxBookNum=Math.min(item.maxBookNum,item2.last) this.maxBookNum = Math.min(this.timeList[i].last, this.productIfo.maxBookNum) //获取剩余库存
//如果为场次票,开始时间为班次时间的开始时间,结束时间为班次时间的结束时间,班次时间的结束时间为空时,结束时间为班次时间的开始时间 //如果为班次票,开始时间为班次时间的开始时间,结束时间为班次时间的结束时间,班次时间的结束时间为空时,结束时间为班次时间的开始时间
item.startPlayTime=item2.startPlanTime this.startPlayTime = this.timeList[i].startPlanTime
item.endPlayTime=item2.endPlanTime||item2.startPlanTime this.endPlayTime = this.timeList[i].endPlanTime || this.timeList[i].startPlanTime
// this.$forceUpdate()
} }
}, },
//---时间确认事件 //---时间确认事件
...@@ -659,33 +641,6 @@ export default { ...@@ -659,33 +641,6 @@ export default {
showContacts() { showContacts() {
this.$refs.contactList.showPop = true this.$refs.contactList.showPop = true
}, },
//---计算价格
computedPrice(){
let savedMoney=0
let original=0
let sell=0
let deposit=0
this.productDepositTotal=0
this.productList.forEach((item)=>{
original+=item.originalPrice*item.buyNum
sell+=item.sellingPrice*item.buyNum
if(item.chooseCouponObj){
if(item.chooseCouponObj.slaveList&&item.chooseCouponObj.slaveList.length>0){
savedMoney+=item.chooseCouponObj.slaveList[0].savedMoney
}else{
savedMoney+=item.chooseCouponObj.savedMoney
}
}
if(item.depositType==1){//等于1,押金金额跟数量没关系
deposit=item.deposit
}else if(item.depositType==2){//等于2,押金单价乘购买数量
deposit=item.deposit*item.buyNum
}
this.productDepositTotal+=deposit
})
this.originalTotal=parseFloat((original+this.productDepositTotal).toFixed(2))||0 //产品总价+产品押金
this.sellTotal=parseFloat((sell+this.productDepositTotal-savedMoney).toFixed(2))||0
},
//---游客选择 //---游客选择
visitorChoose(i) { visitorChoose(i) {
let chooseList = this.chooseContact let chooseList = this.chooseContact
...@@ -748,51 +703,56 @@ export default { ...@@ -748,51 +703,56 @@ export default {
}, },
//---页面初始化数据,获取产品基本信息 //---页面初始化数据,获取产品基本信息
initData() { initData() {
let data={ let data = {
productList:this.productIdList,//产品id列表 id: this.productId //产品id
} }
uni.showLoading({ uni.showLoading({
title: '加载中', title: '加载中',
mask:true mask:true
}) })
this.$request('scenic/groupGood/loadProductList', data).then(res => { this.$request('scenic/groupGood/loadProduct', data).then(res => {
if (res.code == '00'){ if (res.code == '00') {
this.productList=res.data||[] this.productIfo = res.data
this.productIdList=this.productList.map((item)=>{//id集合用于请求价格库存列表接口 this.defaultAreaCode = this.productIfo.defaultAreaCode || ''
return item.id //通过默认站点找到站点数据
}) if (this.defaultAreaCode) {
this.productIfo.productAreaList.forEach(item => {
for(let i=0;i<this.productList.length;i++){ if (item.areaCode == this.defaultAreaCode) {
let item=this.productList[i] this.areaObj = {}
if(item.defaultAreaCode){ this.areaObj.areaCode = item.areaCode
item.areaObj={} this.areaObj.areaName = item.areaName
item.areaObj.areaCode=item.areaCode }
item.areaObj.areaName=item.areaName })
}else{ }
item.areaObj={} this.merchantCode = this.productIfo.merchantVo.code, //商户code
} this.productId = res.data.id//产品id变化,重新赋值产品id
item.active=0//默认选中第一个日期 this.merchantId = res.data.merchantId //重新赋值商户id
item.buyNum=1,//默认为1 this.beforeBookDays = res.data.beforeBookDays || 0 //提前预定天数
item.contactTotal=[]//选中的游客信息列表 this.buyKnowData = res.data //购买须知,传给子组件
item.contactNum=1//需要选择几位联系人数量 this.serviceList = res.data.loadProductResVoList //额外服务
if(item.status==1){//任何一个产品下架,该组合票为下架状态 //this.chooseService=res.data.data.loadProductResVoList//默认全部选中
this.orderStatus=1 if (this.productIfo.status == 1) {
//下架状态
this.payBackground = '#C0C0C0' this.payBackground = '#C0C0C0'
return
} }
if(item.productType!=3){//不为班次票时,开始时间为当前时间,结束时间为23:59:59 if (this.productIfo.productType != 3) {
item.startPlayTime=new Date().Format('hh:mm:ss') //不为班次票时,开始时间为当前时间,结束时间为23:59:59
item.endPlayTime='23:59:59' this.startPlayTime = new Date().Format('hh:mm:ss')
this.endPlayTime = '23:59:59'
} }
if (this.productIfo.tripTemplateResList.length > 0) {
//用于判断选中的联系人信息是否填写完善
this.productIfo.tripTemplateResList.forEach(item => {
this.templateList.push(item.enumKey)
})
} }
this.getPriceList() this.getPriceList()
// this.getDiscountPrice() //获取优惠价格 this.getDiscountPrice() //获取优惠价格
//---待处理 if (this.productIfo.tripTemplateFlag != 2) {
// if (this.productIfo.tripTemplateFlag != 2) { //等于2时不需要填写联系人信息和手机号码
// //等于2时不需要填写联系人信息和手机号码 this.getContactList()
// this.getContactList() }
// }
} else { } else {
uni.showToast({ uni.showToast({
title: res.message, title: res.message,
...@@ -803,166 +763,88 @@ export default { ...@@ -803,166 +763,88 @@ export default {
}, },
//---获取产品价格库存列表 //---获取产品价格库存列表
getPriceList() { getPriceList() {
let data={ let data = {
productIds:this.productIdList,//产品id集合 productId: this.productId //产品id
} }
this.$request('scenic/user/product/groupPriceStockList', data).then(res => { this.$request('scenic/user/product/priceStockList', data).then(res => {
if (res.code == '00') { if (res.code == '00') {
//所有产品的价格库存列表 this.dateList = res.data //日期列表
let stockList=res.data if (this.dateList.length > 0) {
this.productList.forEach(item=>{ let time1 = this.dateList[0].startTime.substr(0, 10) + this.productIfo.bookTime //获取价格列表的第一个日期+预订最晚时间
//待处理 let timeNum1 = parseInt(this.$commonjs.changeTime(time1))
// if(item.isFetch==1&&item.productAreaList.length>1){ let time2 = new Date().Format('yyyy-MM-dd hh:mm:ss')
// this.areaIndex=index let timeNum2 = parseInt(this.$commonjs.changeTime(time2)) //将当前时间转化为数字
// this.merchantCode=this.productList[index].merchantVo.code if (timeNum2 > timeNum1) {
// this.sortUpDown()
//}else if(item.isFetch==1&&item.productAreaList.length==1){
// item.areaObj=item.productAreaList[0]
// }
//把价格列表合并到对应的产品上面
stockList.forEach(item2=>{
if(item.id==item2.productId){
item.priceStockList=item2.priceStockList||[]
}
})
})
let today = this.$commonjs.today() //今天
let tomorrow = this.$commonjs.tomorrow() //明天
let afterTomorrow = this.$commonjs.afterTomorrow() //后天
this.productList.forEach(item=>{
if(item.priceStockList.length>0){
//获取价格列表的第一个日期+预订最晚时间
let time1=item.priceStockList[0].startTime.substr(0,10)+item.bookTime
let timeNum1=parseInt(this.$commonjs.changeTime(time1))
let time2=new Date().Format('yyyy-MM-dd hh:mm:ss')
let timeNum2 =parseInt(this.$commonjs.changeTime(time2)) //将当前时间转化为数字
if(timeNum2>timeNum1){
//如果当前时间大于价格列表第一个日期+预订最晚时间,第一个价格不显示 //如果当前时间大于价格列表第一个日期+预订最晚时间,第一个价格不显示
item.priceStockList.splice(0,1) this.dateList.splice(0, 1)
} }
item.priceStockList.forEach((item2, index) => { this.dateList.forEach((item, index) => {
//价格上面时间小于当前时间加上需预定天数之后的需删除 //价格上面时间小于当前时间加上需预定天数之后的需删除
let date = new Date() let date = new Date()
date.setDate(date.getDate() + item2.beforeBookDays) date.setDate(date.getDate() + this.beforeBookDays)
let newDate = date.Format('yyyy-MM-dd') let newDate = date.Format('yyyy-MM-dd')
let priceTime = this.$commonjs.changeTime(item2.endTime.substr(0, 10)) let priceTime = this.$commonjs.changeTime(item.endTime.substr(0, 10))
let newTime = this.$commonjs.changeTime(newDate) let newTime = this.$commonjs.changeTime(newDate)
if (priceTime < newTime) { if (priceTime < newTime) {
delete item.priceStockList[index] delete this.dateList[index]
} }
}) })
item.priceStockList = item.priceStockList.filter(val => { this.dateList = this.dateList.filter(val => {
return val return val
}) })
if(item.priceStockList.length==0){ if (this.dateList.length == 0) {
uni.showToast({title: '没有库存',icon: 'none'}) uni.showToast({
title: '没有库存',
icon: 'none'
})
this.showArea = false
this.payBackground = '#C0C0C0' this.payBackground = '#C0C0C0'
return return
} }
item.startDate=item.priceStockList[0].startTime//开始日期 if (this.productIfo.isFetch == 1) {
item.endDate=item.priceStockList[0].endTime//结束日期 this.sortUpDown()
item.originalPrice=item.priceStockList[0].originalPrice//原价 }
item.sellingPrice=item.priceStockList[0].sellingPrice//卖价 if (this.dateList.length == 1 && this.beforeBookDays == 0) {
item.maxBookNum=Math.min(item.priceStockList[0].surplus,item.maxBookNum)//最大购买数量 //长度为1而且只能预订当天,默认选中第一个日期
item.priceStockList.forEach(item2=>{//循环单个产品的价格列表 //真机模拟的时候手机端不显示今天,明天后天,延迟执行
item2.week='日一二三四五六'.charAt(new Date(item2.startTime.substr(0,10)).getDay()) setTimeout(item => {
if(item2.startTime.substr(0,10)==today){ this.$refs.calendar.defaultDate = this.dateList[0].startTime.substr(0, 10)
item2.week='今天' }, 1000)
} this.maxBookNum = Math.min(this.dateList[0].surplus, this.productIfo.maxBookNum) //剩余量
if(item2.startTime.substr(0,10)==tomorrow){ this.startDate = this.dateList[0].startTime //开始日期
item2.week='明天' this.endDate = this.dateList[0].endTime //结束日期
this.originalPrice = this.dateList[0].originalPrice //原价
this.sellingPrice = this.dateList[0].sellingPrice //卖价
this.active = 0
if (this.productIfo.productType == 3) {
//如果为班次票,请求班次票接口
this.getTimeStock()
} }
if(item2.startTime.substr(0,10)==afterTomorrow){ this.initCoupon() //获取优惠券
item2.week='后天'
} }
} else {
uni.showToast({
title: '没有库存',
icon: 'none'
}) })
//如果是班次票,并且班次票价格列表不为空 this.showArea = false
if(item.productType==3&&item.priceStockList.length>0){
this.getTimeStock(item)
}
}else{
uni.showToast({title: '没有库存',icon: 'none'})
this.payBackground = '#C0C0C0' this.payBackground = '#C0C0C0'
} }
let today = this.$commonjs.today() //今天
let tomorrow = this.$commonjs.tomorrow() //明天
let afterTomorrow = this.$commonjs.afterTomorrow() //后天
this.dateList.forEach((item, index) => {
item.week = '日一二三四五六'.charAt(new Date(item.startTime.substr(0, 10)).getDay())
if (item.startTime.substr(0, 10) == today) {
item.week = '今天'
}
if (item.startTime.substr(0, 10) == tomorrow) {
item.week = '明天'
}
if (item.startTime.substr(0, 10) == afterTomorrow) {
item.week = '后天'
}
}) })
// this.dateList = res.data //日期列表
// if (this.dateList.length > 0) {
// let time1 = this.dateList[0].startTime.substr(0, 10) + this.productIfo.bookTime //获取价格列表的第一个日期+预订最晚时间
// let timeNum1 = parseInt(this.$commonjs.changeTime(time1))
// let time2 = new Date().Format('yyyy-MM-dd hh:mm:ss')
// let timeNum2 = parseInt(this.$commonjs.changeTime(time2)) //将当前时间转化为数字
// if (timeNum2 > timeNum1) {
// //如果当前时间大于价格列表第一个日期+预订最晚时间,第一个价格不显示
// this.dateList.splice(0, 1)
// }
// this.dateList.forEach((item, index) => {
// //价格上面时间小于当前时间加上需预定天数之后的需删除
// let date = new Date()
// date.setDate(date.getDate() + this.beforeBookDays)
// let newDate = date.Format('yyyy-MM-dd')
// let priceTime = this.$commonjs.changeTime(item.endTime.substr(0, 10))
// let newTime = this.$commonjs.changeTime(newDate)
// if (priceTime < newTime) {
// delete this.dateList[index]
// }
// })
// this.dateList = this.dateList.filter(val => {
// return val
// })
// if (this.dateList.length == 0) {
// uni.showToast({
// title: '没有库存',
// icon: 'none'
// })
// this.showArea = false
// this.payBackground = '#C0C0C0'
// return
// }
// if (this.productIfo.isFetch == 1) {
// this.sortUpDown()
// }
// if (this.dateList.length == 1 && this.beforeBookDays == 0) {
// //长度为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.startDate = this.dateList[0].startTime //开始日期
// this.endDate = this.dateList[0].endTime //结束日期
// this.originalPrice = this.dateList[0].originalPrice //原价
// this.sellingPrice = this.dateList[0].sellingPrice //卖价
// this.active = 0
// if (this.productIfo.productType == 3) {
// //如果为班次票,请求班次票接口
// this.getTimeStock()
// }
// this.initCoupon() //获取优惠券
// }
// } else {
// uni.showToast({
// title: '没有库存',
// icon: 'none'
// })
// this.showArea = false
// this.payBackground = '#C0C0C0'
// }
// let today = this.$commonjs.today() //今天
// let tomorrow = this.$commonjs.tomorrow() //明天
// let afterTomorrow = this.$commonjs.afterTomorrow() //后天
// this.dateList.forEach((item, index) => {
// item.week = '日一二三四五六'.charAt(new Date(item.startTime.substr(0, 10)).getDay())
// if (item.startTime.substr(0, 10) == today) {
// item.week = '今天'
// }
// if (item.startTime.substr(0, 10) == tomorrow) {
// item.week = '明天'
// }
// if (item.startTime.substr(0, 10) == afterTomorrow) {
// item.week = '后天'
// }
// })
} else { } else {
uni.showToast({ uni.showToast({
title: res.message, title: res.message,
...@@ -1005,13 +887,13 @@ export default { ...@@ -1005,13 +887,13 @@ export default {
}) })
}, },
//---获取班次票 //---获取班次票
getTimeStock(item) { getTimeStock() {
let data = { let data = {
endDate: item.endDate, //结束日期 endDate: this.endDate, //结束日期
startDate: item.startDate, //开始日期 startDate: this.startDate, //开始日期
interfaceCode: item.merchantVo.interfaceCompanyId, //接口编号 interfaceCode: this.productIfo.merchantVo.interfaceCompanyId, //接口编号
merchantCode: item.merchantVo.code, //商户code merchantCode: this.merchantCode, //商户code
productCode: item.code //产品code productCode: this.productIfo.code //产品code
} }
uni.showLoading({ uni.showLoading({
title: '加载中', title: '加载中',
...@@ -1019,21 +901,20 @@ export default { ...@@ -1019,21 +901,20 @@ export default {
}) })
this.$request('distribution/distribution/getTimeStock', data).then(res => { this.$request('distribution/distribution/getTimeStock', data).then(res => {
if (res.code == '00') { if (res.code == '00') {
item.timeList=res.data this.timeList = res.data
this.timeList.forEach((item, index) => {
//增加一个时间Number字段,用于判断当前时间大于班次结束时间时,显示售罄 //增加一个时间Number字段,用于判断当前时间大于班次结束时间时,显示售罄
item.timeList.forEach(item2=>{ let text=parseFloat((item.last/item.total).toFixed(2))||0
let text=parseFloat((item2.last/item2.total).toFixed(2))||0
if(text>0.4){ if(text>0.4){
item2.copyLast='余票充足' item.copyLast='余票充足'
}else{ }else{
item2.copyLast=item2.last item.copyLast=item.last
} }
item2.timeNumber=parseInt(this.$commonjs.changeTime(item2.planDate.substr(0,10)+item2.endPlanTime)) item.timeNumber = parseInt(this.$commonjs.changeTime(item.planDate.substr(0, 10) + item.endPlanTime))
if(this.timeNumber>item2.timeNumber||item2.last<=0){ if (this.timeNumber > item.timeNumber || item.last <= 0) {
item2.copyLast='售罄' item.copyLast='售罄'
} }
}) })
// this.$forceUpdate()
} else { } else {
uni.showToast({ uni.showToast({
title: res.message, title: res.message,
......
...@@ -4,22 +4,22 @@ ...@@ -4,22 +4,22 @@
<view class="middle"> <view class="middle">
<view class="middle-top"> <view class="middle-top">
<!-- --------------------------------------------产品信息部分------------------------------------- --> <!-- --------------------------------------------产品信息部分------------------------------------- -->
<view class="middle-Product"> <view class="middle-Product" v-for="(item,Index) in productList" :key='item.id'>
<view class="merchantName"> <view class="merchantName">
<text class="title-text"> <text class="title-text">
{{ productIfo.merchantName || '' }} {{ item.merchantName || '' }}
</text> </text>
<text> <text>
{{ productIfo.name || '' }} {{ item.name || '' }}
</text> </text>
</view> </view>
<view @click="showBuyKnow()" class="buyKnow"> <view @click="showBuyKnow(index)" class="buyKnow">
<view> <view>
<text v-if="productIfo.backChangeRule == 0">不可退换</text> <text v-if="item.backChangeRule == 0">不可退换</text>
<text v-if="productIfo.backChangeRule == 1">可退</text> <text v-if="item.backChangeRule == 1">可退</text>
<text v-if="productIfo.backChangeRule == 2">随时可退</text> <text v-if="item.backChangeRule == 2">随时可退</text>
<text v-if="productIfo.isFetch == 1">无需取号</text> <text v-if="item.isFetch == 1">无需取号</text>
</view> </view>
<view> <view>
购买须知 购买须知
...@@ -28,11 +28,11 @@ ...@@ -28,11 +28,11 @@
</view> </view>
</view> </view>
<!--需要排队并且站点数大于1--> <!--需要排队并且站点数大于1-->
<view class="middle-place" @click="openArea()" v-if="productIfo.isFetch == 1 && productIfo.productAreaList.length > 1 && showOpenArea"> <view class="middle-place" @click="openArea()" v-if="item.isFetch == 1 && item.productAreaList.length > 1 && showOpenArea">
<view> 出发站点 </view> <view> 出发站点 </view>
<view> <view>
{{ areaObj.areaName || '请选择站点' }} {{ item.areaObj.areaName || '请选择站点' }}
</view> </view>
<view> <view>
...@@ -55,17 +55,17 @@ ...@@ -55,17 +55,17 @@
<view class="middle-Date"> <view class="middle-Date">
<view class="title-text">游玩日期</view> <view class="title-text">游玩日期</view>
<view class="middle-Datelist"> <view class="middle-Datelist">
<scroll-view class="date-content" scroll-x="true" :scroll-left="dateScroll" v-if="dateList.length > 0"> <scroll-view class="date-content" scroll-x="true" :scroll-left="dateScroll" v-if="item.priceStockList.length > 0">
<view class="date-list" v-for="(item, index) of dateList" :class="{ on: active == index }" @click="dateChoose(index)" :key="index"> <view class="date-list" v-for="(item2,index2) of item.priceStockList" :class="{ on: active == index2 }" @click="dateChoose(item,item2,index2)" :key="index2">
<view v-if="item.week"> <view v-if="item2.week">
<text v-if="item.week != '今天' && item.week != '明天' && item.week != '后天'"></text> <text v-if="item2.week != '今天' && item2.week != '明天' && item2.week != '后天'"></text>
{{ item.week }} {{ item2.week }}
</view> </view>
<view> <view>
{{ item.startTime ? item.startTime.substr(5, 5) : '' }} {{ item2.startTime ? item2.startTime.substr(5, 5) : '' }}
</view> </view>
<view class="date-price"> <view class="date-price">
¥<text style="font-weight: bold;">{{ item.sellingPrice }}</text> ¥<text style="font-weight: bold;">{{ item2.sellingPrice }}</text>
</view> </view>
<view v-if="active == index" class="date-icon"> <view v-if="active == index" class="date-icon">
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
</view> </view>
</scroll-view> </scroll-view>
<text v-else class="no-date"> 不可购买 </text> <text v-else class="no-date"> 不可购买 </text>
<view class="dateMore" @click="showCalendar()"> <view class="dateMore" @click="showCalendar(index)">
<view class="date-more-content"> <view class="date-more-content">
<view>更多</view> <view>更多</view>
<view>日期</view> <view>日期</view>
...@@ -87,26 +87,22 @@ ...@@ -87,26 +87,22 @@
<view class="middle-time" v-if="productIfo.productType == 3"> <view class="middle-time" v-if="productIfo.productType == 3">
<view class="title-text"> 场次 </view> <view class="title-text"> 场次 </view>
<view class="middle-timelist"> <view class="middle-timelist">
<scroll-view class="time-content" scroll-x="true" :scroll-left="timeScroll" v-if="timeList.length> 0"> <scroll-view class="time-content" scroll-x="true" :scroll-left="timeScroll" v-if="item.timeList.length> 0">
<view class="time-list" v-for="(item, index) of timeList" @click="chooseTime(index)" :class="{ on: timeActive == index }" :key="index"> <view class="time-list" v-for="(item2,index2) of item.timeList" @click="chooseTime(item,item2,index2)" :class="{ on:item.timeActive == index2 }" :key="index2">
<view> <view>
{{ item.startPlanTime ? item.startPlanTime.substr(0, 5) : '' }} {{ item2.startPlanTime ? item2.startPlanTime.substr(0, 5) : '' }}
<text v-if="item.endPlanTime&&!item.saleOnlyShowFromDate"> <text v-if="item2.endPlanTime">-</text>
-{{ item.endPlanTime ? item.endPlanTime.substr(0, 5) : '' }} {{ item2.endPlanTime ? item2.endPlanTime.substr(0, 5) : '' }}
</text>
</view>
<view>
<text v-if="item.copyLast!='余票充足'&&item.copyLast!='售罄'">剩余:</text>
{{ item.last }}
</view> </view>
<view v-if="timeActive == index" class="date-icon"> <view> 剩余:{{ item2.last }} </view>
<view v-if="item.timeActive == index" class="date-icon">
<u-icon name="checkmark" color="#ffffff"></u-icon> <u-icon name="checkmark" color="#ffffff"></u-icon>
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
<text class="no-time" v-if="startDate && endDate && timeList.length == 0"> 该日票种已售罄,请选择其他日期 </text> <text class="no-time" v-if="item.timeList&&item.timeList.length==0"> 该日票种已售罄,请选择其他日期 </text>
<text class="no-time" v-if="!startDate || !endDate"> 请先选游玩日期 </text> <text class="no-time" v-if="!item.startDate || !item.endDate"> 请先选游玩日期 </text>
<view class="timeMore" @click="showTime()"> <view class="timeMore" @click="showTime(item,index)">
<view class="time-more-content"> <view class="time-more-content">
<view>更多</view> <view>更多</view>
<view>场次</view> <view>场次</view>
...@@ -122,11 +118,11 @@ ...@@ -122,11 +118,11 @@
<view class="middle-Number"> <view class="middle-Number">
<view class="title-text"> 购买数量 </view> <view class="title-text"> 购买数量 </view>
<view> <view>
<u-number-box v-model="buyNum" @change='buyNumChange'> <u-number-box v-model="item.buyNum" @change='buyNumChange'>
<view slot="minus" class="number-minus" > <view slot="minus" class="number-minus" >
<u-icon name="minus" color="#FFFFFF" size="32"></u-icon> <u-icon name="minus" color="#FFFFFF" size="32"></u-icon>
</view> </view>
<text slot="input" class="number-input">{{buyNum}}</text> <text slot="input" class="number-input">{{item.buyNum}}</text>
<view slot="plus" class="number-plus"> <view slot="plus" class="number-plus">
<u-icon name="plus" color="#FFFFFF" size="32"></u-icon> <u-icon name="plus" color="#FFFFFF" size="32"></u-icon>
</view> </view>
...@@ -138,33 +134,33 @@ ...@@ -138,33 +134,33 @@
</view> </view>
<!-- 有可用优惠券,并且未选中 --> <!-- 有可用优惠券,并且未选中 -->
<template v-if="couponData.masterSlaveCouponList&&couponData.masterSlaveCouponList.length>0&&!chooseCouponObj"> <template v-if="item.couponData.masterSlaveCouponList&&item.couponData.masterSlaveCouponList.length>0&&!item.chooseCouponObj">
<view> <view>
{{couponData.masterSlaveCouponList[0].couponName}} {{item.couponData.masterSlaveCouponList[0].couponName}}
</view> </view>
<view > <view >
未使用优惠券 未使用优惠券
</view> </view>
</template> </template>
<!-- 有可用优惠券 --> <!-- 有可用优惠券 -->
<template v-if="chooseCouponObj&&savedMoney>0"> <template v-if="item.chooseCouponObj&&item.savedMoney>0">
<view> <view>
{{chooseCouponObj.couponName}} {{item.chooseCouponObj.couponName}}
</view> </view>
<view style="font-size: 32rpx;"> <view style="font-size: 32rpx;">
<text style="font-size: 24rpx;position: relative;top: 6rpx;">¥</text> <text style="font-size: 24rpx;position: relative;top: 6rpx;">¥</text>
{{parseFloat(savedMoney.toFixed(2))}} {{parseFloat(item.savedMoney.toFixed(2))}}
</view> </view>
</template> </template>
<!-- 可用优惠券条件--> <!-- 可用优惠券条件-->
<template v-if="ableConpon"> <template v-if="item.ableConpon">
<view> <view>
{{ableConpon.couponName}} {{item.ableConpon.couponName}}
</view> </view>
<view> <view>
{{ableConpon.couponRule}} {{item.ableConpon.couponRule}}
</view> </view>
</template> </template>
<u-icon name="arrow-right" color="#3688FF"></u-icon> <u-icon name="arrow-right" color="#3688FF"></u-icon>
...@@ -217,12 +213,12 @@ ...@@ -217,12 +213,12 @@
</view> </view>
<!-- ---------------------------------------------游客信息-------------------------------------------- --> <!-- ---------------------------------------------游客信息-------------------------------------------- -->
<view class="middle-bottom" v-if="productIfo.tripTemplateFlag != 2"> <view class="middle-bottom" v-if="item.tripTemplateFlag != 2">
<view class="middle-visitor"> <view class="middle-visitor">
<view class="visitorTitle"> <view class="visitorTitle">
<text class="title-text"> 用户信息 </text> <text class="title-text"> 用户信息 </text>
<text> <text>
需填<text class="title-bold">{{ contactNum }}</text>位出行人 需填<text class="title-bold">{{item.contactNum }}</text>位出行人
<!-- <text class="title-bold" v-if="contactNum - chooseContact.length > 0">,还需{{ contactNum - chooseContact.length }}位</text> --> <!-- <text class="title-bold" v-if="contactNum - chooseContact.length > 0">,还需{{ contactNum - chooseContact.length }}位</text> -->
</text> </text>
</view> </view>
...@@ -251,40 +247,40 @@ ...@@ -251,40 +247,40 @@
<text style="margin-left:16rpx;">新增</text> <text style="margin-left:16rpx;">新增</text>
</view> </view>
<view class="visitorEdit" v-show="chooseContact.length > 0"> <view class="visitorEdit" v-show="item.chooseContact.length > 0">
<view class="edit-list" v-for="(item, index) of chooseContact" :key="item.id"> <view class="edit-list" v-for="(item2, index) of item.chooseContact" :key="item.id">
<view @click="delChooseContact(item, index)"> <view @click="delChooseContact(item2, index)">
<u-icon name="close-circle" color="#3688ff" size="40"></u-icon> <u-icon name="close-circle" color="#3688ff" size="40"></u-icon>
</view> </view>
<view> <view>
{{ item.name }} {{ item2.name }}
</view> </view>
<view> <view>
{{ item.credentialNumber ? item.credentialNumber.substr(0, 3) + '****' + item.credentialNumber.substr(14, 4) : '' }} {{ item2.credentialNumber ? item2.credentialNumber.substr(0, 3) + '****' + item2.credentialNumber.substr(14, 4) : '' }}
</view> </view>
<view @click="showEdit(item)"> <view @click="showEdit(item2)">
<u-icon name="edit-pen-fill" color="#3688ff" size="48"></u-icon> <u-icon name="edit-pen-fill" color="#3688ff" size="48"></u-icon>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view class="middle-phone" v-if="productIfo.tripTemplateFlag != 2"> <!-- <view class="middle-phone" v-if="productIfo.tripTemplateFlag != 2">
<text> 联系电话: </text> <text> 联系电话: </text>
<input type="number" maxlength="11" placeholder="请输入联系电话" v-model.trim="ticketPhone" /> <input type="number" maxlength="11" placeholder="请输入联系电话" v-model.trim="ticketPhone" />
</view> </view> -->
</view> </view>
<!-- ---------------------------------------------产品押金部分---------------------------------------- --> <!-- ---------------------------------------------产品押金部分---------------------------------------- -->
<view class="productDeposit" v-if="productIfo.deposit"> <view class="productDeposit" v-if="item.deposit">
<view> <view>
{{ productIfo.name }} {{ item.name }}
<text style="color: #FC6703;margin-left: 10rpx;">押金</text> <text style="color: #FC6703;margin-left: 10rpx;">押金</text>
</view> </view>
<view style="color: #FC6703"> {{ productIfo.deposit }}元 </view> <view style="color: #FC6703"> {{ item.deposit }}元 </view>
</view> </view>
</view> </view>
...@@ -303,9 +299,9 @@ ...@@ -303,9 +299,9 @@
</view> </view>
<view class="bottom-btn" :style="{ background: payBackground }"> <view class="bottom-btn" :style="{ background: payBackground }">
<text v-if="productIfo.status == 1">已下架</text> <text v-if="orderStatus == 1">已下架</text>
<text v-if="parseInt(maxBookNum) <1" style="background: #c0c0c0">暂无库存</text> <text v-if="parseInt(maxBookNum) <1" style="background: #c0c0c0">暂无库存</text>
<text v-if="productIfo.status != 1 && parseInt(maxBookNum) >= 1" @click="goPay()">去支付</text> <text v-if="orderStatus!= 1 && parseInt(maxBookNum) >= 1" @click="goPay()">去支付</text>
</view> </view>
</view> </view>
</view> </view>
...@@ -391,7 +387,6 @@ export default { ...@@ -391,7 +387,6 @@ export default {
}, },
data() { data() {
return { return {
defaultAreaCode: '', //默认站点
sortArr: [], //多个站点排号信息列表 sortArr: [], //多个站点排号信息列表
sortIfo: '', //单个站点排号信息 sortIfo: '', //单个站点排号信息
sortInforPop: false, //一个站点时获取排队信息弹窗 sortInforPop: false, //一个站点时获取排队信息弹窗
...@@ -399,34 +394,18 @@ export default { ...@@ -399,34 +394,18 @@ export default {
showArea: false, //控制选择站点显示隐藏 showArea: false, //控制选择站点显示隐藏
showOpenArea: false, //是否可以显示选择站点 showOpenArea: false, //是否可以显示选择站点
chooseDate: '', //选择的日期 chooseDate: '', //选择的日期
active: 10000, //日期下标
timeActive: 10000, //时间下标,默认不选中 timeActive: 10000, //时间下标,默认不选中
buyNum: 1, //订单数量
maxBookNum: 999, //最大预订数量
dateList: [], //日期列表
timeList: [], //时间列表
buyKnowData: '', //购买须知数据 buyKnowData: '', //购买须知数据
editContact: '', //编辑联系人传值对象 editContact: '', //编辑联系人传值对象
productId: '', //产品Id
merchantId: '', //商户Id merchantId: '', //商户Id
ticketPhone: '', //联系电话 ticketPhone: '', //联系电话
productIfo: '', //初始化产品基本信息
originalPrice: 0, //原价单价
sellingPrice: 0, //卖价单价
interfaceCode: '', //接口编号 interfaceCode: '', //接口编号
merchantCode: '', //商户code
productCode: '', //产品code productCode: '', //产品code
contactTotal: [], //所有联系人列表
chooseContact: [], //选中的游客信息列表 chooseContact: [], //选中的游客信息列表
contactNum: 1, //需要选择几位联系人数量
cruisePlanId: '', //班次Id cruisePlanId: '', //班次Id
chooseTimeData: '', //选中的时间传给子组件
timeNumber: '', //当前时间转化为数字 timeNumber: '', //当前时间转化为数字
startDate: '', //开始日期
endDate: '', //结束日期
startPlayTime: '', //开始时间 startPlayTime: '', //开始时间
endPlayTime: '', //结束时间 endPlayTime: '', //结束时间
areaObj: '', //区域组件的传值
templateList: [], //该产品联系人必须要填写的信息 templateList: [], //该产品联系人必须要填写的信息
timeFlag: '', //setTimeout函数 timeFlag: '', //setTimeout函数
savedMoney: 0, //优惠价格 savedMoney: 0, //优惠价格
...@@ -438,7 +417,6 @@ export default { ...@@ -438,7 +417,6 @@ export default {
productDepositTotal: 0, //产品总押金 productDepositTotal: 0, //产品总押金
orderSource: '', //订单来源 1公众号平台、2公众号组合页面1、3公众号组合页面2、4胖丁伙伴app、5第三方自助机、6第三方票房窗口 orderSource: '', //订单来源 1公众号平台、2公众号组合页面1、3公众号组合页面2、4胖丁伙伴app、5第三方自助机、6第三方票房窗口
thirdOpenid: '', //第三方openid thirdOpenid: '', //第三方openid
beforeBookDays: '', //需提前预定天数
companyId: '', //公司Id companyId: '', //公司Id
docQuery: '', //元素变量 docQuery: '', //元素变量
payBackground: '', //支付按钮背景颜色 payBackground: '', //支付按钮背景颜色
...@@ -448,6 +426,13 @@ export default { ...@@ -448,6 +426,13 @@ export default {
couponData:[], //所有劵数据 couponData:[], //所有劵数据
chooseCouponObj: '', //默认选中最优价格优惠券 chooseCouponObj: '', //默认选中最优价格优惠券
ableConpon: '', //没有可用优惠券时,达到一定条件可用,显示达到的条件 ableConpon: '', //没有可用优惠券时,达到一定条件可用,显示达到的条件
productIdList:[],//产品id列表入参
productList:[],//初始化产品数据
orderStatus:'',//上下架状态,任何一个产品状态为下架,该状态为下架
chooseTimeList:[],//选中产品时间列表
chooseTimeData: '', //选中的时间传给子组件
moreDateIndex:0,//点击的更多日期下标
dateList:[],//点击更多日期时对应的日期列表
} }
}, },
onLoad(option) { onLoad(option) {
...@@ -456,8 +441,14 @@ export default { ...@@ -456,8 +441,14 @@ export default {
this.companyId = option.companyId || '' this.companyId = option.companyId || ''
this.orderSource = option.orderSource || '' this.orderSource = option.orderSource || ''
this.thirdOpenid = option.thirdOpenid || '' //第三方openid this.thirdOpenid = option.thirdOpenid || '' //第三方openid
this.productId = option.productId || ''
this.merchantId = option.merchantId || '' this.merchantId = option.merchantId || ''
let idList=JSON.parse(option.productIdList)
this.productIdList=idList.map((item)=>{
return {productId:item}
})
console.log(this.productIdList)
this.initData() //页面初始化数据 this.initData() //页面初始化数据
this.docQuery = uni.createSelectorQuery().in(this) this.docQuery = uni.createSelectorQuery().in(this)
}, },
...@@ -474,7 +465,7 @@ export default { ...@@ -474,7 +465,7 @@ export default {
if (this.chooseService[i].depositType == 1) { if (this.chooseService[i].depositType == 1) {
//等于1,押金金额跟数量没关系 //等于1,押金金额跟数量没关系
singleProduct = this.chooseService[i].deposit singleProduct = this.chooseService[i].deposit
} else if (this.chooseService[i].depositType == 2) { } else if (this.chooseService[i].depositType == 2){
//等于2,押金单价乘购买数量 //等于2,押金单价乘购买数量
singleProduct = parseFloat((this.chooseService[i].deposit * this.buyNum).toFixed(2)) singleProduct = parseFloat((this.chooseService[i].deposit * this.buyNum).toFixed(2))
} }
...@@ -560,52 +551,74 @@ export default { ...@@ -560,52 +551,74 @@ export default {
showDetail() { showDetail() {
this.$refs.detail.showPop = true this.$refs.detail.showPop = true
}, },
//---展示日历 //---展示日历---已修改
showCalendar() { showCalendar(index) {
// if(!this.productList[index].chooseDate){//没有选择时,默认第一个日期
// this.productList[index].chooseDate=this.productList[index].priceStockList[0].startTime.substr(0,10)
// }
// this.$refs.calendar.getDefaultDate(this.productList[index].chooseDate)//日历组件选中日期
this.moreDateIndex=index
this.dateList=this.productList[index].priceStockList
this.$refs.calendar.show = true this.$refs.calendar.show = true
}, },
//---日期选择 //---日期选择---已改
dateChoose(index) { dateChoose(item,item2,index) {
this.active = index //修改选中样式 item.active=index//修改选中样式
this.maxBookNum = Math.min(this.dateList[index].surplus, this.productIfo.maxBookNum) //剩余量变化 item.maxBookNum=Math.min(item2.maxBookNum,item2.surplus) //剩余量变化
this.originalPrice = this.dateList[index].originalPrice //原价变化 item.originalPrice=item2.originalPrice//产品原价为当前选中日期的原价
this.sellingPrice = this.dateList[index].sellingPrice //卖家变化 item.sellingPrice=item2.sellingPrice//产品卖价为当前选中日期的卖价
this.chooseDate = this.dateList[index].startTime.substr(0, 10) //日历组件选中日期 item.chooseDate=item2.startTime.substr(0,10)
this.endDate = this.dateList[index].endTime //开始日期 this.$refs.calendar.getDefaultDate(item.chooseDate)//日历组件选中日期
this.startDate = this.dateList[index].startTime //结束日期 item.endDate=item2.endTime//开始日期
this.$refs.calendar.defaultDate = this.chooseDate item.startDate=item2.startTime//结束日期
if (this.productIfo.productType == 3) { this.chooseTimeData=''//清除之前选中的时间
//如果为班次票,点击时,请求班次票接口 if(item.productType==3){
this.cruisePlanId = '' //清空班次id //productType=3为场次票
this.timeActive = 10000 item.cruisePlanId=''
uni.$u.throttle(this.getTimeStock, 3000) item.timeActive=10000
this.timeActive=10000
uni.$u.throttle(this.getTimeStock(item), 3000)
} }
this.initCoupon()
// this.computedPrice()
// this.initCoupon(Item.id,Item.buyNum,Item.sellingPrice,Item.merchantId,Index)
// this.$forceUpdate()
}, },
//---日历确认事件 //---日历确认事件---已改好
dateConfig(data) { dateConfig(data) {
let index = this.dateList.findIndex(item => { let index=this.moreDateIndex
return item.startTime.substr(0, 10) == data let index2=this.productList[index].priceStockList.findIndex(item=>{
return item.startTime.substr(0,10)==data
}) })
this.dateChoose(index) //选中确认的日期 let item=this.productList[index]
let item2=item.priceStockList[index2]
this.dateChoose(item,item2,index) //选中确认的日期
this.docQuery.selectAll('.date-list').boundingClientRect(data => { this.docQuery.selectAll('.date-list').boundingClientRect(data => {
this.dateScroll = (data[index].width + 4) * index this.dateScroll = (data[index].width + 4) * index
}).exec() }).exec()
}, },
//---展示更多时间 //---展示更多时间---已改好
showTime() { showTime(item,index) {
this.chooseTimeList=item.timeList
this.moreTimeIndex=index
if(item.timeActive>=0){
this.timeActive=item.timeActive//组件的默认下标
}else{
this.timeActive=10000
}
this.$refs.times.showPop = true this.$refs.times.showPop = true
}, },
//---时间选择 //---时间选择---已改好,数据更新需要测试
chooseTime(i) { chooseTime(item,item2,index) {
if(this.timeList[i].copyLast!='售罄'){ if(item2.copyLast!='售罄'){
this.timeActive = i item.timeActive=index
this.cruisePlanId = this.timeList[i].cruisePlanId //获取班次Id item.cruisePlanId=item2.cruisePlanId//获取班次Id
this.chooseTimeData = this.timeList[i].startPlanTime this.chooseTimeData=item2.startPlanTime
this.maxBookNum = Math.min(this.timeList[i].last, this.productIfo.maxBookNum) //获取剩余库存 item.maxBookNum=Math.min(item.maxBookNum,item2.last)
//如果为班次票,开始时间为班次时间的开始时间,结束时间为班次时间的结束时间,班次时间的结束时间为空时,结束时间为班次时间的开始时间 //如果为场次票,开始时间为班次时间的开始时间,结束时间为班次时间的结束时间,班次时间的结束时间为空时,结束时间为班次时间的开始时间
this.startPlayTime = this.timeList[i].startPlanTime item.startPlayTime=item2.startPlanTime
this.endPlayTime = this.timeList[i].endPlanTime || this.timeList[i].startPlanTime item.endPlayTime=item2.endPlanTime||item2.startPlanTime
// this.$forceUpdate()
} }
}, },
//---时间确认事件 //---时间确认事件
...@@ -641,6 +654,33 @@ export default { ...@@ -641,6 +654,33 @@ export default {
showContacts() { showContacts() {
this.$refs.contactList.showPop = true this.$refs.contactList.showPop = true
}, },
//---计算价格
computedPrice(){
let savedMoney=0
let original=0
let sell=0
let deposit=0
this.productDepositTotal=0
this.productList.forEach((item)=>{
original+=item.originalPrice*item.buyNum
sell+=item.sellingPrice*item.buyNum
if(item.chooseCouponObj){
if(item.chooseCouponObj.slaveList&&item.chooseCouponObj.slaveList.length>0){
savedMoney+=item.chooseCouponObj.slaveList[0].savedMoney
}else{
savedMoney+=item.chooseCouponObj.savedMoney
}
}
if(item.depositType==1){//等于1,押金金额跟数量没关系
deposit=item.deposit
}else if(item.depositType==2){//等于2,押金单价乘购买数量
deposit=item.deposit*item.buyNum
}
this.productDepositTotal+=deposit
})
this.originalTotal=parseFloat((original+this.productDepositTotal).toFixed(2))||0 //产品总价+产品押金
this.sellTotal=parseFloat((sell+this.productDepositTotal-savedMoney).toFixed(2))||0
},
//---游客选择 //---游客选择
visitorChoose(i) { visitorChoose(i) {
let chooseList = this.chooseContact let chooseList = this.chooseContact
...@@ -697,62 +737,58 @@ export default { ...@@ -697,62 +737,58 @@ export default {
this.initCoupon() this.initCoupon()
}, 1500) }, 1500)
}, },
//---展示购票须知 //---展示购票须知---已修改
showBuyKnow() { showBuyKnow(index) {
this.buyKnowData=this.productList[index]
this.$refs.buyKnow.showPop = true this.$refs.buyKnow.showPop = true
}, },
//---页面初始化数据,获取产品基本信息 //---页面初始化数据,获取产品基本信息---已修改
initData() { initData() {
let data = { let data={
id: this.productId //产品id productList:this.productIdList,//产品id列表
} }
uni.showLoading({ uni.showLoading({
title: '加载中', title: '加载中',
mask:true mask:true
}) })
this.$request('scenic/groupGood/loadProduct', data).then(res => { this.$request('scenic/groupGood/loadProductList', data).then(res => {
if (res.code == '00') { if (res.code == '00'){
this.productIfo = res.data this.productList=res.data||[]
this.defaultAreaCode = this.productIfo.defaultAreaCode || '' this.productIdList=this.productList.map((item)=>{//id集合用于请求价格库存列表接口
//通过默认站点找到站点数据 return item.id
if (this.defaultAreaCode) { })
this.productIfo.productAreaList.forEach(item => {
if (item.areaCode == this.defaultAreaCode) { for(let i=0;i<this.productList.length;i++){
this.areaObj = {} let item=this.productList[i]
this.areaObj.areaCode = item.areaCode if(item.defaultAreaCode){
this.areaObj.areaName = item.areaName item.areaObj={}
} item.areaObj.areaCode=item.areaCode
}) item.areaObj.areaName=item.areaName
} }else{
this.merchantCode = this.productIfo.merchantVo.code, //商户code item.areaObj={}
this.productId = res.data.id//产品id变化,重新赋值产品id }
this.merchantId = res.data.merchantId //重新赋值商户id item.active=0//默认选中第一个日期
this.beforeBookDays = res.data.beforeBookDays || 0 //提前预定天数 item.buyNum=1,//默认为1
this.buyKnowData = res.data //购买须知,传给子组件 item.contactTotal=[]//选中的游客信息列表
this.serviceList = res.data.loadProductResVoList //额外服务 item.contactNum=1//需要选择几位联系人数量
//this.chooseService=res.data.data.loadProductResVoList//默认全部选中 if(item.status==1){//任何一个产品下架,该组合票为下架状态
if (this.productIfo.status == 1) { this.orderStatus=1
//下架状态
this.payBackground = '#C0C0C0' this.payBackground = '#C0C0C0'
return
} }
if (this.productIfo.productType != 3) { if(item.productType!=3){//不为班次票时,开始时间为当前时间,结束时间为23:59:59
//不为班次票时,开始时间为当前时间,结束时间为23:59:59 item.startPlayTime=new Date().Format('hh:mm:ss')
this.startPlayTime = new Date().Format('hh:mm:ss') item.endPlayTime='23:59:59'
this.endPlayTime = '23:59:59'
} }
if (this.productIfo.tripTemplateResList.length > 0) {
//用于判断选中的联系人信息是否填写完善
this.productIfo.tripTemplateResList.forEach(item => {
this.templateList.push(item.enumKey)
})
} }
this.getPriceList() this.getPriceList()
this.getDiscountPrice() //获取优惠价格 // this.getDiscountPrice() //获取优惠价格
if (this.productIfo.tripTemplateFlag != 2) { //---待处理
//等于2时不需要填写联系人信息和手机号码 // if (this.productIfo.tripTemplateFlag != 2) {
this.getContactList() // //等于2时不需要填写联系人信息和手机号码
} // this.getContactList()
// }
} else { } else {
uni.showToast({ uni.showToast({
title: res.message, title: res.message,
...@@ -761,90 +797,168 @@ export default { ...@@ -761,90 +797,168 @@ export default {
} }
}) })
}, },
//---获取产品价格库存列表 //---获取产品价格库存列表---已部分修改
getPriceList() { getPriceList() {
let data = { let data={
productId: this.productId //产品id productIds:this.productIdList,//产品id集合
} }
this.$request('scenic/user/product/priceStockList', data).then(res => { this.$request('scenic/user/product/groupPriceStockList', data).then(res => {
if (res.code == '00') { if (res.code == '00') {
this.dateList = res.data //日期列表 //所有产品的价格库存列表
if (this.dateList.length > 0) { let stockList=res.data
let time1 = this.dateList[0].startTime.substr(0, 10) + this.productIfo.bookTime //获取价格列表的第一个日期+预订最晚时间 this.productList.forEach(item=>{
let timeNum1 = parseInt(this.$commonjs.changeTime(time1)) //待处理
let time2 = new Date().Format('yyyy-MM-dd hh:mm:ss') // if(item.isFetch==1&&item.productAreaList.length>1){
let timeNum2 = parseInt(this.$commonjs.changeTime(time2)) //将当前时间转化为数字 // this.areaIndex=index
if (timeNum2 > timeNum1) { // this.merchantCode=this.productList[index].merchantVo.code
// this.sortUpDown()
//}else if(item.isFetch==1&&item.productAreaList.length==1){
// item.areaObj=item.productAreaList[0]
// }
//把价格列表合并到对应的产品上面
stockList.forEach(item2=>{
if(item.id==item2.productId){
item.priceStockList=item2.priceStockList||[]
}
})
})
let today = this.$commonjs.today() //今天
let tomorrow = this.$commonjs.tomorrow() //明天
let afterTomorrow = this.$commonjs.afterTomorrow() //后天
this.productList.forEach(item=>{
if(item.priceStockList.length>0){
//获取价格列表的第一个日期+预订最晚时间
let time1=item.priceStockList[0].startTime.substr(0,10)+item.bookTime
let timeNum1=parseInt(this.$commonjs.changeTime(time1))
let time2=new Date().Format('yyyy-MM-dd hh:mm:ss')
let timeNum2 =parseInt(this.$commonjs.changeTime(time2)) //将当前时间转化为数字
if(timeNum2>timeNum1){
//如果当前时间大于价格列表第一个日期+预订最晚时间,第一个价格不显示 //如果当前时间大于价格列表第一个日期+预订最晚时间,第一个价格不显示
this.dateList.splice(0, 1) item.priceStockList.splice(0,1)
} }
this.dateList.forEach((item, index) => { item.priceStockList.forEach((item2, index) => {
//价格上面时间小于当前时间加上需预定天数之后的需删除 //价格上面时间小于当前时间加上需预定天数之后的需删除
let date = new Date() let date = new Date()
date.setDate(date.getDate() + this.beforeBookDays) date.setDate(date.getDate() + item2.beforeBookDays)
let newDate = date.Format('yyyy-MM-dd') let newDate = date.Format('yyyy-MM-dd')
let priceTime = this.$commonjs.changeTime(item.endTime.substr(0, 10)) let priceTime = this.$commonjs.changeTime(item2.endTime.substr(0, 10))
let newTime = this.$commonjs.changeTime(newDate) let newTime = this.$commonjs.changeTime(newDate)
if (priceTime < newTime) { if (priceTime < newTime) {
delete this.dateList[index] delete item.priceStockList[index]
} }
}) })
this.dateList = this.dateList.filter(val => { item.priceStockList = item.priceStockList.filter(val => {
return val return val
}) })
if (this.dateList.length == 0) { if(item.priceStockList.length==0){
uni.showToast({ uni.showToast({title: '没有库存',icon: 'none'})
title: '没有库存',
icon: 'none'
})
this.showArea = false
this.payBackground = '#C0C0C0' this.payBackground = '#C0C0C0'
return return
} }
if (this.productIfo.isFetch == 1) { item.startDate=item.priceStockList[0].startTime//开始日期
this.sortUpDown() item.endDate=item.priceStockList[0].endTime//结束日期
} item.originalPrice=item.priceStockList[0].originalPrice//原价
if (this.dateList.length == 1 && this.beforeBookDays == 0) { item.sellingPrice=item.priceStockList[0].sellingPrice//卖价
//长度为1而且只能预订当天,默认选中第一个日期 item.maxBookNum=Math.min(item.priceStockList[0].surplus,item.maxBookNum)//最大购买数量
//真机模拟的时候手机端不显示今天,明天后天,延迟执行 item.priceStockList.forEach(item2=>{//循环单个产品的价格列表
setTimeout(item => { item2.week='日一二三四五六'.charAt(new Date(item2.startTime.substr(0,10)).getDay())
this.$refs.calendar.defaultDate = this.dateList[0].startTime.substr(0, 10) if(item2.startTime.substr(0,10)==today){
}, 1000) item2.week='今天'
this.maxBookNum = Math.min(this.dateList[0].surplus, this.productIfo.maxBookNum) //剩余量
this.startDate = this.dateList[0].startTime //开始日期
this.endDate = this.dateList[0].endTime //结束日期
this.originalPrice = this.dateList[0].originalPrice //原价
this.sellingPrice = this.dateList[0].sellingPrice //卖价
this.active = 0
if (this.productIfo.productType == 3) {
//如果为班次票,请求班次票接口
this.getTimeStock()
} }
this.initCoupon() //获取优惠券 if(item2.startTime.substr(0,10)==tomorrow){
item2.week='明天'
} }
} else { if(item2.startTime.substr(0,10)==afterTomorrow){
uni.showToast({ item2.week='后天'
title: '没有库存',
icon: 'none'
})
this.showArea = false
this.payBackground = '#C0C0C0'
} }
let today = this.$commonjs.today() //今天 })
let tomorrow = this.$commonjs.tomorrow() //明天 //如果是班次票,并且班次票价格列表不为空
let afterTomorrow = this.$commonjs.afterTomorrow() //后天 if(item.productType==3&&item.priceStockList.length>0){
this.dateList.forEach((item, index) => { this.getTimeStock(item)
item.week = '日一二三四五六'.charAt(new Date(item.startTime.substr(0, 10)).getDay())
if (item.startTime.substr(0, 10) == today) {
item.week = '今天'
}
if (item.startTime.substr(0, 10) == tomorrow) {
item.week = '明天'
} }
if (item.startTime.substr(0, 10) == afterTomorrow) { }else{
item.week = '后天' uni.showToast({title: '没有库存',icon: 'none'})
this.payBackground = '#C0C0C0'
} }
}) })
// this.dateList = res.data //日期列表
// if (this.dateList.length > 0) {
// let time1 = this.dateList[0].startTime.substr(0, 10) + this.productIfo.bookTime //获取价格列表的第一个日期+预订最晚时间
// let timeNum1 = parseInt(this.$commonjs.changeTime(time1))
// let time2 = new Date().Format('yyyy-MM-dd hh:mm:ss')
// let timeNum2 = parseInt(this.$commonjs.changeTime(time2)) //将当前时间转化为数字
// if (timeNum2 > timeNum1) {
// //如果当前时间大于价格列表第一个日期+预订最晚时间,第一个价格不显示
// this.dateList.splice(0, 1)
// }
// this.dateList.forEach((item, index) => {
// //价格上面时间小于当前时间加上需预定天数之后的需删除
// let date = new Date()
// date.setDate(date.getDate() + this.beforeBookDays)
// let newDate = date.Format('yyyy-MM-dd')
// let priceTime = this.$commonjs.changeTime(item.endTime.substr(0, 10))
// let newTime = this.$commonjs.changeTime(newDate)
// if (priceTime < newTime) {
// delete this.dateList[index]
// }
// })
// this.dateList = this.dateList.filter(val => {
// return val
// })
// if (this.dateList.length == 0) {
// uni.showToast({
// title: '没有库存',
// icon: 'none'
// })
// this.showArea = false
// this.payBackground = '#C0C0C0'
// return
// }
// if (this.productIfo.isFetch == 1) {
// this.sortUpDown()
// }
// if (this.dateList.length == 1 && this.beforeBookDays == 0) {
// //长度为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.startDate = this.dateList[0].startTime //开始日期
// this.endDate = this.dateList[0].endTime //结束日期
// this.originalPrice = this.dateList[0].originalPrice //原价
// this.sellingPrice = this.dateList[0].sellingPrice //卖价
// this.active = 0
// if (this.productIfo.productType == 3) {
// //如果为班次票,请求班次票接口
// this.getTimeStock()
// }
// this.initCoupon() //获取优惠券
// }
// } else {
// uni.showToast({
// title: '没有库存',
// icon: 'none'
// })
// this.showArea = false
// this.payBackground = '#C0C0C0'
// }
// let today = this.$commonjs.today() //今天
// let tomorrow = this.$commonjs.tomorrow() //明天
// let afterTomorrow = this.$commonjs.afterTomorrow() //后天
// this.dateList.forEach((item, index) => {
// item.week = '日一二三四五六'.charAt(new Date(item.startTime.substr(0, 10)).getDay())
// if (item.startTime.substr(0, 10) == today) {
// item.week = '今天'
// }
// if (item.startTime.substr(0, 10) == tomorrow) {
// item.week = '明天'
// }
// if (item.startTime.substr(0, 10) == afterTomorrow) {
// item.week = '后天'
// }
// })
} else { } else {
uni.showToast({ uni.showToast({
title: res.message, title: res.message,
...@@ -886,14 +1000,14 @@ export default { ...@@ -886,14 +1000,14 @@ export default {
} }
}) })
}, },
//---获取班次票 //---获取班次票---已修改
getTimeStock() { getTimeStock(item) {
let data = { let data = {
endDate: this.endDate, //结束日期 endDate: item.endDate, //结束日期
startDate: this.startDate, //开始日期 startDate: item.startDate, //开始日期
interfaceCode: this.productIfo.merchantVo.interfaceCompanyId, //接口编号 interfaceCode: item.merchantVo.interfaceCompanyId, //接口编号
merchantCode: this.merchantCode, //商户code merchantCode: item.merchantVo.code, //商户code
productCode: this.productIfo.code //产品code productCode: item.code //产品code
} }
uni.showLoading({ uni.showLoading({
title: '加载中', title: '加载中',
...@@ -901,20 +1015,21 @@ export default { ...@@ -901,20 +1015,21 @@ export default {
}) })
this.$request('distribution/distribution/getTimeStock', data).then(res => { this.$request('distribution/distribution/getTimeStock', data).then(res => {
if (res.code == '00') { if (res.code == '00') {
this.timeList = res.data item.timeList=res.data
this.timeList.forEach((item, index) => {
//增加一个时间Number字段,用于判断当前时间大于班次结束时间时,显示售罄 //增加一个时间Number字段,用于判断当前时间大于班次结束时间时,显示售罄
let text=parseFloat((item.last/item.total).toFixed(2))||0 item.timeList.forEach(item2=>{
let text=parseFloat((item2.last/item2.total).toFixed(2))||0
if(text>0.4){ if(text>0.4){
item.copyLast='余票充足' item2.copyLast='余票充足'
}else{ }else{
item.copyLast=item.last item2.copyLast=item2.last
} }
item.timeNumber = parseInt(this.$commonjs.changeTime(item.planDate.substr(0, 10) + item.endPlanTime)) item2.timeNumber=parseInt(this.$commonjs.changeTime(item2.planDate.substr(0,10)+item2.endPlanTime))
if (this.timeNumber > item.timeNumber || item.last <= 0) { if(this.timeNumber>item2.timeNumber||item2.last<=0){
item.copyLast='售罄' item2.copyLast='售罄'
} }
}) })
// this.$forceUpdate()
} else { } else {
uni.showToast({ uni.showToast({
title: res.message, title: res.message,
......
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