123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263 |
- <!-- 手动入库 -->
- <template>
- <view class="container-wrap">
- <uni-nav-bar title="手动入库" :status-bar="true" background-color="#3F92F9" color="#FFF">
- <view slot="left">
- <u-icon name="account-fill" color="#FFF" size="35"></u-icon>
- <span style="padding: 0 5rpx;color: #FFFFFF;">{{ userInfo.name }}</span>
- </view>
- <view slot="right" @tap="$utils.back()">
- <span style="color: #FFFFFF;">返回</span>
- </view>
- </uni-nav-bar>
- <view class="container">
- <view class="title">
- <span>
- <span style="color: red;">*</span>
- 入库信息
- </span>
- </view>
- <view class="text">
- <view class="label">领料人:</view>
- <select-lay :value="operateUser" placeholder="默认当前用户" :options="userList" @selectitem="selectitem" :zindex="2000"></select-lay>
- </view>
- <view class="text">
- <view class="label">仓库:</view>
- <select-lay :zindex="1000" :value="plcStationCode" :options="selectList" @selectitem="storeSelectitem"></select-lay>
- </view>
- <view class="text">
- <view class="label">入库类型:</view>
- <select-lay :value="stockChangeType" :options="typeList" @selectitem="typeSelectitem"></select-lay>
- </view>
- <view class="text" style="align-items: flex-start;">
- <view class="label">备注:</view>
- <u-input v-model="remark" type="textarea" :border="true" />
- </view>
- <view class="text" style="margin: 20rpx 0 30rpx 0;">
- <view class="label">领料时间:</view>
- <view style="line-height: 1;">{{ time }}</view>
- </view>
- <view class="title flex-between">
- <span>
- <span style="color: red;">*</span>
- 入库列表
- </span>
- <a href="#" @click="scan">+扫描添加</a>
- </view>
- <view class="list">
- <view class="item" v-for="(item, index) in scanList" :key="index">
- <view class="row">
- <view class="col">
- <view class="value">{{ item.materialCode }}</view>
- </view>
- <view class="col">
- <view class="value">{{ item.materialName }}</view>
- </view>
- </view>
- <view class="row sub-row">
- <view class="col">
- <view class="label">规格:</view>
- <view class="value">{{ item.spec }}</view>
- </view>
- <view class="col">
- <view class="label">数量:</view>
- <view class="value">{{ item.quantity }}米</view>
- </view>
- </view>
- </view>
- </view>
- <my-fixed-button :customClick="true" @click="cfm" text="提交"></my-fixed-button>
- </view>
- </view>
- </template>
- <script>
- import DateFormat from '../../../js_sdk/xfl-DateFormat/DateFormat.js';
- import utils from '@/libs/utils/util.js'
- export default {
- data() {
- return {
- timer: null,
- time: new DateFormat(new Date()).toString(),
- show: false,
- operateUser: this.$storage.getStorageSync('userInfo').id,
- plcStationCode: '1',
- stockChangeType: '10',
- remark: '',
- isReading: false,
- scanList: [],
- userList: [],
- selectList: [],
- typeList: [
- { label: '入库', value: 10 },
- { label: '盘点新增', value: 11 },
- { label: '补入库', value: 13 },
- ]
- };
- },
- methods: {
- /* 选择类型 */
- typeSelectitem(index, item) {
- this.stockChangeType = item.value;
- },
- /* 选择领料人 */
- selectitem(index, item) {
- this.operateUser = item.value;
- },
- /* 选择仓库 */
- storeSelectitem(index, item) {
- this.plcStationCode = item.value;
- uni.setStorage({
- key: 'plcStationCode',
- data: item.value
- })
- },
- cfm(){
- let obj = {
- userId: this.operateUser,
- plcCode: this.plcStationCode,
- rfidItems: this.scanList.map(item => item.rfidCode),
- stockChangeType: this.stockChangeType,
- remark: this.remark
- }
- console.log(obj)
- this.$http.HandleMacStockInOut(obj).then(res => {
- console.log(res)
- if(res.code === 0) {
- this.$msg.showToast(res.msg || '操作成功!')
- this.timer = setTimeout(() => {
- this.$utils.back()
- }, 2000)
- }
- })
- },
- /* 扫描添加 */
- scan() {
- this.$utils.open('/pages/store-in-manage/store-in/store-in-scan')
- },
- getList () {
- this.$http.GetApplyStockOutTemp().then(res => {
- console.log(res)
- if(res.code === 0) {
- this.scanList = res.result
- }
- })
- },
- /* 添加扫描到的退货数据 */
- pushData(data) {
- console.log(this.scanList)
- let flag = true
- this.scanList.forEach(item => {
- if(item.rfidCode === data.rfidCode) {
- flag = false
- }
- })
- if(flag) {
- this.scanList.push(data)
- } else {
- setTimeout(() => {
- this.$msg.showToast('标签已存在!')
- }, 100)
- }
- },
- /* 获取用户列表 */
- getUserPageList() {
- this.userList = utils.getUserList(1).map(item => {
- return {
- label: item.name,
- value: item.id
- }
- })
-
- },
- /* 手持机获取仓库 */
- getStockHouse() {
- this.$post('/storage-restructure/stockHouse/page',{
- pageNum:1,
- pageSize:10000,
- }).then(res=>{
- this.selectList = res.data.records.map(item => {
- return {
- label: item.name,
- value: item.id
- }
- })
- })
-
- }
- },
- onLoad(option) {
- this.getUserPageList()
- this.getStockHouse()
- console.log(option)
- uni.$on('scan-list', res => {
- console.log('?????????????')
- console.log(res)
- this.pushData(res)
- })
- uni.getStorage({
- key: 'plcStationCode',
- success: (res) => {
- this.plcStationCode = res.data
- }
- });
- },
- onUnload() {
- clearTimeout(this.timer)
- uni.$off('scan-list')
- }
- }
- </script>
- <style lang="scss" scoped>
- .container-wrap {
- overflow: hidden;
- .container {
- padding: 20rpx;
- height: calc(100vh - var(--status-bar-height) - 44px);
- overflow: auto;
- padding-bottom: 100rpx;
- .text {
- padding: 10rpx 0;
- display: flex;
- align-items: center;
- font-size: 24rpx;
- .label {
- width: 150rpx;
- text-align: right;
- }
- }
- .list {
- margin: 10rpx 0;
- .item {
- padding: 20rpx;
- margin-bottom: 10rpx;
- background-color: #FFFFFF;
- border: 1rpx solid rgba(215, 215, 215, 1);
- border-radius: 10rpx;
- .row {
- &.border {
- border-bottom: 1px solid rgba(215, 215, 215, 1);
- }
- .label {
- width: 80rpx;
- }
- .col {
- &:last-child {
- justify-content: flex-end;
- }
- }
- }
- .sub-row {
- align-items: flex-start;
- .label, .value {
- font-size: 24rpx;
- color: #7F7F7F;
- }
- }
- }
- }
- }
- }
- </style>
|