Handy_Cao 1 gadu atpakaļ
vecāks
revīzija
52b555143f

+ 3 - 3
public/locales/zh-CN.json

@@ -281,7 +281,7 @@
             "username": "挂牌方",
             "orderqty": "数量",
             "orderprice": "价格",
-            "marketmaxsub": "点差",
+            "marketmaxsub": "点差范围",
             "orderqty1": "挂牌量",
             "orderqty2": "摘牌量",
             "orderprice1": "挂牌价格",
@@ -321,14 +321,14 @@
             "buyorsell": "方向",
             "pricemode": "方式",
             "orderqty": "数量",
-            "marketmaxsub": "点差",
+            "marketmaxsub": "点差范围",
             "price": "价格",
             "enableQty": "预估可订立量",
             "deposit": "预扣保证金",
             "avaiableMoney": "可用资金",
             "tips1": "请输入数量",
             "tips2": "请输入价格",
-            "tips3": "请输入点差"
+            "tips3": "请输入点差范围"
         },
         "spot": {
             "title": "挂牌详情",

+ 2 - 1
src/packages/mobile/views/order/position/Index.vue

@@ -12,7 +12,7 @@
         <Tabs class="van-tabs--list" v-model:active="active" :swipe-threshold="4">
             <template v-for="(item, index) in components" :key="index">
                 <Tab :title="item.title" :name="index">
-                    <component :is="item.component" v-bind="{ fromTrade }" />
+                    <component :is="item.component" v-bind="{ fromTrade, goodsCode }" />
                 </Tab>
             </template>
         </Tabs>
@@ -29,6 +29,7 @@ import { i18n } from '@/stores'
 
 const { global: { t } } = i18n
 const fromTrade = false
+const goodsCode = ''
 
 const components = [
     {

+ 14 - 3
src/packages/mobile/views/order/position/components/pricing/list/Index.vue

@@ -66,17 +66,28 @@ const { router } = useNavigation()
 const positionStore = usePositionStore()
 const pullRefreshRef = shallowRef()
 
-const positionList = computed(() => positionStore.getPositionListByTradeMode(10))
+const positionList = computed(() => {
+    const list = positionStore.getPositionListByTradeMode(10)
+    /// 数据过滤
+    if (props.goodsCode != '') {
+        return list.filter(e => e.goodscode === props.goodsCode)
+    }
+    return list
+})
 
 const emit = defineEmits(['callBack'])
 const callBack = (item: Model.TradePositionRsp) => {
-    emit('callBack', 1, item.buyorsell)
+    emit('callBack', 1, item.buyorsell, '')
 }
 
-defineProps({
+const props = defineProps({
     fromTrade: {
         type: Boolean,
         required: true
+    },
+    goodsCode: {
+        type: String,
+        required: true
     }
 })
 

+ 8 - 7
src/packages/mobile/views/pricing/trade/Index.vue

@@ -64,8 +64,7 @@
                 <!-- 允许成交范围 -->
                 <Field name="MarketMaxSub" :rules="formRules.MarketMaxSub" :label="$t('quote.pricing.marketmaxsub')" v-if="formData.PriceMode === PriceMode.Market">
                     <template #input>
-                        <Stepper v-model="formData.MarketMaxSub" theme="round" button-size="22" :auto-fixed="false"
-                            integer />
+                        <Stepper v-model="formData.MarketMaxSub" :min="0" :max="999" theme="round" button-size="22" :auto-fixed="false" integer />
                     </template>
                 </Field>
                 <!-- 限价 -->
@@ -140,8 +139,7 @@
         <Tabs class="van-tabs--list" v-model:active="active">
             <template v-for="(item, index) in components" :key="index">
                 <Tab :title="item.title" :name="item.name">
-                    <component :is="item.component" v-bind="{ goodsCode, goodsid, fromTrade }" 
-                        @callBack="itemBack"/>
+                    <component :is="item.component" v-bind="{ goodsCode, goodsid, fromTrade }" @callBack="itemBack"/>
                 </Tab>
             </template>
         </Tabs>
@@ -273,11 +271,14 @@ const formRules: { [key in keyof Proto.OrderReq]?: FieldRule[] } = {
     // 限价
     MarketMaxSub: [{
         message: t('quote.pricing.tips3'),
-        validator: () => {
+        validator: (val) => {
             if (formData.PriceMode === PriceMode.Market) {
-                return !!formData.MarketMaxSub
+                if (val < 0) {
+                    return t('quote.pricing.tips3')
+                }
+                return true
             }
-            return true
+            return !!formData.MarketMaxSub
         }
     }],
     // 限价

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

@@ -30,7 +30,7 @@
                 <template #input>
                     <div class="g-qty-group__stepper">
                         <Stepper v-model="formData.MarketMaxSub" theme="round" :max="maxspread" :min="minspread" button-size="22" :auto-fixed="true"
-                        :step="0.01" @change="calculateListingAmount"/>
+                        :step="0.01" @change="calculateListingAmount" integer/>
                     </div>
                 </template>
             </Field>

+ 32 - 16
src/packages/pc/views/footer/goods/position/components/transfer/index.vue

@@ -28,19 +28,17 @@
                     {{ formatDecimal(selectedRow.closepl, selectedRow.decimalplace) }}
                 </span>
             </el-form-item>
-            <el-form-item prop="OrderQty" :label="t('position.goods.qty')">
-                <div class="g-qty-group">
-                    <el-input-number :placeholder="t('position.goods.tips2')" v-model="formData.OrderQty" :precision="0"
-                        :max="selectedRow.enableqty" :min="0" />
-                    <el-radio-group size="small" v-model="qtyStep" @change="onRadioChange">
-                        <el-radio v-for="(value, index) in qtyStepList" :key="index" :label="value" border
-                            style="width: 25%;">
-                            {{ parsePercent(value, 0) }}
-                        </el-radio>
-                    </el-radio-group>
-                </div>
+            <el-form-item prop="PriceMode" :label="t('quote.pricing.pricemode')">
+                <el-radio-group v-model="formData.PriceMode">
+                    <el-radio v-for="(item, index) in getPricemode2List()" :key="index" :label="item.value">
+                        {{ item.label }}
+                    </el-radio>
+                </el-radio-group>
             </el-form-item>
-            <el-form-item prop="OrderPrice" :label="t('position.goods.transferprice')">
+            <el-form-item prop="MarketMaxSub" :label="t('quote.pricing.marketmaxsub')" v-if="formData.PriceMode === PriceMode.Market">
+                    <el-input-number ref="priceRef" :placeholder="t('common.pleaseenter')" :min="0" :max="999" v-model="formData.MarketMaxSub" integer/>
+                </el-form-item>
+            <el-form-item prop="OrderPrice" :label="t('position.goods.transferprice')" v-if="formData.PriceMode === PriceMode.Limit">
                 <div class="el-form-item--col">
                     <el-input-number :placeholder="t('position.goods.tips1')" v-model="formData.OrderPrice" :step="quote?.decimalvalue"
                     :precision="quote?.decimalplace" />
@@ -56,6 +54,18 @@
                     </div>
                 </div>
             </el-form-item>
+            <el-form-item prop="OrderQty" :label="t('position.goods.qty')">
+                <div class="g-qty-group">
+                    <el-input-number :placeholder="t('position.goods.tips2')" v-model="formData.OrderQty" :precision="0"
+                        :max="selectedRow.enableqty" :min="0" />
+                    <el-radio-group size="small" v-model="qtyStep" @change="onRadioChange">
+                        <el-radio v-for="(value, index) in qtyStepList" :key="index" :label="value" border
+                            style="width: 25%;">
+                            {{ parsePercent(value, 0) }}
+                        </el-radio>
+                    </el-radio-group>
+                </div>
+            </el-form-item>
         </el-form>
         <template #footer>
             <el-button type="info" @click="onCancel(false)">{{ t('operation.cancel') }}</el-button>
@@ -65,13 +75,13 @@
 </template>
 
 <script lang="ts" setup>
-import { ref, PropType, onMounted } from 'vue'
+import { ref, PropType, onMounted, computed } from 'vue'
 import { ElMessage, FormInstance, FormRules } from 'element-plus'
 import { useOrder } from '@/business/trade'
 import { formatDecimal, parsePercent } from '@/filters'
-import { getBuyOrSellName, BuyOrSell } from '@/constants/order'
+import { getBuyOrSellName, BuyOrSell, getPricemode2List, PriceMode } from '@/constants/order'
 import { useFuturesStore, i18n } from '@/stores'
-import { EBuildType, EDelistingType, EListingSelectType, EOrderOperateType, EPriceMode, EValidType } from '@/constants/client'
+import { EBuildType, EDelistingType, EListingSelectType, EOrderOperateType, EValidType } from '@/constants/client'
 import Icon from '@pc/components/base/icon/index.vue'
 import AppDrawer from '@pc/components/base/drawer/index.vue'
 
@@ -115,14 +125,19 @@ const onCancel = (isRefresh = false) => {
     refresh.value = isRefresh
 }
 
+const marketPrice = computed(() => {
+    const { ask = 0, bid = 0 } = quote.value ?? {}
+    return formData.BuyOrSell === BuyOrSell.Buy ? ask : bid
+})
+
 const onCloseSumit = () => {
     formRef.value?.validate((valid) => {
         if (valid) {
             const { marketid, goodsid, buyorsell } = props.selectedRow
             /// 市场ID
             formData.Header = { GoodsID: goodsid }
+            if (formData.PriceMode === PriceMode.Market) { formData.OrderPrice = marketPrice.value }
             formData.MarketID = marketid
-            formData.PriceMode = EPriceMode.PRICEMODE_LIMIT
             formData.BuyOrSell = buyorsell === BuyOrSell.Buy ? BuyOrSell.Sell : BuyOrSell.Buy
             formData.GoodsID = goodsid
             formData.ListingSelectType = EListingSelectType.LISTINGSELECTTYPE_DELISTINGTHENLISTING
@@ -157,6 +172,7 @@ onMounted(() => {
         default:
             formData.OrderPrice = last || presettle
     }
+    formData.PriceMode = PriceMode.Market
     formData.OrderQty = props.selectedRow.enableqty
 })
 </script>

+ 2 - 2
src/packages/pc/views/market/trade/pricing/list/listing/index.vue

@@ -46,8 +46,8 @@
                     </div>
                 </el-form-item>
                 <el-form-item prop="MarketMaxSub" :label="t('quote.pricing.marketmaxsub')" v-if="formData.PriceMode === PriceMode.Market">
-                    <el-input-number ref="priceRef" :placeholder="t('common.pleaseenter')" :min="0" :max="9999999999" v-model="formData.MarketMaxSub" 
-                    @keyup.enter="submitFocus" integer />
+                    <el-input-number ref="priceRef" :placeholder="t('common.pleaseenter')" :min="0" :max="999" v-model="formData.MarketMaxSub" 
+                    @keyup.enter="submitFocus" />
                 </el-form-item>
                 <el-form-item prop="OrderPrice" :label="t('quote.pricing.price')" v-if="formData.PriceMode === PriceMode.Limit">
                     <el-input-number ref="priceRef" :placeholder="t('common.pleaseenter')" :max="9999999999" :min="0" v-model="formData.OrderPrice" 

+ 1 - 1
src/packages/pc/views/market/trade/swap/detail/listing/index.vue

@@ -21,7 +21,7 @@
             </el-form-item>
             <el-form-item v-if="priceMove === 3" prop="MarketMaxSub" label="点差">
                 <el-input-number :placeholder="t('common.pleaseenter')" :min="minspread" :max="maxspread" :precision="2"
-                    v-model="formData.MarketMaxSub" @change="calculateListingAmount" />
+                    v-model="formData.MarketMaxSub" @change="calculateListingAmount" integer />
             </el-form-item>
             <el-form-item prop="OrderQty" label="挂牌量">
                 <div class="g-qty-group">