huangbin 4 年之前
父节点
当前提交
7cdf208950

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

@@ -1,29 +1,28 @@
 <template>
 <template>
-    <!-- 买大厅 -->
-    <a-table
-        :columns="columns"
-        class="buyHallTable"
-        :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"
-        :buyOrSell="BuyOrSell.buy"
-        :parantSelectedRow="parantSelectedRow"
-        @cancel="closeComponent"
-    ></component>
+  <!-- 买大厅 -->
+  <a-table :columns="columns"
+           class="buyHallTable"
+           :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"
+             :buyOrSell="BuyOrSell.buy"
+             :enumName="enumName"
+             :parantSelectedRow="parantSelectedRow"
+             @cancel="closeComponent"></component>
 </template>
 </template>
 
 
 <script lang="ts">
 <script lang="ts">
@@ -87,6 +86,7 @@ export default defineComponent({
             BuyOrSell,
             BuyOrSell,
             loading,
             loading,
             tableList,
             tableList,
+            enumName: props.enumName,
         };
         };
     },
     },
 });
 });

+ 119 - 119
src/views/market/spot_trade/components/buy-sell-market/components/delisting/index.vue

@@ -1,121 +1,114 @@
 <template>
 <template>
-    <!-- 仓单贸易  一口价    摘牌 -->
-    <Drawer
-        :title="'摘牌'"
-        :placement="'top'"
-        :visible="visible"
-        width="486px"
-        height="479px"
-        @cancel="cancel"
-        class="top"
-    >
-        <div class="delisting">
-            <div class="formBar">
-                <a-form
-                    class="inlineForm dialogForm"
-                    ref="formRef"
-                    :model="formState"
-                    :rules="rules"
-                >
-                    <a-row :gutter="24">
-                        <a-col :span="24">
-                            <a-form-item label="交易账户" name="accountid">
-                                <a-select
-                                    class="inlineFormSelect"
-                                    style="width: 260px"
-                                    v-model:value="formState.accountid"
-                                    placeholder="请选择"
-                                >
-                                    <a-select-option
-                                        v-for="item in accountList"
-                                        :value="item.accountid"
-                                        :key="item.accountid"
-                                    >{{item.accountid}}</a-select-option>
-                                </a-select>
-                            </a-form-item>
-                        </a-col>
-                    </a-row>
-                    <a-row :gutter="24">
-                        <a-col :span="24">
-                            <a-form-item label="挂牌方">
-                                <span class="white">{{selectedRow.username}}</span>
-                            </a-form-item>
-                        </a-col>
-                    </a-row>
-                    <a-row :gutter="24">
-                        <a-col :span="24">
-                            <a-form-item label="挂牌价格">
-                                <span class="yellow">{{selectedRow.fixedprice}}</span>
-                            </a-form-item>
-                            <a-row :gutter="24">
-                                <a-col :span="24"></a-col>
-                            </a-row>
-                            <a-form-item label="挂牌数量">
-                                <span class="white">{{selectedRow.orderqty}}吨</span>
-                            </a-form-item>
-                        </a-col>
-                    </a-row>
-                    <a-row :gutter="24">
-                        <a-col :span="24">
-                            <a-form-item label="现货仓单" name>
-                                <a-select
-                                    class="inlineFormSelect"
-                                    style="width: 260px"
-                                    placeholder="请选择"
-                                >
-                                    <a-select-option value="8271930000-01(120吨)">8271930000-01(120吨)</a-select-option>
-                                </a-select>
-                            </a-form-item>
-                        </a-col>
-                    </a-row>
-                    <a-row :gutter="24">
-                        <a-col :span="24">
-                            <a-form-item label="摘牌数量" name="num">
-                                <a-input-number
-                                    class="dialogInput"
-                                    style="width: 260px"
-                                    v-model:value="formState.num"
-                                    suffix="吨"
-                                />
-                            </a-form-item>
-                        </a-col>
-                    </a-row>
-                    <a-row :gutter="24">
-                        <a-col :span="24" class="mt-20">
-                            <a-form-item>
-                                <a-slider
-                                    :min="0"
-                                    v-model:value="formState.num"
-                                    :max="selectedRow.orderqty"
-                                    class="formSlider"
-                                />
-                                <div class="unit">
-                                    <span>1</span>
-                                    <span>{{selectedRow.orderqty}}</span>
-                                </div>
-                            </a-form-item>
-                        </a-col>
-                        <a-col :span="12">&nbsp;</a-col>
-                    </a-row>
-                    <a-row :gutter="24">
-                        <a-col :span="24" class="mt-20">
-                            <a-form-item label="挂牌金额">
-                                <span class="white">50400.00</span>
-                            </a-form-item>
-                        </a-col>
-                    </a-row>
-                    <a-row :gutter="24">
-                        <a-col :span="24">
-                            <a-form-item class="tc">
-                                <a-button class="listedBtn" @click="submit">卖出</a-button>
-                                <a-button class="ml10 cancelBtn" @click="cancel">取消</a-button>
-                            </a-form-item>
-                        </a-col>
-                    </a-row>
-                </a-form>
-            </div>
-        </div>
-    </Drawer>
+  <!-- 仓单贸易  一口价    摘牌 -->
+  <Drawer :title="'摘牌'"
+          :placement="'top'"
+          :visible="visible"
+          width="486px"
+          height="479px"
+          @cancel="cancel"
+          class="top">
+    <div class="delisting">
+      <div class="formBar">
+        <a-form class="inlineForm dialogForm"
+                ref="formRef"
+                :model="formState"
+                :rules="rules">
+          <a-row :gutter="24">
+            <a-col :span="24">
+              <a-form-item label="交易账户"
+                           name="accountid">
+                <a-select class="inlineFormSelect"
+                          style="width: 260px"
+                          v-model:value="formState.accountid"
+                          placeholder="请选择">
+                  <a-select-option v-for="item in accountList"
+                                   :value="item.accountid"
+                                   :key="item.accountid">{{item.accountid}}</a-select-option>
+                </a-select>
+              </a-form-item>
+            </a-col>
+          </a-row>
+          <a-row :gutter="24">
+            <a-col :span="24">
+              <a-form-item label="挂牌方">
+                <span class="white">{{selectedRow.username}}</span>
+              </a-form-item>
+            </a-col>
+          </a-row>
+          <a-row :gutter="24">
+            <a-col :span="24">
+              <a-form-item label="挂牌价格">
+                <span class="yellow">{{selectedRow.fixedprice}}</span>
+              </a-form-item>
+              <a-row :gutter="24">
+                <a-col :span="24"></a-col>
+              </a-row>
+              <a-form-item label="挂牌数量">
+                <span class="white">{{selectedRow.orderqty}}吨</span>
+              </a-form-item>
+            </a-col>
+          </a-row>
+          <a-row :gutter="24">
+            <a-col :span="24">
+              <a-form-item label="现货仓单"
+                           name>
+                <a-select class="inlineFormSelect"
+                          style="width: 260px"
+                          placeholder="请选择">
+                  <a-select-option value="8271930000-01(120吨)">8271930000-01(120吨)</a-select-option>
+                </a-select>
+              </a-form-item>
+            </a-col>
+          </a-row>
+          <a-row :gutter="24">
+            <a-col :span="24">
+              <a-form-item label="摘牌数量"
+                           name="num">
+                <a-input-number class="dialogInput"
+                                style="width: 260px"
+                                v-model:value="formState.num"
+                                suffix="吨" />
+              </a-form-item>
+            </a-col>
+          </a-row>
+          <a-row :gutter="24">
+            <a-col :span="24"
+                   class="mt-20">
+              <a-form-item>
+                <a-slider :min="0"
+                          v-model:value="formState.num"
+                          :max="selectedRow.orderqty"
+                          class="formSlider" />
+                <div class="unit">
+                  <span>1</span>
+                  <span>{{selectedRow.orderqty}}</span>
+                </div>
+              </a-form-item>
+            </a-col>
+            <a-col :span="12">&nbsp;</a-col>
+          </a-row>
+          <a-row :gutter="24">
+            <a-col :span="24"
+                   class="mt-20">
+              <a-form-item label="挂牌金额">
+                <span class="white">50400.00</span>
+              </a-form-item>
+            </a-col>
+          </a-row>
+          <a-row :gutter="24">
+            <a-col :span="24">
+              <a-form-item class="tc">
+                <a-button class="listedBtn"
+                          @click="submit">卖出</a-button>
+                <a-button class="ml10 cancelBtn"
+                          @click="cancel">取消</a-button>
+              </a-form-item>
+            </a-col>
+          </a-row>
+        </a-form>
+      </div>
+    </div>
+  </Drawer>
 </template>
 </template>
 
 
 <script lang="ts">
 <script lang="ts">
