1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-10 20:39:48 +08:00

correcting error in quantities (#722)

This commit is contained in:
Elsio Sanchez 2021-04-07 15:06:54 -04:00 committed by GitHub
parent a91d027920
commit af96cc5d53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 13 deletions

View File

@ -33,7 +33,7 @@
:is-disabled="isDisabled"
/>
</el-col>
<el-col :span="1" :style="styleTab">
<el-col :span="1" :style="styleTab + 'float: left;'">
<el-tag
v-if="!isEmptyValue(getOrder.documentStatus.value)"
:type="tagStatus(getOrder.documentStatus.value)"
@ -43,7 +43,7 @@
</span>
</el-tag>
</el-col>
<el-col :span="1" :style="styleTab">
<el-col :span="2" :style="styleTab + 'float: right;'">
<el-button type="primary" plain :disabled="isEmptyValue(this.$route.query.action)" @click="newOrder">
{{ $t('form.pos.optionsPoinSales.salesOrder.newOrder') }}
</el-button>
@ -144,11 +144,12 @@
trigger="click"
:title="$t('form.pos.tableProduct.editQuantities')"
width="600"
@hide="showFieldLine = !showFieldLine"
@hide="showFieldLine = false"
>
<field-line
:data-line="scope.row"
:show-field="showFieldLine"
:current-line="currentOrderLine"
/>
<el-button
slot="reference"
@ -327,9 +328,9 @@ export default {
styleTab() {
const isShowedPOSOptions = this.$store.getters.getIsShowPOSOptions
if (this.isShowedPOSKeyLayout || isShowedPOSOptions) {
return 'adding-left: 0px; padding-right: 0px; padding-top: 2.5%;margin-right: 1%;'
return 'adding-left: 0px; padding-right: 0px; padding-top: 2.5%;margin-right: 1%;float: right;'
}
return 'padding-left: 0px; padding-right: 0px; padding-top: 2.2%;margin-right: 1%;'
return 'padding-left: 0px; padding-right: 0px; padding-top: 2.2%;margin-right: 1%;float: right;'
},
namePointOfSales() {
const currentPOS = this.$store.getters.getCurrentPOS

View File

@ -1,7 +1,7 @@
<template>
<div class="wrapper">
<el-row
v-if="!isEmptyValue(metadataList)"
v-if="!isEmptyValue(metadataList) && isLoadedField"
>
<template
v-for="(field, index) in metadataList"
@ -49,7 +49,11 @@ export default {
},
showField: {
type: Boolean,
default: true
default: false
},
currentLine: {
type: Object,
default: () => {}
}
},
data() {
@ -57,21 +61,28 @@ export default {
metadataList: [],
panelMetadata: {},
isLoaded: false,
isLoadedField: false,
panelType: 'custom',
fieldsListLine
fieldsListLine,
fieldsList: []
}
},
watch: {
showField(value) {
if (value && this.isEmptyValue(this.metadataList)) {
if (value && this.isEmptyValue(this.metadataList) && (this.dataLine.uuid === this.currentLine.uuid)) {
this.setFieldsList()
this.metadataList = this.setFieldsList()
this.metadataList.sort(this.sortFields)
this.isLoadedField = true
}
if (value) {
this.fillOrderLineQuantities({
currentPrice: this.dataLine.price,
quantityOrdered: this.dataLine.quantity,
discount: this.dataLine.discountRate
currentPrice: this.currentLine.price,
quantityOrdered: this.currentLine.quantity,
discount: this.currentLine.discountRate
})
this.metadataList.sort(this.sortFields)
this.isLoadedField = true
}
}
},
@ -96,7 +107,7 @@ export default {
console.warn(`LookupFactory: Get Field From Server (State) - Error ${error.code}: ${error.message}.`)
})
})
this.metadataList = fieldsList
return fieldsList
},
fillOrderLineQuantities({
currentPrice,
@ -126,6 +137,15 @@ export default {
value: discount
})
}
},
sortFields(field, nextField) {
if (field.sequence < nextField.sequence) {
return 1
}
if (field.sequence > nextField.sequence) {
return -1
}
return 0
}
}
}