Handy_Cao преди 1 година
родител
ревизия
8f6295d1b1

+ 9 - 0
public/locales/en-US.json

@@ -345,6 +345,15 @@
             "enableqty": "enableqty",
             "closepl": "closepl",
             "expiredate": "expiredate"
+        },
+        "pricing": {
+            "title": "Pricing Position",
+            "curpositionqty": "CurPositionQty",
+            "averageprice": "AveragePrice",
+            "frozenqty": "FrozenQty",
+            "curholderamount": "CurHolderAmount",
+            "enableqty": "EnableQty",
+            "closepl": "ClosePl"
         }
     },
     "delivery": {

+ 9 - 0
public/locales/zh-CN.json

@@ -345,6 +345,15 @@
             "enableqty": "可用量",
             "closepl": "参考损益",
             "expiredate": "到期日"
+        },
+        "pricing": {
+            "title": "点价持仓",
+            "curpositionqty": "持有量",
+            "averageprice": "持仓均价",
+            "frozenqty": "冻结量",
+            "curholderamount": "持仓金额",
+            "enableqty": "可用量",
+            "closepl": "参考损益"
         }
     },
     "delivery": {

+ 0 - 1
src/packages/mobile/views/goods/detail/components/listing/Index.vue

@@ -153,7 +153,6 @@ const total = computed(() => {
 
 // 买方向持仓数量
 const buyQty = computed(() => positionStore.getOrderQty(BuyOrSell.Buy, props.goodsCode))
-
 // 卖方向持仓数量
 const sellQty = computed(() => positionStore.getOrderQty(BuyOrSell.Sell, props.goodsCode))
 

+ 1 - 1
src/packages/mobile/views/order/list/components/pricingorder/list/Index.vue

@@ -97,7 +97,7 @@ const onCancelSumit = (item: Model.TradeOrderDetailRsp) => {
         message: '确认要撤销吗?',
         showCancelButton: true,
     }).then(() => {
-        formData.Header = { MarketID: item.marketid }
+        formData.Header = { MarketID: item.marketid, GoodsID: item.goodsid }
         formData.OldOrderId = handleRequestBigNumber(item.orderid)
 
         /// loding....

+ 12 - 9
src/packages/mobile/views/order/position/components/pricing/list/Index.vue

@@ -6,37 +6,40 @@
                 <div class="g-order-list__titlebar">
                     <div class="left">
                         <h4>{{ item.goodscode }}/{{ item.goodsname }}</h4>
-                        <span>--</span>
                     </div>
                     <div class="right">
-                        <span>{{ getBuyOrSellName(item.buyorsell) }}</span>
+                        <span :class="!item.buyorsell ? 'g-price-up' : 'g-price-down'">
+                            {{ getBuyOrSellName(item.buyorsell) }}
+                        </span>
                     </div>
                 </div>
                 <div class="g-order-list__content">
                     <ul>
                         <li>
-                            <span>持有量:</span>
+                            <span>{{ $t('position.pricing.curpositionqty') }}</span>
                             <span>{{ formatDecimal(item.curpositionqty) }}</span>
                         </li>
                         <li>
-                            <span>持仓均价:</span>
+                            <span>{{ $t('position.pricing.averageprice') }}</span>
                             <span>{{ item.averageprice === 0.0 ? '--' : formatDecimal(item.averageprice) }}</span>
                         </li>
                         <li>
-                            <span>冻结量:</span>
+                            <span>{{ $t('position.pricing.frozenqty') }}</span>
                             <span>{{ formatDecimal(item.frozenqty) }}</span>
                         </li>
                         <li>
-                            <span>持仓金额:</span>
+                            <span>{{ $t('position.pricing.curholderamount') }}</span>
                             <span>{{ formatDecimal(item.curholderamount) }}</span>
                         </li>
                         <li>
-                            <span>可用量:</span>
+                            <span>{{ $t('position.pricing.enableqty') }}</span>
                             <span>{{ formatDecimal(item.enableqty) }}</span>
                         </li>
                         <li>
-                            <span>参考损益:</span>
-                            <span>--</span>
+                            <span>{{ $t('position.pricing.closepl') }}</span>
+                            <span :class="item.closeplColor">
+                                {{ formatDecimal(item.closepl, item.decimalplace) }}
+                            </span>
                         </li>
                     </ul>
                 </div>

+ 7 - 29
src/packages/mobile/views/pricing/detail/components/trade/Index.vue

@@ -54,10 +54,10 @@
                         </template>
                     </Field>
                     <!-- 限价 -->
-                    <Field name="OrderPrice" :rules="formRules.OrderPrice" label="价格"
-                        v-if="formData.PriceMode === PriceMode.Limit">
+                    <Field name="OrderPrice" :rules="formRules.OrderPrice" label="价格" v-if="formData.PriceMode === PriceMode.Limit">
                         <template #input>
-                            <Stepper v-model="formData.OrderPrice" theme="round" button-size="22" :auto-fixed="false" />
+                            <Stepper v-model="formData.OrderPrice" theme="round" button-size="22" :min="0"
+                             :auto-fixed="false" :decimal-length="quote?.decimalplace" :step="quote?.decimalvalue" />
                         </template>
                     </Field>
                     <Field name="SlPrice" :rules="formRules.SlPrice"
@@ -67,7 +67,7 @@
                         </template>
                         <template #input>
                             <Stepper v-model="formData.SlPrice" :disabled="!sl" theme="round" button-size="22" allow-empty
-                                :default-value="0" :min="0" integer />
+                                :default-value="0" :min="0" :decimal-length="quote?.decimalplace" :step="quote?.decimalvalue" />
                         </template>
                     </Field>
                     <Field name="SpPrice" :rules="formRules.SpPrice"
@@ -77,7 +77,7 @@
                         </template>
                         <template #input>
                             <Stepper v-model="formData.SpPrice" :disabled="!sp" theme="round" button-size="22" allow-empty
-                                :default-value="0" :min="0" integer />
+                                :default-value="0" :min="0" :decimal-length="quote?.decimalplace" :step="quote?.decimalvalue" />
                         </template>
                     </Field>
                     <template v-if="formData.BuyOrSell === BuyOrSell.Buy || quote?.tradeproperty !== 2">
@@ -132,14 +132,11 @@
 import { useFuturesStore, useAccountStore, usePositionStore } from '@/stores'
 import { useNavigation } from '@mobile/router/navigation'
 import { handleNumberValue } from '@/filters'
-import quoteSocket from '@/services/websocket/quote'
-import { shallowRef, onMounted, onUnmounted, computed, defineAsyncComponent } from 'vue'
+import { shallowRef, onMounted, computed, defineAsyncComponent } from 'vue'
 import { Form, Field, Button, FieldRule, FormInstance, Radio, RadioGroup, Checkbox, CellGroup } from 'vant'
 import { useOrder } from '@/business/trade'
 import { BuyOrSell, getBuyOrSellList, BuildType, getPricemode2List, PriceMode } from '@/constants/order'
 import { fullloading, dialog } from '@/utils/vant'
-import { useRequest } from '@/hooks/request'
-import { queryTradePosition } from '@/services/api/order'
 import AppModal from '@/components/base/modal/index.vue'
 import Stepper from '@mobile/components/base/stepper/index.vue'
 
@@ -164,12 +161,11 @@ const positionStore = usePositionStore()
 const formRef = shallowRef<FormInstance>()
 const { formData, formSubmit } = useOrder()
 
+const quote = futuresStore.getGoodsQuote(props.goodsCode)
 const marketPrice = computed(() => {
     const { ask = 0, bid = 0 } = quote.value ?? {}
     return formData.BuyOrSell === BuyOrSell.Buy ? ask : bid
 })
-const quote = futuresStore.getGoodsQuote(props.goodsCode)
-const subscribe = quoteSocket.createSubscribe()
 const sl = shallowRef(false) // 止损
 const sp = shallowRef(false) // 止盈
 const position = shallowRef<Model.TradePositionRsp[]>([]) // 持仓汇总
@@ -210,7 +206,6 @@ const total = computed(() => {
 
 // 买方向持仓数量
 const buyQty = computed(() => positionStore.getOrderQty(BuyOrSell.Buy, props.goodsCode))
-
 // 卖方向持仓数量
 const sellQty = computed(() => positionStore.getOrderQty(BuyOrSell.Sell, props.goodsCode))
 
@@ -252,20 +247,6 @@ const formRules: { [key in keyof Proto.OrderReq]?: FieldRule[] } = {
     }],
 }
 
-// 获取当前商品持仓汇总
-useRequest(queryTradePosition, {
-    params: {
-        tradeMode: '10'
-    },
-    onSuccess: (res) => {
-        position.value = res.data.filter(item => item.goodscode === props.goodsCode)
-        const datas = position.value.filter(item => formData.BuyOrSell === BuyOrSell.Buy ? item.buyorsell === BuyOrSell.Sell : item.buyorsell === BuyOrSell.Buy) // 反方向持仓
-        if (datas.length > 0) {
-            formData.OrderQty = datas[0].enableqty
-        }
-    },
-})
-
 const onBuyOrSellChanged = () => {
     if (formData.PriceMode === PriceMode.Limit) {
         const { ask = 0, bid = 0 } = quote.value ?? {}
@@ -346,7 +327,6 @@ const closed = (isRefresh = true) => {
 }
 
 onMounted(() => {
-    subscribe.start(props.goodsCode)
     formData.BuyOrSell = props.buyOrSell
     formData.BuildType = BuildType.Open
     formData.PriceMode = PriceMode.Market
@@ -357,8 +337,6 @@ onMounted(() => {
     formData.OrderQty = qtyStep.value
 })
 
-onUnmounted(() => subscribe.stop())
-
 // 暴露组件属性给父组件调用
 defineExpose({
     closed,