Handy_Cao 1 mese fa
parent
commit
d2ee01c00d

+ 11 - 1
src/packages/digital/views/contract/components/order/list/index.vue

@@ -50,7 +50,7 @@
 </template>
 
 <script lang="ts" setup>
-import { PropType, shallowRef, defineAsyncComponent } from 'vue'
+import { PropType, shallowRef, defineAsyncComponent, onUnmounted } from 'vue'
 import { Button } from 'vant'
 import { formatDate, formatDecimal } from '@/filters'
 import { getBuyOrSellName,getBuildTypeName, getWRTradeOrderStatusName, getGoodsCurrencyItemName } from '@/constants/order'
@@ -58,6 +58,7 @@ import { useRequest } from '@/hooks/request'
 import { useComponent } from '@/hooks/component'
 import { queryTradeOrderDetail } from '@/services/api/order'
 import { useFuturesStore } from '@/stores'
+import eventBus from '@/services/bus'
 import AppPullRefresh from '@mobile/components/base/pull-refresh/index.vue'
 
 const props = defineProps({
@@ -110,10 +111,19 @@ const onRefresh = () => {
     run(props.params)
 }
 
+// 接收委托回应通知
+const orderRspNotify = eventBus.$on('OrderRsp', () => pullRefreshRef.value?.refresh())
+
+
 // 暴露组件属性给父组件调用
 defineExpose({
     refresh: () => {
         pullRefreshRef.value?.refresh()
     }
 })
+
+onUnmounted(() => {
+    orderRspNotify.cancel()
+})
+
 </script>

+ 10 - 7
src/packages/digital/views/contract/goods/detail/index.vue

@@ -282,7 +282,7 @@ const tpsl = computed(() => {
 // 保证金设置(比率) 时:可开数量 = 可用余额 / (价格 * 合约乘数 * 比率值)
 const calculations = computed(() => {
 
-    const buyFeeValue = futuresStore.getFeeValue(quote.value, 101)
+    const feeValue = futuresStore.getFeeValue(quote.value, 101)
 
     const { last = 0, agreeunit = 0, currencyid = 0, goodscurrencyid = 0 } = quote.value ?? {}
     const { OrderPrice = 0, OrderQty = 0 } = formData
@@ -298,11 +298,15 @@ const calculations = computed(() => {
 
     // 可用余额
     const maxBalance =  account.avaiableBalance
-    // 预估手续费
-    const buyEstimatedFee = (buyFeeValue.FeeAlgorithm === 2 ? amount : estimatedAmount) * buyFeeValue.feeValue
-    // 可开数量
-    const maxBuyQty = price ? (maxBalance - buyEstimatedFee) / (price * agreeunit) : 0
-
+    // 预估手续费 1 比率 2 固定 预估手续费(小数位根据币种小数位格式化):
+    // 手续费设置(固定) 时:预估手续费 = 数量 * 合约乘数 * 固定值
+    // 手续费设置(比率) 时:预估手续费 = 价格 * 数量 * 合约乘数 * 比率值
+    const buyEstimatedFee = (feeValue.FeeAlgorithm === 1 ? OrderPrice : 1)*OrderQty*agreeunit*feeValue.feeValue
+    // 可开数量 1 比率 2 固定
+    // 可开数量(整数,向下取整):
+    // 保证金设置(固定) 时:可开数量 = 可用余额 / (合约乘数 * 固定值)
+    // 保证金设置(比率) 时:可开数量 = 可用余额 / (价格 * 合约乘数 * 比率值)
+    const maxBuyQty =  feeValue.FeeAlgorithm === 1 ? maxBalance/(agreeunit*feeValue.feeValue) : maxBalance/(OrderPrice*agreeunit*feeValue.feeValue)
     return {
         estimatedAmount,
         maxBalance,
@@ -351,7 +355,6 @@ const formRules: { [key: string]: FieldRule[] } = {
         message: '请输入数量',
         validator: (val) => {
             if (val) {
-                console.log(val)
                 if (val > 0) {
                     return true
                 }