Browse Source

调整演出日期由后端传的方式

gcz 1 year ago
parent
commit
e6a9a8d326
3 changed files with 37 additions and 11 deletions
  1. 1 1
      common/config.js
  2. 4 2
      pages/bookticket.vue
  3. 32 8
      pages/ticketlist.vue

+ 1 - 1
common/config.js

@@ -12,7 +12,7 @@
 // }
 
 //64
-let baseUrl='https://scenicadmin.hw.hongweisoft.com/serviceapi';
+let baseUrl='https://greatadmin.dev.gztjy.top/serviceapi';
 let upFileUrl='http://fileupload.hw.hongweisoft.com/upload/single/minio';
 // let staticUrl='http://res.hw.hongweisoft.com/xushuo/';
 let staticUrl='https://miniores.hw.hongweisoft.com/greattransition/staticfile';

+ 4 - 2
pages/bookticket.vue

@@ -155,7 +155,7 @@
 				performId:'',
 				performInfo:{},
 				pageData:{},//上个页面传过来的数据
-				pageContent:{purchaser:{},ticketNotice:''},//页面信息
+				pageContent:{purchaser:{},ticketNotice:'',viewerList:[]},//页面信息
 				ticketNotice:'aaa',
 				cansubmit:true,
 				staticUrl:this.$commonConfig.staticUrl,
@@ -215,12 +215,14 @@
 			},
 			getMemberAll(){
 				let that = this;
-				const userId = this.vuex_member_info.id;
+				// const userId = this.vuex_member_info.id;
+				const userId = this.pageContent.viewerList[0]?.id;
 				this.$u.api.selectMemberAll({userid:userId}).then(res=>{
 					// console.log('getMemberAll',res.data);
 					this.visitorList =  res.data.list;
 					console.log('this.visitorList',this.visitorList);
 					this.visitors = this.visitorList.filter(obj => obj.memberId==userId);
+					this.visitors = this.visitorList.filter(obj => that.selectedVisitor.includes(obj.id));
 					console.log('this.visitors',this.visitors);
 				}).catch(err=>{
 					console.log('getMemberAll',err);

+ 32 - 8
pages/ticketlist.vue

@@ -44,7 +44,7 @@
 					<view class="title">演出日期</view>
 					<view class="date-list u-flex">
 						<view class="date-item" :class="{active:dateIndex==index}" @click="dateClick(index)" v-for="(date,index) in dateList" :key="index">
-							<view class="name">{{ date.name }}</view>
+							<view class="name">{{ date.name || ' ' }}</view>
 							<view class="date">{{ date.month }} - {{ date.day }}</view>
 						</view>
 						<view class="date-item more-date u-flex u-row-center" @click="calendarShow = true">
@@ -124,6 +124,7 @@
 		</view>
 		<u-calendar
 			ref="calendar"
+			:formatter="formatter"
 			:maxDate="maxDate"
 			:show="calendarShow" 
 			color="#EF1010"
@@ -167,6 +168,7 @@
 	month = month < 10 ? `0${month}` : month
 	const date = d.getDate()
 	// 日历
+	let parentThis= null;
 	export default {
 		mixins:[systemInfo],
 		data() {
@@ -195,12 +197,13 @@
 				posterSrc:'',
 				performInfo:{},//节目详情
 				formerNotice:{},//节目观影须知
-				
+				ticketDay:[{day:'2023-12-05',ishave:false},{day:'2023-12-06',ishave:false},{day:'2023-12-07',ishave:true},{day:'2023-12-08',ishave:false}],//有票的日期
 			}
 		},
 		onShow() {
 		},
 		onLoad(page) {
+			parentThis = this;
 			console.log('page',page);
 			this.performId = page.id;
 			this.getPerformData();
@@ -211,6 +214,10 @@
 			this.getPerformerNotice();
 
 		},
+		onReady() {
+			// 如果需要兼容微信小程序的话,需要用此写法
+			this.$refs.calendar.setFormatter(this.formatter);
+		},
 		methods: {
 			leftClick(e){
 				let pages = getCurrentPages();
@@ -270,17 +277,34 @@
 					console.log('getPoster',err);
 				})
 			},
-			setDate(firstDay){
+			 formatter: (day) => {
+				 // console.log('day',day);
+				 // console.log('thisthisthisthisthisthisthisthisthis',parentThis);
+				 // console.log('==================================',day.date.toISOString().split('T')[0]);
+				let ticket = parentThis.ticketDay.find(item => item.day === day.date.toISOString().split('T')[0]);
+				if(ticket&&ticket.ishave){
+					day.bottomInfo = '有票'
+					day.dot = true
+				}else if(ticket){
+					day.dot = true
+				}
+			    return day
+			  },
+			setDate(firstDay,isSelect){
+				if(this.ticketDay[0]&&!isSelect){
+					firstDay = new Date(this.ticketDay[0].day);
+				}
+				// console.log('this.dateListthis.dateListthis.dateListthis.dateList',this.dateList);
+				// 前端写演出日期(今天,明天,后天)
 				let today = firstDay;
 				let tomorrow = new Date();
 				tomorrow.setDate(today.getDate() + 1);
 				let afterTomorrow = new Date();
 				afterTomorrow.setDate(today.getDate() + 2);
-				
 				this.dateList = [
-				  { year: today.getFullYear(), month: today.getMonth() + 1, day: today.getDate(),name:'今天' },
-				  { year: tomorrow.getFullYear(), month: tomorrow.getMonth() + 1, day: tomorrow.getDate() ,name:'明天'},
-				  { year: afterTomorrow.getFullYear(), month: afterTomorrow.getMonth() + 1, day: afterTomorrow.getDate(),name:'后天' }
+				  { year: today.getFullYear(), month: today.getMonth() + 1, day: today.getDate(),name:'日期' },
+				  { year: tomorrow.getFullYear(), month: tomorrow.getMonth() + 1, day: tomorrow.getDate() ,name:'日期'},
+				  { year: afterTomorrow.getFullYear(), month: afterTomorrow.getMonth() + 1, day: afterTomorrow.getDate(),name:'日期' }
 				];
 					
 				this.getTimes()
@@ -295,7 +319,7 @@
 			},
 			confirmCalendar(e){
 				// console.log('confirmCalendar',e);
-				this.setDate( new Date(e) );
+				this.setDate( new Date(e),true );
 				this.dateIndex = 0;
 				// console.log('maxDate',this.maxDate);
 				// console.log('dateList',this.dateList);