Переглянути джерело

页面优化 接口对接

Roebin 3 роки тому
батько
коміт
625e2c5e0b

+ 6 - 1
App.vue

xqd
@@ -59,5 +59,10 @@
 		height: var(--status-bar-height);
 		width: 100%;
 	}
-	
+	.more{
+		display: block;
+		text-align: center;
+		margin:0 auto;
+		margin-top: 60rpx;
+	}
 </style>

+ 58 - 22
pages/invoice/applyInvoice.vue

xqd xqd xqd xqd xqd xqd
@@ -30,24 +30,24 @@
 			   	</view>
 			
 			    
-				<u-form-item  label="发票抬头" prop="presonalname" borderBottom  ref="item1" labelWidth="160rpx" v-if="state==1">
+				<u-form-item  label="发票抬头" prop="presonalname" borderBottom  ref="item1" labelWidth="160rpx" v-if="state==1" :required="true">
 					<u-input v-model="presonalname"  disabledColor="#ffffff" placeholder="请输入个人姓名" border="none" placeholderStyle="color: #555555">
 						<template slot="suffix"><text @click="goinvoiceList">抬头薄</text> </template>
 					</u-input>
 				</u-form-item>
-				<u-form-item  label="发送邮箱" prop="prsonalemail" borderBottom  ref="item1" labelWidth="160rpx" v-if="state==1">
+				<u-form-item  label="发送邮箱" prop="prsonalemail" borderBottom  ref="item1" labelWidth="160rpx" v-if="state==1" :required="true">
 					<u-input v-model="prsonalemail"  disabledColor="#ffffff" placeholder="请输入接收邮箱" border="none" placeholderStyle="color: #555555">
 						<template slot="suffix"><text @click="goinvoiceList"></text> </template>
 					</u-input>
 				</u-form-item>
 				<view class="" v-if="state==0">
-					<u-form-item  label="发票抬头" prop="userInfo.name" borderBottom  ref="item1" labelWidth="160rpx">
+					<u-form-item  label="发票抬头" prop="userInfo.name" borderBottom  ref="item1" labelWidth="160rpx" :required="true">
 						<u-input v-model="model1.userInfo.name"  disabledColor="#ffffff" :placeholder="state==0?'请输入公司姓名':'请输入个人姓名'" border="none" placeholderStyle="color: #555555">
 							<template slot="suffix"><text @click="goinvoiceList">抬头薄</text> </template>
 						</u-input>
 					</u-form-item>
-					<u-form-item  label="纳税税号" prop="userInfo.tax_no" borderBottom  ref="item1" labelWidth="160rpx">
-						<u--input v-model="model1.userInfo.tax_no"  disabledColor="#ffffff" placeholder="请输入税号" border="none" placeholderStyle="color: #555555"></u--input>
+					<u-form-item  label="纳税税号" prop="userInfo.tax_no" borderBottom  ref="item1" labelWidth="160rpx" :required="true">
+						<u--input v-model="model1.userInfo.tax_no"  disabledColor="#ffffff" placeholder="请输入税号" border="none" placeholderStyle="color: #555555" ></u--input>
 					</u-form-item>
 					<u-form-item  label="注册地址" prop="userInfo.address" borderBottom  ref="item1" labelWidth="160rpx">
 						<u--input v-model="model1.userInfo.address"  disabledColor="#ffffff" placeholder="请输入注册地址" border="none" placeholderStyle="color: #555555"></u--input>
@@ -62,14 +62,11 @@
 						<u--input v-model="model1.userInfo.bank_no"  disabledColor="#ffffff" placeholder="请输入银行账号" border="none" placeholderStyle="color: #555555" type="number"></u--input>
 						
 					</u-form-item>
-					<u-form-item   label="发送邮箱" prop="userInfo.mail" borderBottom  ref="item1" labelWidth="160rpx">
+					<u-form-item   label="发送邮箱" prop="userInfo.mail" borderBottom  ref="item1" labelWidth="160rpx" :required="true">
 						<u--input v-model="model1.userInfo.mail"  disabledColor="#ffffff" placeholder="请输入接收邮箱" placeholderStyle="color: #555555" border="none" ></u--input>
 					</u-form-item>
 				</view>
-			
-					
-			
-				
+
 				<view class="" style="margin: 30rpx 0;">
 					备注信息(选填)
 				</view>
@@ -93,6 +90,38 @@
 				prsonalemail:'',
 				ids:[],
 				total:0,
+				rules:{
+					'userInfo.name': {
+						type: 'string',
+						required: true,
+						message: '请填写公司名称',
+						trigger: ['blur', 'change']
+					},
+					'personalname': {
+						type: 'string',
+						required: true,
+						message: '请填写个人姓名',
+						trigger: ['blur', 'change']
+					},
+					'prsonalemail': {
+						type: 'string',
+						required: true,
+						message: '请填写接收邮箱',
+						trigger: ['blur', 'change']
+					},
+					'userInfo.tax_no': {
+						type: 'string',
+						required: true,
+						message: '请填写税号',
+						trigger: ['blur', 'change']
+					},
+					'userInfo.email': {
+						type: 'string',
+						required: true,
+						message: '请填写接收邮箱',
+						trigger: ['blur', 'change']
+					},
+				},
 				model1: {
 					userInfo: {
 						name: '',
@@ -109,6 +138,17 @@
 				}
 			}	
 		},
+		onUnload(event){ //监听是否跳转页面
+					if(this.tjzt){
+						//tjzt为变量
+					}else{
+						uni.navigateTo({
+							url:"/pages/invoice/invoiceList"
+						})
+					}
+		
+				},
+		
 		onLoad(o){
 				let order=uni.getStorageSync("order")
 				this.ids=order.ids
@@ -155,20 +195,18 @@
 						orders:this.ids
 					}
 				}
