1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-07 18:25:45 +08:00

fixe discount (#1069)

Co-authored-by: elsiosanchez <elsiossanches@gmail.com>
This commit is contained in:
Elsio Sanchez 2021-08-17 07:55:45 -04:00 committed by GitHub
parent 3978eb8fd5
commit b94a821000
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 111 additions and 109 deletions

View File

@ -53,20 +53,16 @@
/>
</el-col>
<el-col :span="5" :style="styleTab">
<el-form-item style="margin-top: 11%">
<el-form-item>
<template slot="label" />
<el-button v-if="isDisabled" type="text" :disabled="isDisabled" style="color: gray;">
<el-icon class="el-icon-document" />
<b> {{ currentDocumentType.name }} </b>
</el-button>
<el-dropdown
v-if="!isEmptyValue(currentDocumentType) && !isDisabled"
v-if="!isEmptyValue(currentDocumentType)"
trigger="click"
style="font-size: 15px;color: black;"
style="padding-top: 10%;font-size: 15px;color: black;"
@command="changeDocumentType"
>
<span>
<el-icon class="el-icon-document" />
<icon class="el-icon-document" />
<b style="cursor: pointer"> {{ currentDocumentType.name }} </b>
</span>
<el-dropdown-menu slot="dropdown">
@ -178,7 +174,7 @@
<el-col :span="8">
<div style="float: right">
{{ $t('form.productInfo.price') }}:
<b>{{ formatPrice(scope.row.product.priceStandard, pointOfSalesCurrency.iSOCode) }}</b>
<b>{{ formatPrice(scope.row.product.priceActual, pointOfSalesCurrency.iSOCode) }}</b>
<br>
{{ $t('form.productInfo.taxAmount') }}:
<b>{{ scope.row.taxIndicator }}</b>
@ -203,9 +199,9 @@
:show-field="showFieldLine"
:current-line="currentLineOrder"
/>
<el-button slot="reference" type="success" icon="el-icon-edit" :disabled="isDisabled" size="mini" style="margin-right: 3%;" @click="showEditLine(scope.row)" />
<el-button slot="reference" type="success" icon="el-icon-edit" size="mini" style="margin-right: 3%;" @click="showEditLine(scope.row)" />
</el-popover>
<el-button type="danger" icon="el-icon-delete" size="mini" :disabled="isDisabled" @click="deleteOrderLine(scope.row)" />
<el-button type="danger" icon="el-icon-delete" size="mini" @click="deleteOrderLine(scope.row)" />
</template>
</el-table-column>
</el-table>
@ -315,23 +311,23 @@
</p>
</div>
<span v-if="isMobile" style="float: right;padding-right: 3%;">
<p class="total">{{ $t('form.pos.order.order') }}: <b v-show="!isEmptyValue(currentOrder.uuid)" class="order-info">{{ currentOrder.documentNo }}</b></p>
<p class="total">{{ $t('form.pos.order.order') }}: <b class="order-info">{{ currentOrder.documentNo }}</b></p>
<p class="total">
{{ $t('form.pos.order.date') }}:
<b v-show="!isEmptyValue(currentOrder.uuid)" class="order-info">
<b class="order-info">
{{ orderDate }}
</b>
</p>
<p class="total">{{ $t('form.pos.order.type') }}:<b v-show="!isEmptyValue(currentOrder.uuid)" class="order-info">{{ currentOrder.documentType.name }}</b></p>
<p class="total">{{ $t('form.pos.order.type') }}:<b class="order-info">{{ currentOrder.documentType.name }}</b></p>
<p class="total">
{{ $t('form.pos.order.itemQuantity') }}
<b v-show="!isEmptyValue(currentOrder.uuid)" class="order-info">
<b class="order-info">
{{ getItemQuantity }}
</b>
</p>
<p class="total">
{{ $t('form.pos.order.numberLines') }}
<b v-show="!isEmptyValue(currentOrder.uuid)" class="order-info">
<b class="order-info">
{{ numberOfLines }}
</b></p>
</span>
@ -339,14 +335,13 @@
<p class="total">{{ $t('form.pos.order.seller') }}:<b style="float: right;">
{{ currentOrder.salesRepresentative.name }}
</b></p>
<p class="total"> {{ $t('form.pos.order.subTotal') }}:<b v-show="!isEmptyValue(currentOrder.uuid)" class="order-info">{{ formatPrice(currentOrder.totalLines, pointOfSalesCurrency.iSOCode) }}</b></p>
<p class="total"> {{ $t('form.pos.order.discount') }}:<b v-show="!isEmptyValue(currentOrder.uuid)" class="order-info">{{ formatPrice(0, pointOfSalesCurrency.iSOCode) }}</b> </p>
<p class="total"> {{ $t('form.pos.order.tax') }}:<b v-show="!isEmptyValue(currentOrder.uuid)" style="float: right;">{{ getOrderTax(pointOfSalesCurrency.iSOCode) }}</b> </p>
<p class="total"> {{ $t('form.pos.order.subTotal') }}:<b class="order-info">{{ formatPrice(currentOrder.totalLines, pointOfSalesCurrency.iSOCode) }}</b></p>
<p class="total"> {{ $t('form.pos.order.tax') }}:<b style="float: right;">{{ getOrderTax(pointOfSalesCurrency.iSOCode) }}</b> </p>
<p class="total">
<b>
{{ $t('form.pos.order.total') }}:
</b>
<b v-show="!isEmptyValue(currentOrder.uuid)" style="float: right;">
<b style="float: right;">
<el-popover
:v-model="seeConversion"
placement="top-start"
@ -368,23 +363,23 @@
</p>
</span>
<span v-if="!isMobile" style="float: right;padding-right: 3%;">
<p class="total">{{ $t('form.pos.order.order') }}: <b v-show="!isEmptyValue(currentOrder.uuid)" class="order-info">{{ currentOrder.documentNo }}</b></p>
<p class="total">{{ $t('form.pos.order.order') }}: <b class="order-info">{{ currentOrder.documentNo }}</b></p>
<p class="total">
{{ $t('form.pos.order.date') }}:
<b v-show="!isEmptyValue(currentOrder.uuid)" class="order-info">
<b class="order-info">
{{ orderDate }}
</b>
</p>
<p class="total">{{ $t('form.pos.order.type') }}:<b class="order-info">{{ currentOrder.documentType.name }}</b></p>
<p class="total">
{{ $t('form.pos.order.itemQuantity') }}
<b v-show="!isEmptyValue(currentOrder.uuid)" class="order-info">
<b class="order-info">
{{ getItemQuantity }}
</b>
</p>
<p class="total">
{{ $t('form.pos.order.numberLines') }}
<b v-show="!isEmptyValue(currentOrder.uuid)" class="order-info">
<b class="order-info">
{{ numberOfLines }}
</b></p>
</span>
@ -436,7 +431,7 @@ import {
formatPrice,
formatQuantity
} from '@/utils/ADempiere/valueFormat.js'
import { validatePin } from '@/api/ADempiere/form/point-of-sales.js'
// import { validatePin } from '@/api/ADempiere/form/point-of-sales.js'
export default {
name: 'Order',
@ -703,33 +698,33 @@ export default {
focusPin() {
this.$refs.pin.focus()
},
openPin(pin) {
validatePin({
posUuid: this.currentPointOfSales.uuid,
pin
})
.then(response => {
this.validatePin = false
this.pin = ''
this.visible = false
this.pinAction(this.attributePin)
})
.catch(error => {
console.error(error.message)
this.$message({
type: 'error',
message: error.message,
showClose: true
})
this.pin = ''
})
.finally(() => {
this.closePin()
})
},
closePin() {
this.visible = false
},
// openPin(pin) {
// validatePin({
// posUuid: this.currentPointOfSales.uuid,
// pin
// })
// .then(response => {
// this.validatePin = false
// this.pin = ''
// this.visible = false
// this.pinAction(this.attributePin)
// })
// .catch(error => {
// console.error(error.message)
// this.$message({
// type: 'error',
// message: error.message,
// showClose: true
// })
// this.pin = ''
// })
// .finally(() => {
// this.closePin()
// })
// },
// closePin() {
// this.visible = false
// },
closeConvertion() {
this.seeConversion = false
},
@ -753,10 +748,8 @@ export default {
this.createOrder({ withLine: false, newOrder: true })
},
changePos(pointOfSales) {
if (pointOfSales.uuid !== this.currentPointOfSales.uuid) {
this.$store.dispatch('setCurrentPOS', pointOfSales)
this.clearOrder()
}
this.$store.dispatch('setCurrentPOS', pointOfSales)
this.clearOrder()
},
changeWarehouse(warehouse) {
this.attributePin = {
@ -800,42 +793,42 @@ export default {
this.$refs.linesTable.setCurrentRow(this.listOrderLine[this.currentTable])
this.currentOrderLine = this.listOrderLine[this.currentTable]
}
},
pinAction(action) {
if (action.type === 'updateOrder') {
switch (action.columnName) {
case 'QtyEntered':
case 'PriceEntered':
case 'Discount':
this.updateOrderLine(action)
break
case 'C_DocTypeTarget_ID': {
const documentTypeUuid = this.$store.getters.getValueOfField({
containerUuid: this.$route.meta.uuid,
columnName: 'C_DocTypeTarget_ID_UUID'
})
this.$store.dispatch('updateOrder', {
orderUuid: this.$route.query.action,
posUuid: this.currentPointOfSales.uuid,
documentTypeUuid
})
break
}
}
} else if (action.type === 'actionPos') {
switch (action.action) {
case 'changeWarehouse':
this.$store.commit('setCurrentWarehousePos', action)
break
case 'changeDocumentType':
this.$store.commit('setCurrentDocumentTypePos', action)
break
case 'changePriceList':
this.$store.commit('setCurrentPriceList', action)
break
}
}
}
// pinAction(action) {
// if (action.type === 'updateOrder') {
// switch (action.columnName) {
// case 'QtyEntered':
// case 'PriceEntered':
// case 'Discount':
// this.updateOrderLine(action)
// break
// case 'C_DocTypeTarget_ID': {
// const documentTypeUuid = this.$store.getters.getValueOfField({
// containerUuid: this.$route.meta.uuid,
// columnName: 'C_DocTypeTarget_ID_UUID'
// })
// this.$store.dispatch('updateOrder', {
// orderUuid: this.$route.query.action,
// posUuid: this.currentPointOfSales.uuid,
// documentTypeUuid
// })
// break
// }
// }
// } else if (action.type === 'actionPos') {
// switch (action.action) {
// case 'changeWarehouse':
// this.$store.commit('setCurrentWarehousePos', action)
// break
// case 'changeDocumentType':
// this.$store.commit('setCurrentDocumentTypePos', action)
// break
// case 'changePriceList':
// this.$store.commit('setCurrentPriceList', action)
// break
// }
// }
// }
}
}
</script>

View File

@ -138,7 +138,7 @@ export default {
}
if (value) {
this.fillOrderLineQuantities({
currentPrice: this.currentLine.price,
currentPrice: this.currentLine.priceList,
quantityOrdered: this.currentLine.quantity,
discount: this.currentLine.discountRate
})

View File

@ -74,8 +74,7 @@ export default {
quantityOrdered: 0,
uuid: ''
},
totalAmountConvertedLine: {
}
totalAmountConvertedLine: {}
}
},
computed: {
@ -93,6 +92,13 @@ export default {
return converted.divideRate
}
return 1
},
isPosRequiredPin() {
const pos = this.$store.getters.posAttributes.currentPointOfSales
if (!this.isEmptyValue(pos.isPosRequiredPin)) {
return pos.isPosRequiredPin
}
return false
}
},
methods: {
@ -105,7 +111,7 @@ export default {
//
case this.$t('form.pos.tableProduct.editQuantities'):
this.fillOrderLineQuantities({
currentPrice: this.currentOrderLine.currentPrice,
currentPrice: this.currentOrderLine.priceList,
quantityOrdered: this.currentOrderLine.quantityOrdered,
discount: this.currentOrderLine.discount
})
@ -173,7 +179,7 @@ export default {
})
.then(response => {
this.fillOrderLineQuantities({
currentPrice: response.price,
currentPrice: response.priceList,
quantityOrdered: response.quantity,
discount: response.discountRate
})
@ -191,21 +197,24 @@ export default {
})
})
},
deleteOrderLine(lineSelection) {
deleteOrderLine({
orderLineUuid: lineSelection.uuid
})
.then(() => {
this.$store.dispatch('reloadOrder', { orderUuid: this.$store.getters.posAttributes.currentPointOfSales.currentOrder.uuid })
if (!this.isPosRequiredPin) {
deleteOrderLine({
orderLineUuid: lineSelection.uuid
})
.catch(error => {
console.error(error.message)
this.$message({
type: 'error',
message: error.message,
showClose: true
.then(() => {
this.$store.dispatch('reloadOrder', { orderUuid: this.$store.getters.posAttributes.currentPointOfSales.currentOrder.uuid })
})
})
.catch(error => {
console.error(error.message)
this.$message({
type: 'error',
message: error.message,
showClose: true
})
})
}
},
convertedAmount() {
if (!this.isEmptyValue(this.currentPointOfSales.displayCurrency) && this.totalAmountConverted === 1) {
@ -229,7 +238,7 @@ export default {
}
const currency = this.pointOfSalesCurrency.iSOCode
if (columnName === 'CurrentPrice') {
return this.formatPrice(row.priceActual, currency)
return this.formatPrice(row.priceList, currency)
} else if (columnName === 'QtyOrdered') {
return this.formatQuantity(row.quantityOrdered)
} else if (columnName === 'Discount') {