li.shaoyi il y a 2 semaines
Parent
commit
f03e29e4bd

+ 37 - 9
src/packages/digital/assets/themes/global/global.less

@@ -81,7 +81,7 @@
     table {
         width: 100%;
         border-bottom: 1px solid #171f2d;
-        padding: 10px;
+        padding: 10px 12px;
 
         td,
         th {
@@ -135,18 +135,29 @@
 }
 
 .g-detail-list {
-    line-height: 1.6;
-
-    dl {
+    table {
+        width: 100%;
+        line-height: 1.7;
         border-bottom: 1px solid #171f2d;
-        padding: 10px var(--van-padding-md);
+        padding: 10px 12px;
 
-        dd {
-            display: flex;
-            align-items: center;
-            justify-content: space-between;
+        tbody {
             font-size: 13px;
         }
+
+        td {
+            &:last-child {
+                text-align: right;
+            }
+
+            button {
+                min-width: 60px;
+
+                &+button {
+                    margin-left: 10px;
+                }
+            }
+        }
     }
 
     .text-small {
@@ -196,4 +207,21 @@
             }
         }
     }
+}
+
+.g-tabs {
+    --van-tabs-nav-background: transparent;
+    --van-tab-active-text-color: var(--color-primary);
+
+    .van-tabs {
+        &__line {
+            display: none;
+        }
+    }
+
+    .van-tab {
+        &--active {
+            --van-tab-font-size: 16px;
+        }
+    }
 }

+ 36 - 41
src/packages/digital/views/contract/components/position/detail/index.vue

@@ -1,60 +1,55 @@
 <template>
-    <app-pull-refresh ref="pullRefreshRef" class="g-detail-table" v-model:loading="loading" @refresh="onRefresh">
-        <table cellspacing="0" cellpadding="0" v-for="(item, index) in tableList" :key="index">
-            <tbody>
+    <app-pull-refresh ref="pullRefreshRef" class="g-detail-list" v-model:loading="loading" @refresh="onRefresh">
+        <table v-for="(item, index) in tableList" :key="index">
+            <thead>
                 <tr>
-                    <th colspan="2">
-                        <span>{{ item.goodscode }}/{{ item.goodsname }}</span>
-                        <time class="text-small">{{ formatDate(item.tradetime) }}</time>
-                    </th>
-                    <th>
-                        <span :class="item.buyorsell === 0 ? 'g-price-up' : 'g-price-down'">
-                            {{ getBuyOrSellName(item.buyorsell, 1) }}
-                        </span>
-                    </th>
+                    <td>
+                        {{ item.goodscode }}/{{ item.goodsname }}
+                    </td>
+                    <td :class="item.buyorsell === 0 ? 'g-price-up' : 'g-price-down'">
+                        {{ getBuyOrSellName(item.buyorsell, 1) }}
+                    </td>
                 </tr>
+            </thead>
+            <tbody>
                 <tr>
-                    <td colspan="3">
-                        <span class="text-small">{{ $t('account.profitLoss') + `(${currency(item.currencyid)})`
-                        }}</span>
-                        <span :class="item.profitLossClass">
-                            {{ item.profitLoss.toFixed(item.decimalplace) }}
-                        </span>
+                    <td class="text-small">
+                        {{ $t('account.profitLoss') + `(${currency(item.currencyid)})` }}
+                    </td>
+                    <td :class="item.profitLossClass">
+                        <b>{{ formatDecimal(item.profitLoss, item.decimalplace) }}</b>
                     </td>
                 </tr>
                 <tr>
-                    <td>
-                        <span class="text-small">{{ $t('position.goods.enableqty') + `(${item.goodscode})` }}</span>
-                        <span>
-                            {{ item.holderqty - item.freezeqty }}
-                        </span>
-                    </td>
-                    <td>
-                        <span class="text-small">{{ $t('position.goods.holderqty') + `(${item.goodscode})` }}</span>
-                        <span>{{ item.holderqty }}</span>
+                    <td class="text-small">
+                        {{ $t('position.goods.enableqty') + `(${item.goodscode})` }}
                     </td>
                     <td>
-                        <span class="text-small">{{ $t('position.goods.frozenqty') + `(${item.goodscode})` }}</span>
-                        <span>{{ item.freezeqty }}</span>
+                        {{ item.holderqty - item.freezeqty }}
                     </td>
                 </tr>
                 <tr>
-                    <td>
-                        <span class="text-small">{{ $t('position.goods.holderprice') + `(${currency(item.currencyid)})`
-                            }}</span>
-                        <span>{{ item.holderprice }}</span>
-                    </td>
-                    <td>
-                        <span class="text-small">{{ $t('position.goods.holderamount') + `(${currency(item.currencyid)})`
-                            }}</span>
-                        <span>{{ item.holderamount }}</span>
+                    <td class="text-small">
+                        {{ $t('position.goods.holderprice') + `(${currency(item.currencyid)})` }}
                     </td>
-                    <td></td>
+                    <td>{{ item.holderprice }}</td>
+                </tr>
+                <tr v-if="item.tpsl_tpflag">
+                    <td class="text-small">止盈价格</td>
+                    <td>{{ formatDecimal(item.tpsl_tpprice, item.decimalplace) }}</td>
+                </tr>
+                <tr v-if="item.tpsl_slflag">
+                    <td class="text-small">止损价格</td>
+                    <td>{{ formatDecimal(item.tpsl_slprice, item.decimalplace) }}</td>
+                </tr>
+                <tr>
+                    <td class="text-small">交易时间</td>
+                    <td>{{ formatDate(item.tradetime) }}</td>
                 </tr>
             </tbody>
             <tfoot>
                 <tr>
-                    <td colspan="3">
+                    <td colspan="2">
                         <Button size="small" @click="showComponent('Close', index)">
                             {{ $t('operation.close') }}
                         </Button>
@@ -77,7 +72,7 @@
 <script lang="ts" setup>
 import { shallowRef, PropType, defineAsyncComponent, computed, onUnmounted } from 'vue'
 import { Button } from 'vant'
-import { formatDate } from '@/filters'
+import { formatDate, formatDecimal } from '@/filters'
 import { getBuyOrSellName, getGoodsCurrencyItemName } from '@/constants/order'
 import { useRequest } from '@/hooks/request'
 import { useComponent } from '@/hooks/component'

+ 14 - 9
src/packages/digital/views/contract/components/position/detail/tpsl/index.vue

@@ -1,6 +1,6 @@
 <!-- 任务 #7273 -->
 <template>
-    <app-modal direction="right-top" height="100%" width="100%" v-model:show="showModal">
+    <app-modal direction="right-top" height="100%" width="100%" v-model:show="showModal" :refresh="refresh">
         <app-view class="g-form">
             <template #header>
                 <app-navbar title="止盈止损" @back="closed" />
@@ -101,6 +101,7 @@ const props = defineProps({
 const { global: { t } } = i18n
 const futuresStore = useFuturesStore()
 const formRef = shallowRef<FormInstance>()
+const refresh = shallowRef(false)
 const showModal = shallowRef(true)
 
 const formData = reactive<Partial<Proto.HolderTPSLSetReq>>({
@@ -160,8 +161,8 @@ const formRules: { [key: string]: FieldRule[] } = {
         validator: () => {
             if (formData.TPFlag) {
                 const { takeProfit } = pricePoints.value
-                const value = Number(formData.TPPrice)
-                const isInvalid = props.selectedRow.buyorsell === BuyOrSell.Buy ? value < takeProfit.toNumber() : value > takeProfit.toNumber()
+                const value = Decimal(formData.TPPrice ?? 0)
+                const isInvalid = props.selectedRow.buyorsell === BuyOrSell.Buy ? value.lt(takeProfit) : value.gt(takeProfit)
                 return isInvalid ? '价格不在有效范围内' : true
             }
             return true
@@ -172,8 +173,8 @@ const formRules: { [key: string]: FieldRule[] } = {
         validator: () => {
             if (formData.SLFlag) {
                 const { stopLoss } = pricePoints.value
-                const value = Number(formData.SLPrice)
-                const isInvalid = props.selectedRow.buyorsell === BuyOrSell.Buy ? value > stopLoss.toNumber() : value < stopLoss.toNumber()
+                const value = Decimal(formData.SLPrice ?? 0)
+                const isInvalid = props.selectedRow.buyorsell === BuyOrSell.Buy ? value.gt(stopLoss) : value.lt(stopLoss)
                 return isInvalid ? '价格不在有效范围内' : true
             }
             return true
@@ -194,7 +195,7 @@ const onCloseSumit = () => {
                 data: formData
             }).then(() => {
                 hideLoading(t('common.submitsuccess'), 'success')
-                closed()
+                closed(true)
             }).catch((err) => {
                 hideLoading(err, 'fail')
             })
@@ -203,13 +204,17 @@ const onCloseSumit = () => {
 }
 
 // 关闭弹窗
-const closed = () => {
+const closed = (isRefresh = false) => {
+    refresh.value = isRefresh
     showModal.value = false
 }
 
 onMounted(() => {
-    formData.TPPrice = Number(props.selectedRow.tpsl_tpprice) || pricePoints.value.takeProfit.toNumber()
-    formData.SLPrice = Number(props.selectedRow.tpsl_slprice) || pricePoints.value.stopLoss.toNumber()
+    const tpPrice = props.selectedRow.tpsl_tpprice || pricePoints.value.takeProfit
+    const slPrice = props.selectedRow.tpsl_slprice || pricePoints.value.stopLoss
+
+    formData.TPPrice = Decimal(tpPrice).toNumber()
+    formData.SLPrice = Decimal(slPrice).toNumber()
 })
 
 // 暴露组件属性给父组件调用

+ 18 - 16
src/packages/digital/views/contract/components/statement/history/index.vue

@@ -1,22 +1,24 @@
 <template>
     <app-pull-refresh ref="pullRefreshRef" class="g-detail-list" v-model:loading="loading" v-model:pageIndex="pageIndex"
         :page-count="pageCount" @refresh="onRefresh">
-        <dl v-for="(item, index) in dataList" :key="index">
-            <dd>
-                <span class="text-small">{{ t('banksign.capital.amount') }}</span>
-                <span :class="item.amount > 0 ? 'g-price-up' : 'g-price-down'">
-                    <b>{{ (item.amount > 0 ? '+' : '') + item.amount }}</b>
-                </span>
-            </dd>
-            <dd>
-                <span class="text-small">{{ t('banksign.capital.operatetypename') }}</span>
-                <span>{{ getEnumName(item) }}</span>
-            </dd>
-            <dd>
-                <span class="text-small">{{ t('banksign.capital.createtime') }}</span>
-                <span>{{ formatDate(item.createtime) }}</span>
-            </dd>
-        </dl>
+        <table v-for="(item, index) in dataList" :key="index">
+            <tbody>
+                <tr>
+                    <td class="text-small">{{ t('banksign.capital.amount') }}</td>
+                    <td :class="item.amount > 0 ? 'g-price-up' : 'g-price-down'">
+                        <b>{{ (item.amount > 0 ? '+' : '') + item.amount }}</b>
+                    </td>
+                </tr>
+                <tr>
+                    <td class="text-small">{{ t('banksign.capital.operatetypename') }}</td>
+                    <td>{{ getEnumName(item) }}</td>
+                </tr>
+                <tr>
+                    <td class="text-small">{{ t('banksign.capital.createtime') }}</td>
+                    <td>{{ formatDate(item.createtime) }}</td>
+                </tr>
+            </tbody>
+        </table>
     </app-pull-refresh>
 </template>
 

+ 2 - 2
src/packages/digital/views/contract/components/statement/index.vue

@@ -12,9 +12,9 @@
                 </tr>
             </tbody>
         </table>
-        <statement-history ref="historyRef" :params="historyParams" v-if="checked" />
-        <statement-list :params="listParams" v-else />
     </div>
+    <statement-history ref="historyRef" :params="historyParams" v-if="checked" />
+    <statement-list :params="listParams" v-else />
 </template>
 
 <script lang="ts" setup>

+ 18 - 16
src/packages/digital/views/contract/components/statement/list/index.vue

@@ -1,22 +1,24 @@
 <template>
     <app-pull-refresh ref="pullRefreshRef" class="g-detail-list" v-model:loading="loading" v-model:pageIndex="pageIndex"
         :page-count="pageCount" @refresh="onRefresh">
-        <dl v-for="(item, index) in dataList" :key="index">
-            <dd>
-                <span class="text-small">{{ t('banksign.capital.amount') }}</span>
-                <span :class="item.amount > 0 ? 'g-price-up' : 'g-price-down'">
-                    <b>{{ (item.amount > 0 ? '+' : '') + item.amount }}</b>
-                </span>
-            </dd>
-            <dd>
-                <span class="text-small">{{ t('banksign.capital.operatetypename') }}</span>
-                <span>{{ getEnumName(item) }}</span>
-            </dd>
-            <dd>
-                <span class="text-small">{{ t('banksign.capital.createtime') }}</span>
-                <span>{{ formatDate(item.createtime) }}</span>
-            </dd>
-        </dl>
+        <table v-for="(item, index) in dataList" :key="index">
+            <tbody>
+                <tr>
+                    <td class="text-small">{{ t('banksign.capital.amount') }}</td>
+                    <td :class="item.amount > 0 ? 'g-price-up' : 'g-price-down'">
+                        <b>{{ (item.amount > 0 ? '+' : '') + item.amount }}</b>
+                    </td>
+                </tr>
+                <tr>
+                    <td class="text-small">{{ t('banksign.capital.operatetypename') }}</td>
+                    <td>{{ getEnumName(item) }}</td>
+                </tr>
+                <tr>
+                    <td class="text-small">{{ t('banksign.capital.createtime') }}</td>
+                    <td>{{ formatDate(item.createtime) }}</td>
+                </tr>
+            </tbody>
+        </table>
     </app-pull-refresh>
 </template>
 

+ 25 - 23
src/packages/digital/views/spot/components/statement/index.vue

@@ -9,31 +9,33 @@
                 </tr>
             </tbody>
         </table>
-        <app-pull-refresh ref="pullRefreshRef" class="g-detail-list" v-model:loading="loading" v-model:pageIndex="pageIndex"
-            :page-count="pageCount" @refresh="onRefresh">
-            <dl v-for="(item, index) in dataList" :key="index">
-                <dd>
-                    <span class="text-small">金额</span>
-                    <span :class="item.changevalue > 0 ? 'g-price-up' : 'g-price-down'">
+    </div>
+    <app-pull-refresh ref="pullRefreshRef" class="g-detail-list" v-model:loading="loading" v-model:pageIndex="pageIndex"
+        :page-count="pageCount" @refresh="onRefresh">
+        <table v-for="(item, index) in dataList" :key="index">
+            <tbody>
+                <tr>
+                    <td class="text-small">金额</td>
+                    <td :class="item.changevalue > 0 ? 'g-price-up' : 'g-price-down'">
                         <b>{{ (item.changevalue > 0 ? '+' : '') + item.changevalue }}</b> {{
                             getDigitalCurrencyName(item.currencyid) }}
-                    </span>
-                </dd>
-                <dd>
-                    <span class="text-small">业务类型</span>
-                    <span>{{ getDigitalBusinessCodeName(item.digitalbusinesscode) }}</span>
-                </dd>
-                <dd>
-                    <span class="text-small">操作类型</span>
-                    <span>{{ getDigitalOperateTypeName(item.digitaloperatetype) }}</span>
-                </dd>
-                <dd>
-                    <span class="text-small">日期</span>
-                    <span>{{ item.tradedate }}</span>
-                </dd>
-            </dl>
-        </app-pull-refresh>
-    </div>
+                    </td>
+                </tr>
+                <tr>
+                    <td class="text-small">业务类型</td>
+                    <td>{{ getDigitalBusinessCodeName(item.digitalbusinesscode) }}</td>
+                </tr>
+                <tr>
+                    <td class="text-small">操作类型</td>
+                    <td>{{ getDigitalOperateTypeName(item.digitaloperatetype) }}</td>
+                </tr>
+                <tr>
+                    <td class="text-small">日期</td>
+                    <td>{{ item.tradedate }}</td>
+                </tr>
+            </tbody>
+        </table>
+    </app-pull-refresh>
 </template>
 
 <script lang="ts" setup>