-				if(!this.$util.email(form.email)){
-					this.$toast("请输入正确的邮箱号码")
-					return
-				}
+		
+				// if(!this.$util.email(form.email)){
+				// 	this.$toast("请输入正确的邮箱号码")
+				// 	return
+				// }
 				uni.$u.http.post('/api/bill/add', form, {
 					custom: {
 						auth: true
 					}
 				}).then((res) => {
 					console.log(res)
-					uni.showToast({
-						icon: "success",
-						title: "申请成功",
-					})
+					this.$toast("申请成功")
 					setTimeout(() => {
 						uni.navigateTo({
 							url:"/pages/invoice/invoiceList"
@@ -176,10 +214,8 @@
 					}, 1500)
 				
 				}).catch((err) => {
-					uni.showToast({
-						icon: "error",
-						title: err.message,
-					})
+					uni.hideLoading()
+					this.$toast(err.message)
 				})
 			}
 	    },

+ 40 - 11
pages/invoice/invoiceEndit.vue

xqd xqd xqd xqd xqd xqd
@@ -9,7 +9,7 @@
 			</view>
 		</view> -->
 		<view class="form">
-			<u--form labelPosition="left" :model="model1" ref="form1">
+			<u--form labelPosition="left" :model="model1" ref="form1" :rules="rules">
 				<view class="">
 					抬头类型
 				</view>
@@ -20,16 +20,21 @@
 						个人</view>
 				</view>
 
-				<u-form-item label="发票抬头" prop="userInfo.name" borderBottom ref="item1" labelWidth="160rpx">
-					<u--input v-model="model1.userInfo.name" disabledColor="#ffffff"
-						:placeholder="model1.userInfo.type==2?'请输入公司名称':'请输入个人姓名'" border="none"
-						placeholderStyle="color: #555555"></u--input>
+				<u-form-item label="发票抬头" prop="personalname" borderBottom ref="item1" labelWidth="160rpx" :required="true"  v-if="model1.userInfo.type==1">
+					<u--input v-model="personalname" disabledColor="#ffffff"
+						placeholder="请输入个人姓名" border="none"
+						placeholderStyle="color: #555555" ></u--input>
 				</u-form-item>
 
 				<view class="" v-if="model1.userInfo.type==2">
-					<u-form-item label="纳税税号" prop="userInfo.tax_no" borderBottom ref="item1" labelWidth="160rpx">
+					<u-form-item label="发票抬头" prop="userInfo.name" borderBottom ref="item1" labelWidth="160rpx" :required="true">
+						<u--input v-model="model1.userInfo.name" disabledColor="#ffffff"
+							placeholder="请输入公司名称" border="none"
+							placeholderStyle="color: #555555" ></u--input>
+					</u-form-item>
+					<u-form-item label="纳税税号" prop="userInfo.tax_no" borderBottom ref="item1" labelWidth="160rpx" :required="true">
 						<u--input v-model="model1.userInfo.tax_no" disabledColor="#ffffff" placeholder="请输入税号"
-							border="none" placeholderStyle="color: #555555"></u--input>
+							border="none" placeholderStyle="color: #555555" ></u--input>
 					</u-form-item>
 					<u-form-item label="注册地址" prop="userInfo.address" borderBottom ref="item1" labelWidth="160rpx">
 						<u--input v-model="model1.userInfo.address" disabledColor="#ffffff" placeholder="请输入注册地址"
@@ -86,6 +91,7 @@
 				// 编辑与添加状态 0保存 1添加
 				state: 0,
 				showSex: false,
+				personalname:'',
 				model1: {
 					userInfo: {
 						name: '',
@@ -98,6 +104,26 @@
 						memo: "",
 					},
 				},
+				rules:{
+					'userInfo.name': {
+						type: 'string',
+						required: true,
+						message: '请填写公司名称',
+						trigger: ['blur', 'change']
+					},
+					'personalname': {
+						type: 'string',
+						required: true,
+						message: '请填写个人姓名',
+						trigger: ['blur', 'change']
+					},
+					'userInfo.tax_no': {
+						type: 'string',
+						required: true,
+						message: '请填写税号',
+						trigger: ['blur', 'change']
+					},
+				},
 				index: 1
 			}
 		},
@@ -151,12 +177,17 @@
 			},
 			// 添加抬头
 			submit() {
+				uni.showLoading()
 				let form = this.model1.userInfo
+				if(form.type==1){
+					form.name=this.personalname
+				}
 				uni.$u.http.post('/api/invoice/add', form, {
 					custom: {
 						auth: true
 					}
 				}).then((res) => {
+					uni.hideLoading()
 					uni.showToast({
 						icon: "success",
 						title: "添加成功",
@@ -168,10 +199,8 @@
 					}, 1500)
 
 				}).catch((err) => {
-					uni.showToast({
-						icon: "error",
-						title: err.message,
-					})
+					uni.hideLoading()
+					this.$toast(err.message)
 				})
 			}
 		},

+ 15 - 2
pages/invoice/invoiceHistory.vue

xqd xqd
@@ -5,9 +5,22 @@
 			<view class="">
 				{{item.name}}
 			</view>
-			<view class="" style="color: #1E9F6A;">
+			<view class="" style="color: #1E9F6A;" v-if="item.status==1">
+				已申请
+			</view>
+			<view class="" style="color: #1E9F6A;" v-if="item.status==2">
 				已开票
 			</view>
