瀏覽代碼

[dev]
1、优化按键位置
2、保存initPrint状态
3、在打印时先判断打印状态
4、增加宏定义,判断APP-PLUS,(还未测试)

Neo 2 年之前
父節點
當前提交
61797c6c42
共有 4 個文件被更改,包括 33 次插入11 次删除
  1. 13 1
      components/nav-bar/nav-bar.vue
  2. 1 0
      components/print-config/print-config.vue
  3. 17 8
      pages/edit/edit.vue
  4. 2 2
      pages/index/index.vue

+ 13 - 1
components/nav-bar/nav-bar.vue

@@ -2,7 +2,7 @@
   <view class="nav">
 		<view class="navbar">
 			<button class="scanbara" @click="handleScanbara">复核扫码</button>
-			<button class="scanbara" @click="gotoPrint">打印设置</button>
+			<button class="scanbara1" @click="gotoPrint">打印设置</button>
 			<view class="status">{{props.userInfo.workStatus === '0'?"接单中":"暂停接单"}}</view>
 			<view class="userinfo">
 				<button class="lef" @click="dialogToggle">{{props.userInfo.workStatus === '0'?"暂停接单":"开始接单"}}</button>
@@ -78,6 +78,7 @@ const dialogClose = ()=>{
 }
 
 const emitclose =()=>{
+	
 	proxy.$refs.alertPrint.close()
 }
 
@@ -174,6 +175,17 @@ const gotoPrint = ()=>{
 			color:#18C7B0;
 			margin-left: 20.1rpx;
 		}
+		.scanbara1{
+			display: flex;
+			justify-content:center;
+			align-items: center;
+			
+			width: 91rpx;
+			height: 32.8rpx;
+			font-size: 15rpx;
+			color:#18C7B0;
+			margin-left: 10rpx;
+		}
 		.status{
 			font-size: 18.75rpx;
 			color:#fff;

+ 1 - 0
components/print-config/print-config.vue

@@ -44,6 +44,7 @@ const connectPrint = ()=>{
 				console.log('connectPrint>>res',res.code)
 				if(res.code==3){
 					initPrint.value = true
+					uni.setStorageSync('initPrint', true)
 					// _this.tip=JSON.stringify(ret);
 					// console.log(_this.tip);	
 					// 关闭配置页操作

+ 17 - 8
pages/edit/edit.vue

@@ -464,10 +464,14 @@ const handleSubmit = async()=>{
 		// print("#printMe")
 		// 打印成功后调用/userPrescription/sendToUser
 		
-		// #ifdef APP-PLUS
-		const ret = printerTsc()
-		console.log('直接调用接口,然后打印',ret)
-		// #endif
+		if(initPrint){
+			// #ifdef APP-PLUS
+			const ret = printerTsc()
+			console.log('ret',ret)
+			// #endif
+		} else {
+			uni.$showMsg('打印失败,打印机未连接,请先连接打印机', 2000)
+		}
 		
 		const res = await sendToUser({
 			token: uni.getStorageSync('token'),
@@ -487,11 +491,16 @@ 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)
+	}
 	
-	// #ifdef APP-PLUS
-	const ret = printerTsc()
-	console.log('ret',ret)
-	// #endif
 	
 	// 打印成功后调用/userPrescription/sendToUser
 	const res = await sendToUser({

+ 2 - 2
pages/index/index.vue

@@ -14,7 +14,7 @@
 						<view class="search">
 							<uni-easyinput prefixIcon="search" v-model="searchVal" placeholder="请输入姓名" />
 						</view>
-						<button type="primary" @click="handleSearch" class="search-button">搜索</button>
+						<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>
 					</view>
 					<view v-else class="history">
@@ -558,7 +558,7 @@ const loadPreList = async()=>{
 						justify-content:center;
 						align-items: center;
 						width:120rpx;
-						margin: 13.75px 22.19rpx;
+						margin: 13.75px 8rpx;
 						font-size: 15rpx;
 						background-color: #18C7B0;
 					}