li.shaoyi 1 月之前
父节点
当前提交
02da2b2013

+ 1 - 1
src/packages/digital/views/contract/goods/chart/index.less

@@ -1,4 +1,4 @@
-.spot-goods-chart {
+.contract-goods-chart {
     .quote-table {
         padding: var(--van-padding-md) 0;
 

+ 22 - 19
src/packages/digital/views/contract/goods/chart/index.vue

@@ -1,8 +1,8 @@
 <!-- 合约 - 交易下单 - 图表 -->
 <template>
-    <app-view class="spot-goods-chart g-layout">
+    <app-view class="contract-goods-chart g-layout">
         <template #header>
-            <app-navbar :title="quote?.goodscode" />
+            <app-navbar :title="quote ? `${quote.goodscode}/${quote.goodsname}` : '图表'" />
         </template>
         <template v-if="quote">
             <div class="quote-table">
@@ -11,50 +11,52 @@
                         <tr class="data-table__row">
                             <td class="data-table__cell data-table__cell--merged" rowspan="2">
                                 <div :class="quote.lastColor">
-                                    {{ handleNumberValue(quote.last.toFixed(quote.decimalplace)) }}
+                                    <h2>{{ handleNumberValue(quote.last.toFixed(quote.decimalplace)) }}</h2>
                                 </div>
                                 <div>
-                                    <span>{{ quote.rise.toFixed(quote.decimalplace) }}</span>
-                                    <span>{{ parsePercent(quote.change) }}</span>
+                                    <span :class="quote.lastColor">{{ quote.rise.toFixed(quote.decimalplace) }}</span>
+                                    <span :class="quote.lastColor">{{ parsePercent(quote.change) }}</span>
                                 </div>
                             </td>
                             <td class="data-table__cell">
-                                <span class="text-small">昨结</span>
-                                <span>
+                                <div class="text-small">昨结</div>
+                                <div>
                                     {{ handleNumberValue(quote.presettle.toFixed(quote.decimalplace)) }}
-                                </span>
+                                </div>
                             </td>
                             <td class="data-table__cell">
-                                <span class="text-small">最高</span>
-                                <span :class="quote.highestColor">
+                                <div class="text-small">最高</div>
+                                <div :class="quote.highestColor">
                                     {{ handleNumberValue(quote.highest.toFixed(quote.decimalplace)) }}
-                                </span>
+                                </div>
                             </td>
                         </tr>
                         <tr>
                             <td class="data-table__cell">
-                                <span class="text-small">开盘</span>
-                                <span :class="quote.openedColor">
+                                <div class="text-small">开盘</div>
+                                <div :class="quote.openedColor">
                                     {{ handleNumberValue(quote.opened.toFixed(quote.decimalplace)) }}
-                                </span>
+                                </div>
                             </td>
                             <td class="data-table__cell">
-                                <span class="text-small">最低</span>
-                                <span :class="quote.lowestColor">
+                                <div class="text-small">最低</div>
+                                <div :class="quote.lowestColor">
                                     {{ handleNumberValue(quote.lowest.toFixed(quote.decimalplace)) }}
-                                </span>
+                                </div>
                             </td>
                         </tr>
                     </tbody>
                 </table>
             </div>
             <goods-chart v-bind="{ theme: 'Dark', goodsCode: quote.goodscode }" />
+        </template>
+        <template #footer>
             <Row class="g-layout-block g-layout-block--inset" gutter="10">
                 <Col span="12">
-                <Button type="success" block @click="routerBack">开多</Button>
+                <Button type="success" block @click="routerBack({ buyOrSell: BuyOrSell.Buy })">开多</Button>
                 </Col>
                 <Col span="12">
-                <Button type="danger" block @click="routerBack">开空</Button>
+                <Button type="danger" block @click="routerBack({ buyOrSell: BuyOrSell.Sell })">开空</Button>
                 </Col>
             </Row>
         </template>
@@ -65,6 +67,7 @@
 import { computed, defineAsyncComponent } from 'vue'
 import { Button, Col, Row } from 'vant'
 import { handleNumberValue, parsePercent } from '@/filters'
+import { BuyOrSell } from '@/constants/order'
 import { useNavigation } from '@mobile/router/navigation'
 import { useFuturesStore } from '@/stores'
 

+ 4 - 0
src/packages/digital/views/contract/goods/detail/index.less

@@ -1,2 +1,6 @@
 .contract-goods-detail {
+    &__price {
+        display: flex;
+        justify-content: space-around;
+    }
 }

+ 41 - 34
src/packages/digital/views/contract/goods/detail/index.vue

@@ -1,16 +1,15 @@
 <template>
     <app-view class="contract-goods-detail g-layout g-form" v-model:show="showModal">
         <template #header>
-            <app-navbar title="交易">
+            <app-navbar :title="quote ? `${quote.goodscode}/${quote.goodsname}` : '交易'">
                 <template #footer>
                     <Cell>
-                        <template #title>
-                            <b>{{ quote?.goodscode }}/{{ quote?.goodsname }}</b>
-                        </template>
-                        <template #label>
-                            <span>{{ quote?.presettle }}</span>
-                            <span>{{ parsePercent(quote?.change) }}</span>
-                            <span>{{ enumName }}</span>
+                        <template #title v-if="quote">
+                            <h3>
+                                <span>{{ quote.presettle }}</span>
+                                <span style="color: #999;font-size: 14px;margin-left: 2px;">{{ enumName }}</span>
+                            </h3>
+                            <span :class="quote.lastColor">{{ parsePercent(quote.change) }}</span>
                         </template>
                         <template #right-icon>
                             <span @click="routerToChart">图表</span>
@@ -19,44 +18,43 @@
                 </template>
             </app-navbar>
         </template>
+        <div class="contract-goods-detail__price g-layout-block g-layout-block--inset">
+            <h3 :class="quote?.askColor">{{ quote?.ask }}</h3>
+            <h3 :class="quote?.bidColor">{{ quote?.bid }}</h3>
+        </div>
         <Row class="g-layout-block g-layout-block--inset" gutter="10">
             <Col span="12">
-            <span :class="quote?.askColor">{{ quote?.ask }}</span>
-            </Col>
-            <Col span="12">
-            <span :class="quote?.bidColor">{{ quote?.bid }}</span>
-            </Col>
-        </Row>
-        <Row class="g-layout-block g-layout-block--inset" gutter="10">
-            <Col span="12">
-            <Button :type="formData.BuyOrSell === BuyOrSell.Buy ? 'success' : 'default'" size="small" block @click="buyOrSell(BuyOrSell.Buy)">开多</Button>
+            <Button :type="formData.BuyOrSell === BuyOrSell.Buy ? 'success' : 'default'" size="small" block
+                @click="buyOrSell(BuyOrSell.Buy)">开多</Button>
             </Col>
             <Col span="12">
-            <Button :type="formData.BuyOrSell === BuyOrSell.Sell ? 'danger' : 'default'" size="small" block @click="buyOrSell(BuyOrSell.Sell)">开空</Button>
+            <Button :type="formData.BuyOrSell === BuyOrSell.Sell ? 'danger' : 'default'" size="small" block
+                @click="buyOrSell(BuyOrSell.Sell)">开空</Button>
             </Col>
         </Row>
-        <Form ref="formRef" class="g-form__container" @submit="onSubmit" >
+        <Form ref="formRef" class="g-form__container" @submit="onSubmit">
             <CellGroup inset>
                 <Field label="方式" is-link>
                     <template #input>
                         <app-select v-model="formData.PriceMode" :options="options" />
                     </template>
                 </Field>
-                <Field v-if="formData.PriceMode === EPriceMode.PRICEMODE_LIMIT" name="OrderPrice" :rules="formRules.OrderPrice" :label="'价格'+enumName">
+                <Field v-if="formData.PriceMode === EPriceMode.PRICEMODE_LIMIT" name="OrderPrice"
+                    :rules="formRules.OrderPrice" :label="'价格' + enumName">
                     <template #input>
-                        <Stepper v-model="formData.OrderPrice" min="0.0" :decimal-length="quote?.decimalplace"
-                            :step="quote?.decimalvalue" :auto-fixed="false" />
+                        <app-stepper v-model="formData.OrderPrice" :min="0" :decimal-length="quote?.decimalplace"
+                            :step="quote?.decimalvalue" />
                     </template>
                 </Field>
                 <Cell v-else value="最优市价" />
                 <Field name="OrderQty" :rules="formRules.OrderQty" label="数量">
                     <template #input>
-                        <Stepper v-model="formData.OrderQty" min="0.0" :auto-fixed="false" integer theme="round" />
+                        <app-stepper v-model="formData.OrderQty" :min="0" />
                     </template>
                 </Field>
-                <Cell title="开仓价值" :value="formatDecimal(openAmount)+enumName" />
+                <Cell title="开仓价值" :value="formatDecimal(openAmount) + enumName" />
             </CellGroup>
-            <CellGroup>
+            <CellGroup inset>
                 <Cell title="可用余额" :value="calculations.availableBalance" />
                 <Cell title="可开数量" :value="calculations.sellQty" />
                 <Cell title="预估手续费" :value="formatDecimal(serivcefee)" />
@@ -118,7 +116,9 @@
         </Form>
         <Row class="g-layout-block g-layout-block--inset">
             <Col span="24">
-            <Button :type="formData.BuyOrSell === BuyOrSell.Buy ? 'success' : 'danger' " block @click="formRef?.submit">{{ formData.BuyOrSell === BuyOrSell.Buy ? '开多' : '开空' }}{{ goods?.goodscode }}</Button>
+            <Button :type="formData.BuyOrSell === BuyOrSell.Buy ? 'success' : 'danger'" block
+                @click="formRef?.submit">{{
+                    formData.BuyOrSell === BuyOrSell.Buy ? '开多' : '开空' }}{{ goods?.goodscode }}</Button>
             </Col>
         </Row>
         <Tabs v-model:active="tabIndex">
@@ -136,7 +136,7 @@
 </template>
 
 <script lang="ts" setup>
-import { shallowRef, computed, onMounted } from 'vue'
+import { shallowRef, computed, onMounted, onActivated } from 'vue'
 import { Form, FormInstance, Button, CellGroup, Field, Cell, Tab, Tabs, FieldRule, Col, Row, Slider, Checkbox } from 'vant'
 import { EPriceMode, EValidType, EOrderOperateType, EBuildType } from '@/constants/client'
 import { formatDecimal, parsePercent } from '@/filters'
@@ -146,12 +146,12 @@ import { fullloading, dialog } from '@/utils/vant'
 import { useOrder } from '@/business/trade'
 import { BuyOrSell, getGoodsCurrencyItemName } from '@/constants/order'
 import AppSelect from '@mobile/components/base/select/index.vue'
+import AppStepper from '@mobile/components/base/stepper/index.vue'
 import ContractPosition from '../../components/position/index.vue'
 import ContractOrder from '../../components/order/index.vue'
 import ContractAccount from '../../components/account/index.vue'
-import Stepper from '@mobile/components/base/stepper/index.vue'
 
-const { router, getQueryStringToNumber } = useNavigation()
+const { router, getQueryStringToNumber, getGlobalUrlParams } = useNavigation()
 const goodsId = getQueryStringToNumber('id')
 const futuresStore = useFuturesStore()
 const tabIndex = shallowRef(0)
@@ -169,7 +169,7 @@ const sliderStep = 0.01 // 滑块步长
 
 const { getSBYJMyOrders } = useSBYJOrderStore()
 const quote = computed(() => futuresStore.getQuoteInfo({ goodsid: goodsId }))
-const goods = computed(() => futuresStore.getGoods(goodsId ?? 0 )) ?? {}
+const goods = computed(() => futuresStore.getGoods(goodsId ?? 0)) ?? {}
 
 const options = computed(() => {
     return [{
@@ -300,7 +300,7 @@ const serivcefee = computed(() => {
 // 保证金设置(固定) 时:可开数量 = 可用余额 / (合约乘数 * 固定值)
 // 保证金设置(比率) 时:可开数量 = 可用余额 / (价格 * 合约乘数 * 比率值)
 const calculations = computed(() => {
-    
+
     const { last = 0, agreeunit = 0 } = quote.value ?? {}
     const { OrderPrice = 0, OrderQty = 0 } = formData
 
@@ -351,14 +351,14 @@ const openAmount = computed(() => {
     const orderQty = formData.OrderQty ?? 0.0
     if (formData.PriceMode === EPriceMode.PRICEMODE_MARKET) {
         const price = (formData.BuyOrSell === BuyOrSell.Buy ? quote.value?.ask : quote.value?.bid) ?? 0.0
-        return price*orderQty*agreeunit
+        return price * orderQty * agreeunit
     } else {
         const price = formData.OrderPrice ?? 0.0
-        return price*orderQty*agreeunit
+        return price * orderQty * agreeunit
     }
 })
 
-const buyOrSell = ( item: BuyOrSell) => {
+const buyOrSell = (item: BuyOrSell) => {
     formData.BuyOrSell = item
 }
 
@@ -448,6 +448,13 @@ onMounted(() => {
             stopLossRatio.value = slratiodefault * 100
         }
     }
+
+    onActivated(() => {
+        const params = getGlobalUrlParams()
+        if (params.buyOrSell !== undefined) {
+            formData.BuyOrSell = params.buyOrSell
+        }
+    })
 })
 </script>
 

+ 3 - 3
src/packages/digital/views/spot/goods/chart/index.vue

@@ -1,7 +1,7 @@
 <template>
     <app-view class="spot-goods-chart g-layout">
         <template #header>
-            <app-navbar :title="quote?.goodscode" />
+            <app-navbar :title="quote ? quote.goodscode : '图表'" />
         </template>
         <template v-if="quote">
             <div class="quote-table">
@@ -13,8 +13,8 @@
                                     <h2>{{ handleNumberValue(quote.last.toFixed(quote.decimalplace)) }}</h2>
                                 </div>
                                 <div>
-                                    <span>{{ quote.rise.toFixed(quote.decimalplace) }}</span>
-                                    <span>{{ parsePercent(quote.change) }}</span>
+                                    <span :class="quote.lastColor">{{ quote.rise.toFixed(quote.decimalplace) }}</span>
+                                    <span :class="quote.lastColor">{{ parsePercent(quote.change) }}</span>
                                 </div>
                             </td>
                             <td class="data-table__cell">

+ 7 - 10
src/packages/digital/views/spot/goods/detail/index.vue

@@ -1,17 +1,14 @@
 <template>
     <app-view class="sopt-goods-detail g-layout g-form">
         <template #header>
-            <app-navbar title="交易">
+            <app-navbar :title="quote ? quote.goodscode : '交易'">
                 <template #footer>
                     <Cell>
-                        <template #title>
-                            <b>{{ quote?.goodscode }}</b>
-                        </template>
-                        <template #label>
-                            <div style="display: flex; align-items: center; gap: 10px;">
-                                <h2 :class="quote?.lastColor">{{ quote?.last }}</h2>
-                                <span>{{ parsePercent(quote?.change) }}</span>
-                            </div>
+                        <template #title v-if="quote">
+                            <h3 :class="quote.lastColor">
+                                <span>{{ quote.last }}</span>
+                            </h3>
+                            <span :class="quote.lastColor">{{ parsePercent(quote.change) }}</span>
                         </template>
                         <template #right-icon>
                             <span @click="navigateToGoodsChart">图表</span>
@@ -204,7 +201,7 @@ const onSubmit = () => {
         })
     } else {
         showDialog({
-            message: '请先激活数字账户'
+            message: '请先激活资金账户'
         }).then(() => {
             tabIndex.value = 1
         })

+ 0 - 12
src/packages/mobile/assets/themes/base/reset.less

@@ -45,18 +45,6 @@ body {
         }
     }
 
-    p,
-    label,
-    h1,
-    h2,
-    h3,
-    h4,
-    h5,
-    h6 {
-        margin: 0;
-        font-weight: normal;
-    }
-
     img {
         border: 0;
         max-width: 100%;