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

组合产品开发

parent 803fa637
......@@ -314,6 +314,9 @@ export default {
this.merchantId = option.merchantId || ''
},
onShow() {
//清空之前选中的数据
this.detailData=''
this.chooseProduct=[]
let token = uni.getStorageSync('token')
if (token) {
uni.getLocation({
......
<template>
<view class="orderBox">
<view class="head"> </view>
<view class="middle" v-for="(item,Index) in productList" :key='item.id'>
<view class="middle" v-for="(item,index) in productList" :key='item.id'>
<view class="middle-top">
<!-- --------------------------------------------产品信息部分------------------------------------- -->
<view class="middle-Product">
......@@ -56,7 +56,7 @@
<view class="title-text">游玩日期</view>
<view class="middle-Datelist">
<scroll-view class="date-content" scroll-x="true" :scroll-left="dateScroll" v-if="item.priceStockList&&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 class="date-list" v-for="(item2,index2) of item.priceStockList" :class="{ on:item.dateActive == 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 }}
......@@ -68,7 +68,7 @@
¥<text style="font-weight: bold;">{{ item2.sellingPrice }}</text>
</view>
<view v-if="active == index" class="date-icon">
<view v-if="item.dateActive == index2" class="date-icon">
<u-icon name="checkmark" color="#ffffff"></u-icon>
</view>
</view>
......@@ -87,7 +87,7 @@
<view class="middle-time" v-if="item.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">
<scroll-view class="time-content" scroll-x="true" :scroll-left="timeScroll" v-if="item.timeList&&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>
{{ item2.startPlanTime ? item2.startPlanTime.substr(0, 5) : '' }}
......@@ -184,11 +184,11 @@
<view
class="plus-list"
:class="{on:item.ifChoose}"
v-for="(item, index) of contactTotal.slice(0, 3)"
@click="visitorChoose(index)"
:key="index"
v-for="(item2, index2) of contactTotal.slice(0, 3)"
@click="visitorChoose(index2)"
:key="index2"
>
{{ item.name }}
{{ item2.name }}
<view v-if="item.ifChoose" class="date-icon">
<u-icon name="checkmark" color="#ffffff"></u-icon>
</view>
......@@ -490,19 +490,19 @@ export default {
// 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.$refs.calendar.setDefaultDate(this.productList[index].chooseDate)//日历组件选中日期
this.moreDateIndex=index
this.dateList=this.productList[index].priceStockList
this.$refs.calendar.show = true
this.$refs.calendar.showPop = true
},
//---日期选择---已改
dateChoose(item,item2,index) {
item.active=index//修改选中样式
item.dateActive=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)//日历组件选中日期
this.$refs.calendar.setDefaultDate(item.chooseDate)//日历组件选中日期
item.endDate=item2.endTime//开始日期
item.startDate=item2.startTime//结束日期
this.chooseTimeData=''//清除之前选中的时间
......@@ -513,8 +513,6 @@ export default {
this.timeActive=10000
uni.$u.throttle(this.getTimeStock(item), 3000)
}
// this.computedPrice()
// this.initCoupon(Item.id,Item.buyNum,Item.sellingPrice,Item.merchantId,Index)
// this.$forceUpdate()
},
......@@ -679,7 +677,7 @@ export default {
}else{
item.areaObj={}
}
item.active=0//默认选中第一个日期
item.dateActive=0//默认选中第一个日期
item.buyNum=1,//默认为1
item.contactTotal=[]//选中的游客信息列表
item.contactNum=1//需要选择几位联系人数量
......@@ -750,7 +748,7 @@ export default {
item.priceStockList.forEach((item2, index) => {
//价格上面时间小于当前时间加上需预定天数之后的需删除
let date = new Date()
date.setDate(date.getDate() + item2.beforeBookDays)
date.setDate(date.getDate() + item.beforeBookDays)
let newDate = date.Format('yyyy-MM-dd')
let priceTime = this.$commonjs.changeTime(item2.endTime.substr(0, 10))
let newTime = this.$commonjs.changeTime(newDate)
......
<template>
<u-calendar
:show="show"
:show="showPop"
@confirm="onConfirm"
@close="show=false"
@close="showPop=false"
:maxDate="maxDate"
:defaultDate="defaultDate"
:formatter='formatter'
......@@ -29,7 +29,7 @@ export default {
},
data() {
return {
show: false, //控制日历显示隐藏
showPop: false, //控制日历显示隐藏
defaultDate:'', //默认日期
maxDate:'',//最大日期
}
......@@ -40,7 +40,7 @@ export default {
methods: {
//---日期确认事件
onConfirm(date) {
this.show = false
this.showPop = false
this.$emit('dateConfig', date[0])
},
//---时间格式转换
......@@ -67,7 +67,16 @@ export default {
// }
return day
}
},
//---设置默认日期
setDefaultDate(val) {
this.defaultDate=val
// let dates = val.split('-')
// let year = parseInt(dates[0])
// let month = parseInt(dates[1]) - 1
// let day = parseInt(dates[2])
// this.defaultDate = new Date(year, month, day)
},
}
}
</script>
......
......@@ -562,7 +562,7 @@ export default {
},
//---展示日历
showCalendar() {
this.$refs.calendar.show = true
this.$refs.calendar.showPop = true
},
//---日期选择
dateChoose(index) {
......
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