Browse Source

补货确认

chenrui 3 years ago
parent
commit
af6117503b

+ 24 - 0
api/shelfReplenish.js

@@ -10,4 +10,28 @@ export const shelfReplenishList = (params) => {
 		data: params,
 		method: 'post'
 	})
+}
+//  补货单 明细列表 不分页
+export const shelfReplenishDetailList = (params) => {
+  return axios.request({
+    url: 'shelfReplenish/detail/queryList',
+    data: params,
+    method: 'post'
+  })
+}
+//  补货单 检查补货单库存数量
+export const shelfReplenishDetailStock = (params) => {
+  return axios.request({
+    url: 'shelfReplenish/detail/checkDetailStockQty',
+    data: params,
+    method: 'post'
+  })
+}
+//  补货单 确认补货
+export const shelfReplenishConfirm = (params) => {
+  return axios.request({
+    url: 'shelfReplenish/confirm',
+    data: params,
+    method: 'post'
+  })
 }

+ 1 - 0
config/index.js

@@ -18,6 +18,7 @@ const getConfig = (theme) => {
 			warringColor: '#f3bb12', // 警告
 			errorColor: '#E70012', // 错误
 			successColor: '#13C442', // 成功
+			infoColor: '#909399',
 			topBarBackground: 'linear-gradient(45deg, #fff, #fff)', // 顶部栏渐变色
 			topBarTitleColors: '#222222', // 顶部栏文字颜色
 		},

+ 8 - 0
pages.json

@@ -85,6 +85,14 @@
 		        "navigationBarTitleText": "补货管理",
 		        "enablePullDownRefresh": false
 		    }
