1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-06-05 04:29:19 +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
export function getProductPriceList({
searchValue,
priceListUuid,
businessPartnerUuid,
warehouseUuid,
validFrom,
posUuid,
// Query
// criteria,
pageSize,
@ -389,11 +388,10 @@ export function getProductPriceList({
url: `${config.pointOfSales.endpoint}/product-prices`,
method: 'get',
params: {
price_list_uuid: priceListUuid,
pos_uuid: posUuid,
search_value: searchValue,
valid_from: validFrom,
business_partner_uuid: businessPartnerUuid,
warehouse_uuid: warehouseUuid,
page_size: pageSize,
page_token: pageToken
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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