li.shaoyi 2 years ago
parent
commit
9dcbbf54a8

+ 1 - 0
src/packages/pc/components/base/table/index.less

@@ -71,6 +71,7 @@
         &__expanded-cell {
             padding: 4px !important;
 
+            .buttonbar,
             .app-auth {
                 position: sticky;
                 right: 5px;

+ 2 - 2
src/packages/pc/components/modules/listing/index.vue

@@ -20,10 +20,10 @@
                     </el-radio-group>
                 </el-form-item>
                 <el-form-item prop="OrderPrice" label="价格">
-                    <el-input-number placeholder="请输入" v-model="formData.OrderPrice" />
+                    <el-input-number placeholder="请输入" :step="priceStep" v-model="formData.OrderPrice" />
                 </el-form-item>
                 <el-form-item prop="OrderQty" label="数量">
-                    <el-input-number placeholder="请输入" v-model="orderQty" />
+                    <el-input-number placeholder="请输入" :step="qtyStep" v-model="orderQty" />
                 </el-form-item>
             </el-form>
             <div class="block-btnbar">

+ 5 - 0
src/packages/pc/views/market/trade/goods/detail/components/order/delisting/index.vue

@@ -0,0 +1,5 @@
+<template>
+    <div></div>
+</template>
+
+<script lang="ts" setup></script>

+ 43 - 9
src/packages/pc/views/market/trade/goods/detail/components/order/index.vue

@@ -1,14 +1,34 @@
 <template>
     <div class="market-trade-goods-detail-order">
-        <app-table :data-list="dataList" v-model:columns="buyColumns" showIndex></app-table>
-        <app-table :data-list="dataList" v-model:columns="sellColumns" showIndex></app-table>
+        <app-table :data="buyList" v-model:columns="buyColumns" :row-key="rowKey" :expand-row-keys="expandKeys"
+            @row-click="rowClick" showIndex>
+            <!-- 展开行 -->
+            <template #expand>
+                <div class="buttonbar">
+                    <el-button type="primary" size="small" @click="openComponent('delisting')">摘牌</el-button>
+                </div>
+            </template>
+        </app-table>
+        <app-table :data="sellList" v-model:columns="sellColumns" :row-key="rowKey" :expand-row-keys="expandKeys"
+            @row-click="rowClick" showIndex>
+            <!-- 展开行 -->
+            <template #expand>
+                <div class="buttonbar">
+                    <el-button type="primary" size="small" @click="openComponent('delisting')">摘牌</el-button>
+                </div>
+            </template>
+        </app-table>
+        <component ref="componentRef" v-bind="{ selectedRow }" :is="componentMap.get(componentId)" @closed="closeComponent"
+            v-if="componentId" />
     </div>
 </template>
 
 <script lang="ts" setup>
-import { shallowRef } from 'vue'
+import { shallowRef, defineAsyncComponent } from 'vue'
 import { useRequest } from '@/hooks/request'
 import { BuyOrSell } from '@/constants/order'
+import { useComponent } from '@/hooks/component'
+import { useComposeTable } from '@pc/components/base/table'
 import { queryWrTradeOrderDetail } from '@/services/api/transfer'
 import AppTable from '@pc/components/base/table/index.vue'
 
@@ -19,23 +39,37 @@ const props = defineProps({
     },
 })
 
-const { dataList } = useRequest(queryWrTradeOrderDetail, {
+const componentMap = new Map<string, unknown>([
+    ['delisting', defineAsyncComponent(() => import('./delisting/index.vue'))], // 摘牌
+])
+
+const { rowKey, expandKeys, selectedRow, rowClick } = useComposeTable<Model.WrTradeOrderDetailRsp>({ rowKey: 'orderid' })
+const { componentRef, componentId, openComponent, closeComponent } = useComponent()
+
+const { dataList: buyList } = useRequest(queryWrTradeOrderDetail, {
     params: {
         goodsid: props.goodsId,
         buyorsell: BuyOrSell.Buy
     },
 })
 
+const { dataList: sellList } = useRequest(queryWrTradeOrderDetail, {
+    params: {
+        goodsid: props.goodsId,
+        buyorsell: BuyOrSell.Sell
+    },
+})
+
 const buyColumns = shallowRef<Model.TableColumn[]>([
-    { prop: 'goodscode', label: '销售方' },
-    { prop: 'buildtype', label: '卖量' },
+    { prop: 'username', label: '销售方' },
+    { prop: 'orderqty', label: '卖量' },
     { prop: 'orderprice', label: '卖价' },
 ])
 
 const sellColumns = shallowRef<Model.TableColumn[]>([
-    { prop: 'goodscode', label: '买价' },
-    { prop: 'buildtype', label: '买量' },
-    { prop: 'orderprice', label: '购买方' },
+    { prop: 'orderprice', label: '买价' },
+    { prop: 'orderqty', label: '买量' },
+    { prop: 'username', label: '购买方' },
 ])
 </script>