marymelisa 4 lat temu
rodzic
commit
92b79a635a

+ 1 - 1
src/common/components/drawer/index.vue

@@ -82,7 +82,7 @@ export default defineComponent({
     }
 }
 .top {
-    .position(fixed, 80px, 0, auto, auto);
+    .position(fixed, 101px, 0, auto, auto);
     width: 486px;
     height: 479px;
     background: transparent;

+ 1 - 0
src/common/setup/table/clolumn.ts

@@ -42,6 +42,7 @@ export function getTableColumns() {
             // 序号
             if (columntitle === '序号') {
                 item.customRender = (obj: any) => `${obj.index + 1}`
+                // item.width = 30
             }
             // 设置表格宽度,默认120
             if (columnwidth && columnwidth !== '0') {

+ 27 - 0
src/views/market/spot_trade/components/buy-sell-market/components/sell/index.vue

@@ -1,4 +1,5 @@
 <template>
+<<<<<<< HEAD
     <!-- 卖大厅 -->
 
     <a-table
@@ -26,6 +27,32 @@
         :parantSelectedRow="parantSelectedRow"
         @cancel="closeComponent"
     ></component>
+=======
+  <!-- 卖大厅 -->
+  <a-table :columns="columns"
+           class="sellHallTable"
+           :scroll="{ x: '100%', y: 'calc(100vh - 510px)' }"
+           :pagination="false"
+           :loading="loading"
+           :expandedRowKeys="expandedRowKeys"
+           :customRow="Rowclick"
+           rowKey="key"
+           :data-source="tableList">
+    <!-- 额外的展开行 -->
+    <template #expandedRowRender="{ record }">
+      <BtnList :btnList="btnList"
+               :record="record"
+               @click="openComponent" />
+    </template>
+  </a-table>
+  <component :is="componentId"
+             v-if="componentId"
+             :selectedRow="selectedRow"
+             :enumName="enumName"
+             :buyOrSell="BuyOrSell.sell"
+             :parantSelectedRow="parantSelectedRow"
+             @cancel="closeComponent"></component>
+>>>>>>> 9da7742240d665a65bdcfef615364c3de97ef348
 </template>
 
 <script lang="ts">

+ 121 - 0
src/views/market/spot_trade/components/buy-sell-market/setup.ts

@@ -2,6 +2,7 @@ import { EnumRouterName } from '@/common/constants/enumRouterName';
 import { TableKey } from '@/common/methods/table/interface';
 import { getTableColumns, getTableEvent, queryTableList } from "@/common/setup/table";
 import { ref } from 'vue';
+import {WrMarketTradeConfig} from "@/services/go/wrtrade/interface";
 
 
 export function handleBuyAndSellList<T>(menuType: EnumRouterName, isDetail: boolean, tableName: keyof TableKey) {
@@ -81,4 +82,124 @@ export function handleChildComponentMethod() {
         childRef.value?.queryTableAction();
     }
     return { childRef, loadChildComponentData }
+}
+
+export enum WrTradePriceEnum {
+    OnePriceDeListBuy,   // 一口价 摘牌买入
+    OnePriceDeListSale,  // 一口价 摘牌卖出
+    FloatPriceDeListBuy, // 浮动价 摘牌买入
+    FloatPriceDeListSale,// 浮动价 摘牌卖出
+}
+
+/**
+ * 我负责计算摘牌页面需要显示的值
+ * 这里分四种情况
+ * 若履约保证金为0,则不显示括号内容
+ * type 1: 一口价 摘牌买入 摘牌最大数量 = min 挂牌数量,可用资金/(买方履约保证金比例*挂牌价格)                                                                            摘牌金额=挂牌价格*摘牌数量
+ * type 2: 一口价 摘牌卖出 摘牌最大数量 = min(现货库存可用数量,挂牌数量),现货库存数量为所选仓单数量 && 履约保证金=卖方履约保证金比例*摘牌金额,履约保证金为0则括号内容不显示       摘牌金额=挂牌价格*摘牌数量
+ * type 3: 浮动价 摘牌买入 摘牌最大数量 = min {可用资金/(买方履约保证金比例*估算总价),挂牌数量} && 履约保证金=履约保证金比例*估算总额,履约保证金为0则括号内容不显示 && 估算总额=估算总价*摘牌数量 && 估算总价=挂牌基差+期货合约价 && 期货合约取价顺序:现价->实时结算价->昨结算价
+ * type 4:浮动价 摘牌卖出 摘牌最大数量 = min(现货库存可用数量,挂牌数量),现货库存数量为所选仓单数量 && 履约保证金=履约保证金比例*估算总额
+ *
+ * type 1:  in => 输入 {
+ *     挂牌价格, 可用资金, 摘牌数量,  市场交易参数配置, 挂牌数量
+ * } out => {
+ *     履约保证金, 摘牌金额, 摘牌最大数量
+ * }
+ *
+ * type 2: in => 输入 {
+ *     挂牌价格, 仓单数量, 摘牌数量,  市场交易参数配置, 挂牌数量
+ * } out => {
+ *     履约保证金, 摘牌金额, 摘牌最大数量
+ * }
+ *
+ * type 3: in => 输入 {
+ *     期货合约价 + 基差, 可用资金,  摘牌数量,  市场交易参数配置, 挂牌数量
+ * } out => {
+ *     履约保证金, 估算总额, 摘牌最大数量
+ * }
+ *
+ * type 4: in => 输入 {
+ *     期货合约价 + 基差, 仓单数量, 摘牌数量, 市场交易参数配置, 挂牌数量
+ * } out => {
+ *     履约保证金, 估算总额, 摘牌最大数量
+ * }
+ */
+export function ListedViewModel(enumType : WrTradePriceEnum){
+
+    let marginPrice: number = 0  // 履约保证金
+    let amount: number = 0 // 摘牌金额 或 估算总额
+    let maxNum: number = 0 // 摘牌最大数量
+
+    // 负责把输入的数据 转换成 ui需要显示的数据
+    function getCalculate(param: WrParam) {
+        switch (enumType) {
+            case WrTradePriceEnum.FloatPriceDeListBuy: //  浮动价 摘牌买入
+            case WrTradePriceEnum.OnePriceDeListBuy:   //  一口价 摘牌买入
+                if (param.availableFunds === undefined) { // 这里防止异常
+                    maxNum = 0
+                } else {
+                    // 摘牌最大数量 = min 挂牌数量,可用资金/(买方履约保证金比例*挂牌价格)
+                    if (param.config.buymarginalgorithm === 1) {  //  买方保证金模式 1: 比率 2: 固定
+                        maxNum = Math.min(param.listedNum, param.availableFunds as number / param.config.buymarginvalue * param.orderPrice)
+                    } else {
+                        maxNum = Math.min(param.listedNum, param.availableFunds as number / (param.config.buymarginvalue + param.orderPrice))
+                    }
+                }
+                // 摘牌金额 = 挂牌价格 * 摘牌数量
+                amount = param.orderPrice * param.deListNum
+                // 履约保证金=卖方履约保证金比例*摘牌金额,履约保证金为0则括号内容不显示
+                if (param.config.sellmarginalgorithm === 1) { //卖方保证金方式 - 1:比率 2:固定
+                    marginPrice = param.config.sellmarginvalue * amount
+                } else {
+                    marginPrice = param.config.sellmarginvalue + amount
+                }
+                break
+            case WrTradePriceEnum.FloatPriceDeListSale: // 浮动价 摘牌卖出
+            case WrTradePriceEnum.OnePriceDeListSale:  // 一口价  摘牌卖出
+                if (param.warehouseNum === undefined) { // 这里防止异常
+                    maxNum = 0
+                }else{
+                    // 摘牌最大数量 = min(现货库存可用数量,挂牌数量),现货库存数量为所选仓单数量
+                    maxNum = Math.min(param.listedNum, param.warehouseNum as number)
+                }
+                // 摘牌金额 = 挂牌价格 * 摘牌数量
+                amount = param.orderPrice * param.deListNum
+                // 履约保证金=卖方履约保证金比例*摘牌金额,履约保证金为0则括号内容不显示
+                if (param.config.sellmarginalgorithm === 1) { //卖方保证金方式 - 1:比率 2:固定
+                    marginPrice = param.config.sellmarginvalue * amount
+                } else {
+                    marginPrice = param.config.sellmarginvalue + amount
+                }
+                break
+        }
+    }
+
+    const uiParam: UiParam = {
+        marginPrice: marginPrice,
+        amount: amount,
+        maxNum: maxNum
+    }
+
+    return {getCalculate , uiParam}
+}
+
+/**
+ * 需要传入的数据集合
+ */
+export interface WrParam {
+    orderPrice : number  // 挂牌价格 (浮动价是期货合约价 + 基差)  也传这个
+    availableFunds?: number //可用资金(当前账号的可用)
+    warehouseNum?: number  // 仓单数量(如果当前是用自己仓单卖商品给其他人 则需要传自己仓单商品的总数)
+    deListNum: number     // 摘牌数量 (当前选择数量)
+    listedNum: number     // 挂牌数量  (当前单据的挂牌数量)
+    config: WrMarketTradeConfig // 市场交易参数配置 (请求配置返回)
+}
+
+/**
+ *  需要给ui的数据集合
+ */
+export interface UiParam {
+    marginPrice: number  // 履约保证金
+    amount: number       // 摘牌金额 或 估算总额
+    maxNum: number       // 摘牌最大数量
 }

+ 29 - 30
src/views/order/funding_information/components/funding_information_funding_log/index.vue

@@ -1,32 +1,31 @@
 <template>
-    <!-- 资金流水 -->
-    <section>
-        <a-table
-            :columns="columns"
-            class="srcollYTable"
-            :scroll="{ x: '100%', y: '227px' }"
-            :pagination="false"
-            :loading="loading"
-            :expandedRowKeys="expandedRowKeys"
-            :customRow="Rowclick"
-            rowKey="key"
-            :data-source="tableList"
-        >
-            <!-- 额外的展开行 -->
-            <template #expandedRowRender="{ record }">
-                <BtnList :btnList="btnList" :record="record" @click="openComponent" />
-            </template>
-            <template #createtime="{ record }">
-                <a>{{ formatTime(record.createtime) }}</a>
-            </template>
-        </a-table>
-        <component
-            :is="componentId"
-            v-if="componentId"
-            :selectedRow="selectedRow"
-            @cancel="closeComponent"
-        ></component>
-    </section>
+  <!-- 资金流水 -->
+  <section>
+    <a-table :columns="columns"
+             class="srcollYTable"
+             :scroll="{ x: '100%', y: '227px' }"
+             :pagination="false"
+             :loading="loading"
+             :expandedRowKeys="expandedRowKeys"
+             :customRow="Rowclick"
+             rowKey="key"
+             :data-source="tableList">
+      <!-- 额外的展开行 -->
+      <template v-if="btnList.length"
+                #expandedRowRender="{ record }">
+        <BtnList :btnList="btnList"
+                 :record="record"
+                 @click="openComponent" />
+      </template>
+      <template #createtime="{ record }">
+        <a>{{ formatTime(record.createtime) }}</a>
+      </template>
+    </a-table>
+    <component :is="componentId"
+               v-if="componentId"
+               :selectedRow="selectedRow"
+               @cancel="closeComponent"></component>
+  </section>
 </template>
 
 <script lang="ts">
@@ -40,8 +39,8 @@ import { ComposeOrderTableParam } from '@/common/setup/table/interface';
 import { queryAmountLog } from '@/services/go/TaAccount';
 import { QueryAmountLogReq } from '@/services/go/TaAccount/interface';
 import { getSelectedAccountId } from '@/services/bus/account';
-import {getOperateTypeEnumItemName, getOperateTypeName} from "@/common/constants/enumsName";
-import {formatTime} from "@/common/methods";
+import { getOperateTypeEnumItemName, getOperateTypeName } from '@/common/constants/enumsName';
+import { formatTime } from '@/common/methods';
 export default defineComponent({
     name: enumOrderComponents.funding_information_funding_log,
     components: {

+ 30 - 31
src/views/order/funding_information/components/funding_information_funding_summary/index.vue

@@ -1,35 +1,34 @@
 <template>
-    <!-- 资金汇总 -->
-    <section>
-        <a-table
-            :columns="columns"
-            class="srcollYTable"
-            :scroll="{ x: '100%', y: '227px' }"
-            :pagination="false"
-            :loading="loading"
-            :expandedRowKeys="expandedRowKeys"
-            :customRow="Rowclick"
-            rowKey="key"
-            :data-source="tableList"
-        >
-            <!-- 额外的展开行 -->
-            <template #expandedRowRender="{ record }">
-                <BtnList :btnList="btnList" :record="record" @click="openComponent" />
-            </template>
-            <template #balanc="{record}">
-                <span>{{getCanUseMoney(record)}}</span>
-            </template>
-            <template #freezemargin="{record}">
-                <span>{{getCanUseMoney(record)}}</span>
-            </template>
-        </a-table>
-        <component
-            :is="componentId"
-            v-if="componentId"
-            :selectedRow="selectedRow"
-            @cancel="closeComponent"
-        ></component>
-    </section>
+  <!-- 资金汇总 -->
+  <section>
+    <a-table :columns="columns"
+             class="srcollYTable"
+             :scroll="{ x: '100%', y: '227px' }"
+             :pagination="false"
+             :loading="loading"
+             :expandedRowKeys="expandedRowKeys"
+             :customRow="Rowclick"
+             rowKey="key"
+             :data-source="tableList">
+      <!-- 额外的展开行 -->
+      <template v-if="btnList.length"
+                #expandedRowRender="{ record }">
+        <BtnList :btnList="btnList"
+                 :record="record"
+                 @click="openComponent" />
+      </template>
+      <template #balanc="{record}">
+        <span>{{getCanUseMoney(record)}}</span>
+      </template>
+      <template #freezemargin="{record}">
+        <span>{{getCanUseMoney(record)}}</span>
+      </template>
+    </a-table>
+    <component :is="componentId"
+               v-if="componentId"
+               :selectedRow="selectedRow"
+               @cancel="closeComponent"></component>
+  </section>
 </template>
 
 <script lang="ts">

+ 40 - 41
src/views/order/performance_information/components/performance_information_buy_performance/index.vue

@@ -1,48 +1,47 @@
 <template>
-    <!-- 买履约 -->
-    <section>
-        <a-table
-            :columns="columns"
-            class="srcollYTable"
-            :scroll="{ x: '100%', y: '227px' }"
-            :pagination="false"
-            :loading="loading"
-            :expandedRowKeys="expandedRowKeys"
-            :customRow="Rowclick"
-            rowKey="key"
-            :data-source="tableList"
-        >
-            <!-- 额外的展开行 -->
-            <template #expandedRowRender="{ record }">
-                <BtnList :btnList="btnList" :record="record" @click="openComponent" />
-            </template>
-            <!-- 履约类型 -->
-            <template #performancetype="{ record }">
-                <a>{{ getPerformanceTypeName(record.performancetype) }}</a>
-            </template>
+  <!-- 买履约 -->
+  <section>
+    <a-table :columns="columns"
+             class="srcollYTable"
+             :scroll="{ x: '100%', y: '227px' }"
+             :pagination="false"
+             :loading="loading"
+             :expandedRowKeys="expandedRowKeys"
+             :customRow="Rowclick"
+             rowKey="key"
+             :data-source="tableList">
+      <!-- 额外的展开行 -->
+      <template v-if="btnList.length"
+                #expandedRowRender="{ record }">
+        <BtnList :btnList="btnList"
+                 :record="record"
+                 @click="openComponent" />
+      </template>
+      <!-- 履约类型 -->
+      <template #performancetype="{ record }">
+        <a>{{ getPerformanceTypeName(record.performancetype) }}</a>
+      </template>
 
-            <!-- 付款方式 -->
-            <template #paymenttype="{ record }">
-                <a>{{ getPaymentTypeName(record.paymenttype) }}</a>
-            </template>
+      <!-- 付款方式 -->
+      <template #paymenttype="{ record }">
+        <a>{{ getPaymentTypeName(record.paymenttype) }}</a>
+      </template>
 
-            <!-- 履约状态 -->
-            <template #performancestatus="{ record }">
-                <a>{{ getPerformanceStatusName(record.performancestatus) }}</a>
-            </template>
+      <!-- 履约状态 -->
+      <template #performancestatus="{ record }">
+        <a>{{ getPerformanceStatusName(record.performancestatus) }}</a>
+      </template>
 
-            <!-- 当前步骤 -->
-            <template #curstepname="{ record }">
-                <a>{{ record.curstepname }}</a>
-            </template>
-        </a-table>
-        <component
-            :is="componentId"
-            v-if="componentId"
-            :selectedRow="selectedRow"
-            @cancel="closeComponent"
-        ></component>
-    </section>
+      <!-- 当前步骤 -->
+      <template #curstepname="{ record }">
+        <a>{{ record.curstepname }}</a>
+      </template>
+    </a-table>
+    <component :is="componentId"
+               v-if="componentId"
+               :selectedRow="selectedRow"
+               @cancel="closeComponent"></component>
+  </section>
 </template>
 
 <script lang="ts">

+ 40 - 41
src/views/order/performance_information/components/performance_information_sell_performance/index.vue

@@ -1,48 +1,47 @@
 <template>
-    <!-- 卖履约 -->
-    <section>
-        <a-table
-            :columns="columns"
-            class="srcollYTable"
-            :scroll="{ x: '100%', y: '227px' }"
-            :pagination="false"
-            :loading="loading"
-            :expandedRowKeys="expandedRowKeys"
-            :customRow="Rowclick"
-            rowKey="key"
-            :data-source="tableList"
-        >
-            <!-- 额外的展开行 -->
-            <template #expandedRowRender="{ record }">
-                <BtnList :btnList="btnList" :record="record" @click="openComponent" />
-            </template>
-            <!-- 履约类型 -->
-            <template #performancetype="{ record }">
-                <a>{{ getPerformanceTypeName(record.performancetype) }}</a>
-            </template>
+  <!-- 卖履约 -->
+  <section>
+    <a-table :columns="columns"
+             class="srcollYTable"
+             :scroll="{ x: '100%', y: '227px' }"
+             :pagination="false"
+             :loading="loading"
+             :expandedRowKeys="expandedRowKeys"
+             :customRow="Rowclick"
+             rowKey="key"
+             :data-source="tableList">
+      <!-- 额外的展开行 -->
+      <template v-if="btnList.length"
+                #expandedRowRender="{ record }">
+        <BtnList :btnList="btnList"
+                 :record="record"
+                 @click="openComponent" />
+      </template>
+      <!-- 履约类型 -->
+      <template #performancetype="{ record }">
+        <a>{{ getPerformanceTypeName(record.performancetype) }}</a>
+      </template>
 
-            <!-- 付款方式 -->
-            <template #paymenttype="{ record }">
-                <a>{{ getPaymentTypeName(record.paymenttype) }}</a>
-            </template>
+      <!-- 付款方式 -->
+      <template #paymenttype="{ record }">
+        <a>{{ getPaymentTypeName(record.paymenttype) }}</a>
+      </template>
 
-            <!-- 履约状态 -->
-            <template #performancestatus="{ record }">
-                <a>{{ getPerformanceStatusName(record.performancestatus) }}</a>
-            </template>
+      <!-- 履约状态 -->
+      <template #performancestatus="{ record }">
+        <a>{{ getPerformanceStatusName(record.performancestatus) }}</a>
+      </template>
 
-            <!-- 当前步骤 -->
-            <template #curstepname="{ record }">
-                <a>{{ record.curstepname }}</a>
-            </template>
-        </a-table>
-        <component
-            :is="componentId"
-            v-if="componentId"
-            :selectedRow="selectedRow"
-            @cancel="closeComponent"
-        ></component>
-    </section>
+      <!-- 当前步骤 -->
+      <template #curstepname="{ record }">
+        <a>{{ record.curstepname }}</a>
+      </template>
+    </a-table>
+    <component :is="componentId"
+               v-if="componentId"
+               :selectedRow="selectedRow"
+               @cancel="closeComponent"></component>
+  </section>
 </template>
 
 <script lang="ts">

+ 24 - 25
src/views/order/spot_warran/components/spot_warrant_inventory_summary/index.vue

@@ -1,29 +1,28 @@
 <template>
-    <!-- 库存汇总 -->
-    <section>
-        <a-table
-            :columns="columns"
-            class="srcollYTable"
-            :scroll="{ x: '100%', y: '227px' }"
-            :pagination="false"
-            :loading="loading"
-            :expandedRowKeys="expandedRowKeys"
-            :customRow="Rowclick"
-            rowKey="key"
-            :data-source="tableList"
-        >
-            <!-- 额外的展开行 -->
-            <template #expandedRowRender="{ record }">
-                <BtnList :btnList="btnList" :record="record" @click="openComponent" />
-            </template>
-        </a-table>
-        <component
-            :is="componentId"
-            v-if="componentId"
-            :selectedRow="selectedRow"
-            @cancel="closeComponent"
-        ></component>
-    </section>
+  <!-- 库存汇总 -->
+  <section>
+    <a-table :columns="columns"
+             class="srcollYTable"
+             :scroll="{ x: '100%', y: '227px' }"
+             :pagination="false"
+             :loading="loading"
+             :expandedRowKeys="expandedRowKeys"
+             :customRow="Rowclick"
+             rowKey="key"
+             :data-source="tableList">
+      <!-- 额外的展开行 -->
+      <template v-if="btnList.length"
+                #expandedRowRender="{ record }">
+        <BtnList :btnList="btnList"
+                 :record="record"
+                 @click="openComponent" />
+      </template>
+    </a-table>
+    <component :is="componentId"
+               v-if="componentId"
+               :selectedRow="selectedRow"
+               @cancel="closeComponent"></component>
+  </section>
 </template>
 
 <script lang="ts">

+ 24 - 25
src/views/order/spot_warran/components/spot_warrant_spot_summary/index.vue

@@ -1,29 +1,28 @@
 <template>
-    <!-- 现货汇总 -->
-    <section>
-        <a-table
-            :columns="columns"
-            class="srcollYTable expandLeftTable"
-            :scroll="{ x: '100%', y: '227px' }"
-            :pagination="false"
-            :loading="loading"
-            :expandedRowKeys="expandedRowKeys"
-            :customRow="Rowclick"
-            rowKey="key"
-            :data-source="tableList"
-        >
-            <!-- 额外的展开行 -->
-            <template #expandedRowRender="{ record }">
-                <BtnList :btnList="btnList" :record="record" @click="openComponent" />
-            </template>
-        </a-table>
-        <component
-            :is="componentId"
-            v-if="componentId"
-            :selectedRow="selectedRow"
-            @cancel="closeComponent"
-        ></component>
-    </section>
+  <!-- 现货汇总 -->
+  <section>
+    <a-table :columns="columns"
+             class="srcollYTable expandLeftTable"
+             :scroll="{ x: '100%', y: '227px' }"
+             :pagination="false"
+             :loading="loading"
+             :expandedRowKeys="expandedRowKeys"
+             :customRow="Rowclick"
+             rowKey="key"
+             :data-source="tableList">
+      <!-- 额外的展开行 -->
+      <template v-if="btnList.length"
+                #expandedRowRender="{ record }">
+        <BtnList :btnList="btnList"
+                 :record="record"
+                 @click="openComponent" />
+      </template>
+    </a-table>
+    <component :is="componentId"
+               v-if="componentId"
+               :selectedRow="selectedRow"
+               @cancel="closeComponent"></component>
+  </section>
 </template>
 
 <script lang="ts">