Commit 7a2b57b9 by LJM

优化

parent fb29a294
Showing with 82 additions and 26 deletions
......@@ -21,8 +21,8 @@
<input class="uni-input" :focus="is_focus_2" :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 class="action-bar row verCenter">
<text class="iconfont icon-jinggao2" @click="clearInput(2)" v-if="erp_order_sn && form.length == 0"></text>
<template v-if="tallyData.detail && tallyData.detail.length > 0 && step == 1 && erp_order_sn != ''">
<text class="iconfont icon-jinggao2" @click="clearInput(2)" v-if="erp_order_sn"></text>
<template v-if="form.length > 0 && step == 1 && erp_order_sn != ''">
<view class="btn1 row rowCenter verCenter" style="margin-right: 8rpx;" @click="cancelRelease()">取消释放</view>
<view class="btn row rowCenter verCenter" @click="closeBox()">关单封箱</view>
</template>
......@@ -48,7 +48,7 @@
</template>
<!-- digikey等供应商-->
<template v-else>
<input class="uni-input" :focus="is_focus_3" placeholder="输入或扫描" placeholder-style="color:#000;font-weight: bold;" v-model="keyword" @input="handleInput($event,2)" />
<input class="uni-input" :focus="is_focus_3" :confirm-type="'none'" :hold-keyboard="false" placeholder="输入或扫描" placeholder-style="color:#000;font-weight: bold;" v-model="keyword" @input="handleInput($event,2)" />
</template>
</view>
</view>
......@@ -86,16 +86,21 @@
</view>
</view>
<!-- 列表 -->
<view class="list" v-if="tallyData && tallyData.detail">
<view class="list" v-if="form.length > 0">
<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 class="pb16 row bothSide verCenter">
<view class="row" style="width: 50%;">
<text class="t3 w130">物料名称:</text>
<text class="t4">{{item.goods_title}}</text>
</view>
<view class="row" style="width: 50%;justify-content: flex-end;" v-if="item.tally_status == 3">
<text class="t4" style="text-align: right;color: #197adb;">{{item.box_sn}}</text>
</view>
</view>
<view class="pb16 row">
<text class="t3 w130">品牌:</text>
......@@ -115,7 +120,7 @@
<!-- 完全理货 -->
<template v-if="item.tally_status == 3">
<view class="row">
<text class="t3 w130" style="text-align: right;">总数量:</text>
<text class="t3 w130">总数量:</text>
<text class="t4">{{item.order_numbers}}</text>
</view>
</template>
......@@ -187,6 +192,12 @@
</view>
</scroll-view>
</view>
<!-- 无数据 -->
<view class="no-data column verCenter rowCenter" v-if="form.length == 0 && tallyData.create_time_cn">
<text class="iconfont icon-jinggao2"></text>
<text class="text">查找不到相关信息</text>
<text class="p">1、请输入正确的入仓号和型号</text>
</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>
......@@ -204,7 +215,7 @@
<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>
<text class="text">{{ item.name }}</text>
<view class="check-ico"></view>
</view>
</template>
......@@ -295,6 +306,7 @@
bindPickerChange: function(e) {
console.log('picker发送选择改变,携带值为', e.detail.value);
this.index = e.detail.value;
this.clearInput(3);
},
/**
*筛选过滤出选中的元素
......@@ -302,7 +314,7 @@
filterChange(index) {
this.$set(this.filter_status, index, (this.filter_status[index] = !this.filter_status[index]));
let filter_arr = this.findIndex(this.filter_status, true);
let name = filter_arr.map(i => this.origin_list[i]);
let name = filter_arr.map(i => this.origin_list[i].value);
this.form[this.curr].origin = name[0];
this.$forceUpdate();
this.$refs.popup.close();
......@@ -325,6 +337,7 @@
}
} else if (type == 2) {
if (value) {
uni.hideKeyboard()
this.identifyQrCodeNumAndSn();
} else {
this.goods_type = '';
......@@ -333,7 +346,7 @@
}
} else if (type == 3) {
this.origin_list = []; //数组清空
this.getOrigin();
this.getOriginCn();
}
}, 500),
/**
......@@ -543,7 +556,6 @@
});
return false;
}
this.step = 2; //标记点击了哪个按钮
if (this.index == 0) {
//区分其他
this.keyword = '';
......@@ -563,14 +575,27 @@
this.isRequestSent = true; // 设置标志,防止重复发送请求
this.request(API.scanQrCode, 'POST', { data: this.keyword, type: codeType, device: device.deviceModel }, true).then(res => {
this.isRequestSent = false; // 请求完成后重置标志
if (res.code === 0) {
if (res.err_code === 0) {
//如果后台搜索到型号则替换输入框的值
let model = res.data.model || res.data.model2;
if (model) {
this.keyword = model; //兼容TME
this.goods_type = model; //赋值检索出来的型号
}
this.getTallyData();
this.getTallyData((json) => {
//解析出一个物料的情况下才执行此操作
if (json.length == 1) {
//解析处理的产地
if (res.data.origin) {
var originIndex = this.origin_list.findIndex(item => item.name.split('|').includes(res.data.origin)); //通过英文去匹配出对应的中文国家
this.$set(this.form[0], 'origin', this.origin_list[originIndex].value);
}
//解析处理的数量
if (res.data.qty) {
this.$set(this.form[0], 'tally_num', res.data.qty);
}
}
});
} else {
uni.showToast({
title: res.msg,
......@@ -625,6 +650,22 @@
});
},
/**
* 获取产地升级版
*/
getOriginCn() {
this.request(API.getOriginCn, 'GET', { coo: this.origin }, true).then(res => {
if (res.err_code === 0) {
this.origin_list = res.data;
this.filter_status = createArray(this.origin_list.length, false);
} else {
uni.showToast({
title: res.err_msg,
icon: 'none'
});
}
});
},
/**
* 锁定理货
*/
lockTally() {
......@@ -650,12 +691,12 @@
* 获取锁定理货信息
*
*/
getTallyData() {
getTallyData(callback) {
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;
if (res.data.detail.length > 0) {
this.getOrigin(); //获取产地
this.getOriginCn(); //获取产地
// 使用 map 方法生成表单数组
this.form = res.data.detail.map((item) => ({
......@@ -679,11 +720,10 @@
this.image_list[index] = item.goods_check_pic.split(',');
}
});
typeof callback == 'function' && callback(this.form);
} else {
uni.showToast({
title: '查询不到该箱号信息',
icon: 'none'
});
this.form = [];
}
} else {
uni.showToast({
......@@ -697,6 +737,14 @@
* 理货明细提交
*/
submitTallyDetail(index) {
if (!this.box_sn) {
uni.showModal({
title: '',
content: '请先取箱号!并将打印的箱号贴于外箱上',
showCancel: false
});
return false;
}
if (!this.form[index].tally_num) {
uni.showToast({
title: '入库数量必填',
......@@ -738,11 +786,16 @@
this.getTallyData();
}, 2000);
} else if (res.err_code === 10000) {
console.log(res.err_msg)
uni.showModal({
title: '',
content: res.err_msg,
showCancel: false
showCancel: false,
success: (res) => {
if (res.confirm) {
// 用户点击确定按钮后的操作
this.getTallyData();
}
}
});
} else {
uni.showToast({
......@@ -783,17 +836,15 @@
cancelRelease() {
uni.showModal({
title: '提示',
content: '确定取消释放该号吗?',
content: '确定取消释放该入仓号吗?',
success: (res) => {
if (res.confirm) {
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) {
this.tallyData = [];
this.box_sn = '';
this.wsty_id = '';
this.erp_order_sn = '';
this.goods_type = '';
this.keyword = '';
this.tallyData = [];
this.form = [];
} else {
uni.showToast({
......@@ -926,6 +977,7 @@
setTimeout(() => {
this.is_focus_2 = true;
}, 200);
this.getTallyData();
} else if (type == 3) {
this.goods_type = '';
this.keyword = '';
......
......@@ -203,6 +203,10 @@ const API = {
*/
getOrigin: API_BASE + '/supplywechatwms/getOrigin',
/**
* 获取产地升级版
*/
getOriginCn: API_BASE + '/supplywechatwms/getOriginCn',
/**
* 获取合箱子入仓号
*/
getFixErpOrderSn: API_BASE + '/supplywechatwms/getFixErpOrderSn',
......
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