Commit 4887a5c8 authored by tanjunxin's avatar tanjunxin

feat: 完成盘点和调拨功能的开发

parent 7ef9ed11
......@@ -49,6 +49,16 @@ const install = (Vue, vm) => {
getforinvmbinfo: (params = {}) => vm.$u.postJson(config.adminPath + '/invmb/getforinvmbinfo', params),
// 入库单创建
createforstorage: (params = {}) => vm.$u.postJson(config.adminPath + '/sfctb/createforstorage', params),
// 查询产品库存
getforinvmlinfoApi: (params = {}) => vm.$u.postJson(config.adminPath + '/invml/getforinvmlinfo', params),
// 新增库存交易单
stockConfirmApi: (params = {}) => vm.$u.postJson(config.adminPath + '/stockTaking/confirm', params),
// 调拨确认
transferConfirmApi: (params = {}) => vm.$u.postJson(config.adminPath + '/stockAllocate/confirm', params),
// 仓库查询
getWarehouseListApi: (params = {}) => vm.$u.postJson(config.adminPath + '/cmsmc/getCmsmcList', params),
// 库位查询
getStorageListApi: (params = {}) => vm.$u.postJson(config.adminPath + '/cmsni/getCmsniList', params),
};
}
......
......@@ -140,5 +140,42 @@
"未连接到服务器": "ไม่ได้เชื่อมต่อกับเซิร์ฟเวอร์",
"失败": "ล้มเหลว",
"未知错误": "ข้อผิดพลาดที่ไม่รู้จัก",
"获取用户语言失败": "ล้มเหลวในการรับภาษาผู้ใช้"
"获取用户语言失败": "ล้มเหลวในการรับภาษาผู้ใช้",
"提交成功": "ส่งเรียบร้อยแล้ว",
"提交失败": "การส่งล้มเหลว",
"请勿重复提交": "ไม่ยื่นซ้ำซ้อน",
"请求参数有误": "พารามิเตอร์การร้องขอผิดพลาด",
"提交数据不能为空": "ข้อมูลที่ส่งมาไม่สามารถว่างเปล่าได้",
"库存盘点": "นับสินค้าคงคลัง",
"盘点作业": "นับงาน",
"盘点明细": "รายละเอียดการนับ",
"盘点产品号不能为空": "นับหมายเลขสินค้าไม่สามารถว่างได้",
"当前已经存在盘点产品": "ขณะนี้มีผลิตภัณฑ์นับอยู่แล้ว",
"请输入盘点产品号": "กรุณากรอกหมายเลขสินค้า",
"库房/储位": "คลังสินค้า / ที่เก็บของ",
"库存数": "จำนวนสต็อก",
"盘点数": "จำนวนนับ",
"请输入盘点数": "โปรดป้อนคะแนนดิสก์",
"盘点数不能大于库存数": "จำนวนนับต้องไม่เกินจำนวนสต็อก",
"新增库存": "เพิ่มสินค้าคงคลัง",
"新增数": "เพิ่มจำนวน",
"请输入新增数": "กรุณาใส่จำนวนที่เพิ่ม",
"选择仓库": "เลือกคลังสินค้า",
"选择储位": "เลือกพื้นที่เก็บข้อมูล",
"调拨数不能为空": "จำนวนการโทรไม่สามารถว่างได้",
"调入库存不能为空": "โอนเข้าสต็อกไม่สามารถว่างเปล่าได้",
"调入储位不能为空": "ปรับพื้นที่เก็บข้อมูลไม่สามารถว่างได้",
"请输入储位": "กรุณาใส่ที่เก็บข้อมูล",
"库存调拨": "การโอนสินค้าคงคลัง",
"请输入调拨产品号": "กรุณากรอกหมายเลขผลิตภัณฑ์",
"调拨明细": "รายละเอียดการจัดสรร",
"当前储位": "พื้นที่จัดเก็บปัจจุบัน",
"调入储位": "ปรับพื้นที่เก็บข้อมูล",
"调拨确认": "ยืนยันการโอนเงิน",
"该调拨产品号数据已存在": "ข้อมูลหมายเลขผลิตภัณฑ์โอนนี้มีอยู่แล้ว",
"调拨总数不能大于库存数": "จำนวนการจัดสรรทั้งหมดจะต้องไม่เกินจำนวนสินค้าคงคลัง",
"调拨数": "จำนวนการโทร",
"请输入调拨数": "โปรดป้อนจำนวนการโทร",
"调入仓库": "โอนเข้าคลังสินค้า",
"调拨数不能大于库存数": "จำนวนการจัดสรรต้องไม่เกินจำนวนสินค้าคงคลัง"
}
......@@ -140,5 +140,42 @@
"未连接到服务器": "未连接到服务器",
"失败": "失败",
"未知错误": "未知错误",
"获取用户语言失败": "获取用户语言失败"
"获取用户语言失败": "获取用户语言失败",
"提交成功": "提交成功",
"提交失败": "提交失败",
"请勿重复提交": "请勿重复提交",
"请求参数有误": "请求参数有误",
"提交数据不能为空": "提交数据不能为空",
"库存盘点": "库存盘点",
"盘点作业": "盘点作业",
"盘点明细": "盘点明细",
"盘点产品号不能为空": "盘点产品号不能为空",
"当前已经存在盘点产品": "当前已经存在盘点产品",
"请输入盘点产品号": "请输入盘点产品号",
"库房/储位": "库房/储位",
"库存数": "库存数",
"盘点数": "盘点数",
"请输入盘点数": "请输入盘点数",
"盘点数不能大于库存数": "盘点数不能大于库存数",
"新增库存": "新增库存",
"新增数": "新增数",
"请输入新增数": "请输入新增数",
"选择仓库": "选择仓库",
"选择储位": "选择储位",
"调拨数不能为空": "调拨数不能为空",
"调入库存不能为空": "调入库存不能为空",
"调入储位不能为空": "调入储位不能为空",
"请输入储位": "请输入储位",
"库存调拨": "库存调拨",
"请输入调拨产品号": "请输入调拨产品号",
"调拨明细": "调拨明细",
"当前储位": "当前储位",
"调入储位": "调入储位",
"调拨确认": "调拨确认",
"该调拨产品号数据已存在": "该调拨产品号数据已存在",
"调拨总数不能大于库存数": "调拨总数不能大于库存数",
"调拨数": "调拨数",
"请输入调拨数": "请输入调拨数",
"调入仓库": "调入仓库",
"调拨数不能大于库存数": "调拨数不能大于库存数"
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -204,6 +204,41 @@
"navigationBarTitleText": "录入入库单",
"enablePullDownRefresh": false
}
},
{
"path": "pages/stockTransfer/index",
"style": {
"navigationBarTitleText": "库存调拨",
"enablePullDownRefresh": false
}
},
{
"path": "pages/stockTransfer/select",
"style": {
"navigationBarTitleText": "库存调拨选择",
"enablePullDownRefresh": false
}
},
{
"path": "pages/stockCheck/index",
"style": {
"navigationBarTitleText": "库存盘点",
"enablePullDownRefresh": false
}
},
{
"path": "pages/stockCheck/detail",
"style": {
"navigationBarTitleText": "库存盘点",
"enablePullDownRefresh": false
}
},
{
"path": "pages/stockCheck/add",
"style": {
"navigationBarTitleText": "新增库存",
"enablePullDownRefresh": false
}
}
],
"globalStyle": {
......
......@@ -67,6 +67,16 @@ import i18n from '../../lang/index'
src: require('@/static/images/infor.png'),
text: i18n.t('品号信息'),
url: '/pages/invmbinfo/Main'
},
{
src: require('@/static/images/keyin.png'),
text: i18n.t('库存调拨'),
url: '/pages/stockTransfer/index'
},
{
src: require('@/static/images/keyin.png'),
text: i18n.t('库存盘点'),
url: '/pages/stockCheck/index'
}
]
};
......
<template>
<view class="stock-check-add-page">
<NavBar :title="$t('新增库存')"></NavBar>
<view class="container">
<view class="title">
{{info.ml001}}|{{info.materialName}}
</view>
<view class="detail">
<view class="card">
<uni-forms :modelValue="formData" :label-width="90" label-align="right">
<uni-forms-item :label="`${$t('新增数')}:`">
<uni-easyinput v-model="formData.stockQuantity" type="number" trim="all"
:placeholder="$t('请输入新增数')" />
</uni-forms-item>
<uni-forms-item :label="`${$t('选择仓库')}:`">
<uni-data-select v-model="formData.warehouse" :localdata="warehouseRange"
@change="handleChange"></uni-data-select>
</uni-forms-item>
<uni-forms-item :label="`${$t('选择储位')}:`">
<uni-data-select v-model="formData.location" :localdata="storageRange"></uni-data-select>
</uni-forms-item>
</uni-forms>
</view>
</view>
</view>
<view class="footer">
<button class="sumbit-btn" @click="handleSumbit">{{$t('确认')}}</button>
</view>
</view>
</view>
</template>
<script>
import i18n from '@/lang/index';
export default {
data() {
return {
info: [],
warehouseRange: [],
storageRange: [],
formData: {
isAppend: 1,
physicalQuantity: "",
stockQuantity: "",
warehouse: "",
location: "",
}
}
},
onLoad(option) {
this.getWarehouseList();
if (option.info) {
this.info = JSON.parse(decodeURIComponent(option.info));
console.log(this.info);
};
},
methods: {
getWarehouseList() {
this.$u.api.getWarehouseListApi({})
.then(res => {
this.warehouseRange = res.data.map((item) => {
return {
...item,
value: item.mc001,
text: item.mc002,
}
})
})
},
getStorageList() {
const params = {
ni001: this.formData.warehouse
}
this.$u.api.getStorageListApi(params)
.then(res => {
this.storageRange = res.data.map((item) => {
return {
...item,
value: item.ni002,
text: item.ni003,
}
})
})
},
handleChange() {
this.getStorageList();
},
handleSumbit() {
if (!this.formData.stockQuantity) {
return this.$u.toast(i18n.t('调拨数不能为空'));
}
if (!this.formData.warehouse) {
return this.$u.toast(i18n.t('调入库存不能为空'));
}
if (!this.formData.location) {
return this.$u.toast(i18n.t('调入储位不能为空'));
}
let pages = getCurrentPages();
// 2. 上一页面实例
// 注意是length长度,所以要想得到上一页面的实例需要 -2
// 若要返回上上页面的实例就 -3,以此类推
let prevPage = pages[pages.length - 2];
// 3. 给上一页面实例绑定getValue()方法和参数(注意是$vm)
prevPage.$vm.getAddValue(Object.assign(this.info, this.formData, {
physicalQuantity: this.formData.stockQuantity
}));
// 4. 返回上一页面
uni.navigateBack({
delta: 1 // 返回的页面数
});
},
}
}
</script>
<style lang="scss" scoped>
.stock-check-add-page {
.container {
.title {
font-size: 32rpx;
font-weight: bolder;
padding-top: 24rpx;
padding-left: 24rpx;
}
.detail {
width: calc(100% - 40rpx);
margin: 20rpx;
padding: 20rpx;
background-color: #f1f1f3;
border-radius: 12rpx;
.card {
padding: 12rpx;
margin-bottom: 24rpx;
box-sizing: border-box;
background-color: #ffffff;
border-radius: 12rpx;
/deep/.uni-forms {
.uni-forms-item {
margin: 24rpx;
.uni-forms-item__label {
font-size: 28rpx;
}
}
}
}
}
}
.footer {
position: fixed;
bottom: 0;
width: 100%;
height: 120rpx;
padding: 24rpx;
background-color: #ffffff;
.sumbit-btn {
width: 300rpx;
}
}
}
</style>
\ No newline at end of file
<template>
<view class="stock-check-detail-page">
<NavBar :title="$t('库存盘点')"></NavBar>
<view class="container">
<view class="title">
{{list[0].ml001}}|{{list[0].materialName}}
</view>
<view class="detail">
<view class="card" v-for="(item, index) in list" :key="index">
<view class="info">
<view class="item inventory-info">
{{$t('库房/储位')}}{{item.warehouse}}|{{item.location}}
</view>
<view class="item inventory-data">
{{$t('库存数')}}{{item.stockQuantity}}
</view>
</view>
<view class="physical-inventory">
<view>
{{$t('盘点数')}}
</view>
<uni-easyinput v-model="item.physicalQuantity" type="number" trim="all"
:placeholder="$t('请输入盘点数')" @change="handleChange($event, item, index)" />
</view>
</view>
</view>
</view>
<view class="footer">
<button class="sumbit-btn" @click="handleSumbit">{{$t('确认')}}</button>
</view>
</view>
</view>
</template>
<script>
import i18n from '@/lang/index';
export default {
data() {
return {
list: ""
}
},
onLoad(option) {
if (option.list) {
this.list = JSON.parse(decodeURIComponent(option.list));
};
},
methods: {
handleChange(e, row, index) {
if (index == 0) {
if(e > row.stockQuantity) {
this.$u.toast(i18n.t('盘点数不能大于库存数'));
}
} else {
row.stockQuantity = e;
}
},
handleSumbit() {
if (this.list[0]['physicalQuantity'] > this.list[0]['stockQuantity']) {
return this.$u.toast(i18n.t('盘点数不能大于库存数'));
}
let pages = getCurrentPages();
// 2. 上一页面实例
// 注意是length长度,所以要想得到上一页面的实例需要 -2
// 若要返回上上页面的实例就 -3,以此类推
let prevPage = pages[pages.length - 2];
// 3. 给上一页面实例绑定getValue()方法和参数(注意是$vm)
prevPage.$vm.getDetailValue(this.list);
// 4. 返回上一页面
uni.navigateBack({
delta: 1 // 返回的页面数
});
}
}
}
</script>
<style lang="scss" scoped>
.stock-check-detail-page {
.container {
.title {
font-size: 32rpx;
font-weight: bolder;
padding-top: 24rpx;
padding-left: 24rpx;
}
.detail {
width: calc(100% - 40rpx);
margin: 20rpx;
padding: 20rpx;
background-color: #f1f1f3;
border-radius: 12rpx;
.card {
padding: 24rpx;
margin-bottom: 24rpx;
box-sizing: border-box;
background-color: #ffffff;
border-radius: 12rpx;
.info {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 24rpx;
.item {
text-align: left;
}
}
.physical-inventory {
display: flex;
justify-content: space-between;
align-items: center;
}
}
}
}
.footer {
position: fixed;
bottom: 0;
width: 100%;
height: 120rpx;
padding: 24rpx;
background-color: #ffffff;
.sumbit-btn {
width: 300rpx;
}
}
}
</style>
\ No newline at end of file
<template>
<view class="stock-check-page">
<NavBar :title="$t('库存盘点')"></NavBar>
<view class="container">
<view class="title">
{{$t('盘点作业')}}
</view>
<view class="search-area">
<view class="top">
<uni-easyinput v-model="value" prefixIcon="search" :placeholder="$t('请输入盘点产品号')" trim="all" />
<button class="search-btn" :loading="loadings" @click="handleSearch">{{$t('确认')}}</button>
</view>
<uni-easyinput v-model="warehouse" class="warehouse-input" prefixIcon="search"
:placeholder="$t('请输入盘点仓库')" trim="all" />
</view>
<view class="sub-title">
<view>
{{$t('盘点明细')}}
</view>
<u-icon name="plus" size="32" @click="handleAdd"></u-icon>
</view>
<view class="detail">
<view class="card" v-if="list.length > 0" @click="handleDetail">
<view class="top">
<view class="product-number">
{{list[0].ml001}}|{{list[0].materialName}}
</view>
<view class="top-r">
<view class="total-quantity">
{{physicalQuantitys}}ps/{{stockQuantitys}}ps
</view>
</view>
</view>
<view class="bottom">
<view class="content" v-for="(item, index) in list" :key="index">
<view class="left">
<view class="text">
{{item.warehouse}}|{{item.location}}
</view>
</view>
<view class="right">
<view class="text">
{{item.physicalQuantity}}ps/{{item.stockQuantity}}ps
</view>
<u-icon v-if="item.isAppend" name="minus" size="32"
@click.native.stop="handleDelete(item, index)"></u-icon>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="footer">
<button class="sumbit-btn" :loading="loading" @click="handleSumbit">{{$t('确认')}}</button>
</view>
</view>
</template>
<script>
import i18n from '@/lang/index';
export default {
data() {
return {
loading: false,
loadings: false,
value: "",
warehouse: "",
list: [],
}
},
computed: {
physicalQuantitys() {
let num = 0;
this.list.forEach((item, index) => {
num += Number(item.physicalQuantity);
});
return num;
},
stockQuantitys() {
let num = 0;
this.list.forEach((item, index) => {
num += Number(item.stockQuantity);
});
return num;
}
},
methods: {
getAddValue(data) {
this.list.push(data);
},
getDetailValue(data) {
this.list = data;
},
handleSearch() {
if (this.loadings) {
return this.$u.toast(i18n.t('请勿重复提交'))
}
this.loadings = true;
if (!this.value) {
return this.$u.toast(i18n.t('盘点产品号不能为空'));
}
if (this.list.length > 0) {
return this.$u.toast(i18n.t('当前已经存在盘点产品'));
}
const params = {
ml001: this.value,
ml002: this.warehouse
}
this.$u.api.getforinvmlinfoApi(params)
.then(res => {
this.loadings = false;
if (res.data.length > 0) {
this.list = res.data.map((item) => {
return {
...item,
isAppend: 0,
warehouse: item.ml002,
location: item.ml003,
physicalQuantity: 0,
stockQuantity: item.ml005
}
});
setTimeout(() => {
this.value = "";
this.warehouse = "";
}, 1000);
} else {
this.$u.toast(i18n.t('请求参数有误'));
}
})
},
handleAdd() {
uni.navigateTo({
url: '/pages/stockCheck/add?info=' + encodeURIComponent(JSON.stringify(this.list[0]))
});
},
handleDetail() {
uni.navigateTo({
url: '/pages/stockCheck/detail?list=' + encodeURIComponent(JSON.stringify(this.list))
});
},
handleDelete(row, index) {
this.list.splice(index, 1);
},
handleSumbit() {
if (this.loading) {
return this.$u.toast(i18n.t('请勿重复提交'))
}
if(this.list.length == 0) {
return this.$u.toast(i18n.t('提交数据不能为空'));
}
this.loading = true;
const params = this.list.map((item) => {
return {
isAppend: item.isAppend,
location: item.location,
materialName: item.materialName,
materialNo: item.ml001,
physicalQuantity: Number(item.physicalQuantity),
stockQuantity: Number(item.stockQuantity),
warehouse: item.warehouse,
}
})
this.$u.api.stockConfirmApi({
data: params
})
.then(res => {
this.loading = false;
if (res.success) {
this.$u.toast(i18n.t('提交成功'));
setTimeout(() => {
this.$router.go(0);
}, 3000);
} else {
this.$u.toast(i18n.t('提交失败'));
}
})
},
}
}
</script>
<style lang="scss" scoped>
.stock-check-page {
.container {
.title {
font-size: 32rpx;
font-weight: bolder;
padding-top: 24rpx;
padding-left: 24rpx;
}
.search-area {
display: flex;
flex-direction: column;
padding: 24rpx;
.top {
display: flex;
justify-content: space-between;
align-content: center;
margin-bottom: 12rpx;
.search-btn {
width: 120rpx;
height: 60rpx;
line-height: 60rpx;
margin-left: 12rpx;
}
}
/deep/.uni-easyinput {
height: 60rpx;
.uni-easyinput__content {
height: 100%;
border-radius: 36rpx;
}
}
.warehouse-input {
width: calc(100% - 132rpx);
/deep/.uni-easyinput__content {
height: 60rpx;
}
}
}
.sub-title {
font-size: 32rpx;
font-weight: bolder;
padding: 0 24rpx;
display: flex;
justify-content: space-between;
align-items: center;
}
.detail {
width: calc(100% - 40rpx);
margin: 20rpx;
padding: 20rpx;
padding-bottom: 120rpx;
background-color: #f1f1f3;
border-radius: 12rpx;
.card {
padding: 12rpx;
margin-bottom: 24rpx;
box-sizing: border-box;
background-color: #ffffff;
border-radius: 12rpx;
.top {
height: 60rpx;
padding: 0 12rpx;
padding-bottom: 8rpx;
box-sizing: border-box;
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid #d8dadf;
.top-r {
display: flex;
justify-content: space-between;
align-items: center;
padding-right: 12rpx;
.total-quantity {
margin-right: 12rpx;
}
}
}
.bottom {
padding: 12rpx;
box-sizing: border-box;
.content {
padding: 24rpx 12rpx;
margin-bottom: 16rpx;
display: flex;
justify-content: space-between;
font-size: 28rpx;
background-color: #f1f1f3;
border: 1px solid #d8dadf;
border-radius: 12rpx;
box-sizing: border-box;
.left {
.text {
font-size: 28rpx;
}
}
.right {
display: flex;
justify-content: flex-end;
.text {
margin-right: 12rpx;
font-size: 28rpx;
}
}
}
}
}
}
}
.footer {
position: fixed;
bottom: 0;
width: 100%;
height: 120rpx;
padding: 24rpx;
background-color: #ffffff;
.sumbit-btn {
width: 300rpx;
}
}
}
</style>
\ No newline at end of file
<template>
<view class="card">
<view class="top">
<view>{{$t('库房/储位')}}{{`${info.ml002}|${info.ml003}`}}</view>
<view class="top-r">
<view class="inventory-data">
{{$t('库存数')}} {{info.ml005}}
</view>
<u-icon v-if="i == 0" name="plus" size="36" @click="handleAdd"></u-icon>
<u-icon v-else name="minus" size="36" @click="handleDel"></u-icon>
</view>
</view>
<uni-forms :modelValue="info" :label-width="90" label-align="right">
<uni-forms-item :label="`${$t('调拨数')}:`">
<uni-easyinput v-model="info.allocateQuantity" type="number" trim="all"
:placeholder="$t('请输入调拨数')" @change="handleChangeNum" />
</uni-forms-item>
<uni-forms-item :label="`${$t('调入仓库')}:`">
<uni-data-select v-model="info.allocateWarehouse" :localdata="warehouseRange"
@change="handleChange"></uni-data-select>
</uni-forms-item>
<uni-forms-item :label="`${$t('调入储位')}:`">
<uni-data-select v-model="info.allocateLocation" :localdata="storageRange"></uni-data-select>
</uni-forms-item>
</uni-forms>
</view>
</template>
<script>
import i18n from '@/lang/index';
export default {
props: {
info: {
type: Object,
default: () => {}
},
i: {
type: Number,
default: 0
}
},
data() {
return {
warehouseRange: [],
storageRange: [],
}
},
created() {
this.getWarehouseList();
if(this.info.allocateWarehouse) {
this.getStorageList();
}
},
methods: {
getWarehouseList() {
this.$u.api.getWarehouseListApi({})
.then(res => {
this.warehouseRange = res.data.map((item) => {
return {
...item,
value: item.mc001,
text: item.mc002,
}
})
})
},
getStorageList() {
const params = {
ni001: this.info.allocateWarehouse
}
this.$u.api.getStorageListApi(params)
.then(res => {
this.storageRange = res.data.map((item) => {
return {
...item,
value: item.ni002,
text: item.ni003,
}
})
})
},
handleAdd() {
this.$emit('handleAdd');
},
handleDel() {
this.$emit('handleDel', this.i);
},
handleChangeNum(e) {
if (e > this.info.ml005) {
this.$u.toast(i18n.t('调拨数不能大于库存数'));
}
},
handleChange() {
this.getStorageList();
},
}
}
</script>
<style lang="scss" scoped>
.card {
padding: 24rpx 12rpx 12rpx;
margin-bottom: 24rpx;
box-sizing: border-box;
background-color: #ffffff;
border: 1px solid #d8dadf;
border-radius: 12rpx;
.top {
display: flex;
justify-content: space-between;
align-items: center;
padding-left: 24rpx;
.top-r {
display: flex;
justify-content: space-between;
align-items: center;
.inventory-data {
padding-right: 24rpx;
}
}
}
/deep/.uni-forms {
.uni-forms-item {
margin: 24rpx;
.uni-forms-item__label {
font-size: 28rpx;
}
}
}
}
</style>
\ No newline at end of file
<template>
<view class="stock-transfer-page">
<NavBar :title="$t('库存调拨')"></NavBar>
<view class="container">
<view class="search-area">
<uni-easyinput v-model="value" prefixIcon="search" :placeholder="$t('请输入调拨产品号')" trim="all" />
<button class="search-btn" :loading="loadings" @click="handleSearch">{{$t('确认')}}</button>
</view>
<view class="sub-title">
{{$t('调拨明细')}}
</view>
<view class="detail">
<view class="card" v-for="(item, index) in list" :key="index" @click="handleDetail(item, index)">
<view class="top">
<view class="product-number">
{{`${item[0].ml001}${item[0].materialName}`|}}
</view>
<view class="top-r">
<view class="total-quantity">
{{item[0].ml005}}ps
</view>
<u-icon name="minus" size="32" @click.native.stop="handleDelete(item, index)"></u-icon>
</view>
</view>
<view class="bottom">
<view class="content" v-for="(ele, idx) in item" :key="idx">
<view class="left">
<view class="text current-storage">
{{$t('当前储位')}}{{`${ele.ml002}|${ele.ml003}`}}
</view>
<view class="text transfer-storage">
{{$t('调入储位')}}
{{ele.allocateLocation ? `${ele.allocateWarehouse}|${ele.allocateLocation}`: ''}}
</view>
</view>
<view class="right">
{{ele.allocateQuantity ? ele.allocateQuantity : 0}}ps
</view>
</view>
</view>
</view>
</view>
</view>
<view class="footer">
<button class="sumbit-btn" :loading="loading" @click="handleSumbit">{{$t('调拨确认')}}</button>
</view>
</view>
</template>
<script>
import i18n from '@/lang/index';
export default {
data() {
return {
loading: false,
loadings: false,
value: "",
list: [],
numList: [],
}
},
methods: {
getValue(data) {
const index = this.numList.findIndex((item) => {
return item == data[0]['ml001'].trim();
})
this.list.splice(index, 1, data);
},
handleSearch() {
if (this.loadings) {
return this.$u.toast(i18n.t('请勿重复提交'))
}
this.loadings = true;
if (this.numList.includes(this.value)) {
this.$u.toast(i18n.t('该调拨产品号数据已存在'));
setTimeout(() => {
this.value = "";
}, 1000);
return;
}
const params = {
ml001: this.value
}
this.$u.api.getforinvmlinfoApi(params)
.then(res => {
this.loadings = false;
if (res.data.length > 0) {
this.list.push(res.data);
this.numList.push(this.value);
setTimeout(() => {
this.value = "";
}, 1000);
} else {
this.$u.toast(i18n.t('请求参数有误'));
}
})
},
handleDetail(row, index) {
uni.navigateTo({
url: '/pages/stockTransfer/select?info=' + encodeURIComponent(JSON.stringify(row))
});
},
handleDelete(row, index) {
this.list.splice(index, 1);
this.numList.splice(index, 1);
},
handleSumbit() {
if (this.loading) {
return this.$u.toast(i18n.t('请勿重复提交'));
}
if (this.list.length == 0) {
return this.$u.toast(i18n.t('提交数据不能为空'));
}
let flag = false;
for (let i = 0; i < this.list.length; i++) {
for (let v = 0; v < this.list[i].length; v++) {
if (!this.list[i][v]['allocateQuantity']) {
this.$u.toast(i18n.t('调拨数不能为空'));
flag = true;
break;
}
if (!this.list[i][v]['allocateWarehouse']) {
this.$u.toast(i18n.t('调入库存不能为空'));
flag = true;
break;
}
if (!this.list[i][v]['allocateLocation']) {
this.$u.toast(i18n.t('调入储位不能为空'));
flag = true;
break;
}
}
}
if (flag) {
return;
}
const params = this.list.map((item) => {
return item.map((ele) => {
return {
allocateLocation: ele.allocateLocation,
allocateQuantity: ele.allocateQuantity,
allocateWarehouse: ele.allocateWarehouse,
location: ele.ml003,
materialNo: ele.ml001,
warehouse: ele.ml002,
materialName: ele.materialName
}
})
}).flat(Infinity);
this.loading = true;
this.$u.api.transferConfirmApi({
data: params
})
.then(res => {
this.loading = false;
if (res.success) {
this.$u.toast(i18n.t('提交成功'));
setTimeout(() => {
this.$router.go(0);
}, 3000);
} else {
this.$u.toast(i18n.t('提交失败'));
}
})
}
}
}
</script>
<style lang="scss" scoped>
.stock-transfer-page {
width: 100%;
height: 100%;
background-color: #ffffff;
.container {
.search-area {
display: flex;
justify-content: space-between;
align-content: center;
padding: 24rpx;
/deep/.uni-easyinput {
height: 60rpx;
.uni-easyinput__content {
height: 100%;
border-radius: 36rpx;
}
}
.search-btn {
height: 60rpx;
line-height: 60rpx;
margin-left: 12rpx;
}
}
.sub-title {
font-size: 32rpx;
font-weight: bolder;
padding-left: 24rpx;
}
.detail {
width: calc(100% - 40rpx);
margin: 20rpx;
padding: 20rpx;
padding-bottom: 120rpx;
background-color: #f1f1f3;
border-radius: 12rpx;
.card {
padding: 12rpx;
margin-bottom: 24rpx;
box-sizing: border-box;
background-color: #ffffff;
border-radius: 12rpx;
.top {
height: 60rpx;
padding: 0 12rpx;
padding-bottom: 8rpx;
box-sizing: border-box;
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid #d8dadf;
.top-r {
display: flex;
justify-content: space-between;
align-items: center;
padding-right: 12rpx;
.total-quantity {
margin-right: 12rpx;
}
}
}
.bottom {
padding: 12rpx;
box-sizing: border-box;
.content {
padding: 24rpx 12rpx;
margin-bottom: 16rpx;
display: flex;
justify-content: space-between;
font-size: 28rpx;
background-color: #f1f1f3;
border: 1px solid #d8dadf;
border-radius: 12rpx;
box-sizing: border-box;
.left {
.text {
font-size: 28rpx;
}
}
.right {
padding-right: 28rpx;
}
}
}
}
}
}
.footer {
position: fixed;
bottom: 0;
width: 100%;
height: 120rpx;
padding: 24rpx;
background-color: #ffffff;
.sumbit-btn {
width: 300rpx;
}
}
}
</style>
\ No newline at end of file
<template>
<view class="stock-transfer-select-page">
<NavBar :title="$t('库存调拨选择')"></NavBar>
<view class="container">
<view class="title">
{{info[0].ml001}}|{{info[0].materialName}}
</view>
<view class="detail">
<Card v-for="(item, index) in info" :key="index" :info="item" :i="index" @handleAdd="handleAdd"
@handleDel="handleDel" />
</view>
</view>
<view class="footer">
<button class="sumbit-btn" @click="handleSubmit">{{$t('确认')}}</button>
</view>
</view>
</template>
<script>
import i18n from '@/lang/index';
import Card from "./components/card.vue";
export default {
components: {
Card,
},
data() {
return {
info: []
}
},
onLoad(option) {
if (option.info) {
this.info = JSON.parse(decodeURIComponent(option.info));
}
},
methods: {
handleAdd() {
this.info.push({
...this.info[0],
allocateQuantity: "",
allocateWarehouse: "",
allocateLocation: ""
});
},
handleDel(index) {
this.info.splice(index, 1);
},
handleSubmit() {
const num = this.info.reduce((pre, cur) => {
return pre + Number(cur.allocateQuantity);
}, 0);
if (num > this.info[0].ml005) {
return this.$u.toast(i18n.t('调拨总数不能大于库存数'));
};
let pages = getCurrentPages();
// 2. 上一页面实例
// 注意是length长度,所以要想得到上一页面的实例需要 -2
// 若要返回上上页面的实例就 -3,以此类推
let prevPage = pages[pages.length - 2];
// 3. 给上一页面实例绑定getValue()方法和参数(注意是$vm)
prevPage.$vm.getValue(this.info);
// 4. 返回上一页面
uni.navigateBack({
delta: 1 // 返回的页面数
});
}
}
}
</script>
<style lang="scss" scoped>
.stock-transfer-select-page {
.container {
.title {
font-size: 32rpx;
padding: 32rpx 36rpx 12rpx;
font-weight: bold;
}
.detail {
width: calc(100% - 40rpx);
margin: 20rpx;
padding: 20rpx;
padding-bottom: 120rpx;
background-color: #f1f1f3;
border: 1px solid #d8dadf;
border-radius: 12rpx;
}
}
.footer {
position: fixed;
bottom: 0;
width: 100%;
height: 120rpx;
padding: 24rpx;
background-color: #ffffff;
.sumbit-btn {
width: 300rpx;
}
}
}
</style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment