shish 4 سال پیش
والد
کامیت
c3e3d4f034

+ 16 - 161
hdApp/src/admin/goods/plantCgDetail.vue

@@ -4,7 +4,7 @@
       <view class="bills-info_box content-box">
         <view class="order-info_box">
           <view>订单日期:</view>
-          <view>{{ detailInfo.updateTime ? detailInfo.updateTime.substring(0, 16) : '' }}</view>
+          <view>{{ detailInfo.addTime ? detailInfo.addTime.substr(5, 11) : '' }}</view>
         </view>
         <view class="order-info_box">
           <view>订单编号:</view>
@@ -30,7 +30,7 @@
       <view class="module-com content-box proInfo">
         <view class="commodity-view">
           <view class="infoAEdit">
-            <text>商品信息</text> <text @click="printAllLabel()" style="float:right;font-weight:normal;color:#3385FF;margin-right:10upx;">打全部条码</text>
+            <text>商品信息</text> <text @click="printAllLabel(detailInfo)" style="float:right;font-weight:normal;color:#3385FF;margin-right:10upx;">打全部条码</text>
           </view>
           <view class="commodity-list">
             <view v-for="(s, idx) in itemList" :key="idx" class="commodity-item" >
@@ -95,11 +95,8 @@
   </view>
 </template>
 <script>
-import { getPlantCgDetail} from "@/api/goods/index";
+import { getPlantCgDetail,printAll,printItem} from "@/api/goods/index";
 import TuiListCell from "@/components/plugin/list-cell";
-// #ifdef APP-PLUS
-const plug = uni.requireNativePlugin('Html5app-Gprinter')
-// #endif
 export default {
   name: "plantCgDetail",
   components: {
@@ -130,163 +127,21 @@ export default {
 			})
 		},
   methods: {
-		printLabel(ele){
-			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.num)
-								let price = parseFloat(ele.salePrice)
-								let label = that.createLable(ele.name,ele.goodsSn,num,price)
-								data.push(label)
-							}
-							//说明地址 https://ext.dcloud.net.cn/plugin?id=462
-							plug.printer({"TSC":data,isArray:true},result=>{
-								//console.log(result)
-							})
-					})
-				}
-			})
-			// #endif
-			// #ifdef MP-WEIXIN
-			that.$msg('请在App上打印')
-			// #endif
+		printLabel(item){
+      let that = this
+      printItem({id:item.id}).then(res=>{
+        if(res.code == 1){
+          that.$msg(res.msg)
+        }
+      })
 		},
-		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.itemList)){
-							let data = []
-							for (const ele of that.itemList) {
-								if(ele.name && !that.$util.isEmpty(ele.name)){
-									let num = parseFloat(ele.num)
-									let price = parseFloat(ele.salePrice)
-									let label = that.createLable(ele.name,ele.goodsSn,num,price)
-									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)
-							})
-						}
-					})
-				}
-			})
-			// #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,price){
-			//制作条码格式, 
-			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.text= price+'元';
-			line.rotation=0;
-			line.x=390;
-			line.y=180;
-			line.xscal=1;
-			line.yscal=1;
-			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;
+      printAll({orderSn:item.orderSn}).then(res=>{
+        if(res.code == 1){
+          that.$msg(res.msg)
+        }
+      })
 		},
     copy (val) {
       const self = this;

+ 1 - 1
hdApp/src/admin/goods/plantCgItem.vue

@@ -4,7 +4,7 @@
       <view class="item-info">
         <view class="info-row">
           <text class="info-label"> 日期:</text>
-          <text class="info-value">{{ info.addTime ? info.addTime.substring(5, 11) : '' }}</text>
+          <text class="info-value">{{ info.addTime ? info.addTime.substr(5, 11) : '' }}</text>
         </view>
         <view class="info-row">
           <text class="info-label"> 单号:</text>

+ 0 - 5
hdApp/src/admin/item/components/ItemStock.vue

@@ -54,12 +54,7 @@ export default {
 	},
 	methods: {
 		moreToDo(item){
-			// #ifdef MP-WEIXIN
-			this.$msg('请在app上操作')
-			// #endif
-			// #ifdef APP-PLUS
 			this.$emit('moreToDo', item)
-			// #endif
 		},
 		goToOrderDetail(id){
 			this.$util.pageTo({url: "/admin/order/itemOrder?id="+id})

+ 5 - 158
hdApp/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: {
@@ -110,165 +106,16 @@ export default {
 					if (index == 0) {
 						that.$msg('开发中')
 					}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:'您还没有连接蓝牙,请先链接'},() => {
-						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.itemId)},ret=>{
-										//uni.showToast({ title: JSON.stringify(ret), duration: 5000 })
-									})
-								})
-							}
-						})
-					}
-				}
-			})
-
-		},
 		downPriceTable(){
 			// #ifdef MP-WEIXIN
 			let isWindows = false

+ 8 - 0
hdApp/src/api/goods/index.js

@@ -17,6 +17,14 @@ export const getPlantCg = async data => {
 	return https.get("/plant-cg/list", data);
 };
 
+export const printAll = data => {
+	return https.get("/plant-cg/print-all", data);
+};
+
+export const printItem = data => {
+	return https.get("/plant-cg/print-item", data);
+};
+
 export const getPlantCgDetail = async data => {
 	return https.get("/plant-cg/detail", data);
 };

+ 4 - 0
hdApp/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);
+};
+
 export const batchChangeAddPrice = data => {
 	return https.post("/product/batch-change-add-price", data);
 };