1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-13 23:20:12 +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" :is-disabled="isDisabled"
/> />
</el-col> </el-col>
<el-col :span="1" :style="styleTab"> <el-col :span="1" :style="styleTab + 'float: left;'">
<el-tag <el-tag
v-if="!isEmptyValue(getOrder.documentStatus.value)" v-if="!isEmptyValue(getOrder.documentStatus.value)"
:type="tagStatus(getOrder.documentStatus.value)" :type="tagStatus(getOrder.documentStatus.value)"
@ -43,7 +43,7 @@
</span> </span>
</el-tag> </el-tag>
</el-col> </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"> <el-button type="primary" plain :disabled="isEmptyValue(this.$route.query.action)" @click="newOrder">
{{ $t('form.pos.optionsPoinSales.salesOrder.newOrder') }} {{ $t('form.pos.optionsPoinSales.salesOrder.newOrder') }}
</el-button> </el-button>
@ -144,11 +144,12 @@
trigger="click" trigger="click"
:title="$t('form.pos.tableProduct.editQuantities')" :title="$t('form.pos.tableProduct.editQuantities')"
width="600" width="600"
@hide="showFieldLine = !showFieldLine" @hide="showFieldLine = false"
> >
<field-line <field-line
:data-line="scope.row" :data-line="scope.row"
:show-field="showFieldLine" :show-field="showFieldLine"
:current-line="currentOrderLine"
/> />
<el-button <el-button
slot="reference" slot="reference"
@ -327,9 +328,9 @@ export default {
styleTab() { styleTab() {
const isShowedPOSOptions = this.$store.getters.getIsShowPOSOptions const isShowedPOSOptions = this.$store.getters.getIsShowPOSOptions
if (this.isShowedPOSKeyLayout || isShowedPOSOptions) { 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() { namePointOfSales() {
const currentPOS = this.$store.getters.getCurrentPOS const currentPOS = this.$store.getters.getCurrentPOS

View File

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