@@ -132,16 +125,21 @@ import { ModalEnum } from '@/common/constants/modalNameEnum';
 import { HdWRDealOrderReq } from '@/services/proto/warehousetrade/interface';
 import { HdWRDealOrderReq } from '@/services/proto/warehousetrade/interface';
 import { _closeModal } from '@/common/setup/modal/modal';
 import { _closeModal } from '@/common/setup/modal/modal';
 import { message } from 'ant-design-vue';
 import { message } from 'ant-design-vue';
-import { handleForm } from './setup';
+import { handleForm, handleIs } from './setup';
 import { validateAction } from '@/common/setup/form';
 import { validateAction } from '@/common/setup/form';
 import { ListingForm } from './interface';
 import { ListingForm } from './interface';
 import Long from 'long';
 import Long from 'long';
 import { BuyOrSell } from '@/common/constants/enumCommon';
 import { BuyOrSell } from '@/common/constants/enumCommon';
+import { EnumRouterName } from '@/common/constants/enumRouterName';
 export default defineComponent({
 export default defineComponent({
     name: ModalEnum.spot_trade_warehouse_delisting,
     name: ModalEnum.spot_trade_warehouse_delisting,
     components: { Drawer, PlusOutlined, MinusOutlined },
     components: { Drawer, PlusOutlined, MinusOutlined },
     emits: ['cancel'],
     emits: ['cancel'],
     props: {
     props: {
+        enumName: {
+            default: '',
+            type: String as PropType<EnumRouterName>,
+        },
         selectedRow: {
         selectedRow: {
             type: Object as PropType<WrOrderQuoteDetail>,
             type: Object as PropType<WrOrderQuoteDetail>,
             default: {},
             default: {},
@@ -163,6 +161,8 @@ export default defineComponent({
         const { rules, formState, formRef } = handleForm(props.selectedRow);
         const { rules, formState, formRef } = handleForm(props.selectedRow);
         console.log('data', data);
         console.log('data', data);
         const loading = ref<boolean>(false);
         const loading = ref<boolean>(false);
+        const { isSale, isBuy } = handleIs(props.enumName, props.buyOrSell);
+
         function submit() {
         function submit() {
             validateAction<ListingForm>(formRef, formState).then((res) => {
             validateAction<ListingForm>(formRef, formState).then((res) => {
                 // 首先确定  这是仓单贸易的有仓单挂摘牌 HasWr = 1
                 // 首先确定  这是仓单贸易的有仓单挂摘牌 HasWr = 1
@@ -189,7 +189,7 @@ export default defineComponent({
                 };
                 };
 
 
                 // 摘买方向
                 // 摘买方向
-                if (props.buyOrSell === BuyOrSell.buy) {
+                if (isBuy()) {
                     param.BuyOrSell = 1;
                     param.BuyOrSell = 1;
                     param.LadingBillId = Long.fromString('2081627550296000001');
                     param.LadingBillId = Long.fromString('2081627550296000001');
                 } else {
                 } else {

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

@@ -1,3 +1,5 @@
+import { BuyOrSell } from "@/common/constants/enumCommon";
+import { EnumRouterName } from "@/common/constants/enumRouterName";
 import { WrOrderQuoteDetail } from "@/services/go/wrtrade/interface";
 import { WrOrderQuoteDetail } from "@/services/go/wrtrade/interface";
 import { reactive, ref, UnwrapRef } from "vue";
 import { reactive, ref, UnwrapRef } from "vue";
 import { ListingForm } from "./interface";
 import { ListingForm } from "./interface";
@@ -15,3 +17,23 @@ export function handleForm(data: WrOrderQuoteDetail) {
     }
     }
     return { rules, formState, formRef }
     return { rules, formState, formRef }
 }
 }
+
+
+export function handleIs(enumName: EnumRouterName, buyOrSell: BuyOrSell) {
+    /**
+     *
+     * @returns true => 仓单预售; false => 仓单贸易
+     */
+    function isSale(): boolean {
+        return enumName === EnumRouterName.warehouse_receipt_trade_price ||
+            enumName === EnumRouterName.warehouse_receipt_trade_floating_price
+    }
+    /**
+     *
+     * @returns true => 买; false =>卖
+     */
+    function isBuy() {
+        return buyOrSell === BuyOrSell.buy
+    }
+    return { isSale, isBuy }
+}

+ 24 - 25
src/views/market/spot_trade/components/buy-sell-market/components/sell/index.vue

@@ -1,30 +1,28 @@
 <template>
 <template>
-    <!-- 卖大厅 -->
+  <!-- 卖大厅 -->
 
 
-    <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"
-        :buyOrSell="BuyOrSell.sell"
-        :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"
+             :buyOrSell="BuyOrSell.sell"
+             :parantSelectedRow="parantSelectedRow"
+             @cancel="closeComponent"></component>
 </template>
 </template>
 
 
 <script lang="ts">
 <script lang="ts">
@@ -89,6 +87,7 @@ export default defineComponent({
             loading,
             loading,
             tableList,
             tableList,
             BuyOrSell,
             BuyOrSell,
+            enumName: props.enumName,
         };
         };
     },
     },
 });
 });