shish 4 лет назад
Родитель
Сommit
fd01ed41c6

+ 3 - 78
ghsApp/src/admin/billing/affirm.vue

@@ -10,10 +10,10 @@
             <view class="commodity-list">
               <view class="commodity-item" v-for="(item, index) in selectList" :key="index">
                 <!-- #ifdef APP-PLUS -->
-                <image class="item-icon" :src="item.cover" alt="" @click="moreToDo(item)" />
+                <image class="item-icon" :src="item.cover" />
                 <!-- #endif -->
                 <!-- #ifdef MP-WEIXIN -->
-                <image class="item-icon" :src="item.cover" alt="" />
+                <image class="item-icon" :src="item.cover" />
                 <!-- #endif -->
                 <view class="item-info">
                   <view class="info-line">
@@ -189,9 +189,6 @@ import { getAllStaff } from "@/api/shop-admin"
 import { mapActions, mapGetters } from "vuex";
 import { getUserDet} from "@/api/member";
 import ModalModule from "@/components/plugin/modal";
-// #ifdef APP-PLUS
-const plug= uni.requireNativePlugin('Html5app-Gprinter')
-// #endif
 export default {
   name: "BillingAffirm",
   components: {
@@ -308,7 +305,7 @@ export default {
 
 	},
 	onUnload(){
-			uni.removeStorageSync('newClient');
+			uni.removeStorageSync('newClient')
 	},
   computed: {
     ...mapGetters(["getMerchantInfo", "getLoginInfo"]),
@@ -322,84 +319,12 @@ export default {
   },
   methods: {
     ...mapActions(["initMerchantInfo"]),
-		// #ifdef APP-PLUS
-		moreToDo(item){
-			//查询是否已经连接蓝牙
-			let that=this;
-			let doList = ['打印条码', '打印条码2个', '打印条码5个','打印条码10个','打印条码20个']
-			let doNum = [1,2,5,10,20]
-			uni.showActionSheet({
-				itemList: doList,
-				success: function (respond) {
-					let index = respond.tapIndex
-
-					plug.state({},ret=>{
-						if(ret.code == 1){
-              that.$util.confirmModal({content:'您还没有连接条码机,请先连接'},() => {
-                // #ifdef APP-PLUS
-                plug.connectUSB({setBackgroundColor:"#2088d2"},ret=>{   
-                  //console.log(ret)
-                })
-                // #endif
-              })
-						}else{
-							let currentNum = Number(doNum[index])
-							console.log(currentNum)
-							for (let i = 0; i < currentNum; i++) {
-								plug.printer({"TSC":that.OrderLable(item.name,item.itemId)},ret=>{
-									//uni.showToast({ title: JSON.stringify(ret), duration: 5000 })
-								})
-							}
-						}
-					})
-
-				}
-			})
-
-		},
-		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.text= itemName;
-			line.rotation=0;
-			line.x=35;
-			line.y=20;
-			line.xscal=1;
-			line.yscal=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);
-			return data;
-		},
-    // #endif
 		reduceItemFn(item) {
       this.kdType = 'HIT';
 			this.replaceItemFn(item,0,'sub')
 		},
 		addItemFn (item) {
       this.kdType = 'HIT';
-      console.log('当前',item)
 			this.replaceItemFn(item,0,'add')
 		},
     init () {

+ 5 - 162
ghsApp/src/admin/item/list.vue

@@ -6,7 +6,6 @@
 				<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" @click="pageTo({ url: '/admin/ptItem/itemList' })">添花材</button>
 			</view>
@@ -56,10 +55,7 @@ import ItemStock from "./components/ItemStock";
 import productMins from "@/mixins/product";
 import { mapGetters } from "vuex";
 import { getWeixinId } from "@/api/invite/index";
-import { generatePriceTable,generateBarcodeTable } from '@/api/product/index'
-// #ifdef APP-PLUS
-const plug = uni.requireNativePlugin('Html5app-Gprinter')
-// #endif
+import { generatePriceTable,generateBarcodeTable,print } from '@/api/product'
 export default {
 	name: "item_list",
 	components: {
@@ -99,7 +95,6 @@ export default {
 	},
 	methods: {
 		moreToDo(item){
-			//查询是否已经连接蓝牙
 			let that=this;
 			let doList = ['复制花材', '打1个条码', '打2个条码', '打10个条码','打20个条码']
 			let doNum = [0,1,2,10,20]
@@ -110,168 +105,16 @@ export default {
 					if (index == 0) {
 						that.pageTo({url: '/admin/item/copy',query: {id: item.id}})
 					}else{
-						// #ifdef APP-PLUS
-
-						let platform=uni.getSystemInfoSync().platform
-						if(platform=='ios'){
-							that.$msg('开发中,敬请期待')
-							return false
-						}
-
-						plug.state({},ret=>{
-							if(ret.code == 1){
-								that.$util.confirmModal({content:'您还没有连接条码机,请先连接'},() => {
-									// #ifdef APP-PLUS
-									plug.connectUSB({setBackgroundColor:"#2088d2"},ret=>{   
-									//console.log(ret)
-									})
-									// #endif
-								})
-							}else{
-								let currentNum = Number(doNum[index])
-								if(Number(currentNum)<0){
-									this.$msg('请选择打印数量')
-									return false
-								}
-								let data = []
-								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)
-								})
+						let currentNum = Number(doNum[index])
+						print({id:item.id,num:currentNum}).then(res=>{
+							if(res.code == 1){
+								that.$msg(res.msg)
 							}
 						})
-						// #endif
-						// #ifdef MP-WEIXIN
-						that.$msg('请在App上打印')
-						// #endif
 					}
 				}
 			})
 		},
-		//大条码
-		createLable(itemName,itemId,num){
-			//制作条码格式,
-			var data=[];  //定义一个数组
-			var line={};  //每添加一个,代表一行字
-
-			//设置条码纸大小
-			line={};
-			line.width=40; //mm
-			line.height=50; //mm
-			line.gap=2; //条码纸之间,间隙长度 mm
-			line.page=num; //打印几份
-			data.push(line); //每添加一个,代表一行字
-
-			//添加文字
-			line={};
-			line.text= itemName;
-			line.rotation=0;
-			line.x=290;
-			line.y=15;
-			line.xscal=2;
-			line.yscal=2;
-			data.push(line); //每添加一个,代表一行字
-
-			//添加条型码
-			line={};
-			line.barcode=itemId;
-			line.x=290;
-			line.y=80;
-			line.type="CODE128";
-			line.width=2;//条型宽度,这里的宽指的是 条型码 竖条的宽度,不是整个条型码的宽度
-			line.height=90;
-			line.readable=true;
-			line.rotation=0;
-			data.push(line);
-
-			return data;
-		},
-		//小条码
-		createLable2(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.text= itemName;
-			line.rotation=0;
-			line.x=35;
-			line.y=20;
-			line.xscal=1;
-			line.yscal=1;
-			data.push(line); //每添加一个,代表一行字
-
-			//添加条型码
-			line={};
-			line.barcode=itemId;
-			line.x=35;
-			line.y=55;
-			line.type="CODE128";
-			line.width=2;//条型宽度,这里的宽指的是 条型码 竖条的宽度,不是整个条型码的宽度
-			line.height=50;
-			line.readable=true;
-			line.rotation=0;
-			data.push(line);
-
-			return data;
-		},
-		itemMore(){
-			let that=this;
-			//let doList = ['下载全部条码', '打印全部条码']
-			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){
-					that.$util.confirmModal({content:'您还没有连接条码机,请先连接'},() => {
-						// #ifdef APP-PLUS
-						plug.connectUSB({setBackgroundColor:"#2088d2"},ret=>{   
-						//console.log(ret)
-						})
-						// #endif
-					})
-				}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.createLable(currentItem.name,currentItem.itemId)},ret=>{
-										//uni.showToast({ title: JSON.stringify(ret), duration: 5000 })
-									})
-								})
-							}
-						})
-					}
-				}
-			})
-
-		},
 		downPriceTable(){
 			// #ifdef MP-WEIXIN
 			let isWindows = false

+ 4 - 0
ghsApp/src/api/product/index.js

@@ -1,5 +1,9 @@
 import https from "@/plugins/luch-request_0.0.7/request";
 
+export const print = data => {
+	return https.get("/product/print", data);
+};
+
 /** *
  * 分类及花材数据(库存预警、库存管理共用这个接口)
  * @parmas py 花材拼音

+ 8 - 0
ghsApp/src/api/purchase/index.js

@@ -1,5 +1,13 @@
 import https from "@/plugins/luch-request_0.0.7/request";
 
+export const printAll = data => {
+	return https.get("/purchase-order/print-all", data);
+};
+
+export const printItem = data => {
+	return https.get("/purchase-order/print-item", data);
+};
+
 /** *
  * 采购订单详情
  */

+ 11 - 146
ghsApp/src/pagesPurchase/info.vue

@@ -71,7 +71,7 @@
 			</view>
 
 			<view class="title">
-				商品信息 <text @click="printAllLabel()" style="float:right;font-weight:normal;color:#3385FF;margin-right:10upx;">打全部条码</text>
+				商品信息 <text @click="printAllLabel(detailInfo)" style="float:right;font-weight:normal;color:#3385FF;margin-right:10upx;">打全部条码</text>
 			</view>
 			<view class="module-com content-box">
 				<view class="commodity-view">
@@ -190,13 +190,9 @@
 
 <script>
 
-import { getPurchaseDetailApi,updateRemark } from "@/api/purchase/index";
+import { getPurchaseDetailApi,updateRemark,printAll,printItem } from "@/api/purchase/index";
 import productMins from "@/mixins/product";
-import { clearOrderApi } from "@/api/gys/index";
 import TuiListCell from "@/components/plugin/list-cell";
-// #ifdef APP-PLUS
-const plug = uni.requireNativePlugin('Html5app-Gprinter')
-// #endif
 export default {
 	name: "info",
 	components: {
@@ -216,152 +212,21 @@ export default {
 		};
 	},
 	methods: {
-		printLabel(ele){
+		printLabel(item){
 			let that = this
-			// #ifdef APP-PLUS
-
-			let platform=uni.getSystemInfoSync().platform
-			if(platform=='ios'){
-				that.$msg('开发中,敬请期待')
-				return false
-			}
-
-			plug.state({},ret=>{
-				if(ret.code == 1){
-					that.$util.confirmModal({content:'您还没有连接条码机,请先连接'},() => {
-						// #ifdef APP-PLUS
-						plug.connectUSB({setBackgroundColor:"#2088d2"},ret=>{   
-						//console.log(ret)
-						})
-						// #endif
-					})
-				}else{
-					that.$util.confirmModal({content:'确认打印?'},() => {
-							let data = []
-							if(ele.name && !that.$util.isEmpty(ele.name)){
-								let num = parseFloat(ele.itemNum)
-								let label = that.createLable(ele.name,ele.itemId,num)
-								data.push(label)
-							}
-							//说明地址 https://ext.dcloud.net.cn/plugin?id=462
-							plug.printer({"TSC":data,isArray:true},result=>{
-								//console.log(result)
-							})
-					})
-				}
+			printItem({id:item.id}).then(res=>{
+				if(res.code == 1){
+					that.$msg(res.msg)
+				}	
 			})
-			// #endif
-			// #ifdef MP-WEIXIN
-			that.$msg('请在App上打印')
-			// #endif
 		},
-		printAllLabel(){
+		printAllLabel(item){
 			let that = this
-			// #ifdef APP-PLUS
-
-			let platform=uni.getSystemInfoSync().platform
-			if(platform=='ios'){
-				that.$msg('开发中,敬请期待')
-				return false
-			}
-
-			plug.state({},ret=>{
-				if(ret.code == 1){
-					that.$util.confirmModal({content:'您还没有连接条码机,请先连接'},() => {
-						// #ifdef APP-PLUS
-						plug.connectUSB({setBackgroundColor:"#2088d2"},ret=>{   
-						//console.log(ret)
-						})
-						// #endif
-					})
-				}else{
-					that.$util.confirmModal({content:'确认打印全部条码?'},() => {
-						if(!that.$util.isEmpty(that.detailInfo.itemInfo)){
-							let data = []
-							for (const ele of that.detailInfo.itemInfo) {
-								if(ele.name && !that.$util.isEmpty(ele.name)){
-									let num = parseFloat(ele.itemNum)
-									let label = that.createLable(ele.name,ele.itemId,num)
-									data.push(label)
-									let separateLabel = that.createSeparateLabel()
-									data.push(separateLabel)
-								}
-							}
-							//说明地址 https://ext.dcloud.net.cn/plugin?id=462
-							plug.printer({"TSC":data,isArray:true},result=>{
-								//console.log(result)
-							})
-						}
-					})
+			printAll({orderSn:item.orderSn}).then(res=>{
+				if(res.code == 1){
+					that.$msg(res.msg)
 				}
 			})
-			// #endif
-			// #ifdef MP-WEIXIN
-			that.$msg('请在App上打印')
-			// #endif
-		},
-		//分隔条码
-		createSeparateLabel(){
-			//制作条码格式, 
-			var data=[];  //定义一个数组
-			var line={};  //每添加一个,代表一行字
-
-			//设置条码纸大小
-			line={};
-			line.width=40; //mm
-			line.height=50; //mm
-			line.gap=2; //条码纸之间,间隙长度 mm
-			line.page=1; //打印几份
-			data.push(line); //每添加一个,代表一行字
-
-			//添加文字
-			line={};
-			line.text= '======';
-			line.rotation=0;
-			line.x=290;
-			line.y=80;
-			line.xscal=2;
-			line.yscal=2;
-			data.push(line); //每添加一个,代表一行字
-
-			return data;
-		},
-		createLable(itemName,itemId,num){
-			//制作条码格式, 
-			var data=[];  //定义一个数组
-			var line={};  //每添加一个,代表一行字
-
-			//设置条码纸大小
-			line={};
-			line.width=40; //mm
-			line.height=50; //mm
-			line.gap=2; //条码纸之间,间隙长度 mm
-			line.page=num; //打印几份
-			data.push(line); //每添加一个,代表一行字
-
-			//添加文字
-			line={};
-			line.text= itemName;
-			line.rotation=0;
-			line.x=290;
-			line.y=15;
-			line.xscal=2;
-			line.yscal=2;
-			data.push(line); //每添加一个,代表一行字
-
-			//添加条型码
-			line={};
-			line.barcode=itemId;
-			line.x=290;
-			line.y=80;
-			line.type="CODE128";
-			line.width=2;//条型宽度,这里的宽指的是 条型码 竖条的宽度,不是整个条型码的宽度
-			line.height=90;
-			line.readable=true;
-			line.rotation=0;
-			data.push(line);
-
-			return data;
 		},
 		goToClear (item) {
 			this.pageTo({