|
|
@@ -187,7 +187,7 @@ export default defineComponent({
|
|
|
queryTable(queryTradePosition);
|
|
|
|
|
|
// 获取保证金比例
|
|
|
- const { getReckonMarginValueByTradeMode } = useTodayMargin();
|
|
|
+ const { getReckonMarginValueByTradeMode, getReckonMarginTypeAndValueByTradeMode } = useTodayMargin();
|
|
|
// 控制弹窗
|
|
|
const { visible, cancel } = _closeModal(context);
|
|
|
// 表单
|
|
|
@@ -204,29 +204,55 @@ export default defineComponent({
|
|
|
isFloat,
|
|
|
canUseMoney,
|
|
|
};
|
|
|
- const { getFloatPrice, getMoney } = useListingTradeNumAndPrice<FormParam>(param);
|
|
|
+ // 挂牌金额
|
|
|
+ // function getMoney() {
|
|
|
+
|
|
|
+ // }
|
|
|
+ // 估算价
|
|
|
+ function getAppraise() {}
|
|
|
+ // 合约单位
|
|
|
+ const agreeunit = getGoodsAgreeunitByGoodsCode(props.selectedRow.goodscode);
|
|
|
+ console.log();
|
|
|
+ console.log('合约单位', agreeunit);
|
|
|
+ const { getFloatPrice, getMoney } = useListingTradeNumAndPrice<FormParam>(param, agreeunit);
|
|
|
// 保证金
|
|
|
const getMargin = () => {
|
|
|
- const marginvalue = getReckonMarginValueByTradeMode(TradeMode.DiaoQi);
|
|
|
- return marginvalue ? marginvalue : '--';
|
|
|
+ let result = '--';
|
|
|
+ const [marginType, marginValue] = getReckonMarginTypeAndValueByTradeMode(TradeMode.DiaoQi);
|
|
|
+ if (marginType) {
|
|
|
+ // 保证金方式 1:比率 2:固定
|
|
|
+ if (marginType === 1) {
|
|
|
+ if (getMoney()) {
|
|
|
+ // 履约保证金=挂牌金额*保证金比例
|
|
|
+ result = ((getMoney() * marginValue) / 100).toFixed(2);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (formState.OrderQty) {
|
|
|
+ // 履约保证金=挂牌数量*保证金固定值
|
|
|
+ result = (formState.OrderQty * marginValue).toFixed(2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return result;
|
|
|
};
|
|
|
// 最大数量
|
|
|
const getMaxNum = () => {
|
|
|
let result = 0;
|
|
|
- if (isBuy()) {
|
|
|
- // 可用资金
|
|
|
- const temp = +canUseMoney();
|
|
|
-
|
|
|
- const money = temp > 0 ? temp : 0;
|
|
|
- const agreeunit = getGoodsAgreeunitByGoodsCode(props.selectedRow.goodscode);
|
|
|
- if (money && formState.FixedPrice) {
|
|
|
- result = +(money / (formState.FixedPrice * agreeunit)).toFixed(0);
|
|
|
+ const [marginType, marginValue] = getReckonMarginTypeAndValueByTradeMode(TradeMode.DiaoQi);
|
|
|
+ // 可用资金
|
|
|
+ const temp = +canUseMoney();
|
|
|
+ const money = temp > 0 ? temp : 0;
|
|
|
+ if (marginType && money && formState.FixedPrice) {
|
|
|
+ // 保证金方式 1:比率 2:固定
|
|
|
+ if (marginType === 1) {
|
|
|
+ // 最大可挂牌数量=可用/(价格*合约单位*保证金比例
|
|
|
+ result = money / (((formState.FixedPrice * marginValue) / 100) * agreeunit);
|
|
|
+ } else {
|
|
|
+ // 最大可挂牌数量=可用/保证金固定值
|
|
|
+ result = money / marginValue;
|
|
|
}
|
|
|
- } else {
|
|
|
- const temp = tableList.value.find((el) => el.goodscode === props.selectedRow.goodscode)?.enableqty;
|
|
|
- result = temp ? temp : 0;
|
|
|
}
|
|
|
- return result;
|
|
|
+ return +result.toFixed(0);
|
|
|
};
|
|
|
// 估算价
|
|
|
function getPrice() {
|