shish 4 vuotta sitten
vanhempi
commit
6a7570ac10

+ 9 - 6
ghsApp/src/admin/home/me.vue

@@ -67,10 +67,6 @@
               <view class="tui-title">充值记录</view>
             </tui-list-cell>
 
-            <!-- <tui-list-cell @click="pageTo({ url: '/admin/tools/blue' })" class="line-cell" :hover="false" :arrow="true">
-              <view class="tui-title">蓝牙管理</view>
-            </tui-list-cell> -->
-
             <tui-list-cell @click="pageTo({ url: '/admin/book/index' })" class="line-cell" :hover="false" :arrow="true">
               <view class="tui-title">使用教程</view>
             </tui-list-cell>
@@ -86,7 +82,11 @@
             </tui-list-cell>
 
             <tui-list-cell @click="pageTo({ url: '/admin/shop/print' })" class="line-cell" :hover="false" :arrow="true">
-              <view class="tui-title">打印机设置</view>
+              <view class="tui-title">小票机设置</view>
+            </tui-list-cell>
+
+            <tui-list-cell @click="pageTo({ url: '/admin/tools/blue' })" class="line-cell" :hover="false" :arrow="true">
+              <view class="tui-title">标签机设置</view>
             </tui-list-cell>
 
             <tui-list-cell @click="pageTo({ url: '/admin/shop/trumpet' })" class="line-cell" :hover="false" :arrow="true">
@@ -95,13 +95,16 @@
             <tui-list-cell @click="pageTo({ url: '/pagesStore/me/expressSet' })" class="line-cell" :hover="false" :arrow="true">
               <view class="tui-title">快递设置</view>
             </tui-list-cell>
+
             <tui-list-cell @click="pageTo({ url: '/admin/shop/sk' })" class="line-cell" :hover="false" :arrow="true">
-              <view class="tui-title">绑定零售门店</view>
+              <view class="tui-title">设置零售店</view>
             </tui-list-cell>
+
             <!-- #ifdef APP-PLUS -->
             <!-- <tui-list-cell @click="closeApp()" class="line-cell" :hover="false" :arrow="true" v-if="!$util.isEmpty(getLoginInfo.admin) && getLoginInfo.admin.currentGhsShopId > 0">
               <view class="tui-title">关闭APP</view>
             </tui-list-cell> -->
+
             <tui-list-cell @click="loginOut()" class="line-cell" :hover="false" :arrow="true" v-if="!$util.isEmpty(getLoginInfo.admin) && getLoginInfo.admin.currentGhsShopId > 0">
               <view class="tui-title">退出登陆</view>
             </tui-list-cell>

+ 16 - 14
ghsApp/src/admin/item/list.vue

@@ -102,7 +102,7 @@ export default {
 		moreToDo(item){
 			//查询是否已经连接蓝牙
 			let that=this;
-			let doList = ['复制花材', '打印1个条形', '打印2个条形码', '打印条形10个','打印条形20个']
+			let doList = ['复制花材', '打1个标签', '打2个标签', '打10个标签','打20个标签']
 			let doNum = [0,1,2,10,20]
 			uni.showActionSheet({
 				itemList: doList,
@@ -124,10 +124,8 @@ export default {
 								return false
 							}
 							let data = []
-							for (let i = 0; i < currentNum; i++) {
-								let label = that.createLable(item.name,item.itemId)
-								data.push(label)
-							}
+							let label = that.createLable(item.name,item.itemId,currentNum)
+							data.push(label)
 							//说明地址 https://ext.dcloud.net.cn/plugin?id=462
 							plug.printer({"TSC":data,isArray:true},result=>{
 								//console.log(result)
@@ -135,11 +133,13 @@ export default {
 						}
 					})
 					// #endif
+					// #ifdef MP-WEIXIN
+					that.$msg('请在App上打印')
+					// #endif
 				}
 			})
 		},
