li.shaoyi vor 2 Jahren
Ursprung
Commit
d4036d80e9

+ 14 - 14
src/packages/mobile/views/goods/detail/Index.vue

@@ -13,10 +13,10 @@
             </app-navbar>
         </template>
         <app-pull-refresh ref="pullRefreshRef" v-model:loading="loading" v-model:error="error" v-model:pageIndex="pageIndex"
-            :page-count="pageCount" @refresh="onTabChange">
-            <Tabs v-model:active="tabIndex" @click="onChange">
-                <Tab title="买大厅" />
-                <Tab title="卖大厅" />
+            :page-count="pageCount" @refresh="onRefresh">
+            <Tabs v-model:active="tabIndex" @click="onTabChange">
+                <Tab title="买大厅" :name="BuyOrSell.Buy" />
+                <Tab title="卖大厅" :name="BuyOrSell.Sell" />
             </Tabs>
             <div class="trade-section sell" v-if="dataList.length">
                 <app-list :columns="columns" :data-list="dataList">
@@ -24,8 +24,9 @@
                         <span>{{ row.userid }}/{{ row.username }}</span>
                     </template>
                     <template #operate="{ row }">
-                        <Button size="small" type="primary" round @click="onDelisting(row)">{{ tabIndex === 0 ? '卖出' : '买入'
-                        }}</Button>
+                        <Button size="small" type="primary" round @click="onDelisting(row)">
+                            {{ tabIndex === BuyOrSell.Buy ? '卖出' : '买入' }}
+                        </Button>
                     </template>
                 </app-list>
             </div>
@@ -41,6 +42,7 @@ import { Tab, Tabs, Button, showToast } from 'vant'
 import { useRequest } from '@/hooks/request'
 import { useNavigation } from '@/hooks/navigation'
 import { useComponent } from '@/hooks/component'
+import { BuyOrSell } from '@/constants/order'
 import { queryWrTradeOrderDetail } from '@/services/api/transfer'
 import { useLoginStore, useFuturesStore } from '@/stores'
 import AppQuote from '@mobile/components/modules/quote/index.vue'
