|
|
|
@ -365,6 +365,7 @@ function changeApply() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
const freeType = ref('')
|
|
|
|
|
const currenciesData = ref([]) as any
|
|
|
|
|
function addDetailFree() {
|
|
|
|
|
let arr = getSelectRowsFree() ? getSelectRowsFree() : []
|
|
|
|
|
if (arr.length == 0) {
|
|
|
|
@ -379,19 +380,30 @@ function addDetailFree() {
|
|
|
|
|
customerId: item.customerId
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
currenciesData.value = []
|
|
|
|
|
exchangarr.value = []
|
|
|
|
|
GetCurrencies(freeList).then(res => {
|
|
|
|
|
const cuArr = []
|
|
|
|
|
const cuArr = [] as any
|
|
|
|
|
currenciesData.value = res.data
|
|
|
|
|
res.data.forEach(item => {
|
|
|
|
|
if (item != 'RMB') {
|
|
|
|
|
cuArr.push(1)
|
|
|
|
|
item.exchangeRates.forEach(ite => {
|
|
|
|
|
if (ite.currency != 'RMB') {
|
|
|
|
|
cuArr.push({
|
|
|
|
|
currency: ite.currency,
|
|
|
|
|
id: item.id
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
if (cuArr.length > 0) {
|
|
|
|
|
const promises = cuArr.map(item => {
|
|
|
|
|
const filteredItems = cuArr.filter((item, index, self) =>
|
|
|
|
|
index === self.findIndex((t) => t.currency === item.currency)
|
|
|
|
|
);
|
|
|
|
|
const promises = filteredItems.map(item => {
|
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
|
const data = {
|
|
|
|
|
currencyFrom: 'RMB',
|
|
|
|
|
currencyTo: item,
|
|
|
|
|
currencyTo: item.currency,
|
|
|
|
|
}
|
|
|
|
|
GetExchangeRate(data).then(res => {
|
|
|
|
|
exchangarr.value.push(res.data)
|
|
|
|
@ -447,24 +459,36 @@ function handleSureExhange() {
|
|
|
|
|
exchangeFlag.value = false
|
|
|
|
|
}
|
|
|
|
|
if (route.query.type == 'free') {
|
|
|
|
|
let arr = [] as any
|
|
|
|
|
if (freeType.value == 'left') {
|
|
|
|
|
arr = getSelectRowsFree()
|
|
|
|
|
} else {
|
|
|
|
|
arr = getSelectRowsFeeDetail()
|
|
|
|
|
let arr = [] as any
|
|
|
|
|
currenciesData.value.forEach(item => {
|
|
|
|
|
item.exchangeRates.forEach(itemC => {
|
|
|
|
|
exchangarr.value.forEach(ite => {
|
|
|
|
|
if (itemC.currency == ite.currencyTo) {
|
|
|
|
|
itemC.exchangeRate = ite.reverseRate
|
|
|
|
|
}
|
|
|
|
|
if (itemC.currency == 'RMB') {
|
|
|
|
|
itemC.exchangeRate = 1
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
freeFlag.value = false
|
|
|
|
|
exchangeFlag.value = false
|
|
|
|
|
emits('updateListFreeLeft', currenciesData.value)
|
|
|
|
|
}
|
|
|
|
|
if (freeType.value == 'right') {
|
|
|
|
|
let arr = [] as any
|
|
|
|
|
arr = getSelectRowsFeeDetail()
|
|
|
|
|
arr.forEach(item => {
|
|
|
|
|
exchangarr.value.forEach(ite => {
|
|
|
|
|
if (item.currency == item.currencyTo) {
|
|
|
|
|
if (item.currency == ite.currencyTo) {
|
|
|
|
|
item.exchangeRate = ite.reverseRate
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
open.value = false
|
|
|
|
|
freeFlag.value = false
|
|
|
|
|
exchangeFlag.value = false
|
|
|
|
|
if (freeType.value == 'left') {
|
|
|
|
|
emits('updateListFreeLeft', arr)
|
|
|
|
|
} else {
|
|
|
|
|
emits('updateListFree', arr)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|