Bladeren bron

Merge branch 'v20' of http://47.101.159.18:3000/Muchinfo/MTP20_WEB_GLOBAL into v20

li.shaoyi 2 jaren geleden
bovenliggende
commit
c6585a7d26

+ 40 - 52
src/packages/mobile/views/swap/detail/components/delisting/Index.vue

@@ -11,6 +11,11 @@
                     <span>{{ selectedRow.username }}</span>
                 </template>
             </Field>
+            <Field label="挂牌方向">
+                <template #input>
+                    <span>{{ getBuyOrSellName(selectedRow.buyorsell) }}</span>
+                </template>
+            </Field>
             <Field label="价格类型">
                 <template #input>
                     <RadioGroup v-model="priceMove" direction='horizontal'>
@@ -19,7 +24,7 @@
                     </RadioGroup>
                 </template>
             </Field>
-            <Field label="当前价格" v-if="priceMove === 2">
+            <Field label="挂牌价格" v-if="priceMove === 2">
                 <template #input>
                     <span>{{ selectedRow.orderprice }}</span>
                 </template>
@@ -29,7 +34,10 @@
                     <span>{{ selectedRow.orderqty }}</span>
                 </template>
             </Field>
-            <Field name="OrderQty" :rules="formRules.OrderQty" label="挂牌数量">
+            <el-form-item v-if="priceMove === 3" prop="OrderPrice" label="摘牌价格">
+                <el-input-number placeholder="请输入" :min="0" :step="Math.pow(10, -1*(goods?.decimalplace ?? 0))" :precision="(goods?.decimalplace ?? 2)" v-model="formData.OrderPrice" @change="calculateDelistingAmount"/>
+            </el-form-item>
+            <Field name="OrderQty" :rules="formRules.OrderQty" label="摘牌数量">
                 <template #input>
                     <div class="g-qty-group">
                         <div class="g-qty-group__stepper">
@@ -60,7 +68,7 @@
             </Field>
         </Form>
         <template #footer>
-            <Button type="danger" block round @click="formRef?.submit">{{ tabIndex === 0 ? '卖出' : '买入' }}</Button>
+            <Button type="danger" block round @click="formRef?.submit">摘牌</Button>
         </template>
     </app-popup>
 </template>
@@ -72,7 +80,7 @@ import { handleRequestBigNumber } from '@/filters'
 import { useAccountStore, useFuturesStore } from '@/stores'
 import { EBuildType, EDelistingType, EListingSelectType, EOrderOperateType, EPriceMode, EValidType } from '@/constants/client'
 import { useOrder } from '@/business/trade'
-import { BuyOrSell } from '@/constants/order'
+import { BuyOrSell, getBuyOrSellName } from '@/constants/order'
 import { fullloading, dialog } from '@/utils/vant'
 import { useRequest } from '@/hooks/request'
 import { queryTjmdTodayAccountMargin } from '@/services/api/swap'
@@ -81,20 +89,6 @@ import AppPopup from '@mobile/components/base/popup/index.vue'
 const accountStore = useAccountStore()
 const futuresStore = useFuturesStore()
 const { formData, formSubmit } = useOrder()
