gcz 1 week ago
parent
commit
7eafb73d41
4 changed files with 150 additions and 30 deletions
  1. 10 1
      center/order.vue
  2. 4 0
      center/orderdetails.vue
  3. 5 0
      common/apiurl.js
  4. 131 29
      pages/ticketlist.vue

+ 10 - 1
center/order.vue

@@ -93,7 +93,12 @@
 					0:[{name:'取消订单',fun:'cancelOrder',class:''},{name:'去支付',fun:'pay',class:'red'}],
 					0:[{name:'取消订单',fun:'cancelOrder',class:''},{name:'去支付',fun:'pay',class:'red'}],
 					1:[],
 					1:[],
 					2:[],
 					2:[],
-					3:[{name:'改签',fun:'rebook',class:'',condition: (item) => item.allowReSubmit === 1},{name:'查看原订单',fun:'viewOldOrder',class:'',condition: (item) => !!item.orgOrderId},{name:'出示二维码',fun:'goOrderDetails',class:'red'}],
+					3:[
+						{name:'改签',fun:'rebook',class:'',condition: (item) => item.allowReSubmit === 1},
+						{name:'升舱',fun:'upgrade',class:'',condition: (item) => item.allowReSubmit === 1},
+						{name:'查看原订单',fun:'viewOldOrder',class:'',condition: (item) => !!item.orgOrderId},
+						{name:'出示二维码',fun:'goOrderDetails',class:'red'},
+					],
 					//,{name:'评价',fun:'evaluate',class:'green'}
 					//,{name:'评价',fun:'evaluate',class:'green'}
 					4:[],
 					4:[],
 					5:[],
 					5:[],
@@ -255,6 +260,7 @@
 				  confirmReceipt:this.confirmReceipt,
 				  confirmReceipt:this.confirmReceipt,
 				  viewEvaluate:this.viewEvaluate,
 				  viewEvaluate:this.viewEvaluate,
 				  rebook:this.rebook,
 				  rebook:this.rebook,
+				  upgrade:this.upgrade,
 				  viewNewOrder:this.viewNewOrder,
 				  viewNewOrder:this.viewNewOrder,
 				  viewOldOrder:this.viewOldOrder,
 				  viewOldOrder:this.viewOldOrder,
 				};
 				};
@@ -378,6 +384,9 @@
 				// console.log('rebook',item);
 				// console.log('rebook',item);
 				uni.$u.route('pages/ticketlist',{performId:item.performId,orderId:item.id,fromPage:'rebook'})
 				uni.$u.route('pages/ticketlist',{performId:item.performId,orderId:item.id,fromPage:'rebook'})
 			},
 			},