-		createLable(itemName,itemId){
-
+		createLable(itemName,itemId,num){
 			//制作标签格式, 
 			var data=[];  //定义一个数组
 			var line={};  //每添加一个,代表一行字
@@ -147,9 +147,9 @@ export default {
 			//设置标签纸大小
 			line={};
 			line.width=40; //mm
-			line.height=30; //mm
+			line.height=50; //mm
 			line.gap=2; //标签纸之间,间隙长度 mm
-			line.page=1; //打印几份
+			line.page=num; //打印几份
 			data.push(line); //每添加一个,代表一行字
 
 			//添加文字
@@ -157,18 +157,19 @@ export default {
 			line.text= itemName;
 			line.rotation=0;
 			line.x=30;
-			line.y=40;
-			line.xscal=1;
-			line.yscal=1;
+			line.y=15;
+			line.xscal=2;
+			line.yscal=2;
 			data.push(line); //每添加一个,代表一行字
 
 			//添加条型码
 			line={};
 			line.barcode=itemId;
 			line.x=30;
-			line.y=110;
+			line.y=80;
 			line.type="CODE128";
-			line.height=300;
+			line.width=2;//条型宽度,这里的宽指的是 条型码 竖条的宽度,不是整个条型码的宽度
+			line.height=190;
 			line.readable=true;
 			line.rotation=0;
 			data.push(line);
@@ -205,6 +206,7 @@ export default {
 			line.x=35;
 			line.y=55;
 			line.type="CODE128";
+			line.width=2;//条型宽度,这里的宽指的是 条型码 竖条的宽度,不是整个条型码的宽度
 			line.height=50;
 			line.readable=true;
 			line.rotation=0;

+ 370 - 404
ghsApp/src/admin/tools/blue.vue

@@ -2,434 +2,400 @@
 <view class="app-content">
 	<view class="content">
 		<view>
-			<button @click="openDefault" >连接蓝牙</button>
+			<button @click="openDefault" >连接</button>
 			<!-- <button @click="open" >打开自定义蓝牙搜索页面</button>
-			<button @click="connectIP" >端口ip连接打印机</button>
-			<button @click="connectUSB" >USB 连接打印机</button> -->
+			<button @click="connectIP" >端口ip连接标签机</button>
+			<button @click="connectUSB" >USB 连接标签机</button> -->
 			<!-- <button @click="printer" >打印小票</button> -->
 			<!-- <button @click="printerLable" >打印样签</button>	 -->
 			<!-- <button @click="writePDFToTsc" >标签打印PDF</button>
 			<button @click="writePDFToEsc" >小票打印PDF</button>
 			<button @click="writeTSC" >tsc指令打印</button> -->
-			<button @click="state" >打印机状态</button>		
-			<button @click="dis" >断开打印机</button>
+			<!-- <button @click="state" >标签机状态</button> -->
+			<button @click="dis" >断开</button>
 			<text>{{tip}}</text>
 		</view>
 	</view>
 </view>
 </template>
-
-
 <script>
-
-	const plug= uni.requireNativePlugin('Html5app-Gprinter');
-	export default {
-		data() {
-			return {
-				tip: ''
-			}
+const plug= uni.requireNativePlugin('Html5app-Gprinter');
+export default {
+	data() {
+		return {
+			tip: ''
+		}
+	},
+	methods: {
+		openDefault()
+		{
+			//蓝牙连接标签机
+			const that=this;
+			plug.BluetoothPort({setBackgroundColor:"#2088d2"},result=>{
+				if(result.code == 3){
+					that.$msg('连接成功')
+					setTimeout(function(){
+						uni.navigateBack()
+					},2000)
+					that.tip=''
+				}else{
+					that.tip=JSON.stringify(result)
+				}
+			})
+		},
+		open(){
+			uni.navigateTo({ "url":"./Bluetooth" })
+		},
+		connectIP()
+		{
+			//端口网络连接
+			let that=this;
+			plug.connectIP({},ret=>{	
+				that.tip=JSON.stringify(ret)
+			})
+		},
+		connectUSB()
+		{
+			//USB网络连接
+			let that=this;
+			plug.connectUSB({setBackgroundColor:"#2088d2"},ret=>{	
+				that.tip=JSON.stringify(ret)
+			});
+		},
+		state(){
+			//查询标签机状态
+			let that=this;
+			plug.state({},ret=>{
+				that.tip=JSON.stringify(ret.msg)
+			});
+		},
+		dis()
+		{
+			//断开标签机
+			let that=this;
+			plug.disconnect({},ret=>{	
+				that.tip=JSON.stringify(ret.msg)
+			});
+		},
+		printer(){
+			//标签机小票
+			const that=this;
+			plug.printer({"ESC":that.setDate()},ret=>{
+				that.tip=JSON.stringify(ret)
+			})
+		},
+		printerLable(){
+			//打印标签
+			const that=this;
+			plug.printer({"TSC":that.OrderLable('粉红雪山','11054')},ret=>{
+				that.tip=JSON.stringify(ret);
+			})
+		},
+		writePDFToTsc()
+		{
+			//打印pdf 档标签文件
+			let filePath=plus.io.convertLocalFileSystemURL("static/pdfFile.pdf");
+			plug.writePDFToTsc({filePath:filePath,width:400},ret=>{
+			
+			});
 		},
-		onLoad() {
+		writePDFToEsc()
+		{
+			//打印pdf 档小票文件
+			let filePath=plus.io.convertLocalFileSystemURL("static/pdfFile.pdf");
+			plug.writePDFToEsc({filePath:filePath,width:400},ret=>{
+			
+			});
+		},
+		writeTSC()
+		{
+			//打印图片和文字
+			let image=plus.io.convertLocalFileSystemURL("static/gprinter.png");
+			
+			//图片指令,BITMAP x,y,宽度,图片路径 ,四个参数组成
+			
+			const that=this;
+			let str="SIZE 40 mm,15 mm \n";
+				str+="GAP 2 mm,0 mm \n";
+				str+"SET RESPONSE NO \n";
+				str+="CLS \n";
+				str+="TEXT 50,50,\"3\",0,1,1,\"DEMO FOR TEXT\" \n";
+				str+="BITMAP 20,20,100,"+image+" \n";
+				str+=" PRINT 1 \n";
 
+			plug.writeTSC({"tsc":str},function(e){
+					that.tip=JSON.stringify(e);
+			});
+			
 		},
-		methods: {
-			openDefault()
-			{
-				//蓝牙连接打印机
-				const _this=this;
-				plug.BluetoothPort({setBackgroundColor:"#2088d2"},result=>{
-					
-					_this.tip=JSON.stringify(result);
-					
-				});
-				
-			},
-			open(){
-				
-				uni.navigateTo({
-					"url":"./Bluetooth"
-				});
-				
-			},
-			connectIP()
-			{
-				//端口网络连接
-				let _this=this;
-				plug.connectIP({},ret=>{	
-					
-					_this.tip=JSON.stringify(ret);
-					console.log(_this.tip);
-					
-					
-				});
-				
-			},
-			connectUSB()
-			{
-				//USB网络连接
-				let _this=this;
-				plug.connectUSB({setBackgroundColor:"#2088d2"},ret=>{	
-					
-					_this.tip=JSON.stringify(ret);
-					console.log(_this.tip);
-	
-				});
-				
-			},
-			state(){
-				
-				//查询打印机状态
-				let _this=this;
-				plug.state({},ret=>{
-					
-					_this.tip=JSON.stringify(ret);
-					console.log(_this.tip);
-					
-				});
-				
-			},
-			dis()
-			{
-				//断开打印机
-				let _this=this;
-				plug.disconnect({},ret=>{	
-					_this.tip=JSON.stringify(ret);
-				});
-				
-			},
-			printer(){
-				//打印机小票
-				const _this=this;
-				
-				console.log(JSON.stringify(_this.setDate()));
-				
-				plug.printer({"ESC":_this.setDate()},ret=>{
-					
-					_this.tip=JSON.stringify(ret);
-					console.log(_this.tip);
-				});
-				
-			},
-			printerLable(){
-				//打印标签
-				const _this=this;
-				plug.printer({"TSC":_this.OrderLable('粉红雪山','11054')},ret=>{
-					_this.tip=JSON.stringify(ret);
-				})
-			},
-			writePDFToTsc()
-			{
-				//打印pdf 档标签文件
-				let filePath=plus.io.convertLocalFileSystemURL("static/pdfFile.pdf");
-				plug.writePDFToTsc({filePath:filePath,width:400},ret=>{
-				
-				});
-				
-			},
-			writePDFToEsc()
-			{
-				//打印pdf 档小票文件
-				let filePath=plus.io.convertLocalFileSystemURL("static/pdfFile.pdf");
-				plug.writePDFToEsc({filePath:filePath,width:400},ret=>{
-				
-				});
-				
-			},
-			writeTSC()
-			{
-				//打印图片和文字
-			  	let image=plus.io.convertLocalFileSystemURL("static/gprinter.png");
-				
-				//图片指令,BITMAP x,y,宽度,图片路径 ,四个参数组成
-				
-			  	const _this=this;
-			  	let str="SIZE 40 mm,15 mm \n";
-			  	    str+="GAP 2 mm,0 mm \n";
-			  		str+"SET RESPONSE NO \n";
-			  		str+="CLS \n";
-			  		str+="TEXT 50,50,\"3\",0,1,1,\"DEMO FOR TEXT\" \n";
-			  		str+="BITMAP 20,20,100,"+image+" \n";
-			  		str+=" PRINT 1 \n";
-			  	
-			  	plug.writeTSC({"tsc":str},function(e){
-			  		
-			  		 console.log(JSON.stringify(e));
-			  		 _this.tip=JSON.stringify(e);
-			  	});
-				
-			},
-			setDate()
-			{
-				//打印小票
-				const _this=this;
-				
-				//制作小票格式, 
-				var data=[];  //定义一个数组
-				var line={};  //每添加一个,代表一行字
-				
-				var filePath=plus.io.convertLocalFileSystemURL("static/gprinter.png");
-				//加入logo图片
-				var Path=filePath; 
-				line.image=Path;
-				line.width="350";
-				line.center="center";
-				line.bottom="1";
-				data.push(line);
-				
-				line={};
-				line.text="万达广场欢迎您";
-				line.center="center";
-				line.font="max";
-				line.bottom="3";
-				data.push(line); //每添加一个,代表一行字
-	
-				line={};
-				line.text="收银员:00056";
-				line.center="left";
-				line.font="bold";
-				line.bottom="2";
-				data.push(line);
-				
-				line={};  
-				line.text="单号:00256933";
-				line.center="left";
-				line.font="normal";
-				line.bottom="2";
-				data.push(line);
-				
-				line={};  
-				line.text="业务日期:2019-05-30 18:15:25";
-				line.center="left";
-				line.font="normal";
-				line.bottom="1";
-				data.push(line);
-				
-				line={};
-				line.text="------------------------------";
-				line.center="left";
-				line.font="normal";
-				line.bottom="1";
-				data.push(line);
-				
-				//商品列表,示例
-				for(let i=0;i<4;i++)
-				{
-				               
-				line={};
-				line.text="商品名称:小黑瓶眼霜";
-				line.center="left";
-				line.font="normal";
-				line.bottom="1";
-				data.push(line);
-				
-				line={};
-				line.title=["数量:1","单价:305","金额:305"];
-				line.left=[0,30,60];
-				line.center="left";
-				line.font="normal";
-				line.bottom="2";
-				data.push(line);
-									
-				}
-				
-				line={}; //清空一下
-				
-				line.text="------------------------------";
-				line.center="left";
-				line.font="normal";
-				line.bottom="2";
-				data.push(line);
-				
-				line={};
-				line.text="数量:4 ,金额:¥1220.00";
-				line.center="left";
-				line.font="bold";
-				line.bottom="1";
-				data.push(line);
-				
-				line={};
-				line.text="实收金额:¥1220.00";
-				line.center="left";
-				line.font="bold";
-				line.bottom="2";
-				data.push(line);
-				
-				line={};
-				line.text="活动期间满500送100";
-				line.center="left";
-				line.font="normal";
-				line.bottom="1";
-				data.push(line);
-				line={};
-				line.text="折让金额500";
-				line.center="left";
-				line.font="normal";
-				line.bottom="1";
-				data.push(line);
-				line={};
-				line.text="折后金额2029";
-				line.center="left";
-				line.font="normal";
-				line.bottom="3";
-				data.push(line);
-				
-				line={};
-				line.text="30天内可凭小票换开发票";
-				line.center="left";
-				line.font="normal";
-				line.bottom="2";
-				data.push(line);
-				line={};
-				line.text="活动商品,不退不换";
-				line.center="left";
-				line.font="normal";
-				line.bottom="2";
-				data.push(line);
-				
-				//加入条型码
-				line={};
-				line.barcode="2019563352660";
-				line.type="CODE128";
-				line.height="100";
-				line.position="BELOW";
-				line.width="2";
-				line.center="center";
-				line.bottom="2";
-				data.push(line);
-				
-				
-				 //加入二维码
-				line={};
-				line.qrcode="d68242b5e540aa7f21173c2d65b2c5ad";
-				line.size="10";
-				line.center="center";
-				line.bottom="0";
-				line.errorlevel="L";
-				
-				
-				data.push(line);
-				
-				// line={};
-				// //加入图片
-				// line.image="http://www.html5-app.com/uploads/file/20190307/20190307172436572807.png";
-				// line.width="150";
-				// line.center="center";
-				// line.bottom="3";
-				// data.push(line);
-				
-				console.log("printdata:"+JSON.stringify(data));
-				
-				return data;
-				
-			},
-			OrderLable(itemName,itemId){
-				
-				//制作标签格式, 
-				var data=[];  //定义一个数组
-				var line={};  //每添加一个,代表一行字
-				
-				//设置标签纸大小
-				line={};
-				line.width=30; //mm
-				line.height=20; //mm
-				line.gap=2; //标签纸之间,间隙长度 mm
-				line.page=1; //打印几份
-				data.push(line); //每添加一个,代表一行字
+		setDate()
+		{
+			//打印小票
+			const that=this;
+			
+			//制作小票格式, 
+			var data=[];  //定义一个数组
+			var line={};  //每添加一个,代表一行字
+			
+			var filePath=plus.io.convertLocalFileSystemURL("static/gprinter.png");
+			//加入logo图片
+			var Path=filePath; 
+			line.image=Path;
+			line.width="350";
+			line.center="center";
+			line.bottom="1";
+			data.push(line);
+			
+			line={};
+			line.text="万达广场欢迎您";
+			line.center="center";
+			line.font="max";
+			line.bottom="3";
+			data.push(line); //每添加一个,代表一行字
 
-					//添加文字
-				line={};
-				line.text= itemName;
-				line.rotation=0;
-				line.x=35;
-				line.y=20;
-				line.xscal=1;
-				line.yscal=1;
-				data.push(line); //每添加一个,代表一行字
+			line={};
+			line.text="收银员:00056";
+			line.center="left";
+			line.font="bold";
+			line.bottom="2";
+			data.push(line);
+			
+			line={};  
+			line.text="单号:00256933";
+			line.center="left";
+			line.font="normal";
+			line.bottom="2";
+			data.push(line);
+			
+			line={};  
+			line.text="业务日期:2019-05-30 18:15:25";
+			line.center="left";
+			line.font="normal";
+			line.bottom="1";
+			data.push(line);
+			
+			line={};
+			line.text="------------------------------";
+			line.center="left";
+			line.font="normal";
+			line.bottom="1";
+			data.push(line);
+			
+			//商品列表,示例
+			for(let i=0;i<4;i++)
+			{
+							
+			line={};
+			line.text="商品名称:小黑瓶眼霜";
+			line.center="left";
+			line.font="normal";
+			line.bottom="1";
+			data.push(line);
+			
+			line={};
+			line.title=["数量:1","单价:305","金额:305"];
+			line.left=[0,30,60];
+			line.center="left";
+			line.font="normal";
+			line.bottom="2";
+			data.push(line);
+								
+			}
+			
+			line={}; //清空一下
+			
+			line.text="------------------------------";
+			line.center="left";
+			line.font="normal";
+			line.bottom="2";
+			data.push(line);
+			
+			line={};
+			line.text="数量:4 ,金额:¥1220.00";
+			line.center="left";
+			line.font="bold";
+			line.bottom="1";
+			data.push(line);
+			
+			line={};
+			line.text="实收金额:¥1220.00";
+			line.center="left";
+			line.font="bold";
+			line.bottom="2";
+			data.push(line);
+			
+			line={};
+			line.text="活动期间满500送100";
+			line.center="left";
+			line.font="normal";
+			line.bottom="1";
+			data.push(line);
+			line={};
+			line.text="折让金额500";
+			line.center="left";
+			line.font="normal";
+			line.bottom="1";
+			data.push(line);
+			line={};
+			line.text="折后金额2029";
+			line.center="left";
+			line.font="normal";
+			line.bottom="3";
+			data.push(line);
+			
+			line={};
+			line.text="30天内可凭小票换开发票";
+			line.center="left";
+			line.font="normal";
+			line.bottom="2";
+			data.push(line);
+			line={};
+			line.text="活动商品,不退不换";
+			line.center="left";
+			line.font="normal";
+			line.bottom="2";
+			data.push(line);
+			
+			//加入条型码
+			line={};
+			line.barcode="2019563352660";
+			line.type="CODE128";
+			line.height="100";
+			line.position="BELOW";
+			line.width="2";
+			line.center="center";
+			line.bottom="2";
+			data.push(line);
+			
+			
+				//加入二维码
+			line={};
+			line.qrcode="d68242b5e540aa7f21173c2d65b2c5ad";
+			line.size="10";
+			line.center="center";
+			line.bottom="0";
+			line.errorlevel="L";
+			
+			
+			data.push(line);
+			
+			// line={};
+			// //加入图片
+			// line.image="http://www.html5-app.com/uploads/file/20190307/20190307172436572807.png";
+			// line.width="150";
+			// line.center="center";
+			// line.bottom="3";
+			// data.push(line);
+				
+			return data;
+			
+		},
+		OrderLable(itemName,itemId){
+			
+			//制作标签格式, 
+			var data=[];  //定义一个数组
+			var line={};  //每添加一个,代表一行字
+			
+			//设置标签纸大小
+			line={};
+			line.width=30; //mm
+			line.height=20; //mm
+			line.gap=2; //标签纸之间,间隙长度 mm
+			line.page=1; //打印几份
+			data.push(line); //每添加一个,代表一行字
 
-				//添加条型码
-				line={};
-				line.barcode=itemId;
-				line.x=35;
-				line.y=55;
-				line.type="CODE128";
-				line.height=50;
-				line.readable=true;
-				line.rotation=0;
-				data.push(line);
+				//添加文字
+			line={};
+			line.text= itemName;
+			line.rotation=0;
+			line.x=35;
+			line.y=20;
+			line.xscal=1;
+			line.yscal=1;
+			data.push(line); //每添加一个,代表一行字
 
-				return data;
-			},
-			Lable(){
-				
-				//制作标签格式, 
-				var data=[];  //定义一个数组
-				var line={};  //每添加一个,代表一行字
-				
-				//设置标签纸大小
-				line={};
-				line.width=40; //mm
-				line.height=30; //mm
-				line.gap=3; //标签纸之间,间隙长度 mm
-				line.page=1; //打印几份
-				data.push(line); //每添加一个,代表一行字
+			//添加条型码
+			line={};
+			line.barcode=itemId;
+			line.x=35;
+			line.y=55;
+			line.type="CODE128";
+			line.height=50;
+			line.readable=true;
+			line.rotation=0;
+			data.push(line);
 
-				//添加图片
-				line={};
-				line.image="http://www.html5-app.com/gprinter.png";
-				line.x=30;
-				line.y=20;
-				line.width=70;
-				data.push(line);
-				
-				
-					//添加文字
-				line={};
-				line.text="HTML5+混合APP开发社区";
-				line.rotation=0;
-				line.x=30;
-				line.y=90;
-				line.xscal=1;
-				line.yscal=1;
-				data.push(line); //每添加一个,代表一行字
-				
-				//添加条型码
-				line={};
-				line.barcode="2019563352660";
-				line.x=30;
-				line.y=130;
-				line.type="CODE128";
-				line.height=50;
-				line.readable=true;
-				line.rotation=0;
-				data.push(line);
-				
-				 //加入二维码
-				line={};
-				line.qrcode="1234566";	
-				line.x=190;
-				line.y=20;
-				line.width=3
-				line.rotation=0;
-				data.push(line);
-				
-				//添加黑块
-				line={};
-				line.addBar={x:25,y:2,width:300,height:3};
-				data.push(line);
-				
-				//添加方框
-				line={};
-				line.addBox={x:25,y:15,xend:300,yend:120,thickness:2};
-				data.push(line);
-				
-				return data;
-			}
+			return data;
+		},
+		Lable(){
 			
+			//制作标签格式, 
+			var data=[];  //定义一个数组
+			var line={};  //每添加一个,代表一行字
+			
+			//设置标签纸大小
+			line={};
+			line.width=40; //mm
+			line.height=30; //mm
+			line.gap=3; //标签纸之间,间隙长度 mm
+			line.page=1; //打印几份
+			data.push(line); //每添加一个,代表一行字
 
+			//添加图片
+			line={};
+			line.image="http://www.html5-app.com/gprinter.png";
+			line.x=30;
+			line.y=20;
+			line.width=70;
+			data.push(line);
+			
+			
+				//添加文字
+			line={};
+			line.text="HTML5+混合APP开发社区";
+			line.rotation=0;
+			line.x=30;
+			line.y=90;
+			line.xscal=1;
+			line.yscal=1;
+			data.push(line); //每添加一个,代表一行字
+			
+			//添加条型码
+			line={};
+			line.barcode="2019563352660";
+			line.x=30;
+			line.y=130;
+			line.type="CODE128";
+			line.height=50;
+			line.readable=true;
+			line.rotation=0;
+			data.push(line);
+			
+				//加入二维码
+			line={};
+			line.qrcode="1234566";	
+			line.x=190;
+			line.y=20;
+			line.width=3
+			line.rotation=0;
+			data.push(line);
+			
+			//添加黑块
+			line={};
+			line.addBar={x:25,y:2,width:300,height:3};
+			data.push(line);
+			
+			//添加方框
+			line={};
+			line.addBox={x:25,y:15,xend:300,yend:120,thickness:2};
+			data.push(line);
+			
+			return data;
 		}
+
 	}
+}
 </script>
-
 <style>
 	.content {
 		margin: 10px;

+ 4 - 1
ghsApp/src/manifest.json

@@ -56,8 +56,11 @@
                 "privacyDescription" : {
                     "NSPhotoLibraryUsageDescription" : "该应用需要读取您的相册,以便支持您修改花材的图片",
                     "NSPhotoLibraryAddUsageDescription" : "该应用需要读取您的相册,以便支持您修改花材的图片",
-                    "NSCameraUsageDescription" : "该应用需要获取您的摄像头权限,以便支持您直接拍照上传并修改花材的图片"
+                    "NSCameraUsageDescription" : "该应用需要获取您的摄像头权限,以便支持您直接拍照上传并修改花材的图片",
+                    "NSBluetoothPeripheralUsageDescription" : "是否允许获取蓝牙用于连接打印机?",
+                    "NSBluetoothAlwaysUsageDescription" : "是否允许获取蓝牙用于连接打印机?"
                 },
+                "UIBackgroundModes" : [ "bluetooth-central" ],
                 "idfa" : false
             },
             /* SDK配置 */

+ 1 - 1
ghsApp/src/pages.json

@@ -21,7 +21,7 @@
 		{
 			"root": "admin/tools",
 			"pages": [
-				{"path": "blue","style": {"navigationBarTitleText": "蓝牙管理"}}
+				{"path": "blue","style": {"navigationBarTitleText": "标签机管理"}}
 			]
 		},
 		{

+ 23 - 22
ghsApp/src/pagesPurchase/info.vue

@@ -72,7 +72,7 @@
 			</view>
 
 			<view class="title">
-				商品信息 <text @click="printAllLabel()" style="float:right;font-weight:normal;color:#3385FF;">打印标签</text>
+				商品信息 <text @click="printAllLabel()" style="float:right;font-weight:normal;color:#3385FF;margin-right:10upx;">打全部标签</text>
 			</view>
 			<view class="module-com content-box">
 				<view class="commodity-view">
@@ -221,8 +221,8 @@ export default {
 	},
 	methods: {
 		printAllLabel(){
-			// #ifdef APP-PLUS
 			let that = this
+			// #ifdef APP-PLUS
 			plug.state({},ret=>{
 				if(ret.code == 1){
 					that.$util.confirmModal({content:'您还没有连接蓝牙,请先链接'},() => {
@@ -230,15 +230,13 @@ export default {
 					})
 				}else{
 					that.$util.confirmModal({content:'确定打印全部标签?'},() => {
-						if(!this.$util.isEmpty(this.detailInfo.itemInfo)){
+						if(!that.$util.isEmpty(that.detailInfo.itemInfo)){
 							let data = []
-							for (const elem of this.detailInfo.itemInfo) {
-								let currentNum = parseFloat(elem.itemNum)
-								for (let i = 0; i < currentNum; i++) {
-									if(elem.name && !this.$util.isEmpty(elem.name)){
-										let label = that.createLable(elem.name,elem.itemId)
-										data.push(label)
-									}
+							for (const elem of that.detailInfo.itemInfo) {
+								if(elem.name && !that.$util.isEmpty(elem.name)){
+									let num = parseFloat(elem.itemNum)
+									let label = that.createLable(elem.name,elem.itemId,num)
+									data.push(label)
 								}
 							}
 							//说明地址 https://ext.dcloud.net.cn/plugin?id=462
@@ -250,38 +248,41 @@ export default {
 				}
 			})
 			// #endif
+			// #ifdef MP-WEIXIN
+			that.$msg('请在App上打印')
+			// #endif
 		},		
-		createLable(itemName,itemId){
-
+		createLable(itemName,itemId,num){
 			//制作标签格式, 
 			var data=[];  //定义一个数组
 			var line={};  //每添加一个,代表一行字
 
 			//设置标签纸大小
 			line={};
-			line.width=30; //mm
-			line.height=20; //mm
+			line.width=40; //mm
+			line.height=50; //mm
 			line.gap=2; //标签纸之间,间隙长度 mm
-			line.page=1; //打印几份
+			line.page=num; //打印几份
 			data.push(line); //每添加一个,代表一行字
 
 			//添加文字
 			line={};
 			line.text= itemName;
 			line.rotation=0;
-			line.x=35;
-			line.y=20;
-			line.xscal=1;
-			line.yscal=1;
+			line.x=30;
+			line.y=15;
+			line.xscal=2;
+			line.yscal=2;
 			data.push(line); //每添加一个,代表一行字
 
 			//添加条型码
 			line={};
 			line.barcode=itemId;
-			line.x=35;
-			line.y=55;
+			line.x=30;
+			line.y=80;
 			line.type="CODE128";
-			line.height=50;
+			line.width=2;//条型宽度,这里的宽指的是 条型码 竖条的宽度,不是整个条型码的宽度
+			line.height=190;
 			line.readable=true;
 			line.rotation=0;
 			data.push(line);

+ 4 - 2
开发/ghsApp/src/manifest.json

@@ -52,13 +52,15 @@
             },
             /* ios打包配置 */
             "ios" : {
-                "UIBackgroundModes" : [ "audio" ],
                 "urlschemewhitelist" : [ "baidumap", "iosamap" ],
                 "privacyDescription" : {
                     "NSPhotoLibraryUsageDescription" : "该应用需要读取您的相册,以便支持您修改花材的图片",
                     "NSPhotoLibraryAddUsageDescription" : "该应用需要读取您的相册,以便支持您修改花材的图片",
-                    "NSCameraUsageDescription" : "该应用需要获取您的摄像头权限,以便支持您直接拍照上传并修改花材的图片"
+                    "NSCameraUsageDescription" : "该应用需要获取您的摄像头权限,以便支持您直接拍照上传并修改花材的图片",
+                    "NSBluetoothPeripheralUsageDescription" : "是否允许获取蓝牙用于连接打印机?",
+                    "NSBluetoothAlwaysUsageDescription" : "是否允许获取蓝牙用于连接打印机?"
                 },
+                "UIBackgroundModes" : [ "bluetooth-central" ],
                 "idfa" : false
             },
             /* SDK配置 */

+ 4 - 1
线上/ghsApp/src/manifest.json

@@ -56,8 +56,11 @@
                 "privacyDescription" : {
                     "NSPhotoLibraryUsageDescription" : "该应用需要读取您的相册,以便支持您修改花材的图片",
                     "NSPhotoLibraryAddUsageDescription" : "该应用需要读取您的相册,以便支持您修改花材的图片",
-                    "NSCameraUsageDescription" : "该应用需要获取您的摄像头权限,以便支持您直接拍照上传并修改花材的图片"
+                    "NSCameraUsageDescription" : "该应用需要获取您的摄像头权限,以便支持您直接拍照上传并修改花材的图片",
+                    "NSBluetoothPeripheralUsageDescription" : "是否允许获取蓝牙用于连接打印机?",
+                    "NSBluetoothAlwaysUsageDescription" : "是否允许获取蓝牙用于连接打印机?"
                 },
+                "UIBackgroundModes" : [ "bluetooth-central" ],
                 "idfa" : false
             },
             /* SDK配置 */