Commit d76c32af by LJM

修复快速移位问题

parent 7203fc48
Showing with 150 additions and 142 deletions
...@@ -229,157 +229,164 @@ ...@@ -229,157 +229,164 @@
</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 {
is_focus: true, is_focus: true,
is_submit: true, is_submit: true,
single_style: false, //区分一条和多条样式 single_style: false, //区分一条和多条样式
input_flag: false, input_flag: false,
input_flag_position_code: false, input_flag_position_code: false,
page: 1, page: 1,
limit: 1000, limit: 1000,
index: 0, index: 0,
array: ['入库批次号'], array: ['入库批次号'],
list: [], list: [],
searchParams: { searchParams: {
stock_in_batch_sn: '' //入库批次号 stock_in_batch_sn: '' //入库批次号
}, },
formParams: { formParams: {
stock_id: '', stock_id: '',
transfer_qty: '', transfer_qty: '',
position_code: '' position_code: ''
}
};
},
onLoad(options) {
this.searchParams.stock_in_batch_sn = options.stock_in_batch_sn || '';
},
watch: {
list: {
handler(newList) {
if (newList.length > 0) {
this.formParams.transfer_qty = newList[0].useable_qty;
this.formParams.stock_id = newList[0].id;
} else {
this.formParams.transfer_qty = '';
} }
}, };
deep: true
}
},
methods: {
bindPickerChange: function(e) {
console.log('picker发送选择改变,携带值为', e.detail.value);
this.index = e.detail.value;
}, },
onFocus(event) { onNavigationBarButtonTap(e) {
if (this.flag) { if (e.index == 0) {
this.flag = false; uni.reLaunch({
url: '/pages/transfer/record'
});
} }
}, },
/** onLoad(options) {
* 选中一条数据 this.searchParams.stock_in_batch_sn = options.stock_in_batch_sn || '';
*/
filterChange(targetId) {
this.list = this.list.filter(item => item.id === targetId);
this.single_style = true;
}, },
/** watch: {
* 获取列表数据 list: {
*/ handler(newList) {
getData() { if (newList.length > 0) {
this.request(API.searchStockListByYW, 'GET', { page: this.page, limit: this.limit, ...this.searchParams }, false).then(res => { this.formParams.transfer_qty = newList[0].useable_qty;
if (res.code === 0) { this.formParams.stock_id = newList[0].id;
this.list = res.data.list; } else {
this.single_style = Number(res.data.count) > 1 ? false : true; this.formParams.transfer_qty = '';
} else { }
uni.showToast({ },
title: res.msg, deep: true
icon: 'none' }
});
}
});
}, },
/** methods: {
* 快速移位 bindPickerChange: function(e) {
*/ console.log('picker发送选择改变,携带值为', e.detail.value);
quickTransfer() { this.index = e.detail.value;
this.request(API.quickTransfer, 'POST', this.formParams, true).then(res => { },
if (res.code === 0) { onFocus(event) {
this.is_submit = true; if (this.flag) {
uni.showModal({ this.flag = false;
title: '提示',
content: '移位成功',
showCancel: false,
confirmText: '确定',
success: res => {
if (res.confirm) {
//恢复初始
this.searchParams.stock_in_batch_sn = '';
this.list = [];
this.is_focus = false;
setTimeout(() => {
this.is_focus = true;
}, 800);
}
}
});
} else {
this.is_submit = false;
uni.showToast({
title: res.msg,
icon: 'none'
});
} }
}); },
}, /**
/** * 选中一条数据
* 单号搜索 */
* @param {Object} event filterChange(targetId) {
* @param {Object} type 1 目标移位 this.list = this.list.filter(item => item.id === targetId);
*/ this.single_style = true;
handleInput: debounce(function(event, type) { },
var val = event.target.value; /**
if (val) { * 获取列表数据
if (type == 1) { */
this.input_flag_position_code = true; getData() {
this.quickTransfer(); //调用快速移位 this.request(API.searchStockListByYW, 'GET', { page: this.page, limit: this.limit, ...this.searchParams }, false).then(res => {
if (res.code === 0) {
this.list = res.data.list;
this.single_style = Number(res.data.count) > 1 ? false : true;
} else {
uni.showToast({
title: res.msg,
icon: 'none'
});
}
});
},
/**
* 快速移位
*/
quickTransfer() {
this.request(API.quickTransfer, 'POST', this.formParams, true).then(res => {
if (res.code === 0) {
this.is_submit = true;
uni.showModal({
title: '提示',
content: '移位成功',
showCancel: false,
confirmText: '确定',
success: res => {
if (res.confirm) {
//恢复初始
this.searchParams.stock_in_batch_sn = '';
this.list = [];
this.is_focus = false;
setTimeout(() => {
this.is_focus = true;
}, 800);
}
}
});
} else {
this.is_submit = false;
uni.showToast({
title: res.msg,
icon: 'none'
});
}
});
},
/**
* 单号搜索
* @param {Object} event
* @param {Object} type 1 目标移位
*/
handleInput: debounce(function(event, type) {
var val = event.target.value;
if (val) {
if (type == 1) {
this.input_flag_position_code = true;
this.quickTransfer(); //调用快速移位
} else {
this.input_flag = true;
this.getData();
}
} else { } else {
this.input_flag = true; if (type == 1) {
this.getData(); this.input_flag_position_code = false;
} else {
this.input_flag = false;
this.list = [];
}
} }
} else { }, 500),
if (type == 1) { /**
* 清空数据
*/
clearInput(type) {
this.is_submit = true;
if (type) {
this.formParams.position_code = '';
this.input_flag_position_code = false; this.input_flag_position_code = false;
} else { } else {
this.input_flag = false; this.input_flag = false;
this.searchParams.stock_in_batch_sn = '';
this.list = []; this.list = [];
} }
} }
}, 500),
/**
* 清空数据
*/
clearInput(type) {
this.is_submit = true;
if (type) {
this.formParams.position_code = '';
this.input_flag_position_code = false;
} else {
this.input_flag = false;
this.searchParams.stock_in_batch_sn = '';
this.list = [];
}
} }
} };
};
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@import '@/assets/css/transfer/quick.scss'; @import '@/assets/css/transfer/quick.scss';
</style> </style>
\ No newline at end of file
// const API_BASE_USER = 'http://user.liexindev.net'; //用户系统 const API_BASE_USER = 'http://user.liexindev.net'; //用户系统
// const API_BASE_PUR = 'http://pur.liexindev.net'; //采购系统 const API_BASE_PUR = 'http://pur.liexindev.net'; //采购系统
// const API_BASE = 'http://wms.liexindev.net'; //WMS系统 const API_BASE = 'http://wms.liexindev.net'; //WMS系统
// const API_BASE_OSS = 'http://image.liexindev.net'; //oss系统 const API_BASE_OSS = 'http://image.liexindev.net'; //oss系统
const API_BASE_USER = 'https://user.ichunt.net'; //用户系统 // const API_BASE_USER = 'https://user.ichunt.net'; //用户系统
const API_BASE_PUR = 'https://purchase.ichunt.net'; //采购系统 // const API_BASE_PUR = 'https://purchase.ichunt.net'; //采购系统
const API_BASE = 'https://wms.ichunt.net'; //WMS系统 // const API_BASE = 'https://wms.ichunt.net'; //WMS系统
const API_BASE_OSS = 'https://image.ichunt.net'; //oss系统 // const API_BASE_OSS = 'https://image.ichunt.net'; //oss系统
const API = { const API = {
......
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