发票开出

szh-new
sunzehua 2 months ago
parent a7f9d309ab
commit e6c087debd

@ -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)
}
}

@ -684,6 +684,7 @@ function updateListFreeLeft(val){
},
bizList: val,
}
loading.value = true
FreeInvoiceSave(data).then(res => {
if (res.succeeded) {
createMessage.success('保存成功')
@ -697,6 +698,9 @@ function updateListFreeLeft(val){
getDetail()
}
}
loading.value = false
}).catch(()=>{
loading.value = false
})
}
function handleUpdate(val) {
@ -708,6 +712,7 @@ function handleUpdate(val) {
invoiceDetails: list.value,
applications: val,
}
loading.value = true
GeneralInvoiceSave(data).then(res => {
if (res.succeeded) {
createMessage.success('保存成功')
@ -721,6 +726,9 @@ function handleUpdate(val) {
getDetail()
}
}
loading.value = false
}).catch(()=>{
loading.value = false
})
}
function updateListFree(val) {
@ -737,6 +745,7 @@ function updateListFree(val) {
},
details: val,
}
loading.value = true
FreeInvoiceSave(data).then(res => {
if (res.succeeded) {
createMessage.success('保存成功')
@ -750,6 +759,9 @@ function updateListFree(val) {
getDetail()
}
}
loading.value = false
}).catch(()=>{
loading.value = false
})
}

Loading…
Cancel
Save