shish 4 anni fa
parent
commit
7f7e2b4d21

+ 3 - 1
hdApp/src/admin/goodsManage/cgNewPlant.vue

@@ -178,9 +178,11 @@ export default {
         return;
       }
       let form = JSON.parse(JSON.stringify(this.form))
+      uni.showLoading({mask:true})
       cgPlant({...form}).then(res => {
+        uni.hideLoading()
         if(res.code == 1){
-          this.pageTo({url: '/admin/goodsManage/cgNewPlantResult',type:2})
+          this.pageTo({url: '/admin/goodsManage/cgNewPlantResult',type:2,query:{id:res.data.id}})
         }
       })
     },

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

@@ -5,18 +5,118 @@
 			<view class="result-view">
 				<view class="iconfont iconchenggong"></view>
 				<view class="result-title">操作成功</view>
-				<button class="admin-button-com big blue" style="width:45vh;" @click="goBackHome">返回</button>
+				<button class="admin-button-com big blue" style="width:45vh;" @click="printLabel">打标签</button>
+				<button class="admin-button-com big default" style="width:45vh;margin-top:30upx;" @click="goBackHome">返回</button>
 			</view>
 		</view>
 	</view>
 </template>
-
 <script>
+import { getFullInfo } from "@/api/plant-cg";
+// #ifdef APP-PLUS
+const plug = uni.requireNativePlugin('Html5app-Gprinter')
+// #endif
 export default {
     name: "success",
 	methods: {
 		goBackHome() {
 			uni.navigateBack({})
+		},
+		printLabel(){
+			let that = this
+			// #ifdef APP-PLUS
+			plug.state({},ret=>{
+				if(ret.code == 1){
+					that.$util.confirmModal({content:'您还没有连接标签机,请先连接'},() => {
+						plug.connectUSB({setBackgroundColor:"#2088d2"},ret=>{   
+							//console.log(ret)
+						})
+					})
+				}else{
+					that.$util.confirmModal({content:'确认打印?'},() => {
+						that.confirmPrintLabel()	
+					})
+				}
+			})
+			// #endif
+		},
+		confirmPrintLabel(){
+			let that = this
+			// #ifdef MP-WEIXIN
+			that.$msg('请在App上打印')
+			// #endif
+			// #ifdef APP-PLUS
+			plug.state({},ret=>{
+				if(ret.code == 1){
+					that.$util.confirmModal({content:'您还没有连接标签机,请先连接'},() => {
+						plug.connectUSB({setBackgroundColor:"#2088d2"},ret=>{   
+							//console.log(ret)
+						})
+					})
+				}else{
+					getFullInfo({id:this.option.id}).then(res=>{
+						if(res.code == 1){
+							if(res.data.itemList && !that.$util.isEmpty(res.data.itemList)){
+								let data = []
+								for (const info in res.data.itemList) {
+									let currentNum = info.num ? Number(info.num) : 0
+									let name = info.name || ''
+									let code = info.goodsSn || ''
+									if(Number(currentNum)<=0){
+										this.$msg('请选择打印数量')
+										return false
+									}
+									let label = that.createLable(name,code,currentNum)
+									data.push(label)
+								}
+								//说明地址 https://ext.dcloud.net.cn/plugin?id=462
+								plug.printer({"TSC":data,isArray:true},result=>{
+									//console.log(result)
+								})
+							}						
+						}
+					})
+				}
+			})
+			// #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=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;
 		}
 	}
 };

+ 2 - 3
hdApp/src/admin/goodsManage/plantConfirm.vue

@@ -82,13 +82,12 @@ export default {
     confirmToSubmit () {
       let that = this
       let goods = this.selectList.map((ele) => {
-        return { goodsId: ele.id, num: ele.bigCount,price: ele.userPrice }
+        return { goodsId: ele.id, num: ele.bigCount,price: ele.userPrice,goodsSn:ele.sn,cover:ele.cover }
       })
       that.$util.confirmModal({content:'确认提交?'},() => {
           cgPlant({goods:JSON.stringify(goods),remark:that.form.remark}).then((res) => {
-            //删除记忆
             that.removeFromSaveDirect()
-            that.pageTo({url: '/admin/goodsManage/plantResult',type:2})
+            that.pageTo({url: '/admin/goodsManage/cgNewPlantResult',type:2,query:{id:res.data.id}})
           });
       })
     },

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

@@ -140,8 +140,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 +152,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)

