Browse Source

接口对接 页面细节调整

LiuShu_0203 1 week ago
parent
commit
7cf05b3eed

+ 155 - 0
my/classes/PassengerList.vue

@@ -0,0 +1,155 @@
+<template>
+	<view class="boxs">
+		<!-- 外层容器 -->
+		<view class="flex align-center padding-tb-sm" v-for="(item, index) in selectdata" :key="index">
+			<!-- 显示头像 -->
+			<view>
+				<image v-if="globalImages" :src="globalImages + 'images/order/chengcheren.png'" style="width: 80rpx;height: 80rpx;" mode=""></image>
+			</view>
+			<!-- 显示姓名和关系、电话 -->
+			<view style="margin-left: 30rpx; line-height: 40rpx;">
+				<view>{{ item.name }}</view>
+				<view style="color: #999;">{{ item.idCard }}</view>
+			</view>
+			<!-- 编辑图标 -->
+			<view style="position: absolute; right: 130rpx;" @tap="handleEdit(item)">
+				<image v-if="globalImages" :src="globalImages + 'images/order/xiugai.png'" style="width: 36rpx;height: 36rpx;" mode="">
+				</image>
+			</view>
+			<!-- 删除图标 -->
+			<view style="position: absolute; right: 60rpx;" @tap="handleDelete(item.id, index)">
+				<image v-if="globalImages" :src="globalImages + 'images/order/shanchu.png'" style="width: 36rpx;height: 36rpx;" mode="">
+				</image>
+			</view>
+		</view>
+		<!-- 底部操作栏 -->
+		<view class="footer">
+			<button class="submit-btn" @click="goNav('/my/classes/adddetailsList?type=add')">+ 新增乘车人</button>
+		</view>
+	</view>
+	
+</template>
+
+<script>
+	import { waitForGlobalImages } from '@/utils/globalImageLoader'
+	export default {
+		data() {
+			return {
+				selectdata: [],
+				globalImages: ''
+			}
+		},
+		onLoad(options) {
+			waitForGlobalImages().then((path) => {
+			    console.log('✅ 全局图片路径:', path)
+			    this.globalImages = path
+			  })
+			
+			this.fetchPassengerList(); // 初始化加载一次
+			
+			  uni.$on('refreshPassengerList', () => {
+				this.fetchPassengerList(); // 被添加页通知时刷新
+			  });
+		},
+		onUnload() {
+		  uni.$off('refreshPassengerList'); // 销毁监听,避免重复绑定
+		},
+		methods: {
+			fetchPassengerList() {
+			    this.$Request.getT('/app/passenger/selectList').then(res => {
+			      if (res.code === 0) {
+			        this.selectdata = res.data;
+			      }
+			    });
+		    },
+			handleEdit(contact) {
+			  const token = this.$queue.getData("token");
+			  if (token) {
+			    uni.navigateTo({
+			      url: `/my/classes/adddetailsList?type=edit&data=${encodeURIComponent(JSON.stringify(contact))}`
+			    });
+			  }
+			},
+			handleDelete(ids, index) {
+			    uni.showModal({
+			      title: '确认删除',
+			      content: '是否删除该乘车人?',
+			      success: (res) => {
+			        if (res.confirm) {
+						let data = {
+							id: ids
+						}
+			           this.$Request.postT('/app/passenger/delete', data)
+						.then(res => {
+						  if (res.code === 0) {
+							uni.showToast({ title: '删除成功', icon: 'success' });
+							this.fetchPassengerList()
+						  } else {
+							uni.showToast({ title: res.msg || '删除失败', icon: 'none' });
+						  }
+						})
+						.catch(err => {
+						  console.error('删除失败:', err);
+						  uni.showToast({ title: '网络错误', icon: 'none' });
+						});
+			        }
+			      }
+			    });
+			},
+			goNav(url) {
+				// #ifdef MP-WEIXIN
+				if (uni.getStorageSync('sendorderMsg')) {
+					uni.requestSubscribeMessage({
+						tmplIds: this.arr,
+						success(re) {
+							// console.log(re,'**********')
+							var datas = JSON.stringify(re);
+							if (datas.indexOf("accept") != -1) {
+								console.log(re)
+							}
+						},
+						fail: (res) => {
+							console.log(res)
+						}
+					})
+				}
+				// #endif
+				let token = this.$queue.getData("token");
+				if (token) {
+					uni.navigateTo({
+						url: url
+					})
+				} else {
+					this.bindlogin();
+				}
+			}
+		}
+	}
+</script>
+
+<style scoped>
+	.boxs {
+		background: #FFFFFF;
+		border-radius: 24rpx;
+		margin: 30rpx;
+		padding: 30rpx;
+	}
+	.footer {
+		position: fixed;
+		bottom: 0;
+		left: 0;
+		right: 0;
+		background: #fff;
+		padding: 20rpx 30rpx;
+		box-shadow: 0 -4rpx 10rpx rgba(0, 0, 0, 0.05);
+	}
+	
+	.submit-btn {
+		background: #fe6b01;
+		color: #fff;
+		border-radius: 50rpx;
+		font-size: 32rpx;
+		height: 80rpx;
+		line-height: 80rpx;
+	}
+</style>

