Commit e10f89e4 by LJM

bug

parent 2c4b1ef1
Showing with 288 additions and 289 deletions
......@@ -107,7 +107,9 @@
<text class="label" style="width: 130rpx;">客户物料编码:</text>
<text class="tt">{{ item.customer_material_number }}</text>
</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>
<!-- 无数据展示 -->
......@@ -155,10 +157,6 @@
<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%;">
<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">
<text class="label">自营货品ID:</text>
<text class="tt" style="max-width: 100%;">{{ detail.sku_id }}</text>
......@@ -247,305 +245,305 @@
</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 {
input_flag: false,
page: 1,
limit: 50,
index: 0,
array: ['全量搜索'],
list: [],
filter_list: [], //筛选已选中的列表
filter_id: [], //过滤处理的id
detail: {},
hasMoreData: true, //是否分页加载
searchParams: {
stock_in_type: '',
search_type: 1,
search_keyword: '',
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);
export default {
data() {
return {
input_flag: false,
page: 1,
limit: 50,
index: 0,
array: ['全量搜索'],
list: [],
filter_list: [], //筛选已选中的列表
filter_id: [], //过滤处理的id
detail: {},
hasMoreData: true, //是否分页加载
searchParams: {
stock_in_type: '',
search_type: 1,
search_keyword: '',
shelf_status: ''
}
});
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].id);
onReachBottom() {
if (!this.hasMoreData) {
return;
}
this.page++;
this.getData();
},
/**
* 全选
*/
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;
onNavigationBarButtonTap(e) {
if (e.index == 0) {
uni.reLaunch({
url: '/pages/index/index'
});
} else {
this.filter_id = [];
}
},
/**
* 清空数据
*/
clearInput() {
onShow() {
this.resetChange();
this.input_flag = false;
this.searchParams.search_keyword = '';
this.getData();
},
/**
* 单号搜索
* @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;
}
this.getData();
}, 500),
/**
* 获取列表数据
*/
getData() {
this.request(API.onShelfRecordList, 'GET', { 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;
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);
}
} 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].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 {
uni.showToast({
title: res.msg,
icon: 'error'
});
this.filter_id = [];
}
});
},
/**
* 取消上架记录
*/
cancelShelfRecord(type, stock_shelf_id) {
if (type == 1) {
if (this.filter_id.length == 0) {
uni.showToast({
title: '请选择货品',
icon: 'error'
});
return false;
},
/**
* 清空数据
*/
clearInput() {
this.resetChange();
this.input_flag = false;
this.searchParams.search_keyword = '';
this.getData();
},
/**
* 单号搜索
* @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(',');
} else {
var stock_shelf_ids = stock_shelf_id;
}
uni.showModal({
title: '提示',
content: '确定要取消上架吗?',
showCancel: true,
success: res => {
if (res.confirm) {
this.request(API.cancelShelfRecord, 'POST', { stock_shelf_ids: stock_shelf_ids }, true).then(res => {
if (res.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: res.msg,
showCancel: false
});
}
this.getData();
}, 500),
/**
* 获取列表数据
*/
getData() {
this.request(API.onShelfRecordList, 'GET', { 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 {
uni.showToast({
title: res.msg,
icon: 'error'
});
} 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 => {
if (res.code === 0) {
uni.showToast({
title: '提交成功',
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('用户点击取消');
}
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 {
uni.showToast({
title: res.msg,
icon: 'error'
});
}
});
},
/**
* 取消上架记录
*/
cancelShelfRecord(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;
}
uni.showModal({
title: '提示',
content: '确定要取消上架吗?',
showCancel: true,
success: res => {
if (res.confirm) {
this.request(API.cancelShelfRecord, 'POST', { stock_shelf_ids: stock_shelf_ids }, true).then(res => {
if (res.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: 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 {
uni.showModal({
title: '提示',
content: res.msg,
showCancel: false
});
var stock_shelf_ids = stock_shelf_id;
}
});
},
/**
* 重置
*/
resetChange() {
this.list = [];
this.page = 1;
/**
* 当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) {
uni.showToast({
title: '提交成功',
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>
<style scoped lang="scss">
@import '@/assets/css/putaway/record.scss';
</style>
@import '@/assets/css/putaway/record.scss';
</style>
\ No newline at end of file
// const API_BASE_USER = 'http://user.liexindev.net'; //用户系统
// const API_BASE_PUR = 'http://pur.liexindev.net'; //采购系统
// const API_BASE = 'http://wms.liexindev.net'; //WMS系统
// const API_BASE_OSS = 'http://image.liexindev.net'; //oss系统
const API_BASE_USER = 'http://user.liexindev.net'; //用户系统
const API_BASE_PUR = 'http://pur.liexindev.net'; //采购系统
const API_BASE = 'http://wms.liexindev.net'; //WMS系统
const API_BASE_OSS = 'http://image.liexindev.net'; //oss系统
const API_BASE_USER = 'https://user.ichunt.net'; //用户系统
const API_BASE_PUR = 'https://purchase.ichunt.net'; //采购系统
const API_BASE = 'https://wms.ichunt.net'; //WMS系统
const API_BASE_OSS = 'https://image.ichunt.net'; //oss系统
// const API_BASE_USER = 'https://user.ichunt.net'; //用户系统
// const API_BASE_PUR = 'https://purchase.ichunt.net'; //采购系统
// const API_BASE = 'https://wms.ichunt.net'; //WMS系统
// const API_BASE_OSS = 'https://image.ichunt.net'; //oss系统
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