Selaa lähdekoodia

Merge remote-tracking branch 'origin/master'

liyuan 4 kuukautta sitten
vanhempi
commit
55818312d9

+ 83 - 7
pages/views/warehouseDelivery/salesOrderDetails.vue

@@ -93,10 +93,28 @@
 						<view style="display: flex;align-items: center;justify-content: space-between;
 						margin-bottom: 20rpx;">
 							<text style="color: #FD4B09;font-size: 32rpx">序号{{ index + 1 }}</text>
-							<view style="color: #fff;font-size: 30rpx;
-								background: #FD4B09;padding: 10rpx;border-radius: 10rpx;" @click.stop="shipItemsDelfun(index, item.id)">
-								删除
+							<view style="display: flex;">
+								<view v-if="reservoirArea == 1 && item.historyList.length" style="color: #fff;font-size: 24rpx;
+									background: #67C23A;padding: 6rpx;border-radius: 10rpx;margin-right: 10rpx;"
+									@click.stop="rowArea(item,index)">
+									查看库区
+								</view>
+								<view v-if="reservoirArea == 1 && item.historyList.length == 0" style="color: #fff;font-size: 24rpx;
+									background: #67C23A;padding: 6rpx;border-radius: 10rpx;margin-right: 10rpx;"
+									@click.stop="rowArea(item,index)">
+									选择库区
+								</view>
+								<view v-if="reservoirArea == 1 && item.historyList.length" style="color: #fff;font-size: 24rpx;
+									background: #e43d33;padding: 6rpx;border-radius: 10rpx;margin-right: 10rpx;"
+									@click.stop="rowDelArea(item,index)">
+									清空库区
+								</view>
+								<view style="color: #fff;font-size: 24rpx;
+									background: #FD4B09;padding: 6rpx;border-radius: 10rpx;" @click.stop="shipItemsDelfun(index, item.id)">
+									删除
+								</view>
 							</view>
+
 						</view>
 						<view>
 							<view>{{ item.goodsName }}</view>