+ 98 - 2
my/classes/adddetailsList.vue

@@ -14,13 +14,13 @@
 		<view class="padding" >
 			<view class="title">乘客姓名</view>
 			<view style="margin-top: 20rpx;">
-				<input class="uni-input" style="width: 90%;" placeholder="请输入乘客姓名" />
+				<input class="uni-input" v-model="name" style="width: 90%;" placeholder="请输入乘客姓名" />
 			</view>
 		</view>
 		<view class=" padding" v-if="falong === 1" >
 			<view class="title">乘客身份证</view>
 			<view style="margin-top: 20rpx;">
-				<input class="uni-input" style="width: 90%;" placeholder="请输入乘客身份证号码" />
+				<input class="uni-input" v-model="idCard" style="width: 90%;" placeholder="请输入乘客身份证号码" />
 			</view>
 		</view>
 		<view class=" padding" v-if="falong === 2" >
@@ -29,6 +29,10 @@
 				儿童需要全价购票,暂时不支持半价票或免票,必须有一名成人跟随
 			</view>
 		</view>
+		
+		<view class="footer">
+			<button class="submit-btn" @tap="insertsubmit()">确认</button>
+		</view>
 	</view>
 </template>
 
@@ -37,11 +41,84 @@
 		data() {
 			return {
 				falong: 1,
+				name: '',
+				idCard: '',
+				isEdit: false,
+				id: null,
+			}
+		},
+		onLoad(options) {
+		  this.mode = options.type;
+		  
+		    if (this.mode === 'edit' && options.data) {
+		      try {
+		        const detail = JSON.parse(decodeURIComponent(options.data));
+		        this.editId = detail.id;
+		        this.name = detail.name;
+		        this.idCard = '';
+		        this.falong = detail.type;
+		      } catch (e) {
+		        console.error('解析传参失败', e);
+		      }
 			}
 		},
 		methods: {
 			tablist(valie) {
 				this.falong = valie
+			},
+			validateIdCard(idCard) {
+			    const reg =
+			      /(^\d{15}$)|(^\d{17}([0-9Xx])$)/;
+			    return reg.test(idCard);
+			},
+			insertsubmit() {
+			  if (!this.name.trim()) {
+			    uni.showToast({
+			      title: '请填写乘客姓名',
+			      icon: 'none'
+			    });
+			    return;
+			  }
+			
+			  if (this.falong === 1) {
+			    // 成人:校验身份证
+			    if (!this.idCard.trim()) {
+			      uni.showToast({
+			        title: '请填写身份证号',
+			        icon: 'none'
+			      });
+			      return;
+			    }
+			    if (!this.validateIdCard(this.idCard)) {
+			      uni.showToast({
+			        title: '身份证格式不正确',
+			        icon: 'none'
+			      });
+			      return;
+			    }
+			  }
+			
+			  const data = {
+			    name: this.name,
+			    idCard: this.falong === 1 ? this.idCard : '',
+			    type: this.falong,
+			  }
+			
+		   // 如果是编辑模式,加上 id 字段,并改为调用更新接口
+			const api = this.isEdit ? '/app/passenger/update' : '/app/passenger/insert';
+			if (this.isEdit) {
+				data.id = this.id;
+			}
+		  
+			this.$Request.postT(api, data).then(res => {
+			  if (res.code === 0) {
+					uni.showToast({ title: '操作成功' });
+					uni.$emit('refreshPassengerList'); // 通知列表页刷新
+					uni.navigateBack();
+			  } else {
+					uni.showModal({ showCancel: false, title: '操作失败', content: res.msg });
+			  }
+			});
 			}
 		}
 	}