@@ -56,14 +58,15 @@ const componentMap = new Map<string, unknown>([
 const loginStore = useLoginStore()
 
 const { getParamString } = useNavigation()
-const { componentRef, componentId, openComponent, closeComponent } = useComponent()
 const item: Model.QuoteGoodsListRsp = JSON.parse(getParamString('item')?.toString() || '{}')
-const tabIndex = shallowRef(0)
+const tabIndex = shallowRef(BuyOrSell.Buy)
 const selectedRow = shallowRef<Model.WrTradeOrderDetailRsp>()
 const error = shallowRef(false)
 const dataList = shallowRef<Model.WrTradeOrderDetailRsp[]>([])
 const quote = futuresStore.getQuoteInfo(item.goodscode)
 
+const { componentRef, componentId, openComponent, closeComponent } = useComponent(() => onTabChange())
+
 const { pageIndex, loading, run, pageCount } = useRequest(queryWrTradeOrderDetail, {
     params: {
         pagesize: 20,
@@ -81,19 +84,16 @@ const { pageIndex, loading, run, pageCount } = useRequest(queryWrTradeOrderDetai
     }
 })
 
-const onTabChange = () => {
+const onRefresh = () => {
     run({
         buyorsell: tabIndex.value,
     })
 }
 
-const onChange = () => {
+const onTabChange = () => {
     /// 重置为1
     pageIndex.value = 1
-    run({
-        buyorsell: tabIndex.value,
-        page: 1
-    })
+    onRefresh()
 }
 
 const columns: Model.TableColumn[] = [

+ 7 - 0
src/packages/mobile/views/order/list/Index.vue

@@ -64,7 +64,9 @@ const componentMap = new Map<string, unknown>([
     ['goodsorder', defineAsyncComponent(() => import('./components/goodsorder/list/Index.vue'))], // 订单委托
     ['goodstrade', defineAsyncComponent(() => import('./components/goodstrade/list/Index.vue'))], // 订单成交
     ['transferorder', defineAsyncComponent(() => import('./components/transferorder/list/Index.vue'))], // 转让委托
+    ['histransferorder', defineAsyncComponent(() => import('./components/transferorder/history/index.vue'))], // 历史转让委托
     ['transfertrade', defineAsyncComponent(() => import('./components/transfertrade/list/Index.vue'))], // 转让成交
+    ['histransfertrade', defineAsyncComponent(() => import('./components/transfertrade/history/index.vue'))], // 历史转让委托
     ['hisswaporder', defineAsyncComponent(() => import('./components/hisswaporder/list/Index.vue'))], // 历史掉期委托
     ['hisswaptrade', defineAsyncComponent(() => import('./components/hisswaptrade/list/Index.vue'))], // 历史掉期成交
     ['hisgoodsorder', defineAsyncComponent(() => import('./components/hisgoodsorder/list/Index.vue'))], // 历史订单委托
@@ -84,6 +86,11 @@ const onMoreClick = () => {
             break
         }
         case 1: {
+            showComponent('histransferorder')
+            break
+        }
+        case 2: {
+            showComponent('histransfertrade')
             break
         }
         case 3: {

+ 128 - 0
src/packages/mobile/views/order/list/components/transferorder/history/index.vue

@@ -0,0 +1,128 @@
+<!-- 我的订单-转让委托-历史 -->
+<template>
+    <app-modal direction="right" height="100%" v-model:show="showModal">
+        <app-view class="g-form">
+            <template #header>
+                <app-navbar title="历史转让委托" @back="closed">
+                    <template #footer>
+                        <Cell title="查询日期" :value="dateRange.join('-')" @click="showCalendar = true" is-link />
+                    </template>
+                </app-navbar>
+            </template>
+            <app-pull-refresh ref="pullRefreshRef" v-model:loading="loading" v-model:error="error"
+                v-model:pageIndex="pageIndex" :page-count="pageCount" @refresh="onRefresh">
+                <div class="g-order-list">
+                    <div class="g-order-list__box" v-for="(item, index) in dataList" :key="index">
+                        <div class="g-order-list__titlebar">
+                            <div class="left">
+                                <h4>{{ item.goodsname }}</h4>
+                                <span>{{ item.orderid }}</span>
+                            </div>
+                        </div>
+                        <div class="g-order-list__content">
+                            <ul>
+                                <li>
+                                    <span>转让数量</span>
+                                    <span>{{ item.orderqty }}</span>
+                                </li>
+                                <li>
+                                    <span>转让价</span>
+                                    <span>{{ item.orderprice }}</span>
+                                </li>
+                                <li>
+                                    <span>摘牌数量</span>
+                                    <span>{{ item.tradeqty }}</span>
+                                </li>
+                                <li>
+                                    <span>订货价</span>
+                                    <span>{{ item.presaleprice }}</span>
+                                </li>
+                            </ul>
+                        </div>
+                        <div class="g-order-list__btnbar">
+                            <Button size="small" @click="showComponent(item)" round>详情</Button>
+                        </div>
+                    </div>
+                </div>
+            </app-pull-refresh>
+            <Calendar v-model:show="showCalendar" type="range" :max-date="new Date()"
+                :min-date="moment().subtract(1, 'years').toDate()" @confirm="onConfirm" />
+            <component ref="componentRef" v-bind="{ selectedRow }" :is="componentMap.get(componentId)"
+                @closed="closeComponent" v-if="componentId" />
+        </app-view>
+    </app-modal>
+</template>
+
+<script lang="ts" setup>
+import { shallowRef, ref, defineAsyncComponent } from 'vue'
+import { formatDate } from '@/filters'
+import { useRequest } from '@/hooks/request'
+import { queryMineTradeOrders } from '@/services/api/transfer'
+import { useComponent } from '@/hooks/component'
+import { Button, Calendar, Cell } from 'vant'
+import moment from 'moment'
+import AppModal from '@/components/base/modal/index.vue'
+import AppPullRefresh from '@mobile/components/base/pull-refresh/index.vue'
+
+const componentMap = new Map<string, unknown>([
+    ['detail', defineAsyncComponent(() => import('../detail/Index.vue'))],
+])
+
+const dataList = shallowRef<Model.MineTradeOrdersRsp[]>([])
+const selectedRow = shallowRef<Model.MineTradeOrdersRsp>()
+const error = shallowRef(false)
+const pullRefreshRef = shallowRef()
+const showModal = shallowRef(true)
+const showCalendar = shallowRef(false) // 是否显示日期选择器
+const dateRange = ref<string[]>([]) // 日期范围
+
+const { componentRef, componentId, openComponent, closeComponent } = useComponent()
+
+const { loading, pageIndex, pageCount, run } = useRequest(queryMineTradeOrders, {
+    manual: true,
+    params: {
+        pagesize: 20,
+        ishis: true,
+    },
+    onSuccess: (res) => {
+        if (pageIndex.value === 1) {
+            dataList.value = []
+        }
+        dataList.value.push(...res.data)
+    },
+    onError: () => {
+        error.value = true
+    }
+})
+
+const showComponent = (row: Model.MineTradeOrdersRsp) => {
+    selectedRow.value = row
+    openComponent('detail')
+}
+
+// 选择日期
+const onConfirm = ([start, end]: Date[]) => {
+    showCalendar.value = false
+    dateRange.value = [formatDate(start.toISOString(), 'YYYYMMDD'), formatDate(end.toISOString(), 'YYYYMMDD')]
+    pageIndex.value = 1
+    pullRefreshRef.value?.refresh()
+}
+
+const onRefresh = () => {
+    const [begindate, enddate] = dateRange.value
+    run({
+        begindate,
+        enddate,
+    })
+}
+
+// 关闭弹窗
+const closed = () => {
+    showModal.value = false
+}
+
+// 暴露组件属性给父组件调用
+defineExpose({
+    closed,
+})
+</script>

+ 1 - 1
src/packages/mobile/views/order/list/components/transfertrade/detail/Index.vue

@@ -12,7 +12,7 @@
                     <Cell title="转让数量" :value="selectedRow.tradeqty" />
                     <Cell title="转让价" :value="selectedRow.tradeprice" />
                     <Cell title="订货价" :value="selectedRow.presaleprice" />
-                    <Cell title="损益" :value="selectedRow.premium" />
+                    <Cell title="损益" :value="selectedRow.closepl" />
                     <Cell title="对手方" :value="selectedRow.accountname" />
                     <Cell title="成交时间" :value="selectedRow.tradedate" />
                     <Cell title="成交单号" :value="selectedRow.orderid" />

+ 136 - 0
src/packages/mobile/views/order/list/components/transfertrade/history/index.vue

@@ -0,0 +1,136 @@
+<!-- 我的订单-转让成交-历史 -->
+<template>
+    <app-modal direction="right" height="100%" v-model:show="showModal">
+        <app-view class="g-form">
+            <template #header>
+                <app-navbar title="历史转让成交" @back="closed">
+                    <template #footer>
+                        <Cell title="查询日期" :value="dateRange.join('-')" @click="showCalendar = true" is-link />
+                    </template>
+                </app-navbar>
+            </template>
+            <app-pull-refresh ref="pullRefreshRef" v-model:loading="loading" v-model:error="error"
+                v-model:pageIndex="pageIndex" :page-count="pageCount" @refresh="onRefresh">
+                <div class="g-order-list">
+                    <div class="g-order-list__box" v-for="(item, index) in dataList" :key="index">
+                        <div class="g-order-list__titlebar">
+                            <div class="left">
+                                <h4>{{ item.goodsname }}</h4>
+                                <span>{{ item.orderid }}</span>
+                            </div>
+                            <div class="right">
+                                <span>{{ getBuyOrSellName(item.buyorsell) }}</span>
+                            </div>
+                        </div>
+                        <div class="g-order-list__content">
+                            <ul>
+                                <li>
+                                    <span>转让数量</span>
+                                    <span>{{ item.tradeqty }}</span>
+                                </li>
+                                <li>
+                                    <span>转让价</span>
+                                    <span>{{ item.tradeprice }}</span>
+                                </li>
+                                <li>
+                                    <span>订货价</span>
+                                    <span>{{ item.presaleprice }}</span>
+                                </li>
+                                <li>
+                                    <span>损益</span>
+                                    <span>{{ item.closepl }}</span>
+                                </li>
+                                <li>
+                                    <span>成交时间</span>
+                                    <span>{{ formatDate(item.tradetime, 'YYYY-MM-DD') }}</span>
+                                </li>
+                            </ul>
+                        </div>
+                        <div class="g-order-list__btnbar">
+                            <Button size="small" @click="showComponent(item)" round>详情</Button>
+                        </div>
+                    </div>
+                </div>
+            </app-pull-refresh>
+            <Calendar v-model:show="showCalendar" type="range" :max-date="new Date()"
+                :min-date="moment().subtract(1, 'years').toDate()" @confirm="onConfirm" />
+            <component ref="componentRef" v-bind="{ selectedRow }" :is="componentMap.get(componentId)"
+                @closed="closeComponent" v-if="componentId" />
+        </app-view>
+    </app-modal>
+</template>
+
+<script lang="ts" setup>
+import { shallowRef, ref, defineAsyncComponent } from 'vue'
+import { formatDate } from '@/filters'
+import { useRequest } from '@/hooks/request'
+import { queryMineTradeTradeDetails } from '@/services/api/transfer'
+import { getBuyOrSellName } from '@/constants/order'
+import { useComponent } from '@/hooks/component'
+import { Button, Calendar, Cell } from 'vant'
+import moment from 'moment'
+import AppModal from '@/components/base/modal/index.vue'
+import AppPullRefresh from '@mobile/components/base/pull-refresh/index.vue'
+
+const componentMap = new Map<string, unknown>([
+    ['detail', defineAsyncComponent(() => import('../detail/Index.vue'))],
+])
+
+const dataList = shallowRef<Model.MineTradeTradeDetailsRsp[]>([])
+const selectedRow = shallowRef<Model.MineTradeTradeDetailsRsp>()
+const error = shallowRef(false)
+const pullRefreshRef = shallowRef()
+const showModal = shallowRef(true)
+const showCalendar = shallowRef(false) // 是否显示日期选择器
+const dateRange = ref<string[]>([]) // 日期范围
+
+const { componentRef, componentId, openComponent, closeComponent } = useComponent()
+
+const { loading, pageIndex, pageCount, run } = useRequest(queryMineTradeTradeDetails, {
+    manual: true,
+    params: {
+        pagesize: 20,
+        ishis: true,
+    },
+    onSuccess: (res) => {
+        if (pageIndex.value === 1) {
+            dataList.value = []
+        }
+        dataList.value.push(...res.data)
+    },
+    onError: () => {
+        error.value = true
+    }
+})
+
+const showComponent = (row: Model.MineTradeTradeDetailsRsp) => {
+    selectedRow.value = row
+    openComponent('detail')
+}
+
+// 选择日期
+const onConfirm = ([start, end]: Date[]) => {
+    showCalendar.value = false
+    dateRange.value = [formatDate(start.toISOString(), 'YYYYMMDD'), formatDate(end.toISOString(), 'YYYYMMDD')]
+    pageIndex.value = 1
+    pullRefreshRef.value?.refresh()
+}
+
+const onRefresh = () => {
+    const [begindate, enddate] = dateRange.value
+    run({
+        begindate,
+        enddate,
+    })
+}
+
+// 关闭弹窗
+const closed = () => {
+    showModal.value = false
+}
+
+// 暴露组件属性给父组件调用
+defineExpose({
+    closed,
+})
+</script>

+ 1 - 1
src/packages/mobile/views/order/list/components/transfertrade/list/Index.vue

@@ -33,7 +33,7 @@
                         </li>
                         <li>
                             <span>成交时间</span>
-                            <span>{{ item.tradetime }}</span>
+                            <span>{{ formatDate(item.tradetime, 'YYYY-MM-DD') }}</span>
                         </li>
                     </ul>
                 </div>

+ 3 - 3
src/packages/mobile/views/order/position/components/transfer/delivery/trade/Index.vue

@@ -11,8 +11,8 @@
                     <Cell title="升贴水" :value="discount.toFixed(2)" />
                     <Cell title="数量" :value="detail.avalidqty" />
                     <Cell title="总货款" :value="payment.toFixed(2)" />
-                    <Cell title="剩余货款" :value="available.toFixed(2)" />
                     <Cell title="已付定金" :value="deposit.toFixed(2)" />
+                    <Cell title="剩余货款" :value="available.toFixed(2)" />
                     <Field name="DeliveryQty" :rules="formRules.DeliveryQty" label="点选数量">
                         <template #input>
                             <Stepper v-model="formData.DeliveryQty" theme="round" button-size="22"
@@ -76,12 +76,12 @@ const payment = computed(() => {
 
 // 剩余货款
 const available = computed(() => {
-    return payment.value * props.selectedRow.transferdepositratio
+    return payment.value - deposit.value + discount.value
 })
 
 // 已付定金
 const deposit = computed(() => {
-    return payment.value - available.value + discount.value
+    return payment.value * props.selectedRow.transferdepositratio
 })
 
 // 表单验证规则

+ 2 - 1
src/packages/mobile/views/order/position/components/transfer/detail/Index.vue

@@ -15,7 +15,7 @@
                     <Cell title="发售方" :value="selectedRow.sellname" />
                     <Cell title="订货价" :value="selectedRow.presaleprice" />
                     <Cell title="总货款" :value="selectedRow.buycurpositionqty * selectedRow.presaleprice" />
-                    <Cell title="转让订金比例" :value="selectedRow.transferdepositratio" />
+                    <Cell title="转让订金比例" :value="parsePercent(selectedRow.transferdepositratio)" />
                     <Cell title="转让订金" :value="selectedRow.transferdeposit" />
                     <Cell title="未付订金" :value="selectedRow.depositremain" />
                     <Cell title="支付状态" :value="getPayStatusName(selectedRow.paystatus)" />
@@ -29,6 +29,7 @@
 <script lang="ts" setup>
 import { shallowRef, PropType } from 'vue'
 import { CellGroup, Cell } from 'vant'
+import { parsePercent } from '@/filters'
 import { getPayStatusName } from '@/constants/order'
 import AppModal from '@/components/base/modal/index.vue'
 

+ 2 - 2
src/packages/mobile/views/order/position/components/transfer/listing/Index.vue

@@ -19,8 +19,8 @@
                     </Field>
                     <Field name="OrderPrice" :rules="formRules.OrderPrice" label="转让价">
                         <template #input>
-                            <Stepper v-model="formData.OrderPrice" theme="round" :decimal-length="2" :auto-fixed="false"
-                                button-size="22" />
+                            <Stepper v-model="formData.OrderPrice" :default-value="selectedRow.presaleprice" theme="round"
+                                :decimal-length="2" :auto-fixed="false" button-size="22" />
                         </template>
                     </Field>
                     <Field name="OrderQty" :rules="formRules.OrderQty" label="转让数量">

+ 13 - 17
src/packages/mobile/views/swap/detail/Index.vue

@@ -13,10 +13,10 @@
             </app-navbar>
         </template>
         <app-pull-refresh ref="pullRefreshRef" v-model:loading="loading" v-model:error="error" v-model:pageIndex="pageIndex"
-            :page-count="pageCount" @refresh="onTabChange">
-            <Tabs v-model:active="tabIndex" @click="onChange">
-                <Tab title="买大厅" />
-                <Tab title="卖大厅" />
+            :page-count="pageCount" @refresh="onRefresh">
+            <Tabs v-model:active="tabIndex" @click="onTabChange">
+                <Tab title="买大厅" :name="BuyOrSell.Buy" />
+                <Tab title="卖大厅" :name="BuyOrSell.Sell" />
             </Tabs>
             <div class="trade-section sell" v-if="dataList.length">
                 <app-list :columns="columns" :data-list="dataList">
@@ -24,8 +24,9 @@
                         <span>{{ row.userid }}/{{ row.username }}</span>
                     </template>
                     <template #operate="{ row }">
-                        <Button size="small" type="primary" round @click="onDelisting(row)">{{ tabIndex === 0 ? '卖出' : '买入'
-                        }}</Button>
+                        <Button size="small" type="primary" round @click="onDelisting(row)">
+                            {{ tabIndex === BuyOrSell.Buy ? '卖出' : '买入' }}
+                        </Button>
                     </template>
                 </app-list>
             </div>
@@ -41,6 +42,7 @@ import { Tab, Tabs, Button, showToast } from 'vant'
 import { useRequest } from '@/hooks/request'
 import { useNavigation } from '@/hooks/navigation'
 import { useComponent } from '@/hooks/component'
+import { BuyOrSell } from '@/constants/order'
 import { queryTjmdTradeOrderDetail } from '@/services/api/swap'
 import { useLoginStore } from '@/stores'
 import AppPullRefresh from '@mobile/components/base/pull-refresh/index.vue'
@@ -53,18 +55,15 @@ const componentMap = new Map<string, unknown>([
 ])
 const pullRefreshRef = shallowRef()
 const loginStore = useLoginStore()
-
 const { getParamString } = useNavigation()
-const { componentRef, componentId, openComponent, closeComponent } = useComponent(() => {
-    pullRefreshRef.value?.refresh()
-})
-
 const item: Model.QuoteGoodsListRsp = JSON.parse(getParamString('item')?.toString() || '{}')
 const tabIndex = shallowRef(0)
 const selectedRow = shallowRef<Model.TjmdTradeOrderDetailRsp>()
 const error = shallowRef(false)
 const dataList = shallowRef<Model.TjmdTradeOrderDetailRsp[]>([])
 
+const { componentRef, componentId, openComponent, closeComponent } = useComponent(() => onTabChange())
+
 const { pageIndex, loading, run, pageCount } = useRequest(queryTjmdTradeOrderDetail, {
     params: {
         pagesize: 20,
@@ -82,19 +81,16 @@ const { pageIndex, loading, run, pageCount } = useRequest(queryTjmdTradeOrderDet
     }
 })
 
-const onTabChange = () => {
+const onRefresh = () => {
     run({
         buyorsell: tabIndex.value,
     })
 }
 
-const onChange = () => {
+const onTabChange = () => {
     /// 重置为1
     pageIndex.value = 1
-    run({
-        buyorsell: tabIndex.value,
-        page: 1
-    })
+    onRefresh()
 }
 
 const columns: Model.TableColumn[] = [

+ 12 - 3
src/packages/mobile/views/transfer/detail/Index.vue

@@ -20,12 +20,20 @@
                     </li>
                     <li>
                         <span>最新价</span>
-                        <span>¥{{ getQuotePrice(detail.goodscode) }}</span>
+                        <span>{{ handleNumberValue(quote?.last) }}</span>
                     </li>
                     <li>
                         <span>转让比例</span>
                         <span>{{ parsePercent(detail.transferdepositratio) }}</span>
                     </li>
+                    <li>
+                        <span>涨停价</span>
+                        <span>{{ handleNumberValue(quote?.limitup) }}</span>
+                    </li>
+                    <li>
+                        <span>跌停价</span>
+                        <span>{{ handleNumberValue(quote?.limitdown) }}</span>
+                    </li>
                 </ul>
             </div>
         </div>
@@ -55,7 +63,7 @@
 
 <script lang="ts" setup>
 import { computed, defineAsyncComponent } from 'vue'
-import { getFileUrl, parsePercent } from '@/filters'
+import { getFileUrl, parsePercent, handleNumberValue } from '@/filters'
 import { useRequest } from '@/hooks/request'
 import { queryPresaleDefault, queryMineTradePositionExs } from '@/services/api/transfer'
 import { useComponent } from '@/hooks/component'
@@ -69,8 +77,9 @@ const componentMap = new Map<string, unknown>([
 
 const { getQueryStringToNumber } = useNavigation()
 const { componentRef, componentId, openComponent, closeComponent } = useComponent()
-const { getQuotePrice } = useFuturesStore()
+const { getQuoteInfo } = useFuturesStore()
 const goodsid = getQueryStringToNumber('goodsid')
+const quote = getQuoteInfo(goodsid)
 
 // 获取转让详情
 const { data: detail } = useRequest(queryPresaleDefault, {

+ 4 - 4
src/stores/modules/futures.ts

@@ -142,14 +142,14 @@ export const useFuturesStore = defineStore(() => {
     }
 
     // 通过 goodscode 获取实时行情信息
-    const getQuoteInfo = (goodscode?: string) => {
-        return computed(() => quoteList.value.find((e) => e.goodscode.toUpperCase() === goodscode?.toUpperCase()))
+    const getQuoteInfo = (code?: string | number) => {
+        return computed(() => quoteList.value.find((e) => e.goodscode === code || e.goodsid === code))
     }
 
     // 通过 goodscode 获取实时行情报价
-    const getQuotePrice = (goodscode?: string) => {
+    const getQuotePrice = (code?: string | number) => {
         return computed(() => {
-            const quote = getQuoteInfo(goodscode)
+            const quote = getQuoteInfo(code)
             return quote.value?.last ?? 0
         })
     }