接口
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
</view>
|
||||
<view class="zd-row border-bottom">
|
||||
<view class="zd-col-7">
|
||||
<span class="filter_label">总数量</span>
|
||||
<span class="filter_label filter_input_disabled">总数量</span>
|
||||
</view>
|
||||
<view class="zd-col-24">
|
||||
<input type="number" v-model="num" class="filter_input filter_input_disabled" disabled>
|
||||
@@ -50,7 +50,7 @@
|
||||
<td>{{e.material_code}}</td>
|
||||
<td>{{e.material_name}}</td>
|
||||
<td>{{e.pcsn}}</td>
|
||||
<td>{{e.qty}}</td>
|
||||
<td><input type="number" class="sin_input" v-model="e.qty" @blur="handleBlur(e)"></td>
|
||||
<td>{{e.qty_unit_name}}</td>
|
||||
<td>{{e.supp_name}}</td>
|
||||
<td>{{e.material_type_id}}</td>
|
||||
@@ -66,7 +66,7 @@
|
||||
</view>
|
||||
<view class="zd-row submit-bar">
|
||||
<button class="zd-col-5 button-default" @tap="toEmpty">清空</button>
|
||||
<button class="zd-col-18 button-primary" :class="{'button-info': !val1 || !index || !dataList.length}" :disabled="disabled" @tap="_packInConfirm">回库</button>
|
||||
<button class="zd-col-18 button-primary" :class="{'button-info': !val1 || !dataList.length}" :disabled="disabled" @tap="_leftoverMaterialBack">回库</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -74,7 +74,7 @@
|
||||
<script>
|
||||
import NavBar from '@/components/NavBar.vue'
|
||||
import SearchBox from '@/components/SearchBox.vue'
|
||||
import {queryPointInDownload, queryPointInDtl, packInConfirm} from '@/utils/getData3.js'
|
||||
import {getGroupInfo, leftoverMaterialBack} from '@/utils/getData3.js'
|
||||
export default {
|
||||
components: {
|
||||
NavBar,
|
||||
@@ -83,8 +83,6 @@
|
||||
data() {
|
||||
return {
|
||||
title: '',
|
||||
options: [],
|
||||
index: '',
|
||||
val1: '',
|
||||
num: null,
|
||||
dataList: [],
|
||||
@@ -94,7 +92,6 @@
|
||||
},
|
||||
onLoad (options) {
|
||||
this.title = options.title
|
||||
this._queryPointInDownload()
|
||||
},
|
||||
methods: {
|
||||
toEmpty () {
|
||||
@@ -102,26 +99,31 @@
|
||||
this.dataList = []
|
||||
this.disabled = false
|
||||
},
|
||||
async _queryPointInDownload () {
|
||||
try {
|
||||
let res = await queryPointInDownload()
|
||||
if (res) {
|
||||
this.options = res.data
|
||||
handleBlur (e) {
|
||||
if (e.qty) {
|
||||
if (e.qty < 0) {
|
||||
e.qty = 0
|
||||
} else {
|
||||
this.options = []
|
||||
e.qty = e.qty.replace(/[^0-9]/g, '')
|
||||
e.qty = e.qty.replace(/^0+/, '') || '0'
|
||||
if (e.qty > e.initialQty) {
|
||||
e.qty = e.initialQty
|
||||
}
|
||||
this.num = this.dataList.reduce((sum, item) => sum + Number(item.qty), 0)
|
||||
}
|
||||
} catch (e) {
|
||||
this.options = []
|
||||
} else {
|
||||
// uni.showToast({
|
||||
// title: '数量必填',
|
||||
// icon: 'none'
|
||||
// })
|
||||
}
|
||||
},
|
||||
selectChange (e) {
|
||||
this.index = e
|
||||
},
|
||||
async _queryPointInDtl () {
|
||||
async _getGroupInfo () {
|
||||
try {
|
||||
let res = await queryPointInDtl(this.val1)
|
||||
let res = await getGroupInfo(this.val1)
|
||||
if (res && res.data.length > 0) {
|
||||
this.dataList = [...res.data]
|
||||
this.num = this.dataList.reduce((sum, item) => sum + Number(item.qty), 0)
|
||||
} else {
|
||||
this.dataList = []
|
||||
}
|
||||
@@ -129,14 +131,14 @@
|
||||
this.dataList = []
|
||||
}
|
||||
},
|
||||
async _packInConfirm () {
|
||||
async _leftoverMaterialBack () {
|
||||
this.disabled = true
|
||||
if (!this.val1 || !this.index || !this.dataList.length) {
|
||||
if (!this.val1 || !this.dataList.length) {
|
||||
this.disabled = false
|
||||
return
|
||||
}
|
||||
try {
|
||||
let res = await packInConfirm(this.val1, this.index, this.dataList)
|
||||
let res = await leftoverMaterialBack(this.val1, this.dataList)
|
||||
if (res) {
|
||||
uni.showToast({
|
||||
title: res.message,
|
||||
|
||||
Reference in New Issue
Block a user