1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-10 20:39:48 +08:00

Feature/support pos (#577)

* when cancelled, you must exit the collection window

* when there is no conversion rate it should show the amount receivable in zero
This commit is contained in:
Elsio Sanchez 2021-02-01 22:58:14 -04:00 committed by GitHub
parent 4368cf71c9
commit d83b109aef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 78 additions and 27 deletions

View File

@ -73,9 +73,21 @@ export default {
computed: {
displayCurrency() {
return this.$store.getters.getValueOfField({
containerUuid: this.containerUuid,
containerUuid: 'Collection-Convert-Amount',
columnName: 'DisplayColumn_C_Currency_ID'
})
},
typeCurrency() {
return this.$store.getters.getValueOfField({
containerUuid: 'Collection-Convert-Amount',
columnName: 'C_Currency_ID'
})
},
currencyUuid() {
return this.$store.getters.getValueOfField({
containerUuid: 'Collection-Convert-Amount',
columnName: 'C_Currency_ID_UUID'
})
}
},
created() {

View File

@ -34,7 +34,6 @@ export default [
// Bank
{
tableName,
elementColumnName: 'C_Bank_ID',
columnName: 'C_Bank_ID',
isFromDictionary: true,
overwriteDefinition: {

View File

@ -73,7 +73,7 @@
</b>
</el-link>
</el-checkbox>
<el-button type="danger" icon="el-icon-close" @click="cancel" />
<el-button type="danger" icon="el-icon-close" @click="exit" />
<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" />
</samp>
@ -233,14 +233,17 @@ export default {
},
computed: {
validateCompleteCollection() {
if (this.order.grandTotal === this.pay) {
return false
} else if (this.isCashAmt >= this.change) {
return false
} else if (this.pay >= this.order.grandTotal && this.checked) {
return false
let collection
if (this.pay === this.order.grandTotal) {
collection = false
} else {
if (this.pay >= this.order.grandTotal && (this.isCashAmt >= this.change) || this.checked) {
collection = false
} else {
collection = true
}
}
return true
return collection
},
fullCopper() {
if ((this.change > this.isCashAmt) && this.pay > this.order.grandTotal) {
@ -406,7 +409,7 @@ export default {
},
currencyUuid() {
return this.$store.getters.getValueOfField({
containerUuid: this.containerUuid,
containerUuid: 'Collection',
columnName: 'C_Currency_ID_UUID'
})
},
@ -419,9 +422,12 @@ export default {
multiplyRate() {
return this.$store.getters.getMultiplyRate
},
multiplyRateCollection() {
return this.$store.getters.getMultiplyRateCollection
},
converCurrency() {
return this.$store.getters.getValueOfField({
containerUuid: 'Collection-Convert-Amount',
containerUuid: 'Collection',
columnName: 'C_Currency_ID_UUID'
})
},
@ -442,7 +448,7 @@ export default {
return true
},
fieldpending() {
return this.pending * this.multiplyRate
return this.pending * this.multiplyRateCollection
}
},
watch: {
@ -470,12 +476,13 @@ export default {
}
if (!this.isEmptyValue(value)) {
this.$store.dispatch('conversionMultiplyRate', {
containerUuid: 'Collection',
conversionTypeUuid: this.$store.getters.getCurrentPOS.conversionTypeUuid,
currencyFromUuid: this.currencyPoint.uuid,
currencyToUuid: value
})
} else {
this.$store.commit('currencyMultiplyRate', 1)
this.$store.commit('currencyMultiplyRateCollection', 1)
}
},
convertAllPayment(value) {
@ -487,6 +494,7 @@ export default {
converCurrency(value) {
if (!this.isEmptyValue(value)) {
this.$store.dispatch('conversionMultiplyRate', {
containerUuid: 'Collection',
conversionTypeUuid: this.$store.getters.getCurrentPOS.conversionTypeUuid,
currencyFromUuid: this.currencyPoint.uuid,
currencyToUuid: value
@ -632,6 +640,9 @@ export default {
this.$store.dispatch('conversionDivideRate', 1)
this.$store.commit('currencyMultiplyRate', 1)
},
exit() {
this.$store.commit('setShowPOSCollection', false)
},
getPriceApplyingDiscount(price, discount) {
if (this.isEmptyValue(price)) {
price = 0

View File

@ -410,7 +410,7 @@ export default {
},
currencyUuid() {
return this.$store.getters.getValueOfField({
containerUuid: this.containerUuid,
containerUuid: 'Collection-Convert-Amount',
columnName: 'C_Currency_ID_UUID'
})
},
@ -434,6 +434,7 @@ export default {
converCurrency(value) {
if (!this.isEmptyValue(value)) {
this.$store.dispatch('conversionMultiplyRate', {
containerUuid: 'Order',
conversionTypeUuid: this.$store.getters.getCurrentPOS.conversionTypeUuid,
currencyFromUuid: this.currencyPoint.uuid,
currencyToUuid: value
@ -449,7 +450,7 @@ export default {
this.newOrder()
},
openCollectionPanel() {
this.$store.commit('setShowPOSCollection', !this.$store.getters.getShowCollectionPos)
this.$store.commit('setShowPOSCollection', true)
this.isShowedPOSKeyLayout = true
this.$store.commit('setShowPOSOptions', false)
},

View File

@ -224,10 +224,12 @@ export default {
containerUuid: this.metadata.containerUuid
})
values = this.convertValuesToSend(values)
this.$store.dispatch('listOrdersFromServer', {
...values
})
const point = this.$store.getters.getPointOfSalesUuid
if (!this.isEmptyValue(point)) {
this.$store.dispatch('listOrdersFromServer', {
...values
})
}
},
handleChangePage(newPage) {
this.$store.dispatch('setOrdersListPageNumber', newPage)

View File

@ -7,7 +7,9 @@ const collection = {
state: {
paymentBox: [],
multiplyRate: 1,
divideRate: 1
divideRate: 1,
multiplyRateCollection: 1,
divideRateCollection: 1
},
mutations: {
addPaymentBox(state, paymentBox) {
@ -18,6 +20,12 @@ const collection = {
},
currencyDivideRate(state, divideRate) {
state.divideRate = divideRate
},
currencyMultiplyRateCollection(state, multiplyRateCollection) {
state.multiplyRateCollection = multiplyRateCollection
},
currencyDivideRateCollection(state, divideRateCollection) {
state.divideRateCollection = divideRateCollection
}
},
actions: {
@ -25,12 +33,16 @@ const collection = {
* creating boxes with the payment list
*/
setPaymentBox({ state, commit, getters }, params) {
const payments = undefined
const payments = getters.getPaymentBox.find(element => {
if (params.tenderType === 'X' && element.currency.id === params.currency.id) {
return element
}
})
if (isEmptyValue(payments)) {
commit('addPaymentBox', params)
} else {
const addPayment = getters.getPaymentBox.map(item => {
if (item.tenderType === params.tenderType && item.currency.id === params.currency.id) {
if ((item.tenderType === params.tenderType) && item.currency.id === params.currency.id) {
return {
...item,
payAmt: item.payAmt + params.payAmt,
@ -58,7 +70,11 @@ const collection = {
})
.then(response => {
const divideRate = isEmptyValue(response.divideRate) ? 1 : response.divideRate
commit('currencyDivideRate', divideRate)
if (params.containerUuid === 'Collection') {
commit('currencyDivideRateCollection', divideRate)
} else {
commit('currencyDivideRate', divideRate)
}
})
.catch(error => {
console.warn(`conversionDivideRate: ${error.message}. Code: ${error.code}.`)
@ -70,6 +86,7 @@ const collection = {
})
},
conversionMultiplyRate({ commit }, {
containerUuid,
conversionTypeUuid,
currencyFromUuid,
currencyToUuid
@ -82,9 +99,12 @@ const collection = {
// conversionDate
})
.then(response => {
const multiplyRate = isEmptyValue(response.multiplyRate) ? 1 : response.multiplyRate
commit('currencyMultiplyRate', multiplyRate)
const multiplyRate = isEmptyValue(response.multiplyRate) ? 0 : response.multiplyRate
if (containerUuid === 'Collection') {
commit('currencyMultiplyRateCollection', multiplyRate)
} else {
commit('currencyMultiplyRate', multiplyRate)
}
})
.catch(error => {
console.warn(`conversionMultiplyRate: ${error.message}. Code: ${error.code}.`)
@ -111,6 +131,12 @@ const collection = {
},
getDivideRate: (state) => {
return state.divideRate
},
getMultiplyRateCollection: (state) => {
return state.multiplyRateCollection
},
getDivideRateCollection: (state) => {
return state.divideRateCollection
}
}
}