Commit 0100b9e1 by LJM

移动端--【理货记录】增加理货时间筛选

parent b3d57bda
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
<text class="iconfont icon-a-juxing11" @click="clearInput('end')" v-if="searchParams.create_time_end != ''"></text> <text class="iconfont icon-a-juxing11" @click="clearInput('end')" v-if="searchParams.create_time_end != ''"></text>
</view> </view>
</view> </view>
<!-- 全量搜索 -->
<view class="radio-search-box row verCenter"> <view class="radio-search-box row verCenter">
<radio-group @change="radioChange" class="row verCenter"> <radio-group @change="radioChange" class="row verCenter">
<label class="radio row verCenter"> <label class="radio row verCenter">
...@@ -260,7 +261,9 @@ ...@@ -260,7 +261,9 @@
</scroll-view> </scroll-view>
</view> </view>
</template> </template>
<view class="btn row rowCenter verCenter"><view class="row btn1 row rowCenter verCenter" style="width:100%" @click="addStockInRegister(2, detail.stock_in_id)">到货登记</view></view> <view class="btn row rowCenter verCenter">
<view class="row btn1 row rowCenter verCenter" style="width:100%" @click="addStockInRegister(2, detail.stock_in_id)">到货登记</view>
</view>
</view> </view>
</uni-drawer> </uni-drawer>
<!-- 无单号登记弹窗 --> <!-- 无单号登记弹窗 -->
...@@ -477,555 +480,445 @@ ...@@ -477,555 +480,445 @@
</template> </template>
<script> <script>
import { API } from '@/util/api.js'; import { API } from '@/util/api.js';
import { createArray } from '@/util/util.js'; import { createArray } from '@/util/util.js';
import debounce from 'lodash/debounce'; import debounce from 'lodash/debounce';
export default { export default {
data() { data() {
return { return {
indicatorDots: true, indicatorDots: true,
autoplay: false, autoplay: false,
interval: 2000, interval: 2000,
duration: 500, duration: 500,
input_flag: false, input_flag: false,
page: 1, page: 1,
limit: 50, limit: 50,
index: 0, index: 0,
array: ['全量搜索', '入仓号', 'FedEx'], array: ['全量搜索', '入仓号', 'FedEx'],
list: [], list: [],
filter_list: [], //筛选已选中的列表 filter_list: [], //筛选已选中的列表
filter_id: [], //过滤处理的id filter_id: [], //过滤处理的id
filter_id_warehouse_id: [], //过滤处理的仓库id filter_id_warehouse_id: [], //过滤处理的仓库id
filter_id_stock_in_sn: [], //过滤处理的入库单号 filter_id_stock_in_sn: [], //过滤处理的入库单号
detail: {}, //详情的数据 detail: {}, //详情的数据
warehouse_id_index: 0, warehouse_id_index: 0,
warehouse_id_data: [], warehouse_id_data: [],
hasMoreData: true, //是否分页加载 hasMoreData: true, //是否分页加载
curr: 0, curr: 0,
item: ['货品信息', '其他信息'], item: ['货品信息', '其他信息'],
zyGoodsData: [], //自营货品信息 zyGoodsData: [], //自营货品信息
saveZyGoodsParams: [], //自营数据参数集合 saveZyGoodsParams: [], //自营数据参数集合
searchParams: { searchParams: {
create_time_begin: '', create_time_begin: '', //起始日期
create_time_end: '', create_time_end: '', //结束日期
mobile_register_all_search: '', //全量搜索 mobile_register_all_search: '', //全量搜索
stock_in_with_stock_in_items_inhouse: '', //入仓单号 stock_in_with_stock_in_items_inhouse: '', //入仓单号
tracking_no: '' //fedex tracking_no: '' //fedex
}, },
maxInputLength: 8, maxInputLength: 8,
formParams: { formParams: {
warehouse_id: '', warehouse_id: '',
logistics_company: '', logistics_company: '',
logistics_sn: '', logistics_sn: '',
other_info: '' other_info: ''
}, },
packingSet: [{ name: '编带', value: 5 }, { name: '袋', value: 6 }, { name: '盒', value: 7 }, { name: '管', value: 8 }, { name: '托盘', value: 9 }, { name: '卷', value: 10 }, { name: '其他', value: 11 }], packingSet: [{ name: '编带', value: 5 }, { name: '袋', value: 6 }, { name: '盒', value: 7 }, { name: '管', value: 8 }, { name: '托盘', value: 9 }, { name: '卷', value: 10 }, { name: '其他', value: 11 }],
pickingModeSet: [{ name: '裁剪', value: 1 }, { name: '称重', value: 2 }, { name: '计数', value: 3 }], pickingModeSet: [{ name: '裁剪', value: 1 }, { name: '称重', value: 2 }, { name: '计数', value: 3 }],
standardSize: ['标准包装长宽高', '单位包装长宽高'], standardSize: ['标准包装长宽高', '单位包装长宽高'],
standardSizeIndex: 0, standardSizeIndex: 0,
netWeight: ['标准包装净重', '单位净重'], netWeight: ['标准包装净重', '单位净重'],
netWeightIndex: 0, netWeightIndex: 0,
grossWeight: ['标准包装毛重', '单位毛重'], grossWeight: ['标准包装毛重', '单位毛重'],
grossWeightIndex: 0, grossWeightIndex: 0,
netWeightSize: ['kg', 'g'], //净重尺寸 1kg 2g netWeightSize: ['kg', 'g'], //净重尺寸 1kg 2g
netWeightSizeIndex: 0, netWeightSizeIndex: 0,
grossWeightSize: ['kg', 'g'], //毛重尺寸 1kg 2g grossWeightSize: ['kg', 'g'], //毛重尺寸 1kg 2g
grossWeightSizeIndex: 0, grossWeightSizeIndex: 0,
otherAttrList: [], //其他属性 otherAttrList: [], //其他属性
swiperCurr: 0 swiperCurr: 0
}; };
},
onReachBottom() {
if (!this.hasMoreData) {
return;
}
this.page++;
this.getData();
},
onNavigationBarButtonTap(e) {
if (e.index == 0) {
uni.navigateTo({
url: '/pages/arrivalRegister/registered'
});
}
},
onLoad() {
this.getWareHouselist();
},
onShow() {
this.resetChange();
this.getData();
},
methods: {
/**
* @param {Object} index
* @param {Object} stock_in_sn 入库单号
* tab切换
*/
tab(index, stock_in_sn) {
this.curr = index;
if (index == 1) {
//获取自营货品信息
this.getZyGoodsData(stock_in_sn, 1);
}
},
radioChange(e) {
this.index = e.detail.value;
}, },
/** onReachBottom() {
* 轮播图切换监听 if (!this.hasMoreData) {
*/ return;
swiperChange(e) {
console.log('swiper发送选择改变,携带值为', e);
this.swiperCurr = e.detail.current;
},
/**监听包装信息
* @param {Object} e
* @param {Object} type
*/
bindPickerZYChange: function(e, type, index) {
console.log('picker发送选择改变,携带值为', e.detail.value);
switch (type) {
//包装方式
case 1:
this.saveZyGoodsParams[index].packing = this.packingSet[e.detail.value].value;
break;
//拣货方式
case 2:
this.saveZyGoodsParams[index].picking_mode = this.pickingModeSet[e.detail.value].value;
break;
//选择标准包装长宽高
case 3:
this.standardSizeIndex = e.detail.value;
if (this.standardSizeIndex == 1) {
//标准包装长宽高
this.saveZyGoodsParams[index].standard_length = '';
this.saveZyGoodsParams[index].standard_width = '';
this.saveZyGoodsParams[index].standard_high = '';
} else {
//单位包装长宽高
this.saveZyGoodsParams[index].unit_length = '';
this.saveZyGoodsParams[index].unit_width = '';
this.saveZyGoodsParams[index].unit_high = '';
}
this.$forceUpdate();
break;
//选择标标准包净重
case 5:
this.netWeightIndex = e.detail.value;
if (this.netWeightSizeIndex == 1) {
//标准包装净重
this.saveZyGoodsParams[index].standard_net_weight = '';
} else {
//单位净重
this.saveZyGoodsParams[index].unit_net_weight = '';
}
break;
//选择标标准包净重-单位
case 6:
this.netWeightSizeIndex = e.detail.value;
if (this.netWeightSizeIndex == 1) {
this.saveZyGoodsParams[index].net_weight_size = 2;
} else {
this.saveZyGoodsParams[index].net_weight_size = 1;
}
this.$forceUpdate();
break;
//选择标准包毛重
case 7:
this.grossWeightIndex = e.detail.value;
if (this.grossWeightIndex == 1) {
//标准包装净重
this.saveZyGoodsParams[index].standard_gross_weight = '';
} else {
//单位净重
this.saveZyGoodsParams[index].unit_gross_weight = '';
}
break;
//选择标准包毛重-单位
case 8:
this.grossWeightSizeIndex = e.detail.value;
if (this.grossWeightSizeIndex == 1) {
this.saveZyGoodsParams[index].gross_weight_size = 2;
} else {
this.saveZyGoodsParams[index].gross_weight_size = 1;
}
break;
//其他属性
case 9:
this.saveZyGoodsParams[index].picking_other_attr_index = e.detail.value;
this.saveZyGoodsParams[index].picking_other_attr = this.otherAttrList[e.detail.value];
break;
default:
break;
} }
this.page++;
this.getData();
}, },
/** onNavigationBarButtonTap(e) {
* @param {Object} e if (e.index == 0) {
* @param {Object} type uni.navigateTo({
*/ url: '/pages/arrivalRegister/registered'
bindPickerChange: function(e, type) { });
console.log('picker发送选择改变,携带值为', e.detail.value);
if (type == 1) {
this.warehouse_id_index = e.detail.value;
this.formParams.warehouse_id = this.warehouse_id_data[e.detail.value].value;
} else {
this.index = e.detail.value;
} }
}, },
/** onLoad() {
* 时间选择 this.getWareHouselist();
*/ },
bindTimeChange(type, e) { onShow() {
this.resetChange(); this.resetChange();
if (type == 1) {
this.searchParams.create_time_begin = e.detail.value;
} else if (type == 2) {
this.searchParams.create_time_end = e.detail.value;
}
var timeA = new Date(this.searchParams.create_time_begin).getTime();
var timeB = new Date(this.searchParams.create_time_end).getTime();
if (timeB < timeA) {
uni.showToast({
title: '不能小于开始时间',
icon: 'none'
});
this.searchParams.create_time_end = this.searchParams.create_time_begin;
return false;
}
this.getData(); this.getData();
}, },
/** methods: {
* 找出false对应的下标 /**
* @param {Object} arr * @param {Object} index
* @param {Object} target * @param {Object} stock_in_sn 入库单号
*/ * tab切换
findIndex(arr, target) { */
const result = []; tab(index, stock_in_sn) {
arr.map((item, index) => { this.curr = index;
if (item === target) { if (index == 1) {
result.push(index); //获取自营货品信息
this.getZyGoodsData(stock_in_sn, 1);
} }
}); },
return result; radioChange(e) {
}, this.index = e.detail.value;
/** },
* 筛选过滤出选中的元素 /**
*/ * 轮播图切换监听
filterChange(index) { */
this.$set(this.filter_list, index, (this.filter_list[index] = !this.filter_list[index])); swiperChange(e) {
let filter_arr = this.findIndex(this.filter_list, true); console.log('swiper发送选择改变,携带值为', e);
this.filter_id = filter_arr.map(i => this.list[i].stock_in_id); this.swiperCurr = e.detail.current;
this.filter_id_warehouse_id = filter_arr.map(i => this.list[i].warehouse_id); },
this.filter_id_stock_in_sn = filter_arr.map(i => this.list[i].stock_in_sn); /**监听包装信息
}, * @param {Object} e
/** * @param {Object} type
* 全选 */
*/ bindPickerZYChange: function(e, type, index) {
allChnage() { console.log('picker发送选择改变,携带值为', e.detail.value);
this.all_flag = !this.all_flag; switch (type) {
this.filter_list = createArray(this.list.length, this.all_flag); //包装方式
if (this.all_flag) { case 1:
this.filter_id = this.list.map(function(item) { this.saveZyGoodsParams[index].packing = this.packingSet[e.detail.value].value;
return item.stock_in_id; break;
}); //拣货方式
} else { case 2:
this.filter_id = []; this.saveZyGoodsParams[index].picking_mode = this.pickingModeSet[e.detail.value].value;
} break;
}, //选择标准包装长宽高
/** case 3:
* 清空数据 this.standardSizeIndex = e.detail.value;
*/ if (this.standardSizeIndex == 1) {
clearInput(type) { //标准包装长宽高
if (type == 'start') { this.saveZyGoodsParams[index].standard_length = '';
this.searchParams.create_time_begin = ''; this.saveZyGoodsParams[index].standard_width = '';
} else if (type == 'end') { this.saveZyGoodsParams[index].standard_high = '';
this.searchParams.create_time_end = ''; } else {
} else { //单位包装长宽高
this.input_flag = false; this.saveZyGoodsParams[index].unit_length = '';
this.resetChange(); this.saveZyGoodsParams[index].unit_width = '';
this.saveZyGoodsParams[index].unit_high = '';
}
this.$forceUpdate();
break;
//选择标标准包净重
case 5:
this.netWeightIndex = e.detail.value;
if (this.netWeightSizeIndex == 1) {
//标准包装净重
this.saveZyGoodsParams[index].standard_net_weight = '';
} else {
//单位净重
this.saveZyGoodsParams[index].unit_net_weight = '';
}
break;
if (this.index == 0) { //选择标标准包净重-单位
this.searchParams.mobile_register_all_search = ''; case 6:
} else if (this.index == 1) { this.netWeightSizeIndex = e.detail.value;
this.searchParams.stock_in_with_stock_in_items_inhouse = ''; if (this.netWeightSizeIndex == 1) {
} else if (this.index == 2) { this.saveZyGoodsParams[index].net_weight_size = 2;
this.searchParams.tracking_no = ''; } else {
this.saveZyGoodsParams[index].net_weight_size = 1;
}
this.$forceUpdate();
break;
//选择标准包毛重
case 7:
this.grossWeightIndex = e.detail.value;
if (this.grossWeightIndex == 1) {
//标准包装净重
this.saveZyGoodsParams[index].standard_gross_weight = '';
} else {
//单位净重
this.saveZyGoodsParams[index].unit_gross_weight = '';
}
break;
//选择标准包毛重-单位
case 8:
this.grossWeightSizeIndex = e.detail.value;
if (this.grossWeightSizeIndex == 1) {
this.saveZyGoodsParams[index].gross_weight_size = 2;
} else {
this.saveZyGoodsParams[index].gross_weight_size = 1;
}
break;
//其他属性
case 9:
this.saveZyGoodsParams[index].picking_other_attr_index = e.detail.value;
this.saveZyGoodsParams[index].picking_other_attr = this.otherAttrList[e.detail.value];
break;
default:
break;
} }
} },
this.getData(); /**
}, * @param {Object} e
/** * @param {Object} type
* 单号搜索 */
* @param {Object} event bindPickerChange: function(e, type) {
*/ console.log('picker发送选择改变,携带值为', e.detail.value);
handleInput: debounce(function(type, event) {
this.resetChange();
var val = event.target.value;
this.searchParams.mobile_register_all_search = '';
this.searchParams.stock_in_with_stock_in_items_inhouse = '';
if (val) {
if (type == 1) { if (type == 1) {
this.searchParams.mobile_register_all_search = val; this.warehouse_id_index = e.detail.value;
} else if (type == 2) { this.formParams.warehouse_id = this.warehouse_id_data[e.detail.value].value;
//入仓号
var str = val;
if (str.startsWith('F')) {
this.searchParams.stock_in_with_stock_in_items_inhouse = val;
} else {
this.searchParams.stock_in_with_stock_in_items_inhouse = str.slice(0, -1);
}
} else if (type == 3) {
var last12 = val.slice(22); // 截取后12位
this.searchParams.tracking_no = last12;
}
this.input_flag = true;
} else {
this.input_flag = false;
}
this.getData();
}, 800),
/**
* 获取仓库
*/
getWareHouselist() {
this.request(API.getWareHouselist, 'POST', { warehouse_status: 1 }, false).then(res => {
if (res.code === 0) {
this.formParams.warehouse_id = res.data.list[0].warehouse_id;
this.warehouse_id_data = res.data.list.map(function(item) {
return {
name: item.warehouse_name,
value: item.warehouse_id
};
});
} else { } else {
uni.showToast({ this.index = e.detail.value;
title: res.msg,
icon: 'error'
});
} }
}); },
}, /**
/** * 时间选择
* 获取其他属性 */
*/ bindTimeChange(type, e) {
getOtherAttrList() { this.resetChange();
this.request(API.getOtherAttrList, 'POST', {}, true).then(res => { if (type == 1) {
if (res.code === 0) { this.searchParams.create_time_begin = e.detail.value;
this.otherAttrList = res.data.list; } else if (type == 2) {
} else { this.searchParams.create_time_end = e.detail.value;
uni.showToast({
title: res.msg,
icon: 'error'
});
} }
}); var timeA = new Date(this.searchParams.create_time_begin).getTime();
}, var timeB = new Date(this.searchParams.create_time_end).getTime();
/**
* @param {Object} stock_in_sn 入库单号 if (timeB < timeA) {
*
*/
getZyGoodsData(stock_in_sn, type) {
if (type) {
var params = { stock_in_sn: stock_in_sn };
} else {
var params = { stock_in_sn: stock_in_sn, is_first_check: 1 };
}
this.request(API.getZyGoodsData, 'GET', params, true).then(res => {
if (res.code === 0) {
this.zyGoodsData = res.data;
this.saveZyGoodsParams = res.data; //赋值自营数据
// 添加 picking_other_attr_index 到每个对象并设置默认值为 0
this.saveZyGoodsParams = res.data.map(item => ({
...item,
picking_other_attr_index: -1
}));
} else {
uni.showToast({ uni.showToast({
title: res.msg, title: '不能小于开始时间',
icon: 'error' icon: 'none'
}); });
this.searchParams.create_time_end = this.searchParams.create_time_begin;
return false;
} }
}); this.getData();
}, },
/** /**
* 获取列表数据 * 找出false对应的下标
*/ * @param {Object} arr
getData() { * @param {Object} target
this.request(API.stockInMobileRegisterList, 'POST', { page: this.page, limit: this.limit, is_register: 0, ...this.searchParams }, false).then(res => { */
if (res.code === 0) { findIndex(arr, target) {
if (res.data.list.length > 0) { const result = [];
this.hasMoreData = true; arr.map((item, index) => {
this.list = this.list.concat(res.data.list); if (item === target) {
this.filter_list = createArray(this.list.length, false); result.push(index);
} else {
this.hasMoreData = false;
} }
} else { });
uni.showToast({ return result;
title: res.msg, },
icon: 'error' /**
* 筛选过滤出选中的元素
*/
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].stock_in_id);
this.filter_id_warehouse_id = filter_arr.map(i => this.list[i].warehouse_id);
this.filter_id_stock_in_sn = filter_arr.map(i => this.list[i].stock_in_sn);
},
/**
* 全选
*/
allChnage() {
this.all_flag = !this.all_flag;
this.filter_list = createArray(this.list.length, this.all_flag);
if (this.all_flag) {
this.filter_id = this.list.map(function(item) {
return item.stock_in_id;
}); });
} else {
this.filter_id = [];
} }
}); },
}, /**
/** * 清空数据
* 获取详情 */
* @param {Object} stock_in_sn 入库单号 clearInput(type) {
*/ if (type == 'start') {
getDetail(stock_in_sn) { this.searchParams.create_time_begin = '';
this.request(API.stockInMobileRegisterList, 'POST', { page: 1, limit: this.limit, stock_in_sn: stock_in_sn, is_register: 0 }, true).then(res => { } else if (type == 'end') {
if (res.code === 0) { this.searchParams.create_time_end = '';
this.detail = res.data.list[0];
} else { } else {
uni.showToast({ this.input_flag = false;
title: res.msg, this.resetChange();
icon: 'error'
}); if (this.index == 0) {
this.searchParams.mobile_register_all_search = '';
} else if (this.index == 1) {
this.searchParams.stock_in_with_stock_in_items_inhouse = '';
} else if (this.index == 2) {
this.searchParams.tracking_no = '';
}
} }
}); this.getData();
}, },
/** /**
* 修改自营数据 * 单号搜索
*/ * @param {Object} event
saveZyGoodsDataSubmit() { */
this.request(API.saveZyGoodsData, 'POST', { list: JSON.stringify(this.saveZyGoodsParams) }, true).then(res => { handleInput: debounce(function(type, event) {
if (res.code === 0) { this.resetChange();
this.request(API.addStockInRegister, 'POST', { stock_in_id: JSON.stringify(this.filter_id) }, true).then(res => { var val = event.target.value;
if (res.code === 0) { this.searchParams.mobile_register_all_search = '';
uni.showToast({ this.searchParams.stock_in_with_stock_in_items_inhouse = '';
title: '登记成功', if (val) {
icon: 'success' if (type == 1) {
}); this.searchParams.mobile_register_all_search = val;
setTimeout(() => { } else if (type == 2) {
this.resetChange(); //入仓号
this.getData(); var str = val;
this.closeDrawer(); if (str.startsWith('F')) {
this.filter_id = []; this.searchParams.stock_in_with_stock_in_items_inhouse = val;
this.filter_id_warehouse_id = [];
}, 2000);
} else { } else {
uni.showModal({ this.searchParams.stock_in_with_stock_in_items_inhouse = str.slice(0, -1);
itle: '提示',
content: res.msg,
showCancel: false
});
} }
}); } else if (type == 3) {
var last12 = val.slice(22); // 截取后12位
this.searchParams.tracking_no = last12;
}
this.input_flag = true;
} else { } else {
uni.showModal({ this.input_flag = false;
title: '提示',
content: res.msg,
showCancel: false
});
} }
}); this.getData();
}, }, 800),
/** /**
* 无单号登记 * 获取仓库
*/ */
withoutTrackingNumberRecord() { getWareHouselist() {
if (!this.formParams.logistics_company) { this.request(API.getWareHouselist, 'POST', { warehouse_status: 1 }, false).then(res => {
uni.showToast({ if (res.code === 0) {
title: '请填写物流公司', this.formParams.warehouse_id = res.data.list[0].warehouse_id;
icon: 'error' this.warehouse_id_data = res.data.list.map(function(item) {
return {
name: item.warehouse_name,
value: item.warehouse_id
};
});
} else {
uni.showToast({
title: res.msg,
icon: 'error'
});
}
}); });
return false; },
} /**
if (this.formParams.logistics_sn == '' && this.formParams.other_info == '') { * 获取其他属性
uni.showModal({ */
title: '提示', getOtherAttrList() {
content: '物流单号、其它信息必填其一', this.request(API.getOtherAttrList, 'POST', {}, true).then(res => {
showCancel: false if (res.code === 0) {
this.otherAttrList = res.data.list;
} else {
uni.showToast({
title: res.msg,
icon: 'error'
});
}
}); });
return false; },
} /**
* @param {Object} stock_in_sn 入库单号
this.request(API.addStockInRegister, 'POST', this.formParams, true).then(res => { *
if (res.code === 0) { */
uni.showToast({ getZyGoodsData(stock_in_sn, type) {
title: '登记成功', if (type) {
icon: 'success' var params = { stock_in_sn: stock_in_sn };
});
setTimeout(() => {
this.resetChange();
this.getData();
this.closeDrawer();
}, 2000);
} else { } else {
uni.showModal({ var params = { stock_in_sn: stock_in_sn, is_first_check: 1 };
itle: '提示',
content: res.msg,
showCancel: false
});
} }
}); this.request(API.getZyGoodsData, 'GET', params, true).then(res => {
}, if (res.code === 0) {
/** this.zyGoodsData = res.data;
* 到货登记 this.saveZyGoodsParams = res.data; //赋值自营数据
* @param {Object} type 1无单号登记 2详情登记 // 添加 picking_other_attr_index 到每个对象并设置默认值为 0
* @param {Object} id this.saveZyGoodsParams = res.data.map(item => ({
*/ ...item,
addStockInRegister(type, id) { picking_other_attr_index: -1
var stock_in_id = []; }));
if (type == 1) { } else {
if (this.filter_id.length == 0) { uni.showToast({
uni.showToast({ title: res.msg,
title: '请选择货品', icon: 'error'
icon: 'error' });
}); }
return false;
}
stock_in_id = this.filter_id;
} else if (type == 2) {
stock_in_id[0] = id;
}
const allElementsEqual = this.filter_id_warehouse_id.every(element => element === this.filter_id_warehouse_id[0]);
if (!allElementsEqual) {
uni.showModal({
title: '提示',
content: '请勾选状态相同仓库的数据',
showCancel: false
}); });
return false; },
} /**
* 获取列表数据
//深圳自营仓 */
if (this.filter_id_warehouse_id[0] == 9) { getData() {
//先判断一下自营货品信息 this.request(API.stockInMobileRegisterList, 'POST', { page: this.page, limit: this.limit, is_register: 0, ...this.searchParams }, false).then(res => {
this.request(API.getZyGoodsData, 'GET', { stock_in_sn: this.filter_id_stock_in_sn.join(','), is_first_check: 1 }, true).then(res => {
if (res.code === 0) { if (res.code === 0) {
if (res.data.length > 0) { if (res.data.list.length > 0) {
this.getOtherAttrList(); this.hasMoreData = true;
this.showDrawer(decodeURIComponent(this.filter_id_stock_in_sn.join(',')), 1); this.list = this.list.concat(res.data.list);
this.filter_list = createArray(this.list.length, false);
} else { } else {
this.request(API.addStockInRegister, 'POST', { stock_in_id: JSON.stringify(stock_in_id) }, true).then(res => { this.hasMoreData = false;
if (res.code === 0) {
uni.showToast({
title: '登记成功',
icon: 'success'
});
setTimeout(() => {
this.resetChange();
this.getData();
this.closeDrawer();
this.filter_id = [];
this.filter_id_warehouse_id = [];
}, 2000);
} else {
uni.showModal({
itle: '提示',
content: res.msg,
showCancel: false
});
}
});
} }
} else { } else {
uni.showToast({
title: res.msg,
icon: 'error'
});
}
});
},
/**
* 获取详情
* @param {Object} stock_in_sn 入库单号
*/
getDetail(stock_in_sn) {
this.request(API.stockInMobileRegisterList, 'POST', { page: 1, limit: this.limit, stock_in_sn: stock_in_sn, is_register: 0 }, true).then(res => {
if (res.code === 0) {
this.detail = res.data.list[0];
} else {
uni.showToast({
title: res.msg,
icon: 'error'
});
}
});
},
/**
* 修改自营数据
*/
saveZyGoodsDataSubmit() {
this.request(API.saveZyGoodsData, 'POST', { list: JSON.stringify(this.saveZyGoodsParams) }, true).then(res => {
if (res.code === 0) {
this.request(API.addStockInRegister, 'POST', { stock_in_id: JSON.stringify(this.filter_id) }, true).then(res => {
if (res.code === 0) {
uni.showToast({
title: '登记成功',
icon: 'success'
});
setTimeout(() => {
this.resetChange();
this.getData();
this.closeDrawer();
this.filter_id = [];
this.filter_id_warehouse_id = [];
}, 2000);
} else {
uni.showModal({
itle: '提示',
content: res.msg,
showCancel: false
});
}
});
} else {
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: res.msg, content: res.msg,
...@@ -1033,8 +926,28 @@ export default { ...@@ -1033,8 +926,28 @@ export default {
}); });
} }
}); });
} else { },
this.request(API.addStockInRegister, 'POST', { stock_in_id: JSON.stringify(stock_in_id) }, true).then(res => { /**
* 无单号登记
*/
withoutTrackingNumberRecord() {
if (!this.formParams.logistics_company) {
uni.showToast({
title: '请填写物流公司',
icon: 'error'
});
return false;
}
if (this.formParams.logistics_sn == '' && this.formParams.other_info == '') {
uni.showModal({
title: '提示',
content: '物流单号、其它信息必填其一',
showCancel: false
});
return false;
}
this.request(API.addStockInRegister, 'POST', this.formParams, true).then(res => {
if (res.code === 0) { if (res.code === 0) {
uni.showToast({ uni.showToast({
title: '登记成功', title: '登记成功',
...@@ -1044,8 +957,6 @@ export default { ...@@ -1044,8 +957,6 @@ export default {
this.resetChange(); this.resetChange();
this.getData(); this.getData();
this.closeDrawer(); this.closeDrawer();
this.filter_id = [];
this.filter_id_warehouse_id = [];
}, 2000); }, 2000);
} else { } else {
uni.showModal({ uni.showModal({
...@@ -1055,41 +966,133 @@ export default { ...@@ -1055,41 +966,133 @@ export default {
}); });
} }
}); });
},
/**
* 到货登记
* @param {Object} type 1无单号登记 2详情登记
* @param {Object} id
*/
addStockInRegister(type, id) {
var stock_in_id = [];
if (type == 1) {
if (this.filter_id.length == 0) {
uni.showToast({
title: '请选择货品',
icon: 'error'
});
return false;
}
stock_in_id = this.filter_id;
} else if (type == 2) {
stock_in_id[0] = id;
}
const allElementsEqual = this.filter_id_warehouse_id.every(element => element === this.filter_id_warehouse_id[0]);
if (!allElementsEqual) {
uni.showModal({
title: '提示',
content: '请勾选状态相同仓库的数据',
showCancel: false
});
return false;
}
//深圳自营仓
if (this.filter_id_warehouse_id[0] == 9) {
//先判断一下自营货品信息
this.request(API.getZyGoodsData, 'GET', { stock_in_sn: this.filter_id_stock_in_sn.join(','), is_first_check: 1 }, true).then(res => {
if (res.code === 0) {
if (res.data.length > 0) {
this.getOtherAttrList();
this.showDrawer(decodeURIComponent(this.filter_id_stock_in_sn.join(',')), 1);
} else {
this.request(API.addStockInRegister, 'POST', { stock_in_id: JSON.stringify(stock_in_id) }, true).then(res => {
if (res.code === 0) {
uni.showToast({
title: '登记成功',
icon: 'success'
});
setTimeout(() => {
this.resetChange();
this.getData();
this.closeDrawer();
this.filter_id = [];
this.filter_id_warehouse_id = [];
}, 2000);
} else {
uni.showModal({
itle: '提示',
content: res.msg,
showCancel: false
});
}
});
}
} else {
uni.showModal({
title: '提示',
content: res.msg,
showCancel: false
});
}
});
} else {
this.request(API.addStockInRegister, 'POST', { stock_in_id: JSON.stringify(stock_in_id) }, true).then(res => {
if (res.code === 0) {
uni.showToast({
title: '登记成功',
icon: 'success'
});
setTimeout(() => {
this.resetChange();
this.getData();
this.closeDrawer();
this.filter_id = [];
this.filter_id_warehouse_id = [];
}, 2000);
} else {
uni.showModal({
itle: '提示',
content: res.msg,
showCancel: false
});
}
});
}
},
/**
* @param {Object} stock_in_sn
*/
showDrawer(stock_in_sn, type) {
this.curr = 0;
//区分深圳自营和非深圳自营
if (type) {
this.getZyGoodsData(stock_in_sn);
this.$refs.showRightZyGoodsDat.open();
} else {
this.getDetail(stock_in_sn);
this.$refs.showRight.open();
}
},
showDrawers() {
this.$refs.showRightAdd.open();
},
closeDrawer() {
this.$refs.showRight.close();
this.$refs.showRightAdd.close();
this.$refs.showRightZyGoodsDat.close();
},
/**
* 重置
*/
resetChange() {
this.list = [];
this.page = 1;
} }
},
/**
* @param {Object} stock_in_sn
*/
showDrawer(stock_in_sn, type) {
this.curr = 0;
//区分深圳自营和非深圳自营
if (type) {
this.getZyGoodsData(stock_in_sn);
this.$refs.showRightZyGoodsDat.open();
} else {
this.getDetail(stock_in_sn);
this.$refs.showRight.open();
}
},
showDrawers() {
this.$refs.showRightAdd.open();
},
closeDrawer() {
this.$refs.showRight.close();
this.$refs.showRightAdd.close();
this.$refs.showRightZyGoodsDat.close();
},
/**
* 重置
*/
resetChange() {
this.list = [];
this.page = 1;
} }
} };
};
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@import '@/assets/css/arrivalRegister/index.scss'; @import '@/assets/css/arrivalRegister/index.scss';
</style> </style>
\ No newline at end of file
<template> <template>
<view class="tallyReceive"> <view class="tallyReceive">
<view class="search-box row bothSide verCenter"> <!-- 时间筛选 -->
<view class="time-interval row bothSide verCenter">
<view class="time-interval-box row verCenter bothSide">
<view class="row verCenter">
<text class="iconfont icon-juxing4"></text>
<picker mode="date" @change="bindTimeChange(1, $event)"><input type="text" class="uni-input" placeholder="请选择起始时间" placeholder-style="color:#919399" v-model="searchParams.create_time_begin" /></picker>
</view>
<text class="iconfont icon-a-juxing11" @click="clearInput('start')" v-if="searchParams.create_time_begin != ''"></text>
</view>
<view class="time-interval-box row verCenter bothSide">
<view class="row verCenter">
<text class="iconfont icon-juxing4"></text>
<picker mode="date" @change="bindTimeChange(2, $event)"><input type="text" class="uni-input" placeholder="请选择结束时间" placeholder-style="color:#919399" v-model="searchParams.create_time_end" /></picker>
</view>
<text class="iconfont icon-a-juxing11" @click="clearInput('end')" v-if="searchParams.create_time_end != ''"></text>
</view>
</view>
<!-- 全量搜索 -->
<view class="search-box row bothSide verCenter" style="margin-top: 15rpx;">
<view class="sn row rowCenter verCenter"> <view class="sn row rowCenter verCenter">
<picker @change="bindPickerChange" :value="index" :range="array"> <picker @change="bindPickerChange" :value="index" :range="array">
<view class="row verCenter"> <view class="row verCenter">
...@@ -106,7 +124,9 @@ ...@@ -106,7 +124,9 @@
<text class="label">明细备注:</text> <text class="label">明细备注:</text>
<text class="desc">{{ item.upstream_remark }}</text> <text class="desc">{{ item.upstream_remark }}</text>
</view> </view>
<view class="btn-box row"><view class="detail-btn row rowCenter verCenter" @click="showDrawer(item)">详情</view></view> <view class="btn-box row">
<view class="detail-btn row rowCenter verCenter" @click="showDrawer(item)">详情</view>
</view>
</view> </view>
</view> </view>
<view class="no-date column rowCenter verCenter" v-else> <view class="no-date column rowCenter verCenter" v-else>
...@@ -265,7 +285,9 @@ ...@@ -265,7 +285,9 @@
<view class="pic-list"> <view class="pic-list">
<view class="pic-title">理货照片:</view> <view class="pic-title">理货照片:</view>
<view class="row pic-wrap"> <view class="row pic-wrap">
<view class="box" v-for="(item, index) in image_list" :key="index"><image @click="previewChange(image_list, index)" :src="item" mode="aspectFill" lazy-load="true"></image></view> <view class="box" v-for="(item, index) in image_list" :key="index">
<image @click="previewChange(image_list, index)" :src="item" mode="aspectFill" lazy-load="true"></image>
</view>
</view> </view>
</view> </view>
</template> </template>
...@@ -329,7 +351,9 @@ ...@@ -329,7 +351,9 @@
</view> </view>
</view> </view>
</template> </template>
<view class="btn row verCenter bothSide"><view class="btn1 row rowCenter verCenter" @click="cancelTallyReceive(2, detail.tally_id, detail.stock_in_item_id)">取消理货</view></view> <view class="btn row verCenter bothSide">
<view class="btn1 row rowCenter verCenter" @click="cancelTallyReceive(2, detail.tally_id, detail.stock_in_item_id)">取消理货</view>
</view>
</view> </view>
</uni-drawer> </uni-drawer>
<!-- 修改容器 --> <!-- 修改容器 -->
...@@ -338,292 +362,289 @@ ...@@ -338,292 +362,289 @@
</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 {
page: 1, page: 1,
limit: 50, limit: 50,
input_flag: false, input_flag: false,
index: 0, index: 0,
curr: 0, curr: 0,
item: ['货品信息', '其他信息'], item: ['货品信息', '其他信息'],
array: ['全量搜索', '入仓号'], array: ['全量搜索', '入仓号'],
list: [], list: [],
filter_list: [], //筛选已选中的列表 filter_list: [], //筛选已选中的列表
filter_id: [], //入库单列表的入库登记 filter_id: [], //入库单列表的入库登记
detail: {}, //详情的数据 detail: {}, //详情的数据
image_list: [], //图片列表 image_list: [], //图片列表
hasMoreData: true, //是否分页加载 hasMoreData: true, //是否分页加载
searchParams: { searchParams: {
mobile_have_tally_all_search: '', //全量搜索 create_time_begin: '', //起始日期
stock_in_with_stock_in_items_inhouse: '', //入仓单号 create_time_end: '', //结束日期
container_id: '', //容器, mobile_have_tally_all_search: '', //全量搜索
tally_status: 0, //默认显示已理货 stock_in_with_stock_in_items_inhouse: '', //入仓单号
stock_tally_with_stock_in_stock_in_type_in: '' //入库类型 container_id: '', //容器,
} tally_status: 0, //默认显示已理货
}; stock_tally_with_stock_in_stock_in_type_in: '' //入库类型
}, }
onReachBottom() { };
if (!this.hasMoreData) {
return;
}
this.page++;
this.getData();
},
onNavigationBarButtonTap(e) {
if (e.index == 0) {
uni.reLaunch({
url: '/pages/index/index'
});
}
},
onShow() {
this.resetChange();
this.getData();
},
methods: {
/**
* @param {Object} index
* tab切换
*/
tab(index) {
this.curr = index;
}, },
radioChange(e, type) { onReachBottom() {
this.resetChange(); if (!this.hasMoreData) {
if (type == 1) { return;
this.searchParams.stock_tally_with_stock_in_stock_in_type_in = e.detail.value;
} else if (type == 2) {
this.searchParams.tally_status = e.detail.value;
} }
this.page++;
this.getData(); this.getData();
}, },
bindPickerChange: function(e) { onNavigationBarButtonTap(e) {
console.log('picker发送选择改变,携带值为', e.detail.value); if (e.index == 0) {
this.index = e.detail.value; uni.reLaunch({
}, url: '/pages/index/index'
inputDialogToggle(detail) {
this.$refs.inputDialog.open();
},
closeChange() {
this.$refs.inputDialog.close();
},
dialogInputConfirm(e) {
if (!e) {
uni.showToast({
title: '请输入目的容器',
icon: 'none'
}); });
return false;
} }
this.request(API.changeTallyContainer, 'GET', { tally_id: this.detail.tally_id, container_sn: e }, true).then(res => { },
if (res.code === 0) { onShow() {
this.resetChange();
this.getData();
},
methods: {
/**
* @param {Object} index
* tab切换
*/
tab(index) {
this.curr = index;
},
radioChange(e, type) {
this.resetChange();
if (type == 1) {
this.searchParams.stock_tally_with_stock_in_stock_in_type_in = e.detail.value;
} else if (type == 2) {
this.searchParams.tally_status = e.detail.value;
}
this.getData();
},
/**
* 时间选择
*/
bindTimeChange(type, e) {
this.resetChange();
if (type == 1) {
this.searchParams.create_time_begin = e.detail.value;
} else if (type == 2) {
this.searchParams.create_time_end = e.detail.value;
}
var timeA = new Date(this.searchParams.create_time_begin).getTime();
var timeB = new Date(this.searchParams.create_time_end).getTime();
if (timeB < timeA) {
uni.showToast({ uni.showToast({
title: '修改成功', title: '不能小于开始时间',
icon: 'success' icon: 'none'
}); });
setTimeout(() => { this.searchParams.create_time_end = this.searchParams.create_time_begin;
this.detail.container_sn = e; return false;
this.closeChange(); }
}, 2000); this.getData();
} else { },
bindPickerChange: function(e) {
console.log('picker发送选择改变,携带值为', e.detail.value);
this.index = e.detail.value;
},
inputDialogToggle(detail) {
this.$refs.inputDialog.open();
},
closeChange() {
this.$refs.inputDialog.close();
},
dialogInputConfirm(e) {
if (!e) {
uni.showToast({ uni.showToast({
title: res.msg, title: '请输入目的容器',
icon: 'none' icon: 'none'
}); });
return false;
} }
}); this.request(API.changeTallyContainer, 'GET', { tally_id: this.detail.tally_id, container_sn: e }, true).then(res => {
}, if (res.code === 0) {
/** uni.showToast({
* 找出false对应的下标 title: '修改成功',
* @param {Object} arr icon: 'success'
* @param {Object} target });
*/ setTimeout(() => {
findIndex(arr, target) { this.detail.container_sn = e;
const result = []; this.closeChange();
arr.map((item, index) => { }, 2000);
if (item === target) { } else {
result.push(index); uni.showToast({
} title: res.msg,
}); icon: 'none'
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].tally_id);
},
/**
* 全选
*/
allChnage() {
this.all_flag = !this.all_flag;
this.filter_list = createArray(this.list.length, this.all_flag);
if (this.all_flag) {
this.filter_id = this.list.map(function(item) {
return item.tally_id;
}); });
} else { },
this.filter_id = []; /**
} * 找出false对应的下标
}, * @param {Object} arr
/** * @param {Object} target
* 清空数据 */
*/ findIndex(arr, target) {
clearInput() { const result = [];
this.resetChange(); arr.map((item, index) => {
this.input_flag = false; if (item === target) {
if (this.index == 0) { 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].tally_id);
},
/**
* 全选
*/
allChnage() {
this.all_flag = !this.all_flag;
this.filter_list = createArray(this.list.length, this.all_flag);
if (this.all_flag) {
this.filter_id = this.list.map(function(item) {
return item.tally_id;
});
} else {
this.filter_id = [];
}
},
/**
* 清空数据
*/
clearInput(type) {
if (type == 'start') {
//起始时间清空
this.searchParams.create_time_begin = '';
} else if (type == 'end') {
//结束时间清空
this.searchParams.create_time_end = '';
} else {
this.resetChange();
this.input_flag = false;
if (this.index == 0) {
this.searchParams.mobile_have_tally_all_search = '';
} else if (this.index == 1) {
this.searchParams.stock_in_with_stock_in_items_inhouse = '';
}
this.getData();
}
},
/**
* 单号搜索
* @param {Object} event
*/
handleInput: debounce(function(type, event) {
this.resetChange();
var val = event.target.value;
this.searchParams.mobile_have_tally_all_search = ''; this.searchParams.mobile_have_tally_all_search = '';
} else if (this.index == 1) {
this.searchParams.stock_in_with_stock_in_items_inhouse = ''; this.searchParams.stock_in_with_stock_in_items_inhouse = '';
} if (val) {
this.getData(); if (type == 1) {
}, this.searchParams.mobile_have_tally_all_search = val;
/** } else if (type == 2) {
* 单号搜索 this.searchParams.stock_in_with_stock_in_items_inhouse = val;
* @param {Object} event }
*/ this.input_flag = true;
handleInput: debounce(function(type, event) { } else {
this.resetChange(); this.input_flag = false;
var val = event.target.value;
this.searchParams.mobile_have_tally_all_search = '';
this.searchParams.stock_in_with_stock_in_items_inhouse = '';
if (val) {
if (type == 1) {
this.searchParams.mobile_have_tally_all_search = val;
} else if (type == 2) {
this.searchParams.stock_in_with_stock_in_items_inhouse = val;
} }
this.input_flag = true; this.getData();
} else { }, 500),
this.input_flag = false; showDrawer(data) {
} this.$refs.showRight.open();
this.getData(); this.detail = data;
}, 500), this.image_list = data.image_ids.split(',');
showDrawer(data) { },
this.$refs.showRight.open(); closeDrawer() {
this.detail = data; this.$refs.showRight.close();
this.image_list = data.image_ids.split(','); },
}, /**
closeDrawer() { * 获取列表数据
this.$refs.showRight.close(); */
}, getData() {
/** this.request(API.haveTallyReceiveList, 'POST', { page: this.page, limit: this.limit, ...this.searchParams }, false).then(res => {
* 获取列表数据 if (res.code === 0) {
*/ if (res.data.total > 0) {
getData() { this.hasMoreData = true;
this.request(API.haveTallyReceiveList, 'POST', { page: this.page, limit: this.limit, ...this.searchParams }, false).then(res => { this.list = this.list.concat(res.data.list);
if (res.code === 0) { this.filter_list = createArray(this.list.length, false);
if (res.data.total > 0) { } else {
this.hasMoreData = true; this.hasMoreData = false;
this.list = this.list.concat(res.data.list); }
this.filter_list = createArray(this.list.length, false);
} else { } else {
this.hasMoreData = false; uni.showToast({
title: res.msg,
icon: 'error'
});
} }
} else { });
},
/**
* 提交
*/
submitTallyReceive() {
if (this.filter_id.length == 0) {
uni.showToast({ uni.showToast({
title: res.msg, title: '请选择货品',
icon: 'error' icon: 'error'
}); });
return false;
} }
}); let filter_arr = this.findIndex(this.filter_list, true);
}, let stock_in_id = filter_arr.map(i => this.list[i].stock_in_id);
/** let stock_in_item_id = filter_arr.map(i => this.list[i].stock_in_item_id);
* 提交 let stock_in_type_arr = filter_arr.map(i => this.list[i].stock_in_type);
*/ const same = stock_in_type_arr.every((val, i, arr) => val === stock_in_type_arr[0]);
submitTallyReceive() { if (!same) {
if (this.filter_id.length == 0) {
uni.showToast({
title: '请选择货品',
icon: 'error'
});
return false;
}
let filter_arr = this.findIndex(this.filter_list, true);
let stock_in_id = filter_arr.map(i => this.list[i].stock_in_id);
let stock_in_item_id = filter_arr.map(i => this.list[i].stock_in_item_id);
let stock_in_type_arr = filter_arr.map(i => this.list[i].stock_in_type);
const same = stock_in_type_arr.every((val, i, arr) => val === stock_in_type_arr[0]);
if (!same) {
uni.showModal({
title: '提示',
content: '请勾选相同的入库单类型',
showCancel: false
});
return false;
}
this.request(API.submitTallyReceive, 'POST', { tally_id: this.filter_id.join(','), stock_in_id: stock_in_id.join(','), stock_in_item_id: stock_in_item_id.join(',') }, true).then(res => {
if (res.code === 0) {
uni.showToast({
title: '提交成功',
icon: 'success'
});
setTimeout(() => {
this.resetChange();
this.filter_id = [];
this.getData();
}, 2000);
} else {
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: res.msg, content: '请勾选相同的入库单类型',
showCancel: false showCancel: false
}); });
return false;
} }
});
},
/**
* 批量打印
*/
padTallyPrint() {
let filter_arr = this.findIndex(this.filter_list, true);
let warehouse_id = filter_arr.map(i => this.list[i].warehouse_id);
if (this.filter_id.length == 0) {
uni.showToast({
title: '请选择货品',
icon: 'error'
});
return false;
}
this.request(API.padTallyPrint, 'POST', { tally_ids: this.filter_id.join(','), warehouse_id: warehouse_id.join(',') }, true).then(res => { this.request(API.submitTallyReceive, 'POST', { tally_id: this.filter_id.join(','), stock_in_id: stock_in_id.join(','), stock_in_item_id: stock_in_item_id.join(',') }, true).then(res => {
uni.showLoading({ if (res.code === 0) {
title: '正在打印中...'
});
if (res.code === 0) {
setTimeout(() => {
uni.hideLoading();
uni.showToast({ uni.showToast({
title: '打印成功', title: '提交成功',
icon: 'success' icon: 'success'
}); });
this.getData(); setTimeout(() => {
this.filter_id = []; this.resetChange();
}, 5000); this.filter_id = [];
} else { this.getData();
uni.showModal({ }, 2000);
title: '提示', } else {
content: res.msg, uni.showModal({
showCancel: false title: '提示',
}); content: res.msg,
} showCancel: false
}); });
}, }
/** });
* 取消理货 },
*/ /**
cancelTallyReceive(type, ids, stock_in_item_id) { * 批量打印
if (type == 1) { */
padTallyPrint() {
let filter_arr = this.findIndex(this.filter_list, true);
let warehouse_id = filter_arr.map(i => this.list[i].warehouse_id);
if (this.filter_id.length == 0) { if (this.filter_id.length == 0) {
uni.showToast({ uni.showToast({
title: '请选择货品', title: '请选择货品',
...@@ -631,71 +652,107 @@ export default { ...@@ -631,71 +652,107 @@ export default {
}); });
return false; return false;
} }
var tally_id = this.filter_id.join(',');
let filter_arr = this.findIndex(this.filter_list, true);
var stock_in_item_id = filter_arr.map(i => this.list[i].stock_in_item_id);
stock_in_item_id = stock_in_item_id.join(',');
} else {
var tally_id = ids;
var stock_in_item_id = stock_in_item_id;
}
uni.showModal({ this.request(API.padTallyPrint, 'POST', { tally_ids: this.filter_id.join(','), warehouse_id: warehouse_id.join(',') }, true).then(res => {
title: '提示', uni.showLoading({
content: '确定要取消理货吗?', title: '正在打印中...'
showCancel: true, });
success: res => { if (res.code === 0) {
if (res.confirm) { setTimeout(() => {
this.request(API.cancelTallyReceive, 'POST', { tally_id: tally_id, stock_in_item_id: stock_in_item_id }, true).then(res => { uni.hideLoading();
if (res.code === 0) { uni.showToast({
uni.showToast({ title: '打印成功',
title: '取消理货成功', icon: 'success'
icon: 'success' });
}); this.getData();
setTimeout(() => { this.filter_id = [];
this.resetChange(); }, 5000);
this.filter_id = []; } else {
this.getData(); uni.showModal({
this.closeDrawer(); title: '提示',
}, 2000); content: res.msg,
} else { showCancel: false
uni.showModal({
title: '提示',
content: res.msg,
showCancel: false
});
}
}); });
} else if (res.cancel) {
// 用户点击取消操作
console.log('用户点击取消');
} }
});
},
/**
* 取消理货
*/
cancelTallyReceive(type, ids, stock_in_item_id) {
if (type == 1) {
if (this.filter_id.length == 0) {
uni.showToast({
title: '请选择货品',
icon: 'error'
});
return false;
}
var tally_id = this.filter_id.join(',');
let filter_arr = this.findIndex(this.filter_list, true);
var stock_in_item_id = filter_arr.map(i => this.list[i].stock_in_item_id);
stock_in_item_id = stock_in_item_id.join(',');
} else {
var tally_id = ids;
var stock_in_item_id = stock_in_item_id;
} }
});
}, uni.showModal({
/** title: '提示',
* 预览图片 content: '确定要取消理货吗?',
* @param {Object} img showCancel: true,
* @param {Object} index success: res => {
*/ if (res.confirm) {
previewChange(img, index) { this.request(API.cancelTallyReceive, 'POST', { tally_id: tally_id, stock_in_item_id: stock_in_item_id }, true).then(res => {
uni.previewImage({ if (res.code === 0) {
current: index, uni.showToast({
urls: img title: '取消理货成功',
}); icon: 'success'
}, });
/** setTimeout(() => {
* 重置 this.resetChange();
*/ this.filter_id = [];
resetChange() { this.getData();
this.list = []; this.closeDrawer();
this.page = 1; }, 2000);
} else {
uni.showModal({
title: '提示',
content: res.msg,
showCancel: false
});
}
});
} else if (res.cancel) {
// 用户点击取消操作
console.log('用户点击取消');
}
}
});
},
/**
* 预览图片
* @param {Object} img
* @param {Object} index
*/
previewChange(img, index) {
uni.previewImage({
current: index,
urls: img
});
},
/**
* 重置
*/
resetChange() {
this.list = [];
this.page = 1;
}
} }
} };
};
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@import '@/assets/css/tallyReceive/index.scss'; @import '@/assets/css/tallyReceive/index.scss';
</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