Commit 8145374b by liangjianmin

feat(scanTally): 新增到货登记和待理货任务弹窗功能

- 在扫描页新增到货登记右侧弹窗,支持自营货品资料填写
- 实现待理货任务选择弹窗,展示多个待理货任务供用户选择
- 根据入库单状态自动区分流程,支持新建登记和直接理货操作
- 提供详细货品包装、净重、毛重及其他属性的选择及输入控件
- 增加自营货品第一次入库逻辑,完成资料保存后自动到货登记
- 优化搜索输入防抖,结合扫码解析查询入库单明细并展示弹窗
- 支持清空输入并重新聚焦,提升用户交互体验
parent 3fac4d59
...@@ -9,3 +9,389 @@ ...@@ -9,3 +9,389 @@
background: #f1f4f6; background: #f1f4f6;
} }
} }
::v-deep .uni-drawer__content {
width: 85% !important;
}
.uni-drawer-layer {
width: 100%;
background-color: #ffffff;
padding: 22rpx 22rpx 0 22rpx;
.tip {
color: red;
font-size: 17rpx;
margin-top: 28rpx;
}
.title {
position: relative;
.iconfont {
position: absolute;
left: 0;
top: 0;
font-size: 30rpx;
color: #292b33;
}
.text {
font-size: 23rpx;
color: #292b33;
font-weight: bold;
}
}
.field-item {
flex-wrap: wrap;
margin-top: 16rpx;
.item {
flex: 0 0 50%;
margin-bottom: 8rpx;
.label {
font-size: 16rpx;
color: #919399;
white-space: nowrap;
}
.tt {
font-size: 17rpx;
color: #484b59;
margin-left: 6rpx;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
max-width: 176rpx;
}
}
}
.uni-swiper-wrap {
margin-top: 15rpx;
.uni-swiper-input {
margin-bottom: 15rpx;
.label {
width: 24%;
font-size: 16rpx;
color: #919399;
&.required:before {
content: ' *';
color: red;
}
}
.select-box {
position: relative;
width: 76%;
height: 45rpx;
.uni-arrow {
position: absolute;
right: 14rpx;
width: 14rpx;
height: 9rpx;
background: url('https://img.ichunt.com/images/ichunt/202304/10/e4c72319ad41ce1425f71cc6ec35f111.png') no-repeat center;
background-size: contain;
}
.uni-input {
width: 100%;
height: 45rpx;
background: #ffffff;
border-radius: 10rpx;
border: 1px solid #1969f9;
font-size: 17rpx;
padding-left: 18rpx;
}
}
.input-box {
position: relative;
width: 76%;
.uni-input {
width: 100%;
height: 45rpx;
background: #ffffff;
border-radius: 10rpx;
border: 1px solid #1969f9;
font-size: 17rpx;
padding-left: 18rpx;
}
}
}
.uni-swiper-input-multipl {
margin-bottom: 15rpx;
.label {
width: 24%;
font-size: 16rpx;
color: #919399;
&.required:before {
content: ' *';
color: red;
}
.uni-arrow {
width: 14rpx;
height: 9rpx;
background: url('https://img.ichunt.com/images/ichunt/202304/10/e4c72319ad41ce1425f71cc6ec35f111.png') no-repeat center;
background-size: contain;
margin-right: 10rpx;
}
.uni-input {
font-size: 17rpx;
}
}
.multipl-input {
width: 76%;
.uni-input {
width: 100%;
height: 45rpx;
background: #ffffff;
border-radius: 10rpx;
border: 1px solid #1969f9;
font-size: 17rpx;
padding-left: 18rpx;
}
.timesSymbol {
padding: 0 14rpx;
font-size: 24rpx;
color: #292b33;
font-weight: bold;
}
.unit {
margin-left: 10rpx;
color: #919399;
font-size: 25rpx;
}
}
}
}
.swiper {
height: 790rpx;
}
.btn {
position: absolute;
bottom: 0;
left: 0;
right: 0;
width: 100%;
.btn1 {
height: 75rpx;
background: #1969f9;
font-size: 23rpx;
color: #ffffff;
}
.btn2 {
height: 75rpx;
background: #ffe0d7;
font-size: 23rpx;
color: #ff3700;
font-weight: bold;
}
}
}
.popup-content-sn {
background-color: #f1f4f6;
padding: 28rpx 24rpx 24rpx 24rpx;
border-radius: 10rpx;
width: 675rpx;
.tally-header {
display: flex;
align-items: center;
margin-bottom: 12rpx;
.order-sn {
font-size: 28rpx;
color: #ff6600;
}
.goods-type {
font-size: 26rpx;
margin-left: 24rpx;
.label {
color: #333;
}
.value {
color: #ff6600;
}
}
}
.tally-subtitle {
font-size: 26rpx;
color: #333;
margin-bottom: 20rpx;
}
.tally-empty-tip {
font-size: 26rpx;
color: #e64340;
line-height: 1.8;
padding: 40rpx 0 20rpx;
}
.tally-list {
background-color: #ffffff;
border-radius: 8rpx;
overflow: hidden;
.scroll-Y {
max-height: 500rpx;
}
.list-header {
padding: 20rpx 24rpx;
border-bottom: 1px solid #e6edf0;
.col-select {
width: 100rpx;
font-size: 24rpx;
color: #6e767a;
}
.col-order {
flex: 1;
font-size: 24rpx;
color: #6e767a;
}
.col-qty {
width: 150rpx;
font-size: 24rpx;
color: #6e767a;
text-align: right;
}
}
.list-item {
padding: 24rpx;
border-bottom: 1px solid #e6edf0;
transition: background-color 0.2s ease;
&:last-child {
border-bottom: none;
}
&.active {
background-color: #e6f4ff;
}
.col-select {
width: 100rpx;
}
.radio-circle {
width: 36rpx;
height: 36rpx;
border: 2rpx solid #d9d9d9;
border-radius: 50%;
position: relative;
transition: all 0.2s ease;
&.checked {
border-color: #197adb;
background-color: #197adb;
&::after {
content: '';
position: absolute;
top: 50%;
left: 50%;
width: 12rpx;
height: 12rpx;
background-color: #ffffff;
border-radius: 50%;
transform: translate(-50%, -50%);
}
}
}
.col-order {
flex: 1;
font-size: 26rpx;
color: #333;
&.highlight {
color: #ff9500;
font-weight: bold;
}
}
.col-qty {
width: 150rpx;
font-size: 26rpx;
color: #333;
text-align: right;
&.highlight {
color: #ff9500;
font-weight: bold;
}
}
}
}
.tally-footer {
display: flex;
justify-content: center;
gap: 24rpx;
margin-top: 24rpx;
.tally-btn {
flex: 1;
height: 64rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 28rpx;
border-radius: 8rpx;
transition: all 0.2s ease;
&:active {
transform: scale(0.96);
}
}
.tally-btn-cancel {
background: #ffffff;
color: #323233;
border: 1px solid #ebedf0;
&:active {
background: #f5f5f5;
}
}
.tally-btn-confirm {
background: #1989fa;
color: #ffffff;
&:active {
background: #0570db;
}
}
}
}
...@@ -3,6 +3,207 @@ ...@@ -3,6 +3,207 @@
<view class="fix-box"> <view class="fix-box">
<SearchBoxWithPicker :showPicker="false" placeholder="请扫描Digikey或Rochest二维码" :focus="is_focus" :value="keyword" :showClear="!!keyword" @input="handleSearchInput" @clear="clearInput" /> <SearchBoxWithPicker :showPicker="false" placeholder="请扫描Digikey或Rochest二维码" :focus="is_focus" :value="keyword" :showClear="!!keyword" @input="handleSearchInput" @clear="clearInput" />
</view> </view>
<!-- 到货登记(自营)第一次入库 -->
<uni-drawer ref="showRightZyGoodsDat" mode="right">
<view class="uni-drawer-layer" v-if="zyGoodsData">
<view class="title row rowCenter verCenter">
<text class="iconfont icon-juxing2" @click="closeZyDrawer()"></text>
<text class="text">到货登记</text>
</view>
<view class="tip">共有 {{ zyGoodsData.length }} 个货品为第一次入库,请确认物料信息!</view>
<swiper class="swiper" @change="swiperChange" circular :indicator-dots="indicatorDots" :autoplay="autoplay" :interval="interval" :duration="duration">
<swiper-item v-for="(item, index) in zyGoodsData" :key="index">
<view class="swiper-item">
<view class="field-item row">
<view class="item row verCenter" style="flex: 0 0 100%;">
<text class="label">自营货品ID:</text>
<text class="tt">{{ item.sku_id }}</text>
</view>
<view class="item row verCenter" style="flex: 0 0 100%;">
<text class="label">入库单号:</text>
<text class="tt">{{ item.stock_in_sn }}</text>
</view>
<view class="item row verCenter">
<text class="label">货品名称:</text>
<text class="tt">{{ item.goods_name }}</text>
</view>
<view class="item row verCenter">
<text class="label">标准品牌:</text>
<text class="tt">{{ item.brand_name }}</text>
</view>
</view>
<view class="uni-swiper-wrap">
<view class="uni-swiper-input row verCenter bothSide">
<text class="label required">包装方式:</text>
<view class="select-box row verCenter">
<picker @change="bindPickerZYChange($event, 1, index)" :value="saveZyGoodsParams[index].packing" :range="packingSet" :range-key="'name'" style="width: 100%;height: 100%;">
<view class="row verCenter bothSide">
<view class="uni-input row verCenter">{{ saveZyGoodsParams[index].packing == 0 ? '请选择' : packingSet[saveZyGoodsParams[index].packing - 5].name }}</view>
<view class="uni-arrow"></view>
</view>
</picker>
</view>
</view>
<view class="uni-swiper-input row verCenter bothSide">
<text class="label required">标准包装量:</text>
<view class="input-box row verCenter"><input type="number" inputmode="numeric" class="uni-input" v-model="saveZyGoodsParams[index].mpq" /></view>
</view>
<view class="uni-swiper-input row verCenter bothSide">
<text class="label required">拣货方式:</text>
<view class="select-box row verCenter">
<picker @change="bindPickerZYChange($event, 2, index)" :value="saveZyGoodsParams[index].picking_mode" :range="pickingModeSet" :range-key="'name'" style="width: 100%;height: 100%;">
<view class="row verCenter bothSide">
<view class="uni-input row verCenter">{{ saveZyGoodsParams[index].picking_mode == 0 ? '请选择' : pickingModeSet[saveZyGoodsParams[index].picking_mode - 1].name }}</view>
<view class="uni-arrow"></view>
</view>
</picker>
</view>
</view>
<view class="uni-swiper-input-multipl row verCenter bothSide">
<text class="label required">标准包装长宽高:</text>
<view class="multipl-input row verCenter bothSide">
<view class="row verCenter">
<input type="text" class="uni-input" placeholder="长" style="width: 100rpx;" v-model="saveZyGoodsParams[index].standard_length" />
<text class="timesSymbol"></text>
<input type="text" class="uni-input" placeholder="宽" style="width: 100rpx;" v-model="saveZyGoodsParams[index].standard_width" />
<text class="timesSymbol"></text>
<input type="text" class="uni-input" placeholder="高" style="width: 100rpx;" v-model="saveZyGoodsParams[index].standard_high" />
</view>
<view class="multipl-input-select row"><text class="unit">cm</text></view>
</view>
</view>
<view class="uni-swiper-input-multipl row verCenter bothSide">
<text class="label required">单位长宽高:</text>
<view class="multipl-input row verCenter bothSide">
<view class="row verCenter">
<input type="text" class="uni-input" placeholder="长" style="width: 100rpx;" v-model="saveZyGoodsParams[index].unit_length" />
<text class="timesSymbol"></text>
<input type="text" class="uni-input" placeholder="宽" style="width: 100rpx;" v-model="saveZyGoodsParams[index].unit_width" />
<text class="timesSymbol"></text>
<input type="text" class="uni-input" placeholder="高" style="width: 100rpx;" v-model="saveZyGoodsParams[index].unit_high" />
</view>
<view class="multipl-input-select row"><text class="unit">cm</text></view>
</view>
</view>
<view class="uni-swiper-input-multipl row verCenter bothSide">
<view class="label row">
<picker @change="bindPickerZYChange($event, 5, index)" :value="netWeightIndex" :range="netWeight" style="width: 100%;height: 100%;">
<view class="row verCenter bothSide">
<view class="uni-input row verCenter" style="color: #919399;">{{ netWeight[netWeightIndex] }}</view>
<view class="uni-arrow"></view>
</view>
</picker>
</view>
<view class="multipl-input row verCenter">
<view class="row verCenter" style="width: 86%;">
<template v-if="netWeightIndex == 0">
<input type="text" class="uni-input" placeholder="净重" v-model="saveZyGoodsParams[index].standard_net_weight" />
</template>
<template v-else>
<input type="text" class="uni-input" placeholder="净重" v-model="saveZyGoodsParams[index].unit_net_weight" />
</template>
</view>
<view class="multipl-input-select row">
<picker @change="bindPickerZYChange($event, 6, index)" :value="netWeightSizeIndex" :range="netWeightSize" style="width: 100%;height: 100%;">
<view class="row verCenter bothSide">
<view class="uni-input row rowCenter verCenter" style="padding-left: 9rpx;padding-right: 9rpx;border-left: none;width: 80rpx;">{{ netWeightSize[netWeightSizeIndex] }}</view>
</view>
</picker>
</view>
</view>
</view>
<view class="uni-swiper-input-multipl row verCenter bothSide">
<view class="label row">
<picker @change="bindPickerZYChange($event, 7, index)" :value="grossWeightIndex" :range="grossWeight" style="width: 100%;height: 100%;">
<view class="row verCenter bothSide">
<view class="uni-input row verCenter" style="color: #919399;">{{ grossWeight[grossWeightIndex] }}</view>
<view class="uni-arrow"></view>
</view>
</picker>
</view>
<view class="multipl-input row verCenter">
<view class="row verCenter" style="width:86%;">
<template v-if="grossWeightIndex == 0">
<input type="text" class="uni-input" placeholder="毛重" v-model="saveZyGoodsParams[index].standard_gross_weight" />
</template>
<template v-else>
<input type="text" class="uni-input" placeholder="毛重" v-model="saveZyGoodsParams[index].unit_gross_weight" />
</template>
</view>
<view class="multipl-input-select row">
<picker @change="bindPickerZYChange($event, 8, index)" :value="grossWeightSizeIndex" :range="grossWeightSize" style="width: 100%;height: 100%;">
<view class="row verCenter bothSide">
<view class="uni-input row rowCenter verCenter" style="padding-left: 9rpx;padding-right: 9rpx;border-left: none;width: 80rpx;">{{ grossWeightSize[grossWeightSizeIndex] }}</view>
</view>
</picker>
</view>
</view>
</view>
<view class="uni-swiper-input row verCenter bothSide">
<text class="label">其他属性:</text>
<view class="select-box row verCenter">
<picker @change="bindPickerZYChange($event, 9, index)" :value="saveZyGoodsParams[index].picking_other_attr_index" :range="otherAttrList" style="width: 100%;height: 100%;">
<view class="row verCenter bothSide">
<view class="uni-input row verCenter">{{ saveZyGoodsParams[index].picking_other_attr_index == -1 ? '请选择' : saveZyGoodsParams[index].picking_other_attr }}</view>
<view class="uni-arrow"></view>
</view>
</picker>
</view>
</view>
</view>
<view class="status-num row rowCenter verCenter" style="color: #1969f9;font-size: 23rpx;margin-top: 20rpx;">{{ swiperCurr + 1 }}/{{ zyGoodsData.length }}</view>
</view>
</swiper-item>
</swiper>
<view class="btn row rowCenter verCenter">
<view class="btn2 row rowCenter verCenter" @click="closeZyDrawer()" style="width: 50%;">关 闭</view>
<view class="row btn1 row rowCenter verCenter" style="width:50%" @click="saveZyGoodsDataSubmit()">到货登记</view>
</view>
</view>
</uni-drawer>
<!-- 待理货任务弹窗 -->
<uni-popup ref="popupTally" background-color="#F1F4F6">
<view class="popup-content-sn">
<view class="tally-header">
<text class="order-sn">{{ order_sn }}</text>
<view class="goods-type">
<text class="label">型号:</text>
<text class="value">{{ goods_type }}</text>
</view>
</view>
<!-- 有待理货任务 -->
<template v-if="tallyList.length > 0">
<view class="tally-subtitle">该标签有以下待理货任务</view>
<view class="tally-list">
<scroll-view scroll-y="true" class="scroll-Y">
<view class="list-header row verCenter">
<text class="col-select">请选择</text>
<text class="col-order">入仓号</text>
<text class="col-qty">待理货数量</text>
</view>
<view class="list-item row verCenter" v-for="(item, index) in tallyList" :key="index" :class="{ active: tallySelectedIndex === index }" @click="selectTallyItem(index)">
<view class="col-select">
<view class="radio-circle" :class="{ checked: tallySelectedIndex === index }"></view>
</view>
<text class="col-order" :class="{ highlight: tallySelectedIndex === index }">{{ item.inhouse }}</text>
<text class="col-qty" :class="{ highlight: tallySelectedIndex === index }">{{ item.wait_tally_qty }}</text>
</view>
</scroll-view>
</view>
<view class="tally-footer row">
<view class="tally-btn tally-btn-cancel" @click="closeTallyPopup">返回</view>
<view class="tally-btn tally-btn-confirm" @click="confirmTallySelect">到货登记 / 去理货</view>
</view>
</template>
<!-- 无待理货任务 -->
<template v-else>
<view class="tally-empty-tip">该标签没有待理货的任务,请检查是否已理货完成,或者联系业务确认是否已推单</view>
<view class="tally-footer row rowCenter">
<view class="tally-btn tally-btn-cancel" @click="closeTallyPopup">关闭</view>
</view>
</template>
</view>
</uni-popup>
</view> </view>
</template> </template>
...@@ -24,7 +225,29 @@ ...@@ -24,7 +225,29 @@
goods_type: '', goods_type: '',
parsed_origin: '', parsed_origin: '',
parsed_qty: '', parsed_qty: '',
isRequestSent: false isRequestSent: false,
tallyList: [],
tallySelectedIndex: -1,
// 自营到货登记相关
indicatorDots: true,
autoplay: false,
interval: 2000,
duration: 500,
swiperCurr: 0,
zyGoodsData: [],
saveZyGoodsParams: [],
packingSet: [{ name: '编带', value: 5 }, { name: '袋', value: 6 }, { name: '盒', value: 7 }, { name: '管', value: 8 }, { name: '托盘', value: 9 }, { name: '卷', value: 10 }, { name: '其他', value: 11 }],
pickingModeSet: [{ name: '裁剪', value: 1 }, { name: '称重', value: 2 }, { name: '计数', value: 3 }],
netWeight: ['标准包装净重', '单位净重'],
netWeightIndex: 1,
grossWeight: ['标准包装毛重', '单位毛重'],
grossWeightIndex: 1,
netWeightSize: ['kg', 'g'],
netWeightSizeIndex: 0,
grossWeightSize: ['kg', 'g'],
grossWeightSizeIndex: 0,
otherAttrList: [],
pendingStockInId: null
}; };
}, },
methods: { methods: {
...@@ -55,12 +278,12 @@ ...@@ -55,12 +278,12 @@
data: { data: {
goods: '', goods: '',
brand: '', brand: '',
model: 'BL02RN2R1M75B', model: 'ADXL879800',
model2: '', model2: '',
qty: 9, qty: 9,
origin: 'CN', origin: 'CN',
batch: '2421', batch: '2421',
putaway_sn: 'C00983' putaway_sn: 'B210088'
} }
}; };
...@@ -92,14 +315,41 @@ ...@@ -92,14 +315,41 @@
this.request(API.stockInDetailList, 'POST', { this.request(API.stockInDetailList, 'POST', {
page: 1, page: 1,
limit: 1000, limit: 1000,
inhouse: this.order_sn,//入仓号 inhouse: this.order_sn,
goods_name: this.goods_type,//货品名称 goods_name: this.goods_type,
tally_status_in: [0, 1, 2],//待处理、待理货、部分理货 tally_status_in: [0, 1, 2],
stock_in_items_with_stock_in_status_in: [1, 2]//新创建、已到货 stock_in_items_with_stock_in_status_in: [1, 2]
}, true).then(res => { }, true).then(res => {
if (res.code === 0) { if (res.code === 0) {
var list = res.data.list || []; var list = res.data.list || [];
// TODO: 后续步骤 - 展示待理货列表 this.tallyList = list;
// 无待理货任务,弹窗提示
if (list.length === 0) {
this.tallySelectedIndex = -1;
this.$refs.popupTally.open('center');
return;
}
if (list.length === 1) {
var item = list[0];
// 入库单状态"已到货"(2),直接进入理货页,无需弹窗
if (item.stock_in_status === 2) {
this.stock_in_id = item.stock_in_id;
// TODO: 跳转到入库单明细理货页,等待后续指示
return;
}
// 入库单状态"新创建"(1),自动选中并弹窗
if (item.stock_in_status === 1) {
this.tallySelectedIndex = 0;
this.$refs.popupTally.open('center');
return;
}
}
// 多条数据,弹窗让用户选择
this.tallySelectedIndex = -1;
this.$refs.popupTally.open('center');
} else { } else {
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
...@@ -109,6 +359,222 @@ ...@@ -109,6 +359,222 @@
}); });
}, },
/** /**
* 选择待理货项
*/
selectTallyItem(index) {
this.tallySelectedIndex = index;
},
/**
* 关闭待理货选择弹窗
*/
closeTallyPopup() {
this.$refs.popupTally.close();
this.tallySelectedIndex = -1;
},
/**
* 确认选择待理货项 - 到货登记/去理货
*/
confirmTallySelect() {
if (this.tallySelectedIndex === -1) {
uni.showToast({
title: '请选择一个待理货任务',
icon: 'none'
});
return;
}
var selectedItem = this.tallyList[this.tallySelectedIndex];
this.stock_in_id = selectedItem.stock_in_id;
this.pendingStockInId = selectedItem.stock_in_id;
this.$refs.popupTally.close();
// 入库单状态"新创建"(1)需要到货登记
if (selectedItem.stock_in_status === 1) {
this.addStockInRegister(selectedItem);
return;
}
// 入库单状态"已到货"(2)直接进入理货
// TODO: 进入理货页逻辑等待后续指示
},
/**
* 到货登记:判断是否自营且第一次入库
*/
addStockInRegister(selectedItem) {
var stockInSn = selectedItem.stock_in_sn;
this.request(API.getZyGoodsData, 'GET', { stock_in_sn: stockInSn, is_first_check: 1 }, true).then(res => {
if (res.code === 0) {
if (res.data.length > 0) {
// 自营且第一次入库,弹出资料填写框
this.getOtherAttrList();
this.openZyDrawer(stockInSn);
} else {
// 非第一次入库,直接到货登记
this.doStockInRegister();
}
} else {
uni.showModal({
title: '提示',
content: res.msg,
showCancel: false
});
}
});
},
/**
* 直接执行到货登记(非第一次入库)
*/
doStockInRegister() {
this.request(API.addStockInRegister, 'POST', { stock_in_id: JSON.stringify([this.pendingStockInId]) }, true).then(res => {
if (res.code === 0) {
uni.showToast({ title: '登记成功', icon: 'success' });
this.clearInput();
} else {
uni.showModal({
title: '提示',
content: res.msg,
showCancel: false
});
}
});
},
/**
* 获取自营货品数据
*/
getZyGoodsData(stockInSn) {
this.request(API.getZyGoodsData, 'GET', { stock_in_sn: stockInSn }, true).then(res => {
if (res.code === 0) {
this.zyGoodsData = res.data;
this.saveZyGoodsParams = res.data.map(item => ({
...item,
picking_other_attr_index: -1
}));
} else {
uni.showToast({ title: res.msg, icon: 'error' });
}
});
},
/**
* 获取其他属性列表
*/
getOtherAttrList() {
this.request(API.getOtherAttrList, 'POST', {}, true).then(res => {
if (res.code === 0) {
this.otherAttrList = res.data.list;
} else {
uni.showToast({ title: res.msg, icon: 'error' });
}
});
},
/**
* 打开自营资料填写弹窗
*/
openZyDrawer(stockInSn) {
this.swiperCurr = 0;
this.getZyGoodsData(stockInSn);
this.$refs.showRightZyGoodsDat.open();
},
/**
* 关闭自营资料填写弹窗
*/
closeZyDrawer() {
this.$refs.showRightZyGoodsDat.close();
},
/**
* 轮播图切换
*/
swiperChange(e) {
this.swiperCurr = e.detail.current;
},
/**
* 自营picker选择变更
*/
bindPickerZYChange(e, type, index) {
var val = e.detail.value;
switch (type) {
case 1:
this.saveZyGoodsParams[index].packing = this.packingSet[val].value;
break;
case 2:
this.saveZyGoodsParams[index].picking_mode = this.pickingModeSet[val].value;
break;
case 5:
this.netWeightIndex = val;
if (val == 1) {
this.saveZyGoodsParams[index].unit_net_weight = '';
} else {
this.saveZyGoodsParams[index].standard_net_weight = '';
}
break;
case 6:
this.netWeightSizeIndex = val;
if (this.netWeightIndex == 0) {
this.saveZyGoodsParams[index].net_weight_size = val == 1 ? 2 : 1;
} else {
this.saveZyGoodsParams[index].unit_net_weight_size = val == 1 ? 2 : 1;
}
this.$forceUpdate();
break;
case 7:
this.grossWeightIndex = val;
if (val == 1) {
this.saveZyGoodsParams[index].standard_gross_weight = '';
} else {
this.saveZyGoodsParams[index].unit_gross_weight = '';
}
break;
case 8:
this.grossWeightSizeIndex = val;
if (this.grossWeightIndex == 0) {
this.saveZyGoodsParams[index].gross_weight_size = val == 1 ? 2 : 1;
} else {
this.saveZyGoodsParams[index].unit_gross_weight_size = val == 1 ? 2 : 1;
}
break;
case 9:
this.saveZyGoodsParams[index].picking_other_attr_index = val;
this.saveZyGoodsParams[index].picking_other_attr = this.otherAttrList[val];
break;
}
},
/**
* 自营资料提交 + 到货登记
*/
saveZyGoodsDataSubmit() {
var isEmptyMpq = this.saveZyGoodsParams.every(obj => obj.hasOwnProperty('mpq') && obj.mpq !== '');
if (!isEmptyMpq) {
uni.showModal({ title: '提示', content: '标准包装量必填', showCancel: false });
return;
}
var hasError = this.saveZyGoodsParams.filter(item => item.packing === 5).some(({ standard_length, unit_length }, index) => {
if (!standard_length) {
uni.showModal({ title: '提示', content: `第${index + 1}页,包装方式为编带的时候,标准包装长为必填`, showCancel: false });
return true;
}
if (!unit_length) {
uni.showModal({ title: '提示', content: `第${index + 1}页,包装方式为编带的时候,单位长为必填`, showCancel: false });
return true;
}
return false;
});
if (hasError) return;
this.request(API.saveZyGoodsData, 'POST', { list: JSON.stringify(this.saveZyGoodsParams) }, true).then(res => {
if (res.code === 0) {
this.request(API.addStockInRegister, 'POST', { stock_in_id: JSON.stringify([this.pendingStockInId]) }, true).then(res => {
if (res.code === 0) {
uni.showToast({ title: '登记成功', icon: 'success' });
this.closeZyDrawer();
this.clearInput();
} else {
uni.showModal({ title: '提示', content: res.msg, showCancel: false });
}
});
} else {
uni.showModal({ title: '提示', content: res.msg, showCancel: false });
}
});
},
/**
* 清空输入并重新聚焦 * 清空输入并重新聚焦
*/ */
clearInput() { clearInput() {
......
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