|
@@ -31,7 +31,7 @@
|
|
|
<Field name="OrderPrice" :rules="formRules.OrderPrice" :label="t('quote.goods.orderprice')"
|
|
<Field name="OrderPrice" :rules="formRules.OrderPrice" :label="t('quote.goods.orderprice')"
|
|
|
label-align="top">
|
|
label-align="top">
|
|
|
<template #input>
|
|
<template #input>
|
|
|
- <app-stepper v-model.number="formData.OrderPrice" :min="0" :decimal-length="quote?.decimalplace"
|
|
|
|
|
|
|
+ <app-stepper v-model="orderPrice" :min="0" :decimal-length="quote?.decimalplace"
|
|
|
:step="quote?.decimalvalue" />
|
|
:step="quote?.decimalvalue" />
|
|
|
</template>
|
|
</template>
|
|
|
</Field>
|
|
</Field>
|
|
@@ -39,8 +39,9 @@
|
|
|
<CellGroup inset>
|
|
<CellGroup inset>
|
|
|
<Field :label="t('quote.goods.orderqty')" label-align="top" :rules="formRules.OrderQty">
|
|
<Field :label="t('quote.goods.orderqty')" label-align="top" :rules="formRules.OrderQty">
|
|
|
<template #input>
|
|
<template #input>
|
|
|
- <app-stepper v-model.number="formData.OrderQty" :min="0"
|
|
|
|
|
- :decimal-length="baseAccount?.currencydecimalplace" :step="baseAccount?.currencydecimalplace" />
|
|
|
|
|
|
|
+ <app-stepper v-model="formData.OrderQty" :min="0"
|
|
|
|
|
+ :decimal-length="baseAccount?.currencydecimalplace"
|
|
|
|
|
+ :step="baseAccount?.currencydecimalplace" />
|
|
|
</template>
|
|
</template>
|
|
|
</Field>
|
|
</Field>
|
|
|
</CellGroup>
|
|
</CellGroup>
|
|
@@ -150,6 +151,7 @@ const futuresStore = useFuturesStore()
|
|
|
const spotAccountStore = useSpotAccountStore()
|
|
const spotAccountStore = useSpotAccountStore()
|
|
|
const activeTab = shallowRef(0)
|
|
const activeTab = shallowRef(0)
|
|
|
const formRef = shallowRef<FormInstance>()
|
|
const formRef = shallowRef<FormInstance>()
|
|
|
|
|
+const orderPrice = shallowRef('0')
|
|
|
|
|
|
|
|
const formData = reactive<Partial<Proto.DigitalOrderReq>>({
|
|
const formData = reactive<Partial<Proto.DigitalOrderReq>>({
|
|
|
BuyOrSell: BuyOrSell.Buy,
|
|
BuyOrSell: BuyOrSell.Buy,
|
|
@@ -172,9 +174,9 @@ const calculations = computed(() => {
|
|
|
const sellFeeValue = futuresStore.getFeeValue(quote.value, 102)
|
|
const sellFeeValue = futuresStore.getFeeValue(quote.value, 102)
|
|
|
|
|
|
|
|
const { last = 0, agreeunit = 0 } = quote.value ?? {}
|
|
const { last = 0, agreeunit = 0 } = quote.value ?? {}
|
|
|
- const { OrderPrice = 0, OrderQty = 0 } = formData
|
|
|
|
|
|
|
+ const { OrderQty = 0 } = formData
|
|
|
|
|
|
|
|
- const price = formData.PriceMode === PriceMode.Market ? last : Number(OrderPrice)
|
|
|
|
|
|
|
+ const price = formData.PriceMode === PriceMode.Market ? last : Number(orderPrice.value)
|
|
|
const amount = OrderQty * agreeunit
|
|
const amount = OrderQty * agreeunit
|
|
|
|
|
|
|
|
// 预估金额
|
|
// 预估金额
|
|
@@ -186,7 +188,7 @@ const calculations = computed(() => {
|
|
|
// 买预估手续费
|
|
// 买预估手续费
|
|
|
const buyEstimatedFee = (buyFeeValue.FeeAlgorithm === 2 ? amount : estimatedAmount) * buyFeeValue.feeValue
|
|
const buyEstimatedFee = (buyFeeValue.FeeAlgorithm === 2 ? amount : estimatedAmount) * buyFeeValue.feeValue
|
|
|
// 可买数量
|
|
// 可买数量
|
|
|
- const maxBuyQty = (price && maxBalance>buyEstimatedFee) ? (maxBalance - buyEstimatedFee) / (price * agreeunit) : 0
|
|
|
|
|
|
|
+ const maxBuyQty = (price && maxBalance > buyEstimatedFee) ? maxBalance / (price * agreeunit) : 0
|
|
|
|
|
|
|
|
// 卖预估手续费
|
|
// 卖预估手续费
|
|
|
const sellEstimatedFee = (sellFeeValue.FeeAlgorithm === 2 ? amount : estimatedAmount) * sellFeeValue.feeValue
|
|
const sellEstimatedFee = (sellFeeValue.FeeAlgorithm === 2 ? amount : estimatedAmount) * sellFeeValue.feeValue
|
|
@@ -194,7 +196,7 @@ const calculations = computed(() => {
|
|
|
const maxSellQty = spotAccountStore.getAvailableBalance(baseAccount.value)
|
|
const maxSellQty = spotAccountStore.getAvailableBalance(baseAccount.value)
|
|
|
// 可获金额
|
|
// 可获金额
|
|
|
const maxAmount = price * maxSellQty * agreeunit
|
|
const maxAmount = price * maxSellQty * agreeunit
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
return {
|
|
return {
|
|
|
estimatedAmount,
|
|
estimatedAmount,
|
|
@@ -212,7 +214,7 @@ const formRules: { [key: string]: FieldRule[] } = {
|
|
|
OrderPrice: [{
|
|
OrderPrice: [{
|
|
|
message: t('quote.goods.pleaseenterorderprice'),
|
|
message: t('quote.goods.pleaseenterorderprice'),
|
|
|
validator: () => {
|
|
validator: () => {
|
|
|
- return Number(formData.OrderPrice) > 0
|
|
|
|
|
|
|
+ return Number(orderPrice.value) > 0
|
|
|
}
|
|
}
|
|
|
}],
|
|
}],
|
|
|
OrderQty: [{
|
|
OrderQty: [{
|
|
@@ -240,6 +242,7 @@ const onSubmit = () => {
|
|
|
formData.QuoteAccountID = Long.fromString(quoteAccountId)
|
|
formData.QuoteAccountID = Long.fromString(quoteAccountId)
|
|
|
formData.GoodsID = quote.value?.goodsid
|
|
formData.GoodsID = quote.value?.goodsid
|
|
|
formData.MarketID = quote.value?.marketid
|
|
formData.MarketID = quote.value?.marketid
|
|
|
|
|
+ formData.OrderPrice = Number(orderPrice.value)
|
|
|
|
|
|
|
|
digitalOrder({
|
|
digitalOrder({
|
|
|
data: formData
|
|
data: formData
|
|
@@ -263,7 +266,7 @@ const onSubmit = () => {
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
if (quote.value) {
|
|
if (quote.value) {
|
|
|
subscribe.start(quote.value.goodscode)
|
|
subscribe.start(quote.value.goodscode)
|
|
|
- formData.OrderPrice = quote.value.last
|
|
|
|
|
|
|
+ orderPrice.value = quote.value.last.toFixed(quote.value.decimalplace)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
onActivated(() => {
|
|
onActivated(() => {
|