Browse Source

代码提交

Handy_Cao 2 years ago
parent
commit
f737071fe8

+ 28 - 0
src/packages/mobile/views/order/list/components/hisswaporder/detail/Index.vue

@@ -0,0 +1,28 @@
+<!-- 我的订单- 历史掉期订单 - 详情 -->
+<template>
+    <app-modal direction="right" height="100%" v-model:show="showModal" :refresh="refresh">
+        <app-view class="g-form">
+            <template #header>
+                <app-navbar title="详细" @back="closed" />
+            </template>
+        </app-view>
+    </app-modal>
+</template>
+
+<script lang="ts" setup>
+import { shallowRef } from 'vue'
+
+const showModal = shallowRef(true)
+const refresh = shallowRef(false) // 是否刷新父组件数据
+
+// 关闭弹窗
+const closed = (isRefresh = false) => {
+    refresh.value = isRefresh
+    showModal.value = false
+}
+
+// 暴露组件属性给父组件调用
+defineExpose({
+    closed,
+})
+</script>

+ 12 - 5
src/packages/mobile/views/order/list/components/hisswaporder/list/Index.vue

@@ -12,15 +12,23 @@
                     <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.goodscode }}/{{ item.goodsname }} {{ formatDate(item.ordertime) }})</h4>
+                                <h5>{{ item.goodscode }}/{{ item.goodsname }}</h5>
                             </div>
                             <div class="right">
-                                <span>{{ getBuyOrSellName(item.buyorsell) }}</span>
+                                <span>{{ item.orderid }}</span>
                             </div>
                         </div>
                         <div class="g-order-list__content">
                             <ul>
                                 <li>
+                                    <span>时间:</span>
+                                    <span>{{ formatDate(item.ordertime, 'YY/MM/DD HH:mm:ss') }}</span>
+                                </li>
+                                <li>
+                                    <span>方向:</span>
+                                    <span>{{ getBuyOrSellName(item.buyorsell) }}</span>
+                                </li>
+                                <li>
                                     <span>委托数量:</span>
                                     <span>{{ item.orderqty }}</span>
                                 </li>
@@ -34,12 +42,11 @@
                                 </li>
                                 <li>
                                     <span>委托状态:</span>
-                                    <span>{{ getTHJOrderStatusName(item.orderstatus) }}</span>
+                                    <span>{{ getWRTradeOrderStatusName(item.orderstatus) }}</span>
                                 </li>
                             </ul>
                         </div>
                         <div class="g-order-list__btnbar">
-                            <span>{{ item.orderid }}</span>
                             <Button size="small" @click="showComponent('detail', item)" round>详情</Button>
                         </div>
                     </div>
@@ -57,7 +64,7 @@
 import { shallowRef, ref, reactive, defineAsyncComponent } from 'vue'
 import { useRequest } from '@/hooks/request'
 import { queryHisTradeOrderDetail } from '@/services/api/order'
-import { getBuyOrSellName, getTHJOrderStatusName } from '@/constants/order'
+import { getBuyOrSellName, getWRTradeOrderStatusName } from '@/constants/order'
 import { formatDate } from '@/filters'
 import { useComponent } from '@/hooks/component'
 import { Button, Calendar, Cell } from 'vant'

+ 28 - 0
src/packages/mobile/views/order/list/components/hisswaptrade/detail/Index.vue

@@ -0,0 +1,28 @@
+<!-- 我的持仓- 历史掉期成交 - 平仓 -->
+<template>
+    <app-modal direction="right" height="100%" v-model:show="showModal" :refresh="refresh">
+        <app-view class="g-form">
+            <template #header>
+                <app-navbar title="详细" @back="closed" />
+            </template>
+        </app-view>
+    </app-modal>
+</template>
+
+<script lang="ts" setup>
+import { shallowRef } from 'vue'
+
+const showModal = shallowRef(true)
+const refresh = shallowRef(false) // 是否刷新父组件数据
+
+// 关闭弹窗
+const closed = (isRefresh = false) => {
+    refresh.value = isRefresh
+    showModal.value = false
+}
+
+// 暴露组件属性给父组件调用
+defineExpose({
+    closed,
+})
+</script>

+ 10 - 3
src/packages/mobile/views/order/list/components/hisswaptrade/list/Index.vue

@@ -12,15 +12,23 @@
                     <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.goodscode }}/{{ item.goodsname }} {{ formatDate(item.tradetime) }})</h4>
