huangbin 4 gadi atpakaļ
vecāks
revīzija
5d12ae1525

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 705 - 47
src/assets/styles/index.css


+ 60 - 30
src/assets/styles/index.less

@@ -25,32 +25,37 @@ body {
 // 布局组件样式初始化
 .ant-layout {
     background: @m-white0;
+
     aside {
         background: @m-white0;
+
         .ant-layout-sider-children {
-            section {
-            }
+            section {}
         }
     }
-    > section {
+
+    >section {
         header {
             background: @m-white0;
             padding: 0;
         }
+
         main {
             background: @m-white0;
-            header {
-            }
-            main {
-            }
+
+            header {}
+
+            main {}
         }
     }
 }
 
 .ant-card .ant-card-head {
     border: none;
+
     .ant-card-head-wrapper {
         border-bottom: 1px solid @m-white2;
+
         .ant-card-head-title {
             text-align: left;
             font-size: 16px;
@@ -61,25 +66,29 @@ body {
     }
 }
 
-.ant-steps .ant-steps-item:not(.ant-steps-item-active) > .ant-steps-item-container[role='button']:hover .ant-steps-item-title,
-.ant-steps .ant-steps-item:not(.ant-steps-item-active) > .ant-steps-item-container[role='button']:hover .ant-steps-item-subtitle,
-.ant-steps .ant-steps-item:not(.ant-steps-item-active) > .ant-steps-item-container[role='button']:hover .ant-steps-item-description {
+.ant-steps .ant-steps-item:not(.ant-steps-item-active)>.ant-steps-item-container[role='button']:hover .ant-steps-item-title,
+.ant-steps .ant-steps-item:not(.ant-steps-item-active)>.ant-steps-item-container[role='button']:hover .ant-steps-item-subtitle,
+.ant-steps .ant-steps-item:not(.ant-steps-item-active)>.ant-steps-item-container[role='button']:hover .ant-steps-item-description {
     color: @m-green2;
 }
-.ant-steps .ant-steps-item:not(.ant-steps-item-active):not(.ant-steps-item-process) > .ant-steps-item-container[role='button']:hover .ant-steps-item-icon {
+
+.ant-steps .ant-steps-item:not(.ant-steps-item-active):not(.ant-steps-item-process)>.ant-steps-item-container[role='button']:hover .ant-steps-item-icon {
     border-color: @m-green2;
 }
+
 .ant-modal-title {
     font-size: 18px;
     font-family: Source Han Sans CN;
     font-weight: 500;
     color: @m-green3;
 }
+
 .submit {
     background: @m-green3;
     border-radius: 3px;
     color: @m-white0;
 }
+
 .ant-btn-primary {
     background-color: @m-green3;
 }
@@ -94,8 +103,8 @@ body {
 .ant-menu-submenu-title:hover,
 .ant-menu-submenu-selected,
 .ant-menu-item-selected,
-.ant-menu-item-selected > a,
-.ant-menu-item-selected > a:hover {
+.ant-menu-item-selected>a,
+.ant-menu-item-selected>a:hover {
     color: @m-green3;
 }
 
@@ -109,7 +118,7 @@ body {
 .ant-checkbox-checked::after,
 .ant-checkbox-wrapper:hover .ant-checkbox-inner,
 .ant-checkbox:hover .ant-checkbox-inner,
-.ant-checkbox-input:focus + .ant-checkbox-inner,
+.ant-checkbox-input:focus+.ant-checkbox-inner,
 .ant-input-affix-wrapper:hover,
 .ant-input-affix-wrapper:focus,
 .ant-select:not(.ant-select-disabled):hover .ant-select-selector,
@@ -152,19 +161,22 @@ body {
     overflow: hidden;
 }
 
-.ant-spin-nested-loading > div > .ant-spin {
+.ant-spin-nested-loading>div>.ant-spin {
     // height: 90%;
     max-height: 100%;
 }
+
 .ant-spin-nested-loading {
     width: 100%;
     height: 100%;
+
     .ant-spin-container {
         width: 100%;
         height: 100%;
         display: flex;
     }
 }
+
 .ant-switch-checked {
     background-color: @theme;
 }
@@ -198,6 +210,7 @@ body {
     width: 120px;
     display: inline-block;
 }
+
 .ellipsis_temp {
     white-space: nowrap;
     overflow: hidden;
@@ -210,32 +223,36 @@ body {
 .ant-menu-dark,
 .ant-menu-dark {
     background-color: @m-grey18;
+
     .ant-menu-submenu-title {
         font-size: 16px;
         text-align: left;
     }
+
     .ant-menu-sub {
         background-color: @m-black4;
+
         .ant-menu-item {
             font-size: 14px;
             font-family: @menu-item-family;
             color: @menu-item-color;
             text-align: left;
         }
+
         .ant-menu-item-selected {
             color: @m-white0;
         }
     }
 }
 
-.ant-menu-horizontal > .ant-menu-item-active,
-.ant-menu-horizontal > .ant-menu-item-open,
-.ant-menu-horizontal > .ant-menu-item-selected,
-.ant-menu-horizontal > .ant-menu-item:hover,
-.ant-menu-horizontal > .ant-menu-submenu-active,
-.ant-menu-horizontal > .ant-menu-submenu-open,
-.ant-menu-horizontal > .ant-menu-submenu-selected,
-.ant-menu-horizontal > .ant-menu-submenu:hover {
+.ant-menu-horizontal>.ant-menu-item-active,
+.ant-menu-horizontal>.ant-menu-item-open,
+.ant-menu-horizontal>.ant-menu-item-selected,
+.ant-menu-horizontal>.ant-menu-item:hover,
+.ant-menu-horizontal>.ant-menu-submenu-active,
+.ant-menu-horizontal>.ant-menu-submenu-open,
+.ant-menu-horizontal>.ant-menu-submenu-selected,
+.ant-menu-horizontal>.ant-menu-submenu:hover {
     color: @theme;
 }
 
@@ -259,23 +276,28 @@ body {
         }
 
 
-        > tr:first-child {
-            > th:last-child, > th:first-child {
+        >tr:first-child {
+
+            >th:last-child,
+            >th:first-child {
                 border-radius: 0px;
 
             }
         }
     }
 
-    .ant-table-tbody > tr:hover:not(.ant-table-expanded-row):not(.ant-table-row-selected) > td {
+    .ant-table-tbody>tr:hover:not(.ant-table-expanded-row):not(.ant-table-row-selected)>td {
         background: @m-blue3;
     }
+
     .ant-table-body tr td {
         background-color: @m-black2;
         color: white;
         cursor: pointer;
     }
-    .ant-table-bordered .ant-table-thead > tr > th, .ant-table-bordered .ant-table-tbody > tr > td {
+
+    .ant-table-bordered .ant-table-thead>tr>th,
+    .ant-table-bordered .ant-table-tbody>tr>td {
         padding: 0;
         height: 34px;
         line-height: 34px;
@@ -283,12 +305,13 @@ body {
         font-family: Adobe Heiti Std;
         font-size: 16px;
     }
+
     .ant-table-fixed {
         width: max-content !important;
         color: @m-white1;
         background: @m-black2;
-        border-top-color: @m-black2 !important;
-        border-left-color: @m-black9 !important;
+        border-top-color: @m-black2  !important;
+        border-left-color: @m-black9  !important;
     }
 }
 
@@ -303,7 +326,8 @@ body {
 
 .iframe-container {
     height: calc(100% - 40px);
-    > iframe {
+
+    >iframe {
         border: 0;
         width: 100%;
         height: 100%;
@@ -314,6 +338,12 @@ body {
 .up-quote-color {
     color: @m-red1;
 }
+
 .down-quote-color {
     color: @m-green4;
+}
+
+// 不可复制
+.not-copy {
+    user-select: none
 }

+ 4 - 5
src/common/setup/table/tableQuote.ts

@@ -126,13 +126,12 @@ function isPrice(price1: number | string, price2: number | string) {
  * @param price2
  * @returns
  */
-export function handleQuotePriceColor(record: QueryQuoteDayRsp) {
-    const { presettle, bid } = record
+export function handleQuotePriceColor(value: number, presettle: number) {
     let result = ''
-    if (isPrice(bid, presettle)) {
-        if (bid === presettle) {
+    if (isPrice(value, presettle)) {
+        if (value === presettle) {
             result = ''
-        } else if (bid > presettle) {
+        } else if (value > presettle) {
             result = 'up-quote-color'
         } else {
             result = 'down-quote-color'

+ 118 - 108
src/views/order/commodity_contract/components/commodity_contract_summary/components/commodity_contract_summary_deal_closed/index.vue

@@ -1,25 +1,26 @@
 <template>
-    <!-- 协议平仓-->
-    <Drawer
-        :title="'协议平仓'"
-        :placement="'right'"
-        class="bottom486"
-        :visible="visible"
-        @cancel="cancel"
-    >
-        <div class="listed c_c_s_s">
-            <a-form class="inlineForm dialogForm" ref="formRef">
-                <div class="formBar">
-                    <div class="formtop">
-                        <div class="firstTitle">
-                            <span>合约:{{selectedRow.goodscode}}/{{selectedRow.goodsname}}</span>
-                        </div>
-                        <div class="secondLine">
-                            <div class="left">持仓单号/方向</div>
-                            <div class="middle">数量/价格/金额</div>
-                            <div class="right">到期日/盈亏</div>
-                        </div>
-                        <!-- <a-checkbox-group class="commonCheckboxGroup"
+  <!-- 协议平仓-->
+  <Drawer :title="'协议平仓'"
+          :placement="'right'"
+          class="bottom486"
+          :visible="visible"
+          @cancel="cancel">
+    <div class="listed c_c_s_s">
+      <a-form class="inlineForm dialogForm"
+              ref="formRef"
+              :model="formState"
+              :rules="rules">
+        <div class="formBar">
+          <div class="formtop">
+            <div class="firstTitle">
+              <span>合约:{{selectedRow.goodscode}}/{{selectedRow.goodsname}}</span>
+            </div>
+            <div class="secondLine">
+              <div class="left">持仓单号/方向</div>
+              <div class="middle">数量/价格/金额</div>
+              <div class="right">到期日/盈亏</div>
+            </div>
+            <!-- <a-checkbox-group class="commonCheckboxGroup"
                               v-model:value="checked"
                               @change="checkGroupChange">
               <div class="lineBar"
@@ -57,79 +58,67 @@
                 </div>
               </div>
                         </a-checkbox-group>-->
-                        <a-checkbox-group class="commonCheckboxGroup">
-                            <div class="lineBar">
-                                <div class="line1">
-                                    <div class>
-                                        <a-checkbox></a-checkbox>
-                                    </div>
-                                    <div class="name">32266556655555</div>
-                                    <div class="date">2021-10-30</div>
-                                </div>
-                                <div class="line2">
-                                    <div class="left">买入</div>
-                                    <div class="middle">
-                                        <div>10</div>
-                                        <div>850.5</div>
-                                        <div>8505.5</div>
-                                    </div>
-                                    <div class="right red">+100</div>
-                                </div>
-                            </div>
-                            <div class="lineBar">
-                                <div class="line1">
-                                    <div class>
-                                        <a-checkbox></a-checkbox>
-                                    </div>
-                                    <div class="name">32266556655555</div>
-                                    <div class="date">2021-10-30</div>
-                                </div>
-                                <div class="line2">
-                                    <div class="left">买入</div>
-                                    <div class="middle">
-                                        <div>10</div>
-                                        <div>850.5</div>
-                                        <div>8505.5</div>
-                                    </div>
-                                    <div class="right red">+100</div>
-                                </div>
-                            </div>
-                        </a-checkbox-group>
-                    </div>
+            <a-checkbox-group class="commonCheckboxGroup"
+                              v-model:value="checked"
+                              @change="checkGroupChange">
+              <div class="lineBar"
+                   v-for="item in tableList"
+                   :key="item.tradeid">
+                <div class="line1">
+                  <div class>
+                    <a-checkbox @change="checkboxChange(item)"
+                                :value="item.tradeid"></a-checkbox>
+                  </div>
+                  <div class="name">{{item.tradeid}}</div>
+                  <div class="date">{{item.tradetime}}</div>
                 </div>
-                <div class="fixedBtns">
-                    <a-row :gutter="24">
-                        <a-col :span="24" class="mt12">
-                            <a-form-item label="协议价" name class="inputIconBox mb10">
-                                <a-input-number
-                                    class="commonInput"
-                                    style="width: 200px"
-                                    :min="0"
-                                    :max="100"
-                                />
-                                <MinusOutlined />
-                                <PlusOutlined />
-                            </a-form-item>
-                        </a-col>
-                        <a-col :span="24">
-                            <a-form-item label="平仓金额" class="mb10">
-                                <span class="white">50400.20</span>
-                            </a-form-item>
-                        </a-col>
-                    </a-row>
-                    <a-form-item class="btnCenter mt10">
-                        <a-button
-                            class="listedBtn"
-                            :loading="loading"
-                            :disabled="loading"
-                            @click="submit"
-                        >提交</a-button>
-                        <a-button class="ml10 cancelBtn">取消</a-button>
-                    </a-form-item>
+                <div class="line2">
+                  <div class="left">{{item.buyorsell === BuyOrSell.buy ? '买入' : '卖出'}}</div>
+                  <div class="middle">
+                    <div>{{item.holderqty}}</div>
+                    <div>{{item.holderprice}}</div>
+                    <div>{{item.holderamount}}</div>
+                  </div>
+                  <div class="right red">+100</div>
                 </div>
-            </a-form>
+              </div>
+            </a-checkbox-group>
+          </div>
         </div>
-    </Drawer>
+        <div class="fixedBtns">
+          <a-row :gutter="24">
+            <a-col :span="24"
+                   class="mt12">
+              <a-form-item label="协议价"
+                           name="price"
+                           class="inputIconBox mb10 not-copy">
+                <a-input-number class="commonInput not-copy"
+                                v-model:value="formState.price"
+                                style="width: 200px"
+                                :min="0" />
+                <MinusOutlined @click="decreasePrice" />
+                <PlusOutlined @click="increasePirce" />
+              </a-form-item>
+            </a-col>
+            <a-col :span="24">
+              <a-form-item label="平仓金额"
+                           class="mb10 not-copy ">
+                <span class="white">50400.20</span>
+              </a-form-item>
+            </a-col>
+          </a-row>
+          <a-form-item class="btnCenter mt10">
+            <a-button class="listedBtn"
+                      :loading="loading"
+                      :disabled="loading"
+                      @click="submit">提交</a-button>
+            <a-button class="ml10 cancelBtn"
+                      @click="cancel">取消</a-button>
+          </a-form-item>
+        </div>
+      </a-form>
+    </div>
+  </Drawer>
 </template>
 
 <script lang="ts">
@@ -160,8 +149,8 @@ import { queryTradeHolderDetail } from '@/services/go/order';
 import { QueryTradeHolderDetailReq } from '@/services/go/order/interface';
 import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
 import { validateAction } from '@/common/setup/form';
-import { FormState } from './interface';
-import { handleForm } from './setup';
+import { FormState, BargainList } from './interface';
+import { handleForm, usePrice, useCheckd } from './setup';
 
 export default defineComponent({
     name: ModalEnum.commodity_contract_summary_settlement,
@@ -180,32 +169,45 @@ export default defineComponent({
     setup(props, context) {
         const { visible, cancel } = _closeModal(context);
         const { rules, formState, formRef } = handleForm();
+        // 选中逻辑
+        const { checked, selected, checkGroupChange, checkboxChange } = useCheckd();
         // 表格列表数据
-        const { loading, tableList, queryTable } = queryTableList<QueryTjmdTransferApplyRsp>();
+        const { loading, tableList, queryTable } = queryTableList<BargainList>();
         const param: QueryTradeHolderDetailReq = {
             buyorsell: props.selectedRow.buyorsell,
             userid: getUserId(),
             goodsid: props.selectedRow.goodsid,
         };
-        queryTable(queryTradeHolderDetail, param);
+        queryTable(queryTradeHolderDetail, param).then((res) => {
+            tableList.value = res.map((e, i) => {
+                if (i) {
+                    return { ...e, checked: false };
+                } else {
+                    // 默认勾选第一个
+                    checked.value = e.tradeid;
+                    const result = { ...e, checked: true };
+                    return result;
+                }
+            });
+        });
 
         const toFixed0 = (value: number) => +value.toFixed(0);
 
         function submit() {
-            // validateAction<FormState>(formRef, formState).then((res) => {
-            const item = tableList.value[0];
-            const param: TradeHoldTransferApplyReq = {
-                TradeID: Long.fromString(item.tradeid),
-                BuyorSell: item.buyorsell,
-                TransferPrice: 100,
-                ApplySrc: 2,
-                ApplicantID: geLoginID_number()!,
-                Remark: '',
-            };
-            requestResultLoadingAndInfo(tradeHoldTransferApply, param, loading, ['协议平仓成功', '协议平仓失败:']).then(() => {
-                cancel(true);
+            validateAction<FormState>(formRef, formState).then((res) => {
+                const item = tableList.value[0];
+                const param: TradeHoldTransferApplyReq = {
+                    TradeID: Long.fromString(item.tradeid),
+                    BuyorSell: item.buyorsell,
+                    TransferPrice: res.price,
+                    ApplySrc: 2,
+                    ApplicantID: geLoginID_number()!,
+                    Remark: '',
+                };
+                requestResultLoadingAndInfo(tradeHoldTransferApply, param, loading, ['协议平仓成功', '协议平仓失败:']).then(() => {
+                    cancel(true);
+                });
             });
-            // });
         }
         return {
             visible,
@@ -214,6 +216,14 @@ export default defineComponent({
             tableList,
             loading,
             toFixed0,
+            rules,
+            formState,
+            formRef,
+            ...usePrice(formState),
+            checked,
+            checkGroupChange,
+            checkboxChange,
+            BuyOrSell,
         };
     },
 });

+ 7 - 1
src/views/order/commodity_contract/components/commodity_contract_summary/components/commodity_contract_summary_deal_closed/interface.ts

@@ -1,4 +1,10 @@
+import { QueryTradeHolderDetailRsp } from "@/services/go/order/interface";
 
 export interface FormState {
-    num: number,
+    price: number,
 }
+
+
+export interface BargainList extends QueryTradeHolderDetailRsp {
+    checked: boolean
+}

+ 32 - 3
src/views/order/commodity_contract/components/commodity_contract_summary/components/commodity_contract_summary_deal_closed/setup.ts

@@ -1,7 +1,7 @@
 import { validateCommon } from "@/common/setup/validate";
 import { RuleObject } from "ant-design-vue/lib/form/interface";
 import { reactive, ref, UnwrapRef } from "vue";
-import { FormState } from "./interface";
+import { BargainList, FormState } from "./interface";
 
 export function handleForm() {
     const formRef = ref();
@@ -9,12 +9,41 @@ export function handleForm() {
         return validateCommon(value, '请输入协议价');
     };
     const formState: UnwrapRef<FormState> = reactive({
-        num: 0,
+        price: 0,
     })
     const rules = {
-        num: [
+        price: [
             { require, message: '请输入协议价', trigger: 'blur', type: 'number', validator: v_num },
         ],
     }
     return { rules, formState, formRef }
+}
+
+export function usePrice(formState: UnwrapRef<FormState>) {
+    function increasePirce() {
+        formState.price++
+    }
+    function decreasePrice() {
+        if (formState.price) {
+            formState.price--
+        }
+    }
+    return { increasePirce, decreasePrice }
+}
+
+export function useCheckd() {
+    const checked = ref<string>();
+    const selected = ref<BargainList>()
+    function checkGroupChange(checkedValue: string[]) {
+        checked.value = checkedValue[checkedValue.length - 1];
+    }
+    function checkboxChange(item: BargainList) {
+        selected.value = item;
+    }
+    return { checked, selected, checkGroupChange, checkboxChange }
+}
+
+// 计算盈亏
+export function useProfit(item: BargainList) {
+
 }

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels