소스 검색

[dev]
1、进行错误提醒

Neo 1 년 전
부모
커밋
4c007a6945
3개의 변경된 파일112개의 추가작업 그리고 57개의 파일을 삭제
  1. 9 4
      pages/edit/edit.vue
  2. 80 38
      pages/index/index.vue
  3. 23 15
      pages/review/review.vue

+ 9 - 4
pages/edit/edit.vue

@@ -461,6 +461,8 @@ const handleSubmit = debounce(async()=>{
 	if(res.code===200){
 		console.log('depoly success>>>')
 		
+	}  else {
+		uni.$showMsg(res.msg, 2000)
 	}
 	if(isPrint.value){
 		// 直接调用接口,然后打印
@@ -516,10 +518,13 @@ const dialogConfirm = debounce(async()=>{
 	
 	// 打印成功后调用/userPrescription/sendToUser
 	const res = await sendToUser({
-			token: uni.getStorageSync('token'),
-			data: JSON.stringify({id:uni.getStorageSync('userId')})
-		})
-		console.log('sendToUser res',res)
+		token: uni.getStorageSync('token'),
+		data: JSON.stringify({id:uni.getStorageSync('userId')})
+	})
+	console.log('sendToUser res',res)
+	if (res.code !== 200){
+		uni.$showMsg(res.msg, 2000)
+	}
 	uni.redirectTo({
 		url:"/pages/index/index"
 	})

+ 80 - 38
pages/index/index.vue

@@ -78,10 +78,14 @@
 						v-if="orderList.length > 0" 
 						class="order-list-wrap" 
 						scroll-y="true" 
-						:scroll-top="50"
-						@scrolltoupper="loadPreList"
+						:scroll-top="0"
+						refresher-enabled="true"
+						:refresher-triggered="trigger"
+						
+						@refresherrefresh="loadPreList"
 						@scrolltolower="loadMoreList"
 					>
+					<!-- @scrolltoupper="loadPreList" -->
 						<template v-for="(v,i) in orderList" :key="i">
 							<orderCard v-if="v " :s="s" :v="v" :work-Status="workStatus" :c="tabActive"
 								@emit-select="emitSelect"
@@ -112,6 +116,7 @@ import debounce from 'lodash.debounce'
 
 // import { ID_INJECTION_KEY } from 'element-plus'
 
+const trigger = ref(false)
 
 const userInfo = ref({})
 const workStatus = ref('0')
@@ -208,8 +213,10 @@ onLoad(async () => {
 	if (res.code === 200) {
 		total.value = res.total
 		orderList.value = res.rows
-		if(orderList.value.length < pageSize.value){
+		if(total.value == orderList.value.length){
 			isBottom.value = true
+		} else {
+			isBottom.value = false
 		}
 		if(tabActive.value ==0){
 			tabList.value[0].leng = orderList.value.length
@@ -238,12 +245,19 @@ const updateUser = (v)=>{
 
 const emitSelect = (v)=>{
 	console.log('emitSelect', v)
+	
+	const index1 = orderList.value.findIndex(x=>x.id==v.id)
+	if (index1>-1){
+		orderList.value[index1].selected = v.selected
+	}
 	// 查在ids中查找v,如果存在就删除,如果不存在就添加
-	const index = ids.value.findIndex(x=>x==v)
+	const index = ids.value.findIndex(x=>x==v.id)
+	
+	
 	if (index>-1){
 		ids.value.splice(index, 1)
 	} else {
-		ids.value.push(v)
+		ids.value.push(v.id)
 	}
 }
 
@@ -268,8 +282,10 @@ const handleSearch = debounce(async()=>{
 		if (res.code === 200) {
 			total.value = res.total
 			orderList.value = res.rows
-			if(orderList.value.length < pageSize.value){
+			if(total.value == orderList.value.length){
 				isBottom.value = true
+			} else {
+			isBottom.value = false
 			}
 		}
 	}
@@ -296,9 +312,11 @@ const handleSearch = debounce(async()=>{
 		if (res.code === 200) {
 			total.value = res.total
 			orderList.value = res.rows
-			if(orderList.value.length < pageSize.value){
+			if(total.value == orderList.value.length){
 				isBottom.value = true
-			}
+			} else {
+			isBottom.value = false
+		}
 			if(tabActive.value ==0){
 				tabList.value[0].leng = orderList.value.length
 			}
@@ -306,7 +324,7 @@ const handleSearch = debounce(async()=>{
 	}
 },500)
 
-const handleRefresh = debounce(()=>{
+const handleRefresh = async()=>{
 	
 	console.log('yijianshifang >orderList>>', orderList.value)
 	// let ids = ''
@@ -316,6 +334,28 @@ const handleRefresh = debounce(()=>{
 	// 	}})
 		
 	// console.log('yijianshifang >orderList>>666',ids)
+	const params = {
+		token: uni.getStorageSync('token'),
+		data: JSON.stringify({
+			currentUserId: parseInt(uni.getStorageSync('userId')) || 0,
+			name: searchVal.value.trim(),
+			pageNum: page.value,
+			pageSize: pageSize.value,
+			status: tabList.value[tabActive.value].status,
+			
+		})
+	}
+	const {data:res} = await receiveOrderList(params)
+	if (res.code === 200) {
+		total.value = res.total
+		orderList.value = res.rows
+		if(total.value == orderList.value.length){
+			isBottom.value = true
+		} else {
+		isBottom.value = false
+		}
+	}
+	
 	s.value = '0'
 	console.log('handleRefresh>>ids.value ',ids.value)
 	ids.value = []
@@ -347,12 +387,12 @@ const handleRefresh = debounce(()=>{
 	// 		ids.value = []
 	// 	}
 	// }
-},500)
+}
 
 
 			
 
-const handleRelease  = debounce(async()=>{
+const handleRelease  = async()=>{
 	console.log('ids.value.length',ids.value.length)
 	
 	const params = {
@@ -387,10 +427,12 @@ const handleRelease  = debounce(async()=>{
 	console.log('refresh orderList checkIndex params',paramss)
 	const {data:ress} = await receiveOrderList(paramss)
 	if (ress.code === 200) {
-		total.value = res.total
+		total.value = ress.total
 		orderList.value = ress.rows
-		if(orderList.value.length < pageSize.value){
+		if(total.value == orderList.value.length){
 			isBottom.value = true
+		} else {
+			isBottom.value = false
 		}
 		if(tabActive.value ==0){
 			tabList.value[0].leng = orderList.value.length
@@ -398,13 +440,6 @@ const handleRelease  = debounce(async()=>{
 	}
 	s.value = '1'
 	console.log('after refresh orderList handleRelease ids.value', ids.value)
-},500)
-
-
-const handleSelect = ()=>{
-	console.log('handleSelect>>',props.v.id)
-	emit('emitSelect', props.v.id)
-	oselected.value = !oselected.value
 }
 
 const handleGetOffice = (e)=>{
@@ -538,7 +573,7 @@ const handleGetTags = (v)=>{
 }
 
 // 更新处方列表
-const checkIndex = debounce(async(index) => {
+const checkIndex = async(index) => {
 	tabActive.value = index
 	page.value= 1
 	console.log('index',index)
@@ -561,8 +596,10 @@ const checkIndex = debounce(async(index) => {
 	if (res.code === 200) {
 		total.value = res.total
 		orderList.value = res.rows
-		if(orderList.value.length < pageSize.value){
+		if(total.value == orderList.value.length){
 			isBottom.value = true
+		} else {
+			isBottom.value = false
 		}
 		if(tabActive.value ==0){
 			tabList.value[0].leng = orderList.value.length
@@ -585,17 +622,14 @@ const checkIndex = debounce(async(index) => {
 			console.log('selectDepartment officeArr.value', officeArr.value)
 		}
 	}
-},500)
-
-const openTime = ()=>{
-    proxy.$refs.timeslot.open()
 }
 
-const loadMoreList = debounce(async()=>{
-	if(s.value=='0'){
-		console.log('一键释放模式中,不需要加载更多')
-		return
-	}
+
+const loadMoreList = async()=>{
+	// if(s.value=='0'){
+	// 	console.log('一键释放模式中,不需要加载更多')
+	// 	return
+	// }
 	console.log('loadMoreList>>>')
 	if(isBottom.value){
 		return
@@ -632,21 +666,24 @@ const loadMoreList = debounce(async()=>{
 		console.log('orderList.value after',orderList.value)
 		if(total.value == orderList.value.length){
 			isBottom.value = true
+		} else {
+			isBottom.value = false
 		}
 		if(tabActive.value ==0){
 			console.log('tabActive===',)
 			tabList.value[0].leng = orderList.value.length
 		}
 	}
-},500)
+}
 
  
-const loadPreList = debounce(async()=>{
+const loadPreList = async()=>{
 	console.log('loadPreList>>>')
-	if(s.value=='0'){
-		console.log('一键释放模式中,不需要刷新')
-		return
-	}
+	// if(s.value=='0'){
+	// 	console.log('一键释放模式中,不需要刷新')
+	// 	return
+	// }
+	trigger.value = true;
 	page.value = 1
 	const params = {
 		token: uni.getStorageSync('token'),
@@ -671,12 +708,17 @@ const loadPreList = debounce(async()=>{
 		orderList.value = res.rows
 		if(orderList.value.length < pageSize.value){
 			isBottom.value = true
+		} else {
+			isBottom.value = false
 		}
 		if(tabActive ==0){
 			tabList.value[0].leng = orderList.value.length
 		}
 	}
-},500)
+	setTimeout(() => {
+		trigger.value = false;
+	}, 1000)
+}
 
 
 </script>

+ 23 - 15
pages/review/review.vue

@@ -109,14 +109,14 @@
 		<view class="weight">
 			<view class="title">复核重量</view>
 			<view class="tex">
-				<input class="uni-input" type="number" :value="v.weight" placeholder="请输入" @input="handleOnblur" auto-blur= /> g
+				<input class="uni-input" type="number" :value="weight" placeholder="请输入" @input="handleOnblur" auto-blur= /> g
 			</view>
 		</view>
 		
 		<view class="cooment">
 			<view class="title">备注内容</view>
 			<view class="tex">
-				<textarea placeholder="请输入备注内容" v-model="editForm.comments"  placeholder-style="font-size: 15rpx;" height="60rpx" @input="bindTextInput" class="input" ></textarea>
+				<textarea placeholder="请输入备注内容" v-model="form.comments"  placeholder-style="font-size: 15rpx;" height="60rpx" @input="bindTextInput" class="input" ></textarea>
 			</view>
 		</view>
 		
@@ -178,6 +178,7 @@ const selectRps = ref([])
 
 const isPrint = ref(true)
 const photos = ref([])
+const weight = ref(0)
 const v=ref({
 	preNo:'',//'11220822134401',
 	// presType:'普通处方',
@@ -234,7 +235,7 @@ const v=ref({
 		// {matName:'车前子',matDose:'6',matUnitName:'g',tips:'先煎',sign:''}
 	],
 	number:3,
-	weight: 0,
+	// weight: 0,
 	pies_tips:'',//'待见',
 	dosageForm:'',//'汤剂',
 	prescriptionUsage:'',//'煎服',
@@ -265,7 +266,7 @@ const v=ref({
 })
 
 
-const editForm =ref({
+const form =ref({
 	urls:[],
 	userId:uni.getStorageSync('userId'),
 	comments:'',
@@ -345,8 +346,8 @@ onLoad(async(options) => {
 				weight1 = weight1+parseInt(v.value.rp[i].matDose)
 			}
 		}
-		v.value.weight = weight1
-		console.log('weigiht>>>', v.value.weight)
+		weight.value = weight1
+		console.log('weigiht>>>', weight.value)
 		
 		v.value.state = res.data.state,
 		console.log('res.data.state',res.data.state)
@@ -425,19 +426,24 @@ const handleBack =()=>{
 }
 
 const handleSubmit = debounce(async()=>{
-	editForm.value.preNo = v.value.preNo
-	editForm.value.weight = editForm.value.weight + 'g'
-	
-	console.log('handleSubmit>>>',editForm.value)
+	form.value.preNo = v.value.preNo
+	console.log('weight.value',weight.value)
+	form.value.weight = weight.value + 'g'
+	// uni.$showMsg(form.value.weight, 1000)
+	// setTimeout(uni.$showMsg(form.value.weight, 2000),5000)
+	console.log('handleSubmit>>>',form.value)
 	
 	const {data:res} = await saveReview({
 		token: uni.getStorageSync('token'),
-		data: JSON.stringify(editForm.value)
+		data: JSON.stringify(form.value)
 	})
 	if(res.code===200){
 		console.log('depoly success>>>')
+		// uni.$showMsg('res.msg'+form.value.weight, 2000)
 		proxy.$refs.alertDialog.open()
-		
+	} else {
+		uni.$showMsg(res.msg, 2000)
+		// uni.$showMsg('res.msg'+form.value.weight, 2000)
 	}
 },500)
 
@@ -466,7 +472,7 @@ const selectUpload = debounce((e)=>{
 				const back = JSON.parse(uploadFileRes.data);
 				console.log('upload success back >>',back)
 				if (back.code == 200) {
-					editForm.value.urls.push(back.url)
+					form.value.urls.push(back.url)
 				}
 			},
 			fail: () => {
@@ -483,8 +489,10 @@ const selectUpload = debounce((e)=>{
 
 const handleOnblur = (e)=>{
 	console.log('eeeeee',e.detail.value)
-	editForm.value.weight = e.detail.value
-	console.log('eeeeee editForm.value.weight',editForm.value.weight)
+	console.log('eeeeee before',weight.value)
+	form.value.weight = weight.value =  e.detail.value
+	console.log('eeeeee form.value.weight',form.value.weight)
+	console.log('eeeeee after',weight.value)
 }
 
 const dialogConfirm = ()=>{