mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-10 12:01:57 +08:00
support process order (#609)
Co-authored-by: Elsio Sanchez <elsiosanche@gmail.com>
This commit is contained in:
parent
f4cc107f2b
commit
c0b3c2f5c3
@ -3,6 +3,7 @@ import {
|
||||
ApiRest as requestRest,
|
||||
evaluateResponse
|
||||
} from '@/api/ADempiere/instances.js'
|
||||
import { isEmptyValue } from '@/utils/ADempiere'
|
||||
|
||||
/**
|
||||
* method in api/price-checking.js as requestGetProductPrice
|
||||
@ -110,7 +111,7 @@ export function requestUpdateOrder({
|
||||
// Get order from uuid
|
||||
export function requestGetOrder(orderUuid) {
|
||||
return requestRest({
|
||||
url: '/pos/update-order',
|
||||
url: '/pos/get-order',
|
||||
data: {
|
||||
order_uuid: orderUuid
|
||||
}
|
||||
@ -545,3 +546,59 @@ export function requestListPayments({
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Process Order
|
||||
* This request allows process a draft order with payments
|
||||
*
|
||||
* req.query.token - user token
|
||||
* Body:
|
||||
* req.body.pos_uuid - POS UUID reference
|
||||
* req.body.order_uuid - Order UUID reference
|
||||
* req.body.create_payments - Optional create payments (if is true then hope payments array)
|
||||
* req.body.payments
|
||||
* [
|
||||
* invoice_uuid - Invoice UUID reference
|
||||
* bank_uuid - Bank UUID reference
|
||||
* reference_no - Reference no
|
||||
* description - Description for Payment
|
||||
* amount - Payment Amount
|
||||
* tender_type_code - Tender Type
|
||||
* payment_date - Payment Date (default now)
|
||||
* currency_uuid - Currency UUID reference
|
||||
* ]
|
||||
*/
|
||||
export function requestProcessOrder({
|
||||
posUuid,
|
||||
orderUuid,
|
||||
createPayments,
|
||||
payments
|
||||
}) {
|
||||
if (!isEmptyValue(payments)) {
|
||||
payments = payments.map(parameter => {
|
||||
return {
|
||||
invoice_uuid: parameter.invoiceUuid,
|
||||
bank_uuid: parameter.bankUuid,
|
||||
reference_no: parameter.referenceNo,
|
||||
description: parameter.description,
|
||||
amount: parameter.amount,
|
||||
tender_type_code: parameter.tenderTypeCode,
|
||||
payment_ate: parameter.paymentDate,
|
||||
currency_uid: parameter.currency_uuid
|
||||
}
|
||||
})
|
||||
}
|
||||
return requestRest({
|
||||
url: '/pos/process-order',
|
||||
data: {
|
||||
pos_uuid: posUuid,
|
||||
order_uuid: orderUuid,
|
||||
create_payments: createPayments,
|
||||
payments: payments
|
||||
}
|
||||
})
|
||||
.then(evaluateResponse)
|
||||
.then(processOrderResponse => {
|
||||
return processOrderResponse
|
||||
})
|
||||
}
|
||||
|
@ -123,7 +123,6 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
typesPayment() {
|
||||
console.log(this.$store.getters.getListsPaymentTypes)
|
||||
return this.$store.getters.getListsPaymentTypes
|
||||
},
|
||||
listCurrency() {
|
||||
|
@ -256,13 +256,12 @@ import ListProductPrice from '@/components/ADempiere/Form/VPOS/ProductInfo/produ
|
||||
import {
|
||||
requestPrintOrder,
|
||||
requestGenerateImmediateInvoice,
|
||||
requestCompletePreparedOrder,
|
||||
// requestReverseSalesTransaction,
|
||||
requestCreateWithdrawal,
|
||||
requestCreateNewCustomerReturnOrder,
|
||||
requestCashClosing,
|
||||
requestDeleteOrder,
|
||||
requestCreateOrder
|
||||
requestCreateOrder,
|
||||
requestProcessOrder
|
||||
} from '@/api/ADempiere/form/point-of-sales.js'
|
||||
import ModalDialog from '@/components/ADempiere/Dialog'
|
||||
import posProcess from '@/utils/ADempiere/constants/posProcess'
|
||||
@ -422,9 +421,36 @@ export default {
|
||||
})
|
||||
},
|
||||
completePreparedOrder() {
|
||||
requestCompletePreparedOrder({
|
||||
orderUuid: this.$route.query.action
|
||||
const posUuid = this.currentPoint.uuid
|
||||
this.$store.dispatch('updateOrderPos', true)
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: this.$t('notifications.processing'),
|
||||
showClose: true
|
||||
})
|
||||
requestProcessOrder({
|
||||
posUuid,
|
||||
orderUuid: this.$route.query.action,
|
||||
createPayments: !this.isEmptyValue(this.$store.getters.getListPayments),
|
||||
payments: this.$store.getters.getListPayments
|
||||
})
|
||||
.then(response => {
|
||||
this.$store.dispatch('reloadOrder', response.uuid)
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error)
|
||||
})
|
||||
.finally(() => {
|
||||
this.$store.dispatch('listOrdersFromServer', {
|
||||
posUuid: this.$store.getters.getCurrentPOS.uuid
|
||||
})
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: this.$t('notifications.completed'),
|
||||
showClose: true
|
||||
})
|
||||
this.$store.dispatch('updateOrderPos', false)
|
||||
})
|
||||
},
|
||||
reverseSalesTransaction() {
|
||||
const process = this.$store.getters.getProcess(posProcess[0].uuid)
|
||||
|
@ -34,6 +34,7 @@
|
||||
</el-col>
|
||||
<el-col :span="2" :style="styleTab">
|
||||
<el-tag
|
||||
v-if="!isEmptyValue(getOrder.documentStatus.value)"
|
||||
:type="tagStatus(getOrder.documentStatus.value)"
|
||||
>
|
||||
<span v-if="isEmptyValue(getOrder.documentStatus.value)">
|
||||
@ -458,6 +459,9 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (!this.isEmptyValue(this.$route.query.action)) {
|
||||
this.$store.dispatch('reloadOrder', { orderUuid: this.$route.query.action })
|
||||
}
|
||||
setTimeout(() => {
|
||||
this.currencyDisplaye()
|
||||
}, 1500)
|
||||
|
@ -323,9 +323,9 @@ export default {
|
||||
if (requery) {
|
||||
if (this.isEmptyValue(orderUuid)) {
|
||||
orderUuid = this.$route.query.action
|
||||
if (this.isEmptyValue(orderUuid)) {
|
||||
orderUuid = this.$store.getters.getOrder.uuid // this.currentOrder.uuid
|
||||
}
|
||||
// if (this.isEmptyValue(orderUuid)) {
|
||||
// orderUuid = this.$store.getters.getOrder.uuid // this.currentOrder.uuid
|
||||
// }
|
||||
}
|
||||
if (!this.isEmptyValue(orderUuid)) {
|
||||
this.$store.dispatch('reloadOrder', { orderUuid })
|
||||
|
@ -20,7 +20,8 @@ export default {
|
||||
businessPartner: {
|
||||
value: '',
|
||||
uuid: ''
|
||||
}
|
||||
},
|
||||
uuid: ''
|
||||
},
|
||||
findOrder: {},
|
||||
listOrder: {
|
||||
|
@ -126,6 +126,17 @@ export function convertCountry(countryToConvert) {
|
||||
}
|
||||
|
||||
export function convertCurrency(currencyToConvert) {
|
||||
if (isEmptyValue(currencyToConvert)) {
|
||||
return {
|
||||
id: 0,
|
||||
uuid: '',
|
||||
iSOCode: '',
|
||||
curSymbol: '',
|
||||
description: '',
|
||||
standardPrecision: 0,
|
||||
costingPrecision: 0
|
||||
}
|
||||
}
|
||||
return {
|
||||
id: currencyToConvert.id,
|
||||
uuid: currencyToConvert.uuid,
|
||||
|
Loading…
x
Reference in New Issue
Block a user