Handy_Cao 3 minggu lalu
induk
melakukan
5a0bc1b4a4

+ 6 - 1
public/locales/en-US.json

@@ -1853,6 +1853,11 @@
         "buy": "Buy",
         "marketclose": "Market-Close",
         "history": "History",
-        "tips": "Market closing will liquidate the position by market order."
+        "tips": "Market closing will liquidate the position by market order.",
+        "tradeid": "OrderID",
+        "spsl": "SP-SL",
+        "sp": "SP",
+        "sl": "SL",
+        "quoteprice": "QuotePrice"
     }
 }

+ 6 - 1
public/locales/th-TH.json

@@ -1856,6 +1856,11 @@
         "buy": "Buy",
         "marketclose": "MarketClose",
         "history": "历史",
-        "tips": "市價平倉會以市價委託方式平掉此倉位。"
+        "tips": "市價平倉會以市價委託方式平掉此倉位。",
+        "tradeid": "OrderID",
+        "spsl": "SP-SL",
+        "sp": "SP",
+        "sl": "SL",
+        "quoteprice": "QuotePrice"
     }
 }

+ 6 - 1
public/locales/vi-VN.json

@@ -1853,6 +1853,11 @@
         "buy": "Buy",
         "marketclose": "MarketClose",
         "history": "历史",
-        "tips": "市價平倉會以市價委託方式平掉此倉位。"
+        "tips": "市價平倉會以市價委託方式平掉此倉位。",
+        "tradeid": "OrderID",
+        "spsl": "SP-SL",
+        "sp": "SP",
+        "sl": "SL",
+        "quoteprice": "QuotePrice"
     }
 }

+ 6 - 1
public/locales/zh-CN.json

@@ -1856,6 +1856,11 @@
         "buy": "开多",
         "marketclose": "市价平仓",
         "history": "历史",
-        "tips": "市价平仓会以市价委托方式平掉此仓位。"
+        "tips": "市价平仓会以市价委托方式平掉此仓位。",
+        "tradeid": "持仓单号",
+        "spsl": "止盈止损",
+        "sp": "止盈",
+        "sl": "止损",
+        "quoteprice": "行情价格"
     }
 }

+ 6 - 1
public/locales/zh-TW.json

@@ -1856,6 +1856,11 @@
         "buy": "開多",
         "marketclose": "市價平倉",
         "history": "歷史",
-        "tips": "市價平倉會以市價委託方式平掉此倉位。"
+        "tips": "市價平倉會以市價委託方式平掉此倉位。",
+        "tradeid": "持倉單號",
+        "spsl": "止盈止損",
+        "sp": "止盈",
+        "sl": "止損",
+        "quoteprice": "行情價格"
     }
 }

+ 2 - 3
src/packages/digital/views/contract/components/position/detail/close/index.vue

@@ -7,14 +7,14 @@
             </template>
             <Form ref="formRef" class="g-form__container" @submit="onCloseSumit">
                 <CellGroup title="持仓信息" inset>
-                    <Cell title="持仓单号" :value="selectedItem.tradeid" />
+                    <Cell :title="t('digital.tradeid')" :value="selectedItem.tradeid" />
                     <Cell :title="t('digital.goodscode')" :value="`${selectedItem.goodscode}/${selectedItem.goodsname}`" />
                     <Cell :title="t('position.transfer.buyorsell')" :value="getBuyOrSellName(selectedItem.buyorsell, 1)" />
                     <Cell :title="`${t('position.goods.holddetail.holderprice')}(${selectedItem.currencyname})`"
                         :value="selectedItem.holderprice.toFixed(selectedItem.decimalplace)" />
                     <Cell :title="`${t('quote.holdvolume')}(${selectedItem.goodscode})`" :value="selectedItem.holderqty" />
                     <Cell :title="`${t('position.goods.frozenqty')}(${selectedItem.goodscode})`" :value="selectedItem.freezeqty" />
-                    <Cell :title="`行情价格(${selectedItem.currencyname})`" :value="floatingPL.lastPrice">
+                    <Cell :title="`${t('digital.quoteprice')}(${selectedItem.currencyname})`" :value="floatingPL.lastPrice">
                         <template #value>
                             <span :class="floatingPL.lastPriceClass">
                                 {{ floatingPL.lastPrice.toFixed(selectedItem.decimalplace) }}
@@ -77,7 +77,6 @@ const props = defineProps({
     }
 })
 
-// const { global: { t } } = i18n
 const userStore = useUserStore()
 const futuresStore = useFuturesStore()
 const positionStore = usePositionStore()

+ 2 - 2
src/packages/digital/views/contract/components/position/list/close/index.vue

@@ -6,14 +6,14 @@
                 <app-navbar title="汇总平仓" @back="closed" />
             </template>
             <Form ref="formRef" class="g-form__container" @submit="onCloseSumit">
