|
|
@@ -25,12 +25,15 @@
|
|
|
<app-stepper v-model="formData.Amount" :min="0" />
|
|
|
</template>
|
|
|
</Field>
|
|
|
- <Cell title="可用" value="0" />
|
|
|
+ <Cell title="可用"
|
|
|
+ :value="formatDecimal(contractAccount?.avaiableBalance ?? 0, contractAccount?.currencydecimalplace)"
|
|
|
+ v-if="formData.DigitalTransferType === 3" />
|
|
|
+ <Cell title="可用" :value="spotBalance" v-if="formData.DigitalTransferType === 4" />
|
|
|
</CellGroup>
|
|
|
</Form>
|
|
|
<Row class="g-layout-block g-layout-block--inset" gutter="10">
|
|
|
<Col span="12">
|
|
|
- <Button block>取消</Button>
|
|
|
+ <Button block @click="routerBack">取消</Button>
|
|
|
</Col>
|
|
|
<Col span="12">
|
|
|
<Button type="primary" block @click="formRef?.submit">划转</Button>
|
|
|
@@ -40,15 +43,21 @@
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import { shallowRef, reactive } from 'vue'
|
|
|
+import { shallowRef, reactive, computed } from 'vue'
|
|
|
import { FormInstance, Form, Col, Row, Button, CellGroup, Field, Cell, FieldRule } from 'vant'
|
|
|
import { fullloading } from '@/utils/vant'
|
|
|
+import { formatDecimal } from '@/filters'
|
|
|
+import { useNavigation } from '@mobile/router/navigation'
|
|
|
import { getCurrencyList, getDigitalCurrencyList } from '@/constants/order'
|
|
|
import { DigitalAccountTransferApply } from '@/services/api/bank'
|
|
|
import { useAccountStore, useUserStore } from '@/stores'
|
|
|
+import { useSpotAccountStore } from '../components/spot/composables'
|
|
|
import AppSelect from '@mobile/components/base/select/index.vue'
|
|
|
import AppStepper from '@mobile/components/base/stepper/index.vue'
|
|
|
|
|
|
+const { routerBack } = useNavigation()
|
|
|
+
|
|
|
+const spotAccountStore = useSpotAccountStore()
|
|
|
const accountStore = useAccountStore()
|
|
|
const userStore = useUserStore()
|
|
|
|
|
|
@@ -79,12 +88,27 @@ const currencyOptions = (() => {
|
|
|
})()
|
|
|
|
|
|
const formData = reactive<Partial<Proto.DigitalAccountTransferApplyReq>>({
|
|
|
- AccountID: accountStore.currentAccountId,
|
|
|
UserID: userStore.userInfo.userid,
|
|
|
DigitalTransferType: 3,
|
|
|
Amount: 1,
|
|
|
})
|
|
|
|
|
|
+// 现货可用余额
|
|
|
+const spotBalance = computed(() => {
|
|
|
+ const item = spotAccountStore.getAccountItem({
|
|
|
+ currencyid: formData.CurrencyID
|
|
|
+ })
|
|
|
+
|
|
|
+ const balance = spotAccountStore.getAvailableBalance(item)
|
|
|
+
|
|
|
+ return formatDecimal(balance, item?.currencydecimalplace)
|
|
|
+})
|
|
|
+
|
|
|
+// 合约账户
|
|
|
+const contractAccount = computed(() => accountStore.getAccountItem({
|
|
|
+ currencyid: formData.CurrencyID
|
|
|
+}))
|
|
|
+
|
|
|
// 表单验证规则
|
|
|
const formRules: { [key: string]: FieldRule[] } = {
|
|
|
CurrencyID: [{
|
|
|
@@ -100,9 +124,13 @@ const formRules: { [key: string]: FieldRule[] } = {
|
|
|
const onSubmit = () => {
|
|
|
fullloading((hideLoading) => {
|
|
|
DigitalAccountTransferApply({
|
|
|
- data: formData
|
|
|
+ data: {
|
|
|
+ ...formData,
|
|
|
+ AccountID: contractAccount.value?.accountid
|
|
|
+ }
|
|
|
}).then(() => {
|
|
|
hideLoading('提交成功', 'success')
|
|
|
+ routerBack()
|
|
|
}).catch((err) => {
|
|
|
hideLoading(err, 'fail')
|
|
|
})
|