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

组合下单开发

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