Commit a3547443 by liangjianmin

feat(tallyReceive): 添加D/C输入框及必填逻辑

- 新增D/C输入框,用户在理货任务中可输入D/C编码
- 更新逻辑,确保在特定条件下D/C为必填项
- 优化样式,提升用户体验和输入框的可用性
parent 6b5d2537
...@@ -641,6 +641,21 @@ ...@@ -641,6 +641,21 @@
} }
} }
.dc-input-box {
width: 100%;
margin-bottom: 20rpx;
.uni-input {
width: 100%;
height: 60rpx;
padding: 0 15rpx;
background: #f5f5f7;
border-radius: 10rpx;
font-size: 18rpx;
box-sizing: border-box;
}
}
.textarea-box { .textarea-box {
width: 100%; width: 100%;
......
...@@ -218,16 +218,13 @@ ...@@ -218,16 +218,13 @@
<text class="tt">个理货任务</text> <text class="tt">个理货任务</text>
</view> </view>
<view class="pack"> <view class="pack">
<view class="h2">容器:</view> <view class="h2" v-if="is_dc_required">
<view class="search-box row bothSide verCenter" :class="{ 'error-style': !is_submit }"> <text>D / C:</text>
<view class="text" style="width: 100rpx;">容 器</view> <text style="color: red;">*</text>
<view class="search-bar row bothSide verCenter" style="width: calc(100% - 100rpx);"> </view>
<view class="row verCenter"> <view class="h2" v-else>D / C:</view>
<text class="iconfont icon-juxing1"></text> <view class="dc-input-box">
<input class="uni-input" placeholder="请输入容器编码" placeholder-style="color:#919399" focus v-model="searchParams.container_name" @input="handleInput(3, $event)" /> <input class="uni-input" :placeholder="is_dc_required ? '请输入D/C,该项必填' : '请输入D/C'" placeholder-style="color:#919399" v-model="formParams.dc_code" />
</view>
<text class="iconfont icon-a-juxing11" @click="clearInput(2)" v-if="input_contaion"></text>
</view>
</view> </view>
<view class="h2 row bothSide verCenter" style="margin-top: 25rpx;"> <view class="h2 row bothSide verCenter" style="margin-top: 25rpx;">
<view> <view>
...@@ -298,6 +295,7 @@ ...@@ -298,6 +295,7 @@
maxNum: 10, //最大上传图片数量 maxNum: 10, //最大上传图片数量
hasMoreData: true, //是否分页加载 hasMoreData: true, //是否分页加载
is_watch: false, //是否看货 is_watch: false, //是否看货
is_dc_required: false, //D/C是否必填
isRequestSent: false, isRequestSent: false,
isStopRequest: false, isStopRequest: false,
apartItem: {}, //拆货任务信息 apartItem: {}, //拆货任务信息
...@@ -315,7 +313,8 @@ ...@@ -315,7 +313,8 @@
container_id: '', container_id: '',
tally_remark: '', tally_remark: '',
image_ids: '', //理货照片集合 image_ids: '', //理货照片集合
is_print: 1 is_print: 1,
dc_code: '' //D/C编码
}, },
fastParams: { fastParams: {
flag: '', flag: '',
...@@ -808,11 +807,12 @@ ...@@ -808,11 +807,12 @@
* 一键理货提交 * 一键理货提交
*/ */
createTallyReceiveSubmit() { createTallyReceiveSubmit() {
// 验证一下容器是否输入正确 // 验证D/C是否必填
if (!this.is_submit) { if (this.is_dc_required && !this.formParams.dc_code) {
uni.showToast({ uni.showToast({
title: '请输入正确容器', title: '该理货任务D/C必填,请输入D/C',
icon: 'error' icon: 'none',
duration: 2500
}); });
return false; return false;
} }
...@@ -826,9 +826,14 @@ ...@@ -826,9 +826,14 @@
return false; return false;
} }
} }
var params = Object.assign(this.formParams, { // 提交参数,排除container_id字段
var params = {
tally_remark: this.formParams.tally_remark,
image_ids: this.formParams.image_ids,
is_print: this.formParams.is_print,
dc_code: this.formParams.dc_code,
stock_in_item_id: this.filter_id.join(',') stock_in_item_id: this.filter_id.join(',')
}); };
this.request(API.createTallyReceive, 'POST', params, true).then(res => { this.request(API.createTallyReceive, 'POST', params, true).then(res => {
if (res.code === 0) { if (res.code === 0) {
uni.showToast({ uni.showToast({
...@@ -881,21 +886,17 @@ ...@@ -881,21 +886,17 @@
return false; return false;
} }
// 检查选中的理货任务是否包含自营商品(新自营stock_type=2),仅针对采购入库类型(stock_in_type=1) // 检查选中的理货任务是否需要必填D/C(采购入库类型stock_in_type=1且满足以下任意条件:新自营stock_type=2、老自营stock_type=3、拆货is_apart=1)
var selfOperatedItem = selectedIndexes.map(i => this.list[i]).find(item => item.stock_in_type == 1 && item.stock_type == 2); var dcRequiredItem = selectedIndexes.map(i => this.list[i]).find(item =>
if (selfOperatedItem) { item.stock_in_type == 1 && (item.stock_type == 2 || item.stock_type == 3 || item.is_apart == 1)
uni.showToast({ );
title: '自营商品需要录入相关信息,请单个理货', this.is_dc_required = !!dcRequiredItem; //设置D/C是否必填标识
icon: 'none',
duration: 2500
});
return false;
}
this.image_list = []; //清空图片列表 this.image_list = []; //清空图片列表
this.server_image_list = []; //清空服务器图片列表 this.server_image_list = []; //清空服务器图片列表
this.formParams.image_ids = ''; //每次打开先清空图片集合 this.formParams.image_ids = ''; //每次打开先清空图片集合
this.formParams.tally_remark = ''; //每次打开先清空理货备注 this.formParams.tally_remark = ''; //每次打开先清空理货备注
this.formParams.dc_code = ''; //每次打开先清空D/C
this.$refs.showRight.open(); this.$refs.showRight.open();
}, },
/** /**
......
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 sign in to comment