+                                <h5>{{ item.goodscode }}/{{ item.goodsname }}</h5>
                             </div>
                             <div class="right">
-                                <span>{{ getBuildTypeName(item.buildtype) }} {{ getBuyOrSellName(item.buyorsell) }}</span>
+                                <span>{{ item.tradeid }}</span>
                             </div>
                         </div>
                         <div class="g-order-list__content">
                             <ul>
                                 <li>
+                                    <span>时间:</span>
+                                    <span>{{ formatDate(item.tradetime, 'YY/MM/DD HH:mm:ss') }}</span>
+                                </li>
+                                <li>
+                                    <span>类型:</span>
+                                    <span>{{ getBuildTypeName(item.buildtype) }}{{ getBuyOrSellName(item.buyorsell) }}</span>
+                                </li>
+                                <li>
                                     <span>成交价格:</span>
                                     <span>{{ item.tradeprice }}</span>
                                 </li>
@@ -39,7 +47,6 @@
                             </ul>
                         </div>
                         <div class="g-order-list__btnbar">
-                            <span>{{ item.tradeid }}</span>
                             <Button size="small" @click="showComponent('detail', item)" round>详情</Button>
                         </div>
                     </div>

+ 28 - 0
src/packages/mobile/views/order/list/components/swaporder/detail/Index.vue

@@ -0,0 +1,28 @@
+<!-- 我的订单- 掉期委托 - 详情 -->
+<template>
+    <app-modal direction="right" height="100%" v-model:show="showModal" :refresh="refresh">
+        <app-view class="g-form">
+            <template #header>
+                <app-navbar title="详细" @back="closed" />
+            </template>
+        </app-view>
+    </app-modal>
+</template>
+
+<script lang="ts" setup>
+import { shallowRef } from 'vue'
+
+const showModal = shallowRef(true)
+const refresh = shallowRef(false) // 是否刷新父组件数据
+
+// 关闭弹窗
+const closed = (isRefresh = false) => {
+    refresh.value = isRefresh
+    showModal.value = false
+}
+
+// 暴露组件属性给父组件调用
+defineExpose({
+    closed,
+})
+</script>

+ 17 - 10
src/packages/mobile/views/order/list/components/swaporder/list/Index.vue

@@ -6,36 +6,43 @@
             <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.goodscode }}/{{ item.goodsname }} {{ formatDate(item.ordertime) }})</h4>
+                        <h5>{{ item.goodscode }}/{{ item.goodsname }}</h5>
                     </div>
                     <div class="right">
-                        <span>{{ getBuyOrSellName(item.buyorsell) }}</span>
+                        <span>{{ item.orderid }}</span>
                     </div>
                 </div>
                 <div class="g-order-list__content">
                     <ul>
                         <li>
+                            <span>时间:</span>
+                            <span>{{ formatDate(item.ordertime, 'HH:mm:ss') }}</span>
+                        </li>
+                        <li>
+                            <span>方向:</span>
+                            <span>{{ getBuyOrSellName(item.buyorsell) }}</span>
+                        </li>
+                        <li>
                             <span>委托数量:</span>
-                            <span>{{ item.orderqty }}</span>
+                            <span>{{ formatDecimal(item.orderqty) }}</span>
                         </li>
                         <li>
                             <span>委托价格:</span>
-                            <span>{{ item.orderprice}}</span>
+                            <span>{{ formatDecimal(item.orderprice) }}</span>
                         </li>
                         <li>
                             <span>成交数量:</span>
-                            <span>{{ item.tradeqty }}</span>
+                            <span>{{ formatDecimal(item.tradeqty) }}</span>
                         </li>
                         <li>
                             <span>委托状态:</span>
-                            <span>{{ getTHJOrderStatusName(item.orderstatus) }}</span>
+                            <span>{{ getWRTradeOrderStatusName(item.orderstatus) }}</span>
                         </li>
                     </ul>
                 </div>
                 <div class="g-order-list__btnbar">
-                    <span>{{ item.orderid }}</span>
                     <Button size="small" @click="showComponent('detail', item)" round>详情</Button>
-                    <Button size="small" @click="showComponent('cancel', item)" round>撤销</Button>
+                    <Button size="small" v-if="(item.orderstatus === 3 || item.orderstatus === 7)" @click="showComponent('cancel', item)" round>撤销</Button>
                 </div>
             </div>
         </div>
