Files
hht-hdyy-uni/pages/hdyy/wbc/wbc-return.vue

273 lines
6.2 KiB
Vue
Raw Normal View History

2025-12-31 14:32:55 +08:00
<template>
<view class="zd_container">
<!-- 外包材还回 -->
<nav-bar :title="title"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper">
<view class="zd-row border-bottom">
<view class="zd-col-6">
<span class="filter_label">点位</span>
</view>
<view class="zd-col-18">
<search-box v-model="val1"/>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-6">
<span class="filter_label">物料编码</span>
</view>
<view class="zd-col-13">
<search-box v-model="materialData.material_code"/>
</view>
<button class="mini-btn" type="primary" @tap="toJump('material?title=物料维护')">查询</button>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-6">
<span class="filter_label filter_input_disabled">物料名称</span>
</view>
<view class="zd-col-18">
<input type="text" class="filter_input filter_input_disabled" v-model="materialData.material_name" disabled>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-6">
<span class="filter_label filter_input_disabled">物料类别</span>
</view>
<view class="zd-col-18">
<input type="text" v-model="materialData.class_name" class="filter_input filter_input_disabled" disabled>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-6">
<span class="filter_label">批号</span>
</view>
<view class="zd-col-18">
<input type="text" v-model="pcsn" class="filter_input">
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-6">
<span class="filter_label">数量</span>
</view>
<view class="zd-col-18">
<input type="number" v-model="num" class="filter_input">
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-6">
<span class="filter_label">计量单位</span>
</view>
<view class="zd-col-18">
<input type="text" class="filter_input" v-model="unit">
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-6">
<span class="filter_label">备注</span>
</view>
<view class="zd-col-18">
<input type="text" class="filter_input" v-model="mark">
</view>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-5 button-default" @tap="toEmpty">清空</button>
2026-04-03 10:44:35 +08:00
<button class="zd-col-18 button-primary" :class="{'button-info': !val1 || JSON.stringify(materialData) === '{}'}" :disabled="disabled" @tap="handleSubmit">确认还回</button>
2025-12-31 14:32:55 +08:00
</view>
2026-04-03 10:44:35 +08:00
<!-- 放置弹窗组件 -->
<CredentialPopup ref="credentialPopup" />
2025-12-31 14:32:55 +08:00
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {packConfirmReturn} from '@/utils/getData3.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
title: '',
val1: '',
materialData: {},
num: '',
unit: 'KG',
mark: '',
disabled: false,
pcsn: ''
};
},
onLoad (options) {
this.title = options.title
},
onShow () {
if (this.$store.getters.publicObj !== '') {
this.materialData = this.$store.getters.publicObj
this.$store.dispatch('setPublicObj', '')
}
},
methods: {
2026-04-03 10:44:35 +08:00
async handleSubmit() {
if (!this.val1 || JSON.stringify(this.materialData) === '{}') {
this.disabled = false
return
}
try {
// 显示弹窗,等待用户输入
const { username, password } = await this.$refs.credentialPopup.show();
// 调用原接口,传入账号密码
this._packConfirmReturn(username, password);
} catch (error) {
// 用户取消,不做处理
console.log('用户取消输入');
}
},
2025-12-31 14:32:55 +08:00
toJump (name) {
uni.navigateTo({
url: `/pages/hdyy/wbc/${name}`
})
},
toEmpty () {
this.val1 = ''
this.index1 = ''
this.materialData = {}
this.pcsn = ''
this.num = ''
this.unit = 'KG'
this.mark = ''
this.disabled = false
},
2026-04-03 10:44:35 +08:00
async _packConfirmReturn (username, password) {
2025-12-31 14:32:55 +08:00
this.disabled = true
try {
2026-04-03 10:44:35 +08:00
let res = await packConfirmReturn(username, password, this.val1, this.materialData.material_id, this.materialData.material_code, this.materialData.material_name, this.pcsn, this.num, this.mark)
2025-12-31 14:32:55 +08:00
if (res) {
uni.showToast({
title: res.message,
icon: 'none'
})
}
this.toEmpty()
this.disabled = false
} catch (e) {
this.disabled = false
}
}
}
}
</script>
<style lang="stylus">
.input-container {
background-color: #fff;
border-radius: 16rpx;
padding: 30rpx;
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.05);
margin-bottom: 40rpx;
}
.input-wrapper {
position: relative;
display: flex;
align-items: center;
// border: 2rpx solid #e0e0e0;
border-radius: 12rpx;
overflow: hidden;
transition: border-color 0.3s;
}
.input-wrapper:focus-within {
border-color: #007AFF;
}
.input-field {
flex: 1;
height: 80rpx;
// padding: 0 24rpx;
font-size: 28rpx;
color: #333;
}
.placeholder {
color: #999;
font-size: 28rpx;
}
.picker {
width: 80rpx;
height: 80rpx;
display: flex;
align-items: center;
justify-content: center;
background-color: #f8f8f8;
border-left: 2rpx solid #e0e0e0;
}
.picker-trigger {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.picker-text {
font-size: 24rpx;
color: #666;
}
.custom-dialog-mask {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.5);
display: flex;
align-items: center;
justify-content: center;
z-index: 999;
}
.custom-dialog {
width: 600rpx;
background: #fff;
border-radius: 16rpx;
overflow: hidden;
}
.dialog-title {
padding: 30rpx;
font-size: 32rpx;
text-align: center;
border-bottom: 1rpx solid #eee;
}
.dialog-body {
padding: 40rpx;
}
.dialog-input {
width: 100%;
height: 80rpx;
border: 1rpx solid #ddd;
border-radius: 8rpx;
padding: 0 20rpx;
text-align: center;
}
.dialog-footer {
display: flex;
border-top: 1rpx solid #eee;
}
.dialog-footer button {
flex: 1;
border-radius: 0;
margin: 0;
}
</style>