Commit 9111c8a4 by LJM

优化

parent 23f21727
......@@ -156,7 +156,7 @@
height: 30rpx;
border-radius: 50%;
background-color: #bb3434;
z-index: 999;
z-index: 9;
.iconfont {
font-size: 20rpx;
color: #ffffff;
......
......@@ -19,12 +19,12 @@
<input class="uni-input" :disabled="tallyData.customer_name" :class="{ 'disabled': tallyData.customer_name }" placeholder="输入或扫描入仓号" placeholder-style="color:#000;font-weight: bold;" v-model="erp_order_sn" />
</view>
<view class="action-bar row verCenter">
<template v-if="tallyData.detail && tallyData.detail.length > 0">
<template v-if="tallyData.detail && tallyData.detail.length > 0 && step == 1">
<view class="btn1 row rowCenter verCenter" style="margin-right: 8rpx;">取消释放</view>
<view class="btn row rowCenter verCenter">关单封箱</view>
</template>
<template v-else>
<view class="btn row rowCenter verCenter" @click="getTallyData()">锁定理货</view>
<view class="btn row rowCenter verCenter" @click="getTallyData(1)">锁定理货</view>
</template>
</view>
</view>
......@@ -39,11 +39,16 @@
</picker>
</view>
<view class="input-box row verCenter">
<input class="uni-input" placeholder="输入或扫描" placeholder-style="color:#000;font-weight: bold;" />
<template v-if="index == 0">
<input class="uni-input" placeholder="输入或扫描" placeholder-style="color:#000;font-weight: bold;" v-model="goods_type" />
</template>
<template v-else>
<input class="uni-input" placeholder="输入或扫描" placeholder-style="color:#000;font-weight: bold;" v-model="keyword" />
</template>
</view>
</view>
<view class="action-bar">
<view class="btn1 row rowCenter verCenter">扫 描</view>
<view class="btn1 row rowCenter verCenter" @click="identifyQrCodeNumAndSn(2)">扫 描</view>
</view>
</view>
<view class="info row verCenter" v-if="tallyData && tallyData.detail">
......@@ -73,6 +78,7 @@
</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">
......@@ -133,18 +139,19 @@
<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, index) in image_list" :key="index">
<image :src="v" mode="aspectFill" lazy-load="true" @click="previewChange(image_list, index)"></image>
<view class="delete row rowCenter verCenter" @click="deletePic(index)"><text class="iconfont icon-shanchu"></text></view>
<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()" v-if="image_list.length < 5"><text class="iconfont icon-xingzhuangjiehe"></text></view>
<view class="default row rowCenter verCenter" @click="chooseImageChange(index)" v-if="image_list.length < 5"><text class="iconfont icon-xingzhuangjiehe"></text></view>
</view>
<view class="btn row rowCenter verCenter">提 交</view>
<view class="btn row rowCenter verCenter" @click="submitTallyDetail(index)">提 交</view>
</view>
</view>
</scroll-view>
</view>
<!-- 操作栏 -->
<view class="btn-list row verCenter bothSide" v-if="!tallyData.detail">
<navigator url="/pages/tally/fixBox" class="box row rowCenter verCenter" hover-class="none">合 箱</navigator>
<navigator url="/pages/tally/unboxing" class="box row rowCenter verCenter" hover-class="none">重新开箱</navigator>
......@@ -185,6 +192,8 @@
export default {
data() {
return {
step: 1,
keyword: '',
curr: -1, //当前打开的是哪个产地
fixBoxStyle: '',
noexebshowFalg: true, //控制是否会触发生命周期
......@@ -192,6 +201,7 @@
index: 0,
item: ['其他', 'digikey', 'mouser', 'future', 'TI'],
box_sn: '', //箱号信息
wsty_id: '', //箱子id
erp_order_sn: '', //入仓号
goods_type: '', //商品型号
tallyData: {}, //理货信息
......@@ -199,9 +209,19 @@
filter_status: [], //控制状态
origin_list: [], //产地
origin: '', //搜索国家携带的参数
form: {}
form: {},
isRequestSent: false,
isStopRequest: false
};
},
watch: {
image_list(arr) {
arr.forEach((item, index) => {
// 将数组元素用逗号连接成字符串,并赋值给对应的 form 中的 goods_check_pic 字段
this.form[index].goods_check_pic = item.length > 0 ? item.join(',') : '';
});
}
},
created() {
this.getOrigin();
},
......@@ -261,7 +281,7 @@
/**
* 选择图片
*/
chooseImageChange() {
chooseImageChange(key) {
this.noexebshowFalg = false;
// 使用 chooseImage选择图片
uni.chooseMedia({
......@@ -316,7 +336,7 @@
uni.hideLoading();
let data = JSON.parse(uploadFileRes.data);
if (data.code === 0) {
this.image_list.push(data.data.oss_image_url);
this.image_list[key].push(data.data.oss_image_url);
} else {
uni.showToast({
title: data.msg,
......@@ -357,8 +377,57 @@
* 删除图片
* @param {Object} index
*/
deletePic(index) {
this.image_list.splice(index, 1);
deletePic(index, i) {
this.image_list[index].splice(i, 1);
},
/**
* 识别
*/
identifyQrCodeNumAndSn(type) {
if (!this.box_sn) {
uni.showModal({
title: '',
content: '请先取箱号!并将打印的箱号贴于外箱上',
showCancel: false
});
return false;
}
if (this.index == 0) {
//区分其他
this.getTallyData(type);
} else {
let codeTypeByIndex = {
3: 'DigiKey',
4: 'Rochester',
5: 'TME',
6: 'Chip1stop',
7: 'Mouser'
};
let codeType = codeTypeByIndex[this.index] || '';
let device = uni.getDeviceInfo();
//匹配到内容才开始调接口
if (!this.isRequestSent) {
this.isRequestSent = true; // 设置标志,防止重复发送请求
this.request(API.identifyQrCodeNumAndSn, 'POST', { data: this.keyword, type: codeType, device: device.deviceModel }, true).then(res => {
this.isRequestSent = false; // 请求完成后重置标志
if (res.code === 0) {
//如果后台搜索到型号则替换输入框的值
if (res.data.model) {
this.keyword = res.data.model;
}
this.goods_type = res.data.model; //赋值检索出来的型号
this.getTallyData(type);
} else {
uni.showToast({
title: res.msg,
icon: 'none'
});
}
});
}
}
},
/**
* 获取箱号
......@@ -367,6 +436,7 @@
this.request(API.getBoxSn, 'POST', {}, true).then(res => {
if (res.err_code === 0) {
this.box_sn = res.data.box_sn;
this.wsty_id = res.data.wsty_id;
} else {
uni.showToast({
title: res.err_msg,
......@@ -393,8 +463,9 @@
},
/**
* 获取锁定理货信息
* @param {Object} type 1 锁定理货 2 其他及供应商
*/
getTallyData() {
getTallyData(type) {
if (!this.box_sn) {
uni.showModal({
title: '',
......@@ -403,6 +474,7 @@
});
return false;
}
if (type == 1) {
if (!this.erp_order_sn) {
uni.showToast({
title: '请输入入仓号',
......@@ -410,7 +482,8 @@
});
return false;
}
}
this.step = type; //记录当前哪个按钮操作
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) {
this.tallyData = res.data;
......@@ -420,12 +493,62 @@
tally_num: '', // 入库数量
origin: '', // 原产地
net_weight: '', // 净重
wstydl_id: '', // 理货明细ID
erp_order_sn: '', // 入仓号
wsty_id: '', // 箱子id
goods_check_pic: '' // 商检的必须上传图片
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_cn: item.is_goods_check_cn //是否商检
}));
this.image_list = res.data.detail.map(() => new Array()); //图片特殊处理
}
} else {
uni.showToast({
title: res.err_msg,
icon: 'none'
});
}
});
},
/**
* 理货明细提交
*/
submitTallyDetail(index) {
if (!this.form[index].tally_num) {
uni.showToast({
title: '入库数量必填',
icon: 'none'
});
return false;
}
if (!this.form[index].origin) {
uni.showToast({
title: '原产地必填',
icon: 'none'
});
return false;
}
if (!this.form[index].net_weight) {
uni.showToast({
title: '净重必填',
icon: 'none'
});
return false;
}
if (this.form[index].is_goods_check_cn) {
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) {
} else {
uni.showToast({
title: res.err_msg,
......
......@@ -6,6 +6,7 @@ const API_BASE = 'http://api.liexin.com';
const API_BASE_OSS = 'http://image.liexindev.net';
const API_BASE_WMS = 'http://wms.liexindev.net'; //WMS系统
const API = {
/**
* 上传数据
......@@ -282,7 +283,11 @@ const API = {
/**
* 合箱
*/
fixBox: API_BASE + '/supplywechatwms/fixBox'
fixBox: API_BASE + '/supplywechatwms/fixBox',
/**
* 识别二维码的数量和型号
* */
identifyQrCodeNumAndSn: API_BASE_WMS + '/api/stockIn/identifyQrCodeNumAndSn',
}
......
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