|
@@ -1,4 +1,4 @@
|
|
|
-import { BuyOrSell } from "@/common/constants/enumCommon";
|
|
|
|
|
|
|
+import { AuctionwrType, BuyOrSell, ListingMode } from '@/common/constants/enumCommon';
|
|
|
import { EnumRouterName } from "@/common/constants/enumRouterName";
|
|
import { EnumRouterName } from "@/common/constants/enumRouterName";
|
|
|
import { queryResultLoadingAndInfo } from "@/common/methods/request/resultInfo";
|
|
import { queryResultLoadingAndInfo } from "@/common/methods/request/resultInfo";
|
|
|
import { getAccountTypeList, getCanUseMoney } from "@/services/bus/account";
|
|
import { getAccountTypeList, getCanUseMoney } from "@/services/bus/account";
|
|
@@ -7,10 +7,12 @@ import { getRules } from '@/services/bus/rules';
|
|
|
import { AccountListItem } from "@/services/dataCenter/interafce/account";
|
|
import { AccountListItem } from "@/services/dataCenter/interafce/account";
|
|
|
import { queryHoldLB, queryWrPosition } from '@/services/go/wrtrade';
|
|
import { queryHoldLB, queryWrPosition } from '@/services/go/wrtrade';
|
|
|
import { QueryWrPositionReq, WrFAProductDetail, WrHoldLB, WrOrderQuote, WrOrderQuoteDetail, WrPosition } from "@/services/go/wrtrade/interface";
|
|
import { QueryWrPositionReq, WrFAProductDetail, WrHoldLB, WrOrderQuote, WrOrderQuoteDetail, WrPosition } from "@/services/go/wrtrade/interface";
|
|
|
|
|
+import { getAuctionwrType, getListingMode } from '@/views/market/market-spot/setup';
|
|
|
import { reactive, Ref, ref, UnwrapRef } from "vue";
|
|
import { reactive, Ref, ref, UnwrapRef } from "vue";
|
|
|
-import { handleIs } from "../../setup";
|
|
|
|
|
import { ListingForm, Wrhold } from "./interface";
|
|
import { ListingForm, Wrhold } from "./interface";
|
|
|
|
|
|
|
|
|
|
+const isBuy = (buyOrSell: BuyOrSell) => buyOrSell === BuyOrSell.buy
|
|
|
|
|
+
|
|
|
export const selecedFinance = ref<WrFAProductDetail>()
|
|
export const selecedFinance = ref<WrFAProductDetail>()
|
|
|
|
|
|
|
|
export function handleForm(data: WrOrderQuoteDetail) {
|
|
export function handleForm(data: WrOrderQuoteDetail) {
|
|
@@ -35,8 +37,7 @@ export function handleForm(data: WrOrderQuoteDetail) {
|
|
|
// 预售仓单汇总
|
|
// 预售仓单汇总
|
|
|
const wrPostion = ref<WrPosition[]>([])
|
|
const wrPostion = ref<WrPosition[]>([])
|
|
|
export function getWrPosition(enumName: EnumRouterName, buyOrSell: BuyOrSell, loading: Ref<boolean>) {
|
|
export function getWrPosition(enumName: EnumRouterName, buyOrSell: BuyOrSell, loading: Ref<boolean>) {
|
|
|
- const { isWR, isBuy } = handleIs(enumName, buyOrSell)
|
|
|
|
|
- if (isBuy() && !isWR()) {
|
|
|
|
|
|
|
+ if (isBuy(buyOrSell) && getAuctionwrType(AuctionwrType.noWr)) {
|
|
|
const param: QueryWrPositionReq = {
|
|
const param: QueryWrPositionReq = {
|
|
|
haswr: 0,
|
|
haswr: 0,
|
|
|
querytype: 2,
|
|
querytype: 2,
|
|
@@ -50,10 +51,9 @@ export function getWrPosition(enumName: EnumRouterName, buyOrSell: BuyOrSell, lo
|
|
|
const allWR = ref<WrHoldLB[]>([])
|
|
const allWR = ref<WrHoldLB[]>([])
|
|
|
// 处理现货仓单
|
|
// 处理现货仓单
|
|
|
export function handleSpotWarrant(enumName: EnumRouterName, buyOrSell: BuyOrSell, selectedRow: WrOrderQuote, loading: Ref<boolean>) {
|
|
export function handleSpotWarrant(enumName: EnumRouterName, buyOrSell: BuyOrSell, selectedRow: WrOrderQuote, loading: Ref<boolean>) {
|
|
|
- const { isWR, isBuy } = handleIs(enumName, buyOrSell)
|
|
|
|
|
const wrHoldList = ref<Wrhold[]>([])
|
|
const wrHoldList = ref<Wrhold[]>([])
|
|
|
- if (isBuy()) {
|
|
|
|
|
- if (isWR()) {
|
|
|
|
|
|
|
+ if (isBuy(buyOrSell)) {
|
|
|
|
|
+ if (getAuctionwrType(AuctionwrType.hasWr)) {
|
|
|
queryResultLoadingAndInfo(queryHoldLB, loading).then(res => {
|
|
queryResultLoadingAndInfo(queryHoldLB, loading).then(res => {
|
|
|
allWR.value = res;
|
|
allWR.value = res;
|
|
|
wrHoldList.value.length = 0
|
|
wrHoldList.value.length = 0
|
|
@@ -70,25 +70,7 @@ export function handleSpotWarrant(enumName: EnumRouterName, buyOrSell: BuyOrSell
|
|
|
return { wrHoldList }
|
|
return { wrHoldList }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// // 处理现货仓单
|
|
|
|
|
-// export function handleSpotWarrant(enumName: EnumRouterName, buyOrSell: BuyOrSell, selectedRow: WrOrderQuote, loading: Ref<boolean>) {
|
|
|
|
|
-// const { isWR, isBuy } = handleIs(enumName, buyOrSell)
|
|
|
|
|
-// const wrHoldList = ref<Wrhold[]>([])
|
|
|
|
|
-// if (isBuy()) {
|
|
|
|
|
-// if (isWR()) {
|
|
|
|
|
-// queryResultLoadingAndInfo(queryHoldLB, loading).then(res => {
|
|
|
|
|
-// wrHoldList.value = res.filter((e: WrHoldLB) => e.wrfactortypeid === String(selectedRow.wrfactortypeid)).map((e: WrHoldLB) => {
|
|
|
|
|
-// const { wrholdeno, enableqty, ladingbillid } = e
|
|
|
|
|
-// return { id: ladingbillid, name: `${wrholdeno}(${enableqty})` }
|
|
|
|
|
-// })
|
|
|
|
|
-// })
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// return { wrHoldList }
|
|
|
|
|
-// }
|
|
|
|
|
-
|
|
|
|
|
export function handleNumAndMoney(enumName: EnumRouterName, buyOrSell: BuyOrSell, selectedRow: WrOrderQuoteDetail, parantSelectedRow: WrOrderQuote, formState: UnwrapRef<ListingForm>) {
|
|
export function handleNumAndMoney(enumName: EnumRouterName, buyOrSell: BuyOrSell, selectedRow: WrOrderQuoteDetail, parantSelectedRow: WrOrderQuote, formState: UnwrapRef<ListingForm>) {
|
|
|
- const { isWR, isBuy, isFloat } = handleIs(enumName, buyOrSell)
|
|
|
|
|
// 资金账号
|
|
// 资金账号
|
|
|
const accountList = getAccountTypeList([2]);
|
|
const accountList = getAccountTypeList([2]);
|
|
|
// 获取选中的资金账号
|
|
// 获取选中的资金账号
|
|
@@ -107,8 +89,8 @@ export function handleNumAndMoney(enumName: EnumRouterName, buyOrSell: BuyOrSell
|
|
|
if (hasRule()) {
|
|
if (hasRule()) {
|
|
|
// 可用资金
|
|
// 可用资金
|
|
|
const canUseMoney = Number(getCanUseMoney(getSelectedAccount() as AccountListItem))
|
|
const canUseMoney = Number(getCanUseMoney(getSelectedAccount() as AccountListItem))
|
|
|
- if (!isBuy()) {
|
|
|
|
|
- if (isFloat()) {
|
|
|
|
|
|
|
+ if (!isBuy(buyOrSell)) {
|
|
|
|
|
+ if (getListingMode(ListingMode.float)) {
|
|
|
const goodsPrice = getQuoteDayInfoByCodeFindPrice(parantSelectedRow.goodscode);
|
|
const goodsPrice = getQuoteDayInfoByCodeFindPrice(parantSelectedRow.goodscode);
|
|
|
// 估算总价=挂牌基差+期货合约价;
|
|
// 估算总价=挂牌基差+期货合约价;
|
|
|
if (goodsPrice && goodsPrice !== '--' && pricemove !== null) { // 有实时行情价格
|
|
if (goodsPrice && goodsPrice !== '--' && pricemove !== null) { // 有实时行情价格
|
|
@@ -126,7 +108,7 @@ export function handleNumAndMoney(enumName: EnumRouterName, buyOrSell: BuyOrSell
|
|
|
result = Math.min(orderqty, canUseMoney / marginMoney)
|
|
result = Math.min(orderqty, canUseMoney / marginMoney)
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
- if (isWR()) {
|
|
|
|
|
|
|
+ if (getAuctionwrType(AuctionwrType.hasWr)) {
|
|
|
if (formState.LadingBillId) {
|
|
if (formState.LadingBillId) {
|
|
|
// 现货库存数量
|
|
// 现货库存数量
|
|
|
const warehouseNum = allWR.value.find((e) => e.ladingbillid === formState.LadingBillId)?.enableqty;
|
|
const warehouseNum = allWR.value.find((e) => e.ladingbillid === formState.LadingBillId)?.enableqty;
|
|
@@ -149,7 +131,7 @@ export function handleNumAndMoney(enumName: EnumRouterName, buyOrSell: BuyOrSell
|
|
|
// 摘牌金额
|
|
// 摘牌金额
|
|
|
function getMoney() {
|
|
function getMoney() {
|
|
|
let result = 0
|
|
let result = 0
|
|
|
- if (isFloat()) {
|
|
|
|
|
|
|
+ if (getListingMode(ListingMode.float)) {
|
|
|
const goodsPrice = getQuoteDayInfoByCodeFindPrice(parantSelectedRow.goodscode);
|
|
const goodsPrice = getQuoteDayInfoByCodeFindPrice(parantSelectedRow.goodscode);
|
|
|
const agreeunit = getGoodsAgreeunitByGoodsCode(parantSelectedRow.goodscode);
|
|
const agreeunit = getGoodsAgreeunitByGoodsCode(parantSelectedRow.goodscode);
|
|
|
if (goodsPrice && goodsPrice !== '--') { // 有实时行情价格
|
|
if (goodsPrice && goodsPrice !== '--') { // 有实时行情价格
|