Commit 40911097 by LJM

优化

parent 41fc4af2
......@@ -98,7 +98,7 @@
<view class="btn row rowCenter verCenter">上架</view>
</navigator>
</view>
<view class="row rowCenter verCenter" v-if="!hasMoreData && page > 1" style="color: #919399;font-size: 16px;padding: 10px 0;flex: 0 0 100%;">--已经到底了--</view>
<view class="row rowCenter verCenter" v-if="!hasMoreData && page > 1" style="color: #999;font-size: 22rpx;padding: 10px 0;flex: 0 0 100%;font-weight: normal;">--&nbsp;已经到底了&nbsp;--</view>
</view>
<!-- 无数据展示 -->
<view class="no-date column rowCenter verCenter" v-else>
......
......@@ -13,7 +13,7 @@
<view class="row verCenter">
<text class="iconfont icon-juxing1"></text>
<template v-if="index == 0">
<input class="uni-input" placeholder="请扫描或输入号码" placeholder-style="color:#919399" focus v-model="searchParams.mobile_wait_tally_all_search" @input="handleInput(1, $event)" />
<input class="uni-input" placeholder="请扫描或输入查询" placeholder-style="color:#919399" focus v-model="searchParams.mobile_wait_tally_all_search" @input="handleInput(1, $event)" />
</template>
<template v-else-if="index == 1">
<input class="uni-input" placeholder="请输入入仓号" placeholder-style="color:#919399" focus v-model="searchParams.stock_in_with_stock_in_items_inhouse" @input="handleInput(2, $event)" maxlength="8" />
......@@ -43,7 +43,7 @@
<view class="search-bar row bothSide verCenter">
<view class="row verCenter">
<text class="iconfont icon-juxing1"></text>
<input class="uni-input" placeholder="请输入容器编码" placeholder-style="color:#919399" focus v-model="searchParams.container_name" @input="handleInput(3, $event)" />
<input class="uni-input" placeholder="请输入容器编码" placeholder-style="color:#919399" v-model="searchParams.container_name" @input="handleInput(3, $event)" />
</view>
<view>
<text class="iconfont icon-juxing3" @click="createTallyContainer()"></text>
......@@ -120,11 +120,13 @@
<view class="btn row rowCenter verCenter">理货</view>
</navigator>
</view>
<view class="row rowCenter verCenter" v-if="!hasMoreData && page > 1" style="color: #999;font-size: 22rpx;padding: 10px 0;flex: 0 0 100%;font-weight: normal;">--&nbsp;已经到底了&nbsp;--</view>
</view>
<view class="no-date column rowCenter verCenter" v-else>
<text class="iconfont icon-a-juxing21"></text>
<text class="text">查不到当前数据</text>
</view>
<!-- 底部bar -->
<view class="fix-btn row verCenter">
<view class="btn1 row rowCenter verCenter" @click="allChnage()">
<text class="check-box-icon" :class="{ curr: filter_list.length > 0 && filter_list.length == filter_id.length }"></text>
......@@ -209,7 +211,7 @@
company_id: uni.getStorageSync('company_id') || 1, //公司组织
all_flag: false, //全选标记
page: 1,
limit: 50,
limit: 50, //分页限制数量
index: 0,
indexContainer: -1,
array: ['全量搜索', '入仓号', 'FedEx', 'DigKey', 'Rochester'],
......@@ -233,7 +235,7 @@
formParams: {
container_id: '',
tally_remark: '',
image_ids: '',
image_ids: '', //理货照片集合
is_print: 1
}
};
......@@ -264,7 +266,7 @@
onShow() {
if (this.noexebshowFalg) {
this.resetChange();
this.getTallyContainerDefault();
this.getData();
}
},
methods: {
......@@ -325,55 +327,57 @@
/**
*刷新容器
*/
createTallyContainer(type) {
if (type == 1) {
var params = {
is_mac: 1
};
} else {
var params = {};
}
this.request(API.createTallyContainer, 'GET', params, true).then(res => {
createTallyContainer() {
this.request(API.createTallyContainer, 'GET', {}, true).then(res => {
if (res.code === 0) {
this.searchParams.container_name = res.data.container_sn;
this.searchParams.container_id = res.data.id;
this.formParams.container_id = res.data.id;
this.searchParams.container_name = res.data.container_sn; //赋值搜索参数容器名字
this.searchParams.container_id = res.data.id; //赋值搜索参数容器id
this.formParams.container_id = res.data.id; //赋值参数容器id
this.is_submit = true;
} else {
uni.showToast({
title: res.msg,
icon: 'error'
icon: 'none'
});
}
});
},
/**
* 清空数据
* 清空数据 1(全量搜索,入仓号,FedEx,DigKey,Rochester,TME,Chip1stop)
* @param {Object} type
*/
clearInput(type) {
this.resetChange();
if (type == 1) {
this.input_flag = false;
if (this.index == 0) {
//清空全量搜索
this.searchParams.mobile_wait_tally_all_search = '';
} else if (this.index == 1) {
//清空入仓号
this.searchParams.stock_in_with_stock_in_items_inhouse = '';
} else if (this.index == 2) {
//清空FedEx
this.searchParams.tracking_no = '';
} else if (this.index == 3) {
//清空DigKey以及赋值的goods_name
this.searchParams.code_type = '';
this.searchParams.goods_name = '';
} else if (this.index == 4) {
//清空Rochester供应商以及赋值的goods_name
this.searchParams.code_type = '';
this.searchParams.goods_name = '';
} else if (this.index == 5) {
//清空TME供应商以及赋值的goods_name
this.searchParams.code_type = '';
this.searchParams.goods_name = '';
} else if (this.index == 6) {
//清空Chip1stop供应商以及赋值的goods_name
this.searchParams.code_type = '';
this.searchParams.goods_name = '';
}
} else {
//容器以及一键理货里面的容器
this.input_contaion = false;
this.searchParams.container_name = '';
this.searchParams.container_id = '';
......@@ -381,59 +385,60 @@
this.getData();
},
/**
* 单号搜索
* @param {Object} type 1:全量搜索 2:入仓号 3:一键理货的容器监听 0:FedEx
* @param {Object} event
* 单号搜索
*/
handleInput: debounce(function(type, event) {
var val = event.target.value;
if (val) {
if (type == 1) {
this.resetChange();
this.searchParams.mobile_wait_tally_all_search = '';
this.searchParams.stock_in_with_stock_in_items_inhouse = '';
this.searchParams.tracking_no = '';
this.searchParams.code_type = '';
//全量搜索
this.resetChange(); //先清空数据
this.searchParams.stock_in_with_stock_in_items_inhouse = ''; //清空入仓号字段
this.searchParams.tracking_no = ''; //清空FedEx
this.searchParams.code_type = ''; //清空DigKey等一系列供应商
this.searchParams.mobile_wait_tally_all_search = val;
this.searchParams.mobile_wait_tally_all_search = val; //赋值全量搜索字段
this.input_flag = true;
this.getData();
} else if (type == 2) {
//入仓号搜索
this.resetChange();
this.searchParams.mobile_wait_tally_all_search = '';
this.searchParams.stock_in_with_stock_in_items_inhouse = '';
this.searchParams.tracking_no = '';
this.searchParams.code_type = '';
this.searchParams.mobile_wait_tally_all_search = ''; //清空全量搜索字段
this.searchParams.tracking_no = ''; //清空FedEx
this.searchParams.code_type = ''; //清空DigKey等一系列供应商
//入仓号
//处理F号开头
var str = val;
if (str.startsWith('F')) {
this.searchParams.stock_in_with_stock_in_items_inhouse = val;
this.searchParams.stock_in_with_stock_in_items_inhouse = val; //赋值入仓号
} else {
this.searchParams.stock_in_with_stock_in_items_inhouse = str.slice(0, -1);
this.searchParams.stock_in_with_stock_in_items_inhouse = str.slice(0, -1); //赋值入仓号
}
this.input_flag = true;
this.getData();
} else if (type == 3) {
//容器 && 一键理货的容器监听
this.searchParams.container_name = val;
this.input_contaion = true;
this.getTallyContainer();
//注意,此时不刷新列表,是给一键理货用的
} else if (type == 0) {
//选择了fedex
this.resetChange();
this.searchParams.mobile_wait_tally_all_search = '';
this.searchParams.stock_in_with_stock_in_items_inhouse = '';
this.searchParams.tracking_no = '';
this.searchParams.code_type = '';
var last12 = val.slice(22); // 截取后12位
this.searchParams.tracking_no = last12;
this.searchParams.mobile_wait_tally_all_search = ''; //清空全量搜索字段
this.searchParams.stock_in_with_stock_in_items_inhouse = ''; //清空入仓号字段
this.searchParams.code_type = ''; //清空DigKey等一系列供应商
// 规则处理FedEx截取后12位
let last12 = val.slice(22);
this.searchParams.tracking_no = last12; //赋值FedEx
this.input_flag = true;
this.getData();
} else if (type == 3) {
//一键理货的容器监听
this.searchParams.container_name = val;
this.input_contaion = true;
this.getTallyContainer();
}
} else {
if (type == 1 || type == 2) {
if (type == 1 || type == 2 || type == 0) {
//清空全量搜索和入仓号搜索和FedEx
this.resetChange();
this.input_flag = false;
this.getData();
......@@ -444,17 +449,20 @@
this.input_contaion = false;
}
}
}, 800),
}, 500),
/**
* DigKey,Rochester,TME,Chip1stop供应商
* @param {Object} event
*
*/
handleInputChange: debounce(function(event) {
var val = event.target.value;
if (val) {
this.resetChange();
this.searchParams.mobile_wait_tally_all_search = '';
this.searchParams.stock_in_with_stock_in_items_inhouse = '';
this.searchParams.tracking_no = '';
this.searchParams.code_type = '';
this.searchParams.code_type = val;
this.resetChange(); //先清空数据
this.searchParams.mobile_wait_tally_all_search = ''; //清空全量搜索字段
this.searchParams.stock_in_with_stock_in_items_inhouse = ''; //清空入仓号字段
this.searchParams.tracking_no = ''; //清空FedEx
this.searchParams.code_type = val; //赋值DigKey,Rochester,TME,Chip1stop供应商
let code_type = '';
if (this.index == 3) {
code_type = 'DigKey';
......@@ -468,51 +476,15 @@
this.input_flag = true;
this.identifyQrCodeNumAndSn(val, code_type); //识别二维码的数量和型号
} else {
this.resetChange();
this.input_flag = false;
this.getData();
}
}, 2000),
bindPickerChange: function(e) {
console.log('picker发送选择改变,携带值为', e.detail.value);
this.index = e.detail.value;
},
/**
* 识别二维码的数量和型号
*/
identifyQrCodeNumAndSn(code_str, code_type) {
console.log(code_str);
this.request(API.identifyQrCodeNumAndSn, 'POST', { code_str: code_str, code_type: code_type }, true).then(res => {
if (res.code === 0) {
this.searchParams.goods_name = res.data.sn;
this.getData();
} else {
uni.showToast({
title: '识别错误',
icon: 'error'
});
}
});
},
/**
* 获取列表数据
*/
getData() {
this.request(API.waitTallyReceiveList, 'POST', { page: this.page, limit: this.limit, ...this.searchParams }, false).then(res => {
if (res.code === 0) {
if (res.data.total > 0) {
this.hasMoreData = true;
this.list = this.list.concat(res.data.list);
this.filter_list = createArray(this.list.length, false);
} else {
this.hasMoreData = false;
}
} else {
uni.showToast({
title: res.msg,
icon: 'error'
});
}
});
},
//设置默认的容器
getTallyContainerDefault() {
this.request(API.getTallyContainer, 'GET', {}, false).then(res => {
......@@ -525,32 +497,29 @@
}
});
if (filter_arr.length > 0) {
//取消默认的容器
this.searchParams.container_name = '';
this.searchParams.container_id = '';
this.formParams.container_id = '';
//设置默认容器name和id
}
this.getData();
} else {
uni.showToast({
title: res.msg,
icon: 'error'
icon: 'none'
});
}
});
},
/**
* 获取容器列表数据
* 获取容器列表数据 && 验证容器是否输入正确
*/
getTallyContainer() {
this.request(API.getTallyContainer, 'GET', {}, false).then(res => {
this.request(API.getTallyContainer, 'GET', {}, true).then(res => {
if (res.code === 0) {
var name = this.searchParams.container_name;
var name = this.searchParams.container_name; //输入的容器名字
//验证容器是否输入正取
this.is_submit = res.data.list.some(function(obj) {
return obj.name === name;
});
if (this.is_submit) {
//筛选出匹配正确的那条容器
var id = res.data.list.filter(function(item) {
if (item.name == name) {
return {
......@@ -558,15 +527,56 @@
};
}
});
this.searchParams.container_id = id[0].id;
this.formParams.container_id = id[0].id;
this.searchParams.container_id = id[0].id; //赋值正确的搜索容器id
this.formParams.container_id = id[0].id; //赋值正确的参数容器id
} else {
//如果容器检验错误,就清空搜索容器id和参数容器id
this.searchParams.container_id = '';
this.formParams.container_id = '';
}
} else {
uni.showToast({
title: res.msg,
icon: 'none'
});
}
});
},
/**
* 识别二维码的数量和型号
* @param {Object} code_str 输入值
* @param {Object} code_type 供应商类型(DigKey,Rochester,TME,Chip1stop)
*/
identifyQrCodeNumAndSn(code_str, code_type) {
console.log(code_str);
this.request(API.identifyQrCodeNumAndSn, 'POST', { code_str: code_str, code_type: code_type }, true).then(res => {
if (res.code === 0) {
this.searchParams.goods_name = res.data.sn; //赋值检索出来的型号
this.getData();
} else {
uni.showToast({
title: '识别错误',
icon: 'error'
});
}
});
},
/**
* 获取列表数据 支持分页
*/
getData() {
this.request(API.waitTallyReceiveList, 'POST', { page: this.page, limit: this.limit, ...this.searchParams }, false).then(res => {
if (res.code === 0) {
if (res.data.total > 0) {
this.hasMoreData = true;
this.list = this.list.concat(res.data.list);
this.filter_list = createArray(this.list.length, false);
} else {
this.hasMoreData = false;
}
} else {
uni.showToast({
title: res.msg,
icon: 'error'
});
}
......@@ -576,7 +586,7 @@
* 一键理货提交
*/
createTallyReceiveSubmit() {
// 现在需求是都去掉容器必填的验证
// 验证一下容器是否输入正确
if (!this.is_submit) {
uni.showToast({
title: '请输入正确容器',
......@@ -584,7 +594,6 @@
});
return false;
}
//当前登录组织为深贸电子才必填
if (this.company_id == 2) {
if (this.formParams.image_ids.length <= 0) {
......@@ -595,11 +604,9 @@
return false;
}
}
var params = Object.assign(this.formParams, {
stock_in_item_id: this.filter_id.join(',')
});
this.request(API.createTallyReceive, 'POST', params, true).then(res => {
if (res.code === 0) {
uni.showToast({
......@@ -607,6 +614,7 @@
icon: 'success'
});
setTimeout(() => {
this.filter_id = []; //清空选中状态
this.resetChange();
this.getData();
this.closeDrawer();
......@@ -620,8 +628,11 @@
}
});
},
/**
* 打开一键理货弹窗
*/
showDrawer() {
// 现在需求是都去掉容器必填的验证
// 验证一下容器是否输入正确
if (!this.is_submit) {
uni.showToast({
title: '请输入正确容器',
......@@ -629,7 +640,6 @@
});
return false;
}
if (this.filter_id.length == 0) {
uni.showToast({
title: '请选择货品',
......@@ -637,11 +647,14 @@
});
return false;
}
this.image_list = [];
this.formParams.image_ids = []; //每次打开先清空
this.formParams.tally_remark = ''; //每次打开先清空
this.image_list = []; //清空缓存的图片集合
this.formParams.image_ids = []; //每次打开先清空图片集合
this.formParams.tally_remark = ''; //每次打开先清空理货备注
this.$refs.showRight.open();
},
/**
* 关闭一键理货弹窗
*/
closeDrawer() {
this.$refs.showRight.close();
},
......
......@@ -131,11 +131,13 @@
<view class="detail-btn row rowCenter verCenter" @click="showDrawer(item)">详情</view>
</view>
</view>
<view class="row rowCenter verCenter" v-if="!hasMoreData && page > 1" style="color: #999;font-size: 22rpx;padding: 10px 0;flex: 0 0 100%;font-weight: normal;">--&nbsp;已经到底了&nbsp;--</view>
</view>
<view class="no-date column rowCenter verCenter" v-else>
<text class="iconfont icon-a-juxing21"></text>
<text class="text">查不到当前数据</text>
</view>
<!-- 底部bar -->
<view class="fix-btn row verCenter" v-if="list.length > 0">
<view class="btn1 row rowCenter verCenter" style="width: 127rpx;" @click="allChnage()">
<text class="check-box-icon" :class="{ curr: filter_list.length > 0 && filter_list.length == filter_id.length }"></text>
......@@ -182,8 +184,8 @@
<text>货品信息</text>
</template>
</view>
<template v-if="curr == 0">
<!-- 非深圳自营 -->
<template v-if="curr == 0">
<view class="field-item row">
<view class="item row verCenter">
<text class="label">货品编码:</text>
......@@ -298,8 +300,8 @@
</view>
</view>
</template>
<template v-else>
<!-- 深圳自营 -->
<template v-else>
<view class="field-item row">
<view class="item row verCenter" style="flex: 0 0 100%;" v-if="detail.sku_id">
<text class="label">自营货品ID:</text>
......@@ -365,7 +367,9 @@
</view>
</uni-drawer>
<!-- 修改容器 -->
<uni-popup ref="inputDialog" type="dialog"><uni-popup-dialog before-close="true" ref="inputClose" mode="input" :title="'当前容器:' + detail.container_sn" placeholder="请输入目的容器" @close="closeChange" @confirm="dialogInputConfirm"></uni-popup-dialog></uni-popup>
<uni-popup ref="inputDialog" type="dialog">
<uni-popup-dialog before-close="true" ref="inputClose" mode="input" :title="'当前容器:' + detail.container_sn" placeholder="请输入目的容器" @close="closeChange" @confirm="dialogInputConfirm"></uni-popup-dialog>
</uni-popup>
</view>
</template>
......@@ -378,7 +382,7 @@
data() {
return {
page: 1,
limit: 50,
limit: 50, //分页限制数量
input_flag: false,
index: 0,
curr: 0,
......@@ -389,7 +393,6 @@
filter_list: [], //筛选已选中的列表
filter_id: [], //入库单列表的入库登记
detail: {}, //详情的数据
image_list: [], //图片列表
hasMoreData: true, //是否分页加载
image_list: [], //图片列表
maxNum: 10, //最大上传图片数量
......@@ -405,7 +408,7 @@
},
changeStockTallyImagesParams: {
tally_id: '',
image_ids: ''
image_ids: '' //修改理货照片集合
}
};
},
......@@ -468,6 +471,7 @@
*/
radioChange(e, type) {
let value = e.detail.value;
this.filter_id = []; //清空统计数据
this.resetChange();
if (type == 1) {
this.searchParams.stock_tally_with_stock_in_stock_in_type_in = value;
......@@ -504,12 +508,20 @@
console.log('picker发送选择改变,携带值为', e.detail.value);
this.index = e.detail.value;
},
/**
* 容器编辑弹窗
* @param {Object} detail
*/
inputDialogToggle(detail) {
this.$refs.inputDialog.open();
},
closeChange() {
this.$refs.inputDialog.close();
},
/**
* 修改容器提交
* @param {Object} e
*/
dialogInputConfirm(e) {
if (!e) {
uni.showToast({
......@@ -741,8 +753,8 @@
});
setTimeout(() => {
this.resetChange();
this.getData();
this.filter_id = [];
this.getData();
}, 2000)
}, 5000);
} else {
......
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