Bladeren bron

快速补货

lilei 2 jaren geleden
bovenliggende
commit
9cc86a7b1d

+ 9 - 1
api/shelfReplenish.js

@@ -94,11 +94,19 @@ export const shelfReplenishOutStock = (params) => {
   })
 }
 
-// 快速补货 
+// 可快速补货产品列表
 export const createShelfReplenishBill = (params) => {
   return axios.request({
     url: 'shelfReplenish/createShelfReplenishBill',
     data: params,
     method: 'post'
   })
+}
+//生成补货单
+export const saveReplenishBill = (params) => {
+  return axios.request({
+    url: 'shelfReplenish/saveReplenishBill',
+    data: params,
+    method: 'post'
+  })
 }

+ 0 - 1
components/kk-printer/index.vue

@@ -173,7 +173,6 @@
 			},
 			//点击打印按钮
 			handlePrintTap(){
-				this.$emit("hasProduct")
 				//打开蓝牙适配器
 				blesdk.openBlue().then((res)=>{
 					//获取已连接设备

+ 4 - 1
pages/replenishmentManage/stockModal.vue

@@ -6,7 +6,10 @@
 				<view class="modal-box" v-for="(item, index) in list" :key="index">
 					<view class="modal-p-header">
 						<view class="modal-p-code">{{item.product&&item.product.code?item.product.code:'--'}}</view>
-						<view class="modal-p-num">库存<text class="txt-red">{{item.stockQty||item.stockQty==0?item.stockQty:'--'}}</text>/补货<text class="txt-main">{{item.confirmQty||item.confirmQty==0?item.confirmQty:'--'}}</text>{{item.product&&item.product.unit?item.product.unit:'--'}}</view>
+						<view class="modal-p-num">
+							库存<text class="txt-red">{{item.stockQty||item.stockQty==0?item.stockQty:'--'}}</text>/
+							补货<text class="txt-main">{{item.qty||(item.confirmQty||item.confirmQty==0?item.confirmQty:'--')}}</text>
+							{{item.product&&item.product.unit?item.product.unit:'--'}}</view>
 					</view>
 					<view class="modal-p-footer">{{item.product&&item.product.name?item.product.name:'--'}}</view>
 				</view>

+ 127 - 0
pages/shelfSetting/chooseTypeModal.vue

@@ -0,0 +1,127 @@
+<template>
+	<u-mask class="commonModal" :show="isShow" :mask-click-able="false">
+		<view class="modal-con">
+			<view class="modal-title">系统将按照补货数量,同步执行出库、签收操作</view>
+			<view class="modal-main">
+				<view class="modal-title">请选择配送方式</view>
+				<u-radio-group v-model="form.dispatchType" width="50%" style="width: 100%;margin-bottom: 20upx;">
+					<u-radio v-for="(item, index) in dispatchTypeList" :key="index" :name="item.code">{{item.dispName}}</u-radio>
+				</u-radio-group>
+				<u-input v-model="form.remarks" placeholder="请输入出库备注(最多500字符)" type="textarea" :maxlength="500" :border="true" :auto-height="false" :custom-style="{height: '100upx'}" />
+			</view>
+			<view class="modal-footer">
+				<view class="button-cancel" @click="isShow=false">取消</view>
+				<view class="button-confirm" @click="handleConfirm">提交</view>
+			</view>
+		</view>
+	</u-mask>
+</template>
+
+<script>
+	import { getLookUpItem } from '@/api/data'
+	export default {
+		props: {
+			openModal: { //  弹框显示状态
+				type: Boolean,
+				default: false
+			}
+		},
+		data() {
+			return {
+				isShow: this.openModal, //  是否打开弹框
+				form: {
+				  dispatchType: undefined,
+				  remarks: ''
+				},
+				dispatchTypeList: []
+			}
+		},
+		mounted() {
+			this.getLookUpItem()
+		},
+		methods: {
+			// 确认
+			handleConfirm(){
+				const _this = this;
+				//  表单校验
+				if (!_this.form.dispatchType) {
+					uni.showToast({ icon: 'none', title: '请选择配送方式' });
+					return;
+				}
+				this.$emit('confirm', _this.form, 0)
+			},
+			// 配送方式
+			getLookUpItem () {
+				getLookUpItem({ lookupCode: 'DISTRIBUTION_MODE', pageNo: 1, pageSize: 1000 }).then(res => {
+					if (res.status == 200 && res.data && res.data.list) {
+						this.dispatchTypeList = res.data.list
+					} else {
+						this.dispatchTypeList = []
+					}
+				})
+			}
+		},
+		watch: {
+			//  父页面传过来的弹框状态
+			openModal (newValue, oldValue) {
+				this.isShow = newValue
+			},
+			//  重定义的弹框状态
+			isShow (newValue, oldValue) {
+				if (!newValue) {
+					this.$emit('close')
+				}
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.commonModal{
+		width: 100%;
+		height: 100%;
+		position: absolute;
+		left: 0;
+		top: 0;
+		z-index: 9999999;
+		.modal-con{
+			width: 78%;
+			margin: 50% auto;
+			background-color: #fff;
+			border-radius: 24upx;
+			padding-top: 30upx;
+			font-size: 30upx;
+			.modal-title{
+				text-align: center;
+				font-size: 26upx;
+				color: #666;
+			}
+			.modal-main{
+				margin: 10upx 30upx 30upx;
+				font-size: 30upx;
+				.modal-title{
+					margin-bottom: 10upx;
+				}
+			}
+			.modal-footer{
+				font-size: 30upx;
+				display: flex;
+				justify-content: space-between;
+				align-items: center;
+				text-align: center;
+				border-top: 1upx solid #E5E5E5;
+				.button-cancel{
+					color: #999;
+					border-right: 1upx solid #E5E5E5;
+					flex-grow: 1;
+					padding: 20upx 0;
+				}
+				.button-confirm{
+					color: #2A86F4;
+					flex-grow: 1;
+					padding: 20upx 0;
+				}
+			}
+		}
+	}
+</style>

+ 1 - 0
pages/shelfSetting/quickProductList.vue

@@ -12,6 +12,7 @@
 						</view>
 						<view class="pinfo">
 							<view class="pname">
+								<text>{{item.shelfPlaceCode}}</text>
 								{{item.productCode}}
 							</view>
 							<view class="pname pname1">

+ 86 - 21
pages/shelfSetting/quickReplenish.vue

@@ -14,30 +14,41 @@
 				<u-checkbox size="40" @change="allCheckeChange" v-model="allChecked" shape="circle">{{allChecked?'取消全选':'全选'}}</u-checkbox>
 			</view>
 			<view class="btns flex align_item justify_end">
-				<kk-printer ref="kkprinter" @hasProduct="hasProduct" printBtnStyle="default-mid" defaultText="打印贴签" @startPrint="startPrint"></kk-printer>
+				<kk-printer ref="kkprinter" printBtnStyle="default-mid" defaultText="打印贴签" @startPrint="startPrint"></kk-printer>
 				<view style="padding: 0 10rpx;"></view>
 				<view>
-					<u-button class="handle-btn" shape="circle" size="medium" hover-class="none" :custom-style="customBtnStyle" @click="replenish()">快速补货</u-button>
+					<u-button class="handle-btn" :loading="loading" shape="circle" size="medium" hover-class="none" :custom-style="customBtnStyle" @click="replenish">快速补货</u-button>
 				</view>
 			</view>
 		</view>
+		<!-- 选择配送方式弹框 -->
+		<choose-type-modal v-if="chooseModal" :openModal="chooseModal" @confirm="modalChooseType" @close="chooseModal = false" />
+		<!-- 库存不足 弹框 -->
+		<stock-modal v-if="stockModal" :openModal="stockModal" :list="stockList" :params="temParams" @confirm="modalStock" @close="stockModal=false" />
 	</view>
 </template>
 
 <script>
 	import quickProductList from './quickProductList.vue'
 	import kkPrinter from '@/components/kk-printer/index.vue';
+	import chooseTypeModal from './chooseTypeModal.vue'
+	import stockModal from '@/pages/replenishmentManage/stockModal.vue'
 	import {printTempl} from '@/libs/printTools.js'
+	import {saveReplenishBill} from '@/api/shelfReplenish.js'
 	export default {
-		components: { quickProductList, kkPrinter },
+		components: { quickProductList, kkPrinter, chooseTypeModal, stockModal },
 		data() {
 			return {
-				show: false,
+				loading: false,
+				chooseModal: false,
 				basicInfoData:null,
 				partList: [],
 				allChecked: false,
 				printIndex: 0,
 				isParinting: false,
+				stockModal: false,
+				stockList: [],
+				temParams:null,
 				customBtnStyle: {  //  自定义按钮样式
 					borderColor: this.$config('primaryColor'),
 					backgroundColor: this.$config('primaryColor'),
@@ -51,6 +62,8 @@
 				backgroundColor: this.$config('primaryColor')
 			})
 			this.$refs.productList.setData(this.partList)
+			this.allCheckeChange({value:true})
+			this.allChecked = true
 		},
 		onLoad(option) {
 			this.basicInfoData = JSON.parse(decodeURIComponent(option.data));
@@ -88,20 +101,64 @@
 			allCheckedCallback(val){
 				this.allChecked = val
 			},
-			hasProduct(){
-				const result =this.$refs.productList.getAllChecked()
-				if(!result.length){
-					this.toashMsg("请选择产品!")
-				}
-			},
 			// 补货
 			replenish(){
 				const result =this.$refs.productList.getAllChecked()
+				console.log(result,result.length)
 				if(result.length){
+					this.chooseModal = true
 				}else{
 					this.toashMsg("请选择产品!")
 				}
 			},
+			modalChooseType(data,confirm){
+				const result =this.$refs.productList.getAllChecked()
+				const arr = []
+				result.map((item, index) => {
+				  arr.push({
+				    productSn: item.productSn,
+					productCode: item.productCode,
+				    qty: item.printQty,
+					shelfSn: this.basicInfoData.shelfSn,
+				    shelfPlaceCode: item.shelfPlaceCode,
+					shelfPlaceSn: item.shelfPlaceSn
+				  })
+				})
+				const params = {
+				  detailList: arr,
+				  dispatchType: data.dispatchType,
+				  remarks: data.remarks,
+				  shelfSn:this.basicInfoData.shelfSn,
+				  confirm: confirm
+				}
+				console.log(params)
+				uni.showLoading({
+					title: "正在提交..."
+				})
+				this.loading = true
+				saveReplenishBill(params).then(res => {
+					console.log(res)
+					if(res.status == 200){
+						// 库存不足
+						if(res.data&&res.data.length){
+							this.temParams = params
+							this.stockList = res.data
+							this.stockModal = true
+						}else{
+							uni.navigateBack()
+							this.toashMsg(res.message)
+						}
+					}
+					this.loading = false
+					this.chooseModal = false
+					uni.hideLoading()
+				})
+			},
+			// 继续补货
+			modalStock(params){
+				this.modalChooseType(params,1)
+				this.stockModal = false
+			},
 			printOnce(opt,tsc,blesdk,data){
 				const _this = this
 				const dealer = this.$store.state.vuex_userData
@@ -132,24 +189,31 @@
 						_this.printIndex = 0
 						_this.$refs.kkprinter.onPrintSuccess()
 						_this.isParinting = false
-						_this.show = false
 					}
 				});
 			},
 			// 批量打印 
 			startPrint(opt,tsc,blesdk){
-				const result =this.$refs.productList.getAllChecked()
+				const _this = this
+				const result =_this.$refs.productList.getAllChecked()
 				console.log(result,result.length)
 				if(result.length){
-					 if(this.isParinting){
+					 if(_this.isParinting){
 					 	return
 					 }
-					 this.isParinting = true
-					 this.show = true
-					 this.printOnce(opt,tsc,blesdk,result[this.printIndex])
+					 clzConfirm({
+					   title: '提示',
+					   content: '开始打印后,无法撤回,系统将默认按照每个产品的补货数量批量打印',
+					   success (ret) {
+					 	if (ret.confirm || ret.index == 0) {
+					 		_this.isParinting = true
+					 		_this.printOnce(opt,tsc,blesdk,result[_this.printIndex])
+					 	}
+					   }
+					 })
 				}else{
-					this.toashMsg("请选择产品!")
-					this.$refs.kkprinter.onPrintFail()
+					_this.toashMsg("请选择产品!")
+					_this.$refs.kkprinter.onPrintFail()
 				}
 			},
 		}
@@ -162,10 +226,11 @@
 		height: 100vh;
 		background: #fff;
 		.head-info{
-			padding: 10rpx;
+			padding: 20rpx 20rpx 0;
 			border-bottom: 2rpx solid #eee;
 			> view{
-				padding: 5rpx 10rpx;
+				padding: 10rpx;
+				color: darkorange;
 			}
 			.p-title{
 				padding: 0 20rpx;
@@ -193,7 +258,7 @@
 			overflow: auto;
 		}
 		.part-footer{
-			padding: 15rpx 30rpx;
+			padding: 20rpx 30rpx;
 			border-top: 2rpx solid #eee;
 			> view{
 				&:first-child{

+ 4 - 1
pages/shelfSetting/shelfList.vue

@@ -73,6 +73,9 @@
 		onLoad(opts) {
 			this.getShelfList()
 			uni.$on("setCustome",(data)=>{
+				this.pageNo = 1
+				this.shelfList = []
+				this.getShelfList()
 				this.saveShelf(data)
 			})
 		},
@@ -91,7 +94,7 @@
 					this.clearSearch()
 				}
 			},
-			// 保存数字货架基本信息
+			// 关联客户
 			saveShelf(data){
 				shelfSave({
 					shelfSn: this.tempData.shelfSn,

+ 1 - 1
pages/shelfSetting/shelfSet.vue

@@ -235,7 +235,7 @@
 					for(let a in res.data){
 						this.placeTab.push(a)
 					}
-					if(!flag){
+					if(!flag || this.placeTab.length==1){
 					  this.curTab = this.placeTab[0]
 					}
 					if(this.placeTab.length == 0){