+		},
+		{
+			"path" : "pages/replenishmentManage/confirm",
+			"style" :
+			{
+				"navigationBarTitleText": "补货确认",
+				"enablePullDownRefresh": false
+			}
 		}
         ,{
             "path" : "pages/common/printTag/printTag",

+ 114 - 0
pages/common/commonModal.vue

@@ -0,0 +1,114 @@
+<template>
+	<u-mask class="commonModal" :show="isShow" :mask-click-able="false">
+		<view class="modal-con">
+			<view class="modal-title">{{title}}</view>
+			<view class="modal-main">{{content}}</view>
+			<view class="modal-footer">
+				<view class="button-cancel" v-if="isCancel" @click="isShow=false">{{cancelText}}</view>
+				<view class="button-confirm" @click="handleConfirm">{{confirmText}}</view>
+			</view>
+		</view>
+	</u-mask>
+</template>
+
+<script>
+	export default {
+		props: {
+			openModal: { //  弹框显示状态
+				type: Boolean,
+				default: false
+			},
+			title: { //  标题
+				type: String,
+				default: '提示'
+			},
+			content: { //  内容
+				type: String,
+				default: ''
+			},
+			isCancel: { //  是否有取消按钮
+				type: Boolean,
+				default: true
+			},
+			confirmText: { //  确认按钮内容
+				type: String,
+				default: '确认'
+			},
+			cancelText: { //  取消按钮内容
+				type: String,
+				default: '取消'
+			}
+		},
+		data() {
+			return {
+				isShow: this.openModal, //  是否打开弹框
+			}
+		},
+		methods: {
+			// 确认
+			handleConfirm(){
+				this.$emit('confirm')
+			}
+		},
+		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;
+		.modal-con{
+			width: 78%;
+			margin: 50% auto 0;
+			background-color: #fff;
+			border-radius: 24upx;
+			.modal-title{
+				text-align: center;
+				font-size: 30upx;
+				color: #000;
+				padding: 30upx 30upx 0;
+			}
+			.modal-main{
+				text-align: center;
+				font-size: 28upx;
+				color: #222;
+				line-height: 1.5em;
+				padding: 30upx 30upx 40upx;
+			}
+			.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>

+ 184 - 0
pages/replenishmentManage/confirm.vue

@@ -0,0 +1,184 @@
+<template>
+	<view class="replenishment-confirm-wrap">
+		<scroll-view scroll-y class="replenishment-confirm-cont">
+			<view class="replenishment-confirm-main" v-for="(item,index) in listdata" :key="item.id">
+				<u-image class="item-pic" :src="item.product&&item.product.productMsg?item.product.productMsg:`../../static/${theme}/def_img@2x.png`" width="64px" height="64px"></u-image>
+				<view class="item-con">
+					<view class="item-name">{{item.product&&item.product.name?item.product.name:'--'}}</view>
+					<view class="item-code">{{item.product&&item.product.code?item.product.code:'--'}}</view>
+					<view class="item-num">
+						<view class="num-t">x {{item.qty||item.qty==0?item.qty:'--'}} {{item.product&&item.product.unit?item.product.unit:'--'}}</view>
+						<u-number-box class="num-v" v-model="item.confirmQty" @change="handlerChange" :min="0" :max="item.qty" color="#000"></u-number-box>
+					</view>
+				</view>
+			</view>
+		</scroll-view>
+		<view class="replenishment-confirm-footer">
+			<u-button @click="confirmModal=true" type="success" :custom-style="customStyle" hover-class="none" shape="circle">确定补货({{confirmQty}}/{{totalQty}})</u-button>
+		</view>
+		<common-modal :openModal="confirmModal" content="确认对该数字货架进行补货吗?" confirmText="确认补货" @confirm="modalConfirm" @close="confirmModal=false" />
+	</view>
+</template>
+
+<script>
+	import commonModal from '@/pages/common/commonModal.vue'
+	import { shelfReplenishDetailList, shelfReplenishDetailStock, shelfReplenishConfirm } from '@/api/shelfReplenish'
+	export default {
+		components: { commonModal },
+		data() {
+			return {
+				listdata: [],
+				theme: '',
+				customStyle: {
+					borderRadius:'100rpx',
+					fontSize:'30rpx',
+					background: '#0485F6'
+				},
+				confirmQty: 0,  // 实发数量之合
+				totalQty: 0,  // 应发数量之合
+				confirmModal: false,
+				replenishBillSn: ''
+			}
+		},
+		onLoad(options){
+			this.theme = getApp().globalData.theme
+			this.replenishBillSn = options.sn
+			this.getRow()
+		},
+		methods:{
+			// 查询列表
+			getRow () {
+				const _this = this
+				shelfReplenishDetailList({ replenishBillSn: this.replenishBillSn }).then(res => {
+					if (res.status == 200) {
+						_this.totalQty = 0
+						_this.confirmQty = 0
+						res.data.map(item =>{
+							item.confirmQty = item.qty || 0
+							if(item.qty && Number(item.qty)){
+								_this.totalQty += Number(item.qty)
+							}
+							if(item.confirmQty && Number(item.confirmQty)){
+								_this.confirmQty += Number(item.confirmQty)
+							}
+						})
+						this.listdata = res.data || []
+					} else {
+						this.listdata = []
+					}
+				})
+			},
+			handlerChange(value, index){
+				const _this = this
+				this.confirmQty = 0
+				this.listdata.map(item => {
+					if(item.confirmQty && Number(item.confirmQty)){
+						_this.confirmQty += Number(item.confirmQty)
+					}
+				})
+			},
+			// 确认补货 confirm
+			modalConfirm(){
+				const arr = []
+				this.listdata.map((item, index) => {
+					if (item.confirmQty || item.confirmQty == 0) {
+						arr.push({
+							productSn: item.productSn,
+							confirmQty: item.confirmQty
+						})
+					}
+				})
+				const params = {
+					replenishBillSn: this.replenishBillSn,
+					detailList: arr
+				}
+				// 校验产品库存是否足够
+				shelfReplenishDetailStock(params).then(res => {
+					if (res.status == 200) {
+						// if (res.data && res.data.length > 0) {
+							// this.stockList = res.data
+							// this.validateType = 'confirm'
+							// this.paramsData = params
+							// this.openStockModal = true
+						// } else {
+							this.confirmFun(params)
+						// }
+					}
+				})
+			},
+			// 提交确认
+			confirmFun (params) {
+				shelfReplenishConfirm(params).then(res => {
+					if (res.status == 200) {
+						uni.showToast({icon: 'none', title: '确认补货成功'})
+						uni.$emit('refreshBL')
+						uni.navigateTo({ url: "/pages/replenishmentManage/replenishmentList" })
+					}
+				})
+			},
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	page {
+		height: 100%;
+		background-color: #fff;
+	}
+	.replenishment-confirm-wrap{
+		position: relative;
+		width: 100%;
+		height: 100%;
+		overflow: hidden;
+		padding-bottom: 136upx;
+		.replenishment-confirm-cont{
+			width: 100%;
+			height: 100%;
+			overflow: auto;
+			.replenishment-confirm-main{
+				display: flex;
+				justify-content: space-between;
+				margin: 0 32upx;
+				padding: 30upx 0;
+				border-bottom: 1px solid #E5E5E5;
+				.item-pic{
+					flex-shrink: 0;
+					margin-right: 20upx;
+				}
+				.item-con{
+					flex-grow: 1;
+					.item-name{
+						color: #191919;
+						font-size: 30upx;
+						font-weight: bold;
+					}
+					.item-code{
+						color: #999999;
+						font-size: 26upx;
+					}
+					.item-num{
+						display: flex;
+						justify-content: space-between;
+						align-items: center;
+						.num-t{
+							color: #707070;
+							font-size: 26upx;
+						}
+						.num-v{
+							
+						}
+					}
+				}
+			}
+		}
+		.replenishment-confirm-footer{
+			padding: 26upx 32upx 30upx;
+			background-color: #fff;
+			position: fixed;
+			left: 0;
+			bottom: 0;
+			width: 100%;
+			box-shadow: 3px 1px 7px #eee;
+		}
+	}
+</style>

+ 49 - 60
pages/replenishmentManage/replenishmentList.vue

@@ -1,44 +1,43 @@
 <template>
 	<view class="pagesCons">
-		    <view class="utabs">
-				<u-tabs-swiper ref="uTabs" :list="tabList" name="dispName" :current="current" @change="tabsChange" :is-scroll="false" swiperWidth="750"></u-tabs-swiper>
-			</view>
-			<swiper class="check-list" :current="swiperCurrent" @transition="transition" @change="swiperChange" @animationfinish="animationfinish">
-				<swiper-item class="swiper-item" v-for="(tabs, index) in tabList" :key="index">
-					<scroll-view scroll-y class="scroll-view" @scrolltolower="onreachBottom">
-						<view  
-						class="check-order-list" 
-						v-if="index==current"
-						v-for="(item,sindex) in list" 
-						:key="item.id+'-'+sindex"
-						@click="viewRow(item)" >
-							<view class="check-row">
-								<view>{{item.shelfName}}</view>
-								<view>
-									<text :style="{color:$config('errorColor')}">{{item.billStateDictValue}}</text>
-								</view>
+		<view class="utabs">
+			<u-tabs-swiper ref="uTabs" :list="tabList" name="dispName" :current="current" @change="tabsChange" :is-scroll="false" swiperWidth="750"></u-tabs-swiper>
+		</view>
+		<swiper class="check-list" :current="swiperCurrent" @transition="transition" @change="swiperChange" @animationfinish="animationfinish">
+			<swiper-item class="swiper-item" v-for="(tabs, index) in tabList" :key="index">
+				<scroll-view scroll-y class="scroll-view" @scrolltolower="onreachBottom">
+					<view  
+					class="check-order-list" 
+					v-if="index==current"
+					v-for="(item,sindex) in list" 
+					:key="item.id+'-'+sindex"
+					@click="viewRow(item)" >
+						<view class="check-row">
+							<view>{{item.shelfName}}</view>
+							<view>
+								<text :style="{color: item.billState=='FINISH'?$config('successColor'):item.billState=='CANCEL'?$config('infoColor'):$config('errorColor')}">{{item.billStateDictValue}}</text>
 							</view>
-							<view class="check-col">
-								<view>补货单号:{{item.replenishBillNo}}</view>
-								<view>应发数量:{{item.totalQty}}</view>
-								<view>{{item.createDate}}</view>
-							</view>
-						 </view>
-						 <u-empty :src="`/static/${$config('themePath')}/def_no_data@3x.png`" icon-size="240" :text="noDataText" img-width="120" v-if="list.length==0 && status!='loading'" mode="list"></u-empty>
-						 <view v-if="index==current" style="padding: 20upx;">
-							 <u-loadmore :load-text="$config('loadText')" v-if="total>pageSize || status=='loading'" :status="status" />
-						 </view>
-					</scroll-view>
-				</swiper-item>
-			</swiper>
+						</view>
+						<view class="check-col">
+							<view>补货单号:{{item.replenishBillNo}}</view>
+							<view>应发数量:{{item.totalQty}}</view>
+							<view>{{item.createDate}}</view>
+						</view>
+					 </view>
+					 <u-empty :src="`/static/${$config('themePath')}/def_no_data@3x.png`" icon-size="240" :text="noDataText" img-width="120" v-if="list.length==0 && status!='loading'" mode="list"></u-empty>
+					 <view v-if="index==current" style="padding: 20upx;">
+						 <u-loadmore :load-text="$config('loadText')" v-if="total>pageSize || status=='loading'" :status="status" />
+					 </view>
+				</scroll-view>
+			</swiper-item>
+		</swiper>
 	</view>
 </template>
 
 <script>
-	import { shelfReplenishList } from '@/api/shelfReplenish.js'
+	import { shelfReplenishList } from '@/api/shelfReplenish'
 	export default {
-		components: {
-		},
+		components: {},
 		data() {
 			return {
 				status: 'loadmore',
@@ -96,7 +95,7 @@
 		methods:{
 			// tabs通知swiper切换
 			tabsChange(index) {
-				this.swiperCurrent = index;
+				this.swiperCurrent = index
 			},
 			swiperChange(event){
 				this.action = 'swiperChange'
@@ -104,21 +103,21 @@
 			},
 			// swiper-item左右移动,通知tabs的滑块跟随移动
 			transition(e) {
-				let dx = e.detail.dx;
-				this.$refs.uTabs.setDx(dx);
+				let dx = e.detail.dx
+				this.$refs.uTabs.setDx(dx)
 			},
 			// 由于swiper的内部机制问题,快速切换swiper不会触发dx的连续变化,需要在结束时重置状态
 			// swiper滑动结束,分别设置tabs和swiper的状态
 			animationfinish(e) {
-				let current = e.detail.current;
+				let current = e.detail.current
 				let isCurtab = this.current == current
 				if(this.status!="nomore"){
-					let loadData = this.action == 'swiperChange' ? !isCurtab : isCurtab;
+					let loadData = this.action == 'swiperChange' ? !isCurtab : isCurtab
 					if(loadData){
-						this.$refs.uTabs.setFinishCurrent(current);
-						this.swiperCurrent = current;
-						this.current = current;
-						this.resetPage();
+						this.$refs.uTabs.setFinishCurrent(current)
+						this.swiperCurrent = current
+						this.current = current
+						this.resetPage()
 					}
 				}
 			},
@@ -173,24 +172,14 @@
 			},
 			// 详细页
 			viewRow(item){
-				// 已完成的
-				uni.navigateTo({
-					url: "/pages/toDoList/backlogDetail?id="+item.id
-				})
-			},
-			// 状态颜色处理
-			clsStatus(status){
-				if(status == 'CHECK_PENDING'){
-					return 'dsh'
-				}
-				if(status == 'PENDING'){
-					return 'dzg'
-				}
-				if(status == 'FINISHED'){
-					return 'ywc'
-				}
-				if(status == 'EXPIRED'){
-					return 'ygq'
+				if(item.billState=='WAIT_CONFIRM'){ // 待确认
+					uni.navigateTo({ url: "/pages/replenishmentManage/confirm?sn="+item.replenishBillSn })
+				}else if(item.billState=='WAIT_OUT_STOCK'){ // 待出库
+					uni.navigateTo({ url: "/pages/replenishmentManage/replenishmentList?sn="+item.replenishBillSn })
+				}else if(item.billState=='WAIT_CHECK'){ // 待签收
+					uni.navigateTo({ url: "/pages/replenishmentManage/replenishmentList?sn="+item.replenishBillSn })
+				}else{
+					uni.navigateTo({ url: "/pages/replenishmentManage/replenishmentList?sn="+item.replenishBillSn })
 				}
 			}
 		}

BIN
static/default/def_img@2x.png