@@ -51,8 +58,8 @@ import { useComponent } from '@/hooks/component'
 import { useRequest } from '@/hooks/request'
 import { queryTradeOrderDetail } from '@/services/api/order'
 import AppPullRefresh from '@mobile/components/base/pull-refresh/index.vue'
-import { getBuyOrSellName, getTHJOrderStatusName } from '@/constants/order'
-import { formatDate } from '@/filters'
+import { getBuyOrSellName, getWRTradeOrderStatusName } from '@/constants/order'
+import { formatDate, formatDecimal } from '@/filters'
 
 const componentMap = new Map<string, unknown>([
     ['detail', defineAsyncComponent(() => import('../detail/Index.vue'))],

+ 28 - 0
src/packages/mobile/views/order/list/components/swaptrade/detail/Index.vue

@@ -0,0 +1,28 @@
+<!-- 我的订单- 掉期成交 - 详情 -->
+<template>
+    <app-modal direction="right" height="100%" v-model:show="showModal" :refresh="refresh">
+        <app-view class="g-form">
+            <template #header>
+                <app-navbar title="详细" @back="closed" />
+            </template>
+        </app-view>
+    </app-modal>
+</template>
+
+<script lang="ts" setup>
+import { shallowRef } from 'vue'
+
+const showModal = shallowRef(true)
+const refresh = shallowRef(false) // 是否刷新父组件数据
+
+// 关闭弹窗
+const closed = (isRefresh = false) => {
+    refresh.value = isRefresh
+    showModal.value = false
+}
+
+// 暴露组件属性给父组件调用
+defineExpose({
+    closed,
+})
+</script>

+ 15 - 8
src/packages/mobile/views/order/list/components/swaptrade/list/Index.vue

@@ -6,34 +6,41 @@
             <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.goodscode }}/{{ item.goodsname }} {{ formatDate(item.tradetime) }})</h4>
+                        <h5>{{ item.goodscode }}/{{ item.goodsname }}</h5>
                     </div>
                     <div class="right">
-                        <span>{{ getBuildTypeName(item.buildtype) }} {{ getBuyOrSellName(item.buyorsell) }}</span>
+                        <span>{{ item.tradeid }}</span>
                     </div>
                 </div>
                 <div class="g-order-list__content">
                     <ul>
                         <li>
+                            <span>时间:</span>
+                            <span>{{ formatDate(item.tradetime, 'HH:mm:ss') }}</span>
+                        </li>
+                        <li>
+                            <span>类型:</span>
+                            <span>{{ getBuildTypeName(item.buildtype) }}{{ getBuyOrSellName(item.buyorsell) }}</span>
+                        </li>
+                        <li>
                             <span>成交价格:</span>
-                            <span>{{ item.tradeprice }}</span>
+                            <span>{{ formatDecimal(item.tradeprice) }}</span>
                         </li>
                         <li>
                             <span>手续费:</span>
-                            <span>{{ item.charge}}</span>
+                            <span>{{ formatDecimal(item.charge)}}</span>
                         </li>
                         <li>
                             <span>成交数量:</span>
-                            <span>{{ item.tradeqty }}</span>
+                            <span>{{ formatDecimal(item.tradeqty) }}</span>
                         </li>
                         <li>
                             <span>平仓盈亏:</span>
-                            <span>{{ item.closepl }}</span>
+                            <span>{{ formatDecimal(item.closepl) }}</span>
                         </li>
                     </ul>
                 </div>
                 <div class="g-order-list__btnbar">
-                    <span>{{ item.tradeid }}</span>
                     <Button size="small" @click="showComponent('detail', item)" round>详情</Button>
                 </div>
             </div>
@@ -51,7 +58,7 @@ import { useRequest } from '@/hooks/request'
 import { queryTradeDetail } from '@/services/api/order'
 import AppPullRefresh from '@mobile/components/base/pull-refresh/index.vue'
 import { getBuyOrSellName, getBuildTypeName } from '@/constants/order'
