mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-10 20:39:48 +08:00
fixe discount (#1069)
Co-authored-by: elsiosanchez <elsiossanches@gmail.com>
This commit is contained in:
parent
3978eb8fd5
commit
b94a821000
@ -53,20 +53,16 @@
|
|||||||
/>
|
/>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="5" :style="styleTab">
|
<el-col :span="5" :style="styleTab">
|
||||||
<el-form-item style="margin-top: 11%">
|
<el-form-item>
|
||||||
<template slot="label" />
|
<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
|
<el-dropdown
|
||||||
v-if="!isEmptyValue(currentDocumentType) && !isDisabled"
|
v-if="!isEmptyValue(currentDocumentType)"
|
||||||
trigger="click"
|
trigger="click"
|
||||||
style="font-size: 15px;color: black;"
|
style="padding-top: 10%;font-size: 15px;color: black;"
|
||||||
@command="changeDocumentType"
|
@command="changeDocumentType"
|
||||||
>
|
>
|
||||||
<span>
|
<span>
|
||||||
<el-icon class="el-icon-document" />
|
<icon class="el-icon-document" />
|
||||||
<b style="cursor: pointer"> {{ currentDocumentType.name }} </b>
|
<b style="cursor: pointer"> {{ currentDocumentType.name }} </b>
|
||||||
</span>
|
</span>
|
||||||
<el-dropdown-menu slot="dropdown">
|
<el-dropdown-menu slot="dropdown">
|
||||||
@ -178,7 +174,7 @@
|
|||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<div style="float: right">
|
<div style="float: right">
|
||||||
{{ $t('form.productInfo.price') }}:
|
{{ $t('form.productInfo.price') }}:
|
||||||
<b>{{ formatPrice(scope.row.product.priceStandard, pointOfSalesCurrency.iSOCode) }}</b>
|
<b>{{ formatPrice(scope.row.product.priceActual, pointOfSalesCurrency.iSOCode) }}</b>
|
||||||
<br>
|
<br>
|
||||||
{{ $t('form.productInfo.taxAmount') }}:
|
{{ $t('form.productInfo.taxAmount') }}:
|
||||||
<b>{{ scope.row.taxIndicator }}</b>
|
<b>{{ scope.row.taxIndicator }}</b>
|
||||||
@ -203,9 +199,9 @@
|
|||||||
:show-field="showFieldLine"
|
:show-field="showFieldLine"
|
||||||
:current-line="currentLineOrder"
|
: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-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>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@ -315,23 +311,23 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<span v-if="isMobile" style="float: right;padding-right: 3%;">
|
<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">
|
<p class="total">
|
||||||
{{ $t('form.pos.order.date') }}:
|
{{ $t('form.pos.order.date') }}:
|
||||||
<b v-show="!isEmptyValue(currentOrder.uuid)" class="order-info">
|
<b class="order-info">
|
||||||
{{ orderDate }}
|
{{ orderDate }}
|
||||||
</b>
|
</b>
|
||||||
</p>
|
</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">
|
<p class="total">
|
||||||
{{ $t('form.pos.order.itemQuantity') }}
|
{{ $t('form.pos.order.itemQuantity') }}
|
||||||
<b v-show="!isEmptyValue(currentOrder.uuid)" class="order-info">
|
<b class="order-info">
|
||||||
{{ getItemQuantity }}
|
{{ getItemQuantity }}
|
||||||
</b>
|
</b>
|
||||||
</p>
|
</p>
|
||||||
<p class="total">
|
<p class="total">
|
||||||
{{ $t('form.pos.order.numberLines') }}
|
{{ $t('form.pos.order.numberLines') }}
|
||||||
<b v-show="!isEmptyValue(currentOrder.uuid)" class="order-info">
|
<b class="order-info">
|
||||||
{{ numberOfLines }}
|
{{ numberOfLines }}
|
||||||
</b></p>
|
</b></p>
|
||||||
</span>
|
</span>
|
||||||
@ -339,14 +335,13 @@
|
|||||||
<p class="total">{{ $t('form.pos.order.seller') }}:<b style="float: right;">
|
<p class="total">{{ $t('form.pos.order.seller') }}:<b style="float: right;">
|
||||||
{{ currentOrder.salesRepresentative.name }}
|
{{ currentOrder.salesRepresentative.name }}
|
||||||
</b></p>
|
</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.subTotal') }}:<b 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 style="float: right;">{{ getOrderTax(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">
|
<p class="total">
|
||||||
<b>
|
<b>
|
||||||
{{ $t('form.pos.order.total') }}:
|
{{ $t('form.pos.order.total') }}:
|
||||||
</b>
|
</b>
|
||||||
<b v-show="!isEmptyValue(currentOrder.uuid)" style="float: right;">
|
<b style="float: right;">
|
||||||
<el-popover
|
<el-popover
|
||||||
:v-model="seeConversion"
|
:v-model="seeConversion"
|
||||||
placement="top-start"
|
placement="top-start"
|
||||||
@ -368,23 +363,23 @@
|
|||||||
</p>
|
</p>
|
||||||
</span>
|
</span>
|
||||||
<span v-if="!isMobile" style="float: right;padding-right: 3%;">
|
<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">
|
<p class="total">
|
||||||
{{ $t('form.pos.order.date') }}:
|
{{ $t('form.pos.order.date') }}:
|
||||||
<b v-show="!isEmptyValue(currentOrder.uuid)" class="order-info">
|
<b class="order-info">
|
||||||
{{ orderDate }}
|
{{ orderDate }}
|
||||||
</b>
|
</b>
|
||||||
</p>
|
</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.type') }}:<b class="order-info">{{ currentOrder.documentType.name }}</b></p>
|
||||||
<p class="total">
|
<p class="total">
|
||||||
{{ $t('form.pos.order.itemQuantity') }}
|
{{ $t('form.pos.order.itemQuantity') }}
|
||||||
<b v-show="!isEmptyValue(currentOrder.uuid)" class="order-info">
|
<b class="order-info">
|
||||||
{{ getItemQuantity }}
|
{{ getItemQuantity }}
|
||||||
</b>
|
</b>
|
||||||
</p>
|
</p>
|
||||||
<p class="total">
|
<p class="total">
|
||||||
{{ $t('form.pos.order.numberLines') }}
|
{{ $t('form.pos.order.numberLines') }}
|
||||||
<b v-show="!isEmptyValue(currentOrder.uuid)" class="order-info">
|
<b class="order-info">
|
||||||
{{ numberOfLines }}
|
{{ numberOfLines }}
|
||||||
</b></p>
|
</b></p>
|
||||||
</span>
|
</span>
|
||||||
@ -436,7 +431,7 @@ import {
|
|||||||
formatPrice,
|
formatPrice,
|
||||||
formatQuantity
|
formatQuantity
|
||||||
} from '@/utils/ADempiere/valueFormat.js'
|
} 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 {
|
export default {
|
||||||
name: 'Order',
|
name: 'Order',
|
||||||
@ -703,33 +698,33 @@ export default {
|
|||||||
focusPin() {
|
focusPin() {
|
||||||
this.$refs.pin.focus()
|
this.$refs.pin.focus()
|
||||||
},
|
},
|
||||||
openPin(pin) {
|
// openPin(pin) {
|
||||||
validatePin({
|
// validatePin({
|
||||||
posUuid: this.currentPointOfSales.uuid,
|
// posUuid: this.currentPointOfSales.uuid,
|
||||||
pin
|
// pin
|
||||||
})
|
// })
|
||||||
.then(response => {
|
// .then(response => {
|
||||||
this.validatePin = false
|
// this.validatePin = false
|
||||||
this.pin = ''
|
// this.pin = ''
|
||||||
this.visible = false
|
// this.visible = false
|
||||||
this.pinAction(this.attributePin)
|
// this.pinAction(this.attributePin)
|
||||||
})
|
// })
|
||||||
.catch(error => {
|
// .catch(error => {
|
||||||
console.error(error.message)
|
// console.error(error.message)
|
||||||
this.$message({
|
// this.$message({
|
||||||
type: 'error',
|
// type: 'error',
|
||||||
message: error.message,
|
// message: error.message,
|
||||||
showClose: true
|
// showClose: true
|
||||||
})
|
// })
|
||||||
this.pin = ''
|
// this.pin = ''
|
||||||
})
|
// })
|
||||||
.finally(() => {
|
// .finally(() => {
|
||||||
this.closePin()
|
// this.closePin()
|
||||||
})
|
// })
|
||||||
},
|
// },
|
||||||
closePin() {
|
// closePin() {
|
||||||
this.visible = false
|
// this.visible = false
|
||||||
},
|
// },
|
||||||
closeConvertion() {
|
closeConvertion() {
|
||||||
this.seeConversion = false
|
this.seeConversion = false
|
||||||
},
|
},
|
||||||
@ -753,10 +748,8 @@ export default {
|
|||||||
this.createOrder({ withLine: false, newOrder: true })
|
this.createOrder({ withLine: false, newOrder: true })
|
||||||
},
|
},
|
||||||
changePos(pointOfSales) {
|
changePos(pointOfSales) {
|
||||||
if (pointOfSales.uuid !== this.currentPointOfSales.uuid) {
|
this.$store.dispatch('setCurrentPOS', pointOfSales)
|
||||||
this.$store.dispatch('setCurrentPOS', pointOfSales)
|
this.clearOrder()
|
||||||
this.clearOrder()
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
changeWarehouse(warehouse) {
|
changeWarehouse(warehouse) {
|
||||||
this.attributePin = {
|
this.attributePin = {
|
||||||
@ -800,42 +793,42 @@ export default {
|
|||||||
this.$refs.linesTable.setCurrentRow(this.listOrderLine[this.currentTable])
|
this.$refs.linesTable.setCurrentRow(this.listOrderLine[this.currentTable])
|
||||||
this.currentOrderLine = 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>
|
</script>
|
||||||
|
@ -138,7 +138,7 @@ export default {
|
|||||||
}
|
}
|
||||||
if (value) {
|
if (value) {
|
||||||
this.fillOrderLineQuantities({
|
this.fillOrderLineQuantities({
|
||||||
currentPrice: this.currentLine.price,
|
currentPrice: this.currentLine.priceList,
|
||||||
quantityOrdered: this.currentLine.quantity,
|
quantityOrdered: this.currentLine.quantity,
|
||||||
discount: this.currentLine.discountRate
|
discount: this.currentLine.discountRate
|
||||||
})
|
})
|
||||||
|
@ -74,8 +74,7 @@ export default {
|
|||||||
quantityOrdered: 0,
|
quantityOrdered: 0,
|
||||||
uuid: ''
|
uuid: ''
|
||||||
},
|
},
|
||||||
totalAmountConvertedLine: {
|
totalAmountConvertedLine: {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -93,6 +92,13 @@ export default {
|
|||||||
return converted.divideRate
|
return converted.divideRate
|
||||||
}
|
}
|
||||||
return 1
|
return 1
|
||||||
|
},
|
||||||
|
isPosRequiredPin() {
|
||||||
|
const pos = this.$store.getters.posAttributes.currentPointOfSales
|
||||||
|
if (!this.isEmptyValue(pos.isPosRequiredPin)) {
|
||||||
|
return pos.isPosRequiredPin
|
||||||
|
}
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -105,7 +111,7 @@ export default {
|
|||||||
//
|
//
|
||||||
case this.$t('form.pos.tableProduct.editQuantities'):
|
case this.$t('form.pos.tableProduct.editQuantities'):
|
||||||
this.fillOrderLineQuantities({
|
this.fillOrderLineQuantities({
|
||||||
currentPrice: this.currentOrderLine.currentPrice,
|
currentPrice: this.currentOrderLine.priceList,
|
||||||
quantityOrdered: this.currentOrderLine.quantityOrdered,
|
quantityOrdered: this.currentOrderLine.quantityOrdered,
|
||||||
discount: this.currentOrderLine.discount
|
discount: this.currentOrderLine.discount
|
||||||
})
|
})
|
||||||
@ -173,7 +179,7 @@ export default {
|
|||||||
})
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.fillOrderLineQuantities({
|
this.fillOrderLineQuantities({
|
||||||
currentPrice: response.price,
|
currentPrice: response.priceList,
|
||||||
quantityOrdered: response.quantity,
|
quantityOrdered: response.quantity,
|
||||||
discount: response.discountRate
|
discount: response.discountRate
|
||||||
})
|
})
|
||||||
@ -191,21 +197,24 @@ export default {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteOrderLine(lineSelection) {
|
deleteOrderLine(lineSelection) {
|
||||||
deleteOrderLine({
|
if (!this.isPosRequiredPin) {
|
||||||
orderLineUuid: lineSelection.uuid
|
deleteOrderLine({
|
||||||
})
|
orderLineUuid: lineSelection.uuid
|
||||||
.then(() => {
|
|
||||||
this.$store.dispatch('reloadOrder', { orderUuid: this.$store.getters.posAttributes.currentPointOfSales.currentOrder.uuid })
|
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.then(() => {
|
||||||
console.error(error.message)
|
this.$store.dispatch('reloadOrder', { orderUuid: this.$store.getters.posAttributes.currentPointOfSales.currentOrder.uuid })
|
||||||
this.$message({
|
|
||||||
type: 'error',
|
|
||||||
message: error.message,
|
|
||||||
showClose: true
|
|
||||||
})
|
})
|
||||||
})
|
.catch(error => {
|
||||||
|
console.error(error.message)
|
||||||
|
this.$message({
|
||||||
|
type: 'error',
|
||||||
|
message: error.message,
|
||||||
|
showClose: true
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
convertedAmount() {
|
convertedAmount() {
|
||||||
if (!this.isEmptyValue(this.currentPointOfSales.displayCurrency) && this.totalAmountConverted === 1) {
|
if (!this.isEmptyValue(this.currentPointOfSales.displayCurrency) && this.totalAmountConverted === 1) {
|
||||||
@ -229,7 +238,7 @@ export default {
|
|||||||
}
|
}
|
||||||
const currency = this.pointOfSalesCurrency.iSOCode
|
const currency = this.pointOfSalesCurrency.iSOCode
|
||||||
if (columnName === 'CurrentPrice') {
|
if (columnName === 'CurrentPrice') {
|
||||||
return this.formatPrice(row.priceActual, currency)
|
return this.formatPrice(row.priceList, currency)
|
||||||
} else if (columnName === 'QtyOrdered') {
|
} else if (columnName === 'QtyOrdered') {
|
||||||
return this.formatQuantity(row.quantityOrdered)
|
return this.formatQuantity(row.quantityOrdered)
|
||||||
} else if (columnName === 'Discount') {
|
} else if (columnName === 'Discount') {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user