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