li.shaoyi 2 vuotta sitten
vanhempi
commit
50cba4f6d9

+ 22 - 84
src/business/trade/index.ts

@@ -497,9 +497,6 @@ export function useCancelOrder() {
             return await cancelOrder({
                 data: {
                     ...params,
-                    Header: {
-                        MarketID: marketid
-                    },
                     OldOrderId: orderid
                 }
             })
@@ -534,9 +531,6 @@ export function useHolderClose() {
             loading.value = true
             return await holderClose({
                 data: {
-                    Header: {
-                        MarketID: marketid
-                    },
                     TradeID: tradeid,
                     GoodsID: goodsid,
                     BuyOrSell: buyOrSell,
@@ -555,88 +549,31 @@ export function useHolderClose() {
     }
 }
 
-// 掉期商品摘牌请求
-export function useDelisting() {
-    const loading = shallowRef(false)
-
-    const onSubmit = async (goodsid: number, marketid: number, buyOrSell: EOrderDirection, orderid: string, priceMode: EPriceMode, orderPrice: number, maxSub: number, orderQty: number) => {
-        try {
-            loading.value = true
-            return await order({
-                data: {
-                    ClientSerialNo: v4(),
-                    ClientOrderTime: formatDate(new Date().toString(), 'YYYY-MM-DD HH:mm:ss'),
-                    ClientType: ClientType.Web,
-                    LoginID: loginStore.loginId,
-                    AccountID: accountStore.accountId,
-                    GoodsID: goodsid,
-                    MarketID: marketid,
-                    ValidType: EValidType.VALIDTYPE_DR,
-                    OperateType: EOrderOperateType.ORDEROPERATETYPE_NORMAL,
-                    OrderSrc: OrderSrc.ORDERSRC_CLIENT,
-                    OperatorID: loginStore.loginId,
-                    ListingSelectType: EListingSelectType.LISTINGSELECTTYPE_DELISTING,
-                    DelistingType: EDelistingType.DELISTINGTYPE_SELECTED,
-                    BuyOrSell: buyOrSell === EOrderDirection.BUY ? EOrderDirection.SELL : EOrderDirection.BUY,
-                    BuildType: EBuildType.BUILDTYPE_OPEN,
-                    TimevalidType: 1,
-                    MarketMaxSub: 0.0,
-                    ServiceTime: '',
-                    ValidTime: '',
-                    OrderFlag: 1,
-                    RelatedID: orderid,
-                    PriceMode: priceMode,
-                    CurtQuotePrice: 0.0,
-                    OrderPrice: priceMode === EPriceMode.PRICEMODE_LIMIT ? orderPrice : maxSub,
-                    OrderQty: orderQty,    
-                }
-            })
-        } finally {
-            loading.value = false
-        }
-    }
-
-    return {
-        loading,
-        onSubmit
-    }
-}
-
-// 掉期商品挂牌请求
-export function useListing() {
+// 交易委托
+export function useOrder() {
     const loading = shallowRef(false)
+    const formData = reactive<Partial<Proto.OrderReq>>({
+        ClientSerialNo: v4(),
+        ClientOrderTime: formatDate(new Date().toISOString(), 'YYYY-MM-DD HH:mm:ss'),
+        ClientType: ClientType.Web,
+        LoginID: loginStore.loginId,
+        AccountID: accountStore.accountId,
+        ValidType: EValidType.VALIDTYPE_DR,
+        OperateType: EOrderOperateType.ORDEROPERATETYPE_NORMAL,
+        OrderSrc: OrderSrc.ORDERSRC_CLIENT,
+        OperatorID: loginStore.loginId,
+        ListingSelectType: EListingSelectType.LISTINGSELECTTYPE_DELISTING,
+        DelistingType: EDelistingType.DELISTINGTYPE_SELECTED,
+        BuildType: EBuildType.BUILDTYPE_OPEN,
+        TimevalidType: 1,
+        OrderFlag: 1,
+    })
 
-    const onSubmit = async (goodsid: number, buyOrSell: number, orderid: string, priceMode: EPriceMode, orderPrice: number, maxSub: number, orderQty: number) => {
+    const formSubmit = async () => {
         try {
             loading.value = true
             return await order({
-                data: {
-                    ClientSerialNo: v4(),
-                    ClientOrderTime: formatDate(new Date().toString(), 'YYYY-MM-DD HH:mm:ss'),
-                    ClientType: ClientType.Web,
-                    LoginID: loginStore.loginId,
-                    AccountID: accountStore.accountId,
-                    GoodsID: goodsid,
-                    MarketID: userStore.getMarketId('TRADEMODE_TJMD'),
-                    ValidType: EValidType.VALIDTYPE_DR,
-                    OperateType: EOrderOperateType.ORDEROPERATETYPE_NORMAL,
-                    OrderSrc: OrderSrc.ORDERSRC_CLIENT,
-                    OperatorID: loginStore.loginId,
-                    ListingSelectType: EListingSelectType.LISTINGSELECTTYPE_LISTING,
-                    DelistingType: EDelistingType.DELISTINGTYPE_SELECTED,
-                    BuyOrSell: buyOrSell === 0 ? EOrderDirection.SELL : EOrderDirection.BUY,
-                    BuildType: EBuildType.BUILDTYPE_OPEN,
-                    TimevalidType: 1,
-                    MarketMaxSub: priceMode === EPriceMode.PRICEMODE_LIMIT ? 0.0 : maxSub,
-                    ServiceTime: '',
-                    ValidTime: '',
-                    OrderFlag: 1,
-                    RelatedID: orderid,
-                    PriceMode: priceMode,
-                    CurtQuotePrice: 0.0,
-                    OrderPrice: priceMode === EPriceMode.PRICEMODE_LIMIT ? orderPrice : 0.0,
-                    OrderQty: orderQty,    
-                }
+                data: formData
             })
         } finally {
             loading.value = false
@@ -645,6 +582,7 @@ export function useListing() {
 
     return {
         loading,
-        onSubmit
+        formData,
+        formSubmit
     }
 }

+ 17 - 4
src/packages/mobile/views/presale/detail/components/buy/index.vue

@@ -35,12 +35,14 @@
 </template>
 
 <script lang="ts" setup>
-import { shallowRef, PropType } from 'vue'
+import { shallowRef, PropType, onMounted } from 'vue'
 import { Form, Field, Stepper, Button, FieldRule, FormInstance } from 'vant'
 import { fullloading, dialog } from '@/utils/vant'
 import { useAccountStore } from '@/stores'
-import { useDelisting } from '@/business/trade'
+import { useOrder } from '@/business/trade'
 import AppPopup from '@mobile/components/base/popup/index.vue'
+import { BuyOrSell } from '@/constants/order'
+import { EPriceMode } from '@/constants/client'
 //import AppSelect from '@mobile/components/base/select/index.vue'
 
 const props = defineProps({
@@ -50,7 +52,7 @@ const props = defineProps({
     },
 })
 
-const { formData, formSubmit } = useDelisting(props.detail)
+const { formData, formSubmit } = useOrder()
 const accountStore = useAccountStore()
 const formRef = shallowRef<FormInstance>()
 const refresh = shallowRef(false) // 是否刷新父组件数据
@@ -78,8 +80,15 @@ const closed = (isRefresh = false) => {
     showModal.value = false
 }
 
-// 提交
+// 提交
 const onSubmit = () => {
+    const { applyid, goodsid, marketid } = props.detail
+    formData.GoodsID = goodsid
+    formData.MarketID = marketid
+    formData.BuyOrSell = BuyOrSell.Buy
+    formData.RelatedID = applyid
+    formData.PriceMode = EPriceMode.PRICEMODE_LIMIT
+
     fullloading((hideLoading) => {
         formSubmit().then(() => {
             hideLoading()
@@ -90,6 +99,10 @@ const onSubmit = () => {
     })
 }
 
+onMounted(() => {
+    formData.OrderPrice = props.detail.startprice
+})
+
 // 暴露组件属性给父组件调用
 defineExpose({
     closed,

+ 1 - 1
src/types/model/presale.d.ts

@@ -10,7 +10,7 @@ declare namespace Model {
     /** 查询预售竞拍列表 请求 */
     interface PresaleAuctionsRsp {
         accountid: number; // 卖方账户ID
-        applyid: number; // 关联申请ID
+        applyid: string; // 关联申请ID
         attachmenturl: string; // 缩略图片(1:1)
         bannerpicurl: string; // Banner图(逗号分隔)(2:1)
         buymaxqty: number; // 购买上限 [71] - 0为不限