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

+ 1 - 1
ghsApp/src/components/not-login.vue

@@ -18,7 +18,7 @@ export default {
 	watch: {
 		getLoginInfo: {
 			handler(newValue) {
-        if(this.$util.isEmpty(newValue.admin) == false && newValue.admin.currentGhsShopId > 0){
+        if(!this.$util.isEmpty(newValue.admin) && newValue.admin.currentGhsShopId > 0){
           this.showModel = false
         }				
 			}

+ 1 - 0
ghsApp/src/utils/util.js

@@ -386,6 +386,7 @@ export const confirmModal = (item,okCallback=null,cancelCallback=null) => {
     }else if(platform=='android'){
 		let options={
 			title:title,//内容(可选)但是标题和内容至少选择一个
+			con:content,
 			okTitle:okText,//确认按钮文字(可选)
 			cancleTitle:cancelText,//取消按钮文字(可选)
 			okTextColor:"#38ADFF",//确认按钮颜色(可选)

+ 5 - 2
hdApp/src/admin/goodsManage/cgNewPlantResult.vue

@@ -24,9 +24,12 @@ export default {
 		},
 		printLabel(){
 			let that = this
+			// #ifdef MP-WEIXIN
+			that.$msg('请在App上打印')
+			// #endif
 			// #ifdef APP-PLUS
 			plug.state({},ret=>{
-				if(ret.code == 1){
+				if(ret.state == 1){
 					that.$util.confirmModal({content:'您还没有连接标签机,请先连接'},() => {
 						plug.connectUSB({setBackgroundColor:"#2088d2"},ret=>{   
 							//console.log(ret)
@@ -47,7 +50,7 @@ export default {
 			// #endif
 			// #ifdef APP-PLUS
 			plug.state({},ret=>{
-				if(ret.code == 1){
+				if(ret.state == 1){
 					that.$util.confirmModal({content:'您还没有连接标签机,请先连接'},() => {
 						plug.connectUSB({setBackgroundColor:"#2088d2"},ret=>{   
 							//console.log(ret)

+ 5 - 1
hdApp/src/admin/goodsManage/list.vue

@@ -98,7 +98,8 @@ export default {
       operateTop: 0,
       autoLoad:false,
       flowerNum:0,
-      flowerNumList:[{num:6,name:6},{num:9,name:9},{num:11,name:11},{num:19,name:19},{num:33,name:33},{num:52,name:52},{num:66,name:66},{num:99,name:99},{num:0,name:'取消'}]
+      flowerNumList:[{num:6,name:6},{num:9,name:9},{num:11,name:11},{num:19,name:19},{num:33,name:33},{num:52,name:52},{num:66,name:66},{num:99,name:99},{num:0,name:'取消'}],
+      py:''
     };
   },
   computed: {
@@ -107,6 +108,9 @@ export default {
     this.getCategoryData();
   },
   methods: {
+    searchFn(){
+
+    },
     selectFlowerNumFn(){
       this.$refs.selectFlowerNumRef.open('top')
     },

+ 4 - 5
hdApp/src/admin/home/workbench.vue

@@ -71,7 +71,6 @@
 </template>
 <script>
 import { mapGetters, mapState } from "vuex";
-import { getDataTimestamp } from "@/utils/common";
 import { getWeixinId } from "@/api/invite/index";
 import { getUser } from "@/utils/auth";
 import { consoleIndex } from "@/api/workbench";
@@ -140,8 +139,8 @@ export default {
     },
     goCg(){
       if(this.getLoginInfo.pfShopId && Number(this.getLoginInfo.pfShopId)>0){
-          //this.$msg('请在批发端操作')
-          //return false
+          this.$msg('请在批发端操作')
+          return false
       }
       this.$util.pageTo({url:'/pagesPurchase/order'})
     },
@@ -152,8 +151,8 @@ export default {
       }
       if(this.getLoginInfo.pfShopId && Number(this.getLoginInfo.pfShopId)>0){
         if(item.pf == 0){
-          //this.$msg('请在批发端操作')
-          //return false
+          this.$msg('请在批发端操作')
+          return false
         }
       }
       this.$util.pageTo(item)

+ 74 - 16
hdApp/src/admin/item/list.vue

@@ -102,28 +102,46 @@ export default {
 		moreToDo(item){
 			//查询是否已经连接蓝牙
 			let that=this;
-			let doList = ['打印条形', '打印条形2个', '打印条形5个','打印条形10个','打印条形20个']
+			let doList = ['打1个标签', '打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:'您还没有连接蓝牙,请先链接'},() => {
 								that.pageTo({url:'/admin/tools/blue'})
 							})
-
 						}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 })
-								})
-							}
+							// #ifdef APP-PLUS
+							plug.state({},ret=>{
+								if(ret.state == 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)
+									//console.log(data)
+									//说明地址 https://ext.dcloud.net.cn/plugin?id=462
+									plug.printer({"TSC":data,isArray:true},result=>{ })
+								}
+							})
+							// #endif
+							// #ifdef MP-WEIXIN
+							that.$msg('请在App上打印')
+							// #endif
 						}
 					})
 
@@ -132,12 +150,51 @@ export default {
 
 		},
 		// #endif
-		OrderLable(itemName,itemId){
-			
-			//制作标签格式, 
+		//大标签
+		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=30;
+			line.y=15;
+			line.xscal=2;
+			line.yscal=2;
+			data.push(line); //每添加一个,代表一行字
+
+			//添加条型码
+			line={};
+			line.barcode=itemId;
+			line.x=30;
+			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
@@ -146,7 +203,7 @@ export default {
 			line.page=1; //打印几份
 			data.push(line); //每添加一个,代表一行字
 
-				//添加文字
+			//添加文字
 			line={};
 			line.text= itemName;
 			line.rotation=0;
@@ -162,6 +219,7 @@ export default {
 			line.x=35;
 			line.y=55;
 			line.type="CODE128";
+			line.width=2;//条型宽度,这里的宽指的是 条型码 竖条的宽度,不是整个条型码的宽度
 			line.height=50;
 			line.readable=true;
 			line.rotation=0;

+ 1 - 1
hdApp/src/components/not-login.vue

@@ -18,7 +18,7 @@ export default {
 	watch: {
 		getLoginInfo: {
 			handler(newValue) {
-        if(this.$util.isEmpty(newValue.admin) == false && newValue.admin.currentShopId > 0){
+        if(!this.$util.isEmpty(newValue.admin) && newValue.admin.currentShopId > 0){
           this.showModel = false
         }				
 			}

+ 24 - 7
hdApp/src/mixins/globalMixins.js

@@ -33,12 +33,13 @@ export default {
 			uni.setStorageSync('account', option.account)
 		}
     	uni.setStorageSync('currentQuery', JSON.stringify(option))
+		let token = uni.getStorageSync('token')
+		let that = this
 		if (this.$util.isEmpty(this.getLoginInfo)) {
 			// #ifdef MP-WEIXIN
 			//微信小程序第一次打开小程序时尝试登录一次
 			var pages = getCurrentPages()
 			let currentRoute  = pages[pages.length-1].route;
-			let token = uni.getStorageSync('token')
 			if(this.$util.isEmpty(token)){
 				if(currentRoute == 'admin/home/workbench' || currentRoute == 'pagesPurchase/ghsProduct'){
 					wxLoginFn(true).then(res => {
@@ -56,7 +57,6 @@ export default {
 					})
 				}
 			}else{
-				let that = this
 				hasTokenAutoLogin().then(subRes=>{
 				  //有几个地方涉及登陆,需要统一方法,请搜索关键词 uni_login
 				  if(subRes.code == 1){
@@ -78,6 +78,28 @@ export default {
 				})
 			}
 			// #endif
+			//#ifdef APP-PLUS
+			if(!this.$util.isEmpty(token)){
+				hasTokenAutoLogin().then(subRes=>{
+					//有几个地方涉及登陆,需要统一方法,请搜索关键词 uni_login
+					if(subRes.code == 1){
+						uni.setStorageSync('shopId', subRes.data.admin.currentShopId)
+						getDictionaries({ token: subRes.data.token }).then(res => {
+							if (that.$util.isEmpty(res)) {
+								return false
+							}
+							that.$store.commit('setDictionariesInfo', { ...res.data.dict, ...res.data })
+							that.$store.commit('setMyShopInfo', { ...res.data.shop, ...res.data })
+						})
+						that.$store.commit('setLoginInfo', { ...subRes.data.admin, ...subRes.data })
+						getUser(true).then(res => { 
+							uni.setNavigationBarTitle({ title: res.name })
+						})
+						that.setUserShopAll()
+					}
+				})
+			}
+			// #endif
 		}
 	},
 	onShow(){
@@ -87,10 +109,5 @@ export default {
 	},
 	methods: {
     ...mapActions(['setUserShopAll'])
-	},
-	mounted() {
-		if (this.mInit) {
-			this.mInit()
-		}
 	}
 }

+ 1 - 0
hdApp/src/utils/util.js

@@ -359,6 +359,7 @@ export const confirmModal = (item,okCallback=null,cancelCallback=null) => {
     }else if(platform=='android'){
 		let options={
 			title:title,//内容(可选)但是标题和内容至少选择一个
+			con:content,
 			okTitle:okText,//确认按钮文字(可选)
 			cancleTitle:cancelText,//取消按钮文字(可选)
 			okTextColor:"#38ADFF",//确认按钮颜色(可选)