Commit 0100b9e1 by LJM

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

parent b3d57bda
......@@ -17,6 +17,7 @@
<text class="iconfont icon-a-juxing11" @click="clearInput('end')" v-if="searchParams.create_time_end != ''"></text>
</view>
</view>
<!-- 全量搜索 -->
<view class="radio-search-box row verCenter">
<radio-group @change="radioChange" class="row verCenter">
<label class="radio row verCenter">
......@@ -260,7 +261,9 @@
</scroll-view>
</view>
</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>
</uni-drawer>
<!-- 无单号登记弹窗 -->
......@@ -477,555 +480,445 @@
</template>
<script>
import { API } from '@/util/api.js';
import { createArray } from '@/util/util.js';
import debounce from 'lodash/debounce';
import { API } from '@/util/api.js';
import { createArray } from '@/util/util.js';
import debounce from 'lodash/debounce';
export default {
data() {
return {
indicatorDots: true,
autoplay: false,
interval: 2000,
duration: 500,
input_flag: false,
page: 1,
limit: 50,
index: 0,
array: ['全量搜索', '入仓号', 'FedEx'],
list: [],
filter_list: [], //筛选已选中的列表
filter_id: [], //过滤处理的id
filter_id_warehouse_id: [], //过滤处理的仓库id
filter_id_stock_in_sn: [], //过滤处理的入库单号
detail: {}, //详情的数据
warehouse_id_index: 0,
warehouse_id_data: [],
hasMoreData: true, //是否分页加载
curr: 0,
item: ['货品信息', '其他信息'],
zyGoodsData: [], //自营货品信息
saveZyGoodsParams: [], //自营数据参数集合
searchParams: {
create_time_begin: '',
create_time_end: '',
mobile_register_all_search: '', //全量搜索
stock_in_with_stock_in_items_inhouse: '', //入仓单号
tracking_no: '' //fedex
},
maxInputLength: 8,
formParams: {
warehouse_id: '',
logistics_company: '',
logistics_sn: '',
other_info: ''
},
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 }],
standardSize: ['标准包装长宽高', '单位包装长宽高'],
standardSizeIndex: 0,
netWeight: ['标准包装净重', '单位净重'],
netWeightIndex: 0,
grossWeight: ['标准包装毛重', '单位毛重'],
grossWeightIndex: 0,
netWeightSize: ['kg', 'g'], //净重尺寸 1kg 2g
netWeightSizeIndex: 0,
grossWeightSize: ['kg', 'g'], //毛重尺寸 1kg 2g
grossWeightSizeIndex: 0,
otherAttrList: [], //其他属性
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;
export default {
data() {
return {
indicatorDots: true,
autoplay: false,
interval: 2000,
duration: 500,
input_flag: false,
page: 1,
limit: 50,
index: 0,
array: ['全量搜索', '入仓号', 'FedEx'],
list: [],
filter_list: [], //筛选已选中的列表
filter_id: [], //过滤处理的id
filter_id_warehouse_id: [], //过滤处理的仓库id
filter_id_stock_in_sn: [], //过滤处理的入库单号
detail: {}, //详情的数据
warehouse_id_index: 0,
warehouse_id_data: [],
hasMoreData: true, //是否分页加载
curr: 0,
item: ['货品信息', '其他信息'],
zyGoodsData: [], //自营货品信息
saveZyGoodsParams: [], //自营数据参数集合
searchParams: {
create_time_begin: '', //起始日期
create_time_end: '', //结束日期
mobile_register_all_search: '', //全量搜索
stock_in_with_stock_in_items_inhouse: '', //入仓单号
tracking_no: '' //fedex
},
maxInputLength: 8,
formParams: {
warehouse_id: '',
logistics_company: '',
logistics_sn: '',
other_info: ''
},
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 }],
standardSize: ['标准包装长宽高', '单位包装长宽高'],
standardSizeIndex: 0,
netWeight: ['标准包装净重', '单位净重'],
netWeightIndex: 0,
grossWeight: ['标准包装毛重', '单位毛重'],
grossWeightIndex: 0,
netWeightSize: ['kg', 'g'], //净重尺寸 1kg 2g
netWeightSizeIndex: 0,
grossWeightSize: ['kg', 'g'], //毛重尺寸 1kg 2g
grossWeightSizeIndex: 0,
otherAttrList: [], //其他属性
swiperCurr: 0
};
},
/**
* 轮播图切换监听
*/
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;
onReachBottom() {
if (!this.hasMoreData) {
return;
}
this.page++;
this.getData();
},
/**
* @param {Object} e
* @param {Object} type
*/
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;
onNavigationBarButtonTap(e) {
if (e.index == 0) {
uni.navigateTo({
url: '/pages/arrivalRegister/registered'
});
}
},
/**
* 时间选择
*/
bindTimeChange(type, e) {
onLoad() {
this.getWareHouselist();
},
onShow() {
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();
},
/**
* 找出false对应的下标
* @param {Object} arr
* @param {Object} target
*/
findIndex(arr, target) {
const result = [];
arr.map((item, index) => {
if (item === target) {
result.push(index);
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);
}
});
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].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 = [];
}
},
/**
* 清空数据
*/
clearInput(type) {
if (type == 'start') {
this.searchParams.create_time_begin = '';
} else if (type == 'end') {
this.searchParams.create_time_end = '';
} else {
this.input_flag = false;
this.resetChange();
},
radioChange(e) {
this.index = e.detail.value;
},
/**
* 轮播图切换监听
*/
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;
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 = '';
//选择标标准包净重-单位
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.getData();
},
/**
* 单号搜索
* @param {Object} event
*/
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) {
},
/**
* @param {Object} e
* @param {Object} type
*/
bindPickerChange: function(e, type) {
console.log('picker发送选择改变,携带值为', e.detail.value);
if (type == 1) {
this.searchParams.mobile_register_all_search = val;
} else if (type == 2) {
//入仓号
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
};
});
this.warehouse_id_index = e.detail.value;
this.formParams.warehouse_id = this.warehouse_id_data[e.detail.value].value;
} else {
uni.showToast({
title: res.msg,
icon: 'error'
});
this.index = e.detail.value;
}
});
},
/**
* 获取其他属性
*/
getOtherAttrList() {
this.request(API.getOtherAttrList, 'POST', {}, true).then(res => {
if (res.code === 0) {
this.otherAttrList = res.data.list;
} else {
uni.showToast({
title: res.msg,
icon: 'error'
});
},
/**
* 时间选择
*/
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;
}
});
},
/**
* @param {Object} stock_in_sn 入库单号
*
*/
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 {
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: res.msg,
icon: 'error'
title: '不能小于开始时间',
icon: 'none'
});
this.searchParams.create_time_end = this.searchParams.create_time_begin;
return false;
}
});
},
/**
* 获取列表数据
*/
getData() {
this.request(API.stockInMobileRegisterList, 'POST', { page: this.page, limit: this.limit, is_register: 0, ...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);
this.filter_list = createArray(this.list.length, false);
} else {
this.hasMoreData = false;
this.getData();
},
/**
* 找出false对应的下标
* @param {Object} arr
* @param {Object} target
*/
findIndex(arr, target) {
const result = [];
arr.map((item, index) => {
if (item === target) {
result.push(index);
}
} else {
uni.showToast({
title: res.msg,
icon: 'error'
});
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].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 入库单号
*/
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];
},
/**
* 清空数据
*/
clearInput(type) {
if (type == 'start') {
this.searchParams.create_time_begin = '';
} else if (type == 'end') {
this.searchParams.create_time_end = '';
} else {
uni.showToast({
title: res.msg,
icon: 'error'
});
this.input_flag = false;
this.resetChange();
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 = '';
}
}
});
},
/**
* 修改自营数据
*/
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);
this.getData();
},
/**
* 单号搜索
* @param {Object} event
*/
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) {
this.searchParams.mobile_register_all_search = val;
} else if (type == 2) {
//入仓号
var str = val;
if (str.startsWith('F')) {
this.searchParams.stock_in_with_stock_in_items_inhouse = val;
} else {
uni.showModal({
itle: '提示',
content: res.msg,
showCancel: false
});
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 {
uni.showModal({
title: '提示',
content: res.msg,
showCancel: false
});
this.input_flag = false;
}
});
},
/**
* 无单号登记
*/
withoutTrackingNumberRecord() {
if (!this.formParams.logistics_company) {
uni.showToast({
title: '请填写物流公司',
icon: 'error'
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 {
uni.showToast({
title: res.msg,
icon: 'error'
});
}
});
return false;
}
if (this.formParams.logistics_sn == '' && this.formParams.other_info == '') {
uni.showModal({
title: '提示',
content: '物流单号、其它信息必填其一',
showCancel: false
},
/**
* 获取其他属性
*/
getOtherAttrList() {
this.request(API.getOtherAttrList, 'POST', {}, true).then(res => {
if (res.code === 0) {
this.otherAttrList = res.data.list;
} else {
uni.showToast({
title: res.msg,
icon: 'error'
});
}
});
return false;
}
this.request(API.addStockInRegister, 'POST', this.formParams, true).then(res => {
if (res.code === 0) {
uni.showToast({
title: '登记成功',
icon: 'success'
});
setTimeout(() => {
this.resetChange();
this.getData();
this.closeDrawer();
}, 2000);
},
/**
* @param {Object} stock_in_sn 入库单号
*
*/
getZyGoodsData(stock_in_sn, type) {
if (type) {
var params = { stock_in_sn: stock_in_sn };
} else {
uni.showModal({
itle: '提示',
content: res.msg,
showCancel: false
});
var params = { stock_in_sn: stock_in_sn, is_first_check: 1 };
}
});
},
/**
* 到货登记
* @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
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({
title: res.msg,
icon: 'error'
});
}
});
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 => {
},
/**
* 获取列表数据
*/
getData() {
this.request(API.stockInMobileRegisterList, 'POST', { page: this.page, limit: this.limit, is_register: 0, ...this.searchParams }, false).then(res => {
if (res.code === 0) {
if (res.data.length > 0) {
this.getOtherAttrList();
this.showDrawer(decodeURIComponent(this.filter_id_stock_in_sn.join(',')), 1);
if (res.data.list.length > 0) {
this.hasMoreData = true;
this.list = this.list.concat(res.data.list);
this.filter_list = createArray(this.list.length, 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
});
}
});
this.hasMoreData = false;
}
} 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({
title: '提示',
content: res.msg,
......@@ -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) {
uni.showToast({
title: '登记成功',
......@@ -1044,8 +957,6 @@ export default {
this.resetChange();
this.getData();
this.closeDrawer();
this.filter_id = [];
this.filter_id_warehouse_id = [];
}, 2000);
} else {
uni.showModal({
......@@ -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>
<style scoped lang="scss">
@import '@/assets/css/arrivalRegister/index.scss';
</style>
@import '@/assets/css/arrivalRegister/index.scss';
</style>
\ No newline at end of file
<template>
<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">
<picker @change="bindPickerChange" :value="index" :range="array">
<view class="row verCenter">
......@@ -106,7 +124,9 @@
<text class="label">明细备注:</text>
<text class="desc">{{ item.upstream_remark }}</text>
</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 class="no-date column rowCenter verCenter" v-else>
......@@ -265,7 +285,9 @@
<view class="pic-list">
<view class="pic-title">理货照片:</view>
<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>
</template>
......@@ -329,7 +351,9 @@
</view>
</view>
</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>
</uni-drawer>
<!-- 修改容器 -->
......@@ -338,292 +362,289 @@
</template>
<script>
import { API } from '@/util/api.js';
import debounce from 'lodash/debounce';
import { createArray } from '@/util/util.js';
import { API } from '@/util/api.js';
import debounce from 'lodash/debounce';
import { createArray } from '@/util/util.js';
export default {
data() {
return {
page: 1,
limit: 50,
input_flag: false,
index: 0,
curr: 0,
item: ['货品信息', '其他信息'],
array: ['全量搜索', '入仓号'],
list: [],
filter_list: [], //筛选已选中的列表
filter_id: [], //入库单列表的入库登记
detail: {}, //详情的数据
image_list: [], //图片列表
hasMoreData: true, //是否分页加载
searchParams: {
mobile_have_tally_all_search: '', //全量搜索
stock_in_with_stock_in_items_inhouse: '', //入仓单号
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;
export default {
data() {
return {
page: 1,
limit: 50,
input_flag: false,
index: 0,
curr: 0,
item: ['货品信息', '其他信息'],
array: ['全量搜索', '入仓号'],
list: [],
filter_list: [], //筛选已选中的列表
filter_id: [], //入库单列表的入库登记
detail: {}, //详情的数据
image_list: [], //图片列表
hasMoreData: true, //是否分页加载
searchParams: {
create_time_begin: '', //起始日期
create_time_end: '', //结束日期
mobile_have_tally_all_search: '', //全量搜索
stock_in_with_stock_in_items_inhouse: '', //入仓单号
container_id: '', //容器,
tally_status: 0, //默认显示已理货
stock_tally_with_stock_in_stock_in_type_in: '' //入库类型
}
};
},
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;
onReachBottom() {
if (!this.hasMoreData) {
return;
}
this.page++;
this.getData();
},
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({
title: '请输入目的容器',
icon: 'none'
onNavigationBarButtonTap(e) {
if (e.index == 0) {
uni.reLaunch({
url: '/pages/index/index'
});
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({
title: '修改成功',
icon: 'success'
title: '不能小于开始时间',
icon: 'none'
});
setTimeout(() => {
this.detail.container_sn = e;
this.closeChange();
}, 2000);
} else {
this.searchParams.create_time_end = this.searchParams.create_time_begin;
return false;
}
this.getData();
},
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({
title: res.msg,
title: '请输入目的容器',
icon: 'none'
});
return false;
}
});
},
/**
* 找出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].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;
this.request(API.changeTallyContainer, 'GET', { tally_id: this.detail.tally_id, container_sn: e }, true).then(res => {
if (res.code === 0) {
uni.showToast({
title: '修改成功',
icon: 'success'
});
setTimeout(() => {
this.detail.container_sn = e;
this.closeChange();
}, 2000);
} else {
uni.showToast({
title: res.msg,
icon: 'none'
});
}
});
} else {
this.filter_id = [];
}
},
/**
* 清空数据
*/
clearInput() {
this.resetChange();
this.input_flag = false;
if (this.index == 0) {
},
/**
* 找出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].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 = '';
} 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.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;
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;
} else {
this.input_flag = false;
}
this.input_flag = true;
} else {
this.input_flag = false;
}
this.getData();
}, 500),
showDrawer(data) {
this.$refs.showRight.open();
this.detail = data;
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) {
this.hasMoreData = true;
this.list = this.list.concat(res.data.list);
this.filter_list = createArray(this.list.length, false);
this.getData();
}, 500),
showDrawer(data) {
this.$refs.showRight.open();
this.detail = data;
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) {
this.hasMoreData = true;
this.list = this.list.concat(res.data.list);
this.filter_list = createArray(this.list.length, false);
} else {
this.hasMoreData = false;
}
} else {
this.hasMoreData = false;
uni.showToast({
title: res.msg,
icon: 'error'
});
}
} else {
});
},
/**
* 提交
*/
submitTallyReceive() {
if (this.filter_id.length == 0) {
uni.showToast({
title: res.msg,
title: '请选择货品',
icon: 'error'
});
return false;
}
});
},
/**
* 提交
*/
submitTallyReceive() {
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 {
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: res.msg,
content: '请勾选相同的入库单类型',
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 => {
uni.showLoading({
title: '正在打印中...'
});
if (res.code === 0) {
setTimeout(() => {
uni.hideLoading();
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: '打印成功',
title: '提交成功',
icon: 'success'
});
this.getData();
this.filter_id = [];
}, 5000);
} else {
uni.showModal({
title: '提示',
content: res.msg,
showCancel: false
});
}
});
},
/**
* 取消理货
*/
cancelTallyReceive(type, ids, stock_in_item_id) {
if (type == 1) {
setTimeout(() => {
this.resetChange();
this.filter_id = [];
this.getData();
}, 2000);
} else {
uni.showModal({
title: '提示',
content: res.msg,
showCancel: 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: '请选择货品',
......@@ -631,71 +652,107 @@ export default {
});
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: '确定要取消理货吗?',
showCancel: true,
success: res => {
if (res.confirm) {
this.request(API.cancelTallyReceive, 'POST', { tally_id: tally_id, stock_in_item_id: stock_in_item_id }, true).then(res => {
if (res.code === 0) {
uni.showToast({
title: '取消理货成功',
icon: 'success'
});
setTimeout(() => {
this.resetChange();
this.filter_id = [];
this.getData();
this.closeDrawer();
}, 2000);
} else {
uni.showModal({
title: '提示',
content: res.msg,
showCancel: false
});
}
this.request(API.padTallyPrint, 'POST', { tally_ids: this.filter_id.join(','), warehouse_id: warehouse_id.join(',') }, true).then(res => {
uni.showLoading({
title: '正在打印中...'
});
if (res.code === 0) {
setTimeout(() => {
uni.hideLoading();
uni.showToast({
title: '打印成功',
icon: 'success'
});
this.getData();
this.filter_id = [];
}, 5000);
} else {
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;
}
});
},
/**
* 预览图片
* @param {Object} img
* @param {Object} index
*/
previewChange(img, index) {
uni.previewImage({
current: index,
urls: img
});
},
/**
* 重置
*/
resetChange() {
this.list = [];
this.page = 1;
uni.showModal({
title: '提示',
content: '确定要取消理货吗?',
showCancel: true,
success: res => {
if (res.confirm) {
this.request(API.cancelTallyReceive, 'POST', { tally_id: tally_id, stock_in_item_id: stock_in_item_id }, true).then(res => {
if (res.code === 0) {
uni.showToast({
title: '取消理货成功',
icon: 'success'
});
setTimeout(() => {
this.resetChange();
this.filter_id = [];
this.getData();
this.closeDrawer();
}, 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>
<style scoped lang="scss">
@import '@/assets/css/tallyReceive/index.scss';
</style>
@import '@/assets/css/tallyReceive/index.scss';
</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