|
@@ -3,8 +3,171 @@
|
|
|
<template #header>
|
|
<template #header>
|
|
|
<app-navbar title="点价详情" />
|
|
<app-navbar title="点价详情" />
|
|
|
</template>
|
|
</template>
|
|
|
|
|
+ <div v-if="quote">
|
|
|
|
|
+ <!-- 商品代码、现价 -->
|
|
|
|
|
+ <div style="padding: .3rem;">
|
|
|
|
|
+ <span>商品代码/名称</span>
|
|
|
|
|
+ <span style="margin-left: .3rem; color: blue;">{{ quote.goodscode }}/{{ quote.goodsname }}</span>
|
|
|
|
|
+ <span :class="quote.lastColor" style="margin-left: .5rem;">{{ handleNumberValue(quote.last) }}</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <!-- 盘面 -->
|
|
|
|
|
+ <div style="padding: .3rem; background-color: white;">
|
|
|
|
|
+ <table cellspacing="10" cellpadding="0" style="width: 100%;">
|
|
|
|
|
+ <tr>
|
|
|
|
|
+ <td style="width: calc(`100% / 3`);">
|
|
|
|
|
+ <span>幅度</span>
|
|
|
|
|
+ <span :class="quote.lastColor" style="margin-left: .2rem;">{{ handleNumberValue(quote.amplitude)
|
|
|
|
|
+ }}</span>
|
|
|
|
|
+ </td>
|
|
|
|
|
+ <td style="width: calc(`100% / 3`);">
|
|
|
|
|
+ <span>涨跌</span>
|
|
|
|
|
+ <span :class="quote.lastColor" style="margin-left: .2rem;">{{ handleNumberValue(quote.change)
|
|
|
|
|
+ }}</span>
|
|
|
|
|
+ </td>
|
|
|
|
|
+ <td style="width: calc(`100% / 3`);" rowspan="3">
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <span style="background-color: green; color: white; padding: 0.05rem;">卖</span>
|
|
|
|
|
+ <span :class="quote.bidColor" style="margin-left: .2rem;">{{ handleNumberValue(quote.bid)
|
|
|
|
|
+ }}</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div style="margin-top: .2rem;">
|
|
|
|
|
+ <span style="background-color: red; color: white; padding: .05rem;">买</span>
|
|
|
|
|
+ <span :class="quote.askColor" style="margin-left: .2rem;">{{ handleNumberValue(quote.ask)
|
|
|
|
|
+ }}</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </td>
|
|
|
|
|
+ </tr>
|
|
|
|
|
+ <tr>
|
|
|
|
|
+ <td style="width: calc(`100% / 3`);">
|
|
|
|
|
+ <span>今开</span>
|
|
|
|
|
+ <span :class="quote.openedColor" style="margin-left: .2rem;">{{ handleNumberValue(quote.opened)
|
|
|
|
|
+ }}</span>
|
|
|
|
|
+ </td>
|
|
|
|
|
+ <td style="width: calc(`100% / 3`);">
|
|
|
|
|
+ <span>昨结</span>
|
|
|
|
|
+ <span style="margin-left: .2rem;">{{ handleNumberValue(quote.presettle) }}</span>
|
|
|
|
|
+ </td>
|
|
|
|
|
+ </tr>
|
|
|
|
|
+ <tr>
|
|
|
|
|
+ <td style="width: calc(`100% / 3`);">
|
|
|
|
|
+ <span>最高</span>
|
|
|
|
|
+ <span :class="quote.highestColor" style="margin-left: .2rem;">{{
|
|
|
|
|
+ handleNumberValue(quote.highest) }}</span>
|
|
|
|
|
+ </td>
|
|
|
|
|
+ <td style="width: calc(`100% / 3`);">
|
|
|
|
|
+ <span>最低</span>
|
|
|
|
|
+ <span :class="quote.lowestColor" style="margin-left: .2rem;">{{ handleNumberValue(quote.lowest)
|
|
|
|
|
+ }}</span>
|
|
|
|
|
+ </td>
|
|
|
|
|
+ </tr>
|
|
|
|
|
+ </table>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <!-- 下单 -->
|
|
|
|
|
+ <Form ref="formRef" style="padding: 0.2rem; background-color: white;" @submit="onSubmit">
|
|
|
|
|
+ <Field label="方向">
|
|
|
|
|
+ <template #input>
|
|
|
|
|
+ <RadioGroup v-model="formData.BuyOrSell" direction="horizontal">
|
|
|
|
|
+ <Radio v-for="(item, index) in getBuyOrSellList()" :key="index" :name="item.value">{{ item.label
|
|
|
|
|
+ }}</Radio>
|
|
|
|
|
+ </RadioGroup>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </Field>
|
|
|
|
|
+ <Field label="类型">
|
|
|
|
|
+ <template #input>
|
|
|
|
|
+ <RadioGroup v-model="formData.BuildType" direction="horizontal">
|
|
|
|
|
+ <Radio :name="BuildType.Open">{{ getBuildTypeName(BuildType.Open) }}</Radio>
|
|
|
|
|
+ <Radio :name="BuildType.Close">{{ getBuildTypeName(BuildType.Close) }}</Radio>
|
|
|
|
|
+ </RadioGroup>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </Field>
|
|
|
|
|
+ <Field label="价格方式">
|
|
|
|
|
+ <template #input>
|
|
|
|
|
+ <RadioGroup v-model="formData.PriceMode" direction="horizontal">
|
|
|
|
|
+ <Radio v-for="(item, index) in getPricemode2List()" :key="index" :name="item.value">{{
|
|
|
|
|
+ item.label
|
|
|
|
|
+ }}</Radio>
|
|
|
|
|
+ </RadioGroup>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </Field>
|
|
|
|
|
+ <Field name="OrderQty" label="挂牌数量">
|
|
|
|
|
+ <template #input>
|
|
|
|
|
+ <Stepper v-model="formData.OrderQty" theme="round" button-size="22" :auto-fixed="false" integer />
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </Field>
|
|
|
|
|
+ <!-- 市价 -->
|
|
|
|
|
+ <Field label="价格" v-if="formData.PriceMode === PriceMode.Market">
|
|
|
|
|
+ <template #input>
|
|
|
|
|
+ <span>{{ handleNumberValue(marketPrice) }}</span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </Field>
|
|
|
|
|
+ <Field name="MarketMaxSub" label="允许成交范围" v-if="formData.PriceMode === PriceMode.Market">
|
|
|
|
|
+ <template #input>
|
|
|
|
|
+ <Stepper v-model="formData.MarketMaxSub" theme="round" button-size="22" :auto-fixed="false" integer />
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </Field>
|
|
|
|
|
+ <!-- 限价 -->
|
|
|
|
|
+
|
|
|
|
|
+ </Form>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <template #footer>
|
|
|
|
|
+ <Button type="primary" block round @click="formRef?.submit">确定</Button>
|
|
|
|
|
+ </template>
|
|
|
</app-view>
|
|
</app-view>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
|
|
|
+import { useFuturesStore } from '@/stores'
|
|
|
|
|
+import { useNavigation } from '@/hooks/navigation'
|
|
|
|
|
+import { handleNumberValue } from '@/filters'
|
|
|
|
|
+import quoteSocket from '@/services/websocket/quote'
|
|
|
|
|
+import { shallowRef, onMounted, onUnmounted, computed } from 'vue'
|
|
|
|
|
+import { Form, Field, Stepper, Button, FieldRule, FormInstance, Radio, RadioGroup } from 'vant'
|
|
|
|
|
+import { useOrder } from '@/business/trade'
|
|
|
|
|
+import { BuyOrSell, getBuyOrSellList, BuildType, getBuildTypeName, getPricemode2List, PriceMode } from '@/constants/order'
|
|
|
|
|
+import { fullloading, dialog } from '@/utils/vant'
|
|
|
|
|
+
|
|
|
|
|
+const futuresStore = useFuturesStore()
|
|
|
|
|
+const { getQueryString, getQueryStringToNumber } = useNavigation()
|
|
|
|
|
+
|
|
|
|
|
+const goodscode = getQueryString('goodscode')
|
|
|
|
|
+const buyOrSell = getQueryStringToNumber('buyOrSell')
|
|
|
|
|
+const buildType = getQueryStringToNumber('buildType')
|
|
|
|
|
+const quote = futuresStore.getQuoteInfo(goodscode)
|
|
|
|
|
+const subscribe = quoteSocket.addSubscribe([goodscode])
|
|
|
|
|
+const formRef = shallowRef<FormInstance>()
|
|
|
|
|
+const { formData, formSubmit } = useOrder()
|
|
|
|
|
+const marketPrice = computed(() => {
|
|
|
|
|
+ const { ask = 0, bid = 0 } = quote.value ?? {}
|
|
|
|
|
+ return formData.BuyOrSell === BuyOrSell.Buy ? ask : bid
|
|
|
|
|
+})
|
|
|
|
|
+
|
|
|
|
|
+onMounted(() => {
|
|
|
|
|
+ subscribe.start()
|
|
|
|
|
+
|
|
|
|
|
+ formData.BuyOrSell = buyOrSell
|
|
|
|
|
+ formData.BuildType = buildType
|
|
|
|
|
+ formData.PriceMode = PriceMode.Market
|
|
|
|
|
+ formData.MarketMaxSub = 100.0
|
|
|
|
|
+})
|
|
|
|
|
+
|
|
|
|
|
+onUnmounted(() => {
|
|
|
|
|
+ subscribe.stop()
|
|
|
|
|
+})
|
|
|
|
|
+
|
|
|
|
|
+// 委托下单
|
|
|
|
|
+const onSubmit = () => {
|
|
|
|
|
+ const { goodsid, marketid } = quote.value ?? {}
|
|
|
|
|
+ formData.GoodsID = goodsid
|
|
|
|
|
+ formData.MarketID = marketid
|
|
|
|
|
+
|
|
|
|
|
+ fullloading((hideLoading) => {
|
|
|
|
|
+ formSubmit().then(() => {
|
|
|
|
|
+ hideLoading()
|
|
|
|
|
+ dialog('委托成功。')
|
|
|
|
|
+ }).catch((err) => {
|
|
|
|
|
+ hideLoading(err, 'fail')
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
</script>
|
|
</script>
|