+			upgrade(item){
+				uni.$u.route('pages/ticketlist',{performId:item.performId,orderId:item.id,fromPage:'rebook',isUpgrade:true})
+			},
 			viewOldOrder(item){
 			viewOldOrder(item){
 				console.log('viewOldOrder',item.orgOrderId);
 				console.log('viewOldOrder',item.orgOrderId);
 				uni.$u.route('/center/orderdetails', {
 				uni.$u.route('/center/orderdetails', {

+ 4 - 0
center/orderdetails.vue

@@ -96,6 +96,7 @@
 					订单信息
 					订单信息
 					<view class="btn-box">
 					<view class="btn-box">
 						<text class="btn" v-if="orderDetails.status==3&&orderDetails.allowReSubmit==1" @click="rebook">改签</text>
 						<text class="btn" v-if="orderDetails.status==3&&orderDetails.allowReSubmit==1" @click="rebook">改签</text>
+						<text class="btn" v-if="orderDetails.status==3&&orderDetails.allowReSubmit==1" @click="upgrade">升舱</text>
 						<text class="btn" v-if="orderDetails.status==3&&orderDetails.ifReSubmit!==1" @click="refund">申请退款</text>
 						<text class="btn" v-if="orderDetails.status==3&&orderDetails.ifReSubmit!==1" @click="refund">申请退款</text>
 						<text class="btn" v-if="orderDetails.status==7||orderDetails.newOrderId" @click="invoice">申请发票</text>
 						<text class="btn" v-if="orderDetails.status==7||orderDetails.newOrderId" @click="invoice">申请发票</text>
 						<text class="btn" v-if="orderDetails.orgOrderId" @click="viewOldOrder">查看原订单</text>
 						<text class="btn" v-if="orderDetails.orgOrderId" @click="viewOldOrder">查看原订单</text>
@@ -722,6 +723,9 @@
 			rebook(){
 			rebook(){
 				uni.$u.route('pages/ticketlist',{performId:this.orderDetails.performId,orderId:this.orderDetails.id,fromPage:'rebook'})
 				uni.$u.route('pages/ticketlist',{performId:this.orderDetails.performId,orderId:this.orderDetails.id,fromPage:'rebook'})
 			},
 			},
+			upgrade(item){
+				uni.$u.route('pages/ticketlist',{performId:item.orderDetails.performId,orderId:item.orderDetails.id,fromPage:'rebook',isUpgrade:true})
+			},
 			// 显示退款信息弹窗
 			// 显示退款信息弹窗
 			showRefundInfoPopup(item) {
 			showRefundInfoPopup(item) {
 				this.hideMainQR = true;
 				this.hideMainQR = true;

+ 5 - 0
common/apiurl.js

@@ -132,6 +132,11 @@ const apiurl = {
 		url: '/order/orderResubmit/resubmitInfo',
 		url: '/order/orderResubmit/resubmitInfo',
 		type: 'get'
 		type: 'get'
 	},
 	},
+	// 选择区域(获取改签信息)
+	selectRegionUpgrade: {
+		url: '/merchantPerformTime/getTimeSeatTypeAll',
+		type: 'get'
+	},
 	// 订单改签
 	// 订单改签
 	rebookApi: {
 	rebookApi: {
 		url: '/order/orderResubmit/reSubmit',
 		url: '/order/orderResubmit/reSubmit',

+ 131 - 29
pages/ticketlist.vue

@@ -74,12 +74,14 @@
 								{{ performDateList.find(item => item.performDate === date.fullDay ) !== undefined?'有演出':'无演出' }}
 								{{ performDateList.find(item => item.performDate === date.fullDay ) !== undefined?'有演出':'无演出' }}
 							</view> -->
 							</view> -->
 							<view class="name">
 							<view class="name">
-								{{date.fullDay|checkWeekDate}}
+								{{checkWeekDate(date.fullDay)}}
 							</view>
 							</view>
 							<view class="date">{{ date.month }} - {{ date.day }}</view>
 							<view class="date">{{ date.month }} - {{ date.day }}</view>
 							<image class="selected-img" :src="staticUrl+'/img/selected.png'"></image>
 							<image class="selected-img" :src="staticUrl+'/img/selected.png'"></image>
 						</view>
 						</view>
-						<view class="date-item more-date u-flex u-row-center" @click="calendarShow = true">
+						<view class="date-item more-date u-flex u-row-center" 
+							v-if="!isUpgrade"
+							@click="calendarShow = true">
 							<view class="text">
 							<view class="text">
 								<view class="">更多</view>
 								<view class="">更多</view>
 								<view class="">日期</view>
 								<view class="">日期</view>
@@ -207,7 +209,7 @@
 							</view>
 							</view>
 						</view>
 						</view>
 						<view class="submit-btn" :class="{active: hasSelectedTicket}" @click="handelRebook">
 						<view class="submit-btn" :class="{active: hasSelectedTicket}" @click="handelRebook">
-							{{hasSelectedTicket ? '确认改签' : '请选择票'}}
+							{{hasSelectedTicket ? (isUpgrade ? '确认升舱' : '确认改签') : '请选择票'}}
 						</view>
 						</view>
 					</view>
 					</view>
 					<view class="inner" v-else>
 					<view class="inner" v-else>
@@ -385,6 +387,7 @@
 				newOrderId:'',
 				newOrderId:'',
 				originOrderInfo:{},
 				originOrderInfo:{},
 				reSubmitInfo:null,
 				reSubmitInfo:null,
+				isUpgrade:false,
 			}
 			}
 		},
 		},
 		onShow() {
 		onShow() {
@@ -423,15 +426,15 @@
 				this.performId = page.performId;
 				this.performId = page.performId;
 				this.orderId = page.orderId;
 				this.orderId = page.orderId;
 				this.fromPage = page.fromPage;
 				this.fromPage = page.fromPage;
-				sharePath=`/pages/ticketlist?id=${page.id}`;
+				this.isUpgrade = page.isUpgrade;
+				
+				// 先获取订单信息
+				this.getOrderInfo();
+				
+				// 其他初始化
 				this.getPerformData();
 				this.getPerformData();
-				// this.getSystemInfo();
-				let today = new Date();
-				this.setDate(today);
 				this.getPerformInfo();
 				this.getPerformInfo();
 				this.getPerformerNotice();
 				this.getPerformerNotice();
-				//获取订单信息
-				this.getOrderInfo();
 			} 
 			} 
 			else{
 			else{
 				this.performId = page.id;
 				this.performId = page.id;
@@ -470,8 +473,16 @@
 				this.$u.api.orderDetails({id:this.orderId}).then(res=>{
 				this.$u.api.orderDetails({id:this.orderId}).then(res=>{
 					console.log('getOrderInfo',res.data);
 					console.log('getOrderInfo',res.data);
 					this.originOrderInfo = res.data||{};
 					this.originOrderInfo = res.data||{};
+					// 在获取到订单信息后再设置日期
+					if(this.isUpgrade) {
+						this.setDate();
+					}
 				}).catch(err=>{
 				}).catch(err=>{
 					console.log('getOrderInfo',err);
 					console.log('getOrderInfo',err);
+					uni.showToast({
+						title: '获取订单信息失败',
+						icon: 'none'
+					});
 				})
 				})
 			},
 			},
 			getPerformData(){
 			getPerformData(){
@@ -520,12 +531,24 @@
 				})
 				})
 			},
 			},
 			getTimes(){
 			getTimes(){
-				// this.firstGet++;
-				uni.showLoading();
-				let auditoriumId= this.auditoriumList[this.auditoriumIndex]?.id;
-				if(!auditoriumId){return}
-				// console.log('this.dateList',this.dateList);
-				// console.log('this.dateIndex',this.dateIndex);
+				// uni.showLoading();
+				let auditoriumId = this.auditoriumList[this.auditoriumIndex]?.id;
+				if(!auditoriumId) return;
+
+				// 如果是升舱,只显示原订单的场次
+				if (this.isUpgrade && this.originOrderInfo && this.originOrderInfo.performTimeId) {
+					this.sessionList = [{
+						id: this.originOrderInfo.performTimeId,
+						performTimeStart: this.originOrderInfo.performTimeStart || '',
+						performTimeEnd: this.originOrderInfo.performTimeEnd || '',
+						ifVaild: 1
+					}];
+					this.sessionIndex = 0;
+					this.getPositionData();
+					uni.hideLoading();
+					return;
+				}
+
 				let dateOBJ = this.dateList[this.dateIndex];
 				let dateOBJ = this.dateList[this.dateIndex];
 				let param = {
 				let param = {
 					auditoriumId:auditoriumId,//演艺厅ID(演艺厅列表)
 					auditoriumId:auditoriumId,//演艺厅ID(演艺厅列表)
@@ -559,7 +582,7 @@
 				 day.date = moment(day.date).format("YYYY-MM-DD HH:mm:ss")
 				 day.date = moment(day.date).format("YYYY-MM-DD HH:mm:ss")
 				 
 				 
 				 // console.log('day',day);
 				 // console.log('day',day);
-				 // console.log('thisthisthisthisthisthisthisthisthis',parentThis);
+				 // console.log('thisthisthisthisthisthisthisthisthisthisthis',parentThis);
 				 // console.log('==================================',day.date.toISOString().split('T')[0]);
 				 // console.log('==================================',day.date.toISOString().split('T')[0]);
 				let ticket = parentThis.performDateList.find(item => item.performDate === day.date.split(' ')[0]);
 				let ticket = parentThis.performDateList.find(item => item.performDate === day.date.split(' ')[0]);
 				if(ticket){
 				if(ticket){
@@ -574,7 +597,22 @@
 			    return day
 			    return day
 			  },
 			  },
 			setDate(firstDay,isSelect){
 			setDate(firstDay,isSelect){
-				// console.log('this.performDateList',this.performDateList);
+				// 如果是升舱,只显示原订单的日期
+				if (this.isUpgrade && this.originOrderInfo && this.originOrderInfo.performDate) {
+					const orderDate = this.originOrderInfo.performDate.split('-');
+					this.dateList = [{
+						year: orderDate[0],
+						month: orderDate[1],
+						day: orderDate[2],
+						name: '日期',
+						fullDay: this.originOrderInfo.performDate
+					}];
+					this.dateIndex = 0;
+					this.getTimes();
+					return;
+				}
+
+				// 原有的日期设置逻辑
 				if(this.performDateList[0]?.performDate&&!isSelect){
 				if(this.performDateList[0]?.performDate&&!isSelect){
 					// firstDay = new Date(this.performDateList[0].performDate);
 					// firstDay = new Date(this.performDateList[0].performDate);
 					const uniquePerformDateList = Array.from(new Set(this.performDateList.map(JSON.stringify))).map(JSON.parse);//去重
 					const uniquePerformDateList = Array.from(new Set(this.performDateList.map(JSON.stringify))).map(JSON.parse);//去重
@@ -627,6 +665,13 @@
 				// console.log('this.dateList ',this.dateList);
 				// console.log('this.dateList ',this.dateList);
 			},
 			},
 			dateClick(index){
 			dateClick(index){
+				if (this.isUpgrade) {
+					uni.showToast({
+						title: '升舱不可更改日期',
+						icon: 'none'
+					});
+					return;
+				}
 				this.dateIndex = index;
 				this.dateIndex = index;
 				this.ticketTypeIndex = 0;
 				this.ticketTypeIndex = 0;
 				this.positionIndex = 0;
 				this.positionIndex = 0;
@@ -655,6 +700,13 @@
 			sessionClick(index,data){
 			sessionClick(index,data){
 				// console.log('sessionClick index',index);
 				// console.log('sessionClick index',index);
 				console.log('sessionClick data',data);
 				console.log('sessionClick data',data);
+				if (this.isUpgrade) {
+					uni.showToast({
+						title: '升舱不可更改场次',
+						icon: 'none'
+					});
+					return;
+				}
 				if(!data.ifVaild){
 				if(!data.ifVaild){
 					uni.showToast({
 					uni.showToast({
 						title:'该场次不可用',
 						title:'该场次不可用',
@@ -678,7 +730,7 @@
 			},
 			},
 			async getPositionData() {
 			async getPositionData() {
 				try {
 				try {
-					uni.showLoading();
+					// uni.showLoading();
 					
 					
 					// 获取 retailId
 					// 获取 retailId
 					let retailId = null;
 					let retailId = null;
@@ -692,22 +744,42 @@
 
 
 					// 构建请求参数
 					// 构建请求参数
 					const session = this.sessionList[this.sessionIndex] || {};
 					const session = this.sessionList[this.sessionIndex] || {};
+					const ticketType = this.ticketTypeList[this.ticketTypeIndex] || {};
 					const params = {
 					const params = {
 						performId: this.performId,
 						performId: this.performId,
 						auditoriumId: this.auditoriumList[this.auditoriumIndex].id,
 						auditoriumId: this.auditoriumList[this.auditoriumIndex].id,
 						performTimeId: session.id,
 						performTimeId: session.id,
+						seatTypeId: ticketType.seatTypeId,
 						label: this.label,
 						label: this.label,
 						retailId: this.retailId,
 						retailId: this.retailId,
 						timeId: session.id,
 						timeId: session.id,
 						orderId: this.orderId
 						orderId: this.orderId
 					};
 					};
 
 
-					// 根据不同场景调用不同接口
-					const api = this.fromPage === 'rebook' ? 
-						this.$u.api.selectRegionRebook : 
-						this.$u.api.selectRegionV2;
-					
-					const res = await api(params,{custom:{toast:false,noload:true}});
+					// 如果是升舱,添加固定日期和场次
+					if (this.isUpgrade && this.originOrderInfo) {
+						// params.performDate = this.originOrderInfo.performDate;
+						params.performTimeId = this.originOrderInfo.performTimeId;
+						params.resubmitType = 2; // 改签类型: 1-改签 2-升舱
+					}
+
+					// 根据不同场景选择对应的接口
+					let api;
+					if (this.fromPage === 'rebook') {
+						api = this.$u.api.selectRegionRebook;
+						// api = this.isUpgrade ? 
+						// 	this.$u.api.selectRegionUpgrade : 
+						// 	this.$u.api.selectRegionRebook;
+					} else {
+						api = this.$u.api.selectRegionV2;
+					}
+					//如果是升舱
+					if(this.isUpgrade){
+						// resubmitType 改签类型: 1-改签 2-升舱 不传默认为改签改签
+						params.resubmitType = 2;
+					}
+					const res = await api(params, {custom:{toast:false,noload:false}});
+					// const res = await api(params);
 					
 					
 					// 处理响应数据
 					// 处理响应数据
 					this.positionData = res.data;
 					this.positionData = res.data;
@@ -727,7 +799,9 @@
 							...obj,
 							...obj,
 							saleNum: obj.saleNum||0 // 初始化选择数量为0
 							saleNum: obj.saleNum||0 // 初始化选择数量为0
 						}));
 						}));
-
+					if(this.isUpgrade){
+						this.getReSubmitInfo();
+					}
 				} catch (error) {
 				} catch (error) {
 					console.error('获取座位数据失败:', error);
 					console.error('获取座位数据失败:', error);
 					uni.showModal({
 					uni.showModal({
@@ -746,6 +820,24 @@
 					uni.hideLoading();
 					uni.hideLoading();
 				}
 				}
 			},
 			},
+			async getReSubmitInfo(){
+				// 构建请求参数
+				const session = this.sessionList[this.sessionIndex] || {};
+				const ticketType = this.ticketTypeList[this.ticketTypeIndex] || {};
+				const params = {
+					performId: this.performId,
+					auditoriumId: this.auditoriumList[this.auditoriumIndex].id,
+					performTimeId: session.id,
+					seatTypeId: ticketType.seatTypeId,
+					label: this.label,
+					retailId: this.retailId,
+					timeId: session.id,
+					orderId: this.orderId
+				};
+				const res = await this.$u.api.selectRegionRebook(params, {custom:{toast:false,noload:false}});
+				this.reSubmitInfo = res.data.reSubmitInfo;
+
+			},
 			// 改变票数
 			// 改变票数
 			changeTicketNum(item, type) {
 			changeTicketNum(item, type) {
 				// console.log('changeTicketNum===',item, type);
 				// console.log('changeTicketNum===',item, type);
@@ -767,6 +859,7 @@
 				console.log('this.positionArr',this.positionArr)
 				console.log('this.positionArr',this.positionArr)
 			},
 			},
 			ticketTypeClick(index,date){
 			ticketTypeClick(index,date){
+				// console.log('date',date)
 				if(this.ticketTypeIndex==index){
 				if(this.ticketTypeIndex==index){
 					// console.log('不变');
 					// console.log('不变');
 					return
 					return
@@ -783,12 +876,15 @@
 				this.positionArr = this.positionArr.map(obj => {
 				this.positionArr = this.positionArr.map(obj => {
 					return {
 					return {
 						...obj, // 保留原有的字段
 						...obj, // 保留原有的字段
-						saleNum: 0 // 新增的字段
+						saleNum: this.isUpgrade?this.reSubmitInfo.saleNum:0 // 新增的字段
 					};
 					};
 				});
 				});
 				// let sellableProductIndex = this.findFirstSellableProductIndex();
 				// let sellableProductIndex = this.findFirstSellableProductIndex();
 				// this.positionIndex = sellableProductIndex;
 				// this.positionIndex = sellableProductIndex;
 				// this.getPositionData()
 				// this.getPositionData()
+				if(this.isUpgrade){
+					this.getReSubmitInfo();
+				}
 			},
 			},
 			positionClick(index,date){
 			positionClick(index,date){
 				if(this.positionIndex==index){
 				if(this.positionIndex==index){
@@ -918,7 +1014,9 @@
 				console.log('handelRebook params',params);
 				console.log('handelRebook params',params);
 				uni.showModal({
 				uni.showModal({
 				  title: '温馨提示',
 				  title: '温馨提示',
-				  content: '仅限改签一次,且改签后禁止退款,确定要继续改签吗?',
+				  content: this.isUpgrade ? 
+					  '仅限升舱一次,且升舱后禁止退款,确定要继续升舱吗?' : 
+					  '仅限改签一次,且改签后禁止退款,确定要继续改签吗?',
 				  success: res => {
 				  success: res => {
 				    if (res.confirm) {
 				    if (res.confirm) {
 						this.cansubmit = false;
 						this.cansubmit = false;
@@ -1257,8 +1355,12 @@
 					urls: urls,
 					urls: urls,
 					current:index
 					current:index
 				})
 				})
-			}
-
+			},
+			checkWeekDate(date) {
+				const weekDay = new Date(date).getDay();
+				const weekDayMap = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
+				return weekDayMap[weekDay];
+			},
 		},
 		},
 		computed: {
 		computed: {
 			// 是否已选择票
 			// 是否已选择票