mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-10 20:39:48 +08:00
add complete order from collection (#626)
Co-authored-by: Elsio Sanchez <elsiosanche@gmail.com>
This commit is contained in:
parent
f2614f70fc
commit
a1bc8bb37b
@ -66,15 +66,25 @@
|
||||
<el-button type="danger" icon="el-icon-close" @click="exit" />
|
||||
<el-button type="info" icon="el-icon-minus" @click="undoPatment" />
|
||||
<el-button type="primary" :disabled="validPay || addPay" icon="el-icon-plus" @click="addCollectToList(paymentBox)" />
|
||||
<el-button type="success" :disabled="validateCompleteCollection" icon="el-icon-shopping-cart-full" />
|
||||
<el-button type="success" :disabled="validateCompleteCollection" icon="el-icon-shopping-cart-full" @click="completePreparedOrder(listPayments)" />
|
||||
</samp>
|
||||
</el-header>
|
||||
<el-main style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px;">
|
||||
<type-collection
|
||||
v-if="!updateOrderPaymentPos"
|
||||
:is-add-type-pay="listPayments"
|
||||
:currency="currencyPoint"
|
||||
:list-types-payment="fieldsList[2]"
|
||||
/>
|
||||
<div
|
||||
v-else
|
||||
key="form-loading"
|
||||
v-loading="updateOrderPaymentPos"
|
||||
:element-loading-text="$t('notifications.loading')"
|
||||
:element-loading-spinner="'el-icon-loading'"
|
||||
element-loading-background="rgba(255, 255, 255, 0.8)"
|
||||
class="view-loading"
|
||||
/>
|
||||
</el-main>
|
||||
|
||||
<el-footer height="auto" style="padding-left: 0px; padding-right: 0px;">
|
||||
@ -172,6 +182,7 @@ import fieldsListCollection from './fieldsListCollection.js'
|
||||
import typeCollection from '@/components/ADempiere/Form/VPOS/Collection/typeCollection'
|
||||
import convertAmount from '@/components/ADempiere/Form/VPOS/Collection/convertAmount/index'
|
||||
import { formatDate, formatPrice } from '@/utils/ADempiere/valueFormat.js'
|
||||
import { requestProcessOrder } from '@/api/ADempiere/form/point-of-sales.js'
|
||||
|
||||
export default {
|
||||
name: 'Collection',
|
||||
@ -449,6 +460,9 @@ export default {
|
||||
},
|
||||
convert() {
|
||||
return this.$store.getters.getConvertionPayment
|
||||
},
|
||||
updateOrderPaymentPos() {
|
||||
return this.$store.getters.getUpdatePaymentPos
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@ -744,6 +758,46 @@ export default {
|
||||
paymentUuid
|
||||
})
|
||||
},
|
||||
completePreparedOrder(payment) {
|
||||
const posUuid = this.$store.getters.getCurrentPOS.uuid
|
||||
const orderUuid = this.$route.query.action
|
||||
this.$store.dispatch('updateOrderPos', true)
|
||||
this.$store.dispatch('updatePaymentPos', true)
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: this.$t('notifications.processing'),
|
||||
showClose: true
|
||||
})
|
||||
requestProcessOrder({
|
||||
posUuid,
|
||||
orderUuid,
|
||||
createPayments: !this.isEmptyValue(payment),
|
||||
payments: payment
|
||||
})
|
||||
.then(response => {
|
||||
this.$store.dispatch('reloadOrder', response.uuid)
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: this.$t('notifications.completed'),
|
||||
showClose: true
|
||||
})
|
||||
})
|
||||
.catch(error => {
|
||||
this.$message({
|
||||
type: 'error',
|
||||
message: error.message,
|
||||
showClose: true
|
||||
})
|
||||
console.log(error)
|
||||
})
|
||||
.finally(() => {
|
||||
this.$store.dispatch('listOrdersFromServer', {
|
||||
posUuid: this.$store.getters.getCurrentPOS.uuid
|
||||
})
|
||||
this.$store.dispatch('updateOrderPos', false)
|
||||
this.$store.dispatch('updatePaymentPos', false)
|
||||
})
|
||||
},
|
||||
subscribeChanges() {
|
||||
return this.$store.subscribe((mutation, state) => {
|
||||
if (mutation.type === 'updateValueOfField') {
|
||||
|
@ -423,6 +423,7 @@ export default {
|
||||
completePreparedOrder() {
|
||||
const posUuid = this.currentPoint.uuid
|
||||
this.$store.dispatch('updateOrderPos', true)
|
||||
this.$store.dispatch('updatePaymentPos', true)
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: this.$t('notifications.processing'),
|
||||
@ -436,20 +437,26 @@ export default {
|
||||
})
|
||||
.then(response => {
|
||||
this.$store.dispatch('reloadOrder', response.uuid)
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: this.$t('notifications.completed'),
|
||||
showClose: true
|
||||
})
|
||||
})
|
||||
.catch(error => {
|
||||
this.$message({
|
||||
type: 'error',
|
||||
message: error.message,
|
||||
showClose: true
|
||||
})
|
||||
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)
|
||||
this.$store.dispatch('updatePaymentPos', false)
|
||||
})
|
||||
},
|
||||
reverseSalesTransaction() {
|
||||
|
@ -241,7 +241,8 @@ export default {
|
||||
})
|
||||
})
|
||||
},
|
||||
listPayments({ commit, rootGetters }, { posUuid, orderUuid }) {
|
||||
listPayments({ commit, dispatch }, { posUuid, orderUuid }) {
|
||||
dispatch('updatePaymentPos', true)
|
||||
requestListPayments({
|
||||
posUuid,
|
||||
orderUuid
|
||||
@ -252,6 +253,9 @@ export default {
|
||||
.catch(error => {
|
||||
console.warn(`ListPaymentsFromServer: ${error.message}. Code: ${error.code}.`)
|
||||
})
|
||||
.finally(() => {
|
||||
dispatch('updatePaymentPos', false)
|
||||
})
|
||||
},
|
||||
tenderTypeDisplaye({ commit }, tenderType) {
|
||||
const displayTenderType = tenderType.map(item => {
|
||||
|
@ -28,7 +28,8 @@ const initStateUtils = {
|
||||
splitWidthRight: 3,
|
||||
splitWidthLeft: 3,
|
||||
parametersProcessPos: [],
|
||||
updateOrder: false
|
||||
updateOrder: false,
|
||||
updatePayment: false
|
||||
}
|
||||
|
||||
export default {
|
||||
@ -97,6 +98,9 @@ export default {
|
||||
},
|
||||
setUpdateOrder(state, order) {
|
||||
state.updateOrder = order
|
||||
},
|
||||
setUpdatePayment(state, payment) {
|
||||
state.updatePayment = payment
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
@ -160,6 +164,9 @@ export default {
|
||||
},
|
||||
updateOrderPos({ commit }, params) {
|
||||
commit('setUpdateOrder', params)
|
||||
},
|
||||
updatePaymentPos({ commit }, params) {
|
||||
commit('setUpdatePayment', params)
|
||||
}
|
||||
},
|
||||
getters: {
|
||||
@ -229,6 +236,9 @@ export default {
|
||||
},
|
||||
getUpdateOrderPos: (state) => {
|
||||
return state.updateOrder
|
||||
},
|
||||
getUpdatePaymentPos: (state) => {
|
||||
return state.updatePayment
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user