Jelajahi Sumber

app 条码打印

shish 4 tahun lalu
induk
melakukan
8c18a72ab3
2 mengubah file dengan 72 tambahan dan 18 penghapusan
  1. 19 12
      ghsApp/src/admin/custom/selectCustom.vue
  2. 53 6
      ghsApp/src/admin/item/list.vue

+ 19 - 12
ghsApp/src/admin/custom/selectCustom.vue

@@ -153,20 +153,27 @@ export default {
     @include disFlex(center, center);
   }
 }
-  .input-wrap_box {
-    background-color: #fff;
-    position: fixed;
-    top: 0;
-    z-index: 10;
+.input-wrap_box {
+  background-color: #fff;
+  position: fixed;
+  top: 0;
+  z-index: 10;
+  /* 手机mobile屏幕小于1000px */
+  @media screen and (max-width: 1100px) {
     width: 100%;
-    height: 100upx;
-    display: flex;
-    align-items: center;
-    padding: 0 30upx;
-    & > view:nth-child(1) {
-      flex: 1;
-    }
   }
+  /* 收银台cashier屏幕大于1000px */
+  @media screen and (min-width:1100px) {
+    width: 40%;
+  }
+  height: 100upx;
+  display: flex;
+  align-items: center;
+  padding: 0 30upx;
+  & > view:nth-child(1) {
+    flex: 1;
+  }
+}
 .tui-msg-box {
   display: flex;
   align-items: center;

+ 53 - 6
ghsApp/src/admin/item/list.vue

@@ -6,8 +6,8 @@
 				<app-search-module v-model="py" placeholder="找小菊请输xj" @input="searchFn"/>
 			</view>
 			<view style="padding:0 0upx 0 20upx;" >
+				<button class="admin-button-com middle blue" style="margin-right:8upx;" @click="itemMore()">更多</button>
 				<button class="admin-button-com middle blue" style="margin-right:8upx;" @click="downPriceTable()">价格表</button>
-				<button class="admin-button-com middle blue" style="margin-right:8upx;" @click="downBarcodeTable()">条形码</button>
 				<button class="admin-button-com middle blue" @click="pageTo({ url: '/admin/ptItem/itemList' })">添花材</button>
 			</view>
 		</view>
@@ -95,8 +95,8 @@ export default {
 		// #ifdef APP-PLUS
 		moreToDo(item){
 			//查询是否已经连接蓝牙
-			let _this=this;
-			let doList = ['打印标签', '打印标签2个', '打印标签5个','打印标签10个','打印标签20个']
+			let that=this;
+			let doList = ['打印条形', '打印条形2个', '打印条形5个','打印条形10个','打印条形20个']
 			let doNum = [1,2,5,10,20]
 			uni.showActionSheet({
 				itemList: doList,
@@ -110,7 +110,7 @@ export default {
 								content: '您还没有连接蓝牙,请先链接',
 								success: function (res) {
 									if (res.confirm) {
-										_this.pageTo({url:'/admin/tools/blue'})
+										that.pageTo({url:'/admin/tools/blue'})
 									}
 								}
 							})
@@ -118,8 +118,8 @@ export default {
 							let currentNum = Number(doNum[index])
 							console.log(currentNum)
 							for (let i = 0; i < currentNum; i++) {
-								plug.printer({"TSC":_this.OrderLable(item.name,item.id)},ret=>{
-									uni.showToast({ title: JSON.stringify(ret), duration: 5000 })
+								plug.printer({"TSC":that.OrderLable(item.name,item.id)},ret=>{
+									//uni.showToast({ title: JSON.stringify(ret), duration: 5000 })
 								})
 							}
 						}
@@ -167,6 +167,53 @@ export default {
 
 			return data;
 		},
+		itemMore(){
+			let that=this;
+			let doList = ['下载全部条码', '打印全部条码']
+			uni.showActionSheet({
+				itemList: doList,
+				success: function (respond) {
+					let index = respond.tapIndex
+
+					if(index == 0){
+						that.downBarcodeTable()
+					}
+					if(index == 1){
+						that.printAllBarCode()
+					}
+				}
+			})
+		},
+		printAllBarCode(){
+			let that = this
+			plug.state({},ret=>{
+				if(ret.code == 1){
+					uni.showModal({
+						title: '提示',
+						content: '您还没有连接蓝牙,请先链接',
+						success: function (res) {
+							if (res.confirm) {
+								that.pageTo({url:'/admin/tools/blue'})
+							}
+						}
+					})
+				}else{
+					if(!that.$util.isEmpty(this.globalClassItemList)){
+						this.globalClassItemList.forEach((globalItem) => {
+							if(!that.$util.isEmpty(globalItem.child)){
+								globalItem.child.forEach((currentItem)=>{
+									console.log(currentItem)
+									plug.printer({"TSC":that.OrderLable(currentItem.name,currentItem.id)},ret=>{
+										uni.showToast({ title: JSON.stringify(ret), duration: 5000 })
+									})
+								})
+							}
+						})
+					}
+				}
+			})
+
+		},
 		downPriceTable(){
 			// #ifdef MP-WEIXIN
 			let isWindows = false