+			<view class="" style="color: #1E9F6A;" v-if="item.status==3">
+				待发送
+			</view>
+			<view class="" style="color: #1E9F6A;" v-if="item.status==4">
+				已发送
+			</view>
+			<view class="" style="color: #1E9F6A;" v-if="item.status==5">
+				已拒绝
+			</view>
+			
 		</view>
 		<view class="content">
 			<view class="">
@@ -19,7 +32,7 @@
 				{{item.created_at.slice(0,10)}}
 			</view>
 		</view>
-		<view class="btn" @click="sendEmail(item.id)">
+		<view class="btn" @click="sendEmail(item.id)" v-if="item.status!==1">
 			发送至邮箱
 		</view>
 	</view>

+ 11 - 0
pages/invoice/invoiceList.vue

xqd xqd
@@ -39,6 +39,7 @@
 				选择抬头
 			</view>
 		</view>
+		<view v-show="bill.length==0" class="more"><text>暂无更多</text></view>
 	</view>
 </template>
 
@@ -52,6 +53,16 @@
 				ids:[]
 			}
 		},
+		onUnload(event){ //监听是否跳转页面
+					if(this.tjzt){
+						//tjzt为变量
+					}else{
+						uni.navigateTo({
+							url:"/pages/userCenter/invoice"
+						})
+					}
+		
+				},
 		onLoad() {
 			this.loadLsit()
 		},

+ 5 - 5
pages/order/applyAfterSale.vue

xqd xqd xqd xqd
@@ -24,7 +24,7 @@
 
 		<view class="applyAfterSale-center">
 			<u--form :model="form">
-				<u-form-item label="退款原因" labelWidth=200 prop="info.reason" borderBottom ref="item1">
+				<u-form-item label="退款原因" labelWidth=200 prop="info.reason" borderBottom ref="item1" :required="true">
 					<picker @change="bindPickerChange" :value="info.reason" :range="Array">
 						<view class="" style="display: flex;">
 							<u--input v-model="info.reason" disabled disabledColor="#ffffff" border="none"
@@ -34,7 +34,7 @@
 					</picker>
 
 				</u-form-item>
-				<u-form-item label="退款金额" labelWidth=200 prop="info.amount" borderBottom ref="item1">
+				<u-form-item label="退款金额" labelWidth=200 prop="info.amount" borderBottom ref="item1" :required="true">
 					<u--input v-model="info.amount" border="none" :placeholder="'最多可退款'+msg.amount"
 						placeholderStyle="color: #555555"></u--input>
 				</u-form-item>
@@ -42,9 +42,9 @@
 					<u--input v-model="info.memo" border="none" placeholder="请输入备注" placeholderStyle="color: #555555">
 					</u--input>
 				</u-form-item>
-				<u-form-item label="联系方式" labelWidth=200 prop="info.phone" borderBottom ref="item1">
+				<u-form-item label="联系方式" labelWidth=200 prop="info.phone" borderBottom ref="item1" :required="true">
 					<u--input v-model="info.phone" border="none" placeholder="请输入联系方式"
-						placeholderStyle="color: #555555" type="number"></u--input>
+						placeholderStyle="color: #555555" type="number" ></u--input>
 				</u-form-item>
 				<view class="">
 					<view class="" style="margin: 40rpx 0;">
