diff --git a/pages/common/mater-list.vue b/pages/common/mater-list.vue index 8534aa7..be3ea43 100644 --- a/pages/common/mater-list.vue +++ b/pages/common/mater-list.vue @@ -30,9 +30,7 @@ {{e.material_name}} {{e.material_code}} - - + @@ -44,7 +42,7 @@ - + @@ -63,10 +61,11 @@ title: '', val1: '', dataList: [], - // dataList: [{material_name: 'name1', checked: false, qty:'100', pcsn:'p001'},{material_name: 'name2', checked: false},{material_name: 'name3', checked: false}], + // dataList: [{material_name: 'name1', checked: false, qty:1, pcsn:'p001'},{material_name: 'name2', checked: false},{material_name: 'name3', checked: false}], pkId: '', pkObj: {}, allCheck: false, + checkedArr: [], reload: false, status: 'more', contentText: { @@ -84,6 +83,21 @@ // this.searchList() }, methods: { + handleBlur (e) { + if (e.qty) { + if (e.qty < 0) { + e.qty = 0 + } else { + e.qty = e.qty.replace(/[^0-9]/g, '') + e.qty = e.qty.replace(/^0+/, '') || '0' + } + } else { + uni.showToast({ + title: '数量必填', + icon: 'none' + }) + } + }, searchList () { this.dataList = [] this.pageNum = 1 @@ -127,8 +141,8 @@ }, toCheck (e) { e.checked = !e.checked - let arr = this.dataList.filter(el => el.checked === true) - this.allCheck = arr.length === this.dataList.length + this.checkedArr = this.dataList.filter(el => el.checked === true) + this.allCheck = this.checkedArr.length === this.dataList.length }, toEmpty () { this.val1 = '' @@ -137,10 +151,18 @@ this.pkId = '' }, toSure () { - let arr = this.dataList.filter(el => el.checked === true) - if (arr.length) { - this.$store.dispatch('setPublicArr', arr) + if (!this.checkedArr.length) { + return + } + const allValid = this.checkedArr.every(item => item.qty !== ''); + if (allValid) { + this.$store.dispatch('setPublicArr', this.checkedArr) uni.navigateBack() + } else { + uni.showToast({ + title: '数量必填', + icon: 'none' + }) } } } diff --git a/pages/entry/groupplate-instore.vue b/pages/entry/groupplate-instore.vue index 2fd738e..f171ee2 100644 --- a/pages/entry/groupplate-instore.vue +++ b/pages/entry/groupplate-instore.vue @@ -4,17 +4,6 @@ - - - 站点信息 - - - - - 载具编码 @@ -34,51 +23,33 @@ - - - 物料名称 - - - - - - - - 物料规格 - - - - - - - - 物料编号 - - - - - - - - 物料数量 - - - - - - - - 物料批次 - - - - + + + + + + + + + + + + + + + + + + + + +
物料名称物料编码数量批次号
{{e.material_name}}{{e.material_code}}{{e.qty}}{{e.pcsn}}
- +
@@ -96,12 +67,11 @@ return { title: '', val1: '', - val2: '', // options: [{text:'堆叠托盘', value:'11111111'},{text:'料箱',value: '22222222'},{text:'白色EPH',value: '33333333'}], options: [], index: '', disabled: false, - currentData: {} + dataList: [] }; }, onLoad (options) { @@ -135,29 +105,28 @@ try { let res = await getVehicleMaterial(this.val1, this.val2, this.index) if (res) { - this.currentData = res + this.dataList = res.data } else { - this.currentData = {} + this.dataList = [] } } catch (e) { - this.currentData = {} + this.dataList = [] } }, clearUp () { this.val1 = '' - this.val2 = '' this.index = '' this.disabled = false - this.currentData = {} + this.dataList = [] }, async _confirmIn () { this.disabled = true - if (!this.val1 || !this.val2 || !this.index) { + if (!this.val1 || !this.index) { this.disabled = false return } try { - let res = await confirmIn(this.val1, this.val2, this.index) + let res = await confirmIn(this.val1, this.index) if (res.code === '200') { uni.showToast({ title: res.message, diff --git a/pages/entry/mater-group.vue b/pages/entry/mater-group.vue index 8d20d2b..63e3b2c 100644 --- a/pages/entry/mater-group.vue +++ b/pages/entry/mater-group.vue @@ -4,14 +4,6 @@ - - - 源单编码 - - - - - 载具编码 @@ -28,6 +20,14 @@ + + + 源单编码 + + + + + @@ -53,7 +53,7 @@ - + @@ -78,8 +78,6 @@ val3: '', wlxxtext: '', dataList: [], - options: [], - index: '', disabled: false }; }, @@ -97,9 +95,10 @@ url: '/pages/common/mater-list?title=查询物料' }) }, - toEmpty () { + clearUp () { this.dataList = [] - this.index = '' + this.val1 = '' + this.val2 = '' this.disabled = false }, async _groupPlate () { @@ -110,11 +109,19 @@ } try { let res = await groupPlate(this.dataList, this.val2, this.val1) - uni.showToast({ - title: res.message, - icon: 'none' - }) - this.disabled = false + if (res.code === '200') { + uni.showToast({ + title: res.message, + icon: 'none' + }) + this.clearUp() + } else { + uni.showToast({ + title: res.message, + icon: 'none' + }) + this.disabled = false + } } catch (e) { this.disabled = false } diff --git a/pages/entry/mater-group2.vue b/pages/entry/mater-group2.vue index 0c78ddc..c85523e 100644 --- a/pages/entry/mater-group2.vue +++ b/pages/entry/mater-group2.vue @@ -79,7 +79,7 @@ - + @@ -122,7 +122,7 @@ url: '/pages/common/mater-list2?title=查询物料' }) }, - toEmpty () { + clearUp () { this.currentData = {} this.index = '' this.disabled = false