You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

537 lines
18 KiB

<template>
<view>
<!-- 自定义导航栏 -->
<u-navbar bgColor="#ffffff" :placeholder="true" :autoBack="true" titleStyle="font-weight:600">
<!-- @click="popCheBian()" -->
<view slot="center" style="display: flex;align-items: center;">
<span style="font-size: 32rpx; font-weight: 600;color: #333333;margin-right: 10rpx;">{{ changku }}</span>
<!-- <image style="width: 32rpx; height: 32rpx;" src="../../../../static/images/wuzhi/zhuanhuan.png"></image> -->
</view>
</u-navbar>
<view class="paibanBox">
<view class="paiban">
<!-- 头部 -->
<view class="head">
<view class="headTime">入库仓库: {{ changku }}</view>
</view>
<!-- 卡片 -->
<view class="paibanInfo">
<view style="position: relative;">
<image style="width: 132rpx; height: 132rpx;position: absolute;top: 2rpx;right: 15rpx;" src="../../../../static/images/wuzhi/rukutupian.png"></image>
<span style="font-weight: 600;font-size: 31rpx;display: flex;margin-bottom: 30rpx;">
部门名称:
<p style="margin-left: 25rpx;">{{ deptName }}</p>
</span>
<span style="font-weight: 600;font-size: 31rpx;margin-bottom: 20rpx;">
入库说明:
<u--textarea autoHeight style="margin-top: 30rpx;" v-model="ruKuexplain" placeholder="请输入入库说明......"></u--textarea>
</span>
<span v-if="ruKuDanHao !== ''" style="font-weight: 600;font-size: 31rpx;display: flex;margin-top: 10rpx;">
入库批次:
<p style="margin-left: 25rpx;">{{ ruKuDanHao }}</p>
</span>
</view>
</view>
</view>
</view>
<!-- <view style="display: flex;align-items: center; justify-content: space-between;padding: 0rpx 30rpx;">
<view style="display: flex;align-items: center;">
<image style="width: 56rpx; height: 56rpx;" src="../../../../static/images/wuzhi/rukuliebiao.png"></image>
<span style="font-weight: 600;font-size: 31rpx;margin-left: 25rpx;">入库列表</span>
</view>
<u-button style="width: 160rpx;margin: 0rpx;" shape="circle" type="primary" size="mini" icon="plus" :plain="true" text="" @click="openRuKuDialog">入库物资</u-button>
</view> -->
<!-- 入库列表 -->
<view class="paibanBox">
<view class="paiban" style="padding:0rpx ;">
<!-- 头部 -->
<view class="head" style="background: #4679FE;border-radius:20rpx 20rpx 0rpx 0rpx;height: 80rpx;">
<!-- <view style="display: flex;align-items: center; justify-content: space-between;padding: 0rpx 30rpx;"> -->
<view style="display: flex;align-items: center;margin-left: 20rpx;margin-top: 10rpx;">
<image style="width: 56rpx; height: 56rpx;" src="../../../../static/images/wuzhi/rukuliebiao.png"></image>
<span style="font-weight: 600;font-size: 33rpx;margin-left: 25rpx;color: #FFFFFF;">入库物资列表</span>
</view>
<u-button
style="width: 160rpx;margin-right: 20rpx;margin-top: 10rpx;"
shape="circle"
type="primary"
size="mini"
icon="plus"
:plain="true"
text=""
@click="openRuKuDialog"
>
入库物资
</u-button>
<!-- </view> -->
<!-- <view class="headTime" style="color: #FFFFFF;text-align: center;margin-left: 18rpx;font-size: 33rpx;">入库物资</view> -->
</view>
<scroll-view scroll-y="true" style="height: 800rpx;" scroll-with-animation="true">
<view
style="display: flex;width: 100%; margin-top: 10rpx; align-items: center;
justify-content: space-between;padding: 12rpx;border-bottom: 1rpx solid #EFEFEF;"
v-for="(item, index) in addWzParams.inOrOutDelList"
>
<u-album
singleSize="72"
multipleMode="scaleToFill"
singleMode="scaleToFill"
multipleSize="72"
rowCount="1"
style="width: 145rpx;height: 145rpx;border: 1px solid #EFEFEF;background-color:#EFEFEF ;"
:urls="item.showUrls == null ? [] : item.showUrls"
maxCount="1"
></u-album>
<view style=" width: 75%;display: flex; flex-direction: column;justify-content: space-between; align-items: flex-start;margin-left: 10rpx;">
<view style="display: flex;justify-content: space-between;width: 100%;">
<span style="font-weight: 600;font-size: 26rpx;width: 100%;margin-bottom: 10rpx;">{{ item.materialName }} ({{ item.materialUnit }})</span>
<u-icon name="trash-fill" @click="delWz(index)" color="#d64964" size="22"></u-icon>
</view>
<span style="font-size: 24rpx;font-weight: 600;color: #999999;margin-bottom: 10rpx;">{{ item.materialCategory }}</span>
<view style="display: flex;align-items: center;width: 100%;justify-content: space-between;">
<span style="font-size: 24rpx;color: #0c0c0c;margin-bottom: 10rpx;margin-right: 20rpx;">
{{ item.materialSpecification == null ? '暂无规格' : item.materialSpecification }}
</span>
<u-number-box style="margin-right: 15rpx;" v-model="item.realNum" inputWidth="60" buttonSize="25"></u-number-box>
</view>
</view>
</view>
</scroll-view>
<!-- 卡片 -->
</view>
</view>
<view class="paibanBox">
<!-- 头部 -->
<view
class="head"
style="background: rgb(70, 121, 254);color: rgb(255, 255, 255);margin-left: 18rpx;font-size: 34rpx;text-align: center;border-radius: 36rpx;height: 81rpx;display: flex; flex-direction: column; align-items: center; justify-content: center;"
@click="rukuSumbit"
>
入库
</view>
</view>
<!-- 侧边栏弹窗 -->
<u-popup :show="wuzhiCheBian" mode="left" :customStyle="{ width: '70vw' }" :safeAreaInsetBottom="true" @close="offPop()">
<view style="height: 50px;margin-bottom: 10rpx;"></view>
<u-search placeholder="请输入仓库名称搜索" v-model="keyword" :clearabled="false" :showAction="false"></u-search>
<scroll-view scroll-y="true" style="height: 95vh;" scroll-with-animation="true">
<view class="status_bar"></view>
<uni-list>
<uni-list-item v-for="(item, index) in titlelist" :title="`${index + 1}.${item.name}`" :clickable="true" @click="xuanZheChangKu(item)"></uni-list-item>
</uni-list>
<view style="height: 50px;"></view>
</scroll-view>
</u-popup>
<!-- 入库物资下弹框 -->
<u-popup :show="RukuDialogshow" :round="10" mode="bottom" @close="closeRuKuDialog" @open="RuKuDialogOpened">
<view class="bottomPopup">
<view class="">
<u--input
v-model="listDictionaryParams.materialName"
@change="getKuCun"
placeholder="请输入您要查找的物资名称"
prefixIcon="search"
prefixIconStyle="font-size: 22px;color: #909399"
shape="circle"
></u--input>
</view>
<view class=""><u-tabs :list="tabsList" @click="tabsClick" keyName="categoryName"></u-tabs></view>
<view class="">
<scroll-view scroll-y="true" style="height: 700rpx;" scroll-with-animation="true">
<view
style="display: flex;width: 100%; margin-top: 15rpx;padding-bottom: 15rpx; align-items: center;justify-content: space-between;padding: 12rpx;"
v-for="item in kucunlist"
:key="item.id"
>
<u-album
singleSize="72"
multipleMode="scaleToFill"
singleMode="scaleToFill"
multipleSize="72"
rowCount="1"
style="width: 145rpx;height: 145rpx;border: 1px solid #EFEFEF;background-color:#EFEFEF ;"
:urls="item.showUrls == null ? [] : item.showUrls"
maxCount="1"
></u-album>
<view style=" width: 75%;display: flex; flex-direction: column;justify-content: space-between; align-items: flex-start;margin-left: 10rpx;">
<view style="display: flex;justify-content: space-between;width: 100%;">
<span style="font-weight: 600;font-size: 26rpx;width: 100%;margin-bottom: 10rpx;">{{ item.materialName }} ({{ item.materialUnit }})</span>
</view>
<span style="font-size: 24rpx;font-weight: 600;color: #999999;margin-bottom: 10rpx;">{{ item.materialCategory }}</span>
<view style="display: flex;align-items: center;width: 100%;justify-content: space-between;">
<span style="font-size: 24rpx;color: #0c0c0c;margin-bottom: 10rpx;margin-right: 20rpx;">
{{ item.materialSpecification == null ? '暂无规格' : item.materialSpecification }}
</span>
<u-button type="primary" size="mini" style="margin-right: 15rpx;width: 100rpx;" text="选择" @click="SelectRuKuShowPopup(item)"></u-button>
</view>
</view>
</view>
</scroll-view>
</view>
<view class="RuKuPagination">
<uni-pagination
@change="paginationChange"
:show-icon="true"
:pageSize="listDictionaryParams.pageSize"
:current="listDictionaryParams.pageNum"
:total="total"
title="标题文字"
/>
</view>
</view>
</u-popup>
<u-popup overlayOpacit="1" style="width: 300rpx;" mode="center" :round="10" :show="SelectRuKuNumShow" @close="SelectRuKuclose" @open="SelectRuKuopen">
<view
style="display: flex; width: 90vw;height: 260rpx; margin-top: 15rpx;padding-bottom: 15rpx; align-items: center;
justify-content: space-between;padding: 12rpx; "
>
<u-album
singleSize="72"
multipleMode="scaleToFill"
singleMode="scaleToFill"
multipleSize="72"
rowCount="1"
style="width: 145rpx;height: 145rpx;border: 1px solid #EFEFEF;background-color:#EFEFEF ;"
:urls="operationWZ.showUrls == null ? [] : operationWZ.showUrls"
maxCount="1"
></u-album>
<view style=" width: 75%;display: flex; flex-direction: column;justify-content: space-between; align-items: flex-start;margin-left: 10rpx;">
<view style="display: flex;justify-content: space-between;width: 100%;">
<span style="font-weight: 600;font-size: 26rpx;width: 100%;margin-bottom: 10rpx;">{{ operationWZ.materialName }} ({{ operationWZ.materialUnit }})</span>
</view>
<span style="font-size: 24rpx;font-weight: 600;color: #999999;margin-bottom: 10rpx;">{{ operationWZ.materialCategory }}</span>
<view style="display: flex;align-operationWZs: center;width: 100%;justify-content: space-between;">
<span style="font-size: 24rpx;color: #0c0c0c;margin-bottom: 10rpx;margin-right: 20rpx;">
{{ operationWZ.materialSpecification == null ? '暂无规格' : operationWZ.materialSpecification }}
</span>
<view style="display: flex;flex-direction: column;">
<view class=""><u-number-box style="margin-right: 15rpx;" v-model="SelectWzNum" inputWidth="60" buttonSize="25"></u-number-box></view>
<view class=""><u-datetime-picker :show="YxSelectDate" v-model="Yxdate" mode="date"></u-datetime-picker></view>
</view>
</view>
</view>
<!-- <view style=" width: 75%;display: flex;flex-direction: column;justify-content: space-between; align-items: flex-start;margin-left: 10rpx;">
<span style="font-weight: 600;font-size: 28rpx;width: 100%;margin-bottom: 10rpx;">{{ operationWZ.materialName }}</span>
<span style="font-size: 28rpx;color: #999999;margin-bottom: 10rpx;">{{ operationWZ.materialCategory }}</span>
<span style="font-size: 29rpx;color: #999999;margin-bottom: 10rpx;margin-right: 20rpx;">{{ operationWZ.batch }}</span>
<view style="display: flex;flex-direction: column;">
<view class=""><u-number-box style="margin-right: 15rpx;" v-model="SelectWzNum" inputWidth="60" buttonSize="25"></u-number-box></view>
<view class=""><u-datetime-picker :show="YxSelectDate" v-model="Yxdate" mode="date"></u-datetime-picker></view>
</view>
</view> -->
</view>
<view class="confirmBtn">
<u-button style="width: 100rpx;height: 60rpx;" type="primary" text="暂存" @click="SelectRuKuNumConfirm(operationWZ)"></u-button>
<!-- <u-button text="取消" @click="SelectRuKuNumCancel"></u-button> -->
</view>
</u-popup>
</view>
</template>
<script>
//查询仓库列表
import { listWarehouse, listCategory } from '@/api/indexpage/yjWz/warehouse.js';
//查询库存物资
import { listStock, getStock } from '@/api/indexpage/yjWz/kuCun.js';
import { listDictionary, getCategory, addWz } from '@/api/indexpage/yjWz/wzRuKu.js';
import { getUserProfile } from '@/api/indexpage/user.js';
export default {
data() {
return {
ruKuDanHao: '', //使用公共变量存储单号
ruKuexplain: '', //入库说明
SelectWzNum: '1', //入库说明 步进器
timer: '', //防抖函数
keyword: '',
changku: '仓库名称', // 仓库名称
changkuId: '', //仓库ID
wuzhiCheBian: false, //物资侧边栏
titlelist: [], //场库列表
RukuDialogshow: false, //入库弹框
tabsList: [],
kucunlist: [],
SelectRuKuShow: false,
SelectRuKuNumShow: false,
listDictionaryParams: {
pageNum: 1,
pageSize: 5,
materialName: '',
categoryId: ''
},
operationWZ: {},
AddWzList: [],
userInfo: {},
ruKuitemDeptId: '',
addWzParams: {
inOrOutDelList: [],
waterNum: ''
},
Yxdate: '',
YxSelectDate: false,
deptName: '',
total: 0
};
},
onLoad(options) {
//获取场库id和名字
let name = options.ckName;
let id = options.ckId;
this.deptName = options.deptName;
this.changku = name;
this.changkuId = id;
this.getListCategory();
this.getUserProfileList();
},
// watch: {
// keyword(newdata, olddata) {
// let that = this;
// //防抖函数
// clearTimeout(that.timer);
// that.timer = setTimeout(function() {
// if (newdata === '') {
// //发场库请求
// listWarehouse().then(res => {
// that.titlelist = res.rows;
// });
// } else {
// //发场库请求
// listWarehouse({
// name: newdata
// }).then(res => {
// that.titlelist = res.rows;
// });
// }
// }, 600);
// }
// },
methods: {
// 获取用户信息
getUserProfileList() {
getUserProfile().then(res => {
this.userInfo = res.data.user;
});
},
paginationChange(e) {
this.listDictionaryParams.pageNum = e.current;
this.getKuCun();
console.log(e, 'eeeee');
},
SelectRuKuShowPopup(item) {
this.operationWZ = item;
this.RukuDialogshow = false;
this.SelectRuKuNumShow = true;
},
delWz(indexToDelete) {
this.addWzParams.inOrOutDelList.splice(indexToDelete, 1);
},
SelectRuKuopen() {
// console.log('open');
},
SelectRuKuclose() {
this.SelectRuKuNumShow = false;
this.RukuDialogshow = true;
// console.log('close');
},
SelectRuKuNumCancel() {
this.SelectRuKuNumShow = false;
},
SelectRuKuNumConfirm(operationWZ) {
delete operationWZ.id;
console.log(operationWZ, 'operationWZoperationWZoperationWZ');
//单号只获取一次
if (this.addWzParams.inOrOutDelList.length == '0') {
//使用公共变量存储单号
this.ruKuDanHao = this.danhao();
operationWZ.inOutDbId = this.ruKuDanHao;
} else {
operationWZ.inOutDbId = this.ruKuDanHao;
}
operationWZ.realNum = this.SelectWzNum;
operationWZ.status = '1';
operationWZ.type = '1';
//携带场库
operationWZ.houseId = this.changkuId;
//规格赋值
operationWZ.text1 = operationWZ.materialSpecification;
this.addWzParams.inOrOutDelList.push(operationWZ);
this.addWzParams.djUserId = this.userInfo.userId;
this.addWzParams.djUserName = this.userInfo.userName;
this.addWzParams.status = '1';
// console.log(this.SelectWzNum, operationWZ, "operationWZoperationWZoperationWZ")
this.SelectRuKuNumShow = false;
this.RukuDialogshow = true;
},
rukuSumbit() {
if (this.addWzParams.inOrOutDelList.length == '0') {
this.$modal.msg('请选择物资');
return;
}
//入库说明
this.addWzParams.reason = this.ruKuexplain;
//单号赋值
this.addWzParams.waterNum = this.ruKuDanHao;
//入库场库$("#id")
this.addWzParams.houseId = this.changkuId;
addWz(this.addWzParams).then(res => {
this.addWzParams = {
inOrOutDelList: [],
waterNum: ''
};
this.ruKuexplain = '';
this.$modal.msg('入库成功');
});
},
danhao() {
const now = new Date();
const formattedDate = `R-${now.getFullYear()}-${(now.getMonth() + 1).toString().padStart(2, '0')}-${now
.getDate()
.toString()
.padStart(2, '0')}-${now
.getHours()
.toString()
.padStart(2, '0')}${now
.getMinutes()
.toString()
.padStart(2, '0')}${now
.getSeconds()
.toString()
.padStart(2, '0')}`;
return formattedDate;
},
getListCategory() {
listCategory()
.then(res => {
this.tabsList = res.rows;
//默认第一个
this.listDictionaryParams.categoryId = res.rows[0].id;
//获取库存
this.getKuCun();
})
.catch(error => {
console.error(error);
});
},
openRuKuDialog() {
this.RukuDialogshow = true;
},
closeRuKuDialog() {
this.RukuDialogshow = false;
},
RuKuDialogOpened() {},
tabsClick(item) {
this.listDictionaryParams.pageNum = 1;
// this.ruKuitemDeptId = item.id;
this.listDictionaryParams.categoryId = item.id;
this.getKuCun();
},
// getStockById(id) {
// getStock(id).then(res => {
// this.kucunSigle = res.data;
// });
// },
getKuCun() {
listDictionary(this.listDictionaryParams).then(res => {
this.kucunlist = res.rows;
this.total = res.total;
});
},
//弹出侧边栏
popCheBian() {
//弹出侧边栏
this.wuzhiCheBian = true;
},
offPop() {
//弹出侧边栏
this.wuzhiCheBian = false;
//清空搜索
this.keyword = '';
},
xuanZheChangKu(item) {
//给入库接口入参
this.addWzParams.deptId = item.deptId;
this.addWzParams.houseId = item.id;
// 部门名称
this.deptName = item.deptName;
// 获取仓库名称
this.name = item.name;
//获取仓库名称和ID
this.changku = item.name;
this.changkuId = item.id;
this.getKuCun();
//弹出侧边栏
this.wuzhiCheBian = false;
//清空搜索
this.keyword = '';
}
}
};
</script>
<style scoped lang="scss">
.confirmBtn {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
margin-bottom: 50rpx;
}
.bottomPopup {
padding: 20px;
}
.RuKuPagination {
margin: 10px 0 20rpx 0;
}
page {
.paibanBox {
width: 100vw;
padding: 20rpx 30rpx;
.paiban {
width: 100%;
height: 100%;
background-color: #fff;
border-radius: 12rpx;
box-shadow: 0px 4rpx 12rpx 0px rgba(0, 37, 105, 0.1);
padding: 20rpx;
.head {
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 4rpx solid #f0f1f5;
padding-bottom: 13rpx;
.headTime {
font-weight: bolder;
color: #454545;
font-size: 30rpx;
}
}
.paibanInfo {
padding: 15rpx 0;
overflow: scroll;
height: 90%;
}
}
}
}
</style>