-                <CellGroup title="持仓信息" inset>
+                <CellGroup :title="t('position.goods.subtitle')" inset>
                     <Cell :title="t('digital.goodscode')" :value="`${selectedRow.goodscode}/${selectedRow.goodsname}`" />
                     <Cell :title="t('position.transfer.buyorsell')" :value="getBuyOrSellName(selectedRow.buyorsell, 1)" />
                     <Cell :title="`${t('position.goods.holddetail.holderprice')}(${currency(selectedRow.currencyid)})`"
                         :value="selectedRow.averageprice" />
                     <Cell :title="`${t('quote.holdvolume')}(${selectedRow.goodscode})`" :value="selectedRow.curpositionqty" />
                     <Cell :title="`${t('position.goods.frozenqty')}(${selectedRow.goodscode})`" :value="selectedRow.frozenqty" />
-                    <Cell :title="`行情价格(${currency(selectedRow.currencyid)})`">
+                    <Cell :title="`${t('digital.quoteprice')}(${currency(selectedRow.currencyid)})`">
                         <template #value>
                             <span :class="selectedRow.lastPriceClass">
                                 {{ selectedRow.lastPrice.toFixed(selectedRow.decimalplace) }}

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

@@ -62,7 +62,7 @@
                         <Button size="small" @click="showComponent('Close', index)">{{ $t('operation.close') }}</Button>
                         <Button size="small" @click="showComponent('MarketClose', index)">{{ $t('digital.marketclose')
                             }}</Button>
-                        <Button size="small" @click="showComponent('TPSL', index)">止盈止损</Button>
+                        <Button size="small" @click="showComponent('TPSL', index)">{{ $t('digital.spsl') }}</Button>
                     </td>
                 </tr>
             </tfoot>

+ 49 - 19
src/packages/digital/views/contract/components/position/list/tpsl/index.vue

@@ -5,22 +5,22 @@
             <template #header>
                 <app-navbar title="汇总平仓" @back="closed" />
             </template>
-            <Form ref="formRef" class="g-form__container" @submit="onSubmit">
-                <CellGroup title="持仓信息" inset>
-                    <Cell title="代码/名称" :value="`${selectedRow.goodscode}/${selectedRow.goodsname}`" />
-                    <Cell title="持仓方向" :value="getBuyOrSellName(selectedRow.buyorsell, 1)" />
-                    <Cell :title="`持仓价格(${getGoodsCurrencyItemName(selectedRow.currencyid)})`"
+            <Form ref="formRef" class="g-form__container" @submit="onCloseSumit">
+                <CellGroup :title="t('position.goods.subtitle')" inset>
+                    <Cell :title="t('digital.goodscode')" :value="`${selectedRow.goodscode}/${selectedRow.goodsname}`" />
+                    <Cell :title="t('position.transfer.buyorsell')" :value="getBuyOrSellName(selectedRow.buyorsell, 1)" />
+                    <Cell :title="`${t('position.goods.holddetail.holderprice')}(${getGoodsCurrencyItemName(selectedRow.currencyid)})`"
                         :value="selectedRow.averageprice" />
-                    <Cell :title="`持仓量(${selectedRow.goodscode})`" :value="selectedRow.curpositionqty" />
-                    <Cell :title="`冻结量(${selectedRow.goodscode})`" :value="selectedRow.frozenqty" />
-                    <Cell :title="`行情价格(${getGoodsCurrencyItemName(selectedRow.currencyid)})`">
+                    <Cell :title="`${t('quote.holdvolume')}(${selectedRow.goodscode})`" :value="selectedRow.curpositionqty" />
+                    <Cell :title="`${t('position.goods.frozenqty')}(${selectedRow.goodscode})`" :value="selectedRow.frozenqty" />
+                    <Cell :title="`${t('digital.quoteprice')}(${getGoodsCurrencyItemName(selectedRow.currencyid)})`">
                         <template #value>
                             <span :class="selectedRow.lastPriceClass">
                                 {{ selectedRow.lastPrice.toFixed(selectedRow.decimalplace) }}
                             </span>
                         </template>
                     </Cell>
-                    <Cell :title="`浮动盈亏(${getGoodsCurrencyItemName(selectedRow.currencyid)})`">
+                    <Cell :title="`${t('position.goods.holddetail.profitLoss')}(${getGoodsCurrencyItemName(selectedRow.currencyid)})`">
                         <template #value>
                             <span :class="selectedRow.profitLossClass">
                                 {{ selectedRow.profitLoss.toFixed(selectedRow.decimalplace) }}
@@ -28,10 +28,10 @@
                         </template>
                     </Cell>
                 </CellGroup>
-                <CellGroup title="止盈止损" inset>
-                    <Cell :value="`价格 (>=${pricePoints.takeProfit.toFixed(selectedRow.decimalplace)})`">
+                <CellGroup :title="t('digital.spsl')" inset>
+                    <Cell :value="`${t('mine.setting.price')} (>=${pricePoints.takeProfit.toFixed(selectedRow.decimalplace)})`">
                         <template #title>
-                            <Checkbox v-model="formData.TPFlag">止盈</Checkbox>
+                            <Checkbox v-model="formData.TPFlag">{{ $t('digital.sp') }}</Checkbox>
                         </template>
                     </Cell>
                     <Field name="SpPrice" :rules="formRules.SpPrice">
@@ -43,9 +43,9 @@
                     </Field>
                 </CellGroup>
                 <CellGroup inset>