@@ -188,7 +188,7 @@
 				}).then((res) => {
 					uni.hideLoading()
 					// uni.hideLoading()
-					that.$toast("取消成功")
+					that.$toast("申请成功")
 					setTimeout(() => {
 						uni.navigateTo({
 							url: "/pages/order/order"

+ 108 - 9
pages/order/guide.vue

xqd
@@ -4,44 +4,143 @@
 			专属森林向导提醒您
 		</view>
 		<view class="content">
-			旅行过程中使用的所有物品都必须装在行李中。行李的大小、重量、数量需要根据季节、距离、行程长短等因素,本着细心、简单的原则来决定。出行项目细致,一定要仔细考虑细节。如果能在旅途中补给,尽量不要从起点带走;而且一些应急物品一定要提前准备好。旅行需要一个小的贴身包和一个大行李箱。
+			<u-parse :content="muster.muster"></u-parse>
 		</view>
 		<view class="" style="font-size: 36rpx;font-weight: 700;">
 			您的专属森林向导
 		</view>
 		<view class="image">
-			
+			<image :src="muster.qrcode_url" mode="aspectFill"></image>
 		</view>
-		<view class="submit">
+		<view class="submit" @click="savePoster()">
 			保存二维码到相册
 		</view>
 	</view>
 </template>
 
 <script>
+	export default {
+		data() {
+			return {
+				muster: ''
+			}
+		},
+		onLoad(o) {
+			if (o.muster) {
+				let muster = decodeURIComponent(o.muster)
+				this.muster = JSON.parse(muster)
+			}
+		},
+		methods: {
+			init() {
+				let list = uni.getStorageSync("data")
+				// console.log(list[5])
+				this.list = list[5].value.phone
+			},
+			toPhone(item) {
+				uni.makePhoneCall({
+					phoneNumber: item //仅为示例
+				});
+			},
+			savePoster() {
+				uni.getSetting({ //获取用户的当前设置
+					success: (res) => {
+						if (res.authSetting['scope.writePhotosAlbum']) { //验证用户是否授权可以访问相册
+							this.saveImageToPhotosAlbum();
+						} else {
+							uni.authorize({ //如果没有授权,向用户发起请求
+								scope: 'scope.writePhotosAlbum',
+								success: () => {
+									this.saveImageToPhotosAlbum();
+								},
+								fail: () => {
+									uni.showToast({
+										title: "请打开保存相册权限,再点击保存相册分享",
+										icon: "none",
+										duration: 3000
+									});
+									setTimeout(() => {
+										uni.openSetting({ //调起客户端小程序设置界面,让用户开启访问相册
+											success: (res2) => {
+												this.saveImageToPhotosAlbum()
+												// console.log(res2.authSetting)
+											}
+										});
+									}, 3000);
+								}
+							})
+						}
+					}
+				})
+			},
+			saveImageToPhotosAlbum() {
+				let base64 = this.muster.qrcode_url.replace(/^data:image\/\w+;base64,/, ""); //去掉data:image/png;base64,
+				let filePath = wx.env.USER_DATA_PATH + '/ph_fit_qrcode.png';
+				uni.showLoading({
+					title: '加载中',
+					mask: true
+				})
+				uni.getFileSystemManager().writeFile({
+					filePath: filePath, //创建一个临时文件名
+					data: base64, //写入的文本或二进制数据
+					encoding: 'base64', //写入当前文件的字符编码
+					success: res => {
+						uni.saveImageToPhotosAlbum({
+							filePath: filePath,
+							success: function(res2) {
+								uni.hideLoading();
+								uni.showToast({
+									title: '保存成功',
+									icon: "none",
+									duration: 5000
+								})
+							},
+							fail: function(err) {
+								uni.hideLoading();
+								// console.log(err.errMsg);
+							}
+						})
+					},
+					fail: err => {
+						uni.hideLoading();
+						//console.log(err)
+					}
+				})
+			},
+		}
+	}
 </script>
 
 <style lang="less">
-	page{
+	page {
 		background-color: #F4F4F4;
 		font-size: 28rpx;
 	}
-	.pages{
+
+	.pages {
 		margin: 40rpx 30rpx;
-		.content{
+
+		.content {
 			margin: 24rpx 0 94rpx;
 		}
-		.image{
+
+		.image {
 			width: 200rpx;
 			height: 200rpx;
 			background-color: pink;
 			margin: 40rpx auto 73rpx;
+
+			image {
+				width: 100%;
+				height: 100%;
+			}
 		}
-		.submit{
+
+		.submit {
 			margin: 0 auto;
 			box-sizing: border-box;
 			text-align: center;
-			color: #FFFFFF;
+			color: #FCFCFC;
 			width: 654rpx;
 			height: 92rpx;
 			line-height: 92rpx;

+ 81 - 10
pages/order/order.vue

xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd
@@ -2,7 +2,7 @@
 	<view class="">
 		<u-sticky bgColor="#fff">
 		<view class="tab">
-		  <u-tabs :list="list1" :activeStyle="{color: '#1E9F6A'}" lineColor="#1E9F6A" lineWidth="50" :scrollable=false @click="click" ></u-tabs>
+		  <u-tabs :list="list1" :activeStyle="{color: '#1E9F6A'}" lineColor="#1E9F6A" lineWidth="50" :scrollable="false" @click="clickTab" ></u-tabs>
 		</view>
 		</u-sticky>
 		<!-- <view class="list" @click="goOrderDetail">
@@ -43,7 +43,7 @@
 			</view>
 		</view> -->
 		
-		<view class="list" v-if="state==item.status || state==0?true:false" v-for="(item,index) in orderList" :key="index" @click="goOrderDetail(item.id)">
+		<view class="list"  v-for="(item,index) in orderList" :key="index" @click="goOrderDetail(item.id)">
 			<view class="list-top">
 				<view class="">
 				订单号  {{item.code}}
@@ -78,7 +78,7 @@
 			</view>
 
 			<view class="list-bottom">
-				<view class="list-bottom-item" v-if="item.status==4||item.status==5||item.status==3">
+				<view class="list-bottom-item" v-if="item.status==4||item.status==5||item.status==3" @click.stop="buyAgin(item.good_id)">
 					<image src="../../static/orderListicon/notepad@2x.png" mode="aspectFill"></image>
 					<text class="">
 						再次预订
@@ -286,6 +286,7 @@
 				</text>
 			</view>
 		</view> -->
+		<!-- <view v-show="nomore&&orderList.length>0" class="more"><text>暂无更多</text></view> -->
 		<view class="" style="padding-top: 100rpx;width: 100%;"></view>
 	</view>
 </template>
@@ -305,12 +306,26 @@
 				  // 订单状态(0全部 1待付款 2待出行 3已完成 4售后)
 				  state:0,
 				  // 订单列表
-				  orderList:[]
+				  orderList:[],
+				  page:1,
+				  nomore:false
 			}
 		},
 		onLoad() {
 			this.init()
 		},
+		// 下拉到底部后加载新数据
+		    onReachBottom() {
+		      //判断下一页是否存在数据,不存在将显示暂无数据等提示语
+		      if (this.orderList.length >= this.page * 5) {
+		        this.page++;//页数加一
+				
+				this.init();//回调接口
+		      }else{
+				  this.nomore=true
+			  }
+		      
+		    },
 		onShow() {
 			let token=uni.getStorageSync("token")
 			if (!token) {
@@ -328,35 +343,85 @@
 				return false
 			}
 		},
+		
 		methods:{
 			init(){
 				this.$showLoadding("加载中")
-				uni.$u.http.post('/api/order/list',{status:0,page:1,per_page:5},{
+				
+				let obj={
+					status:this.state,
+					page:this.page,
+					per_page:5
+				}
+				uni.$u.http.post('/api/order/list',obj,{
 					custom: {
 						auth: true
 					}
 				}).then((res) => {
 					uni.hideLoading()
 					console.log(res)
-					this.orderList=res.data
+					if(res.data){
+						res.data.forEach(item=>{
+							this.orderList.push(item)
+						})
+					}else{
+						this.nomore=true
+					}
 				}).catch((err) => {
 					console.log( err)
 				})
 			},
-			click(item) {
+			clickTab(item) {
 			    console.log('item', item);
 				if(item.index==0){
 					this.state=0
+					this.orderList=[]
+					this.page=1
+					this.nomore=false
+					this.init()
 				}else if(item.index==1){
 					this.state=1
+					this.orderList=[]
+					this.page=1
+					this.nomore=false
+					this.init()
 				}else if(item.index==2){
+					
 					this.state=2
+					this.orderList=[]
+					this.page=1
+					this.nomore=false
+					this.init()
 				}else if(item.index==3){
+					
 					this.state=3
+					this.orderList=[]
+					this.page=1
+					this.nomore=false
+					this.init()
 				}else if(item.index==4){
-					this.state=4
+					
+					this.state=5
+					this.orderList=[]
+					this.page=1
+					this.nomore=false
+					this.init()
 				}
 			},
+			getAfterSale(){
+				this.$showLoadding("加载中")
+				uni.$u.http.post('/api/refund/list',{status:0,page:1,per_page:5},{
+					custom: {
+						auth: true
+					}
+				}).then((res) => {
+					uni.hideLoading()
+					console.log(res)
+					this.orderList=res.data
+				}).catch((err) => {
+					console.log( err)
+				})
+			},
 			goAfterSale(item){
 				uni.navigateTo({
 					url:"/pages/order/applyAfterSale?obj="+JSON.stringify(item)
@@ -395,6 +460,11 @@
 					})
 				})
 			},
+			buyAgin(id){
+				uni.navigateTo({
+					url:"/pages/travel/travelDetails?id="+id
+				})
+			},
 			// 跳转订单售后详情------待退框
 			goOrderAfterSale(){
 				uni.navigateTo({
@@ -410,7 +480,7 @@
 			// 跳转集合页面
 			goguide(item){
 				console.log(item)
-				if(item.status_text=="待付款"){
+				if(item.status==1){
 					uni.showModal({
 						title:"提示",
 						content:"订单支付后可进入专属森林向导"
@@ -418,7 +488,7 @@
 					return
 				}else{
 					uni.navigateTo({
-					url:"/pages/order/guide"
+					url:"/pages/order/guide?muster="+encodeURIComponent(JSON.stringify(item.plan))
 				})
 				}
 				
@@ -453,6 +523,7 @@
 	.tab{
 		background-color: #FFFFFF;
 	}
+	
 	.list{
 		box-shadow: 0px 2rpx 4rpx 0px rgba(0, 0, 0, 0.02);
 		border-radius: 16rpx 16rpx 16rpx 56rpx;

+ 1 - 1
pages/order/orderDetails.vue

xqd
@@ -139,7 +139,7 @@
 						去支付
 					</text>
 				</view>
-				<view class="navbar-item" @click="buyAgin" v-if="status==4||status==3">
+				<view class="navbar-item" @click="buyAgin" v-if="status==4||status==3||status==5">
 					<view class="navbariconbox">
 						<image src="../../static/orderListicon/notepad.png" mode="aspectFill"></image>
 					</view>

+ 57 - 27
pages/peopleList/addPeople.vue

xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd
@@ -5,14 +5,14 @@
 			<u-cell :border="false" size="large" title="识别身份证信息" isLink></u-cell>
 		</view>
 		<view class="form" style="">
-			<u--form labelPosition="left" :model="form" :rules="rules" ref="form1">
-				<u-form-item label="姓名" prop="userInfo.name" borderBottom ref="item1" labelWidth="200rpx">
+			<u--form labelPosition="left" :model="form" :rules="rules" ref="form1" >
+				<u-form-item label="姓名" prop="userInfo.name" borderBottom ref="item1" labelWidth="200rpx" :required="true">
 					<u--input v-model="form.userInfo.name" border="none" placeholder="填写真实姓名"
 						placeholderStyle="color: #555555"></u--input>
 				</u-form-item>
 
 				<u-form-item label="性别" labelWidth="200rpx" prop="userInfo.gender" borderBottom
-					@click="showgender = true;" ref="item1">
+					@click="showgender = true;" ref="item1" :required="true">
 					<picker @change="bindPickerChange" :value="index" :range="genderArray">
 						<view class="" style="display: flex;">
 							<u--input v-model="form.userInfo.gender" disabled disabledColor="#ffffff" placeholder="选择性别"
@@ -22,8 +22,8 @@
 					</picker>
 				</u-form-item>
 
-				<u-form-item label="出生日期" labelWidth="200rpx" borderBottom ref="item1">
-					<picker  mode="date"  :value="form.userInfo.birthday"  start="1922-01-01"  @change="bindDateChange">
+				<u-form-item label="出生日期" labelWidth="200rpx" borderBottom ref="item1" :required="true">
+					<picker  mode="date"  :value="form.userInfo.birthday"  start="1922-01-01"  @change="bindDateChange" >
 						<view class="" style="display: flex;">
 							<u--input v-model="form.userInfo.birthday" disabled disabledColor="#ffffff"
 								placeholder="选择出生日期" placeholderStyle="color: #555555" border="none"></u--input>
@@ -33,7 +33,7 @@
 					</picker>
 				</u-form-item>
 
-				<u-form-item label="证件类型" labelWidth="200rpx" borderBottom ref="item1" prop="userInfo.certificate_type">
+				<u-form-item label="证件类型" labelWidth="200rpx" borderBottom ref="item1" prop="userInfo.certificate_type" :required="true">
 					<picker @change="bindType" :value="index" :range="typeArray">
 						<view class="" style="display: flex;">
 							<u--input v-model="form.userInfo.certificate_type" disabled disabledColor="#ffffff"
@@ -43,24 +43,24 @@
 					</picker>
 				</u-form-item>
 
-				<u-form-item label="证件号码" labelWidth="200rpx" prop="userInfo.certificate_no" borderBottom ref="item1">
+				<u-form-item label="证件号码" labelWidth="200rpx" prop="userInfo.certificate_no" borderBottom ref="item1" :required="true">
 					<u--input v-model="form.userInfo.certificate_no" border="none" placeholder="填写证件号码"
-						placeholderStyle="color: #555555"></u--input>
+						placeholderStyle="color: #555555" ></u--input>
 				</u-form-item>
 
-				<u-form-item label="手机号码" labelWidth="200rpx" prop="userInfo.phone" borderBottom ref="item1">
+				<u-form-item label="手机号码" labelWidth="200rpx" prop="userInfo.phone" borderBottom ref="item1" :required="true">
 					<u--input v-model="form.userInfo.phone" border="none" placeholder="填写手机号码"
-						placeholderStyle="color: #555555"></u--input>
+						placeholderStyle="color: #555555" type="number"></u--input>
 				</u-form-item>
 
-				<u-form-item label="紧急联系人" labelWidth="200rpx" borderBottom ref="item1" prop="userInfo.emergency_name">
+				<u-form-item label="紧急联系人" labelWidth="200rpx" borderBottom ref="item1" prop="userInfo.emergency_name" :required="true">
 					<u--input v-model="form.userInfo.emergency_name" border="none" placeholder="填写紧急联系人姓名"
 						placeholderStyle="color: #555555"></u--input>
 				</u-form-item>
 
-				<u-form-item label="联系人号码" labelWidth="200rpx" borderBottom ref="item1" prop="userInfo.emergency_phone">
+				<u-form-item label="联系人号码" labelWidth="200rpx" borderBottom ref="item1" prop="userInfo.emergency_phone" :required="true">
 					<u--input v-model="form.userInfo.emergency_phone" border="none" placeholder="填写紧急联系人号码"
-						placeholderStyle="color: #555555"></u--input>
+						placeholderStyle="color: #555555" type="number"></u--input>
 				</u-form-item>
 
 				<u-form-item>
@@ -132,6 +132,12 @@
 						message: '请填写姓名',
 						trigger: ['blur', 'change']
 					},
+					'userInfo.birthday': {
+						type: 'string',
+						required: true,
+						message: '请填写出生日期',
+						trigger: ['blur', 'change']
+					},
 					'userInfo.gender': {
 						type: 'string',
 						max: 1,
@@ -231,10 +237,11 @@
 				})
 			},
 			uploadFilePromise(url) {
+				this.$showLoadding("识别中")
 				let token = uni.getStorageSync("token")
 				return new Promise((resolve, reject) => {
 					let a = uni.uploadFile({
-						url: 'https://t38.9026.com/api/common/upload',
+						url: 'https://t38.9026.com/api/card/upload',
 						filePath: url,
 						name: 'file',
 						header: {
@@ -244,7 +251,7 @@
 							user: 'test'
 						},
 						success: (res) => {
-							console.log(res,8888)
+							
 							let ayu=JSON.parse(res.data)
 							if(ayu.code==401){
 								this.$toast("请先登录")
@@ -254,17 +261,34 @@
 									})
 								})
 							}else if(ayu.code==200){
-								uni.$u.http.post('/api/card/upload', {
-									file:ayu.data.url
+								uni.$u.http.post('/api/card/info', {
+									url:ayu.data.url
 								}, {
 									custom: {
 										auth: true
 									}
 								}).then((res) => {
-									console.log(res)
-								
+									
+									let info=res
+									if(info.gender==1){
+										info.gender="男"
+									}else{
+										info.gender="女"
+									}
+									if(info.certificate_type==1){
+										info.certificate_type="身份证"
+									}
+									this.form.userInfo.gender=info.gender
+									this.form.userInfo.certificate_type=info.certificate_type
+									this.form.userInfo.name=info.name
+									this.form.userInfo.certificate_no=info.certificate_no
+									this.form.userInfo.birthday=info.birthday
+									uni.hideLoading()
+									this.$toast("识别成功")
 								}).catch((err) => {
-									console.log(err)
+									uni.hideLoading()
+									this.$toast(err.message)
+									
 								})
 							}
 							
@@ -326,7 +350,6 @@
 			},
 			// 添加出行人
 			add() {
-				console.log(this.$store.state.token, "xxxxxxxxxxx")
 				let form = JSON.parse(JSON.stringify(this.form.userInfo))
 				// form=this.form.userInfo
 				console.log(form)
@@ -338,8 +361,18 @@
 				if (form.certificate_type == "身份证") {
 					form.certificate_type = 1
 				}
-
-
+				if(!this.$util.phone(form.phone)){
+					this.$toast("请填写正确的手机号码")
+					return
+				}
+				if(!this.$util.phone(form.emergency_phone)){
+					this.$toast("请填写正确的紧急联系人手机号码")
+					return
+				}
+				if(!form.emergency_name){
+					this.$toast("请填写紧急联系人姓名")
+					return
+				}
 				uni.$u.http.post('/api/traveler/add', form, {
 					custom: {
 						auth: true
@@ -358,10 +391,7 @@
 
 				}).catch((err) => {
 					console.log(err)
-					uni.showToast({
-						icon: "error",
-						title: err.message,
-					})
+					this.$toast(err.message)
 				})
 			}
 		}

+ 31 - 15
pages/peopleList/peopleList.vue

xqd xqd xqd xqd xqd
@@ -5,7 +5,7 @@
 			<view class="list-item" v-for="(item, index) in checkboxList" :key="index">
 				<!-- <u-checkbox v-if="peopelList" iconSize=32 style="padding: 0 100rpx;" :name="item"  activeColor="#1E9F6A"></u-checkbox> -->
 				<radio v-if="peopelList" color="#1E9F6A" style="font-size: 26rpx;" :checked="item.checked"
-					:value="index" @click="checkbox(index)"></radio>
+					:value="index" @click="checkbox(index)" :disabled="item.default"></radio>
 				<view class="" style="margin:0 64rpx 0 32rpx;width:100rpx;">
 					{{item.name}}
 				</view>
@@ -72,13 +72,18 @@
 			} else {
 				this.peopelList = true
 			}
-			if (options.value) {
-				this.value = options.value
-			}
-			// uni.showLoading({
-			// 	title: '加载中'
-			// });
 			this.init()
+			setTimeout(()=>{
+				if (options.obj) {
+					let obj=JSON.parse(options.obj)
+					this.value = obj.value
+					if(obj.list.length>0){
+						this.checkboxList=obj.list
+					}
+				}
+			},500)
+			
+		
 		},
 		onShow() {
 			let token = uni.getStorageSync("token")
@@ -99,8 +104,8 @@
 			uni.showLoading({
 				title: '加载中'
 			});
-			this.init()
 		},
+		
 		methods: {
 			init() {
 				uni.$u.http.post('/api/traveler/list', {
@@ -129,7 +134,7 @@
 			// },
 			// 选择
 			checkbox(index) {
-
+				
 				let data = this.checkboxList
 				if (data[index].checked) {
 					data[index].checked = false;
@@ -145,13 +150,24 @@
 					}
 				})
 				this.getpeopleList = arr
-				if (this.getpeopleList.length > this.value) {
-					this.$toast('只能选择' + this.value + '人')
-					this.defaultIndex = index
-					// return
+				console.log(this.getpeopleList, this.value)
+				if (this.getpeopleList.length ==this.value) {
+					// this.$toast('只能选择' + this.value + '人')
+					this.checkboxList.forEach(item=>{
+						if(!item.checked){
+							item.default=true
+						}
+					})
+					console.log(this.checkboxList,5555)
+				}else{
+					this.checkboxList.forEach(item=>{
+							item.default=false
+					})
 				}
-				console.log(this.getpeopleList, 888)
-				this.$store.commit('getpeopleList', arr)
+				
+				this.$store.commit('getpeopleList', this.checkboxList)
+				console.log(this.$store.state.openpeopleList,454)
+				this.$store.commit("getopenpeopleList", 1)
 			},
 			// 确定添加联系人
 			surePeople() {

+ 70 - 45
pages/travel/travelPeople.vue

xqd xqd xqd xqd xqd xqd xqd xqd xqd
@@ -23,7 +23,7 @@
 				<view :class="houseType==index?'houseType-item-active':'houseType-item'" v-for="item,index in houselist"
 					@click="chooseHouse(index,item.price,item.room_id)">
 					<view class="image">
-						<image :src="item.room_picture" @touchend="dblclick(item.room_picture)" ></image>
+						<image :src="item.room_picture" @touchend="dblclick(item.room_picture)"></image>
 						<view class="surplus">
 							剩余 {{item.number}}
 						</view>
@@ -110,7 +110,7 @@
 		</view>
 
 
-		<u-popup :show="details" @close="details = false" duration="0"  :overlay="false"
+		<u-popup :show="details" @close="details = false" duration="0" :overlay="false"
 			:customStyle="{'margin-bottom':'104rpx','background':' #F9F9F9 ','height':'104rpx'}">
 			<view class="order">
 				<view class="icon" @click="details = false">
@@ -182,11 +182,11 @@
 				// 同住人
 				cohabits: [],
 				room_id: 0,
-				value:1
+				value: 1
 			}
 		},
 		onLoad(options) {
-			that=this
+			that = this
 			console.log(options)
 			let newdays = decodeURIComponent(options.obj)
 			let datainfo = JSON.parse(newdays)
@@ -201,23 +201,45 @@
 			this.init()
 		},
 		onShow() {
-			console.log(this.$store.state.peopleList)
-			this.travelers = this.$store.state.peopleList
+			let open = this.$store.state.openpeopleList
+			console.log(open, 890890890)
+			if (open == 0) {
+				this.$store.commit('getpeopleList', [])
+			} else {
+				let arr = this.$store.state.peopleList
+				this.travelers = []
+				arr.forEach(item => {
+					if (item.checked) {
+						this.travelers.push(item)
+					}
+				})
+			}
+			// console.log(this.$store.state.peopleList,7789789)
+
+		},
+		onUnload(event) { //监听是否跳转页面
+			if (this.tjzt) {
+				//tjzt为变量
+			} else {
+				let arr = []
+				this.$store.commit("getpeopleList", arr)
+				this.$store.commit("getopenpeopleList", 0)
+			}
+
 		},
 		
 		methods: {
-			moveAdd(index){
-				let addPel=this.travelers[index]
-				addPel.state=0
+			moveAdd(index) {
+				let addPel = this.travelers[index]
+				addPel.state = 0
 				uni.navigateTo({
-					url:`/pages/peopleList/addPeople?state=0&info=${JSON.stringify(addPel)}`
+					url: `/pages/peopleList/addPeople?state=0&info=${JSON.stringify(addPel)}`
 				})
 			},
-			dblclick(url,e) {
+			dblclick(url, e) {
 				this.touchNum++
 				setTimeout(() => {
-					if (this.touchNum == 1) {
-					}
+					if (this.touchNum == 1) {}
 					if (this.touchNum >= 2) {
 						let imgUrl = []
 						imgUrl.push(url)
@@ -238,17 +260,23 @@
 				let end = newdays.end_at.slice(0, 10)
 				this.day = `${start}~${end}`
 				this.houselist = newdays.rooms
-				this.room_id=this.houselist[0].room_id
-				this.houseType=0
-				this.roomPrice=Number(this.houselist[0].price)
-				this.totalromprice=Number(this.houselist[0].price)
-				
+				this.room_id = this.houselist[0].room_id
+				this.houseType = 0
+				this.roomPrice = Number(this.houselist[0].price)
+				this.totalromprice = Number(this.houselist[0].price)
+
 				console.log(this.day, this.houselist)
 			},
 			// 选择出行人
 			choosePeople() {
+				let list = this.$store.state.peopleList
+				let obj = {
+					value: this.value,
+					list: list
+				}
+				console.log(obj, 9999999)
 				uni.navigateTo({
-					url: "/pages/peopleList/peopleList?value="+this.value,
+					url: "/pages/peopleList/peopleList?obj=" + JSON.stringify(obj),
 				})
 			},
 			// 查看出行人
@@ -270,15 +298,19 @@
 			},
 			// 选择房间数量
 			valChange(e) {
-				this.value=e.value
+				let arr = []
+				this.$store.commit("getpeopleList", arr)
+				this.travelers = []
+				console.log(this.travelers, 77788)
+				this.value = e.value
 				this.totalromprice = Number(this.roomPrice) * e.value
 			},
 			// 添加同住人e
 			addcohabits() {
-				
-				for(let i in this.cohabits){
+
+				for (let i in this.cohabits) {
 					console.log(i)
-					if(this.cohabits[i]==''){
+					if (this.cohabits[i] == '') {
 						console.log(i)
 						this.$toast("请输入正确的同住人姓名")
 						return
@@ -291,23 +323,23 @@
 				this.houseType = index
 				this.roomPrice = price
 				this.room_id = id
-				this.totalromprice = Number(this.roomPrice)*this.value
+				this.totalromprice = Number(this.roomPrice) * this.value
 				console.log(index, price, id, "<=============")
 			},
 			// 提交订单
 			Submit() {
-				if(this.chooseroommate==2){
-					for(let i in this.cohabits){
+				if (this.chooseroommate == 2) {
+					for (let i in this.cohabits) {
 						console.log(i)
-						if(this.cohabits[i]==''){
+						if (this.cohabits[i] == '') {
 							console.log(i)
 							this.$toast("请输入正确的同住人姓名")
 							return
 						}
 					}
 				}
-				
-				if(this.travelers.length==0){
+
+				if (this.travelers.length == 0) {
 					this.$toast("请选择出行人")
 					return
 				}
@@ -319,7 +351,7 @@
 				suborder.travelers = []
 				suborder.cohabits = this.cohabits
 				suborder.cohabit_type = this.chooseroommate
-				suborder.total=this.totalromprice
+				suborder.total = this.totalromprice
 				this.travelers.forEach((item, index) => {
 					// console.log(item.id)
 					suborder.travelers.push(item.id)
@@ -330,22 +362,15 @@
 						auth: true
 					}
 				}).then((res) => {
-// <<<<<<< HEAD
-					// console.log(res)
-					// suborder.name = this.goodsInfo.name
-					// suborder.subtitle = this.goodsInfo.subtitle
-					// suborder.day = this.day
-					// suborder.people = []
-					// this.travelers.forEach((item, index) => {
-// =======
+
 					console.log(res)
-					suborder.order_id=res.id // 订单id
-					suborder.name=this.goodsInfo.name
-					suborder.subtitle=this.goodsInfo.subtitle
-					suborder.day=this.day
-					suborder.people=[]
-					this.travelers.forEach((item,index)=>{
-// >>>>>>> 4815da3871d3be566f42d407886303debb6a2364
+					suborder.order_id = res.id // 订单id
+					suborder.name = this.goodsInfo.name
+					suborder.subtitle = this.goodsInfo.subtitle
+					suborder.day = this.day
+					suborder.people = []
+					this.travelers.forEach((item, index) => {
+
 						suborder.people.push(item.name)
 					})
 					uni.navigateTo({

+ 10 - 0
pages/userCenter/invoice.vue

xqd
@@ -23,6 +23,16 @@
 				
 			}
 		},
+		onUnload(event){ //监听是否跳转页面
+					if(this.tjzt){
+						//tjzt为变量
+					}else{
+						uni.navigateTo({
+							url:"/pages/userCenter"
+						})
+					}
+		
+				},
 		methods:{
 			// 跳转发票
 			goList(){

+ 6 - 1
store/index.js

xqd xqd
@@ -17,6 +17,7 @@ const store = new Vuex.Store({
 	peopleList:[],
 	// c出行人列表
 	list:[],
+	openpeopleList:0,
 	getuser:false,
 	userMsg:{},
   },
@@ -50,7 +51,11 @@ const store = new Vuex.Store({
    // 选择出行人列表
    getpeopleList(state,arr){
 	   state.peopleList=arr
-	    // console.log(state.peopleList,"<==============选择人")
+	    console.log(state.peopleList,"<==============选择人")
+   },
+   getopenpeopleList(state,data){
+   	   state.openpeopleList=data
+   	    console.log(state.peopleList,"<==============选择人")
    },
    getuser(state, data) {
        state.getuser = data;