Commit e1972a83 by LJM

移动端拣货打印标签显示异常

parent 9517a3e0
Showing with 681 additions and 672 deletions
...@@ -56,12 +56,12 @@ ...@@ -56,12 +56,12 @@
<!-- 出库单状态为全部锁库,则显示【释放】、【选择】按钮 --> <!-- 出库单状态为全部锁库,则显示【释放】、【选择】按钮 -->
<template v-if="item.stock_out_status == 3"> <template v-if="item.stock_out_status == 3">
<view class="btn1 row rowCenter verCenter" @click="cancelTake(item.stock_out_id)">释放</view> <view class="btn1 row rowCenter verCenter" @click="cancelTake(item.stock_out_id)">释放</view>
<navigator :url="'/pages/picking/sort?stock_out_id=' + item.stock_out_id + '&stock_out_sn=' + item.stock_out_sn" hover-class="none" class="btn3 row rowCenter verCenter">选择</navigator> <navigator :url="'/pages/picking/sort?stock_out_id=' + item.stock_out_id + '&stock_out_sn=' + item.stock_out_sn+'&warehouse_id='+item.warehouse_id" hover-class="none" class="btn3 row rowCenter verCenter">选择</navigator>
</template> </template>
<!--出库单状态为部分拣货--> <!--出库单状态为部分拣货-->
<template v-if="item.stock_out_status == 4"> <template v-if="item.stock_out_status == 4">
<navigator :url="'/pages/picking/sort?stock_out_id=' + item.stock_out_id + '&stock_out_sn=' + item.stock_out_sn" hover-class="none" class="btn3 row rowCenter verCenter">选择</navigator> <navigator :url="'/pages/picking/sort?stock_out_id=' + item.stock_out_id + '&stock_out_sn=' + item.stock_out_sn+'&warehouse_id='+item.warehouse_id" hover-class="none" class="btn3 row rowCenter verCenter">选择</navigator>
</template> </template>
<!--出库单状态为全部拣货--> <!--出库单状态为全部拣货-->
...@@ -80,124 +80,124 @@ ...@@ -80,124 +80,124 @@
</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';
export default { export default {
data() { data() {
return { return {
input_flag: false, input_flag: false,
index: 0, index: 0,
array: ['出库单号'], array: ['出库单号'],
list: [], list: [],
page: 1, page: 1,
limit: 20, limit: 20,
hasMoreData: true, //是否分页加载 hasMoreData: true, //是否分页加载
searchParams: { searchParams: {
stock_out_sn: '' //出库单号 stock_out_sn: '' //出库单号
}
};
},
onNavigationBarButtonTap(e) {
if (e.index == 0) {
uni.reLaunch({
url: '/pages/index/index'
});
} }
};
},
onNavigationBarButtonTap(e) {
if (e.index == 0) {
uni.reLaunch({
url: '/pages/index/index'
});
}
},
onReachBottom() {
if (!this.hasMoreData) {
return;
}
this.page++;
this.getData();
},
onShow() {
this.getData();
},
methods: {
bindPickerChange: function(e) {
console.log('picker发送选择改变,携带值为', e.detail.value);
this.index = e.detail.value;
}, },
/** onReachBottom() {
* 清空数据 if (!this.hasMoreData) {
*/ return;
clearInput() { }
this.input_flag = false; this.page++;
this.searchParams.stock_out_sn = '';
this.getData(); this.getData();
}, },
/** onShow() {
* 单号搜索
* @param {Object} event
*/
handleInput: debounce(function(event) {
this.resetChange();
var val = event.target.value;
this.searchParams.stock_out_sn = '';
if (val) {
this.input_flag = true;
this.searchParams.stock_out_sn = val;
} else {
this.input_flag = false;
}
this.getData(); this.getData();
}, 500), },
/** methods: {
* 释放已领取拣货单 bindPickerChange: function(e) {
*/ console.log('picker发送选择改变,携带值为', e.detail.value);
cancelTake(stock_out_id) { this.index = e.detail.value;
this.request(API.cancelTake, 'POST', { stock_out_id: stock_out_id }, true).then(res => { },
if (res.code === 0) { /**
uni.showToast({ * 清空数据
title: '释放成功', */
icon: 'success' clearInput() {
}); this.input_flag = false;
setTimeout(() => { this.searchParams.stock_out_sn = '';
this.getData(); this.getData();
this.filter_id = []; },
}, 2000); /**
* 单号搜索
* @param {Object} event
*/
handleInput: debounce(function(event) {
this.resetChange();
var val = event.target.value;
this.searchParams.stock_out_sn = '';
if (val) {
this.input_flag = true;
this.searchParams.stock_out_sn = val;
} else { } else {
uni.showModal({ this.input_flag = false;
itle: '提示',
content: res.msg,
showCancel: false
});
} }
}); this.getData();
}, }, 500),
/** /**
* 获取列表数据 * 释放已领取拣货单
*/ */
getData() { cancelTake(stock_out_id) {
this.request(API.getTakedList, 'POST', { page: this.page, limit: this.limit, ...this.searchParams }, false).then(res => { this.request(API.cancelTake, 'POST', { stock_out_id: stock_out_id }, true).then(res => {
if (res.code === 0) { if (res.code === 0) {
if (res.data.list.length > 0) { uni.showToast({
this.hasMoreData = true; title: '释放成功',
this.list = this.list.concat(res.data.list); icon: 'success'
});
setTimeout(() => {
this.getData();
this.filter_id = [];
}, 2000);
} else { } else {
this.hasMoreData = false; uni.showModal({
itle: '提示',
content: res.msg,
showCancel: false
});
} }
} else { });
uni.showToast({ },
title: res.msg, /**
icon: 'error' * 获取列表数据
}); */
} getData() {
}); this.request(API.getTakedList, 'POST', { page: this.page, limit: this.limit, ...this.searchParams }, false).then(res => {
}, if (res.code === 0) {
/** if (res.data.list.length > 0) {
* 重置 this.hasMoreData = true;
*/ this.list = this.list.concat(res.data.list);
resetChange() { } else {
this.list = []; this.hasMoreData = false;
this.page = 1; }
} else {
uni.showToast({
title: res.msg,
icon: 'error'
});
}
});
},
/**
* 重置
*/
resetChange() {
this.list = [];
this.page = 1;
}
} }
} };
};
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@import '@/assets/css/picking/me.scss'; @import '@/assets/css/picking/me.scss';
</style> </style>
\ No newline at end of file
...@@ -130,7 +130,9 @@ ...@@ -130,7 +130,9 @@
<text class="desc">{{ item.remark }}</text> <text class="desc">{{ item.remark }}</text>
</view> </view>
<template v-if="item.lock_qty !== item.pick_qty"> <template v-if="item.lock_qty !== item.pick_qty">
<view class="row" style="width: 100%;justify-content: flex-end;"><view class="btn row rowCenter verCenter" @click="showDrawer(1, item)">拣货</view></view> <view class="row" style="width: 100%;justify-content: flex-end;">
<view class="btn row rowCenter verCenter" @click="showDrawer(1, item)">拣货</view>
</view>
</template> </template>
</view> </view>
</view> </view>
...@@ -329,7 +331,7 @@ ...@@ -329,7 +331,7 @@
</view> </view>
<!-- 拆货打印标签--> <!-- 拆货打印标签-->
<view class="print row verCenter" v-if="warehouse_id == 9"> <view class="print row verCenter" v-if="warehouse_id == 9">
<text class="t1" @click="rePrintTag(1)">货打印标签</text> <text class="t1" @click="rePrintTag(1)">货打印标签</text>
<view class="print-type-box row rowCenter verCenter"> <view class="print-type-box row rowCenter verCenter">
<picker @change="bindPickerChange" :value="print_style_index" :range="print_style" class="row rowCenter verCenter"> <picker @change="bindPickerChange" :value="print_style_index" :range="print_style" class="row rowCenter verCenter">
<view class="row rowCenter verCenter"> <view class="row rowCenter verCenter">
...@@ -339,7 +341,9 @@ ...@@ -339,7 +341,9 @@
</picker> </picker>
</view> </view>
</view> </view>
<view class="btn row verCenter bothSide"><view class="btn1 row rowCenter verCenter" @click="pick(detail.lock_id, formParams.pick_qty, detail.stock_out_item_id)">拣 货</view></view> <view class="btn row verCenter bothSide">
<view class="btn1 row rowCenter verCenter" @click="pick(detail.lock_id, formParams.pick_qty, detail.stock_out_item_id)">拣 货</view>
</view>
</view> </view>
</uni-drawer> </uni-drawer>
<!-- 按容器拣货详情弹窗 --> <!-- 按容器拣货详情弹窗 -->
...@@ -467,7 +471,9 @@ ...@@ -467,7 +471,9 @@
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
<view class="btn row verCenter bothSide"><view class="btn1 row rowCenter verCenter" @click="makeMultiPickingFinish()">拣 货</view></view> <view class="btn row verCenter bothSide">
<view class="btn1 row rowCenter verCenter" @click="makeMultiPickingFinish()">拣 货</view>
</view>
</view> </view>
</uni-drawer> </uni-drawer>
<!-- 批量拣货弹窗 --> <!-- 批量拣货弹窗 -->
...@@ -520,613 +526,614 @@ ...@@ -520,613 +526,614 @@
</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'; import { createArray } from '@/util/util.js';
export default { export default {
data() { data() {
return { return {
isFocus: false, isFocus: false,
is_batch: true, //是否开启批量 is_batch: true, //是否开启批量
is_batch_active: false, //是否开启批量激活s is_batch_active: false, //是否开启批量激活s
history_id: [], //批量记录id history_id: [], //批量记录id
search_keyword: '', //批量搜索值 search_keyword: '', //批量搜索值
noexebshowFalg: true, //控制是否会触发生命周期 noexebshowFalg: true, //控制是否会触发生命周期
stock_out_sn: '', //标题显示出库单号 stock_out_sn: '', //标题显示出库单号
lock_ids: [], //出库id集合 lock_ids: [], //出库id集合
input_flag_position_name: false, input_flag_position_name: false,
input_flag_stock_in_batch_sn: false, input_flag_stock_in_batch_sn: false,
input_flag_container_sn: false, input_flag_container_sn: false,
filter_list: [], //筛选已选中的列表 filter_list: [], //筛选已选中的列表
filter_id: [], //过滤处理的id filter_id: [], //过滤处理的id
page: 1, page: 1,
limit: 1000, limit: 1000,
curr: 0, curr: 0,
itemArr: ['按货品拣货', '按容器拣货'], itemArr: ['按货品拣货', '按容器拣货'],
list: [], list: [],
detail: {}, //按货品拣货详情 detail: {}, //按货品拣货详情
detailContainer: {}, //按容器拣货详情 detailContainer: {}, //按容器拣货详情
picked_num: '', //应拣数量 picked_num: '', //应拣数量
image_list: [], //图片列表 image_list: [], //图片列表
maxNum: 10, //最大上传图片数量 maxNum: 10, //最大上传图片数量
warehouse_id: '', //仓库id warehouse_id: '', //仓库id
print_style: ['基本样式', '不带D/C'], print_style: ['基本样式', '不带D/C'],
print_style_index: 0, print_style_index: 0,
searchParams: { searchParams: {
stock_out_id: '', stock_out_id: '',
position_name: '', position_name: '',
stock_in_batch_sn: '', stock_in_batch_sn: '',
container_sn: '' container_sn: ''
}, },
formParams: { formParams: {
pick_qty: '', pick_qty: '',
pick_remark: '' pick_remark: ''
}, },
//打印货品标签参数集合 //打印货品标签参数集合
rePrintTagParams: { rePrintTagParams: {
stock_out_item_id: '', stock_out_item_id: '',
print_type: 0, print_type: 0,
recheck_num: '' recheck_num: ''
}
};
},
onNavigationBarButtonTap(e) {
if (e.index == 0) {
uni.navigateTo({
url: '/pages/picking/record?stock_out_sn=' + this.stock_out_sn
});
} }
};
},
onNavigationBarButtonTap(e) {
if (e.index == 0) {
uni.navigateTo({
url: '/pages/picking/record?stock_out_sn=' + this.stock_out_sn
});
}
},
onLoad(options) {
this.stock_out_sn = options.stock_out_sn || '';
this.searchParams.stock_out_id = options.stock_out_id || '';
this.warehouse_id = options.warehouse_id || '';
},
onShow() {
if (this.noexebshowFalg) {
this.getData();
}
},
methods: {
/**
* 打印货品标签样式切换监听
* @param {Object} e
*/
bindPickerChange: function(e) {
this.print_style_index = e.detail.value;
this.rePrintTagParams.print_type = e.detail.value;
}, },
/** onLoad(options) {
* 批量扫描监听 this.stock_out_sn = options.stock_out_sn || '';
* @param {Object} e this.searchParams.stock_out_id = options.stock_out_id || '';
*/ this.warehouse_id = options.warehouse_id || '';
switchChange(e) { },
console.log('switch 发生 change 事件,携带值为', e.detail.value); onShow() {
this.is_batch = e.detail.value; if (this.noexebshowFalg) {
//重置相关数据 this.getData();
this.history_id = []; }
this.list = []; },
this.page = 1; methods: {
this.filter_id = []; /**
this.is_batch_active = false; * 打印货品标签样式切换监听
this.search_keyword = ''; * @param {Object} e
this.searchParams.stock_in_batch_sn = ''; */
bindPickerChange: function(e) {
this.print_style_index = e.detail.value;
this.rePrintTagParams.print_type = e.detail.value;
},
/**
* 批量扫描监听
* @param {Object} e
*/
switchChange(e) {
console.log('switch 发生 change 事件,携带值为', e.detail.value);
this.is_batch = e.detail.value;
//重置相关数据
this.history_id = [];
this.list = [];
this.page = 1;
this.filter_id = [];
this.is_batch_active = false;
this.getData(); this.search_keyword = '';
}, this.searchParams.stock_in_batch_sn = '';
/**
* 单号搜索
* @param {Object} event
*/
handleInput: debounce(function(type, val) {
if (val) {
if (type == 1) {
this.input_flag_position_name = true;
this.getData();
//再次获取焦点
this.isFocus = false;
setTimeout(() => {
this.isFocus = true;
this.$forceUpdate();
}, 1500);
} else if (type == 2) {
//入库批次号 开启批量扫描
if (this.is_batch) {
this.input_flag_stock_in_batch_sn = false;
//记录历史搜索批次号 this.getData();
if (!this.history_id.includes(val)) { },
this.history_id.push(val); /**
} * 单号搜索
this.searchParams.stock_in_batch_sn = this.history_id.join(','); * @param {Object} event
*/
handleInput: debounce(function(type, val) {
if (val) {
if (type == 1) {
this.input_flag_position_name = true;
this.getData();
//再次获取焦点
this.isFocus = false;
setTimeout(() => {
this.isFocus = true;
this.$forceUpdate();
}, 1500);
} else if (type == 2) {
//入库批次号 开启批量扫描
if (this.is_batch) {
this.input_flag_stock_in_batch_sn = false;
this.getData((data, msg) => { //记录历史搜索批次号
//回调data里数据,加是否选中交互 if (!this.history_id.includes(val)) {
if (data.length > 0) { this.history_id.push(val);
this.is_batch_active = true;
const list = data;
list.forEach((item, index) => {
this.filterChange(index);
});
} }
this.searchParams.stock_in_batch_sn = this.history_id.join(',');
this.getData((data, msg) => {
//回调data里数据,加是否选中交互
if (data.length > 0) {
this.is_batch_active = true;
const list = data;
list.forEach((item, index) => {
this.filterChange(index);
});
}
//如果后台有消息返回,就提示 //如果后台有消息返回,就提示
if (msg) { if (msg) {
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: msg, content: msg,
confirmText: '关闭', confirmText: '关闭',
showCancel: false, showCancel: false,
success: res => { success: res => {
let index_history_id = this.history_id.indexOf(val); let index_history_id = this.history_id.indexOf(val);
this.history_id.splice(index_history_id, 1); this.history_id.splice(index_history_id, 1);
try { try {
//再次获取焦点 //再次获取焦点
this.isFocus = false; this.isFocus = false;
setTimeout(() => { setTimeout(() => {
this.isFocus = true; this.isFocus = true;
this.search_keyword = ''; //清空入库批次号 this.search_keyword = ''; //清空入库批次号
this.$forceUpdate(); this.$forceUpdate();
}, 500); }, 500);
} catch (e) { } catch (e) {
//TODO handle the exception //TODO handle the exception
}
} }
} });
}); return false;
return false; } else {
} else { uni.showToast({
uni.showToast({ icon: 'success'
icon: 'success' });
}); }
}
//执行最后再次获取焦点 //执行最后再次获取焦点
try { try {
this.isFocus = false; this.isFocus = false;
setTimeout(() => { setTimeout(() => {
this.isFocus = true; this.isFocus = true;
this.search_keyword = ''; //清空入库批次号 this.search_keyword = ''; //清空入库批次号
this.$forceUpdate(); this.$forceUpdate();
}, 500); }, 500);
} catch (e) { } catch (e) {
//TODO handle the exception //TODO handle the exception
} }
}); });
} else { } else {
this.input_flag_stock_in_batch_sn = true; this.input_flag_stock_in_batch_sn = true;
this.getData();
setTimeout(() => {
if (this.searchParams.stock_in_batch_sn.length == 15) {
this.showDrawer(1, this.list[0]);
}
}, 800);
}
} else if (type == 3) {
this.input_flag_container_sn = true;
this.getData(); this.getData();
setTimeout(() => { setTimeout(() => {
if (this.searchParams.stock_in_batch_sn.length == 15) { if (this.searchParams.container_sn != '') {
this.showDrawer(1, this.list[0]); this.showDrawer(2, this.list[0]);
} }
}, 800); }, 800);
} }
} else {
if (type == 1) {
this.input_flag_position_name = false;
this.getData();
} else if (type == 2) {
this.searchParams.stock_in_batch_sn = '';
this.input_flag_stock_in_batch_sn = false;
this.getData();
} else if (type == 3) {
this.input_flag_container_sn = false;
this.getData();
}
}
}, 500),
/**
* tab切换
* @param {Object} index
*/
tab(index) {
this.curr = index;
this.getData();
this.image_list = [];
},
/**
* 展开弹窗
* @param {Object} type
* @param {Object} data
*/
showDrawer(type, data) {
if (type == 1) {
//按货品拣货
this.formParams.pick_remark = '';
this.$refs.showRight.open();
this.detail = data;
this.picked_num = Number(data.lock_qty) - Number(data.pick_qty);
this.formParams.pick_qty = Number(data.lock_qty) - Number(data.pick_qty);
this.image_list = []; //清空图片列表
} else if (type == 2) {
//按容器拣货
this.formParams.pick_remark = '';
this.$refs.showRightPack.open();
this.detailContainer = data;
this.image_list = []; //清空图片列表
this.lock_ids = data.list.map(function(item) {
return item.lock_id;
});
} else if (type == 3) { } else if (type == 3) {
this.input_flag_container_sn = true; //批量拣货
this.getData(); if (this.filter_id == 0) {
setTimeout(() => { uni.showToast({
if (this.searchParams.container_sn != '') { title: '请选择拣货任务',
this.showDrawer(2, this.list[0]); icon: 'none'
} });
}, 800); return false;
}
this.formParams.pick_remark = '';
this.$refs.showRightPackMultiPick.open();
this.image_list = []; //清空图片列表
} }
} else { },
/**
* 关闭弹窗
* @param {Object} type
*/
closeDrawer(type) {
if (type == 1) { if (type == 1) {
this.input_flag_position_name = false; //按货品拣货
this.getData(); this.$refs.showRight.close();
} else if (type == 2) { } else if (type == 2) {
this.searchParams.stock_in_batch_sn = ''; //按容器拣货
this.input_flag_stock_in_batch_sn = false; this.$refs.showRightPack.close();
this.getData();
} else if (type == 3) { } else if (type == 3) {
this.input_flag_container_sn = false; //批量拣货
this.getData(); this.$refs.showRightPackMultiPick.close();
} }
} },
}, 500), /**
/** * 找出false对应的下标
* tab切换 * @param {Object} arr
* @param {Object} index * @param {Object} target
*/ */
tab(index) { findIndex(arr, target) {
this.curr = index; const result = [];
this.getData(); arr.map((item, index) => {
this.image_list = []; if (item === target) {
}, result.push(index);
/** }
* 展开弹窗
* @param {Object} type
* @param {Object} data
*/
showDrawer(type, data) {
if (type == 1) {
//按货品拣货
this.formParams.pick_remark = '';
this.$refs.showRight.open();
this.detail = data;
this.picked_num = Number(data.lock_qty) - Number(data.pick_qty);
this.formParams.pick_qty = Number(data.lock_qty) - Number(data.pick_qty);
this.image_list = []; //清空图片列表
} else if (type == 2) {
//按容器拣货
this.formParams.pick_remark = '';
this.$refs.showRightPack.open();
this.detailContainer = data;
this.image_list = []; //清空图片列表
this.lock_ids = data.list.map(function(item) {
return item.lock_id;
}); });
} else if (type == 3) { return result;
//批量拣货 },
if (this.filter_id == 0) { /**
uni.showToast({ * 筛选过滤出选中的元素
title: '请选择拣货任务', */
icon: 'none' filterChange(index) {
}); this.$set(this.filter_list, index, (this.filter_list[index] = !this.filter_list[index]));
return false; let filter_arr = this.findIndex(this.filter_list, true);
} this.filter_id = filter_arr.map(i => this.list[i].lock_id);
this.formParams.pick_remark = ''; this.rePrintTagParams.stock_out_item_id = filter_arr.map(i => this.list[i].stock_out_item_id);
this.$refs.showRightPackMultiPick.open();
this.image_list = []; //清空图片列表
}
},
/**
* 关闭弹窗
* @param {Object} type
*/
closeDrawer(type) {
if (type == 1) {
//按货品拣货
this.$refs.showRight.close();
} else if (type == 2) {
//按容器拣货
this.$refs.showRightPack.close();
} else if (type == 3) {
//批量拣货
this.$refs.showRightPackMultiPick.close();
}
},
/**
* 找出false对应的下标
* @param {Object} arr
* @param {Object} target
*/
findIndex(arr, target) {
const result = [];
arr.map((item, index) => {
if (item === target) {
result.push(index);
}
});
return result;
},
/**
* 筛选过滤出选中的元素
*/
filterChange(index) {
this.$set(this.filter_list, index, (this.filter_list[index] = !this.filter_list[index]));
let filter_arr = this.findIndex(this.filter_list, true);
this.filter_id = filter_arr.map(i => this.list[i].lock_id);
this.rePrintTagParams.stock_out_item_id = filter_arr.map(i => this.list[i].stock_out_item_id);
//开启了批量搜索,如果取消勾选则删除
if (this.is_batch) {
if (!this.filter_list[index]) {
this.history_id.splice(index, 1);
this.searchParams.stock_in_batch_sn = this.history_id.join(',');
//当检测到全部取消的时候不应该调用接口 //开启了批量搜索,如果取消勾选则删除
if (this.history_id.length == 0) { if (this.is_batch) {
this.list = []; if (!this.filter_list[index]) {
this.search_keyword = ''; this.history_id.splice(index, 1);
return false; this.searchParams.stock_in_batch_sn = this.history_id.join(',');
}
//搜索之后添加选择状态 //当检测到全部取消的时候不应该调用接口
this.getData(data => { if (this.history_id.length == 0) {
if (data.length > 0) { this.list = [];
const list = data;
list.forEach((item, index) => {
this.filterChange(index);
});
this.search_keyword = ''; this.search_keyword = '';
return false;
} }
});
//搜索之后添加选择状态
this.getData(data => {
if (data.length > 0) {
const list = data;
list.forEach((item, index) => {
this.filterChange(index);
});
this.search_keyword = '';
}
});
}
} }
} },
}, /**
/** * 选择图片
* 选择图片 */
*/ chooseImageChange() {
chooseImageChange() { this.noexebshowFalg = false;
this.noexebshowFalg = false; // 使用 chooseImage选择图片
// 使用 chooseImage选择图片 uni.chooseImage({
uni.chooseImage({ count: this.maxNum,
count: this.maxNum, sizeType: ['original', 'compressed'],
sizeType: ['original', 'compressed'], sourceType: ['album', 'camera'],
sourceType: ['album', 'camera'], success: chooseImageRes => {
success: chooseImageRes => { console.log('选择图片成功:', chooseImageRes);
console.log('选择图片成功:', chooseImageRes);
// 显示loading // 显示loading
uni.showLoading({ uni.showLoading({
title: '上传中...' title: '上传中...'
}); });
// 获取选择的图片路径数组
const imagePaths = chooseImageRes.tempFilePaths;
// 判断选择的图片数量是否超过最大限制数量
let maxNum = Number(imagePaths.length) + Number(this.image_list.length); //当前上传的+已经上传的
if (maxNum > this.maxNum) {
uni.hideLoading();
uni.showToast({
title: '图片不超过' + this.maxNum + '张',
icon: 'none'
});
return false;
}
// 获取选择的图片路径数组 // 遍历图片路径数组,对每张图片进行压缩
const imagePaths = chooseImageRes.tempFilePaths; imagePaths.forEach(imagePath => {
// 使用compressImage 压缩图片
uni.compressImage({
src: imagePath,
quality: 50, //压缩质量,范围0~100,数值越小,质量越低,压缩率越高
success: compressedRes => {
console.log('压缩图片成功:', compressedRes);
// 获取压缩后的图片路径
const compressedImagePath = compressedRes.tempFilePath;
// 判断选择的图片数量是否超过最大限制数量 // 在这里处理压缩后的图片,上传到服务器
let maxNum = Number(imagePaths.length) + Number(this.image_list.length); //当前上传的+已经上传的 uni.uploadFile({
if (maxNum > this.maxNum) { url: API.upload + '?sys_type=4',
uni.hideLoading(); filePath: compressedImagePath,
name: 'file',
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.push({
pic_id: data.data.oss_image_id,
small_image_url: data.data.small_image_url,
big_image_url: data.data.big_image_url
});
} else {
uni.showToast({
title: data.msg,
icon: 'none'
});
}
},
fail: error => {
console.log('上传图片失败:', error);
uni.hideLoading();
}
});
},
fail: err => {
console.log('压缩图片失败:', err);
}
});
});
}
});
},
/**
* 删除图片
* @param {Object} index
*/
deletePic(index) {
this.image_list.splice(index, 1);
},
/**
* 预览图片
* @param {Object} img
* @param {Object} index
*/
previewChange(arr, index) {
var data = arr.map(item => {
return item.big_image_url;
});
this.noexebshowFalg = false;
uni.previewImage({
current: index,
urls: data
});
},
/**
*打印货品标签
*/
rePrintTag(type) {
if (type == 1) {
this.rePrintTagParams.stock_out_item_id = this.detail.stock_out_item_id;
this.rePrintTagParams.recheck_num = this.formParams.pick_qty;
} else {
if (this.filter_id.length == 0) {
uni.showToast({ uni.showToast({
title: '图片不超过' + this.maxNum + '张', title: '请勾选数据',
icon: 'none' icon: 'error'
}); });
return false; return false;
} }
this.rePrintTagParams.stock_out_item_id = this.rePrintTagParams.stock_out_item_id.join(','); //出库明细ids
}
// 遍历图片路径数组,对每张图片进行压缩 this.request(API.RePrintTag, 'POST', this.rePrintTagParams, true).then(res => {
imagePaths.forEach(imagePath => { if (res.code === 0) {
// 使用compressImage 压缩图片 uni.showToast({
uni.compressImage({ title: '操作成功',
src: imagePath, icon: 'success'
quality: 50, //压缩质量,范围0~100,数值越小,质量越低,压缩率越高
success: compressedRes => {
console.log('压缩图片成功:', compressedRes);
// 获取压缩后的图片路径
const compressedImagePath = compressedRes.tempFilePath;
// 在这里处理压缩后的图片,上传到服务器
uni.uploadFile({
url: API.upload + '?sys_type=4',
filePath: compressedImagePath,
name: 'file',
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.push({
pic_id: data.data.oss_image_id,
small_image_url: data.data.small_image_url,
big_image_url: data.data.big_image_url
});
} else {
uni.showToast({
title: data.msg,
icon: 'none'
});
}
},
fail: error => {
console.log('上传图片失败:', error);
uni.hideLoading();
}
});
},
fail: err => {
console.log('压缩图片失败:', err);
}
}); });
}); } else {
} uni.showToast({
}); title: res.msg,
}, icon: 'none'
/** });
* 删除图片 }
* @param {Object} index });
*/ },
deletePic(index) { /**
this.image_list.splice(index, 1); * 监听拣货数量
}, */
/** handleInputNumber: debounce(function(event, num) {
* 预览图片 var num = Number(num);
* @param {Object} img var val = event.target.value * 1;
* @param {Object} index if (val > num) {
*/ this.formParams.pick_qty = num;
previewChange(arr, index) {
var data = arr.map(item => {
return item.big_image_url;
});
this.noexebshowFalg = false;
uni.previewImage({
current: index,
urls: data
});
},
/**
*打印货品标签
*/
rePrintTag(type) {
if (type == 1) {
this.rePrintTagParams.stock_out_item_id = this.detail.stock_out_item_id;
this.rePrintTagParams.recheck_num = this.formParams.pick_qty;
} else {
if (this.filter_id.length == 0) {
uni.showToast({
title: '请勾选数据',
icon: 'error'
});
return false;
} }
this.rePrintTagParams.stock_out_item_id = this.rePrintTagParams.stock_out_item_id.join(','); //出库明细ids }, 500),
} /**
* 获取列表数据
this.request(API.RePrintTag, 'POST', this.rePrintTagParams, true).then(res => { */
if (res.code === 0) { getData(callback) {
uni.showToast({ if (this.curr == 0) {
title: '操作成功', //按货品拣货
icon: 'success' var URL = API.getLockedList;
}); } else if (this.curr == 1) {
} else { //按容器拣货
uni.showToast({ var URL = API.getLockedContainerList;
title: res.msg,
icon: 'none'
});
} }
});
},
/**
* 监听拣货数量
*/
handleInputNumber: debounce(function(event, num) {
var num = Number(num);
var val = event.target.value * 1;
if (val > num) {
this.formParams.pick_qty = num;
}
}, 500),
/**
* 获取列表数据
*/
getData(callback) {
if (this.curr == 0) {
//按货品拣货
var URL = API.getLockedList;
} else if (this.curr == 1) {
//按容器拣货
var URL = API.getLockedContainerList;
}
//赋值title //赋值title
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: this.stock_out_sn + '拣货' title: this.stock_out_sn + '拣货'
}); });
this.request(URL, 'POST', { page: this.page, limit: this.limit, ...this.searchParams }, false).then(res => { this.request(URL, 'POST', { page: this.page, limit: this.limit, ...this.searchParams }, false).then(res => {
if (res.code === 0) { if (res.code === 0) {
//过滤出应拣数量不为0的数据 //过滤出应拣数量不为0的数据
if (this.curr == 0) { if (this.curr == 0) {
var filteredList = res.data.list.filter(item => item.lock_qty - item.pick_qty > 0); var filteredList = res.data.list.filter(item => item.lock_qty - item.pick_qty > 0);
this.list = filteredList; this.list = filteredList;
} else if (this.curr == 1) { } else if (this.curr == 1) {
var filteredList = res.data.list.filter(item => item.total_lock_num - item.total_pick_num > 0); var filteredList = res.data.list.filter(item => item.total_lock_num - item.total_pick_num > 0);
this.list = filteredList; this.list = filteredList;
}
this.filter_list = createArray(this.list.length, false); //创建状态数组
typeof callback == 'function' && callback(res.data.list, res.data.notice_msg);
} else {
uni.showToast({
title: res.msg,
icon: 'none'
});
} }
this.filter_list = createArray(this.list.length, false); //创建状态数组 });
typeof callback == 'function' && callback(res.data.list, res.data.notice_msg); },
} else { /**
uni.showToast({ * 清空数据
title: res.msg, */
icon: 'none' clearInput(type) {
}); if (type == 1) {
this.searchParams.position_name = '';
this.input_flag_position_name = false;
} else if (type == 2) {
this.searchParams.stock_in_batch_sn = '';
this.input_flag_stock_in_batch_sn = false;
} else if (type == 3) {
this.searchParams.container_sn = '';
this.input_flag_container_sn = false;
} }
}); this.getData();
}, },
/** /**
* 清空数据 * 按货品拣货提交
*/ */
clearInput(type) { pick(lock_id, pick_qty, stock_out_item_id) {
if (type == 1) { var num = Number(this.detail.lock_qty) - Number(this.detail.pick_qty);
this.searchParams.position_name = ''; var pick_qty_num = pick_qty * 1;
this.input_flag_position_name = false; var pic_ids = this.image_list.map(item => {
} else if (type == 2) { return item.pic_id;
this.searchParams.stock_in_batch_sn = ''; });
this.input_flag_stock_in_batch_sn = false; this.request(API.pick, 'POST', { lock_id: lock_id, pick_qty: pick_qty, stock_out_item_id: stock_out_item_id, pic_ids: pic_ids.join(','), pick_remark: this.formParams.pick_remark }, true).then(res => {
} else if (type == 3) { if (res.code === 0) {
this.searchParams.container_sn = ''; uni.showToast({
this.input_flag_container_sn = false; title: '拣货成功',
} icon: 'success'
this.getData(); });
}, setTimeout(() => {
/** this.getData();
* 按货品拣货提交 if (pick_qty_num == num) {
*/ this.searchParams.stock_in_batch_sn = '';
pick(lock_id, pick_qty, stock_out_item_id) { this.closeDrawer(1);
var num = Number(this.detail.lock_qty) - Number(this.detail.pick_qty); } else {
var pick_qty_num = pick_qty * 1; this.picked_num = Number(this.picked_num) - pick_qty_num;
var pic_ids = this.image_list.map(item => { }
return item.pic_id; }, 2000);
}); } else {
this.request(API.pick, 'POST', { lock_id: lock_id, pick_qty: pick_qty, stock_out_item_id: stock_out_item_id, pic_ids: pic_ids.join(','), pick_remark: this.formParams.pick_remark }, true).then(res => { uni.showModal({
if (res.code === 0) { itle: '提示',
uni.showToast({ content: res.msg,
title: '拣货成功', showCancel: false
icon: 'success' });
}); }
setTimeout(() => { });
this.getData(); },
if (pick_qty_num == num) { /**
this.searchParams.stock_in_batch_sn = ''; * 按容器拣货提交 || 批量拣货
this.closeDrawer(1); */
} else { makeMultiPickingFinish() {
this.picked_num = Number(this.picked_num) - pick_qty_num; //图片集合
} var pic_ids = this.image_list.map(item => {
}, 2000); return item.pic_id;
});
var lock_ids = '';
var flag = false;
if (this.filter_id.length > 0 && this.lock_ids.length == 0) {
//批量拣货
lock_ids = this.filter_id.join(',');
flag = true;
} else { } else {
uni.showModal({ //按容器拣货
itle: '提示', lock_ids = this.lock_ids.join(',');
content: res.msg, flag = false;
showCancel: false
});
} }
});
},
/**
* 按容器拣货提交 || 批量拣货
*/
makeMultiPickingFinish() {
//图片集合
var pic_ids = this.image_list.map(item => {
return item.pic_id;
});
var lock_ids = ''; this.request(API.makeMultiPickingFinish, 'POST', { stock_out_id: this.searchParams.stock_out_id, lock_ids: lock_ids, pic_ids: pic_ids.join(','), pick_remark: this.formParams.pick_remark }, true).then(res => {
var flag = false; if (res.code === 0) {
if (this.filter_id.length > 0 && this.lock_ids.length == 0) { uni.showToast({
//批量拣货 title: '拣货成功',
lock_ids = this.filter_id.join(','); icon: 'success'
flag = true; });
} else { setTimeout(() => {
//按容器拣货 if (flag) {
lock_ids = this.lock_ids.join(','); this.history_id = [];
flag = false; this.filter_id = [];
this.search_keyword = '';
this.searchParams.stock_in_batch_sn = '';
this.is_batch_active = false;
this.closeDrawer(3);
} else {
this.closeDrawer(2);
}
this.getData();
}, 2000);
} else {
uni.showModal({
itle: '提示',
content: res.msg,
showCancel: false
});
}
});
} }
this.request(API.makeMultiPickingFinish, 'POST', { stock_out_id: this.searchParams.stock_out_id, lock_ids: lock_ids, pic_ids: pic_ids.join(','), pick_remark: this.formParams.pick_remark }, true).then(res => {
if (res.code === 0) {
uni.showToast({
title: '拣货成功',
icon: 'success'
});
setTimeout(() => {
if (flag) {
this.history_id = [];
this.filter_id = [];
this.search_keyword = '';
this.searchParams.stock_in_batch_sn = '';
this.is_batch_active = false;
this.closeDrawer(3);
} else {
this.closeDrawer(2);
}
this.getData();
}, 2000);
} else {
uni.showModal({
itle: '提示',
content: res.msg,
showCancel: false
});
}
});
} }
} };
};
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@import '@/assets/css/picking/sort.scss'; @import '@/assets/css/picking/sort.scss';
.disabled-color {
background: #eaeaef !important; .disabled-color {
} background: #eaeaef !important;
</style> }
</style>
\ No newline at end of file
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