@@ -64,4 +141,23 @@
 		color: #fff !important;
 		border: #f76801 1rpx solid !important;
 	}
+	
+	.footer {
+		position: fixed;
+		bottom: 0;
+		left: 0;
+		right: 0;
+		background: #fff;
+		padding: 20rpx 30rpx;
+		box-shadow: 0 -4rpx 10rpx rgba(0, 0, 0, 0.05);
+	}
+	
+	.submit-btn {
+		background: #fe6b01;
+		color: #fff;
+		border-radius: 50rpx;
+		font-size: 32rpx;
+		height: 80rpx;
+		line-height: 80rpx;
+	}
 </style>

+ 33 - 3
my/classes/detailsList.vue

@@ -26,9 +26,22 @@
 		<view class="margin-top padding" style="background: #FFFFFF;border-radius: 20upx;">
 			<view class="flex" style="justify-content: space-between;">
 				<text class="section-title">乘车人</text>
-				<text style="font-size: 24rpx;" @click="goNav('/my/classes/adddetailsList')">+ 新增乘车人</text>
+				<text style="font-size: 24rpx;" @click="goNav('/my/classes/adddetailsList?type=add')">+ 新增乘车人</text>
 			</view>
-			<view style="width: 100%; display: flex; justify-content: center;margin: 30rpx;">
+			<view v-if="selectdata.length > 0">
+				<view class="flex align-center" style="padding: 15rpx 30rpx;" v-for="(item, index) in selectdata" :key="index">
+					<!-- 显示头像 -->
+					<view>
+						<image v-if="globalImages" :src="globalImages + 'images/order/chengcheren.png'" style="width: 70rpx;height: 70rpx;" mode=""></image>
+					</view>
+					<!-- 显示姓名和身份证号 -->
+					<view style="margin-left: 30rpx; line-height: 40rpx;">
+						<view>{{ item.name }}</view>
+						<view style="color: #999;">{{ item.idCard }}</view>
+					</view>
+				</view>
+			</view>
+			<view v-else style="width: 100%; display: flex; justify-content: center;margin: 30rpx;">
 				<image v-if="globalImages" :src="globalImages + 'images/kong.png'" style="width: 230rpx;height: 180rpx;" mode=""></image>
 			</view>
 			<view class="section" style="margin-top: 20rpx;">
@@ -121,7 +134,8 @@
 				],
 				seatType: 'multiple',
 				selectedSeat: 2,
