1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-10 12:01:57 +08:00

- Add multi-currency support (#916)

- Remove unnecessary mutation
- Rename bad variables
This commit is contained in:
Yamel Senih 2021-06-12 15:14:48 -04:00 committed by GitHub
parent 0b0d6a5f00
commit 5211bc3ef5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 21 additions and 32 deletions

View File

@ -376,10 +376,9 @@ export function getKeyLayout({ keyLayoutUuid }) {
// ListProductPrice // ListProductPrice
export function getProductPriceList({ export function getProductPriceList({
searchValue, searchValue,
priceListUuid,
businessPartnerUuid, businessPartnerUuid,
warehouseUuid,
validFrom, validFrom,
posUuid,
// Query // Query
// criteria, // criteria,
pageSize, pageSize,
@ -389,11 +388,10 @@ export function getProductPriceList({
url: `${config.pointOfSales.endpoint}/product-prices`, url: `${config.pointOfSales.endpoint}/product-prices`,
method: 'get', method: 'get',
params: { params: {
price_list_uuid: priceListUuid, pos_uuid: posUuid,
search_value: searchValue, search_value: searchValue,
valid_from: validFrom, valid_from: validFrom,
business_partner_uuid: businessPartnerUuid, business_partner_uuid: businessPartnerUuid,
warehouse_uuid: warehouseUuid,
page_size: pageSize, page_size: pageSize,
page_token: pageToken page_token: pageToken
} }

View File

@ -25,9 +25,8 @@ export function getProductPrice({
upc, upc,
value, value,
name, name,
priceListUuid, posUuid,
businessPartnerUuid, businessPartnerUuid,
warehouseUuid,
validFrom validFrom
}) { }) {
return request({ return request({
@ -38,9 +37,8 @@ export function getProductPrice({
upc, upc,
value, value,
name, name,
price_list_uuid: priceListUuid, pos_uuid: posUuid,
business_partner_uuid: businessPartnerUuid, business_partner_uuid: businessPartnerUuid,
warehouse_uuid: warehouseUuid,
valid_from: validFrom valid_from: validFrom
} }
}) })

View File

@ -675,7 +675,7 @@ export default {
this.$store.commit('currentWarehouse', warehouse) this.$store.commit('currentWarehouse', warehouse)
}, },
changePriceList(priceList) { changePriceList(priceList) {
this.$store.commit('currentListPrices', priceList) this.$store.commit('currentPriceList', priceList)
}, },
arrowTop() { arrowTop() {
if (this.currentTable > 0) { if (this.currentTable > 0) {

View File

@ -83,9 +83,9 @@ export default {
}, },
created() { created() {
const currentCurrency = this.$store.getters.posAttributes.listPointOfSales.find(pos => if (!this.isEmptyValue(this.$store.getters.posAttributes.currentPointOfSales.displayCurrency)) {
pos.priceList.currency.uuid !== this.$store.getters.posAttributes.currentPointOfSales.priceList.currency.uuid) this.convertedAmountAsTotal(this.$store.getters.posAttributes.currentPointOfSales.displayCurrency)
this.convertedAmountAsTotal(currentCurrency.priceList.currency) }
}, },
methods: { methods: {
formatPercent, formatPercent,

View File

@ -474,6 +474,7 @@ export default {
payment: 'Payment', payment: 'Payment',
change: 'Change', change: 'Change',
convertAmount: 'Convert Quantity', convertAmount: 'Convert Quantity',
convertedAmount: 'Converted Amount',
fullPayment: 'Full Payment', fullPayment: 'Full Payment',
dayRate: 'Day Rate', dayRate: 'Day Rate',
TenderType: { TenderType: {

View File

@ -115,8 +115,8 @@ export default {
* Current Price List * Current Price List
*/ */
currentPriceList: (state) => { currentPriceList: (state) => {
if (!isEmptyValue(state.currentlistPrices)) { if (!isEmptyValue(state.currentPriceList)) {
return state.currentlistPrices return state.currentPriceList
} }
return {} return {}
}, },
@ -129,4 +129,5 @@ export default {
} }
return {} return {}
} }
// Current POS, it can be s
} }

View File

@ -125,7 +125,7 @@ export default {
dispatch('listWarehouseFromServer', posToSet.uuid) dispatch('listWarehouseFromServer', posToSet.uuid)
dispatch('listCurrenciesFromServer', posToSet.uuid) dispatch('listCurrenciesFromServer', posToSet.uuid)
dispatch('listPricesFromServer', posToSet) dispatch('listPricesFromServer', posToSet)
commit('currentListPrices', posToSet.priceList) commit('currentPriceList', posToSet.priceList)
commit('currentWarehouse', rootGetters['user/getWarehouse']) commit('currentWarehouse', rootGetters['user/getWarehouse'])
commit('resetConversionRate', []) commit('resetConversionRate', [])
commit('setIsReloadKeyLayout') commit('setIsReloadKeyLayout')

View File

@ -14,27 +14,19 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
import Vue from 'vue'
/** /**
* Pos Mutations * Pos Mutations
* @author Elsio Sanchez <elsiosanches@gmail.com> * @author Elsio Sanchez <elsiosanches@gmail.com>
*/ */
export default { export default {
setPontOfSales(state, pos) {
state.pointOfSales = pos
},
setCurrentPOS(state, pos) {
Vue.set(state.pointOfSales, 'currentPOS', pos)
},
listPointOfSales(state, listPointOfSales) { listPointOfSales(state, listPointOfSales) {
state.listPointOfSales = listPointOfSales state.listPointOfSales = listPointOfSales
}, },
listWarehouses(state, listWarehouses) { listWarehouses(state, listWarehouses) {
state.listWarehouses = listWarehouses state.listWarehouses = listWarehouses
}, },
currentListPrices(state, listPrices) { currentPriceList(state, priceList) {
state.currentlistPrices = listPrices state.currentPriceList = priceList
}, },
currentWarehouse(state, warehouse) { currentWarehouse(state, warehouse) {
state.currentWarehouse = warehouse state.currentWarehouse = warehouse

View File

@ -30,7 +30,7 @@ export default {
listPointOfSales: {}, listPointOfSales: {},
listWarehouses: {}, listWarehouses: {},
listPrices: {}, listPrices: {},
currentlistPrices: {}, currentPriceList: {},
currentWarehouse: {}, currentWarehouse: {},
listCurrency: [], listCurrency: [],
conversionList: [], conversionList: [],

View File

@ -58,7 +58,8 @@ export default {
pageToken = token + '-' + pageNumber pageToken = token + '-' + pageNumber
} }
} }
const { templateBusinessPartner } = rootGetters.posAttributes.currentPointOfSales const currentPointOfSales = rootGetters.posAttributes.currentPointOfSales
const { templateBusinessPartner } = currentPointOfSales
const { uuid: businessPartnerUuid } = templateBusinessPartner const { uuid: businessPartnerUuid } = templateBusinessPartner
const { uuid: warehouseUuid } = rootGetters['user/getWarehouse'] const { uuid: warehouseUuid } = rootGetters['user/getWarehouse']
if (isEmptyValue(searchValue)) { if (isEmptyValue(searchValue)) {
@ -70,9 +71,8 @@ export default {
return new Promise(resolve => { return new Promise(resolve => {
getProductPriceList({ getProductPriceList({
searchValue, searchValue,
priceListUuid: rootGetters.currentPriceList.uuid, posUuid: currentPointOfSales.uuid,
businessPartnerUuid, businessPartnerUuid,
warehouseUuid: rootGetters.currentWarehouse.uuid,
pageToken pageToken
}).then(responseProductPrice => { }).then(responseProductPrice => {
if (isEmptyValue(token) || isEmptyValue(pageToken)) { if (isEmptyValue(token) || isEmptyValue(pageToken)) {
@ -91,7 +91,7 @@ export default {
resolve(responseProductPrice) resolve(responseProductPrice)
}).catch(error => { }).catch(error => {
console.warn(`getKeyLayoutFromServer: ${error.message}. Code: ${error.code}.`) console.warn(`getProductPriceList: ${error.message}. Code: ${error.code}.`)
showMessage({ showMessage({
type: 'error', type: 'error',
message: error.message, message: error.message,
@ -142,9 +142,8 @@ export default {
return new Promise(resolve => { return new Promise(resolve => {
getProductPriceList({ getProductPriceList({
searchValue, searchValue,
priceListUuid: rootGetters.currentPriceList.uuid, posUuid: rootGetters.currentPointOfSales.uuid,
businessPartnerUuid, businessPartnerUuid,
warehouseUuid,
pageToken pageToken
}).then(responseProductPrice => { }).then(responseProductPrice => {
if (isEmptyValue(token) || isEmptyValue(pageToken)) { if (isEmptyValue(token) || isEmptyValue(pageToken)) {