汇率管理
This commit is contained in:
@@ -24,6 +24,12 @@
|
||||
<el-card shadow="hover" class="balance-card">
|
||||
<div class="balance-label">账户余额</div>
|
||||
<div class="balance-value primary">{{ formatMoney(currentAccount.balance) }}</div>
|
||||
<div v-if="currentCurrency !== 'CNY'" class="balance-base">
|
||||
≈ CNY {{ baseAmountText }}
|
||||
<el-tooltip :content="baseRateText" placement="bottom">
|
||||
<el-icon class="balance-base-icon"><InfoFilled /></el-icon>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :xs="12" :sm="8" :md="4">
|
||||
@@ -368,6 +374,7 @@ import axios from 'axios'
|
||||
import { saveAs } from 'file-saver'
|
||||
import { getCustomer } from "@/api/customersuppliermanagement/customerinfo/customer.js"
|
||||
import { listAccount, listReceipt, getReceipt, addReceipt, confirmReceipt, cancelReceipt, listFlow } from "@/api/customersuppliermanagement/customermoney/customermoney.js"
|
||||
import { convertToBase } from "@/api/data/exchangeRate"
|
||||
import { getToken } from "@/utils/auth"
|
||||
|
||||
import { useRoute } from 'vue-router'
|
||||
@@ -466,9 +473,42 @@ function loadAccounts() {
|
||||
const exists = accountList.value.some(a => a.currency === currentCurrency.value)
|
||||
if (!exists) currentCurrency.value = accountList.value[0].currency
|
||||
}
|
||||
loadBaseAmounts()
|
||||
})
|
||||
}
|
||||
|
||||
/* 外币账户按即期汇率折算本位币(CNY) */
|
||||
const baseAmountMap = ref({})
|
||||
const baseRateMap = ref({})
|
||||
|
||||
function loadBaseAmounts() {
|
||||
baseAmountMap.value = {}
|
||||
baseRateMap.value = {}
|
||||
accountList.value
|
||||
.filter(a => a.currency && a.currency !== 'CNY' && Number(a.balance) !== 0)
|
||||
.forEach(a => {
|
||||
convertToBase({ amount: a.balance, currency: a.currency, rateType: '0' })
|
||||
.then(res => {
|
||||
baseAmountMap.value[a.currency] = res.data.result
|
||||
baseRateMap.value[a.currency] = res.data.rate
|
||||
})
|
||||
.catch(() => {
|
||||
// 未维护汇率时不阻塞页面,折算行不显示
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const baseAmountText = computed(() => {
|
||||
const v = baseAmountMap.value[currentCurrency.value]
|
||||
return v === undefined || v === null ? '-' : formatMoney(v)
|
||||
})
|
||||
const baseRateText = computed(() => {
|
||||
const r = baseRateMap.value[currentCurrency.value]
|
||||
return r === undefined || r === null
|
||||
? '未维护对CNY汇率'
|
||||
: `按即期汇率折算:1 ${currentCurrency.value} = ${r} CNY`
|
||||
})
|
||||
|
||||
function goBack() {
|
||||
router.push({ path: '/customersuppliermanagement/customerinfo' })
|
||||
}
|
||||
@@ -815,6 +855,19 @@ watch(() => route.query.customerId, (newId, oldId) => {
|
||||
.balance-value.success { color: var(--el-color-success); }
|
||||
.balance-value.warning { color: var(--el-color-warning); }
|
||||
.balance-value.danger { color: var(--el-color-danger); }
|
||||
.balance-base {
|
||||
margin-top: 6px;
|
||||
font-size: 12px;
|
||||
color: var(--el-text-color-secondary);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 4px;
|
||||
}
|
||||
.balance-base-icon {
|
||||
cursor: help;
|
||||
font-size: 13px;
|
||||
}
|
||||
.search-form {
|
||||
margin-bottom: -4px;
|
||||
}
|
||||
|
||||
@@ -315,6 +315,20 @@
|
||||
<el-input v-model="form.ed" placeholder="请输入资金额度" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="结算方式" prop="settlementType">
|
||||
<el-select
|
||||
v-model="form.settlementType"
|
||||
placeholder="请选择结算方式"
|
||||
clearable
|
||||
>
|
||||
<el-option label="月结" value="0" />
|
||||
<el-option label="周结" value="1" />
|
||||
<el-option label="日结" value="2" />
|
||||
<el-option label="现结" value="3" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="回款账期" prop="zq">
|
||||
<el-input v-model="form.zq" placeholder="请输入回款账期" />
|
||||
@@ -364,6 +378,7 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item label="临时额度" prop="tempEd">
|
||||
<el-input v-model="form.tempEd" placeholder="请输入临时额度" />
|
||||
|
||||
Reference in New Issue
Block a user