Merge branch 'dev' of http://60.209.125.238:20010/lijingjia/ds-wms-client-web into dev
commit
2e803090b5
@ -0,0 +1,89 @@
|
||||
<!--
|
||||
* @Description: 操作管理 -> 付费申请 -> 汇率换算组件
|
||||
* @Author: lijj
|
||||
* @Date: 2024-06-20 11:54:04
|
||||
-->
|
||||
<template>
|
||||
<div>
|
||||
<a-modal class="ds-exchange-rate" v-model:visible="visible" title="币别汇率折算" cancelText="关闭" @ok="handleOk">
|
||||
<div v-for="(item, index) in c2" :key="'cur' + index">
|
||||
<p class="flex">
|
||||
<span class="unit">1{{ c1 }} =</span>
|
||||
<a-input-number
|
||||
v-model:value="item.value"
|
||||
:min="0.000001"
|
||||
:max="99999999"
|
||||
:step="0.000001"
|
||||
string-mode
|
||||
:precision="6"
|
||||
@change="calc1($event, item)"
|
||||
/>
|
||||
{{ item.currency }}
|
||||
</p>
|
||||
<p class="flex">
|
||||
<span class="unit">1{{ item.currency }} =</span>
|
||||
<a-input-number
|
||||
v-model:value="item.value1"
|
||||
:min="0.000001"
|
||||
:max="99999999"
|
||||
:step="0.000001"
|
||||
:precision="6"
|
||||
string-mode
|
||||
@change="calc2($event, item)"
|
||||
/>
|
||||
{{ c1 }}
|
||||
</p>
|
||||
</div>
|
||||
</a-modal>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, ref, defineEmits, defineProps, watch, defineExpose } from 'vue'
|
||||
import { GetExchangeRate } from '../../api'
|
||||
const emit = defineEmits(['submit'])
|
||||
const visible = ref(false)
|
||||
const value = ref(0)
|
||||
const value1 = ref(0)
|
||||
const handleOk = () => {
|
||||
visible.value = false
|
||||
emit('submit', c2.value)
|
||||
}
|
||||
// 业务币别
|
||||
const c1 = ref()
|
||||
// 要转换的币别集合
|
||||
const c2 = ref([])
|
||||
const init = (currency, list) => {
|
||||
visible.value = true
|
||||
c1.value = currency
|
||||
c2.value = list
|
||||
c2.value.forEach(item => {
|
||||
GetExchangeRate({ currencyFrom: currency, currencyTo: item.currency, feeType: item.feeType }).then(res => {
|
||||
item.value = res.data.rate
|
||||
item.value1 = res.data.reverseRate
|
||||
})
|
||||
})
|
||||
}
|
||||
const calc1 = (e, item) => {
|
||||
item.value1 = (1 / e).toFixed(6)
|
||||
}
|
||||
const calc2 = (e, item) => {
|
||||
item.value = (1 / e).toFixed(6)
|
||||
}
|
||||
defineExpose({
|
||||
init
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
.ds-exchange-rate {
|
||||
.unit {
|
||||
display: inline-block;
|
||||
width: 66px;
|
||||
}
|
||||
.ant-input-number {
|
||||
position: relative;
|
||||
top: -4px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
</style>
|
Loading…
Reference in New Issue