-import { formatDate } from '@/filters'
+import { formatDate, formatDecimal } from '@/filters'
 
 const componentMap = new Map<string, unknown>([
     ['detail', defineAsyncComponent(() => import('../detail/Index.vue'))],

+ 28 - 0
src/packages/mobile/views/order/position/components/swap/close/Index.vue

@@ -0,0 +1,28 @@
+<!-- 我的持仓- 掉期持仓 - 平仓 -->
+<template>
+    <app-modal direction="right" height="100%" v-model:show="showModal" :refresh="refresh">
+        <app-view class="g-form">
+            <template #header>
+                <app-navbar title="掉期持仓-平仓" @back="closed" />
+            </template>
+        </app-view>
+    </app-modal>
+</template>
+
+<script lang="ts" setup>
+import { shallowRef } from 'vue'
+
+const showModal = shallowRef(true)
+const refresh = shallowRef(false) // 是否刷新父组件数据
+
+// 关闭弹窗
+const closed = (isRefresh = false) => {
+    refresh.value = isRefresh
+    showModal.value = false
+}
+
+// 暴露组件属性给父组件调用
+defineExpose({
+    closed,
+})
+</script>

+ 10 - 6
src/packages/mobile/views/order/position/components/swap/list/Index.vue

@@ -6,7 +6,10 @@
             <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.goodscode }}/{{ item.goodsname }}/'--')</h4>
+                        <h5>{{ item.goodscode }}/{{ item.goodsname }}</h5>
+                    </div>
+                    <div class="center">
+                        <h5>--</h5>
                     </div>
                     <div class="right">
                         <span>{{ getBuyOrSellName(item.buyorsell) }}</span>
@@ -16,23 +19,23 @@
                     <ul>
                         <li>
                             <span>持有数量:</span>
-                            <span>{{ item.curpositionqty }}</span>
+                            <span>{{ formatDecimal(item.curpositionqty) }}</span>
                         </li>
                         <li>
                             <span>持仓均价:</span>
-                            <span>{{ item.averageprice === 0.0 ? '--' : item.averageprice}}</span>
+                            <span>{{ item.averageprice === 0.0 ? '--' : formatDecimal(item.averageprice) }}</span>
                         </li>
                         <li>
                             <span>冻结数量:</span>
-                            <span>{{ item.frozenqty }}</span>
+                            <span>{{ formatDecimal(item.frozenqty) }}</span>
                         </li>
                         <li>
                             <span>持仓金额:</span>
-                            <span>{{ item.curholderamount }}</span>
+                            <span>{{ formatDecimal(item.curholderamount) }}</span>
                         </li>
                         <li>
                             <span>可用数量:</span>
-                            <span>{{ item.enableqty }}</span>
+                            <span>{{ formatDecimal(item.enableqty) }}</span>
                         </li>
                         <li>
                             <span>参考损益:</span>
@@ -58,6 +61,7 @@ import { useRequest } from '@/hooks/request'
 import { queryTradePosition } from '@/services/api/order'
 import AppPullRefresh from '@mobile/components/base/pull-refresh/index.vue'
 import { getBuyOrSellName } from '@/constants/order'
