Jelajahi Sumber

新增人员选择和医院选择

shuchang 3 bulan lalu
induk
melakukan
18b7d53d4a

+ 4 - 0
common/config/api.js

@@ -10,6 +10,10 @@ export const loginUrl = (data) => http.get('/dev-api/api/wechat/login', data);
 export const bindInfoUrl = (data) => http.get('/dev-api/api/wechat/bindPhone', data);
 // 提交
 export const applyUrl = (params, config = {}) => http.post('/dev-api/care/applications', params, config);
+// 获取申请人列表
+export const getPersonListUrl = (data) => http.get('/dev-api/care/persons/list', data);
+// 获取所在医院列表
+export const getHospitalListUrl = (data) => http.get('/dev-api/care/hospital/list', data);
 
 // 注册
 export const registerUrl = (params, config = {}) => http.post('/xc-order/api//order/user/register', params, config);

+ 13 - 8
pages.json

@@ -96,19 +96,24 @@
 				}
 			},
 			{
-				"path" : "pages/protocol/list",
-				"style" : 
-				{
+				"path": "pages/protocol/list",
+				"style": {
+					"navigationStyle": "custom",
+					"navigationBarTitleText": "协议列表"
+				}
+			},
+			{
+				"path": "pages/protocol/info",
+				"style": {
 					"navigationStyle": "custom",
-					"navigationBarTitleText" : "协议列表"
+					"navigationBarTitleText": "协议详情"
 				}
 			},
 			{
-				"path" : "pages/protocol/info",
-				"style" : 
-				{
+				"path": "pages/choose-hospital/choose-hospital",
+				"style": {
 					"navigationStyle": "custom",
-					"navigationBarTitleText" : "协议详情"
+					"navigationBarTextStyle": "black"
 				}
 			}
 		]

+ 100 - 28
pages/subpack/pages/apply/apply.vue

@@ -14,52 +14,43 @@
 						style="background: linear-gradient( 180deg, #E8F4FF 0%, #FFFFFF 100%);border-radius: 16rpx;">
 						<view class="flex-row align-center justify-between">
 							<text class="font text-black2">姓名</text>
-							<view class="flex-row justify-end" style="width: 440rpx;">
-								<up-input placeholder="请输入申请人姓名" border="none" v-model.trim="formData.name" clearable
-									:maxlength="20" input-align="end"></up-input>
-								<!-- <text class="font text-black2">请选择申请人</text> -->
-							</view>
+							<text class="font text-black2" @click="goChoosePeople">{{formData.name}}</text>
 						</view>
 						<view class="flex-row align-center justify-between mt-4">
 							<text class="font text-black2">护理需求</text>
 							<view style="width: 440rpx;">
 								<up-input placeholder="请输入护理需求" border="none" v-model.trim="formData.demand" clearable
-									:maxlength="50"></up-input>
+									:maxlength="50" inputAlign="right"></up-input>
 							</view>
 						</view>
 						<view class="flex-row align-center justify-between mt-4">
 							<text class="font text-black2">首选护理人员性别</text>
-							<view style="width: 440rpx;">
-								<u-input placeholder="请输入性别" border="none" type="number" v-model.trim="formData.sex"
-									clearable :maxlength="11"></u-input>
-							</view>
+							<text class="font text-black2" @click="chooseGender">{{formData.sex === '0'?'女':'男'}}</text>
 						</view>
 						<view class="flex-row align-center justify-between mt-4">
 							<text class="font text-black2">所在医院</text>
-							<view style="width: 440rpx;">
-								<u-input placeholder="请输入所在医院" border="none" type="number"
-									v-model.trim="formData.hospital" clearable :maxlength="11"></u-input>
-							</view>
+							<text class="font text-black2" @click="goChooseHospital">{{formData.hospital}}</text>
 						</view>
 						<view class="flex-row align-center justify-between mt-4">
 							<text class="font text-black2">详细地址</text>
 							<view style="width: 440rpx;">
-								<u-input placeholder="请输入详细地址" border="none" type="number"
-									v-model.trim="formData.address" clearable :maxlength="11"></u-input>
+								<u-input placeholder="请输入具体科室/楼层/房间/床号" border="none" v-model.trim="formData.address"
+									clearable :maxlength="50" inputAlign="right"></u-input>
 							</view>
 						</view>
 						<view class="flex-row align-center justify-between mt-4">
 							<text class="font text-black2">预计天数</text>
 							<view style="width: 440rpx;">
 								<u-input placeholder="请输入预计天数" border="none" type="number"
-									v-model.trim="formData.dayCount" clearable :maxlength="11"></u-input>
+									v-model.trim="formData.dayCount" clearable :maxlength="5"
+									inputAlign="right"></u-input>
 							</view>
 						</view>
 						<view class="flex-row align-center justify-between mt-4">
 							<text class="font text-black2">备注</text>
 							<view style="width: 440rpx;">
-								<u-input placeholder="请输入备注" border="none" type="number" v-model.trim="formData.remark"
-									clearable :maxlength="50"></u-input>
+								<u-input placeholder="请输入备注" border="none" v-model.trim="formData.remark" clearable
+									:maxlength="100" inputAlign="right"></u-input>
 							</view>
 						</view>
 					</view>
@@ -83,19 +74,60 @@
 		data() {
 			return {
 				formData: {
-					personId: '6',
-					name: '',
+					personId: '',
+					name: '请选择申请人',
 					demand: '',
-					sex: '',
-					hospital: '',
+					sex: '0',
+					hospital: '请选择所在医院',
 					address: '',
 					dayCount: '',
 					remark: ''
 				}
 			}
 		},
+		onLoad() {
+			uni.$on('personChoose', (e) => {
+				console.log(e);
+				this.formData.personId = e.id;
+				this.formData.name = e.name;
+			});
+
+			uni.$on('hospitalChoose', (e) => {
+				console.log(e);
+				this.formData.hospital = e.name;
+			})
+		},
+		onUnload() {
+			uni.$off('personChoose');
+			uni.$off('hospitalChoose');
+		},
 		methods: {
-			handleSubmit() {
+			goChooseHospital() {
+				uni.navigateTo({
+					url: '/pages/subpack/pages/choose-hospital/choose-hospital'
+				})
+			},
+			goChoosePeople() {
+				uni.navigateTo({
+					url: '/pages/subpack/pages/choose-people/choose-people'
+				})
+			},
+			chooseGender() {
+				uni.showActionSheet({
+					title: '首选护理人员性别',
+					itemList: ['女', '男'],
+					success: (res) => {
+						// console.log('选择了第' + (res.tapIndex) + '个选项');
+						this.formData.sex = res.tapIndex + '';
+					},
+					fail: (err) => {
+						console.log('弹窗取消');
+					}
+				});
+			},
+
+			apply() {
+				uni.showLoading();
 				applyUrl({
 						address: this.formData.address,
 						applyDate: dayjs().format('YYYY-MM-DD'),
@@ -108,15 +140,55 @@
 						remark: this.formData.remark
 					})
 					.then(res => {
-						console.log('提交');
+						uni.hideLoading();
+						uni.showModal({
+							title: '提示',
+							content: `提交成功`,
+							showCancel: false,
+							confirmText: '返回首页',
+							success: (e) => {
+								if (e.confirm) {
+									uni.navigateBack()
+								}
+							}
+						})
 					})
 					.catch(err => {
+						uni.hideLoading();
 						console.log(err);
 					})
 			},
-			goChoosePeople() {
-				uni.navigateTo({
-					url: '/pages/subpack/pages/choose-people/choose-people'
+
+			handleSubmit() {
+				if (this.formData.name === '请选择申请人' || !this.formData.name) {
+					return uni.$u.toast('请选择申请人')
+				}
+
+				if (!this.formData.demand) {
+					return uni.$u.toast('请输入护理需求')
+				}
+
+				if (this.formData.hospital === '请选择所在医院' || !this.formData.hospital) {
+					return uni.$u.toast('请选择所在医院')
+				}
+
+				if (!this.formData.address) {
+					return uni.$u.toast('请输入详情地址')
+				}
+
+				if (!this.formData.dayCount) {
+					return uni.$u.toast('请输入预计天数')
+				}
+
+				uni.showModal({
+					title: '提示',
+					content: `确定提交此次申请吗?`,
+					showCancel: true,
+					success: (e) => {
+						if (e.confirm) {
+							this.apply();
+						}
+					}
 				})
 			}
 		}

+ 94 - 0
pages/subpack/pages/choose-hospital/choose-hospital.vue

@@ -0,0 +1,94 @@
+<template>
+	<z-paging ref="hospitalPaging" v-model="dataList" @query="queryList" loading-more-no-more-text="没有更多医院了">
+		<template v-slot:top>
+			<up-navbar class="u-navbar-box" title="所在医院" auto-back placeholder bgColor="transparent"
+				:title-style="{fontWeight:'bold'}">
+			</up-navbar>
+			<view class="p-12">
+				<up-search placeholder="请输入所在医院名称" clearabled v-model="keyword" @search="handleSearch"
+					@custom="handleSearch"></up-search>
+			</view>
+		</template>
+		<view v-for="(item,index) in dataList" :key="item.personId" class="flex-row align-center justify-center mt-24"
+			@click="handleItemClick(item)">
+			<view class="pl-4 py-2 flex-row align-center"
+				style="width: 686rpx;background: linear-gradient( 178deg, #EAF4FF 0%, #FFFFFF 100%);box-shadow: 0rpx 4rpx 20rpx 0rpx rgba(138,196,255,0.2);border-radius: 16rpx;border: 2rpx solid #FFFFFF;box-sizing: border-box;">
+				<image src="@/pages/subpack/static/images/item-img.png" style="width: 68rpx;height: 78rpx;"
+					mode="aspectFill"></image>
+				<view class="flex-column ml-4">
+					<view class="flex-row align-center">
+						<view class="flex-row align-center">
+							<up-icon name="bookmark-fill" color="#2979ff" :size="15"></up-icon>
+							<text class="font text-black2 ml-08 font-weight-bolder">{{item.name}}</text>
+						</view>
+					</view>
+					<view class="flex-row align-center mt-16">
+						<text class="font" style="color: #666666;">地址:{{item.address}}</text>
+					</view>
+				</view>
+			</view>
+		</view>
+	</z-paging>
+</template>
+
+<script>
+	import {
+		getHospitalListUrl
+	} from '@/common/config/api.js'
+	export default {
+		data() {
+			return {
+				keyword: '',
+				dataList: []
+			}
+		},
+		computed: {
+			computeNavHeight() {
+				console.log(uni.$u.sys());
+				return uni.$u.sys().statusBarHeight + 44 + 'px'
+			}
+		},
+		methods: {
+			handleItemClick(item) {
+				uni.$emit('hospitalChoose', {
+					// id: item.personId,
+					name: item.name
+				})
+
+				setTimeout(() => {
+					uni.navigateBack()
+				}, 200)
+			},
+			handleSearch() {
+				this.$refs.hospitalPaging.reload();
+			},
+			queryList(pageNo, pageSize) {
+				getHospitalListUrl({
+						params: {
+							pageNum: pageNo,
+							pageSize: pageSize,
+							name: this.keyword
+						}
+					})
+					.then(res => {
+						console.log('人员列表: ', res);
+						this.$refs.hospitalPaging.complete(res);
+					})
+					.catch(err => {
+						console.log('err: ', err);
+						this.$refs.hospitalPaging.complete(false);
+					})
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	page {
+		background-color: #F6F8FD;
+	}
+
+	.u-navbar-box {
+		background: radial-gradient(circle at left, #FFE5E4 0%, #EEF2F5 40%, #DBEEFB 100%);
+	}
+</style>

+ 66 - 16
pages/subpack/pages/choose-people/choose-people.vue

@@ -1,21 +1,44 @@
 <template>
-	<z-paging ref="listPaging" v-model="dataList" @query="queryList" loading-more-no-more-text="没有更多消息了">
+	<z-paging ref="personPaging" v-model="dataList" @query="queryList" loading-more-no-more-text="没有更多人员了">
 		<template v-slot:top>
-			<div class="flex-column">
-				<up-navbar class="u-navbar-box" title="申请人列表" bgColor="transparent" auto-back
-					:title-style="{fontWeight:'bold'}">
-				</up-navbar>
-				<!-- <u-search v-model="keyword" :maxlength="10" placeholder="请输入人员姓名"></u-search> -->
-				<text>123</text>
-			</div>
+			<up-navbar class="u-navbar-box" title="申请人" auto-back placeholder bgColor="transparent"
+				:title-style="{fontWeight:'bold'}">
+			</up-navbar>
+			<view class="p-12">
+				<up-search placeholder="请输入申请人姓名" clearabled v-model="keyword" @search="handleSearch"
+					@custom="handleSearch"></up-search>
+			</view>
 		</template>
-		<!-- <ItemReservation v-for="(item,index) in dataList" :item="item" :index="index" @cancel="handleCancel">
-		</ItemReservation> -->
+		<view v-for="(item,index) in dataList" :key="item.personId" class="flex-row align-center justify-center mt-24"
+			@click="handleItemClick(item)">
+			<view class="pl-4 py-2 flex-row align-center"
+				style="width: 686rpx;background: linear-gradient( 178deg, #EAF4FF 0%, #FFFFFF 100%);box-shadow: 0rpx 4rpx 20rpx 0rpx rgba(138,196,255,0.2);border-radius: 16rpx;border: 2rpx solid #FFFFFF;box-sizing: border-box;">
+				<image src="@/pages/subpack/static/images/item-img.png" style="width: 68rpx;height: 78rpx;"
+					mode="aspectFill"></image>
+				<view class="flex-column ml-4">
+					<view class="flex-row align-center">
+						<view class="flex-row align-center">
+							<up-icon name="account-fill" color="#222222" :size="15"></up-icon>
+							<text class="font text-black2 ml-08 font-weight-bolder">{{item.name}}</text>
+						</view>
+						<view class="flex-row align-center ml-4">
+							<up-icon name="phone" color="#666666" :size="15"></up-icon>
+							<text class="font ml-08" style="color: #666666;">{{item.phoneNumber}}</text>
+						</view>
+					</view>
+					<view class="flex-row align-center mt-16">
+						<text class="font" style="color: #666666;">年龄:{{item.age}}</text>
+						<text class="font ml-2" style="color: #666666;">性别:{{item.gender === "1"?'男':'女'}}</text>
+					</view>
+				</view>
+			</view>
+		</view>
 	</z-paging>
 </template>
 
 <script>
 	import {
+		getPersonListUrl,
 		getReservationListUrl,
 		cancelReservationUrl
 	} from '@/common/config/api.js'
@@ -37,12 +60,33 @@
 			}
 		},
 		methods: {
+			handleItemClick(item) {
+				uni.showModal({
+					title: '提示',
+					content: `确定选择为${item.name}提交看护申请吗?`,
+					showCancel: true,
+					success: (e) => {
+						if (e.confirm) {
+							uni.$emit('personChoose', {
+								id: item.personId,
+								name: item.name
+							})
+							setTimeout(() => {
+								uni.navigateBack()
+							}, 200)
+						}
+					}
+				})
+			},
+			handleSearch() {
+				this.$refs.personPaging.reload();
+			},
 			handleCancel(orderId) {
 				cancelReservationUrl(orderId)
 					.then(res => {
 						console.log('取消预约', res);
 						uni.$u.toast('取消成功')
-						this.$refs.listPaging.reload();
+						this.$refs.personPaging.reload();
 					})
 					.catch(err => {
 						console.log(err);
@@ -50,20 +94,20 @@
 					})
 			},
 			queryList(pageNo, pageSize) {
-				getReservationListUrl({
+				getPersonListUrl({
 						params: {
 							pageNum: pageNo,
 							pageSize: pageSize,
-							createUser: this.vuex_user.id
+							name: this.keyword
 						}
 					})
 					.then(res => {
-						console.log('消息列表: ', res);
-						this.$refs.listPaging.complete(res.records);
+						console.log('人员列表: ', res);
+						this.$refs.personPaging.complete(res);
 					})
 					.catch(err => {
 						console.log('err: ', err);
-						this.$refs.listPaging.complete(false);
+						this.$refs.personPaging.complete(false);
 					})
 			}
 		}
@@ -75,6 +119,12 @@
 		background-color: #F6F8FD;
 	}
 
+	.container {
+		height: 100vh;
+		display: flex;
+		flex-direction: column;
+	}
+
 	.u-navbar-box {
 		background: radial-gradient(circle at left, #FFE5E4 0%, #EEF2F5 40%, #DBEEFB 100%);
 	}

TEMPAT SAMPAH
pages/subpack/static/images/item-img.png


+ 1 - 1
pages/tabbar/application/application.vue

@@ -61,7 +61,7 @@
 			this.getUserInfo();
 		},
 		onShow() {
-			this.getMsgCount();
+			// this.getMsgCount();
 		},
 		computed: {
 			computeHeight() {

+ 4 - 3
utils/request/index.js

@@ -10,14 +10,15 @@ import {
 //  初始化请求配置
 const initRequest = (vm) => {
 	http.setConfig((defaultConfig) => {
+		defaultConfig.baseURL = 'http://133.46.158.100' /* 根域名 */
 		// defaultConfig.baseURL = 'http://tkhtest.natapp1.cc' /* 根域名 */
-		defaultConfig.baseURL = 'http://127.0.0.1' /* 根域名 */
+		// defaultConfig.baseURL = 'http://127.0.0.1' /* 根域名 */
 		defaultConfig = {
-			...defaultConfig, 
+			...defaultConfig,
 			custom: {
 				loading: true, //是否显示loading
 				isCloseLoad: true, //请求返回数据后,是否关闭loading
-				validateCode: true,//验证code
+				validateCode: true, //验证code
 			},
 		}
 		/* defaultConfig 为默认全局配置 */