-// 数量步长列表
-const qtyStepList = [1, 5, 10, 20, 30, 50]
-// 数量步长
-const qtyStep = shallowRef(qtyStepList[0]) 
-/// 挂牌金额
-const amount = shallowRef(0.0)
-/// 履约保证金
-const permargin = shallowRef(0.0)
-/// 价格类型
-const priceMove = shallowRef(EPriceMode.PRICEMODE_LIMIT)
-/// 保证金配置
-const margin = shallowRef<Model.TjmdTodayAccountMarginRsp>()
-/// 商品信息
-const goods = computed(() => futuresStore.getGoods(props.selectedRow.goodsid) ) 
 
 const props = defineProps({
     selectedRow: {
@@ -104,10 +98,6 @@ const props = defineProps({
     item: {
         type: Object as PropType<Model.QuoteGoodsListRsp>,
         required: true
-    },
-    tabIndex: {
-        type: Number,
-        required: true
     }
 })
 
@@ -115,18 +105,29 @@ 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 amount = shallowRef(0.0)
+/// 履约保证金
+const permargin = shallowRef(0.0)
+/// 价格类型
+const priceMove = shallowRef(props.selectedRow.pricemode)
+/// 保证金配置
+const margin = shallowRef<Model.TjmdTodayAccountMarginRsp>()
+/// 商品信息
+const goods = computed(() => futuresStore.getGoods(props.selectedRow.goodsid) ) 
+/// 默认价格为挂牌价格
+formData.OrderPrice = props.selectedRow.orderprice ?? 0.0
+
 // 表单验证规则
 const formRules: { [key in keyof Proto.OrderReq]?: FieldRule[] } = {
     OrderPrice: [{
-        message: '请输入价格',
-        validator: (val) => {
-            if (val) {
-                if (priceMove.value === EPriceMode.PRICEMODE_LIMIT) {
-                    return true
-                }
-                return '请输入挂牌价格'
-            }
-            return false
+        message: '请输入摘牌价格',
+        validator: () => {
+            return !!formData.OrderPrice
         }
     }],
     OrderQty: [{
@@ -135,18 +136,6 @@ const formRules: { [key in keyof Proto.OrderReq]?: FieldRule[] } = {
             return !!formData.OrderQty
         }
     }],
-    MarketMaxSub: [{
-        message: '请输入基差',
-        validator: (val) => {
-            if (val) {
-                if (priceMove.value === EPriceMode.PRICEMODE_FLOAT) {
-                    return !!formData.MarketMaxSub
-                }
-                return '请输入挂牌基差'
-            }
-            return false
-        }
-    }],
 }
 
 const onRadioChange = (value: number) => {
@@ -177,28 +166,27 @@ const calculateDelistingAmount = () => {
     if (margin.value?.infoc) {
         const { MarginAlgorithm, MarketMarginValue } = margin.value?.infoc
         const { OrderQty = 0 } = formData
-        const { orderprice } = props.selectedRow
+        const { OrderPrice = 0.0 } = formData
         const { agreeunit = 0 } = goods.value ?? {}
         /// 按比例
         if (MarginAlgorithm === 1) {
-            permargin.value = orderprice*OrderQty*agreeunit*MarketMarginValue
+            permargin.value = OrderPrice*OrderQty*agreeunit*MarketMarginValue
         } else {
-            permargin.value = OrderQty*MarketMarginValue
+            permargin.value = OrderPrice*MarketMarginValue
         }
-        amount.value = OrderQty*orderprice*agreeunit
+        amount.value = OrderQty*OrderPrice*agreeunit
     }
 }
 
-// 提交
+// 提交
 const onSubmit = () => {
-    const { goodsid, orderid, orderprice, buyorsell } = props.selectedRow
+    const { goodsid, orderid, buyorsell } = props.selectedRow
     const { marketid = 0 } = goods.value ?? {}
 
     /// 获取对应的市场ID
     formData.MarketID = marketid
-    formData.PriceMode = EPriceMode.PRICEMODE_LIMIT
+    formData.PriceMode = priceMove.value === EPriceMode.PRICEMODE_LIMIT ? EPriceMode.PRICEMODE_LIMIT : EPriceMode.PRICEMODE_MARKET
     formData.RelatedID = handleRequestBigNumber(orderid)
-    formData.OrderPrice = orderprice
     formData.BuyOrSell = buyorsell === BuyOrSell.Buy ? BuyOrSell.Sell : BuyOrSell.Buy
     formData.GoodsID = goodsid
     formData.ListingSelectType = EListingSelectType.LISTINGSELECTTYPE_DELISTING
@@ -210,7 +198,7 @@ const onSubmit = () => {
     fullloading((hideLoading) => {
         formSubmit().then(() => {
             hideLoading()
-            dialog('挂牌提交成功。').then(() => closed(true))
+            dialog('提交成功。').then(() => closed(true))
         }).catch((err) => {
             hideLoading(err, 'fail')
         })

+ 0 - 10
src/packages/pc/views/market/trade/swap/detail/index.vue

@@ -13,16 +13,6 @@
                             <span>{{ selectedRow?.goodsname }}</span>
                         </li>
                     </ul>
-                    <ul class="datainfo" v-if="selectedRow">
-                        <li>
-                            <span>卖量:</span>
-                            <span>{{ selectedRow?.sellqty }}</span>
-                        </li>
-                        <li>
-                            <span>买量:</span>
-                            <span>{{ selectedRow?.buyqty }}</span>
-                        </li>
-                    </ul>
                     <div class="buttonbar">
                         <template v-if="market">
                             <span style="color: #3a87f7;padding:0 10px;">

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

@@ -15,7 +15,7 @@
                 </el-radio-group>
             </el-form-item>
             <el-form-item v-if="priceMove === 2" prop="OrderPrice" label="挂牌价格">
-                <el-input-number placeholder="请输入" :min="0" :precision="2" v-model="formData.OrderPrice" @change="calculateListingAmount"/>
+                <el-input-number placeholder="请输入" :min="0" :step="Math.pow(10, -1*(goods?.decimalplace ?? 0))" :precision="(goods?.decimalplace ?? 2)" v-model="formData.OrderPrice" @change="calculateListingAmount"/>
             </el-form-item>
             <el-form-item v-if="priceMove === 3" prop="MarketMaxSub" label="点差">
                 <el-input-number placeholder="请输入" :min="minBasis" :maxBasis="maxBasis" :precision="2" v-model="formData.MarketMaxSub" @change="calculateListingAmount" />
@@ -166,7 +166,7 @@ const formRules: FormRules = {
             if (value) {
                 callback()
             } else {
-                callback(new Error('请输入差'))
+                callback(new Error('请输入差'))
             }
         }
     }],
@@ -238,10 +238,7 @@ const onCancel = (isRefresh = false) => {
 const onSubmit = () => {
     formRef.value?.validate((valid) => {
         if (valid) {
-            ElMessageBox.confirm(
-                '*若存在价格匹配的反方向委托订单,系统将会自动撤销。',
-                '是否立即挂牌?'
-            ).then(() => {
+            ElMessageBox.confirm('是否立即挂牌?').then(() => {
                 /// 买卖方向
                 const { goodsid } = props.quoteGoods?? {}
                 /// 获取对应的市场ID

+ 36 - 19
src/packages/pc/views/market/trade/swap/detail/order/delisting/index.vue

@@ -14,16 +14,15 @@
                     <el-radio :label="3" v-if="selectedRow.pricemode === 3">浮动价</el-radio>
                 </el-radio-group>
             </el-form-item>
+            <el-form-item label="挂牌方向">
+                <span>{{ getBuyOrSellName(selectedRow.buyorsell) }}</span>
+            </el-form-item>
             <el-form-item label="挂牌价格">
                 <span>{{ selectedRow.orderprice }}</span>
             </el-form-item>
-            
             <el-form-item label="可摘数量">
                 <span>{{ selectedRow.orderqty }}</span>
             </el-form-item>
-            <el-form-item label="估算价格" v-if="priceMove === 3">
-                <span>0.0</span>
-            </el-form-item>
             <el-form-item label="挂牌金额" v-if="priceMove === 2">
                 <span>{{ amount.toFixed(2) }}</span>
             </el-form-item>
@@ -36,10 +35,13 @@
             <el-form-item label="可用资金">
                 <span>{{ accountStore.currentAccount.avaiableMoney?.toFixed(2) }}</span>
             </el-form-item>
+            <el-form-item v-if="priceMove === 3" prop="OrderPrice" label="摘牌价格">
+                <el-input-number placeholder="请输入" :min="0" :step="Math.pow(10, -1*(goods?.decimalplace ?? 0))" :precision="(goods?.decimalplace ?? 2)" v-model="formData.OrderPrice" @change="calculateDelistingAmount"/>
+            </el-form-item>
             <el-form-item prop="OrderQty" label="摘牌数量">
                 <div class="g-qty-group">
-                    <el-input-number placeholder="请输入" :disabled="userStore.userType === 5" :min="0" :max="selectedRow.orderqty" :precision="0" :step="qtyStep"
-                        v-model="formData.OrderQty" />
+                    <el-input-number placeholder="请输入" :min="0" :max="selectedRow.orderqty" :precision="0" :step="qtyStep"
+                        v-model="formData.OrderQty" @change="calculateDelistingAmount"/>
                     <el-radio-group size="small" v-model="qtyStep" @change="onRadioChange" v-if="userStore.userType === 5">
                         <el-radio v-for="(value, index) in qtyStepList" :key="index" :label="value" border />
                     </el-radio-group>
@@ -59,7 +61,7 @@ import { shallowRef, PropType, computed } from 'vue'
 import { ElMessage, FormInstance, FormRules, ElMessageBox } from 'element-plus'
 import { handleRequestBigNumber } from '@/filters'
 import { EBuildType, EDelistingType, EListingSelectType, EOrderOperateType, EPriceMode, EValidType } from '@/constants/client'
-import { BuyOrSell } from '@/constants/order'
+import { BuyOrSell, getBuyOrSellName } from '@/constants/order'
 import { useOrder } from '@/business/trade'
 import { useRequest } from '@/hooks/request'
 import { queryTjmdTodayAccountMargin } from '@/services/api/swap'
@@ -80,25 +82,29 @@ const props = defineProps({
 const accountStore = useAccountStore()
 const userStore = useUserStore()
 
-
 /// 价格类型
-const priceMove = shallowRef(EPriceMode.PRICEMODE_LIMIT)
+const priceMove = shallowRef(props.selectedRow.pricemode)
 /// 挂牌金额
 const amount = shallowRef(0.0)
 /// 履约保证金
 const permargin = shallowRef(0.0)
 
 const { formData, formSubmit, loading } = useOrder()
+
 const futuresStore = useFuturesStore()
 const show = shallowRef(true)
 const refresh = shallowRef(false)
 const formRef = shallowRef<FormInstance>()
-const qtyStepList = [1, 5, 10, 20, 30, 50] // 数量步长列表
-const qtyStep = shallowRef(qtyStepList[0]) // 数量步长
+// 数量步长列表
+const qtyStepList = [1, 5, 10, 20, 30, 50] 
+// 数量步长
+const qtyStep = shallowRef(qtyStepList[0]) 
 /// 保证金配置
 const margin = shallowRef<Model.TjmdTodayAccountMarginRsp>()
 /// 商品信息
 const goods = computed(() => futuresStore.getGoods(props.selectedRow.goodsid) ) 
+/// 默认价格为挂牌价格
+formData.OrderPrice = props.selectedRow.orderprice ?? 0.0
 
 /// 查询交易保证金信息
 useRequest(queryTjmdTodayAccountMargin, {
@@ -122,15 +128,17 @@ const calculateDelistingAmount = () => {
     if (margin.value?.infoc) {
         const { MarginAlgorithm, MarketMarginValue } = margin.value?.infoc
         const { OrderQty = 0 } = formData
-        const { orderprice } = props.selectedRow
+        const { OrderPrice = 0.0 } = formData
         const { agreeunit = 0 } = goods.value ?? {}
         /// 按比例
         if (MarginAlgorithm === 1) {
-            permargin.value = orderprice*OrderQty*agreeunit*MarketMarginValue
+            /// 价格*数量*合约单位*保证金比例
+            permargin.value = OrderPrice*OrderQty*agreeunit*MarketMarginValue
         } else {
+            /// 数量*保证金值
             permargin.value = OrderQty*MarketMarginValue
         }
-        amount.value = OrderQty*orderprice*agreeunit
+        amount.value = OrderQty*OrderPrice*agreeunit
     }
 }
 
@@ -145,6 +153,16 @@ const formRules: FormRules = {
             }
         }
     }],
+    OrderPrice: [{
+        required: true,
+        validator: (rule, value, callback) => {
+            if (value) {
+                callback()
+            } else {
+                callback(new Error('请输入摘牌价格'))
+            }
+        }
+    }],
 }
 
 const onRadioChange = (value: number) => {
@@ -162,17 +180,15 @@ const onSubmit = (buildType: number) => {
     formRef.value?.validate((valid) => {
         if (valid) {
             ElMessageBox.confirm(
-                '*若存在价格匹配的反方向委托订单,系统将会自动撤销。',
                 '是否立即摘牌?'
             ).then(() => {
-                const { goodsid, orderid, orderprice, buyorsell } = props.selectedRow
+                const { goodsid, orderid, buyorsell } = props.selectedRow
                 const { marketid = 0 } = goods.value ?? {}
 
                 /// 获取对应的市场ID
                 formData.MarketID = marketid
-                formData.PriceMode = EPriceMode.PRICEMODE_LIMIT
+                formData.PriceMode = priceMove.value === EPriceMode.PRICEMODE_LIMIT ? EPriceMode.PRICEMODE_LIMIT : EPriceMode.PRICEMODE_MARKET
                 formData.RelatedID = handleRequestBigNumber(orderid)
-                formData.OrderPrice = orderprice
                 formData.BuyOrSell = buyorsell === BuyOrSell.Buy ? BuyOrSell.Sell : BuyOrSell.Buy
                 formData.GoodsID = goodsid
                 formData.ListingSelectType = EListingSelectType.LISTINGSELECTTYPE_DELISTING
@@ -180,7 +196,8 @@ const onSubmit = (buildType: number) => {
                 formData.BuildType = buildType
                 formData.TimevalidType = EValidType.VALIDTYPE_DR
                 formData.OperateType = EOrderOperateType.ORDEROPERATETYPE_NORMAL
-
+                formData.MarketMaxSub = priceMove.value === EPriceMode.PRICEMODE_LIMIT ? 0.0 : formData.MarketMaxSub
+                
                 formSubmit().then(() => {
                     ElMessage.success('提交成功')
                     onCancel(true)

+ 1 - 1
src/packages/qdhs/views/home/Index.vue

@@ -1,5 +1,5 @@
 <template>
-  <LayoutHome :tabs="tabList" />
+  <LayoutHome :tabs="tabList" ios-update-url="https://itunes.apple.com/lookup?id=6468948889"/>
 </template>
 
 <script lang="ts" setup>