+ 5 - 0
hdApp/src/api/plant-cg/index.js

@@ -0,0 +1,5 @@
+import https from "@/plugins/luch-request_0.0.7/request";
+
+export const getFullInfo = data => {
+	return https.get("/plant-cg/get-full-info", data);
+};

+ 8 - 39
hdApp/src/pagesStorehouse/allot/allotEx.vue

@@ -1,49 +1,18 @@
 <template>
-	<!-- 出库列表 -->
 	<view class="allot-ex-page">
 		<view class="tabs">
-			<Tabs
-				:tabs="tabs"
-				:currentTab="tabIndex"
-				@change="changeTabEvent"
-				@add="addEvent"
-				:addText="'新增'"
-				:isAdd="false"
-			></Tabs>
+			<Tabs :tabs="tabs" :currentTab="tabIndex" @change="changeTabEvent" @add="addEvent" :addText="'新增'" :isAdd="false" ></Tabs>
 		</view>
 		<scroll-view scroll-y class="allot-list">
 			<block v-if="!$util.isEmpty(list.data)">
-				<view
-					class="allot-item"
-					v-for="(item, index) in list.data"
-					:key="index"
-					@click="gotoDetails(item)"
-				>
+				<view class="allot-item" v-for="(item, index) in list.data" :key="index" @click="gotoDetails(item)" >
 					<view class="info">
 						<view class="info-order">{{ item.orderSn }}</view>
 						<view class="info-name">{{ item.adminName }}</view>
-						<view
-							><text class="info-time">{{ item.updateTime }}</text
-							><text>{{ item.smallNum || "-" }}/{{ item.bigNum || "-" }}</text
-							>件</view
-						>
+						<view ><text class="info-time">{{ item.updateTime }}</text ><text>{{ item.smallNum || "-" }}/{{ item.bigNum || "-" }}</text >件</view >
 					</view>
-					<view
-						:class="[
-							'status',
-							item.status == OUT_STATUS.DONE
-								? 'primary'
-								: item.status == OUT_STATUS.CONFIRM
-								? 'warn'
-								: 'gray'
-						]"
-					>
-						<view
-							:class="[
-								'iconfont',
-								item.status == OUT_STATUS.CANCEL ? 'iconcaozuojihuo' : 'icondairuku'
-							]"
-						></view>
+					<view :class="[ 'status', item.status == OUT_STATUS.DONE ? 'primary' : item.status == OUT_STATUS.CONFIRM ? 'warn' : 'gray' ]" >
+						<view :class="[ 'iconfont', item.status == OUT_STATUS.CANCEL ? 'iconcaozuojihuo' : 'icondairuku' ]" ></view>
 						<view :class="['status-name']">{{ item.statusName }}</view>
 					</view>
 				</view>
@@ -52,11 +21,9 @@
 				<AppWrapperEmpty title="暂无记录" :is-empty="$util.isEmpty(list.data)" />
 			</block>
 		</scroll-view>
-		
 		<view class="app-footer open_btn">
 			<view @click="addEvent" class="admin-button-com middle blue">新增出库</view>
 		</view>
-    <!-- <kd-entrance></kd-entrance> -->
 	</view>
 </template>
 <script>
@@ -140,6 +107,8 @@ export default {
 			return name;
 		},
 		addEvent() {
+			this.$msg('开发中')
+			return
 			uni.navigateTo({
 				url: `/pagesStorehouse/allot/addExDetails`,
 				success: result => {},
@@ -223,4 +192,4 @@ export default {
 		}
 	}
 }
-</style>
+</style>