Просмотр исходного кода

[dev]
1、接单状态优化
2、增加扫码成功后弹窗,使用者自行操作回首页或者继续扫码
3、其他优化

Neo 1 год назад
Родитель
Сommit
d02228773b

+ 15 - 12
components/nav-bar/nav-bar.vue

@@ -3,19 +3,19 @@
 		<view class="navbar">
 			<button class="scanbara" @click="handleScanbara">复核扫码</button>
 			<button class="scanbara1" @click="gotoPrint">打印设置</button>
-			<view class="status">{{props.userInfo.workStatus === '0'?"接单中":"暂停接单"}}</view>
+			<view class="status">{{props.workStatus === '0'?"接单中":"暂停接单"}}</view>
 			<view class="userinfo">
-				<button class="lef" @click="dialogToggle">{{props.userInfo.workStatus === '0'?"暂停接单":"开始接单"}}</button>
+				<button class="lef" @click="dialogToggle">{{props.workStatus === '0'?"暂停接单":"开始接单"}}</button>
 				<image class="mid" aspectFill src="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/cat-1.png" />
 				<view class="rig">
-					<text class="name">{{props.userInfo.name?props.userInfo.name:"张三三"}}</text>
+					<text class="name">{{props.name?props.userInfo.name:"张三三"}}</text>
 					<view size="mini" @click="handleLogout" class="logout">退出<uni-icons class="item" type="forward" color="#ff" size="16"></uni-icons></view>
 				</view>
 			</view>
 		</view>
   </view>
 	
-	<view v-if="props.userInfo.workStatus==='0'">
+	<view v-if="props.workStatus==='0'">
 		<uni-popup ref="alertDialog" type="dialog">
 			<uni-popup-dialog type="center" cancelText="取消" confirmText="同意" title="温馨提示" content="你确定要暂停接单吗?" @confirm="dialogConfirm"
 				@close="dialogClose"></uni-popup-dialog>
@@ -47,11 +47,13 @@ import {updateWorkStatus, updateOnlineStatus } from "@/static/js/api.js"
 const props = defineProps({
 	userInfo: {
 		default: function() {
-			return {
-				workStatus: '0'
-			}
+			return {}
 		},
 		type: Object
+	},
+	workStatus: {
+		default:true,
+		type: String
 	}
 })
 
@@ -59,7 +61,7 @@ const {proxy} = getCurrentInstance()
 
 const emit = defineEmits(['updateUser'])
 
