|
|
@@ -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>
|