-				globalImages: ''
+				globalImages: '',
+				selectdata: [],
 			}
 		},
 		onLoad(options) {
@@ -133,8 +147,24 @@
 			const busData = uni.getStorageSync('selectedBus')
 			this.busInfo = busData
 			console.log('本地存储数据:', busData, this.busInfo)
+			
+			this.fetchPassengerList(); // 初始化加载一次
+			
+			  uni.$on('refreshPassengerList', () => {
+				this.fetchPassengerList(); // 被添加页通知时刷新
+			  });
+		},
+		onUnload() {
+		  uni.$off('refreshPassengerList'); // 销毁监听,避免重复绑定
 		},
 		methods: {
+			fetchPassengerList() {
+			    this.$Request.getT('/app/passenger/selectList').then(res => {
+			      if (res.code === 0) {
+			        this.selectdata = res.data;
+			      }
+			    });
+		    },
 			goNav(url) {
 				// #ifdef MP-WEIXIN
 				if (uni.getStorageSync('sendorderMsg')) {

+ 1 - 1
my/exchange/shoppingMall.vue

@@ -25,7 +25,7 @@
 			<view class="margin-top padding" style="background: #FFFFFF;border-radius: 20upx;">
 				<view class="flex"
 					style="margin: 20rpx 0; padding: 20rpx;border-radius: 11rpx; border: 1px #ccc solid;">
-					<input class="uni-input" style="width: 90%;" placeholder="输入充值金额" />
+					<input class="uni-input" style="width: 90%;" placeholder="请输入兑换码" />
 					<image v-if="globalImages" :src="globalImages + 'images/saoma.png'" style="width: 44rpx;height: 44rpx;margin-left: 15rpx;"
 						mode=""></image>
 				</view>

+ 3 - 3
my/setting/index.vue

@@ -29,7 +29,7 @@
 					<switch color="#fe6b01!important" checked @change="switch1Change" />
 				</view>
 			</view>
-			<view class="flex align-center justify-between padding-lr">
+			<!-- <view class="flex align-center justify-between padding-lr">
 				<view style="line-height: 40rpx;">
 					<view>个人信息可见范围</view>
 					<view style="color: #999;font-size: 24rpx;">设置其他用户可见的信息</view>
@@ -37,8 +37,8 @@
 				<view class="order_money">
 					<u-icon name="arrow-right"></u-icon>
 				</view>
-			</view>
-			<view class="flex align-center justify-between padding-lr">
+			</view> -->
+			<view class="flex align-center justify-between padding-lr" style="margin-top: 30rpx;">
 				<view style="line-height: 40rpx;">
 					<view>消息推送权限</view>
 					<view style="color: #999;font-size: 24rpx;">管理通知和消息接收</view>

+ 40 - 0
my/setting/recruit.vue

@@ -0,0 +1,40 @@
+<template>
+	<view class="full-page">
+		<image
+			v-if="globalImages"
+			:src="globalImages + 'images/my/publicize.jpg'"
+			mode="aspectFill"
+			class="full-image"
+		/>
+	</view>
+</template>
+
+<script>
+	import { waitForGlobalImages } from '@/utils/globalImageLoader'
+	export default {
+		data() {
+			return {
+				globalImages: ''
+			}
+		},
+		onLoad() {
+			waitForGlobalImages().then((path) => {
+				console.log('✅ 全局图片路径:', path)
+				this.globalImages = path
+			})
+		}
+	}
+</script>
+
+<style scoped>
+.full-page {
+	width: 100vw;
+	height: 100vh;
+	overflow: hidden;
+}
+
+.full-image {
+	width: 100vw;
+	height: 100vh;
+}
+</style>

+ 13 - 1
pages.json

@@ -231,6 +231,12 @@
 				"navigationBarTitleText": "消息中心",
 				"enablePullDownRefresh": true
 			}
+		}, {
+			"path": "setting/recruit",
+			"style": {
+				"navigationBarTitleText": "招募车主",
+				"enablePullDownRefresh": true
+			}
 		}, {
 			"path": "youhui/index",
 			"style": {
@@ -293,7 +299,13 @@
 		}, {
 			"path": "classes/adddetailsList",
 			"style": {
-				"navigationBarTitleText": "添加乘车人",
+				"navigationBarTitleText": "乘车人操作页",
+				"enablePullDownRefresh": false
+			}
+		},{
+			"path": "classes/PassengerList",
+			"style": {
+				"navigationBarTitleText": "乘车人",
 				"enablePullDownRefresh": false
 			}
 		}, {

+ 3 - 3
pages/index/index.vue

@@ -189,11 +189,11 @@
 										</view>
 									</view>
 									<view class="flex justify-between margin-top">
-										<view class="zx_view" @tap="payorder()">
+									<!-- 	<view class="zx_view" @tap="payorder()">
 											<image v-if="globalImages" :src="globalImages + 'images/shijian.png'" style="width: 35rpx;height: 37rpx;">
 											</image>
 											<view class="zx_name">预约</view>
-										</view>
+										</view> -->
 										<view class="zx_view" @tap="personShow = true">
 											<image v-if="globalImages" :src="globalImages + 'images/yiren.png'" style="width: 34rpx;height: 32rpx;">
 											</image>
@@ -214,7 +214,7 @@
 									</view>
 									<!-- @tap="payorder()" -->
 								</view>
-								<view class="btna" @click="goNav('/my/classes/list')">搜索行程</view>
+								<view class="btna" @click="goNav('/my/classes/list')">发布行程</view>
 							</view>
 						
 						</view>

+ 9 - 9
pages/my/my.vue

@@ -119,11 +119,11 @@
 						<view class="text-sm">实名认证</view>
 						<!-- <view class="weinumber" v-if="order&&order.djdOrders">{{order.djdOrders}}</view> -->
 					</view>
-					<view class="text-center margin-tb-sm"  style="width: 25%;">
+					<!-- <view class="text-center margin-tb-sm"  style="width: 25%;">
 						<image v-if="globalImages" :src="globalImages + 'images/my/fuli.png'" style="width: 56rpx;height: 56rpx;" mode=""></image>
 						<view class="text-sm">我的福利</view>
-						<!-- <view class="weinumber" v-if="order&&order.yjdOrders">{{order.yjdOrders}}</view> -->
-					</view>
+						<view class="weinumber" v-if="order&&order.yjdOrders">{{order.yjdOrders}}</view>
+					</view> -->
 					<view class="text-center margin-tb-sm"  style="width: 25%;" @click="goNav('/pages/my/invitationUser')">
 						<image v-if="globalImages" :src="globalImages + 'images/my/yaoqing.png'" style="width: 56rpx;height: 56rpx;" mode=""></image>
 						<view class="text-sm">邀请好友</view>
@@ -134,7 +134,7 @@
 						<view class="text-sm">设置</view>
 						<!-- <view class="weinumber" v-if="order&&order.dzfOrders">{{order.dzfOrders}}</view> -->
 					</view>
-					<view class="text-center margin-tb-sm"  style="width: 25%;">
+					<view class="text-center margin-tb-sm"  style="width: 25%;" @click="goNav('/my/classes/PassengerList')">
 						<image v-if="globalImages" :src="globalImages + 'images/my/chengcheren.png'" style="width: 56rpx;height: 56rpx;" mode=""></image>
 						<view class="text-sm">乘车人</view>
 					</view>
@@ -204,11 +204,11 @@
 						<view class="text-sm">客服电话</view>
 						<!-- <view class="weinumber" v-if="order&&order.jxzOrders">{{order.jxzOrders}}</view> -->
 					</view>
-					<view class="text-center margin-tb-sm"  style="width: 25%;">
+					<!-- <view class="text-center margin-tb-sm"  style="width: 25%;">
 						<image v-if="globalImages" :src="globalImages + 'images/my/shoucang.png'" style="width: 56rpx;height: 56rpx;" mode=""></image>
 						<view class="text-sm">我的收藏</view>
-						<!-- <view class="weinumber" v-if="order&&order.dzfOrders">{{order.dzfOrders}}</view> -->
-					</view>
+						<view class="weinumber" v-if="order&&order.dzfOrders">{{order.dzfOrders}}</view>
+					</view> -->
 				</view>
 			</view>
 			
@@ -218,12 +218,12 @@
 				</view>
 				
 				<view class="flex flex-wrap margin-top-sm">
-					<view class="text-center margin-tb-sm" style="width: 25%;">
+					<view class="text-center margin-tb-sm" style="width: 25%;" @click="goNav('/my/setting/recruit')">
 						<image v-if="globalImages" :src="globalImages + 'images/my/zhaomu.png'" style="width: 56rpx;height: 56rpx;" mode=""></image>
 						<view class="text-sm">招募车主</view>
 						<!-- <view class="weinumber" v-if="order&&order.djdOrders">{{order.djdOrders}}</view> -->
 					</view>
-					<view class="text-center margin-tb-sm"  style="width: 25%;">
+					<view class="text-center margin-tb-sm"  style="width: 25%;" @click="goRider()">
 						<image v-if="globalImages" :src="globalImages + 'images/my/chengwei.png'" style="width: 56rpx;height: 56rpx;" mode=""></image>
 						<view class="text-sm">成为车主</view>
 						<!-- <view class="weinumber" v-if="order&&order.yjdOrders">{{order.yjdOrders}}</view> -->