mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-07 18:25:45 +08:00
Add option to change warehouse and price list (#913)
* Adding the option to change Warehouse and Price List * add service * support service * add Warehouse Co-authored-by: elsiosanchez <elsiossanches@gmail.com>
This commit is contained in:
parent
c467351738
commit
23aaf79007
@ -77,7 +77,8 @@ export function createOrder({
|
||||
posUuid,
|
||||
customerUuid,
|
||||
documentTypeUuid,
|
||||
salesRepresentativeUuid
|
||||
salesRepresentativeUuid,
|
||||
warehouseUuid
|
||||
}) {
|
||||
return request({
|
||||
url: `${config.pointOfSales.endpoint}/create-order`,
|
||||
@ -86,7 +87,8 @@ export function createOrder({
|
||||
pos_uuid: posUuid,
|
||||
customer_uuid: customerUuid,
|
||||
document_type_uuid: documentTypeUuid,
|
||||
sales_representative_uuid: salesRepresentativeUuid
|
||||
sales_representative_uuid: salesRepresentativeUuid,
|
||||
warehouse_uuid: warehouseUuid
|
||||
}
|
||||
})
|
||||
.then(createOrderResponse => {
|
||||
@ -101,7 +103,8 @@ export function updateOrder({
|
||||
orderUuid,
|
||||
posUuid,
|
||||
customerUuid,
|
||||
description
|
||||
description,
|
||||
warehouseUuid
|
||||
}) {
|
||||
return request({
|
||||
url: `${config.pointOfSales.endpoint}/update-order`,
|
||||
@ -110,7 +113,8 @@ export function updateOrder({
|
||||
order_uuid: orderUuid,
|
||||
pos_uuid: posUuid,
|
||||
customer_uuid: customerUuid,
|
||||
description
|
||||
description,
|
||||
warehouse_uuid: warehouseUuid
|
||||
}
|
||||
})
|
||||
.then(updateOrderResponse => {
|
||||
@ -637,3 +641,79 @@ export function validatePin({
|
||||
return pinResponse
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* list Warehouse
|
||||
* @param {string} posUuidd - POS UUID reference
|
||||
*/
|
||||
export function listWarehouse({
|
||||
posUuid
|
||||
}) {
|
||||
return request({
|
||||
url: `${config.pointOfSales.endpoint}/available-warehouses`,
|
||||
method: 'get',
|
||||
params: {
|
||||
pos_uuid: posUuid
|
||||
}
|
||||
})
|
||||
.then(listWarehouseResponse => {
|
||||
return listWarehouseResponse
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* List Prices
|
||||
* @param {string} posUuidd - POS UUID reference
|
||||
*/
|
||||
export function listPrices({
|
||||
posUuid
|
||||
}) {
|
||||
return request({
|
||||
url: `${config.pointOfSales.endpoint}/available-price-list`,
|
||||
method: 'get',
|
||||
params: {
|
||||
pos_uuid: posUuid
|
||||
}
|
||||
})
|
||||
.then(listPricesResponse => {
|
||||
return listPricesResponse
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Currencies
|
||||
* @param {string} posUuidd - POS UUID reference
|
||||
*/
|
||||
export function listCurrencies({
|
||||
posUuid
|
||||
}) {
|
||||
return request({
|
||||
url: `${config.pointOfSales.endpoint}/available-currencies`,
|
||||
method: 'get',
|
||||
params: {
|
||||
pos_uuid: posUuid
|
||||
}
|
||||
})
|
||||
.then(listCurrencies => {
|
||||
return listCurrencies
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Tender Type
|
||||
* @param {string} posUuidd - POS UUID reference
|
||||
*/
|
||||
export function listTenderType({
|
||||
posUuid
|
||||
}) {
|
||||
return request({
|
||||
url: `${config.pointOfSales.endpoint}/available-tender-types`,
|
||||
method: 'get',
|
||||
params: {
|
||||
pos_uuid: posUuid
|
||||
}
|
||||
})
|
||||
.then(listTenderType => {
|
||||
return listTenderType
|
||||
})
|
||||
}
|
||||
|
@ -144,22 +144,22 @@ export default {
|
||||
} else {
|
||||
this.amountConvertionTotal = this.amount
|
||||
}
|
||||
},
|
||||
currencyUuid(value) {
|
||||
const listCurrency = this.$store.getters.getConvertionRate.find(currency => {
|
||||
if (currency.uuid === value) {
|
||||
return currency
|
||||
}
|
||||
})
|
||||
if (listCurrency === undefined) {
|
||||
this.$store.dispatch('conversionDivideRate', {
|
||||
conversionTypeUuid: this.currentPointOfSales.conversionTypeUuid,
|
||||
currencyFromUuid: this.pointOfSalesCurrency.uuid,
|
||||
conversionDate: this.formatDate(new Date()),
|
||||
currencyToUuid: value
|
||||
})
|
||||
}
|
||||
}
|
||||
// currencyUuid(value) {
|
||||
// const listCurrency = this.$store.getters.getConvertionRate.find(currency => {
|
||||
// if (currency.uuid === value) {
|
||||
// return currency
|
||||
// }
|
||||
// })
|
||||
// if (listCurrency === undefined) {
|
||||
// this.$store.dispatch('conversionDivideRate', {
|
||||
// conversionTypeUuid: this.currentPointOfSales.conversionTypeUuid,
|
||||
// currencyFromUuid: this.pointOfSalesCurrency.uuid,
|
||||
// conversionDate: this.formatDate(new Date()),
|
||||
// currencyToUuid: value
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
},
|
||||
created() {
|
||||
this.defaultValueCurrency()
|
||||
|
@ -63,17 +63,24 @@
|
||||
<b>{{ $t('form.pos.collect.dayRate') }}:</b>
|
||||
<!-- Conversion rate to date -->
|
||||
<b v-if="!isEmptyValue(dateRate)" style="float: right;">
|
||||
<span v-if="formatConversionCurrenty(dateRate.amountConvertion) > 100">
|
||||
{{
|
||||
formatPrice(formatConversionCurrenty(dateRate.amountConvertion), dateRate.iSOCode)
|
||||
}}
|
||||
<span v-if="!isEmptyValue(dateRate.divideRate)">
|
||||
<span v-if="formatConversionCurrenty(dateRate.divideRate) > 1">
|
||||
{{
|
||||
formatPrice(formatConversionCurrenty(dateRate.divideRate), dateRate.currencyTo.iSOCode)
|
||||
}}
|
||||
</span>
|
||||
<span v-else>
|
||||
{{
|
||||
dateRate.currencyTo.iSOCode
|
||||
}}
|
||||
{{
|
||||
formatConversionCurrenty(dateRate.divideRate)
|
||||
}}
|
||||
</span>
|
||||
</span>
|
||||
<span v-else>
|
||||
{{
|
||||
dateRate.iSOCode
|
||||
}}
|
||||
{{
|
||||
formatConversionCurrenty(dateRate.amountConvertion)
|
||||
formatPrice(1, dateRate.iSOCode)
|
||||
}}
|
||||
</span>
|
||||
</b>
|
||||
@ -93,10 +100,38 @@
|
||||
<el-col v-for="(field, index) in fieldsList" :key="index" :span="8">
|
||||
<!-- Add selected currency symbol -->
|
||||
<field-definition
|
||||
v-if="field.columnName === 'PayAmt' || field.columnName === 'TenderType'"
|
||||
:key="field.columnName"
|
||||
:metadata-field="field.columnName === 'PayAmt' ? {
|
||||
...field,
|
||||
labelCurrency: dateRate
|
||||
labelCurrency: isEmptyValue(dateRate.divideRate) ? dateRate : dateRate.currencyTo
|
||||
} : field"
|
||||
/>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="fieldsList[1].name">
|
||||
<el-select
|
||||
v-model="currentFieldCurrency"
|
||||
:placeholder="fieldsList[1].help"
|
||||
@change="changeCurrency"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in listCurrency"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.key"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-for="(field, index) in fieldsList" :key="index" :span="8">
|
||||
<!-- Add selected currency symbol -->
|
||||
<field-definition
|
||||
v-if="field.columnName !== 'PayAmt' && field.columnName !== 'TenderType' && field.columnName !== 'C_Currency_ID'"
|
||||
:key="field.columnName"
|
||||
:metadata-field="field.columnName === 'PayAmt' ? {
|
||||
...field,
|
||||
labelCurrency: isEmptyValue(dateRate.divideRate) ? dateRate : dateRate.currencyTo
|
||||
} : field"
|
||||
/>
|
||||
</el-col>
|
||||
@ -272,10 +307,18 @@ export default {
|
||||
defaultLabel: '',
|
||||
fieldsList: fieldsListCollection,
|
||||
sendToServer: false,
|
||||
amontSend: 0
|
||||
value: '',
|
||||
amontSend: 0,
|
||||
currentFieldCurrency: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
listCurrency() {
|
||||
return this.$store.state['pointOfSales/point/index'].listCurrency
|
||||
},
|
||||
convertionList() {
|
||||
return this.$store.state['pointOfSales/point/index'].conversionList
|
||||
},
|
||||
validateCompleteCollection() {
|
||||
let collection
|
||||
if (this.pay === this.currentOrder.grandTotal) {
|
||||
@ -488,11 +531,15 @@ export default {
|
||||
return this.$store.getters.getUpdatePaymentPos
|
||||
},
|
||||
dateRate() {
|
||||
return this.$store.getters.getConvertionRate.find(currency => {
|
||||
if (currency.id === this.typeCurrency) {
|
||||
const convertion = this.convertionList.find(currency => {
|
||||
if ((currency.currencyTo.iSOCode === this.currentFieldCurrency) && (this.pointOfSalesCurrency.iSOCode !== currency.currencyTo.iSOCode)) {
|
||||
return currency
|
||||
}
|
||||
})
|
||||
if (!this.isEmptyValue(convertion)) {
|
||||
return convertion
|
||||
}
|
||||
return this.pointOfSalesCurrency
|
||||
},
|
||||
fieldsPaymentType() {
|
||||
return this.fieldsList[2]
|
||||
@ -503,24 +550,24 @@ export default {
|
||||
this.$store.commit('updateValueOfField', {
|
||||
containerUuid: this.containerUuid,
|
||||
columnName: 'PayAmt',
|
||||
value
|
||||
value: value
|
||||
})
|
||||
},
|
||||
currencyUuid(value) {
|
||||
const listCurrency = this.$store.getters.getConvertionRate.find(currency => {
|
||||
if (currency.uuid === value) {
|
||||
return currency
|
||||
}
|
||||
})
|
||||
if (listCurrency === undefined) {
|
||||
this.$store.dispatch('conversionDivideRate', {
|
||||
conversionTypeUuid: this.currentPointOfSales.conversionTypeUuid,
|
||||
currencyFromUuid: this.pointOfSalesCurrency.uuid,
|
||||
conversionDate: this.formatDate(new Date()),
|
||||
currencyToUuid: value
|
||||
})
|
||||
}
|
||||
},
|
||||
// currencyUuid(value) {
|
||||
// const listCurrency = this.$store.getters.getConvertionRate.find(currency => {
|
||||
// if (currency.uuid === value) {
|
||||
// return currency
|
||||
// }
|
||||
// })
|
||||
// if (listCurrency === undefined) {
|
||||
// this.$store.dispatch('conversionDivideRate', {
|
||||
// conversionTypeUuid: this.currentPointOfSales.conversionTypeUuid,
|
||||
// currencyFromUuid: this.pointOfSalesCurrency.uuid,
|
||||
// conversionDate: this.formatDate(new Date()),
|
||||
// currencyToUuid: value
|
||||
// })
|
||||
// }
|
||||
// },
|
||||
convertAllPayment(value) {
|
||||
if (!this.isEmptyValue(value)) {
|
||||
this.allPayCurrency = this.pay / value
|
||||
@ -537,11 +584,11 @@ export default {
|
||||
}
|
||||
},
|
||||
dateRate(value) {
|
||||
if (value && !this.isEmptyValue(value.amountConvertion)) {
|
||||
if (!this.isEmptyValue(value.divideRate)) {
|
||||
this.$store.commit('updateValueOfField', {
|
||||
containerUuid: this.containerUuid,
|
||||
columnName: 'PayAmt',
|
||||
value: this.pending / value.amountConvertion
|
||||
value: this.pending / value.divideRate
|
||||
})
|
||||
} else {
|
||||
this.$store.commit('updateValueOfField', {
|
||||
@ -565,6 +612,7 @@ export default {
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.currentFieldCurrency = this.pointOfSalesCurrency.iSOCode
|
||||
this.$store.dispatch('addRateConvertion', this.pointOfSalesCurrency)
|
||||
this.unsubscribe = this.subscribeChanges()
|
||||
this.defaultValueCurrency()
|
||||
@ -724,6 +772,7 @@ export default {
|
||||
this.defaultValueCurrency()
|
||||
this.$store.commit('currencyDivideRateCollection', 1)
|
||||
this.$store.commit('currencyMultiplyRate', 1)
|
||||
this.currentFieldCurrency = this.pointOfSalesCurrency.iSOCode
|
||||
},
|
||||
exit() {
|
||||
this.$store.commit('setShowPOSCollection', false)
|
||||
@ -865,6 +914,19 @@ export default {
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
changeCurrency(value) {
|
||||
this.currentFieldCurrency = value
|
||||
const currency = this.listCurrency.find(currency => currency.key === value)
|
||||
const findCoventionList = this.convertionList.find(convertion => convertion.currencyTo.iSOCode === value)
|
||||
if (!this.isEmptyValue(currency) && this.isEmptyValue(findCoventionList) && (value !== this.pointOfSalesCurrency.iSOCode)) {
|
||||
this.$store.dispatch('searchConversion', {
|
||||
conversionTypeUuid: this.currentPointOfSales.conversionTypeUuid,
|
||||
currencyFromUuid: this.pointOfSalesCurrency.uuid,
|
||||
conversionDate: this.formatDate(new Date()),
|
||||
currencyToUuid: currency.uuid
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@
|
||||
<el-collapse v-model="activeName" accordion>
|
||||
<el-collapse-item :title="$t('form.pos.optionsPoinSales.salesOrder.title')" name="salesOrder">
|
||||
<el-row :gutter="12" style="padding-right: 10px;">
|
||||
<el-col :span="size">
|
||||
<el-col :span="size" style="padding-left: 12px;padding-right: 12px;padding-bottom: 10px;">
|
||||
<el-card shadow="hover">
|
||||
<p
|
||||
:style="isEmptyValue($route.query.action) ? 'cursor: not-allowed; text-align: center !important; color: gray;' : blockOption"
|
||||
@ -43,7 +43,7 @@
|
||||
</el-card>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="size">
|
||||
<el-col :span="size" style="padding-left: 12px;padding-right: 12px;padding-bottom: 10px;">
|
||||
<el-card shadow="hover">
|
||||
<el-popover
|
||||
placement="right"
|
||||
@ -69,19 +69,11 @@
|
||||
{{ $t('form.pos.optionsPoinSales.salesOrder.ordersHistory') }}
|
||||
</el-button>
|
||||
</p>
|
||||
<!-- <p
|
||||
slot="reference"
|
||||
:style="blockOption"
|
||||
>
|
||||
<svg-icon icon-class="list" />
|
||||
<br>
|
||||
{{ $t('form.pos.optionsPoinSales.salesOrder.ordersHistory') }}
|
||||
</p> -->
|
||||
</el-popover>
|
||||
</el-card>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="size">
|
||||
<el-col :span="size" style="padding-left: 12px;padding-right: 12px;padding-bottom: 10px;">
|
||||
<el-card shadow="hover">
|
||||
<p
|
||||
:style="blockOption"
|
||||
@ -94,7 +86,7 @@
|
||||
</el-card>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="size">
|
||||
<el-col :span="size" style="padding-left: 12px;padding-right: 12px;padding-bottom: 10px;">
|
||||
<el-card shadow="hover">
|
||||
<p
|
||||
:style="blockOption"
|
||||
@ -107,7 +99,7 @@
|
||||
</el-card>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="size">
|
||||
<el-col :span="size" style="padding-left: 12px;padding-right: 12px;padding-bottom: 10px;">
|
||||
<el-card shadow="hover">
|
||||
<p
|
||||
:style="blockOption"
|
||||
@ -120,7 +112,7 @@
|
||||
</el-card>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="size">
|
||||
<el-col :span="size" style="padding-left: 12px;padding-right: 12px;padding-bottom: 10px;">
|
||||
<el-card shadow="hover">
|
||||
<p
|
||||
:style="blockOption"
|
||||
@ -133,7 +125,7 @@
|
||||
</el-card>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="size">
|
||||
<el-col :span="size" style="padding-left: 12px;padding-right: 12px;padding-bottom: 10px;">
|
||||
<el-card shadow="hover">
|
||||
<p
|
||||
:style="blockOption"
|
||||
@ -146,7 +138,7 @@
|
||||
</el-card>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="size">
|
||||
<el-col :span="size" style="padding-left: 12px;padding-right: 12px;padding-bottom: 10px;">
|
||||
<el-card shadow="hover">
|
||||
<p
|
||||
:style="blockOption"
|
||||
@ -158,7 +150,7 @@
|
||||
</p>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="size">
|
||||
<el-col :span="size" style="padding-left: 12px;padding-right: 12px;padding-bottom: 10px;">
|
||||
<el-card shadow="hover">
|
||||
<p
|
||||
:style="blockOption"
|
||||
@ -170,7 +162,7 @@
|
||||
</p>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="size">
|
||||
<el-col :span="size" style="padding-left: 12px;padding-right: 12px;padding-bottom: 10px;">
|
||||
<el-card shadow="hover">
|
||||
<p
|
||||
:style="blockOption"
|
||||
@ -187,7 +179,7 @@
|
||||
|
||||
<el-collapse-item :title="$t('form.pos.optionsPoinSales.cashManagement.title')" name="cashManagement">
|
||||
<el-row :gutter="12" style="padding-right: 10px;">
|
||||
<el-col :span="size">
|
||||
<el-col :span="size" style="padding-left: 12px;padding-right: 12px;padding-bottom: 10px;">
|
||||
<el-card shadow="hover">
|
||||
<p
|
||||
:style="blockOption"
|
||||
@ -198,7 +190,7 @@
|
||||
</p>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="size">
|
||||
<el-col :span="size" style="padding-left: 12px;padding-right: 12px;padding-bottom: 10px;">
|
||||
<el-card shadow="hover">
|
||||
<p
|
||||
:style="blockOption"
|
||||
@ -209,7 +201,7 @@
|
||||
</p>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="size">
|
||||
<el-col :span="size" style="padding-left: 12px;padding-right: 12px;padding-bottom: 10px;">
|
||||
<el-card shadow="hover">
|
||||
<p
|
||||
:style="blockOption"
|
||||
@ -225,12 +217,12 @@
|
||||
</el-collapse-item>
|
||||
|
||||
<el-collapse-item :title="$t('form.pos.optionsPoinSales.generalOptions.title')" name="generalOptions">
|
||||
<el-row :gutter="12" style="padding-right: 10px;">
|
||||
<el-row :gutter="24" style="padding-right: 10px;">
|
||||
<el-col :span="size">
|
||||
<el-card shadow="hover">
|
||||
<el-dropdown trigger="click" style="padding-top: 8px; color: black;" @command="changePos">
|
||||
<el-dropdown trigger="click" style="padding-top: 8px;color: black;display: block;" @command="changePos">
|
||||
<p
|
||||
:style="blockOption"
|
||||
style="cursor: pointer;text-align: center !important;color: black;min-height: 50px;margin: 0px;"
|
||||
>
|
||||
<i class="el-icon-mobile-phone" />
|
||||
<br>
|
||||
@ -248,8 +240,8 @@
|
||||
</el-dropdown>
|
||||
</el-card>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="8">
|
||||
<!-- Product List Price -->
|
||||
<el-col :span="size" style="padding-left: 12px;padding-right: 12px;padding-bottom: 10px;">
|
||||
<el-card shadow="hover">
|
||||
<el-popover
|
||||
placement="right"
|
||||
@ -272,7 +264,51 @@
|
||||
</el-popover>
|
||||
</el-card>
|
||||
</el-col>
|
||||
|
||||
<!-- List Warehouse -->
|
||||
<el-col :span="size" style="padding-left: 12px;padding-right: 12px;padding-bottom: 10px;">
|
||||
<el-card shadow="hover">
|
||||
<el-dropdown trigger="click" style="padding-top: 8px;color: black;display: block;" @command="changePos">
|
||||
<p
|
||||
style="cursor: pointer;text-align: center !important;color: black;min-height: 50px;margin: 0px;"
|
||||
>
|
||||
<svg-icon icon-class="tree-table" />
|
||||
<br>
|
||||
{{ $t('form.pos.optionsPoinSales.generalOptions.changeWarehouseList') }}
|
||||
</p>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item
|
||||
v-for="item in warehousesListPointOfSales"
|
||||
:key="item.uuid"
|
||||
:command="item"
|
||||
>
|
||||
{{ item.name }}
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<!-- List Price -->
|
||||
<el-col :span="size" style="padding-left: 12px;padding-right: 12px;padding-bottom: 10px;">
|
||||
<el-card shadow="hover">
|
||||
<el-dropdown trigger="click" style="padding-top: 8px;color: black;display: block;" @command="changePos">
|
||||
<p
|
||||
style="cursor: pointer;text-align: center !important;color: black;min-height: 50px;margin: 0px;"
|
||||
>
|
||||
<svg-icon icon-class="list" />
|
||||
<br>
|
||||
{{ $t('form.pos.optionsPoinSales.generalOptions.changePriceList') }} </p>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item
|
||||
v-for="item in priceListPointOfSales"
|
||||
:key="item.uuid"
|
||||
:command="item"
|
||||
>
|
||||
{{ item.name }}
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-collapse-item>
|
||||
</el-collapse>
|
||||
@ -347,9 +383,9 @@ export default {
|
||||
},
|
||||
blockOption() {
|
||||
if (!this.isEmptyValue(this.$route.query.pos)) {
|
||||
return 'cursor: pointer; text-align: center !important; color: black'
|
||||
return 'cursor: pointer; text-align: center !important; color: black;min-height: 50px;'
|
||||
}
|
||||
return 'cursor: not-allowed; text-align: center !important; color: gray;'
|
||||
return 'cursor: not-allowed; text-align: center !important; color: gray;min-height: 50px;'
|
||||
},
|
||||
size() {
|
||||
const size = this.$store.getters.getWidthLeft
|
||||
@ -475,7 +511,8 @@ export default {
|
||||
createOrder({
|
||||
posUuid,
|
||||
customerUuid: this.currentOrder.businessPartner.uuid,
|
||||
salesRepresentativeUuid: this.currentOrder.salesRepresentative.uuid
|
||||
salesRepresentativeUuid: this.currentOrder.salesRepresentative.uuid,
|
||||
warehouseUuid: this.$store.getters.currentWarehouse.uuid
|
||||
})
|
||||
.then(order => {
|
||||
this.$store.dispatch('currentOrder', order)
|
||||
|
@ -189,17 +189,17 @@
|
||||
</el-button>
|
||||
</span>
|
||||
<br>
|
||||
<p id="point">
|
||||
<p id="point" style="margin-bottom: 5%;margin-top: 3%;">
|
||||
<el-dropdown
|
||||
v-if="!isEmptyValue(currentPointOfSales)"
|
||||
trigger="click"
|
||||
style="padding-top: 8px; color: black;"
|
||||
class="info-pos"
|
||||
@command="changePos"
|
||||
>
|
||||
<p>
|
||||
<span>
|
||||
<i class="el-icon-mobile-phone" />
|
||||
{{ $t('form.pos.order.pointSale') }}: <b style="cursor: pointer"> {{ currentPointOfSales.name }} </b>
|
||||
</p>
|
||||
</span>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item
|
||||
v-for="item in listPointOfSales"
|
||||
@ -210,6 +210,48 @@
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
<br>
|
||||
<el-dropdown
|
||||
v-if="!isEmptyValue(curretnWarehouse)"
|
||||
trigger="click"
|
||||
class="info-pos"
|
||||
@command="changeWarehouse"
|
||||
>
|
||||
<span>
|
||||
<svg-icon icon-class="tree" />
|
||||
{{ $t('route.warehouse') }}: <b style="cursor: pointer"> {{ curretnWarehouse.name }} </b>
|
||||
</span>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item
|
||||
v-for="item in listWarehouse"
|
||||
:key="item.uuid"
|
||||
:command="item"
|
||||
>
|
||||
{{ item.name }}
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
<br>
|
||||
<el-dropdown
|
||||
v-if="!isEmptyValue(curretnPriceList)"
|
||||
trigger="click"
|
||||
class="info-pos"
|
||||
@command="changePriceList"
|
||||
>
|
||||
<span>
|
||||
<svg-icon icon-class="tree-table" />
|
||||
{{ $t('form.pos.priceList') }}: <b style="cursor: pointer"> {{ curretnPriceList.name }} </b>
|
||||
</span>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item
|
||||
v-for="item in pointPriceList"
|
||||
:key="item.uuid"
|
||||
:command="item"
|
||||
>
|
||||
{{ item.name }}
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</p>
|
||||
</div>
|
||||
<span v-if="isMobile" style="float: right;padding-right: 3%;">
|
||||
@ -513,6 +555,31 @@ export default {
|
||||
currentLineOrder() {
|
||||
const line = this.$store.state['pointOfSales/orderLine/index'].line
|
||||
return line
|
||||
},
|
||||
curretnPriceList() {
|
||||
if (!this.isEmptyValue(this.$store.getters.currentPriceList)) {
|
||||
return this.$store.getters.currentPriceList
|
||||
}
|
||||
return {}
|
||||
},
|
||||
pointPriceList() {
|
||||
const list = this.$store.getters.posAttributes.currentPointOfSales.listPrices
|
||||
if (this.isEmptyValue(list)) {
|
||||
return []
|
||||
}
|
||||
return list
|
||||
},
|
||||
curretnWarehouse() {
|
||||
if (!this.isEmptyValue(this.$store.getters['user/getWarehouse'])) {
|
||||
return this.$store.getters['user/getWarehouse']
|
||||
}
|
||||
return {}
|
||||
},
|
||||
listWarehouse() {
|
||||
if (!this.isEmptyValue(this.$store.getters.currentWarehouse)) {
|
||||
return this.$store.getters.currentWarehouse
|
||||
}
|
||||
return []
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@ -598,6 +665,12 @@ export default {
|
||||
this.$store.dispatch('setCurrentPOS', posElement)
|
||||
this.newOrder()
|
||||
},
|
||||
changeWarehouse(warehouse) {
|
||||
this.$store.commit('currentWarehouse', warehouse)
|
||||
},
|
||||
changePriceList(priceList) {
|
||||
this.$store.commit('currentListPrices', priceList)
|
||||
},
|
||||
arrowTop() {
|
||||
if (this.currentTable > 0) {
|
||||
this.currentTable--
|
||||
@ -652,12 +725,16 @@ export default {
|
||||
.keypad {
|
||||
float: left;
|
||||
height: 20%;
|
||||
padding-top: 25px;
|
||||
padding-top: 10px;
|
||||
}
|
||||
.total {
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px
|
||||
}
|
||||
.info-pos {
|
||||
padding-top: 10px;
|
||||
color: black;
|
||||
}
|
||||
.split {
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
|
@ -81,12 +81,33 @@ export default {
|
||||
uuid: '',
|
||||
iSOCode: '',
|
||||
curSymbol: '',
|
||||
amountConvertion: 1
|
||||
amountConvertion: 1,
|
||||
divideRate: 1
|
||||
}
|
||||
},
|
||||
listPointOfSales() {
|
||||
return this.$store.getters.posAttributes.listPointOfSales
|
||||
},
|
||||
curretnPriceList() {
|
||||
if (!this.isEmptyValue(this.$store.getters.currentPriceList)) {
|
||||
return this.$store.getters.currentPriceList
|
||||
}
|
||||
return {}
|
||||
},
|
||||
priceListPointOfSales() {
|
||||
const list = this.$store.getters.posAttributes.currentPointOfSales.listPrices
|
||||
if (this.isEmptyValue(list)) {
|
||||
return []
|
||||
}
|
||||
return list
|
||||
},
|
||||
warehousesListPointOfSales() {
|
||||
const list = this.$store.getters.posAttributes.currentPointOfSales.listWarehouses
|
||||
if (this.isEmptyValue(list)) {
|
||||
return []
|
||||
}
|
||||
return list
|
||||
},
|
||||
ordersList() {
|
||||
if (this.isEmptyValue(this.currentPointOfSales)) {
|
||||
return []
|
||||
@ -223,10 +244,12 @@ export default {
|
||||
}
|
||||
|
||||
const searchProduct = (typeof searchValue === 'object') ? searchValue.value : searchValue
|
||||
|
||||
if (this.isEmptyValue(this.curretnPriceList)) {
|
||||
return
|
||||
}
|
||||
findProduct({
|
||||
searchValue: searchProduct,
|
||||
priceListUuid: this.currentPointOfSales.priceList.uuid
|
||||
priceListUuid: this.curretnPriceList.uuid
|
||||
})
|
||||
.then(productPrice => {
|
||||
this.product = productPrice.product
|
||||
|
@ -410,6 +410,7 @@ export default {
|
||||
form: {
|
||||
pos: {
|
||||
title: 'POS',
|
||||
priceList: 'Price List',
|
||||
optionsPoinSales: {
|
||||
title: 'Quick Point of Sales Options',
|
||||
salesOrder: {
|
||||
@ -434,7 +435,9 @@ export default {
|
||||
generalOptions: {
|
||||
title: 'General Options',
|
||||
changePos: 'Change Point of Sale',
|
||||
listProducts: 'Change Point of Sale'
|
||||
listProducts: 'Change Point of Sale',
|
||||
changeWarehouseList: 'Change Warehouse',
|
||||
changePriceList: 'Change Price List'
|
||||
}
|
||||
},
|
||||
tableProduct: {
|
||||
@ -526,7 +529,7 @@ export default {
|
||||
description: 'Display the Point of Sale Options panel'
|
||||
},
|
||||
point: {
|
||||
description: 'Displays the current point of sale'
|
||||
description: 'Current point of sale information'
|
||||
},
|
||||
buttonPanelRightPos: {
|
||||
title: 'Show Right Panel',
|
||||
|
@ -385,6 +385,7 @@ export default {
|
||||
form: {
|
||||
pos: {
|
||||
title: 'Punto de Venta',
|
||||
priceList: 'Lista de Precio',
|
||||
optionsPoinSales: {
|
||||
title: 'Opciones Rápidas del Punto de Ventas',
|
||||
salesOrder: {
|
||||
@ -409,7 +410,9 @@ export default {
|
||||
generalOptions: {
|
||||
title: 'Opciones Generales',
|
||||
changePos: 'Cambiar Punto de Venta',
|
||||
listProducts: 'Lista de Productos y Precios'
|
||||
listProducts: 'Lista de Productos y Precios',
|
||||
changeWarehouseList: 'Cambiar de Almacén',
|
||||
changePriceList: 'Cambiar Lista de Precio'
|
||||
}
|
||||
},
|
||||
tableProduct: {
|
||||
@ -502,7 +505,7 @@ export default {
|
||||
description: 'Despliega el panel de Opciones del Punto de Venta'
|
||||
},
|
||||
point: {
|
||||
description: 'Muestra el punto de venta actual'
|
||||
description: 'Informacion del punto de venta actual'
|
||||
},
|
||||
buttonPanelRightPos: {
|
||||
title: 'Mostrar Panel Derecho',
|
||||
|
@ -45,13 +45,17 @@ export default {
|
||||
* List Order Lines
|
||||
* List Payment Order
|
||||
* Lst Order
|
||||
* List Warehouses
|
||||
* List Prices
|
||||
*/
|
||||
posAttributes: (state, getters) => {
|
||||
posAttributes: (state) => {
|
||||
return {
|
||||
listPointOfSales: state.listPointOfSales,
|
||||
currentPointOfSales: {
|
||||
...state.currentPointOfSales,
|
||||
listOrder: state.listOrder,
|
||||
listWarehouses: state.listWarehouses,
|
||||
listPrices: state.listPrices,
|
||||
currentOrder: {
|
||||
...state.order,
|
||||
lineOrder: state.listOrderLine,
|
||||
@ -106,5 +110,23 @@ export default {
|
||||
}
|
||||
}
|
||||
return state.keyLayout
|
||||
},
|
||||
/**
|
||||
* Current Price List
|
||||
*/
|
||||
currentPriceList: (state) => {
|
||||
if (!isEmptyValue(state.currentlistPrices)) {
|
||||
return state.currentlistPrices
|
||||
}
|
||||
return {}
|
||||
},
|
||||
/**
|
||||
* Current Warehouse
|
||||
*/
|
||||
currentWarehouse: (state) => {
|
||||
if (!isEmptyValue(state.currentWarehouse)) {
|
||||
return state.currentWarehouse
|
||||
}
|
||||
return {}
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ export default {
|
||||
* @param {string} customerUuid Customer Uuid
|
||||
* @param {string} salesRepresentativeUuid Sales Representative Uuid
|
||||
*/
|
||||
createOrder({ commit, dispatch }, {
|
||||
createOrder({ commit, dispatch, rootGetters }, {
|
||||
posUuid,
|
||||
customerUuid,
|
||||
salesRepresentativeUuid
|
||||
@ -42,7 +42,8 @@ export default {
|
||||
return createOrder({
|
||||
posUuid,
|
||||
customerUuid,
|
||||
salesRepresentativeUuid
|
||||
salesRepresentativeUuid,
|
||||
warehouseUuid: rootGetters.currentWarehouse.uuid
|
||||
})
|
||||
.then(order => {
|
||||
commit('setOrder', order)
|
||||
@ -66,7 +67,7 @@ export default {
|
||||
* @param {string} posUuid Order Uuid
|
||||
* @param {string} customerUuid Customer Uuid
|
||||
*/
|
||||
updateOrder({ commit, dispatch }, {
|
||||
updateOrder({ commit, dispatch, rootGetters }, {
|
||||
orderUuid,
|
||||
posUuid,
|
||||
customerUuid
|
||||
@ -74,7 +75,7 @@ export default {
|
||||
updateOrder({
|
||||
orderUuid,
|
||||
posUuid,
|
||||
customerUuid
|
||||
warehouseUuid: rootGetters.currentWarehouse.uuid
|
||||
})
|
||||
.then(response => {
|
||||
dispatch('reloadOrder', { orderUuid: response.uuid })
|
||||
|
@ -111,6 +111,25 @@ export default {
|
||||
const payment = state.paymentBox
|
||||
payment.splice(0)
|
||||
},
|
||||
searchConversion({ commit }, params) {
|
||||
requestGetConversionRate({
|
||||
conversionTypeUuid: params.conversionTypeUuid,
|
||||
currencyFromUuid: params.currencyFromUuid,
|
||||
currencyToUuid: params.currencyToUuid,
|
||||
conversionDate: params.conversionDate
|
||||
})
|
||||
.then(response => {
|
||||
commit('conversionList', response)
|
||||
})
|
||||
.catch(error => {
|
||||
console.warn(`conversionDivideRate: ${error.message}. Code: ${error.code}.`)
|
||||
showMessage({
|
||||
type: 'error',
|
||||
message: error.message,
|
||||
showClose: true
|
||||
})
|
||||
})
|
||||
},
|
||||
conversionDivideRate({ commit, dispatch }, params) {
|
||||
return requestGetConversionRate({
|
||||
conversionTypeUuid: params.conversionTypeUuid,
|
||||
|
@ -16,7 +16,10 @@
|
||||
|
||||
import router from '@/router'
|
||||
import {
|
||||
listPointOfSales
|
||||
listPointOfSales,
|
||||
listWarehouse,
|
||||
listPrices,
|
||||
listCurrencies
|
||||
} from '@/api/ADempiere/form/point-of-sales.js'
|
||||
import { isEmptyValue } from '@/utils/ADempiere/valueUtils.js'
|
||||
import { showMessage } from '@/utils/ADempiere/notification.js'
|
||||
@ -58,7 +61,55 @@ export default {
|
||||
})
|
||||
})
|
||||
},
|
||||
setCurrentPOS({ commit, dispatch }, posToSet) {
|
||||
listWarehouseFromServer({ commit }, posUuid) {
|
||||
listWarehouse({
|
||||
posUuid
|
||||
})
|
||||
.then(response => {
|
||||
commit('listWarehouses', response.records)
|
||||
})
|
||||
.catch(error => {
|
||||
console.warn(`listWarehouseFromServer: ${error.message}. Code: ${error.code}.`)
|
||||
showMessage({
|
||||
type: 'error',
|
||||
message: error.message,
|
||||
showClose: true
|
||||
})
|
||||
})
|
||||
},
|
||||
listPricesFromServer({ commit }, point) {
|
||||
listPrices({
|
||||
posUuid: point.uuid
|
||||
})
|
||||
.then(response => {
|
||||
commit('listPrices', response.records)
|
||||
})
|
||||
.catch(error => {
|
||||
console.warn(`listPricesFromServer: ${error.message}. Code: ${error.code}.`)
|
||||
showMessage({
|
||||
type: 'error',
|
||||
message: error.message,
|
||||
showClose: true
|
||||
})
|
||||
})
|
||||
},
|
||||
listCurrenciesFromServer({ commit }, posUuid) {
|
||||
listCurrencies({
|
||||
posUuid
|
||||
})
|
||||
.then(response => {
|
||||
commit('listCurrencies', response.records)
|
||||
})
|
||||
.catch(error => {
|
||||
console.warn(`listPricesFromServer: ${error.message}. Code: ${error.code}.`)
|
||||
showMessage({
|
||||
type: 'error',
|
||||
message: error.message,
|
||||
showClose: true
|
||||
})
|
||||
})
|
||||
},
|
||||
setCurrentPOS({ commit, dispatch, rootGetters }, posToSet) {
|
||||
commit('currentPointOfSales', posToSet)
|
||||
const oldRoute = router.app._route
|
||||
router.push({
|
||||
@ -71,7 +122,11 @@ export default {
|
||||
pos: posToSet.id
|
||||
}
|
||||
}, () => {})
|
||||
|
||||
dispatch('listWarehouseFromServer', posToSet.uuid)
|
||||
dispatch('listCurrenciesFromServer', posToSet.uuid)
|
||||
dispatch('listPricesFromServer', posToSet)
|
||||
commit('currentListPrices', posToSet.priceList)
|
||||
commit('currentWarehouse', rootGetters['user/getWarehouse'])
|
||||
commit('resetConversionRate', [])
|
||||
commit('setIsReloadKeyLayout')
|
||||
commit('setIsReloadProductPrice')
|
||||
|
@ -30,6 +30,24 @@ export default {
|
||||
listPointOfSales(state, listPointOfSales) {
|
||||
state.listPointOfSales = listPointOfSales
|
||||
},
|
||||
listWarehouses(state, listWarehouses) {
|
||||
state.listWarehouses = listWarehouses
|
||||
},
|
||||
currentListPrices(state, listPrices) {
|
||||
state.currentlistPrices = listPrices
|
||||
},
|
||||
currentWarehouse(state, warehouse) {
|
||||
state.currentWarehouse = warehouse
|
||||
},
|
||||
listPrices(state, listPrices) {
|
||||
state.listPrices = listPrices
|
||||
},
|
||||
listCurrencies(state, listCurrency) {
|
||||
state.listCurrency = listCurrency
|
||||
},
|
||||
conversionList(state, conversion) {
|
||||
state.conversionList.push(conversion)
|
||||
},
|
||||
currentPointOfSales(state, currentPointOfSales) {
|
||||
state.currentPointOfSales = currentPointOfSales
|
||||
},
|
||||
|
@ -28,6 +28,12 @@ export default {
|
||||
...withoutResponse
|
||||
},
|
||||
listPointOfSales: {},
|
||||
listWarehouses: {},
|
||||
listPrices: {},
|
||||
currentlistPrices: {},
|
||||
currentWarehouse: {},
|
||||
listCurrency: [],
|
||||
conversionList: [],
|
||||
currentPointOfSales: {},
|
||||
showPOSOptions: false,
|
||||
showPOSKeyLayout: false,
|
||||
|
@ -58,9 +58,8 @@ export default {
|
||||
pageToken = token + '-' + pageNumber
|
||||
}
|
||||
}
|
||||
const { priceList, templateBusinessPartner } = rootGetters.posAttributes.currentPointOfSales
|
||||
const { templateBusinessPartner } = rootGetters.posAttributes.currentPointOfSales
|
||||
const { uuid: businessPartnerUuid } = templateBusinessPartner
|
||||
const { uuid: priceListUuid } = priceList
|
||||
const { uuid: warehouseUuid } = rootGetters['user/getWarehouse']
|
||||
if (isEmptyValue(searchValue)) {
|
||||
searchValue = rootGetters.getValueOfField({
|
||||
@ -71,9 +70,9 @@ export default {
|
||||
return new Promise(resolve => {
|
||||
getProductPriceList({
|
||||
searchValue,
|
||||
priceListUuid,
|
||||
priceListUuid: rootGetters.currentPriceList.uuid,
|
||||
businessPartnerUuid,
|
||||
warehouseUuid,
|
||||
warehouseUuid: rootGetters.currentWarehouse.uuid,
|
||||
pageToken
|
||||
}).then(responseProductPrice => {
|
||||
if (isEmptyValue(token) || isEmptyValue(pageToken)) {
|
||||
@ -130,9 +129,8 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
const { priceList, templateBusinessPartner } = rootGetters.posAttributes.currentPointOfSales
|
||||
const { templateBusinessPartner } = rootGetters.posAttributes.currentPointOfSales
|
||||
const { uuid: businessPartnerUuid } = templateBusinessPartner
|
||||
const { uuid: priceListUuid } = priceList
|
||||
const { uuid: warehouseUuid } = rootGetters['user/getWarehouse']
|
||||
|
||||
if (isEmptyValue(searchValue)) {
|
||||
@ -144,7 +142,7 @@ export default {
|
||||
return new Promise(resolve => {
|
||||
getProductPriceList({
|
||||
searchValue,
|
||||
priceListUuid,
|
||||
priceListUuid: rootGetters.currentPriceList.uuid,
|
||||
businessPartnerUuid,
|
||||
warehouseUuid,
|
||||
pageToken
|
||||
|
Loading…
x
Reference in New Issue
Block a user