浏览代码

兼容不需要实名认证的情况

gcz 2 月之前
父节点
当前提交
27be4eb7bd
共有 2 个文件被更改,包括 15 次插入7 次删除
  1. 2 2
      common/config.js
  2. 13 5
      pages/bookticket.vue

+ 2 - 2
common/config.js

@@ -33,8 +33,8 @@ let staticUrl= null // 静态文件地址
 
 //正式
 // #ifdef MP
-	// baseUrl='https://serviceapi.wdzzgs.com';
-	// upFileUrl='https://serviceapi.wdzzgs.com/thirdapi/upload/single/minio';
+	baseUrl='https://serviceapi.wdzzgs.com';
+	upFileUrl='https://serviceapi.wdzzgs.com/thirdapi/upload/single/minio';
 	staticUrl='https://minio.wdzzgs.com/greattransition/staticfile';
 // #endif
 // #ifdef H5

+ 13 - 5
pages/bookticket.vue

@@ -46,8 +46,9 @@
 			</view>
 			<view class="block-wrap visitors" v-for="(goods, goodsIndex) in pageContent.goodsList" :key="goodsIndex">
 				<view class="block-title u-flex">
-					<view class="name">{{goods.goodsName}}</view>
+					<view class="name">{{goods.goodsName}}({{goods.saleNum}}张)</view>
 					<text v-if="goods.realList && goods.realList[0]">需要{{goods.realList[0].realNum}}张身份证</text>
+					<!-- <text v-else>不需要身份证</text> -->
 				</view>
 				
 				<view class="people-list u-flex u-flex-wrap">
@@ -57,7 +58,7 @@
 					</view>
 					
 					<!-- 添加观影人按钮 -->
-					<view class="btn u-flex u-row-center" @click="showVisitorSelect(goodsIndex)">
+					<view  v-if="goods.realList && goods.realList[0]" class="btn u-flex u-row-center" @click="showVisitorSelect(goodsIndex)">
 						<u-icon name="plus-circle" color="#2D2D2D" size="32rpx"></u-icon>
 						<text class="text">新增/更换</text>
 					</view>
@@ -470,6 +471,7 @@ import {
 				    }
 					this.retailId = retailId;
 				console.log('submitorder retailId',this.retailId);
+				console.log('this.pageContent',this.pageContent);
 				// 构建订单参数
 				let params = {
 					performId: this.pageContent.performId,
@@ -477,7 +479,7 @@ import {
 						return {
 							goodsId: goods.goodsId,
 							saleNum: goods.saleNum,
-							tourists: goods.visitors.map(visitor => {
+							tourists: (goods.visitors ?? []).map(visitor => {
 								return {
 									realType: goods.realList[0].realType,
 									name: visitor.name,
@@ -862,13 +864,19 @@ import {
 			setTemplate() {
 				// 检查是否所有商品都选择了足够的观影人
 				const isValid = this.pageContent.goodsList.every(goods => {
-					if(!goods.visitors || !goods.realList[0]) return false;
+					// 如果没有realList或realList[0]为空,则不需要验证观影人数量
+					if(!goods.realList || !goods.realList[0]) return true;
+					
+					// 如果需要观影人但没有选择任何观影人
+					if(!goods.visitors) return false;
+					
+					// 验证观影人数量是否符合要求
 					return goods.visitors.length === goods.realList[0].realNum;
 				});
 
 				if(!isValid) {
 					uni.showToast({
-						title: '请为每个票种选择足够的观影人',
+						title: '请为需要实名认证的票种选择足够的观影人',
 						icon: 'none'
 					});
 					return;