Handy_Cao 1 yıl önce
ebeveyn
işleme
0c5b0c585f

+ 13 - 4
src/packages/mobile/views/goods/detail/components/listing/Index.vue

@@ -8,6 +8,14 @@
             <component :is="Forex" v-bind="{ goodsCode, showMore: false }" @price-click="onPriceClick" />
             <Form ref="formRef" class="g-form__container" @submit="onSubmit">
                 <CellGroup inset>
+                    <Field name="BuyOrSell" :rules="formRules.BuyOrSelly" label="方向">
+                        <template #input>
+                            <RadioGroup v-model="direction" direction="horizontal">
+                                <Radio :name="0">买入</Radio>
+                                <Radio :name="1">卖出</Radio>
+                            </RadioGroup>
+                        </template>
+                    </Field>
                     <Field name="OrderPrice" :rules="formRules.OrderPrice" label="价格">
                         <template #input>
                             <Stepper v-model="formData.OrderPrice" theme="round" button-size="22" :min="0"
@@ -28,7 +36,7 @@
                             </div>
                         </template>
                     </Field>
-                    <template v-if="buyOrSell === BuyOrSell.Buy || quote?.tradeproperty !== 2">
+                    <template v-if="direction === BuyOrSell.Buy || quote?.tradeproperty !== 2">
                         <Field label="预估可订立量">
                             <template #input>
                                 <span>{{ total.enableQty }}</span>
@@ -49,7 +57,7 @@
             </Form>
             <template #footer>
                 <div class="g-form__footer">
-                    <template v-if="buyOrSell === BuyOrSell.Buy">
+                    <template v-if="direction === BuyOrSell.Buy">
                         <Button type="danger" block square :disabled="!formData.OrderQty"
                             @click="onBeforeSubmit(EBuildType.BUILDTYPE_OPEN)" v-if="!quote?.iscannotbuy">订立买入</Button>
                         <Button type="primary" block square
@@ -59,7 +67,7 @@
                             <span v-if="sellQty">(≤{{ sellQty }})</span>
                         </Button>
                     </template>
-                    <template v-if="buyOrSell === BuyOrSell.Sell">
+                    <template v-if="direction === BuyOrSell.Sell">
                         <Button type="danger" block square :disabled="!formData.OrderQty"
                             @click="onBeforeSubmit(EBuildType.BUILDTYPE_OPEN)"
                             v-if="!isTrademode16 && !quote?.iscannotsell">订立卖出</Button>
@@ -106,6 +114,7 @@ const accountStore = useAccountStore()
 const futuresStore = useFuturesStore()
 const positionStore = usePositionStore()
 const quote = futuresStore.getGoodsQuote(props.goodsCode)
+const direction = shallowRef(props.buyOrSell)
 
 const { formData, formSubmit } = useOrder()
 const formRef = shallowRef<FormInstance>()
@@ -208,7 +217,7 @@ const onSubmit = () => {
     formData.DelistingType = EDelistingType.DELISTINGTYPE_PRICE
     formData.TimevalidType = EValidType.VALIDTYPE_DR
     formData.OperateType = EOrderOperateType.ORDEROPERATETYPE_NORMAL
-    formData.BuyOrSell = props.buyOrSell
+    formData.BuyOrSell = direction.value
 
     fullloading((hideLoading) => {
         formSubmit().then(() => {

+ 19 - 3
src/packages/mobile/views/order/position/components/goods/close/Index.vue

@@ -32,8 +32,16 @@
                     </Field>
                     <Field name="OrderQty" :rules="formRules.OrderQty" label="转让量">
                         <template #input>
-                            <Stepper v-model="formData.OrderQty" theme="round" button-size="22" :min="0"
-                                :max="selectedRow.enableqty" :auto-fixed="false" integer />
+                            <div class="g-qty-group">
+                                <div class="g-qty-group__stepper">
+                                    <Stepper v-model="formData.OrderQty" theme="round" button-size="22" :min="0"
+                                        :step="qtyStep" :max="selectedRow.enableqty" :auto-fixed="false" integer />
+                                </div>
+                                <RadioGroup v-model="qtyStep" direction="horizontal" @change="onRadioChange">
+                                    <Radio v-for="(value, index) in qtyStepList" :key="index" :name="value">{{ value }}
+                                    </Radio>
+                                </RadioGroup>
+                            </div>
                         </template>
                     </Field>
                 </CellGroup>
@@ -48,13 +56,14 @@
 <script lang="ts" setup>
 import { shallowRef, PropType, onMounted, computed } from 'vue'
 import AppModal from '@/components/base/modal/index.vue'
-import { CellGroup, Cell, Button, FieldRule, Form, Field, Stepper, FormInstance } from 'vant'
+import { CellGroup, Cell, Button, FieldRule, Form, Field, RadioGroup, Radio, FormInstance } from 'vant'
 import { getBuyOrSellName, BuyOrSell } from '@/constants/order'
 import { formatDecimal, handleNumberValue, pow } from '@/filters'
 import { useOrder } from '@/business/trade'
 import { dialog, fullloading } from '@/utils/vant'
 import { useFuturesStore } from '@/stores'
 import { EBuildType, EDelistingType, EListingSelectType, EOrderOperateType, EPriceMode, EValidType } from '@/constants/client'
+import Stepper from '@mobile/components/base/stepper/index.vue'
 
 const props = defineProps({
     selectedRow: {
@@ -72,6 +81,8 @@ const formRef = shallowRef<FormInstance>()
 const showModal = shallowRef(true)
 // 是否刷新父组件数据
 const refresh = shallowRef(false)
+const qtyStepList = [1, 5, 10, 20, 30, 50] // 数量步长列表
+const qtyStep = shallowRef(qtyStepList[0]) // 数量步长
 const { formSubmit, formData } = useOrder()
 
 // 价格步长
@@ -99,6 +110,10 @@ const formRules: { [key: string]: FieldRule[] } = {
     }],
 }
 
+const onRadioChange = (value: number) => {
+    formData.OrderQty = value
+}
+
 const onCloseSumit = () => {
     dialog({
         message: '确认要转让吗?',
@@ -148,6 +163,7 @@ onMounted(() => {
         default:
             formData.OrderPrice = presettle
     }
+    formData.OrderQty = qtyStep.value
 })
 
 // 暴露组件属性给父组件调用