-                    <Cell :value="`价格 (>=${pricePoints.stopLoss.toFixed(selectedRow.decimalplace)})`">
+                    <Cell :value="`${t('mine.setting.price')} (>=${pricePoints.stopLoss.toFixed(selectedRow.decimalplace)})`">
                         <template #title>
-                            <Checkbox v-model="formData.SLFlag">止损</Checkbox>
+                            <Checkbox v-model="formData.SLFlag">{{ $t('digital.sl') }}</Checkbox>
                         </template>
                     </Cell>
                     <Field name="SlPrice" :rules="formRules.SlPrice">
@@ -58,7 +58,7 @@
                 </CellGroup>
             </Form>
             <div class="g-form__footer inset">
-                <Button type="primary" @click="formRef?.submit()" block>提交</Button>
+                <Button type="primary" @click="formRef?.submit()" block>{{ $t('operation.submit') }}</Button>
             </div>
         </app-view>
     </app-modal>
@@ -70,8 +70,8 @@ import { CellGroup, Cell, Button, FieldRule, Form, Field, FormInstance, Checkbox
 import { dialog, fullloading } from '@/utils/vant'
 import { getBuyOrSellName, getGoodsCurrencyItemName, BuyOrSell } from '@/constants/order'
 import { useOrder } from '@/business/trade'
-import { useFuturesStore } from '@/stores'
-import { EPriceMode } from '@/constants/client'
+import { i18n, useFuturesStore, useUserStore } from '@/stores'
+import { EBuildType, EDelistingType, EOrderOperateType, EListingSelectType, EPriceMode, EValidType } from '@/constants/client'
 import AppModal from '@/components/base/modal/index.vue'
 import AppStepper from '@mobile/components/base/stepper/index.vue'
 
@@ -87,6 +87,8 @@ const props = defineProps({
     }
 })
 
+const { global: { t } } = i18n
+const userStore = useUserStore()
 const futuresStore = useFuturesStore()
 const formRef = shallowRef<FormInstance>()
 const showModal = shallowRef(true)
@@ -146,8 +148,36 @@ const formRules: { [key: string]: FieldRule[] } = {
     }],
 }
 
-const onSubmit = () => {
-    console.log('提交成功')
+const onCloseSumit = () => {
+    dialog({
+        message: '确认要平仓吗?',
+        showCancelButton: true,
+    }).then(() => {
+
+        const { marketid, goodsid, buyorsell } = props.selectedRow
+        /// 市场ID
+        formData.Header = { GoodsID: goodsid }
+        formData.MarketID = marketid
+        formData.BuyOrSell = buyorsell === BuyOrSell.Buy ? BuyOrSell.Sell : BuyOrSell.Buy
+        formData.GoodsID = goodsid
+        formData.ListingSelectType = EListingSelectType.LISTINGSELECTTYPE_DELISTINGTHENLISTING
+        formData.DelistingType = EDelistingType.DELISTINGTYPE_PRICE
+        formData.BuildType = EBuildType.BUILDTYPE_CLOSE
+        formData.TimevalidType = EValidType.VALIDTYPE_DR
+        formData.OperateType = EOrderOperateType.ORDEROPERATETYPE_NORMAL
+        const param112 = userStore.getSystemParamValue('112')
+        formData.MarketMaxSub = Number(param112) || 100
+
+        /// loding....
+        fullloading((hideLoading) => {
+            formSubmit().then(() => {
+                hideLoading(t('common.submitsuccess'), 'success')
+                closed()
+            }).catch((err) => {
+                hideLoading(err, 'fail')
+            })
+        })
+    })
 }
 
 // 关闭弹窗

+ 3 - 1
src/packages/digital/views/contract/goods/detail/index.vue

@@ -134,6 +134,8 @@ const calculations = computed(() => {
 
     const feeValue = futuresStore.getFeeValue(quote.value, 101)
 
+    console.log(quote.value?.tradefees)
+
     const { bid = 0, ask = 0, agreeunit = 0, currencyid = 0, goodscurrencyid = 0, marketmarginalgorithm, marketmarginvalue = 0 } = quote.value ?? {}
     const { OrderPrice = 0, OrderQty = 0, BuyOrSell } = formData
 
@@ -153,7 +155,7 @@ const calculations = computed(() => {
     // 预估手续费 1 比率 2 固定 预估手续费(小数位根据币种小数位格式化):
     // 手续费设置(固定) 时:预估手续费 = 数量 * 合约乘数 * 固定值
     // 手续费设置(比率) 时:预估手续费 = 价格 * 数量 * 合约乘数 * 比率值
-    const buyEstimatedFee = (feeValue.FeeAlgorithm === 2 ? price : 1)*OrderQty*agreeunit*feeValue.feeValue
+    const buyEstimatedFee = (feeValue.FeeAlgorithm === 2 ? 1 : price)*OrderQty*agreeunit*feeValue.feeValue
     // 可开数量 1 比率 2 固定
     // 可开数量(整数,向下取整):
     // 保证金设置(固定) 时:可开数量 = 可用余额 / (合约乘数 * 固定值)