-console.log("props.userInfo.workStatus", props.userInfo.workStatus)
+console.log("prop.workStatus", props.workStatus)
 
 onMounted(() => {
 	// userInfo.value = props.userInfo
@@ -84,15 +86,15 @@ const emitclose =()=>{
 
 const handleChange =async()=>{
 	
-	console.log("props.userInfo.workStatus》》》", props.userInfo.workStatus)
+	console.log("props.userInfo.workStatus》》》", props.workStatus)
 	const token = uni.getStorageSync('token')
 	const userId = uni.getStorageSync('userId')
-	if(props.userInfo.workStatus){
+	if(props.workStatus=='1'){
 		const params = {
 			token: uni.getStorageSync('token'),
 			data: {
 				pharmacistUserId: userId,
-				workStatus: props.userInfo.workStatus ==='1'?'0':'1'
+				workStatus: props.workStatus ==='1'?'0':'1'
 			}
 		}
 		console.log('params.data.workStatus', params)
@@ -102,8 +104,9 @@ const handleChange =async()=>{
 			uni.setStorageSync('workStatus', params.data.workStatus);
 			emit('updateUser', params.data.workStatus)
 			
+		} else {
+			emit('updateUser', props.workStatus)
 		}
-		emit('updateUser', props.userInfo.workStatus)
 	}
 }
 

+ 60 - 3
components/order-card/order-card.vue

@@ -1,5 +1,5 @@
 <template>
-  <view class="container" @click="handleDetail">
+  <view class="container" v-if="props.status=='1'" @click="handleDetail">
 		<view class="t">
 			<view class="d1"></view>
 			<view class="d2">
@@ -35,6 +35,45 @@
 			<view class="je">处方金额:{{props.v.prescriptionSum}}元</view>
 		</view>
   </view>
+	<view class="container" v-else @click="handleSelect">
+		<view class="t">
+			<view class="d1"></view>
+			<view class="d2">
+				<view class="dtim">时间:{{props.v.prescriptionTime}}</view>
+			</view>
+			<view class="d3"><view class="presno">处方号:{{props.v.preNo}}</view></view>
+			<view class="d4"><view class="source" :class="{'zy':props.v.preMzZy==='1'}">{{props.v.preMzZy==='1'?'门诊':'住院'}}</view></view>
+		</view>
+		<view class="m">
+			<view class="radio">
+				<label><radio value="selected" color="#18C7B0" :checked="selected"/></label>
+			</view>
+			<image class="faceu" aspectFill :src="props.v.sex==='男'?'/static/hz.png':'/static/hy.png'" />
+			<view class="patie">
+				<view class="name">{{props.v.name}}</view>
+				<view class="seage">
+					<image class="img" aspectFill :src="props.v.sex==='男'?'/static/male.png':'/static/female.png'" />
+					<view class="sex">{{props.v.sex}}</view>
+					<view class="sep">|</view>
+					<view class="age">{{v.age}}岁</view>
+				</view>
+				<view class="case">{{props.v.disName}} - {{props.v.symName}}</view>
+			</view>
+			<view class="pres">
+				<view class="department">就诊科室:{{props.v.department}}</view>
+				<view class="presInfo">
+					处方信息:
+					<text class="tips">
+						{{props.v.dosageForm}},{{props.v.number}}剂
+					</text>
+				</view>
+			</view>
+		</view>
+		<view class="b">
+			<view class="zt">当前处方状态: {{deployStateName}}</view>
+			<view class="je">处方金额:{{props.v.prescriptionSum}}元</view>
+		</view>
+	</view>
 </template>
 
 <script>
@@ -57,6 +96,10 @@ const props = defineProps({
 		},
 		type: Object
 	},
+	status: {
+		default: '0',
+		type: String
+	},
 	// 当前tab
 	c: {
 		default: 0,
@@ -64,7 +107,13 @@ const props = defineProps({
 	}
 })
 
+const selected = ref(false)
+
+const emit = defineEmits(['emitSelect'])
+
 console.log('props.v',props.v)
+
+
 const deployStateName = computed(()=>{
 	switch(props.v.deployState) {
 		case '1':
@@ -94,7 +143,12 @@ const handleDetail = ()=>{
 			url:`/pages/detail/detail?id=${props.v.id}`
 		})
 	}
-	
+}
+
+const handleSelect = ()=>{
+	console.log('handleSelect>>',props.v.id)
+	emit('emitSelect', props.v.id)
+	selected.value = !selected.value
 }
 
 </script>
@@ -151,7 +205,10 @@ const handleDetail = ()=>{
 		display: flex;
 		align-items: center;
 		justify-content: flex-start;
-		margin: 11.88rpx 25rpx 18.75rpx;
+		margin: 11.88rpx 25rpx 15.75rpx;
+		.radio{
+			
+		}
 		.faceu{
 			width: 73.13rpx;
 			height: 73.13rpx;

+ 35 - 23
pages/edit/edit.vue

@@ -207,6 +207,7 @@ const barOpations = ref({
 const selectRps = ref([])
 
 const isPrint = ref(true)
+const initPrint =ref(uni.getStorageSync('initPrint'))
 const photos = ref([])
 const v=ref({
 	preNo:'11220822134401',
@@ -299,7 +300,7 @@ const v=ref({
 	// 	pack:'大宝人',
 	// 	dispen:'发药人',
 	// },
-	entrust1111:'1、本处方当日有效\n  2、取药时请您当面核对。。。。 \n  3、延长处方用量时间原油:慢性病 其他老年病 外地 其他'
+	entrust1111:'1、本处方当日有效\n  2、取药时请您当面核对药品名称、规格、数量 \n  3、延长处方用量时间原因:慢性病 其他老年病 外地 其他'
 })
 
 const editForm =ref({
@@ -464,15 +465,18 @@ const handleSubmit = async()=>{
 		// print("#printMe")
 		// 打印成功后调用/userPrescription/sendToUser
 		
-		if(initPrint){
-			// #ifdef APP-PLUS
-			const ret = printerTsc()
-			console.log('ret',ret)
-			// #endif
-		} else {
-			uni.$showMsg('打印失败,打印机未连接,请先连接打印机', 2000)
-		}
+		// if(uni.getStorageSync('initPrint')==true){
+		// 	// APP-PLUS
+		// 	const ret = printerTsc()
+		// 	console.log('ret',ret)
+		// 	// APP-PLUS
+		// } else {
+		// 	uni.$showMsg('打印失败,打印机未连接,请先连接打印机', 2000)
+		// 	return
+		// }
 		
+		printerTsc()
+		console.log("uni.getStorageSync('token')",uni.getStorageSync('token'))
 		const res = await sendToUser({
 			token: uni.getStorageSync('token'),
 			data: JSON.stringify({id:uni.getStorageSync('userId')})
@@ -491,22 +495,22 @@ const handleSubmit = async()=>{
 
 const dialogConfirm = async()=>{
 	console.log('dialogConfirm直接调用接口,然后打印')
-	const initPrint = uni.getStorageSync('initPrint')
-	if(initPrint){
-		// #ifdef APP-PLUS
-		const ret = printerTsc()
-		console.log('ret',ret)
-		// #endif
-	} else {
-		uni.$showMsg('打印失败,打印机未连接,请先连接打印机', 2000)
-	}
-	
+	// if(uni.getStorageSync('initPrint')==true){
+	// 	// #ifdef APP-PLUS
+	// 	const ret = printerTsc()
+	// 	console.log('ret',ret)
+	// 	// #endif
+	// } else {
+	// 	uni.$showMsg('打印失败,打印机未连接,请先连接打印机', 2000)
+	// }
+	printerTsc()
 	
 	// 打印成功后调用/userPrescription/sendToUser
 	const res = await sendToUser({
 			token: uni.getStorageSync('token'),
 			data: JSON.stringify({id:uni.getStorageSync('userId')})
 		})
+		console.log('sendToUser res',res)
 	uni.redirectTo({
 		url:"/pages/index/index"
 	})
@@ -642,12 +646,20 @@ const printerTsc = ()=>{
 	
 	// let _this=this;
 	
-	
+	// #ifdef APP-PLUS
 	plug.printer({TSC:data}, ret => {
 		// _this.tip = JSON.stringify(ret);
-		console.log('print data', data)
-		console.log(ret)
-	})
+		// console.log('print data', data)
+		// console.log('ret',ret)
+		// console.log('ret.code',ret.code)
+		// const err = JSON.parse(ret)
+		// console.log('err',err)
+		if(ret.code==1){
+			uni.$showMsg('打印失败,打印机未连接,请先连接打印机', 2000)
+			console.log('666')
+		}
+	})
+	// #endif
 
  }
 

+ 27 - 15
pages/index/index.vue

@@ -1,6 +1,6 @@
 <template>
 	<view class="main">
-		<NavBar :user-info="userInfo" @update-user="updateUser" />
+		<NavBar :user-info="userInfo" :work-Status="workStatus" @update-user="updateUser" />
 		<view class="body">
 			<view class="tab-box">
 				<view class="tab-bar">
@@ -15,7 +15,7 @@
 							<uni-easyinput prefixIcon="search" v-model="searchVal" placeholder="请输入姓名" />
 						</view>
 						<button type="primary" @click="handleSearch" class="search-button">搜 索</button>
-						<button type="primary" :disabled="userInfo.workStatus==='1'?false:true" @click="handleRefresh" :class="userInfo.workStatus==='1'?'refresh':'refresh active'">一键释放</button>
+						<button type="primary" :disabled="workStatus==='1'?false:true" @click="handleRefresh" :class="workStatus==='1'?'refresh':'refresh active'">一键释放</button>
 					</view>
 					<view v-else class="history">
 						<view class="searchchoice">
@@ -80,8 +80,8 @@
 						@scrolltolower="loadMoreList"
 					>
 						<template v-for="(v,i) in orderList" :key="i">
-							<orderCard v-if="v" :v="v" :index="i" :c=tabActive class="order-card"
-								@update-list="updateList"
+							<orderCard v-if="v" :v="v" :state="workStatus" :index="i" :c=tabActive class="order-card"
+								@emit-select="emitSelect"
 							/>
 						</template>
 					</scroll-view>
@@ -108,6 +108,7 @@ import {releaseOrder} from "@/static/js/request.js"
 // import { ID_INJECTION_KEY } from 'element-plus'
 
 const userInfo = ref({})
+const workStatus = ref('0')
 const searchVal = ref('')
 const tabList = ref([
 	{title:"今日待完成", status: '0', leng:0},
@@ -161,6 +162,8 @@ const total = ref(0)
 const pageSize = ref(10)
 const status = ref('')
 
+const ids = ref([])
+
 const today =ref({
 	leng: 0,
 })
@@ -180,7 +183,7 @@ onMounted(() => {
 onLoad(async () => {
 	const token = uni.getStorageSync('token')
 	userInfo.value.name = uni.getStorageSync('username')
-	userInfo.value.workStatus = uni.getStorageSync('workStatus') || '0'
+	workStatus.value = uni.getStorageSync('workStatus') || '0'
 	const params = {
 		token: token,
 		data:JSON.stringify({
@@ -204,11 +207,18 @@ onLoad(async () => {
 // 子传父,更新userInfo
 const updateUser = (v)=>{
 	console.log('updateUserStatus', v)
-	userInfo.value.workStatus = v
+	workStatus.value = v
 }
 
-const updateList = (v)=>{
-	console.log('updateList', v)
+const emitSelect = (v)=>{
+	console.log('emitSelect', v)
+	// 查在ids中查找v,如果存在就删除,如果不存在就添加
+	const index = ids.value.findIndex(x=>x==v)
+	if (index>-1){
+		ids.splice(index, 1)
+	} else {
+		ids.value.push(v)
+	}
 }
 
 const handleSearch = async()=>{
@@ -266,17 +276,18 @@ const handleSearch = async()=>{
 const handleRefresh = async()=>{
 	
 	console.log('yijianshifang >orderList>>', orderList.value)
-	let ids = ''
-	orderList.value.forEach((v)=>{if(v.id){
-		ids= ids+v.id+','
-		console.log('yijianshifang >orderList>>',ids)
-		}})
+	// let ids = ''
+	// orderList.value.forEach((v)=>{if(v.id){
+	// 	ids= ids+v.id+','
+	// 	console.log('yijianshifang >orderList>>',ids)
+	// 	}})
 		
-	console.log('yijianshifang >orderList>>666',ids)
+	// console.log('yijianshifang >orderList>>666',ids)
 	const params = {
 		token: uni.getStorageSync('token'),
-		data:{ids:ids}
+		data:{ids:ids.value.toString()}
 	}
+	console.log('handleRefresh >params>>666',params)
 	const {data:res} = await releaseOrder(params)
 	if (res.code === 200) {
 		const paramss = {
@@ -403,6 +414,7 @@ const checkIndex = async(index) => {
 	tabActive.value = index
 	page.value= 1
 	console.log('index',index)
+	ids.value = []
 	tabName.value = tabList.value[index].title
 	currentStatus.value = parseInt(tabList.value[index].status)
 	const token = uni.getStorageSync('token')

+ 3 - 2
pages/login/login.vue

@@ -82,7 +82,7 @@ const submit = async ()=> {
 		uni.setStorageSync('username', formData.value.name)
 		uni.setStorageSync('password', formData.value.password)
 		uni.setStorageSync('remember', formData.value.remember)
-		uni.setStorageSync('workStatus', formData.value.remember);
+		// uni.setStorageSync('workStatus', formData.value.remember);
 	}
 	const params = {
 		username: formData.value.username,
@@ -96,7 +96,8 @@ const submit = async ()=> {
 		
 		uni.setStorageSync('token', res.token)
 		uni.setStorageSync('userId', res.userId)
-		uni.$emit('login',{userId:res.userId})
+		// 开启监听 neo
+		// uni.$emit('login',{userId:res.userId})
 		console.log('11')
 		console.log('res.token',res.token)
 		// JSON.stringify(params.data.data)

+ 27 - 3
pages/review/review.vue

@@ -123,6 +123,10 @@
 		<view class="submit">
 			<button type="primary" class="bu" @click="handleSubmit">上传</button>
 		</view>
+		<uni-popup ref="alertDialog" type="dialog">
+			<uni-popup-dialog :type="msgType" cancelText="返回首页" confirmText="继续扫码" title="温馨提示" content="上传成功!" @confirm="dialogConfirm"
+				@close="dialogClose"></uni-popup-dialog>
+		</uni-popup>
   </view>
 </template>
 
@@ -424,9 +428,8 @@ const handleSubmit = async()=>{
 	})
 	if(res.code===200){
 		console.log('depoly success>>>')
-		uni.redirectTo({
-			url:"/pages/index/index"
-		})
+		proxy.$refs.alertDialog.open()
+		
 	}
 }
 
@@ -476,6 +479,27 @@ const handleOnblur = (e)=>{
 	console.log('eeeeee editForm.value.weight',editForm.value.weight)
 }
 
+const dialogConfirm = ()=>{
+	uni.scanCode({
+		scanType: ['barCode'],
+		success: function (res) {
+			console.log('条码类型:' + res.scanType);
+			console.log('条码内容:' + res.result);
+			if(res.result) {
+				uni.navigateTo({
+					url:`/pages/review/review?preNo=${res.result}&depolyStatus=2`
+				})
+			}
+		}
+	});
+}
+
+const dialogClose = ()=>{
+	uni.redirectTo({
+		url:"/pages/index/index"
+	})
+}
+
 </script>
 
 <style lang="scss">