Commit e10f89e4 by LJM

bug

parent 2c4b1ef1
Showing with 288 additions and 289 deletions
...@@ -107,7 +107,9 @@ ...@@ -107,7 +107,9 @@
<text class="label" style="width: 130rpx;">客户物料编码:</text> <text class="label" style="width: 130rpx;">客户物料编码:</text>
<text class="tt">{{ item.customer_material_number }}</text> <text class="tt">{{ item.customer_material_number }}</text>
</view> </view>
<view class="btn-box row"><view class="btn row rowCenter verCenter" @click="showDrawer(item.id)">详情</view></view> <view class="btn-box row">
<view class="btn row rowCenter verCenter" @click="showDrawer(item.id)">详情</view>
</view>
</view> </view>
</view> </view>
<!-- 无数据展示 --> <!-- 无数据展示 -->
...@@ -155,10 +157,6 @@ ...@@ -155,10 +157,6 @@
<text class="label">货品编码:</text> <text class="label">货品编码:</text>
<text class="tt" style="max-width: 100%;">{{ detail.goods_sn }}</text> <text class="tt" style="max-width: 100%;">{{ detail.goods_sn }}</text>
</view> </view>
<view class="item row verCenter" style="flex: 0 0 100%;">
<text class="label">货品编码:</text>
<text class="tt" style="max-width: 100%;">{{ detail.goods_sn }}</text>
</view>
<view class="item row verCenter" style="flex: 0 0 100%;" v-if="detail.sku_id > 0"> <view class="item row verCenter" style="flex: 0 0 100%;" v-if="detail.sku_id > 0">
<text class="label">自营货品ID:</text> <text class="label">自营货品ID:</text>
<text class="tt" style="max-width: 100%;">{{ detail.sku_id }}</text> <text class="tt" style="max-width: 100%;">{{ detail.sku_id }}</text>
...@@ -247,305 +245,305 @@ ...@@ -247,305 +245,305 @@
</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 {
input_flag: false, input_flag: false,
page: 1, page: 1,
limit: 50, limit: 50,
index: 0, index: 0,
array: ['全量搜索'], array: ['全量搜索'],
list: [], list: [],
filter_list: [], //筛选已选中的列表 filter_list: [], //筛选已选中的列表
filter_id: [], //过滤处理的id filter_id: [], //过滤处理的id
detail: {}, detail: {},
hasMoreData: true, //是否分页加载 hasMoreData: true, //是否分页加载
searchParams: { searchParams: {
stock_in_type: '', stock_in_type: '',
search_type: 1, search_type: 1,
search_keyword: '', search_keyword: '',
shelf_status: '' shelf_status: ''
}
};
},
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: {
radioChange(e, type) {
this.resetChange();
if (type == 1) {
this.searchParams.stock_in_type = e.detail.value;
} else if (type == 2) {
this.searchParams.shelf_status = e.detail.value;
}
this.getData();
},
bindPickerChange: function(e) {
console.log('picker发送选择改变,携带值为', e.detail.value);
this.index = e.detail.value;
this.searchParams.search_type = parseInt(this.index) + 1;
},
showDrawer(id) {
this.onShelfRecordInfo(id);
},
closeDrawer() {
this.$refs.showRight.close();
},
/**
* 找出false对应的下标
* @param {Object} arr
* @param {Object} target
*/
findIndex(arr, target) {
const result = [];
arr.map((item, index) => {
if (item === target) {
result.push(index);
} }
}); };
return result;
}, },
/** onReachBottom() {
* 筛选过滤出选中的元素 if (!this.hasMoreData) {
*/ return;
filterChange(index) { }
this.$set(this.filter_list, index, (this.filter_list[index] = !this.filter_list[index])); this.page++;
let filter_arr = this.findIndex(this.filter_list, true); this.getData();
this.filter_id = filter_arr.map(i => this.list[i].id);
}, },
/** onNavigationBarButtonTap(e) {
* 全选 if (e.index == 0) {
*/ uni.reLaunch({
allChnage() { url: '/pages/index/index'
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.id;
}); });
} else {
this.filter_id = [];
} }
}, },
/** onShow() {
* 清空数据
*/
clearInput() {
this.resetChange(); this.resetChange();
this.input_flag = false;
this.searchParams.search_keyword = '';
this.getData(); this.getData();
}, },
/** methods: {
* 单号搜索 radioChange(e, type) {
* @param {Object} event this.resetChange();
*/ if (type == 1) {
handleInput: debounce(function(event) { this.searchParams.stock_in_type = e.detail.value;
this.resetChange(); } else if (type == 2) {
var val = event.target.value; this.searchParams.shelf_status = e.detail.value;
if (val) { }
this.input_flag = true; this.getData();
} else { },
this.input_flag = false; bindPickerChange: function(e) {
} console.log('picker发送选择改变,携带值为', e.detail.value);
this.getData(); this.index = e.detail.value;
}, 500), this.searchParams.search_type = parseInt(this.index) + 1;
/** },
* 获取列表数据 showDrawer(id) {
*/ this.onShelfRecordInfo(id);
getData() { },
this.request(API.onShelfRecordList, 'GET', { page: this.page, limit: this.limit, ...this.searchParams }, false).then(res => { closeDrawer() {
if (res.code === 0) { this.$refs.showRight.close();
if (res.data.total > 0) { },
this.hasMoreData = true; /**
this.list = this.list.concat(res.data.list); * 找出false对应的下标
this.filter_list = createArray(this.list.length, false); * @param {Object} arr
} else { * @param {Object} target
this.hasMoreData = false; */
findIndex(arr, target) {
const result = [];
arr.map((item, index) => {
if (item === target) {
result.push(index);
} }
} 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].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.id;
}); });
}
});
},
/**
* 获取详情数据
*/
onShelfRecordInfo(id) {
this.request(API.onShelfRecordInfo, 'GET', { id: id }, true).then(res => {
if (res.code === 0) {
this.$refs.showRight.open();
this.detail = res.data;
} else { } else {
uni.showToast({ this.filter_id = [];
title: res.msg,
icon: 'error'
});
} }
}); },
}, /**
/** * 清空数据
* 取消上架记录 */
*/ clearInput() {
cancelShelfRecord(type, stock_shelf_id) { this.resetChange();
if (type == 1) { this.input_flag = false;
if (this.filter_id.length == 0) { this.searchParams.search_keyword = '';
uni.showToast({ this.getData();
title: '请选择货品', },
icon: 'error' /**
}); * 单号搜索
return false; * @param {Object} event
*/
handleInput: debounce(function(event) {
this.resetChange();
var val = event.target.value;
if (val) {
this.input_flag = true;
} else {
this.input_flag = false;
} }
var stock_shelf_ids = this.filter_id.join(','); this.getData();
} else { }, 500),
var stock_shelf_ids = stock_shelf_id; /**
} * 获取列表数据
*/
uni.showModal({ getData() {
title: '提示', this.request(API.onShelfRecordList, 'GET', { page: this.page, limit: this.limit, ...this.searchParams }, false).then(res => {
content: '确定要取消上架吗?', if (res.code === 0) {
showCancel: true, if (res.data.total > 0) {
success: res => { this.hasMoreData = true;
if (res.confirm) { this.list = this.list.concat(res.data.list);
this.request(API.cancelShelfRecord, 'POST', { stock_shelf_ids: stock_shelf_ids }, true).then(res => { this.filter_list = createArray(this.list.length, false);
if (res.code === 0) { } else {
uni.showToast({ this.hasMoreData = false;
title: '取消上架成功', }
icon: 'success' } else {
}); uni.showToast({
setTimeout(() => { title: res.msg,
this.resetChange(); icon: 'error'
this.filter_id = [];
this.getData();
if (type == 2) {
this.closeDrawer();
}
}, 2000);
} else {
uni.showModal({
title: '提示',
content: res.msg,
showCancel: false
});
}
}); });
} else if (res.cancel) {
// 用户点击取消操作
console.log('用户点击取消');
} }
} });
}); },
},
/**
* @param {Object} type 1 首页 2弹出的提交
* @param {Object} stock_shelf_id
*/
submitOnShelf(type, stock_shelf_id) {
if (type == 1) {
if (this.filter_id.length == 0) {
uni.showToast({
title: '请选择货品',
icon: 'error'
});
return false;
}
var stock_shelf_ids = this.filter_id.join(',');
} else {
var stock_shelf_ids = stock_shelf_id;
}
/** /**
* 当code返回值为2的时候需要弹出框提醒是否继续,并携带参数is_support_part_shelf=1继续提交操作 * 获取详情数据
*/ */
this.request(API.submitOnShelf, 'POST', { stock_shelf_ids: stock_shelf_ids }, true).then(res => { onShelfRecordInfo(id) {
if (res.code === 0) { this.request(API.onShelfRecordInfo, 'GET', { id: id }, true).then(res => {
uni.showToast({ if (res.code === 0) {
title: '提交成功', this.$refs.showRight.open();
icon: 'success' this.detail = res.data;
}); } else {
setTimeout(() => { uni.showToast({
this.resetChange(); title: res.msg,
this.filter_id = []; icon: 'error'
this.getData(); });
if (type == 2) { }
this.closeDrawer(); });
} },
}, 2000); /**
} else if (res.code == 2) { * 取消上架记录
uni.showModal({ */
title: '提示', cancelShelfRecord(type, stock_shelf_id) {
content: res.msg, if (type == 1) {
success: data => { if (this.filter_id.length == 0) {
if (data.confirm) { uni.showToast({
this.request(API.submitOnShelf, 'POST', { stock_shelf_ids: stock_shelf_ids, is_support_part_shelf: 1 }, true).then(json => { title: '请选择货品',
if (json.code === 0) { icon: 'error'
uni.showToast({ });
title: '提交成功', return false;
icon: 'success' }
}); var stock_shelf_ids = this.filter_id.join(',');
setTimeout(() => { } else {
this.resetChange(); var stock_shelf_ids = stock_shelf_id;
this.filter_id = []; }
this.getData();
if (type == 2) { uni.showModal({
this.closeDrawer(); title: '提示',
} content: '确定要取消上架吗?',
}, 2000); showCancel: true,
} else { success: res => {
uni.showModal({ if (res.confirm) {
title: '提示', this.request(API.cancelShelfRecord, 'POST', { stock_shelf_ids: stock_shelf_ids }, true).then(res => {
content: json.msg, if (res.code === 0) {
showCancel: false uni.showToast({
}); title: '取消上架成功',
} icon: 'success'
}); });
} else if (data.cancel) { setTimeout(() => {
console.log('用户点击取消'); this.resetChange();
} this.filter_id = [];
this.getData();
if (type == 2) {
this.closeDrawer();
}
}, 2000);
} else {
uni.showModal({
title: '提示',
content: res.msg,
showCancel: false
});
}
});
} else if (res.cancel) {
// 用户点击取消操作
console.log('用户点击取消');
} }
}); }
});
},
/**
* @param {Object} type 1 首页 2弹出的提交
* @param {Object} stock_shelf_id
*/
submitOnShelf(type, stock_shelf_id) {
if (type == 1) {
if (this.filter_id.length == 0) {
uni.showToast({
title: '请选择货品',
icon: 'error'
});
return false;
}
var stock_shelf_ids = this.filter_id.join(',');
} else { } else {
uni.showModal({ var stock_shelf_ids = stock_shelf_id;
title: '提示',
content: res.msg,
showCancel: false
});
} }
}); /**
}, * 当code返回值为2的时候需要弹出框提醒是否继续,并携带参数is_support_part_shelf=1继续提交操作
/** */
* 重置 this.request(API.submitOnShelf, 'POST', { stock_shelf_ids: stock_shelf_ids }, true).then(res => {
*/ if (res.code === 0) {
resetChange() { uni.showToast({
this.list = []; title: '提交成功',
this.page = 1; icon: 'success'
});
setTimeout(() => {
this.resetChange();
this.filter_id = [];
this.getData();
if (type == 2) {
this.closeDrawer();
}
}, 2000);
} else if (res.code == 2) {
uni.showModal({
title: '提示',
content: res.msg,
success: data => {
if (data.confirm) {
this.request(API.submitOnShelf, 'POST', { stock_shelf_ids: stock_shelf_ids, is_support_part_shelf: 1 }, true).then(json => {
if (json.code === 0) {
uni.showToast({
title: '提交成功',
icon: 'success'
});
setTimeout(() => {
this.resetChange();
this.filter_id = [];
this.getData();
if (type == 2) {
this.closeDrawer();
}
}, 2000);
} else {
uni.showModal({
title: '提示',
content: json.msg,
showCancel: false
});
}
});
} else if (data.cancel) {
console.log('用户点击取消');
}
}
});
} else {
uni.showModal({
title: '提示',
content: res.msg,
showCancel: false
});
}
});
},
/**
* 重置
*/
resetChange() {
this.list = [];
this.page = 1;
}
} }
} };
};
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@import '@/assets/css/putaway/record.scss'; @import '@/assets/css/putaway/record.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