+import { formatDecimal } from '@/filters'
 
 const componentMap = new Map<string, unknown>([
     ['close', defineAsyncComponent(() => import('../close/Index.vue'))],

+ 41 - 10
src/packages/mobile/views/swap/detail/Index.vue

@@ -9,8 +9,16 @@
             <Tab title="买大厅">
             </Tab>
         </Tabs>
-        <app-list :columns="columns" :data-list="[]" />
-        <component ref="componentRef" :is="components.trade" v-bind="{ selectedRow }" @closed="closeComponent"
+        <div class="trade">
+                <div class="trade-section sell" v-if="dataList.length">
+                    <app-list :columns="columns" :data-list="dataList">
+                        <template #operate="{ row }">
+                            <Button size="small" round @click="delisting(row)">摘牌</Button>
+                        </template>
+                    </app-list>
+                </div>
+            </div>
+        <component ref="componentRef" :is="components.delisting" v-bind="{ selectedRow }" @closed="closeComponent"
             v-if="componentId" />
     </app-view>
 </template>
@@ -18,32 +26,55 @@
 <script lang="ts" setup>
 import { shallowRef, defineAsyncComponent } from 'vue'
 import { Tab, Tabs, Button } from 'vant'
+import { useRequest } from '@/hooks/request'
 import { useNavigation } from '@/hooks/navigation'
 import { useComponent } from '@/hooks/component'
 import AppList from '@mobile/components/base/list/index.vue'
+import { queryTjmdTradeOrderDetail } from '@/services/api/swap'
 
 const components = {
-    trade: defineAsyncComponent(() => import('./components/trade/Index.vue')),
+    delisting: defineAsyncComponent(() => import('./components/delisting/Index.vue')),
+    listing: defineAsyncComponent(() => import('./components/listing/Index.vue')),
 }
 
 const { getQueryStringToNumber } = useNavigation()
 const { componentRef, componentId, openComponent, closeComponent } = useComponent()
 const goodsId = getQueryStringToNumber('id')
 const tabIndex = shallowRef(0)
-const selectedRow = shallowRef()
+const selectedRow = shallowRef<Model.TjmdTradeOrderDetailRsp>()
+const error = shallowRef(false)
+const showModal = shallowRef(true)
+
+const dataList = shallowRef<Model.TjmdTradeOrderDetailRsp[]>([])
+
+const { pageIndex } = useRequest(queryTjmdTradeOrderDetail, {
+    params: {
+        goodsid: goodsId,
+        buyorsell: tabIndex.value
+    },
+    onSuccess: (res) => {
+        if (pageIndex.value === 1) {
+            dataList.value = []
+        }
+        dataList.value.push(...res.data)
+    },
+    onError: () => {
+        error.value = true
+    }
+})
 
 const columns: Model.TableColumn[] = [
-    { prop: 'undefined', label: '价格' },
-    { prop: 'undefined', label: '数量' },
-    { prop: 'undefined', label: '挂牌方' },
+    { prop: 'fixedprice', label: '价格' },
+    { prop: 'orderqty', label: '数量' },
+    { prop: 'username', label: '挂牌方' },
 ]
 
 const tabChange = (index: number) => {
     console.log('切换列表', index)
 }
 
-const openTrade = (item) => {
-    selectedRow.value = item
-    openComponent('trade')
+const delisting = (row: Model.TjmdTradeOrderDetailRsp) => {
+    selectedRow.value = row
+    openComponent('delisting')
 }
 </script>

+ 0 - 0
src/packages/mobile/views/swap/detail/components/trade/Index.vue → src/packages/mobile/views/swap/detail/components/delisting/Index.vue


+ 0 - 0
src/packages/mobile/views/swap/detail/components/listing/Index.vue


+ 9 - 1
src/services/api/swap/index.ts

@@ -1,6 +1,10 @@
+import { useLoginStore, useAccountStore, useUserStore } from '@/stores'
 import http from '@/services/http'
 import { RequestConfig } from '@/services/http/types'
 
+const loginStore = useLoginStore()
+const accountStore = useAccountStore()
+const userStore = useUserStore()
 
 /**
  * 查询掉期报价列表
@@ -48,7 +52,11 @@ export function queryTjmdTodayAccountMargin(config: RequestConfig<Model.TjmdToda
 export function queryTjmdTradeOrderDetail(config: RequestConfig<Model.TjmdTradeOrderDetailReq> = {}) {
     return http.commonRequest<Model.TjmdTradeOrderDetailRsp[]>({
         url: '/Tjmd/QueryTjmdTradeOrderDetail',
-        params: config.data,
+        params: {
+            userid: loginStore.userId,
+            usertype: userStore.userType,
+            ...config.data
+        },
     })
 }
 

+ 7 - 0
src/stores/modules/user.ts

@@ -32,6 +32,12 @@ export const useUserStore = defineStore(() => {
         return userAccount?.accountname
     })
 
+    // 账户类型
+    const userType = computed(() => {
+        const { userAccount } = state.userData
+        return userAccount?.usertype
+    })
+
     // 用户头像
     const userAvatar = computed(() => {
         const file = userInfo.value?.headurl
@@ -79,6 +85,7 @@ export const useUserStore = defineStore(() => {
         ...toRefs(state),
         userInfo,
         accountName,
+        userType,
         userAvatar,
         hasAuth,
         getUserData,

+ 3 - 3
src/types/model/swap.d.ts

@@ -248,15 +248,15 @@ declare namespace Model {
         /// 每页条数
         pagesize?: number
         /// 用户id
-        userid: number
+        userid?: number
         /// 用户类型
-        usertype: number
+        usertype?: number
         /// 市场id, 格式 1,2,3
         marketids?: string
         /// 商品id
         goodsid: number
         /// 买卖方向 0-买 1-卖
-        buyorsell: number
+        buyorsell?: number
         
     }