|
|
@@ -16,7 +16,7 @@
|
|
|
<Cell title="持仓均价" :value="formatDecimal(selectedRow.averageprice)" />
|
|
|
<Cell title="参考损益">
|
|
|
<template #value>
|
|
|
- <span :class="handlePriceColor(closepl, 0.0)">{{ formatDecimal(closepl) }}</span>
|
|
|
+ <span :class="selectedRow.closeplColor">{{ formatDecimal(selectedRow.closepl) }}</span>
|
|
|
</template>
|
|
|
</Cell>
|
|
|
</CellGroup>
|
|
|
@@ -37,18 +37,18 @@
|
|
|
</CellGroup>
|
|
|
</Form>
|
|
|
<template #footer>
|
|
|
- <Button block square type="danger" @click="onCloseSumit">转让</Button>
|
|
|
+ <Button block square type="danger" @click="formRef?.submit">转让</Button>
|
|
|
</template>
|
|
|
</app-view>
|
|
|
</app-modal>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import { shallowRef, PropType, onMounted, computed } from 'vue'
|
|
|
+import { shallowRef, PropType, onMounted } from 'vue'
|
|
|
import AppModal from '@/components/base/modal/index.vue'
|
|
|
-import { CellGroup, Cell, Button, FieldRule, Form, Field, Stepper } from 'vant'
|
|
|
+import { CellGroup, Cell, Button, FieldRule, Form, Field, Stepper, FormInstance } from 'vant'
|
|
|
import { getBuyOrSellName, BuyOrSell } from '@/constants/order'
|
|
|
-import { formatDecimal, handleNumberValue, handlePriceColor } from '@/filters'
|
|
|
+import { formatDecimal, handleNumberValue } from '@/filters'
|
|
|
import { useOrder } from '@/business/trade'
|
|
|
import { dialog, fullloading } from '@/utils/vant'
|
|
|
import { useFuturesStore } from '@/stores'
|
|
|
@@ -56,27 +56,24 @@ import { EBuildType, EDelistingType, EListingSelectType, EOrderOperateType, EPri
|
|
|
|
|
|
const props = defineProps({
|
|
|
selectedRow: {
|
|
|
- type: Object as PropType<Model.TradePositionRsp>,
|
|
|
+ type: Object as PropType<Model.TradePositionRsp & {
|
|
|
+ closepl: number; // 浮动盈亏
|
|
|
+ closeplColor: string; // 浮动盈亏颜色
|
|
|
+ }>,
|
|
|
required: true,
|
|
|
}
|
|
|
})
|
|
|
|
|
|
const futuresStore = useFuturesStore()
|
|
|
const quote = futuresStore.getGoodsQuote(props.selectedRow.goodscode)
|
|
|
+const formRef = shallowRef<FormInstance>()
|
|
|
const showModal = shallowRef(true)
|
|
|
// 是否刷新父组件数据
|
|
|
const refresh = shallowRef(false)
|
|
|
const { formSubmit, formData } = useOrder()
|
|
|
|
|
|
-// 损益
|
|
|
-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: { [key in keyof Proto.OrderReq]?: FieldRule[] } = {
|
|
|
+const formRules: { [key: string]: FieldRule[] } = {
|
|
|
OrderPrice: [{
|
|
|
message: '请输入转让价格',
|
|
|
validator: () => {
|