@@ -248,11 +266,13 @@
 
 <script>
 	import {
-		quickBilling
+		quickBilling,
+		isProcurement
 	} from '@/api/views/sale/index.js'
 	import {
 		queryBrand,
-		dotList
+		dotList,
+		itemRemove
 	} from '@/api/views/stock/index.js'
 	import {
 		storageDescListAll,
@@ -279,6 +299,7 @@
 	export default {
 		data() {
 			return {
+				reservoirArea: 0,
 				dotShow: false,
 				dotist: [],
 				form: {
@@ -304,11 +325,17 @@
 				popupForm: {},
 				popupIndex: 0,
 				popupShow: false,
-
-
 			}
 		},
 		onLoad(data) {
+
+			isProcurement({
+				param: "reservoir.area"
+			}).then(res => {
+				if (res.data) {
+					this.reservoirArea = res.data;
+				}
+			});
 			this.stockClerkListfun()
 			this.storageDescListAllfun()
 			// 获取物流配送方式数据
@@ -316,7 +343,56 @@
 			this.HYqueryBrandfun()
 			this.shipDetailfun(data.id)
 		},
+
+		onReady(data) {
+			console.log('onReady')
+			uni.$on('backAreaData', (obj, index) => {
+				console.log(1111)
+				this.form.shipItemsList[index].dot = obj.dot;
+				this.form.shipItemsList[index].sendNum = obj.sendNum;
+				this.form.shipItemsList[index].historyList = obj.historyList;
+			})
+		},
+		onUnload() {
+			uni.$off('backAreaData');
+		},
 		methods: {
+			rowArea(row, index) {
+				uni.navigateTo({
+					url: "/pages/views/warehouseDelivery/viewArea"
+				})
+				setTimeout(() => {
+					uni.$emit('areaData', this.form, row, index);
+				}, 100);
+			},
+			rowDelArea(row, index) {
+				if (row.historyList.filter(item => item.id).length) {
+					let _this = this
+					uni.showModal({
+						title: '提示',
+						content: '是否撤销库区?',
+						success: function(res) {
+							if (res.confirm) {
+								let ids = [];
+								for (let item of row.historyList) {
+									ids.push(item.id);
+								}
+								itemRemove({
+									ids: ids.join(",")
+								}).then(res => {
+									row.historyList = [];
+									row.dot = null;
+									row.sendNum = 0;
+								});
+							}
+						}
+					});
+				} else {
+					row.historyList = [];
+					row.dot = null;
+					row.sendNum = 0;
+				}
+			},
 			getDot(row) {
 				this.dotShow = true
 				dotList({

+ 176 - 0
pages/views/warehouseDelivery/viewArea.vue

@@ -0,0 +1,176 @@
+<template>
+	<view>
+		<view style="margin:10rpx 20rpx 0 20rpx;padding:0 20rpx;background-color: #fff;border-radius: 12rpx;">
+			<u-cell-group :border="false">
+				<u-cell title="批次号">
+					<text slot="value">
+						<picker @change="pickerChange" range-key="dot" :range="dotList" style="width:100%">
+							<u-input v-model="query.dot" inputAlign="right" border="none" placeholder="批次号"></u-input>
+						</picker>
+					</text>
+				</u-cell>
+				<u-cell title="出库数量" :value="qtyMax" :border="false"></u-cell>
+			</u-cell-group>
+		</view>
+		<u-cell-group :border="false">
+			<u-cell :border="false" center>
+				<view slot="icon" style="width: 10rpx;height: 35rpx;
+						background-color: #fd4b09;"></view>
+				<view slot="title">
+					库区列表
+				</view>
+			</u-cell>
+		</u-cell-group>
+		<view v-for="(item,index) in areaList" :key="index">
+			<view
+				style="margin:0 20rpx 10rpx 20rpx;padding:20rpx;background-color: #fff;border-radius: 12rpx;font-size: 30rpx;">
+				<view style="color: #FD4B09;font-size: 32rpx">
+					库区:{{item.reservoirAreaName}}
+				</view>
+				<view style="display: flex;justify-content: space-between;">
+					<view>
+						批次号:{{item.dot}}
+					</view>
+					<view>
+						库存:{{item.balanceQuantity}}
+					</view>
+				</view>
+				<view style="display: flex;justify-content: space-between;align-items: center;">
+					本次数量:
+					<u-number-box v-model="item.quantity" size="small" :min="0"
+						:max="item.balanceQuantity"></u-number-box>
+				</view>
+			</view>
+		</view>
+		<view style="width: 50%;;margin: 100rpx auto 20rpx auto;">
+			<u-button type="success" color="#fd4b09" shape="circle" text="确认库区" @click="submit"></u-button>
+		</view>
+	</view>
+</template>
+
+<script>
+	import {
+		dotList,
+		selectReservoirAreaList
+	} from '@/api/views/stock/index.js'
+	export default {
+		data() {
+			return {
+				form: {},
+				query: {},
+				dotList: [],
+				areaList: [],
+				qtyMax: 0,
+				index: 0,
+			}
+		},
+		onLoad(data) {
+			uni.$on('areaData', (form, row, index) => {
+				this.form = {};
+				this.query = {};
+				this.index = null;
+				this.qtyMax = 0;
+				this.areaList = [];
+				this.form = form;
+				this.query = row;
+				this.index = index;
+				this.qtyMax = row.remainingNum;
+				this.areaList = row.historyList;
+				this.getDot(row)
+				if (row.historyList.length == 0) {
+					this.getAreaList()
+				}
+			})
+		},
+		onUnload() {
+			uni.$off('areaData');
+		},
+		methods: {
+			submit() {
+				if (this.areaList.filter(item => item.quantity > 0).length == 0) {
+					return uni.showToast({
+						title: '至少有一条本次数量不能为0',
+						icon: 'none',
+						mask: true
+					});
+				}
+				for (let item of this.areaList.filter(item => item.quantity > 0)) {
+					if (this.areaList.filter(item => item.quantity > 0)[0].dot != item.dot) {
+						return uni.showToast({
+							title: '请选择一种批次号',
+							icon: 'none',
+							mask: true
+						});
+					}
+				}
+				if (!this.query.dot) {
+					this.query.dot = this.areaList.filter(item => item.quantity > 0)[0].dot;
+				}
+				let sum = 0;
+				for (let item of this.areaList.filter(item => item.quantity > 0)) {
+					sum += Number(item.quantity ? item.quantity : 0);
+				}
+				if (sum > this.qtyMax) {
+					return uni.showToast({
+						title: `总数量不能超过${this.qtyMax}`,
+						icon: 'none',
+						mask: true
+					});
+				}
+				if (Number(sum) != Number(this.qtyMax)) {
+					let _this = this
+					uni.showModal({
+						title: '提示',
+						content: '本次总数量和出库数量不相等,是否继续出库?',
+						success: function(res) {
+							if (res.confirm) {
+								let obj = {
+									..._this.query,
+									sendNum: sum,
+									historyList: _this.areaList.filter(item => item.quantity > 0)
+								};
+								uni.$emit('backAreaData', obj, _this.index);
+								uni.navigateBack()
+							}
+						}
+					});
+				} else {
+					let obj = {
+						...this.query,
+						sendNum: sum,
+						historyList: this.areaList.filter(item => item.quantity > 0)
+					};
+					uni.$emit('backAreaData', obj, this.index);
+					uni.navigateBack()
+				}
+			},
+			pickerChange(val) {
+				this.query.dot = this.dotList[val.detail.value].dot
+			},
+			getAreaList() {
+				let obj = {
+					shipId: this.form.id,
+					shipItemId: this.query.id,
+					goodsId: this.query.goodsId,
+					storageId: this.form.storageId,
+					dot: this.query.dot
+				};
+				selectReservoirAreaList(obj).then(res => {
+					this.areaList = res.data;
+				})
+			},
+			getDot(row) {
+				dotList({
+					storageId: this.form.storageId,
+					goodsId: row.goodsId
+				}).then(res => {
+					this.dotList = res.data
+				})
+			},
+		},
+	}
+</script>
+
+<style lang="scss" scoped>
+
+</style>