huangbin 4 years ago
parent
commit
f391e02484

+ 4 - 0
src/services/bus/goods.ts

@@ -10,6 +10,10 @@ export function getGoodsList(): Goods[] {
     return APP.get('Goods')
     return APP.get('Goods')
 }
 }
 
 
+export function getGoodsByCode(goodsCode: string): Goods | undefined {
+    return getGoodsList().find(e => e.goodscode === goodsCode)
+}
+
 // 获取全部盘面信息
 // 获取全部盘面信息
 export function getAllQuoteDayInfo(): QueryQuoteDayRsp[] {
 export function getAllQuoteDayInfo(): QueryQuoteDayRsp[] {
     return APP.get('quoteDayInfo')
     return APP.get('quoteDayInfo')

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

@@ -1,99 +1,102 @@
 <template>
 <template>
-    <!-- 买卖大厅 -->
-    <div class="buy-sell-market">
-        <div class="buy-sell-market-title">
-            <a class="backIcon" @click="cancel">
-                <LeftOutlined />
-            </a>
-            <div class="titleBtn">
-                <div class="name">{{selectedRow.deliverygoodsname}}</div>
-                <div class="arrowRightIcon"></div>
-            </div>
-            <div class="titleBtn titleBtn2">
-                <div class="arrowLeftIcon"></div>
-                <div class="name">{{selectedRow.wrgoodsname}}</div>
-                <div class="arrowRightIcon"></div>
-            </div>
-            <div class="titleBtn titleBtn2">
-                <div class="arrowLeftIcon"></div>
-                <div class="name">{{selectedRow.warehousename}}</div>
-                <div class="arrowRightIcon"></div>
-            </div>
-            <div class="titleBtn titleBtn3" v-if="!getHasWR(enumName)">
-                <div class="arrowLeftIcon"></div>
-                <div class="name">
-                    <a-month-picker
-                        :allowClear="false"
-                        v-model:value="time"
-                        @change="timeChange"
-                        class="commonDatePicker conditionPicker"
-                    />
-                </div>
-                <DownOutlined />
-            </div>
-            <div class="green">
-                <div class="numBlock" v-if="isFloatPrice()">
-                    <div class="first">卖基差</div>
-                    <div class="last">{{selectedRow.sellpricemove}}</div>
-                </div>
-                <div class="numBlock" v-else>
-                    <div class="first">卖价</div>
-                    <div class="last">{{selectedRow.sellprice}}</div>
-                </div>
-                <div class="numBlock">
-                    <div class="first">卖量</div>
-                    <div class="last">{{selectedRow.sellqty}}</div>
-                </div>
-            </div>
-            <div class="red ml35">
-                <div class="numBlock" v-if="isFloatPrice()">
-                    <div class="first">买基差</div>
-                    <div class="last">{{selectedRow.buypricemove}}</div>
-                </div>
-                <div class="numBlock" v-else>
-                    <div class="first">买价</div>
-                    <div class="last">{{selectedRow.buyprice}}</div>
-                </div>
-                <div class="numBlock">
-                    <div class="first">买量</div>
-                    <div class="last">{{selectedRow.buyqty}}</div>
-                </div>
-            </div>
-            <div class="market" v-if="isFloatPrice()">
-                <div class="first">{{selectedRow.goodscode}}</div>
-                <div class="last red">{{getGoodsPrice()}}</div>
-                <LineChartOutlined />
-            </div>
-            <BtnList :btnList="firstBtn" :record="selectedRow" @click="openComponent" />
+  <!-- 买卖大厅 -->
+  <div class="buy-sell-market">
+    <div class="buy-sell-market-title">
+      <a class="backIcon"
+         @click="cancel">
+        <LeftOutlined />
+      </a>
+      <div class="titleBtn">
+        <div class="name">{{selectedRow.deliverygoodsname}}</div>
+        <div class="arrowRightIcon"></div>
+      </div>
+      <div class="titleBtn titleBtn2">
+        <div class="arrowLeftIcon"></div>
+        <div class="name">{{selectedRow.wrgoodsname}}</div>
+        <div class="arrowRightIcon"></div>
+      </div>
+      <div class="titleBtn titleBtn2">
+        <div class="arrowLeftIcon"></div>
+        <div class="name">{{selectedRow.warehousename}}</div>
+        <div class="arrowRightIcon"></div>
+      </div>
+      <div class="titleBtn titleBtn3"
+           v-if="!getHasWR(enumName)">
+        <div class="arrowLeftIcon"></div>
+        <div class="name">
+          <a-month-picker :allowClear="false"
+                          v-model:value="time"
+                          @change="timeChange"
+                          class="commonDatePicker conditionPicker" />
         </div>
         </div>
-        <a-row class="buySellHall">
-            <a-col :span="12" v-if="sellMarket.isMarket">
-                <Sell
-                    :enumName="enumName"
-                    ref="sellRef"
-                    :parantSelectedRow="selectedRow"
-                    :time="time"
-                    :btnList="handleBtnList(sellMarket.btnList)"
-                />
-            </a-col>
-            <a-col :span="12" v-if="buyMarket.isMarket">
-                <Buy
-                    :enumName="enumName"
-                    ref="buyRef"
-                    :time="time"
-                    :parantSelectedRow="selectedRow"
-                    :btnList="handleBtnList(buyMarket.btnList)"
-                />
-            </a-col>
-        </a-row>
-        <component
-            :is="componentId"
-            v-if="componentId"
-            :selectedRow="selectedRow"
-            :enumName="enumName"
-            @cancel="closeComponent"
-        ></component>
+        <DownOutlined />
+      </div>
+      <div class="green">
+        <div class="numBlock"
+             v-if="isFloatPrice()">
+          <div class="first">卖基差</div>
+          <div class="last">{{selectedRow.sellpricemove}}</div>
+        </div>
+        <div class="numBlock"
+             v-else>
+          <div class="first">卖价</div>
+          <div class="last">{{selectedRow.sellprice}}</div>
+        </div>
+        <div class="numBlock">
+          <div class="first">卖量</div>
+          <div class="last">{{selectedRow.sellqty}}</div>
+        </div>
+      </div>
+      <div class="red ml35">
+        <div class="numBlock"
+             v-if="isFloatPrice()">
+          <div class="first">买基差</div>
+          <div class="last">{{selectedRow.buypricemove}}</div>
+        </div>
+        <div class="numBlock"
+             v-else>
+          <div class="first">买价</div>
+          <div class="last">{{selectedRow.buyprice}}</div>
+        </div>
+        <div class="numBlock">
+          <div class="first">买量</div>
+          <div class="last">{{selectedRow.buyqty}}</div>
+        </div>
+      </div>
+      <div class="market"
+           v-if="isFloatPrice()">
+        <div class="first">{{selectedRow.goodscode}}</div>
+        <div class="last red">{{getGoodsPrice()}}</div>
+        <LineChartOutlined />
+      </div>
+      <BtnList :btnList="firstBtn"
+               :record="selectedRow"
+               @click="openComponent" />
     </div>
     </div>
+    <a-row class="buySellHall">
+      <a-col :span="12"
+             v-if="sellMarket.isMarket">
+        <Sell :enumName="enumName"
+              ref="sellRef"
+              :parantSelectedRow="selectedRow"
+              :time="time"
+              :btnList="handleBtnList(sellMarket.btnList)" />
+      </a-col>
+      <a-col :span="12"
+             v-if="buyMarket.isMarket">
+        <Buy :enumName="enumName"
+             ref="buyRef"
+             :time="time"
+             :parantSelectedRow="selectedRow"
+             :btnList="handleBtnList(buyMarket.btnList)" />
+      </a-col>
+    </a-row>
+    <component :is="componentId"
+               v-if="componentId"
+               :selectedRow="selectedRow"
+               :enumName="enumName"
+               @cancel="closeComponent"></component>
+  </div>
 </template>
 </template>
 
 
 <script lang="ts">
 <script lang="ts">
@@ -102,7 +105,7 @@ import { defineAsyncComponent, defineComponent, BtnList, ModalEnum } from '@/com
 import { _closeModal } from '@/common/setup/modal/modal';
 import { _closeModal } from '@/common/setup/modal/modal';
 import { WrOrderQuote } from '@/services/go/wrtrade/interface';
 import { WrOrderQuote } from '@/services/go/wrtrade/interface';
 import { LeftOutlined } from '@ant-design/icons-vue';
 import { LeftOutlined } from '@ant-design/icons-vue';
-import { handleChildComponentMethod, handleFinacing, getHasWR } from './setup';
+import { handleChildComponentMethod, handleFinacing, getHasWR, handlePriceRule } from './setup';
 import Buy from './components/buy/index.vue';
 import Buy from './components/buy/index.vue';
 import Sell from './components/sell/index.vue';
 import Sell from './components/sell/index.vue';
 import { LineChartOutlined, DownOutlined } from '@ant-design/icons-vue';
 import { LineChartOutlined, DownOutlined } from '@ant-design/icons-vue';
@@ -112,7 +115,7 @@ import { handleSpotBtnList } from '../../setup';
 import { v4 } from 'uuid';
 import { v4 } from 'uuid';
 import { addSubscribeQuotation, removeSubscribeQuotation } from '@/services/socket/quota';
 import { addSubscribeQuotation, removeSubscribeQuotation } from '@/services/socket/quota';
 import Bus from '@/utils/eventBus/index';
 import Bus from '@/utils/eventBus/index';
-import { getQuoteDayInfoByCode } from '@/services/bus/goods';
+import { getGoodsByCode, getQuoteDayInfoByCode } from '@/services/bus/goods';
 import TimerUtils from '@/utils/timer/timerUtil';
 import TimerUtils from '@/utils/timer/timerUtil';
 import { BtnList as BtnListType } from '@/common/components/btnList/interface';
 import { BtnList as BtnListType } from '@/common/components/btnList/interface';
 import moment, { Moment } from 'moment';
 import moment, { Moment } from 'moment';
@@ -144,6 +147,8 @@ export default defineComponent({
         const time = ref<Moment>(moment()); // string 交收月
         const time = ref<Moment>(moment()); // string 交收月
         const loading = ref<boolean>(false);
         const loading = ref<boolean>(false);
         const { visible, cancel } = _closeModal(context);
         const { visible, cancel } = _closeModal(context);
+        // 获取计算规则
+        handlePriceRule(loading, props.selectedRow.wrstandardid);
         // 买卖大厅 配置数据
         // 买卖大厅 配置数据
         // 表格操作按钮列表
         // 表格操作按钮列表
         const { firstBtn, buyMarket, sellMarket } = handleSpotBtnList(props.enumName);
         const { firstBtn, buyMarket, sellMarket } = handleSpotBtnList(props.enumName);
@@ -155,8 +160,14 @@ export default defineComponent({
         // 获取浮动价商品实时价格
         // 获取浮动价商品实时价格
 
 
         function getGoodsPrice() {
         function getGoodsPrice() {
-            const quoteData = getQuoteDayInfoByCode(props.selectedRow.goodscode);
-            return quoteData ? quoteData.ask : '--';
+            const goods = getGoodsByCode(props.selectedRow.goodscode);
+            if (goods) {
+                const n = Math.pow(10, goods.decimalplace);
+                const quoteData = getQuoteDayInfoByCode(props.selectedRow.goodscode);
+                return quoteData ? quoteData.ask / n : '--';
+            } else {
+                return '--';
+            }
         }
         }
         const uuid = v4();
         const uuid = v4();
         if (isFloatPrice()) {
         if (isFloatPrice()) {

+ 12 - 2
src/views/market/spot_trade/components/buy-sell-market/setup.ts

@@ -2,8 +2,8 @@ import { EnumRouterName } from '@/common/constants/enumRouterName';
 import { queryResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
 import { queryResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
 import { TableKey } from '@/common/methods/table/interface';
 import { TableKey } from '@/common/methods/table/interface';
 import { getTableColumns, getTableEvent, queryTableList } from "@/common/setup/table";
 import { getTableColumns, getTableEvent, queryTableList } from "@/common/setup/table";
-import { queryFaProductDetail } from '@/services/go/wrtrade';
-import { WrFAProductDetail, WrMarketTradeConfig } from "@/services/go/wrtrade/interface";
+import { queryFaProductDetail, queryWrStandardFactoryItem } from '@/services/go/wrtrade';
+import { WrFAProductDetail, WrMarketTradeConfig, WrStandardFactoryItemEx } from "@/services/go/wrtrade/interface";
 import { Ref, ref } from 'vue';
 import { Ref, ref } from 'vue';
 
 
 
 
@@ -100,6 +100,16 @@ export function handleChildComponentMethod() {
     return { childRef, loadChildComponentData }
     return { childRef, loadChildComponentData }
 }
 }
 
 
+// 获取金额计算规则
+const rules = ref<WrStandardFactoryItemEx[]>([])
+export function handlePriceRule(loading: Ref<boolean>, wrstandardid: number) {
+    queryResultLoadingAndInfo(queryWrStandardFactoryItem, loading, { wrstandardid }).then(res => {
+        rules.value = res;
+    })
+}
+export function getRules() {
+    return rules
+}
 
 
 const list = ref<WrFAProductDetail[]>([]);
 const list = ref<WrFAProductDetail[]>([]);
 // 获取融资摘牌
 // 获取融资摘牌