Commit c9f608e9 by LJM

add

parent c78353fa
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
height: 48rpx; height: 48rpx;
background: #ffffff; background: #ffffff;
border-radius: 4rpx; border-radius: 4rpx;
border: 1rpx solid #197adb; border: 1px solid #197adb;
font-size: 24rpx; font-size: 24rpx;
color: #197adb; color: #197adb;
} }
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
width: 40rpx; width: 40rpx;
height: 28rpx; height: 28rpx;
border-radius: 4rpx; border-radius: 4rpx;
border: 1rpx solid #197adb; border: 1px solid #197adb;
font-size: 22rpx; font-size: 22rpx;
color: #197adb; color: #197adb;
} }
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
height: 48rpx; height: 48rpx;
background: #ffffff; background: #ffffff;
border-radius: 4rpx; border-radius: 4rpx;
border: 1rpx solid #197adb; border: 1px solid #197adb;
font-size: 24rpx; font-size: 24rpx;
color: #197adb; color: #197adb;
} }
...@@ -93,7 +93,7 @@ ...@@ -93,7 +93,7 @@
padding-bottom: 16rpx; padding-bottom: 16rpx;
} }
.w130 { .w130 {
width: 130rpx; width: 156rpx;
} }
.t1 { .t1 {
font-size: 28rpx; font-size: 28rpx;
...@@ -104,7 +104,7 @@ ...@@ -104,7 +104,7 @@
width: 48rpx; width: 48rpx;
height: 36rpx; height: 36rpx;
border-radius: 4rpx; border-radius: 4rpx;
border: 1rpx solid #197adb; border: 1px solid #197adb;
font-size: 24rpx; font-size: 24rpx;
color: #197adb; color: #197adb;
margin-left: 16rpx; margin-left: 16rpx;
...@@ -119,7 +119,7 @@ ...@@ -119,7 +119,7 @@
} }
.input-text { .input-text {
.uni-input { .uni-input {
width: 190rpx; width: 173rpx;
height: 48rpx; height: 48rpx;
background: #e6edf0; background: #e6edf0;
border-radius: 4rpx; border-radius: 4rpx;
...@@ -134,7 +134,7 @@ ...@@ -134,7 +134,7 @@
width: 88rpx; width: 88rpx;
height: 88rpx; height: 88rpx;
background-color: #f1f4f6; background-color: #f1f4f6;
border: 1rpx solid #e6edf0; border: 1px solid #e6edf0;
.iconfont { .iconfont {
font-size: 48rpx; font-size: 48rpx;
color: #d8d8d8; color: #d8d8d8;
...@@ -212,7 +212,7 @@ ...@@ -212,7 +212,7 @@
height: 44rpx; height: 44rpx;
background: #ffffff; background: #ffffff;
border-radius: 4rpx; border-radius: 4rpx;
border: 1rpx solid #197adb; border: 1px solid #197adb;
margin-right: 16rpx; margin-right: 16rpx;
margin-bottom: 16rpx; margin-bottom: 16rpx;
.text { .text {
......
...@@ -152,8 +152,8 @@ ...@@ -152,8 +152,8 @@
confirm() { confirm() {
if (!this.abnormal_batch) { if (!this.abnormal_batch) {
uni.showToast({ uni.showToast({
title: '请输入异常批次', title: '请输入异常批次',
icon: 'none' icon: 'error'
}); });
return false; return false;
} }
...@@ -257,7 +257,7 @@ ...@@ -257,7 +257,7 @@
if (!val) { if (!val) {
uni.showToast({ uni.showToast({
title: '请输入毛重', title: '请输入毛重',
icon: 'none' icon: 'error'
}); });
return false; return false;
} }
......
...@@ -77,11 +77,13 @@ ...@@ -77,11 +77,13 @@
*/ */
add() { add() {
if (!this.keyword) { if (!this.keyword) {
uni.showToast({ uni.showModal({
title: '请输入箱号', title: '',
icon: 'none' content: '请先扫描箱号',
showCancel: false
}); });
return false; return false;
return false;
} }
// 检查输入的箱号是否已经存在于列表中 // 检查输入的箱号是否已经存在于列表中
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
</view> </view>
<view class="column-box row bothSide verCenter"> <view class="column-box row bothSide verCenter">
<view class="input-box row verCenter"> <view class="input-box row verCenter">
<input class="uni-input" :disabled="tallyData.detail && tallyData.detail.length > 0 && step == 1 && erp_order_sn !=''" :class="{ 'disabled': tallyData.detail && tallyData.detail.length > 0 && step == 1 && erp_order_sn !='' }" placeholder="输入或扫描入仓号" placeholder-style="color:#000;font-weight: bold;" v-model="erp_order_sn" /> <input class="uni-input" :focus="is_focus" @input="handleInput($event,1)" :disabled="tallyData.detail && tallyData.detail.length > 0 && step == 1 && erp_order_sn !=''" :class="{ 'disabled': tallyData.detail && tallyData.detail.length > 0 && step == 1 && erp_order_sn !='' }" placeholder="输入或扫描入仓号" placeholder-style="color:#000;font-weight: bold;" v-model="erp_order_sn" />
</view> </view>
<view class="action-bar row verCenter"> <view class="action-bar row verCenter">
<template v-if="tallyData.detail && tallyData.detail.length > 0 && step == 1 && erp_order_sn != ''"> <template v-if="tallyData.detail && tallyData.detail.length > 0 && step == 1 && erp_order_sn != ''">
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<view class="btn row rowCenter verCenter" @click="closeBox()">关单封箱</view> <view class="btn row rowCenter verCenter" @click="closeBox()">关单封箱</view>
</template> </template>
<template v-else> <template v-else>
<view class="btn row rowCenter verCenter" @click="getTallyData(1)">锁定理货</view> <view class="btn row rowCenter verCenter" @click="lockTally()">锁定理货</view>
</template> </template>
</view> </view>
</view> </view>
...@@ -39,18 +39,21 @@ ...@@ -39,18 +39,21 @@
</picker> </picker>
</view> </view>
<view class="input-box row verCenter"> <view class="input-box row verCenter">
<!-- 其他 -->
<template v-if="index == 0"> <template v-if="index == 0">
<input class="uni-input" placeholder="输入或扫描" placeholder-style="color:#000;font-weight: bold;" v-model="goods_type" /> <input class="uni-input" placeholder="输入或扫描" placeholder-style="color:#000;font-weight: bold;" v-model="goods_type" @input="handleInput($event,2)" />
</template> </template>
<!-- digikey等供应商-->
<template v-else> <template v-else>
<input class="uni-input" placeholder="输入或扫描" placeholder-style="color:#000;font-weight: bold;" v-model="keyword" /> <input class="uni-input" placeholder="输入或扫描" placeholder-style="color:#000;font-weight: bold;" v-model="keyword" @input="handleInput($event,2)" />
</template> </template>
</view> </view>
</view> </view>
<view class="action-bar"> <view class="action-bar">
<view class="btn1 row rowCenter verCenter" @click="identifyQrCodeNumAndSn(2)">扫 描</view> <view class="btn1 row rowCenter verCenter" @click="identifyQrCodeNumAndSn()">扫 描</view>
</view> </view>
</view> </view>
<!-- 箱子基础信息 -->
<view class="info row verCenter" v-if="tallyData && tallyData.detail"> <view class="info row verCenter" v-if="tallyData && tallyData.detail">
<view class="grid-item row verCenter"> <view class="grid-item row verCenter">
<view class="t1">业务日期:</view> <view class="t1">业务日期:</view>
...@@ -84,7 +87,7 @@ ...@@ -84,7 +87,7 @@
<view class="box" v-for="(item,index) in tallyData.detail" :key="index" :class="{disabled:item.tally_status == 3}"> <view class="box" v-for="(item,index) in tallyData.detail" :key="index" :class="{disabled:item.tally_status == 3}">
<view class="title pb16 row verCenter"> <view class="title pb16 row verCenter">
<text class="t1">{{item.goods_type}}</text> <text class="t1">{{item.goods_type}}</text>
<text class="t2 row rowCenter verCenter" v-if="item.is_goods_check_cn"></text> <text class="t2 row rowCenter verCenter" v-if="item.is_goods_check"></text>
</view> </view>
<view class="pb16 row"> <view class="pb16 row">
<text class="t3 w130">物料名称:</text> <text class="t3 w130">物料名称:</text>
...@@ -94,37 +97,38 @@ ...@@ -94,37 +97,38 @@
<text class="t3 w130">品牌:</text> <text class="t3 w130">品牌:</text>
<text class="t4">{{item.brand}}</text> <text class="t4">{{item.brand}}</text>
</view> </view>
<view class="pb16 row"> <view class="pb16 row verCenter bothSide">
<view class="row" style="width: 50%;"> <view class="row" style="width: 50%;">
<text class="t3 w130">单价:</text> <text class="t3 w130">单价:</text>
<text class="t4">{{item.unit_price}}</text> <text class="t4">{{item.unit_price}}</text>
</view> </view>
<view class="row" style="width: 50%;"> <view class="row" style="width: 50%;">
<text class="t3 w130">金额:</text> <text class="t3 w130" style="text-align: right;">金额:</text>
<text class="t4">{{item.total_price}}</text> <text class="t4">{{item.total_price}}</text>
</view> </view>
</view> </view>
<view class="pb16 row" style="border-bottom: 1px solid #E6EDF0;padding-bottom: 24rpx;"> <view class="pb16 row" style="border-bottom: 1px solid #E6EDF0;padding-bottom: 24rpx;">
<view class="row" style="width: 50%;"> <view class="row" style="width: 50%;">
<text class="t3 w130">待收数量:</text>
<text class="t4">{{item.wait_tally_num}}</text>
</view>
<view class="row" style="width: 50%;">
<text class="t3 w130">总数量:</text> <text class="t3 w130">总数量:</text>
<text class="t4">{{item.order_numbers}}</text> <text class="t4">{{item.order_numbers}}</text>
</view> </view>
</view> </view>
<view class="pb16 row verCenter bothSide" style="margin-top: 24rpx;"> <view class="pb16 row verCenter bothSide" style="margin-top: 24rpx;">
<view class="row verCenter" style="width: 50%;"> <view class="row verCenter">
<text class="t3 w130">入库数量:</text> <text class="t3 w130">入库数量:</text>
<view class="input-text"> <view class="input-text">
<input class="uni-input" type="number" placeholder="输入" placeholder-style="color:#000;font-weight: bold;" v-model="form[index].tally_num" /> <input class="uni-input" :disabled="item.tally_status == 3" type="number" inputmode="numeric" placeholder="输入" placeholder-style="color:#000;font-weight: bold;" v-model="form[index].tally_num" />
</view> </view>
</view> </view>
<view class="row verCenter" style="width: 50%;"> <view class="row verCenter rowCenter">
<text class="t3 w130">原产地:</text> <text class="t3 w130" style="width:105rpx;">原产地:</text>
<view class="input-text"> <view class="input-text">
<template v-if="item.tally_status == 3">
<input class="uni-input" placeholder="输入" placeholder-style="color:#000;font-weight: bold;" disabled="" v-model="form[index].origin" />
</template>
<template v-else>
<input class="uni-input" placeholder="输入" placeholder-style="color:#000;font-weight: bold;" disabled="" @click="open(index)" v-model="form[index].origin" /> <input class="uni-input" placeholder="输入" placeholder-style="color:#000;font-weight: bold;" disabled="" @click="open(index)" v-model="form[index].origin" />
</template>
</view> </view>
</view> </view>
</view> </view>
...@@ -132,7 +136,7 @@ ...@@ -132,7 +136,7 @@
<view class="row verCenter" style="width: 50%;"> <view class="row verCenter" style="width: 50%;">
<text class="t3 w130">净重:</text> <text class="t3 w130">净重:</text>
<view class="input-text"> <view class="input-text">
<input class="uni-input" placeholder="输入" placeholder-style="color:#000;font-weight: bold;" v-model="form[index].net_weight" /> <input class="uni-input" :disabled="item.tally_status == 3" type="number" inputmode="decimal" placeholder="输入" placeholder-style="color:#000;font-weight: bold;" v-model="form[index].net_weight" />
</view> </view>
</view> </view>
</view> </view>
...@@ -168,7 +172,7 @@ ...@@ -168,7 +172,7 @@
<view class="popup-content"> <view class="popup-content">
<view class="search-baar row verCenter"> <view class="search-baar row verCenter">
<text class="iconfont icon-a-riqi11"></text> <text class="iconfont icon-a-riqi11"></text>
<input type="text" class="uni-input" placeholder="请输入国家或地区名称(支持中英文)" placeholder-style="font-size:26rpx;color:#6E767A;" @input="handleInput($event)" v-model="origin" style="width: 100%;" /> <input type="text" class="uni-input" placeholder="请输入国家或地区名称(支持中英文)" placeholder-style="font-size:26rpx;color:#6E767A;" @input="handleInput($event,3)" v-model="origin" style="width: 100%;" />
</view> </view>
<view class="data-list"> <view class="data-list">
<template v-if="origin_list.length > 0"> <template v-if="origin_list.length > 0">
...@@ -187,8 +191,8 @@ ...@@ -187,8 +191,8 @@
</view> </view>
</uni-popup> </uni-popup>
<!-- 关单封箱弹窗 --> <!-- 关单封箱弹窗 -->
<uni-popup ref="inputDialog" type="dialog"> <uni-popup ref="inputDialog" type="dialog" :mask-click="true">
<uni-popup-dialog ref="inputClose" mode="input" :title="title" value="" confirmText="新箱子" cancelText="不需要换箱" placeholder="请输入毛重" @close="dialogInputClose" @confirm="dialogInputConfirm" :is-mask-click="true" :before-close="true"></uni-popup-dialog> <uni-popup-dialog ref="inputClose" mode="input" :title="title" value="" confirmText="新箱子" cancelText="不需要换箱" placeholder="请输入毛重" @close="dialogInputClose" @confirm="dialogInputConfirm" :before-close="true"></uni-popup-dialog>
</uni-popup> </uni-popup>
</view> </view>
</template> </template>
...@@ -208,7 +212,6 @@ ...@@ -208,7 +212,6 @@
curr: -1, //当前打开的是哪个产地 curr: -1, //当前打开的是哪个产地
fixBoxStyle: '', fixBoxStyle: '',
noexebshowFalg: true, //控制是否会触发生命周期 noexebshowFalg: true, //控制是否会触发生命周期
img_upload_url: 'http://hk.image.semour.com',
index: 0, index: 0,
item: ['其他', 'digikey', 'mouser', 'future', 'TI'], item: ['其他', 'digikey', 'mouser', 'future', 'TI'],
box_sn: '', //箱号信息 box_sn: '', //箱号信息
...@@ -269,19 +272,30 @@ ...@@ -269,19 +272,30 @@
this.$forceUpdate(); this.$forceUpdate();
this.$refs.popup.close(); this.$refs.popup.close();
}, },
/**
* 选择国家确认-关闭弹窗
*/
confirmChange() { confirmChange() {
this.$refs.popup.close(); this.$refs.popup.close();
}, },
/** /**
* 输入国家监听 * @param {Object} event 输入框监听
* @param {Object} event * @param {Object} type 1入仓号监听 2型号监听 3输入国家监听
*/ */
handleInput: debounce(function(event) { handleInput: debounce(function(event, type) {
var val = event.target.value; var value = event.target.value;
if (val) { if (type == 1) {
this.origin_list = []; //数组清空 if (value) {
this.lockTally();
} }
} else if (type == 2) {
if (value) {
this.identifyQrCodeNumAndSn();
}
} else if (type == 3) {
this.origin_list = []; //数组清空
this.getOrigin(); this.getOrigin();
}
}, 500), }, 500),
/** /**
* 打开弹窗 * 打开弹窗
...@@ -326,7 +340,7 @@ ...@@ -326,7 +340,7 @@
} }
// 遍历图片路径数组,对每张图片进行压缩 // 遍历图片路径数组,对每张图片进行压缩
imagePaths.forEach((imagePath, index) => { imagePaths.forEach((_imagePath, index) => {
// 使用compressImage 压缩图片 // 使用compressImage 压缩图片
uni.compressImage({ uni.compressImage({
src: imagePaths[index].tempFilePath, src: imagePaths[index].tempFilePath,
...@@ -338,7 +352,7 @@ ...@@ -338,7 +352,7 @@
// 在这里处理压缩后的图片,上传到服务器 // 在这里处理压缩后的图片,上传到服务器
uni.uploadFile({ uni.uploadFile({
url: this.img_upload_url + '/uploadImage?sys_type=4', url: API.uploadImageHk + '?sys_type=4',
filePath: compressedImagePath, filePath: compressedImagePath,
name: 'file', name: 'file',
timeout: 10000, timeout: 10000,
...@@ -359,12 +373,12 @@ ...@@ -359,12 +373,12 @@
}); });
} }
}, },
fail: error => { fail: () => {
uni.hideLoading();
uni.showToast({ uni.showToast({
title: '上传图片失败', title: '上传图片失败',
icon: 'none' icon: 'none'
}); });
uni.hideLoading();
} }
}); });
}, },
...@@ -399,7 +413,7 @@ ...@@ -399,7 +413,7 @@
/** /**
* 识别 * 识别
*/ */
identifyQrCodeNumAndSn(type) { identifyQrCodeNumAndSn() {
if (!this.box_sn) { if (!this.box_sn) {
uni.showModal({ uni.showModal({
title: '', title: '',
...@@ -408,10 +422,10 @@ ...@@ -408,10 +422,10 @@
}); });
return false; return false;
} }
this.step = 2; //标记点击了哪个按钮
if (this.index == 0) { if (this.index == 0) {
//区分其他 //区分其他
this.getTallyData(type); this.getTallyData();
} else { } else {
let codeTypeByIndex = { let codeTypeByIndex = {
3: 'DigiKey', 3: 'DigiKey',
...@@ -433,7 +447,7 @@ ...@@ -433,7 +447,7 @@
this.keyword = res.data.model; this.keyword = res.data.model;
} }
this.goods_type = res.data.model; //赋值检索出来的型号 this.goods_type = res.data.model; //赋值检索出来的型号
this.getTallyData(type); this.getTallyData();
} else { } else {
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
...@@ -478,10 +492,9 @@ ...@@ -478,10 +492,9 @@
}); });
}, },
/** /**
* 获取锁定理货信息 * 锁定理货
* @param {Object} type 1 锁定理货 2 其他及供应商
*/ */
getTallyData(type) { lockTally() {
if (!this.box_sn) { if (!this.box_sn) {
uni.showModal({ uni.showModal({
title: '', title: '',
...@@ -490,16 +503,21 @@ ...@@ -490,16 +503,21 @@
}); });
return false; return false;
} }
if (type == 1) {
if (!this.erp_order_sn) { if (!this.erp_order_sn) {
uni.showToast({ uni.showToast({
title: '请输入入仓号', title: '请输入入仓号',
icon: 'none' icon: 'error'
}); });
return false; return false;
} }
} this.step = 1;
this.step = type; //记录当前哪个按钮操作 this.getTallyData();
},
/**
* 获取锁定理货信息
*
*/
getTallyData() {
this.request(API.getTallyData, 'POST', { erp_order_sn: this.erp_order_sn, goods_type: this.goods_type }, true).then(res => { this.request(API.getTallyData, 'POST', { erp_order_sn: this.erp_order_sn, goods_type: this.goods_type }, true).then(res => {
if (res.err_code === 0) { if (res.err_code === 0) {
this.tallyData = res.data; this.tallyData = res.data;
...@@ -513,7 +531,7 @@ ...@@ -513,7 +531,7 @@
wstydl_id: item.wstydl_id, // 理货明细ID wstydl_id: item.wstydl_id, // 理货明细ID
erp_order_sn: this.erp_order_sn, // 入仓号 erp_order_sn: this.erp_order_sn, // 入仓号
wsty_id: this.wsty_id, // 箱子id wsty_id: this.wsty_id, // 箱子id
is_goods_check_cn: item.is_goods_check_cn //是否商检 is_goods_check: item.is_goods_check //是否商检
})); }));
this.image_list = res.data.detail.map(() => new Array()); //图片特殊处理 this.image_list = res.data.detail.map(() => new Array()); //图片特殊处理
...@@ -539,38 +557,43 @@ ...@@ -539,38 +557,43 @@
if (!this.form[index].tally_num) { if (!this.form[index].tally_num) {
uni.showToast({ uni.showToast({
title: '入库数量必填', title: '入库数量必填',
icon: 'none' icon: 'error'
}); });
return false; return false;
} }
if (!this.form[index].origin) { if (!this.form[index].origin) {
uni.showToast({ uni.showToast({
title: '原产地必填', title: '原产地必填',
icon: 'none' icon: 'error'
}); });
return false; return false;
} }
if (!this.form[index].net_weight) { if (!this.form[index].net_weight) {
uni.showToast({ uni.showToast({
title: '净重必填', title: '净重必填',
icon: 'none' icon: 'error'
}); });
return false; return false;
} }
if (this.form[index].is_goods_check) {
if (this.form[index].is_goods_check_cn) {
if (!this.form[index].goods_check_pic) { if (!this.form[index].goods_check_pic) {
uni.showToast({ uni.showToast({
title: '商检图片必须要上传图片', title: '该物料为商检,必须要上传图片',
icon: 'none' icon: 'none'
}); });
return false; return false;
} }
} }
this.request(API.submitTallyDetail, 'POST', this.form[index], true).then(res => { this.request(API.submitTallyDetail, 'POST', this.form[index], true).then(res => {
if (res.err_code === 0) { if (res.err_code === 0) {
this.getTallyData(1); uni.showToast({
title: '提交成功',
icon: 'success',
duration: 2000
});
setTimeout(() => {
this.getTallyData();
}, 2000);
} else { } else {
uni.showToast({ uni.showToast({
title: res.err_msg, title: res.err_msg,
...@@ -613,12 +636,14 @@ ...@@ -613,12 +636,14 @@
content: '确定取消释放该箱号吗?', content: '确定取消释放该箱号吗?',
success: (res) => { success: (res) => {
if (res.confirm) { if (res.confirm) {
this.request(API.cancelRelease, 'POST', { wsty_id: this.wsty_id }, true).then(res => { this.request(API.cancelRelease, 'POST', { wsty_id: this.wsty_id, erp_order_sn: this.erp_order_sn }, true).then(res => {
if (res.err_code === 0) { if (res.err_code === 0) {
this.tallyData = []; this.tallyData = [];
this.box_sn = ''; this.box_sn = '';
this.erp_order_sn = '';
this.wsty_id = ''; this.wsty_id = '';
this.erp_order_sn = '';
this.goods_type = '';
this.keyword = '';
} else { } else {
uni.showToast({ uni.showToast({
title: res.err_msg, title: res.err_msg,
...@@ -646,7 +671,7 @@ ...@@ -646,7 +671,7 @@
if (!val) { if (!val) {
uni.showToast({ uni.showToast({
title: '请输入毛重', title: '请输入毛重',
icon: 'none' icon: 'error'
}); });
return false; return false;
} }
...@@ -717,6 +742,10 @@ ...@@ -717,6 +742,10 @@
@import '@/assets/css/tally/index.scss'; @import '@/assets/css/tally/index.scss';
::v-deep { ::v-deep {
.uni-dialog-input {
font-size: 24rpx !important;
}
.uni-dialog-title-text { .uni-dialog-title-text {
padding: 10px; padding: 10px;
text-align: center; text-align: center;
......
<template> <template>
<view class="unboxing"> <view class="unboxing">
<view class="input-box row bothSide verCenter"> <view class="input-box row bothSide verCenter">
<input class="uni-input" placeholder="输入或扫描入箱号" placeholder-style="color:#000;font-weight: bold;" /> <input class="uni-input" placeholder="输入或扫描入箱号" placeholder-style="color:#000;font-weight: bold;" v-model="box_sn" @input="handleInput($event)" />
<view class="btn row rowCenter verCenter">开 箱</view> <view class="btn row rowCenter verCenter" @click="unboxing()">开 箱</view>
</view> </view>
<!-- 列表 -->
<view class="list" v-if="tallyData && tallyData.detail">
<scroll-view scroll-y="true" class="scroll-Y">
<view class="box" v-for="(item,index) in tallyData.detail" :key="index" :class="{disabled:item.tally_status == 3}">
<view class="title pb16 row verCenter">
<text class="t1">{{item.goods_type}}</text>
<text class="t2 row rowCenter verCenter" v-if="item.is_goods_check"></text>
</view>
<view class="pb16 row">
<text class="t3 w130">物料名称:</text>
<text class="t4">{{item.goods_title}}</text>
</view>
<view class="pb16 row">
<text class="t3 w130">品牌:</text>
<text class="t4">{{item.brand}}</text>
</view>
<view class="pb16 row verCenter bothSide">
<view class="row" style="width: 50%;">
<text class="t3 w130">单价:</text>
<text class="t4">{{item.unit_price}}</text>
</view>
<view class="row" style="width: 50%;">
<text class="t3 w130" style="text-align: right;">金额:</text>
<text class="t4">{{item.total_price}}</text>
</view>
</view>
<view class="pb16 row" style="border-bottom: 1px solid #E6EDF0;padding-bottom: 24rpx;">
<view class="row" style="width: 50%;">
<text class="t3 w130">总数量:</text>
<text class="t4">{{item.order_numbers}}</text>
</view>
</view>
<view class="pb16 row verCenter bothSide" style="margin-top: 24rpx;">
<view class="row verCenter">
<text class="t3 w130">已入库数量:</text>
<view class="input-text">
<input class="uni-input" :disabled="item.tally_status == 3" type="number" inputmode="numeric" placeholder="输入" placeholder-style="color:#000;font-weight: bold;" v-model="form[index].tally_num" />
</view>
</view>
<view class="row verCenter rowCenter">
<text class="t3 w130" style="width:105rpx;">原产地:</text>
<view class="input-text">
<template v-if="item.tally_status == 3">
<input class="uni-input" placeholder="输入" placeholder-style="color:#000;font-weight: bold;" disabled="" v-model="form[index].origin" />
</template>
<template v-else>
<input class="uni-input" placeholder="输入" placeholder-style="color:#000;font-weight: bold;" disabled="" @click="open(index)" v-model="form[index].origin" />
</template>
</view>
</view>
</view>
<view class="pb16 row verCenter bothSide" style="margin-top: 24rpx;">
<view class="row verCenter" style="width: 50%;">
<text class="t3 w130">净重:</text>
<view class="input-text">
<input class="uni-input" :disabled="item.tally_status == 3" type="number" inputmode="decimal" placeholder="输入" placeholder-style="color:#000;font-weight: bold;" v-model="form[index].net_weight" />
</view>
</view>
</view>
<view class="row bothSide verCenter">
<view class="upload-list row verCenter">
<template v-if="image_list.length > 0">
<view class="pic-box" v-for="(v, i) in image_list[index]" :key="i">
<image :src="v" mode="aspectFill" lazy-load="true" @click="previewChange(image_list[index], i)"></image>
<view class="delete row rowCenter verCenter" @click="deletePic(index,i)"><text class="iconfont icon-shanchu"></text></view>
</view>
</template>
<view class="default row rowCenter verCenter" @click="chooseImageChange(index)" v-if="image_list.length < 5"><text class="iconfont icon-xingzhuangjiehe"></text></view>
</view>
<template v-if="item.tally_status == 3">
<view class="btn row rowCenter verCenter disabled" @click="cancelTallyDetail(index)">取消理货</view>
</template>
<template v-else>
<view class="btn row rowCenter verCenter" @click="submitTallyDetail(index)">提 交</view>
</template>
</view>
</view>
</scroll-view>
</view>
<!-- 选择国家 -->
<uni-popup ref="popup" background-color="#F1F4F6">
<view class="popup-content">
<view class="search-baar row verCenter">
<text class="iconfont icon-a-riqi11"></text>
<input type="text" class="uni-input" placeholder="请输入国家或地区名称(支持中英文)" placeholder-style="font-size:26rpx;color:#6E767A;" @input="handleInput($event,3)" v-model="origin" style="width: 100%;" />
</view>
<view class="data-list">
<template v-if="origin_list.length > 0">
<view class="box row bothSide verCenter" v-for="(item, index) in origin_list" :key="index" :class="{ curr: filter_status[index] }" @click="filterChange(index)">
<text class="text">{{ item }}</text>
<view class="check-ico"></view>
</view>
</template>
<template v-else>
<view class="box row bothSide verCenter">
<text class="text">暂无数据</text>
</view>
</template>
</view>
<view class="pop-btn row rowCenter verCenter" @click="confirmChange">确 认</view>
</view>
</uni-popup>
<!-- 关单封箱弹窗 -->
<uni-popup ref="inputDialog" type="dialog" :mask-click="true">
<uni-popup-dialog ref="inputClose" mode="input" :title="title" value="" confirmText="新箱子" cancelText="不需要换箱" placeholder="请输入毛重" @close="dialogInputClose" @confirm="dialogInputConfirm" :before-close="true"></uni-popup-dialog>
</uni-popup>
</view> </view>
</template> </template>
<script> <script>
import { API } from '@/util/api.js'; import { API } from '@/util/api.js';
import debounce from 'lodash/debounce'; import debounce from 'lodash/debounce';
import { createArray } from '@/util/util.js';
export default { export default {
data() { data() {
return { return {
box_sn: '',
tallyData: {}, //理货信息
image_list: [], //图片列表
filter_status: [], //控制状态
origin_list: [], //产地
curr: -1, //当前打开的是哪个产地
origin: '', //搜索国家携带的参数
form: {}
}; };
}, },
watch: {
image_list(arr) {
const allNonEmpty = arr.every(subArr => subArr.length > 0);
if (allNonEmpty) {
arr.forEach((item, index) => {
// 将数组元素用逗号连接成字符串,并赋值给对应的 form 中的 goods_check_pic 字段
this.form[index].goods_check_pic = item.length > 0 ? item.join(',') : '';
});
}
}
},
methods: { methods: {
/**
* @param {Object} event 输入框监听
*/
handleInput: debounce(function(event) {
var value = event.target.value;
if (value) {
this.unboxing();
}
}, 500),
/**
* 开箱
*/
unboxing() {
if (!this.box_sn) {
uni.showModal({
title: '',
content: '请先扫描箱号',
showCancel: false
});
return false;
}
this.getTallyData();
},
/**
* 打开弹窗
* @param {Object} index
*/
open(index) {
this.curr = index;
this.filter_status.fill(false);
this.$refs.popup.open('bottom');
},
/**
* 选择图片
*/
chooseImageChange(key) {
this.noexebshowFalg = false;
// 使用 chooseImage选择图片
uni.chooseMedia({
count: 5,
mediaType: ['image'],
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success: chooseImageRes => {
console.log('选择图片成功:', chooseImageRes);
// 显示loading
uni.showLoading({
title: '上传中...'
});
// 获取选择的图片路径数组
const imagePaths = chooseImageRes.tempFiles;
// 判断选择的图片数量是否超过最大限制数量
let maxNum = Number(imagePaths.length) + Number(this.image_list.length); //当前上传的+已经上传的
if (maxNum > 5) {
uni.hideLoading();
uni.showToast({
title: '图片不超过5张',
icon: 'none'
});
return false;
}
// 遍历图片路径数组,对每张图片进行压缩
imagePaths.forEach((_imagePath, index) => {
// 使用compressImage 压缩图片
uni.compressImage({
src: imagePaths[index].tempFilePath,
quality: 60, //压缩质量,范围0~100,数值越小,质量越低,压缩率越高
success: compressedRes => {
console.log('压缩图片成功:', compressedRes);
// 获取压缩后的图片路径
const compressedImagePath = compressedRes.tempFilePath;
// 在这里处理压缩后的图片,上传到服务器
uni.uploadFile({
url: API.uploadImageHk + '?sys_type=4',
filePath: compressedImagePath,
name: 'file',
timeout: 10000,
header: {
'Content-Type': 'multipart/form-data'
},
success: uploadFileRes => {
console.log('服务器上传图片成功:', uploadFileRes);
uni.hideLoading();
let data = JSON.parse(uploadFileRes.data);
if (data.code === 0) {
this.image_list[key].push(data.data.oss_image_url);
this.$forceUpdate();
} else {
uni.showToast({
title: data.msg,
icon: 'none'
});
}
},
fail: () => {
uni.hideLoading();
uni.showToast({
title: '上传图片失败',
icon: 'none'
});
}
});
},
fail: err => {
console.log('压缩图片失败:', err);
}
});
});
}
});
},
/**
* 预览图片
* @param {Object} img
* @param {Object} index
*/
previewChange(img, index) {
this.noexebshowFalg = false;
uni.previewImage({
current: index,
urls: img
});
},
/**
* 删除图片
* @param {Object} index
*/
deletePic(index, i) {
this.image_list[index].splice(i, 1);
this.$forceUpdate();
},
/**
* 获取产地
*/
getOrigin() {
this.request(API.getOrigin, 'GET', { origin: this.origin }, true).then(res => {
if (res.err_code === 0) {
this.origin_list = Object.values(res.data);
this.filter_status = createArray(this.origin_list.length, false);
} else {
uni.showToast({
title: res.err_msg,
icon: 'none'
});
}
});
},
/**
* 获取锁定理货信息
*
*/
getTallyData() {
this.request(API.getTallyData, 'POST', { box_sn: this.box_sn }, true).then(res => {
if (res.err_code === 0) {
this.tallyData = res.data;
if (res.data.detail.length > 0) {
this.getOrigin();
// 使用 map 方法生成表单数组
this.form = res.data.detail.map((item) => ({
tally_num: item.tally_num, // 入库数量
origin: item.origin, // 原产地
net_weight: item.net_weight, // 净重
goods_check_pic: item.goods_check_pic, // 商检的必须上传图片
wstydl_id: item.wstydl_id, // 理货明细ID
erp_order_sn: this.erp_order_sn, // 入仓号
wsty_id: this.wsty_id, // 箱子id
is_goods_check: item.is_goods_check //是否商检
}));
this.image_list = res.data.detail.map(() => new Array()); //图片特殊处理
res.data.detail.forEach((item, index) => {
if (item.goods_check_pic) {
this.image_list[index] = item.goods_check_pic.split(',');
}
});
}
} else {
uni.showToast({
title: res.err_msg,
icon: 'none'
});
}
});
},
/**
* 理货明细提交
*/
submitTallyDetail(index) {
if (!this.form[index].tally_num) {
uni.showToast({
title: '入库数量必填',
icon: 'error'
});
return false;
}
if (!this.form[index].origin) {
uni.showToast({
title: '原产地必填',
icon: 'error'
});
return false;
}
if (!this.form[index].net_weight) {
uni.showToast({
title: '净重必填',
icon: 'error'
});
return false;
}
if (this.form[index].is_goods_check) {
if (!this.form[index].goods_check_pic) {
uni.showToast({
title: '该物料为商检,必须要上传图片',
icon: 'none'
});
return false;
}
}
this.request(API.submitTallyDetail, 'POST', this.form[index], true).then(res => {
if (res.err_code === 0) {
uni.showToast({
title: '提交成功',
icon: 'success',
duration: 2000
});
setTimeout(() => {
this.getTallyData();
}, 2000);
} else {
uni.showToast({
title: res.err_msg,
icon: 'none'
});
}
});
},
/**
* 理货明细撤销
*/
cancelTallyDetail(index) {
uni.showModal({
title: '提示',
content: '确定取消该商品理货吗?',
success: (res) => {
if (res.confirm) {
this.request(API.cancelTallyDetail, 'POST', { wstydl_id: this.form[index].wstydl_id, wsty_id: this.form[index].wsty_id }, true).then(res => {
if (res.err_code === 0) {
this.getTallyData(1);
} else {
uni.showToast({
title: res.err_msg,
icon: 'none'
});
}
});
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
}
} }
}; };
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.unboxing { @import '@/assets/css/tally/unboxing.scss';
margin-top: 24rpx;
height: 100vh;
padding: 0 24rpx;
overflow: hidden;
.input-box {
height: 88rpx;
background: #ffffff;
border-radius: 4rpx;
padding: 0 24rpx;
.uni-input {
font-weight: bold;
font-size: 28rpx;
color: #404547;
}
.btn { ::v-deep {
width: 144rpx; .uni-dialog-input {
height: 48rpx; font-size: 24rpx !important;
background: #197adb;
border-radius: 4rpx;
font-size: 24rpx;
color: #ffffff;
} }
.uni-dialog-title-text {
padding: 10px;
text-align: center;
color: #404547;
font-size: 26rpx !important;
font-weight: bold !important;
} }
} }
</style> </style>
\ No newline at end of file
// const API_BASE = 'https://api.ichunt.com'; // const API_BASE = 'https://api.ichunt.com';
// const API_BASE_OSS = 'https://image.ichunt.net'; //oss系统 // const API_BASE_OSS = 'https://image.ichunt.net'; //oss系统
// const API_BASE_OSS_HK = 'http://hk.image.semour.com'; //oss系统 HK
// const API_BASE_WMS = 'https://wms.ichunt.net'; //WMS系统 // const API_BASE_WMS = 'https://wms.ichunt.net'; //WMS系统
const API_BASE = 'http://api.liexin.com'; const API_BASE = 'http://api.liexin.com';
const API_BASE_OSS = 'http://image.liexindev.net'; const API_BASE_OSS = 'http://image.liexindev.net';
const API_BASE_OSS_HK = 'http://image.liexindev.net'; //oss系统 HK
const API_BASE_WMS = 'http://wms.liexindev.net'; //WMS系统 const API_BASE_WMS = 'http://wms.liexindev.net'; //WMS系统
...@@ -37,6 +39,10 @@ const API = { ...@@ -37,6 +39,10 @@ const API = {
* */ * */
uploadImage: API_BASE_OSS + '/uploadImage', uploadImage: API_BASE_OSS + '/uploadImage',
/** /**
* 上传文件
* */
uploadImageHk: API_BASE_OSS_HK + '/uploadImage',
/**
* 生成打印标签数据 * 生成打印标签数据
* */ * */
printLabel: API_BASE + '/supplywechatwms/printLabel', printLabel: API_BASE + '/supplywechatwms/printLabel',
......
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