Handy_Cao пре 2 година
родитељ
комит
5c6420d194

+ 4 - 6
src/packages/pc/views/footer/goods/position/components/delivery/index.vue

@@ -27,7 +27,7 @@
                 <span>{{ selectedRow.matchname }}</span>
             </el-form-item>
             <el-form-item label="参考损益">
-                <span :class="handlePriceColor(closepl(), 0)">{{ formatDecimal(closepl()) }}</span>
+                <span :class="handlePriceColor(closepl, 0)">{{ formatDecimal(closepl) }}</span>
             </el-form-item>
             <el-form-item prop="DeliveryLot" label="交收数量">
                 <el-input-number placeholder="请输入数量" v-model="formData.DeliveryLot" :precision="0" :max="selectedRow.enableqty" :min="0" />
@@ -44,7 +44,7 @@
 </template>
 
 <script lang="ts" setup>
-import { ref, PropType } from 'vue'
+import { ref, PropType, computed } from 'vue'
 import { ElMessage, FormInstance, FormRules } from 'element-plus'
 import { useOfflineDelivery } from '@/business/trade'
 import { useFuturesStore } from '@/stores'
@@ -67,13 +67,11 @@ const futuresStore = useFuturesStore()
 const quote = futuresStore.getQuoteInfo(props.selectedRow.goodscode)
 
 /// 计算参考损益
-const closepl = () => {
-    console.log('wwww',last)
+const closepl = computed(() => {
     const { last = 0 } = quote.value ?? {}
     const { curpositionqty, curholderamount, agreeunit, buyorsell } = props.selectedRow
-    
     return (last * curpositionqty * agreeunit - curholderamount) * (buyorsell === BuyOrSell.Buy ? 1 : -1)
-}
+})
 
 // 表单验证规则
 const formRules: FormRules = {

+ 3 - 5
src/packages/pc/views/footer/goods/position/components/transfer/index.vue

@@ -25,12 +25,10 @@
                 <span>{{ formatDecimal(selectedRow.averageprice) }}</span>
             </el-form-item>
             <el-form-item label="参考损益">
-                <template #value>
-                    <span :class="closepl ? 'g-price-up' : 'g-price-down'">{{ formatDecimal(closepl) }}</span>
-                </template>
+                <span :class="handlePriceColor(closepl, 0)">{{ formatDecimal(closepl) }}</span>
             </el-form-item>
             <el-form-item prop="OrderQty" label="转让数量">
-                <el-input-number placeholder="请输入数量" v-model="formData.OrderQty" :max="selectedRow.enableqty" :min="0" />
+                <el-input-number placeholder="请输入数量" v-model="formData.OrderQty" :precision="0" :max="selectedRow.enableqty" :min="0" />
             </el-form-item>
             <el-form-item prop="OrderPrice" label="转让价格">
                 <el-input-number placeholder="请输入价格" v-model="formData.OrderPrice" :decimal-length="selectedRow.decimalplace" />
@@ -47,7 +45,7 @@
 import { ref, PropType, computed, onMounted } from 'vue'
 import { ElMessage, FormInstance, FormRules } from 'element-plus'
 import { useOrder } from '@/business/trade'
-import { formatDecimal } from '@/filters'
+import { formatDecimal, handlePriceColor } from '@/filters'
 import { getBuyOrSellName, BuyOrSell } from '@/constants/order'
 import { useFuturesStore } from '@/stores'
 import { EBuildType, EDelistingType, EListingSelectType, EOrderOperateType, EPriceMode, EValidType } from '@/constants/client'