li.shaoyi hace 2 años
padre
commit
d6c873c451

+ 0 - 302
src/packages/mobile/assets/themes/global/global.css

@@ -1,302 +0,0 @@
-[class*='g-image'] {
-  position: relative;
-  object-fit: cover;
-  overflow: hidden;
-}
-[class*='g-image']:before {
-  content: '';
-  position: absolute;
-  left: 0;
-  top: 0;
-  width: 100%;
-  height: 100%;
-  background: #fff url("~@mobile/assets/images/avatar.png") no-repeat center;
-  background-size: cover;
-}
-.g-price-up {
-  color: #ff3333;
-}
-.g-price-normal {
-  color: #333333;
-}
-.g-price-down {
-  color: #0baf1f;
-}
-.g-form__container {
-  display: flex;
-  flex-direction: column;
-  padding-bottom: 0.32rem;
-  /* 父元素的第一个子元素 */
-  /* 相邻兄弟元素 */
-}
-.g-form__container .van-cell-group--inset:first-of-type {
-  margin-top: 0.32rem;
-}
-.g-form__container .van-cell-group--inset + .van-cell-group--inset {
-  margin-top: 0.24rem;
-}
-.g-form__container .van-field .van-stepper {
-  display: flex;
-  align-items: center;
-  width: 100%;
-}
-.g-form__container .van-field .van-stepper__input {
-  flex: 1;
-}
-.g-form__footer {
-  display: flex;
-  align-items: center;
-}
-.g-form__footer:empty {
-  display: none;
-}
-.g-form__footer.inset {
-  gap: 0.2rem;
-  padding: 0.2rem 0.32rem;
-}
-.g-flex {
-  display: flex;
-  flex-direction: column;
-  height: 100%;
-}
-.g-flex--row {
-  flex-direction: row;
-}
-.g-flex__body {
-  flex: 1;
-  overflow-y: auto;
-  -webkit-overflow-scrolling: touch;
-}
-.g-flex__footer {
-  margin-top: auto;
-}
-.g-color--up {
-  color: var(--color-up);
-}
-.g-color--down {
-  color: var(--color-down);
-}
-.g-block--bg {
-  background: #fff url('../../images/block-bg.png') no-repeat center bottom;
-  background-size: 100%;
-}
-/* 导航列表 */
-.g-navmenu .app-iconfont {
-  height: 100%;
-}
-.g-navmenu .app-iconfont__icon {
-  font-size: 0.32rem;
-  margin-right: 0.24rem;
-}
-/* 商品列表 */
-.g-goods-list {
-  padding: 0.2rem;
-}
-.g-goods-list .goods {
-  background-color: #fff;
-  border-radius: 0.12rem;
-  overflow: hidden;
-}
-.g-goods-list .goods-image {
-  display: flex;
-  justify-content: center;
-  align-items: center;
-  min-height: 2.4rem;
-  font-size: 0;
-}
-.g-goods-list .goods-info {
-  padding: 0.2rem;
-}
-.g-goods-list .goods-info__title {
-  font-size: 0.26rem;
-  margin-bottom: 0.1rem;
-}
-.g-goods-list .goods-info__price {
-  color: #f2270c;
-}
-.g-goods-list .goods-info__price .unit {
-  font-size: 0.24rem;
-}
-.g-goods-list .goods-info__price .integer {
-  font-size: 0.3rem;
-}
-/* 订单列表 */
-.g-order-list {
-  padding: 0.2rem;
-  padding-bottom: 0;
-}
-.g-order-list__box {
-  background-color: #fff;
-  border-radius: 0.16rem;
-  padding: 0.24rem;
-}
-.g-order-list__box:not(:first-child) {
-  margin-top: 0.2rem;
-}
-.g-order-list__titlebar {
-  display: flex;
-  justify-content: space-between;
-  margin-bottom: 0.2rem;
-}
-.g-order-list__titlebar .left h4 {
-  font-weight: bold;
-}
-.g-order-list__titlebar .left span {
-  font-size: 0.24rem;
-  color: #999;
-}
-.g-order-list__titlebar .right {
-  font-size: 0.24rem;
-  color: #999;
-}
-.g-order-list__content {
-  font-size: 0.24rem;
-}
-.g-order-list__content ul {
-  display: flex;
-  flex-wrap: wrap;
-  justify-content: space-between;
-}
-.g-order-list__content ul li {
-  display: flex;
-  justify-content: space-between;
-  line-height: 0.4rem;
-  width: calc(50% - .24rem);
-}
-.g-order-list__content ul li span:first-child {
-  color: #999;
-  white-space: nowrap;
-  padding-right: 0.24rem;
-}
-.g-order-list__btnbar {
-  display: flex;
-  justify-content: flex-end;
-  gap: 0.16rem;
-  margin-top: 0.2rem;
-}
-.g-order-list__btnbar .van-button {
-  width: 1.6rem;
-  border-width: 1px;
-}
-.g-detail__buy {
-  background-color: #fff;
-}
-.g-detail__buy .topic {
-  display: flex;
-  justify-content: space-between;
-  align-items: center;
-  color: #fff;
-  background-image: linear-gradient(to right, #ee0a24, #ff6034);
-  padding: 0.2rem 0.24rem;
-}
-.g-detail__buy .topic-left .price-text {
-  font-size: 0.24rem;
-}
-.g-detail__buy .topic-left .price-integer {
-  font-size: 0.44rem;
-}
-.g-detail__buy .topic-right {
-  display: flex;
-  flex-direction: column;
-  font-size: 0.24rem;
-}
-.g-detail__buy .title {
-  font-size: 0.3rem;
-  font-weight: bold;
-  line-height: 0.48rem;
-  padding: 0.24rem;
-  padding-bottom: 0;
-}
-.g-detail__buy .title .van-tag {
-  font-weight: normal;
-}
-.g-detail__buy .title span {
-  margin-right: 0.1rem;
-}
-.g-detail__buy .qty {
-  font-size: 0.24rem;
-  color: #999;
-  padding: 0.1rem 0.24rem 0 0.24rem;
-}
-.g-detail__buy .info {
-  background-color: #fff;
-  padding: 0.2rem;
-}
-.g-detail__buy .info ul {
-  display: flex;
-  flex-wrap: wrap;
-  font-size: 0.26rem;
-}
-.g-detail__buy .info ul li {
-  display: flex;
-  justify-content: space-between;
-  width: 50%;
-  padding: 0.08rem 0.24rem;
-}
-.g-detail__buy .info ul li span:first-child {
-  color: #999;
-}
-.g-detail__desc {
-  background-color: #fff;
-  margin-top: 0.24rem;
-}
-.g-detail__footer {
-  display: flex;
-  justify-content: space-between;
-  align-items: center;
-  height: 0.88rem;
-  background-color: #fff;
-}
-.g-detail__footer .price {
-  padding-left: 0.32rem;
-}
-.g-detail__footer .price-text,
-.g-detail__footer .price-unit {
-  font-size: 0.24rem;
-}
-.g-detail__footer .price-unit {
-  color: #f2270c;
-}
-.g-detail__footer .price-integer {
-  font-size: 0.32rem;
-  color: #f2270c;
-}
-.g-detail__footer .submit {
-  align-self: stretch;
-  display: flex;
-  margin-left: auto;
-}
-.g-detail__footer .submit-button {
-  display: flex;
-  justify-content: center;
-  align-items: center;
-  height: 100%;
-  min-width: 2rem;
-  font-weight: bold;
-  color: #fff;
-  padding: 0 0.48rem;
-}
-.g-detail__footer .submit-button.warning {
-  background-image: linear-gradient(to right, #ffd01e, #ff8917);
-  background-color: #ff8a17;
-}
-.g-detail__footer .submit-button.danger {
-  background-image: linear-gradient(to right, #ff6034, #ee0a24);
-  background-color: #ee270a;
-}
-.van-dialog__message {
-  font-size: 0.28rem;
-  line-height: 0.44rem;
-}
-.van-tabs--list {
-  display: flex;
-  flex-direction: column;
-  height: 100%;
-}
-.van-tabs--list .van-tabs__content {
-  flex: 1;
-  overflow-y: auto;
-}
-.van-tabs--list .van-tabs__content .van-tab__panel {
-  height: 100%;
-}

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

@@ -232,7 +232,6 @@ const onSubmit = () => {
         formData.GoodsID = goodsid
         formData.ListingSelectType = EListingSelectType.LISTINGSELECTTYPE_DELISTINGTHENLISTING
         formData.DelistingType = EDelistingType.DELISTINGTYPE_PRICE
-        formData.BuildType = EBuildType.BUILDTYPE_OPEN
         formData.TimevalidType = EValidType.VALIDTYPE_DR
         formData.OperateType = EOrderOperateType.ORDEROPERATETYPE_NORMAL
         formData.BuildType = props.buildType

+ 4 - 5
src/packages/mobile/views/goods/trade/components/delisting/index.vue

@@ -54,18 +54,18 @@
                 <div class="g-form__footer">
                     <template v-if="selectedRow.buyorsell === BuyOrSell.Buy">
                         <Button type="danger" block square @click="onBeforeSubmit(EBuildType.BUILDTYPE_OPEN)">订立卖出</Button>
-                        <Button type="primary" :disabled="(sellQty === 0) || (orderQty > sellQty)" block square
+                        <Button type="primary" :disabled="(buyQty === 0) || (orderQty > buyQty)" block square
                             @click="onBeforeSubmit(EBuildType.BUILDTYPE_CLOSE)">
                             <span>转让卖出</span>
-                            <span v-if="sellQty">(≤{{ sellQty }})</span>
+                            <span v-if="buyQty">(≤{{ buyQty }})</span>
                         </Button>
                     </template>
                     <template v-if="selectedRow.buyorsell === BuyOrSell.Sell">
                         <Button type="danger" block square @click="onBeforeSubmit(EBuildType.BUILDTYPE_OPEN)">订立买入</Button>
-                        <Button type="primary" :disabled="(buyQty === 0) || (orderQty > buyQty)" block square
+                        <Button type="primary" :disabled="(sellQty === 0) || (orderQty > sellQty)" block square
                             @click="onBeforeSubmit(EBuildType.BUILDTYPE_CLOSE)">
                             <span>转让买入</span>
-                            <span v-if="buyQty">(≤{{ buyQty }})</span>
+                            <span v-if="sellQty">(≤{{ sellQty }})</span>
                         </Button>
                     </template>
                 </div>
@@ -179,7 +179,6 @@ const onSubmit = () => {
         formData.GoodsID = goodsid
         formData.ListingSelectType = EListingSelectType.LISTINGSELECTTYPE_DELISTING
         formData.DelistingType = EDelistingType.DELISTINGTYPE_SELECTED
-        formData.BuildType = EBuildType.BUILDTYPE_OPEN
         formData.TimevalidType = EValidType.VALIDTYPE_DR
         formData.OperateType = EOrderOperateType.ORDEROPERATETYPE_NORMAL
         formData.OrderQty = orderQty.value / agreeunit.value // 数量÷合约乘数

+ 12 - 0
src/packages/pc/assets/themes/style.less

@@ -61,4 +61,16 @@
         line-height: 36px;
         padding: 0 20px;
     }
+}
+
+.g-price-up {
+    color: #ff3333;
+}
+
+.g-price-normal {
+    color: #333333;
+}
+
+.g-price-down {
+    color: #0baf1f;
 }

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

@@ -15,7 +15,7 @@
     </div>
     <div class="app-table__container">
       <el-table ref="tableRef" height="100%" :header-cell-class-name="selectionType" v-bind="$attrs" highlight-current-row
-        scrollbar-always-on @row-click="onRowClick" @select="onSelect" border>
+        scrollbar-always-on @row-click="onRowClick" @expand-change="onRowClick" @select="onSelect" border>
         <!-- 展开行 -->
         <el-table-column type="expand" v-if="$slots.expand">
           <template #default="{ row, $index }">

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

@@ -5,7 +5,8 @@
         </div>
         <div class="app-listing__form">
             <h4 class="block-title">订单挂牌</h4>
-            <el-form ref="formRef" size="small" label-width="50px" label-position="left" :model="formData">
+            <el-form ref="formRef" size="small" label-width="50px" label-position="left" :model="formData"
+                :rules="formRules">
                 <el-form-item prop="GoodsID" label="商品">
                     <el-select placeholder="请选择" v-model="goodsStore.goodsId">
                         <el-option :label="item.goodsname" :value="item.goodsid"
@@ -20,25 +21,31 @@
                     </el-radio-group>
                 </el-form-item>
                 <el-form-item prop="OrderPrice" label="价格">
-                    <el-input-number placeholder="请输入" :step="priceStep" v-model="formData.OrderPrice" />
+                    <el-input-number placeholder="请输入" :min="0" :step="priceStep" :precision="quote?.decimalplace"
+                        v-model="formData.OrderPrice" />
                 </el-form-item>
                 <el-form-item prop="OrderQty" label="数量">
-                    <el-input-number placeholder="请输入" :step="qtyStep" v-model="orderQty" />
+                    <el-input-number placeholder="请输入" :min="agreeunit" :step="qtyStep" v-model="orderQty" />
+                    <el-radio-group v-model="qtyStep" @change="onRadioChange">
+                        <el-radio-button v-for="(value, index) in qtyStepList" :key="index" :label="value" />
+                    </el-radio-group>
                 </el-form-item>
             </el-form>
             <div class="block-btnbar">
                 <template v-if="formData.BuyOrSell === BuyOrSell.Buy">
-                    <el-button type="primary" size="small" @click="onSubmit(EBuildType.BUILDTYPE_OPEN)">订立买入</el-button>
-                    <el-button type="primary" size="small" :disabled="(sellQty === 0) || (orderQty > sellQty)"
-                        @click="onSubmit(EBuildType.BUILDTYPE_CLOSE)">
+                    <el-button type="primary" size="small" :loading="loading"
+                        @click="onSubmit(EBuildType.BUILDTYPE_OPEN)">订立买入</el-button>
+                    <el-button type="primary" size="small" :loading="loading"
+                        :disabled="(sellQty === 0) || (orderQty > sellQty)" @click="onSubmit(EBuildType.BUILDTYPE_CLOSE)">
                         <span>转让买入</span>
                         <span v-if="sellQty">(≤{{ sellQty }})</span>
                     </el-button>
                 </template>
                 <template v-if="formData.BuyOrSell === BuyOrSell.Sell">
-                    <el-button type="primary" size="small" @click="onSubmit(EBuildType.BUILDTYPE_OPEN)">订立卖出</el-button>
-                    <el-button type="primary" size="small" :disabled="(buyQty === 0) || (orderQty > buyQty)"
-                        @click="onSubmit(EBuildType.BUILDTYPE_CLOSE)">
+                    <el-button type="primary" size="small" :loading="loading"
+                        @click="onSubmit(EBuildType.BUILDTYPE_OPEN)">订立卖出</el-button>
+                    <el-button type="primary" size="small" :loading="loading"
+                        :disabled="(buyQty === 0) || (orderQty > buyQty)" @click="onSubmit(EBuildType.BUILDTYPE_CLOSE)">
                         <span>转让卖出</span>
                         <span v-if="buyQty">(≤{{ buyQty }})</span>
                     </el-button>
@@ -50,7 +57,7 @@
 
 <script lang="ts" setup>
 import { shallowRef, computed, watch } from 'vue'
-import { ElMessage } from 'element-plus'
+import { ElMessage, ElMessageBox, FormInstance, FormRules } from 'element-plus'
 import { EPriceMode, EListingSelectType, EDelistingType, EBuildType, EValidType, EOrderOperateType } from '@/constants/client'
 import { BuyOrSell, getBuyOrSellList } from '@/constants/order'
 import { useRequest } from '@/hooks/request'
@@ -62,7 +69,8 @@ import Forex from '@pc/components/modules/quote/forex/index.vue'
 
 const goodsStore = useGoodsStore()
 const futuresStore = useFuturesStore()
-const { formData, formSubmit } = useOrder()
+const { formData, loading, formSubmit } = useOrder()
+const formRef = shallowRef<FormInstance>()
 const orderQty = shallowRef(1) // 数量
 const qtyStep = shallowRef(1) // 数量步长
 
@@ -73,7 +81,7 @@ const { dataList: positionList, run: getTradePosition } = useRequest(queryTradeP
     },
 })
 
-// 商品行情
+// 商品盘面
 const quote = computed(() => futuresStore.getQuoteInfo(goodsStore.goodsCode).value)
 
 // 合约乘数
@@ -92,11 +100,8 @@ const priceStep = computed(() => {
 const qtyStepList = computed(() => {
     return [
         agreeunit.value * 1,
-        agreeunit.value * 5,
         agreeunit.value * 10,
-        agreeunit.value * 20,
-        agreeunit.value * 30,
-        agreeunit.value * 50,
+        agreeunit.value * 100,
     ]
 })
 
@@ -118,25 +123,55 @@ const sellQty = computed(() => {
     return 0
 })
 
+const formRules: FormRules = {
+    OrderPrice: [{ required: true, message: '请输入价格' }],
+    OrderQty: [{
+        required: true,
+        validator: (rule, value, callback) => {
+            if (orderQty.value) {
+                if (orderQty.value % agreeunit.value === 0) {
+                    callback()
+                } else {
+                    callback(new Error('只能输入合约乘数的整数倍'))
+                }
+            } else {
+                callback(new Error('请输入摘牌数量'))
+            }
+        }
+    }],
+}
+
+const onRadioChange = (value: number) => {
+    orderQty.value = value
+}
+
 // 提交挂牌
 const onSubmit = (buildType: number) => {
-    const { marketid = 0, goodsid = 0 } = quote.value ?? {}
-    /// 获取对应的市场ID
-    formData.MarketID = marketid
-    formData.PriceMode = EPriceMode.PRICEMODE_LIMIT
-    formData.GoodsID = goodsid
-    formData.ListingSelectType = EListingSelectType.LISTINGSELECTTYPE_DELISTINGTHENLISTING
-    formData.DelistingType = EDelistingType.DELISTINGTYPE_PRICE
-    formData.BuildType = EBuildType.BUILDTYPE_OPEN
-    formData.TimevalidType = EValidType.VALIDTYPE_DR
-    formData.OperateType = EOrderOperateType.ORDEROPERATETYPE_NORMAL
-    formData.BuildType = buildType
-    formData.OrderQty = orderQty.value / agreeunit.value // 数量÷合约乘数
-
-    formSubmit().then(() => {
-        ElMessage.success('提交成功')
-    }).catch((err) => {
-        ElMessage.error('提交失败:' + err)
+    formRef.value?.validate((valid) => {
+        if (valid) {
+            ElMessageBox.confirm(
+                '是否立即挂牌?',
+                '提示'
+            ).then(() => {
+                const { marketid = 0, goodsid = 0 } = quote.value ?? {}
+                /// 获取对应的市场ID
+                formData.MarketID = marketid
+                formData.PriceMode = EPriceMode.PRICEMODE_LIMIT
+                formData.GoodsID = goodsid
+                formData.ListingSelectType = EListingSelectType.LISTINGSELECTTYPE_DELISTINGTHENLISTING
+                formData.DelistingType = EDelistingType.DELISTINGTYPE_PRICE
+                formData.TimevalidType = EValidType.VALIDTYPE_DR
+                formData.OperateType = EOrderOperateType.ORDEROPERATETYPE_NORMAL
+                formData.BuildType = buildType
+                formData.OrderQty = orderQty.value / agreeunit.value // 数量÷合约乘数
+
+                formSubmit().then(() => {
+                    ElMessage.success('提交成功')
+                }).catch((err) => {
+                    ElMessage.error('提交失败:' + err)
+                })
+            })
+        }
     })
 }
 

+ 24 - 0
src/packages/pc/components/modules/quote/tik/index.less

@@ -8,4 +8,28 @@
         background-color: #333;
         padding: 5px;
     }
+
+    &__body {
+        ul {
+            text-align: center;
+            padding: 5px;
+
+            li {
+                display: flex;
+                padding: 3px 0;
+
+                span {
+                    flex: 1;
+
+                    &:first-child {
+                        text-align: left;
+                    }
+
+                    &:last-child {
+                        text-align: right;
+                    }
+                }
+            }
+        }
+    }
 }

+ 1 - 1
src/packages/pc/components/modules/quote/tik/index.vue

@@ -7,7 +7,7 @@
         <div class="app-quote-tik__body">
             <ul>
                 <li v-for="(item, index) in dataList" :key="index">
-                    <span>{{ item.TS }}</span>
+                    <span>{{ formatDate(item.TS, 'HH:mm:ss') }}</span>
                     <span>{{ item.PE }}</span>
                     <span>{{ item.Vol }}</span>
                 </li>

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

@@ -1,5 +1,170 @@
+<!-- 交易市场-订单交易-买卖大厅-摘牌 -->
 <template>
-    <div></div>
+    <app-drawer title="摘牌" v-model:show="show" :loading="loading" :refresh="refresh">
+        <el-form ref="formRef" class="el-form--vertical" label-width="100px" label-position="left" :model="formData"
+            :rules="formRules">
+            <el-form-item label="挂牌方">
+                <span>{{ selectedRow.username }}</span>
+            </el-form-item>
+            <el-form-item label="挂牌价格">
+                <span>{{ selectedRow.orderprice }}</span>
+            </el-form-item>
+            <el-form-item label="剩余数量">
+                <span>{{ selectedRow.orderqty }}{{ getGoodsUnitName(quote?.goodunitid) }}</span>
+            </el-form-item>
+            <el-form-item prop="OrderQty" label="摘牌数量">
+                <el-input-number placeholder="请输入" :min="agreeunit" :step="qtyStep" v-model="orderQty" />
+                <el-radio-group v-model="qtyStep" @change="onRadioChange">
+                    <el-radio-button v-for="(value, index) in qtyStepList" :key="index" :label="value" />
+                </el-radio-group>
+            </el-form-item>
+        </el-form>
+        <template #footer>
+            <template v-if="selectedRow.buyorsell === BuyOrSell.Buy">
+                <el-button type="primary" :disabled="orderQty > selectedRow.orderqty"
+                    @click="onSubmit(EBuildType.BUILDTYPE_OPEN)">订立卖出</el-button>
+                <el-button type="primary" :disabled="(buyQty === 0) || (orderQty > buyQty)"
+                    @click="onSubmit(EBuildType.BUILDTYPE_CLOSE)">
+                    <span>转让卖出</span>
+                    <span v-if="buyQty">(≤{{ buyQty }})</span>
+                </el-button>
+            </template>
+            <template v-if="selectedRow.buyorsell === BuyOrSell.Sell">
+                <el-button type="primary" :disabled="orderQty > selectedRow.orderqty"
+                    @click="onSubmit(EBuildType.BUILDTYPE_OPEN)">订立买入</el-button>
+                <el-button type="primary" :disabled="(sellQty === 0) || (orderQty > sellQty)"
+                    @click="onSubmit(EBuildType.BUILDTYPE_CLOSE)">
+                    <span>转让买入</span>
+                    <span v-if="sellQty">(≤{{ sellQty }})</span>
+                </el-button>
+            </template>
+        </template>
+    </app-drawer>
 </template>
 
-<script lang="ts" setup></script>
+<script lang="ts" setup>
+import { shallowRef, PropType, computed } from 'vue'
+import { ElMessage, FormInstance, FormRules } from 'element-plus'
+import { getGoodsUnitName } from '@/constants/unit'
+import { EBuildType, EDelistingType, EListingSelectType, EOrderOperateType, EPriceMode, EValidType } from '@/constants/client'
+import { BuyOrSell } from '@/constants/order'
+import { useRequest } from '@/hooks/request'
+import { queryTradePosition } from '@/services/api/order'
+import { useOrder } from '@/business/trade'
+import { useFuturesStore } from '@/stores'
+import AppDrawer from '@pc/components/base/drawer/index.vue'
+
+const props = defineProps({
+    selectedRow: {
+        type: Object as PropType<Model.WrTradeOrderDetailRsp>,
+        required: true
+    }
+})
+
+const { formData, formSubmit, loading } = useOrder()
+const futuresStore = useFuturesStore()
+const show = shallowRef(true)
+const refresh = shallowRef(false)
+const formRef = shallowRef<FormInstance>()
+const orderQty = shallowRef(1) // 数量
+const qtyStep = shallowRef(1) // 数量步长
+
+// 持仓列表
+const { dataList: positionList } = useRequest(queryTradePosition, {
+    params: {
+        tradeMode: '50'
+    },
+})
+
+// 商品盘面
+const quote = futuresStore.getQuoteInfo(props.selectedRow.goodsid)
+
+// 合约乘数
+const agreeunit = computed(() => quote.value?.agreeunit ?? 0)
+
+// 数量步长列表
+const qtyStepList = computed(() => {
+    return [
+        agreeunit.value * 1,
+        agreeunit.value * 5,
+        agreeunit.value * 10,
+        agreeunit.value * 20,
+        agreeunit.value * 30,
+        agreeunit.value * 50,
+    ]
+})
+
+// 买方向持仓数量
+const buyQty = computed(() => {
+    const item = positionList.value.find((e) => e.goodsid === props.selectedRow.goodsid && e.buyorsell === BuyOrSell.Buy)
+    if (item) {
+        return item.enableqty * agreeunit.value
+    }
+    return 0
+})
+
+// 卖方向持仓数量
+const sellQty = computed(() => {
+    const item = positionList.value.find((e) => e.goodsid === props.selectedRow.goodsid && e.buyorsell === BuyOrSell.Sell)
+    if (item) {
+        return item.enableqty * agreeunit.value
+    }
+    return 0
+})
+
+const formRules: FormRules = {
+    OrderQty: [{
+        required: true,
+        validator: (rule, value, callback) => {
+            if (orderQty.value) {
+                if (orderQty.value % agreeunit.value === 0) {
+                    callback()
+                } else {
+                    callback(new Error('只能输入合约乘数的整数倍'))
+                }
+            } else {
+                callback(new Error('请输入摘牌数量'))
+            }
+        }
+    }],
+}
+
+const onRadioChange = (value: number) => {
+    orderQty.value = value
+}
+
+const onCancel = (isRefresh = false) => {
+    show.value = false
+    refresh.value = isRefresh
+}
+
+const onSubmit = (buildType: number) => {
+    formRef.value?.validate((valid) => {
+        if (valid) {
+            const { goodsid, orderid, orderprice, buyorsell } = props.selectedRow
+            const { marketid = 0 } = quote.value ?? {}
+
+            /// 获取对应的市场ID
+            formData.MarketID = marketid
+            formData.PriceMode = EPriceMode.PRICEMODE_LIMIT
+            formData.RelatedID = orderid
+            formData.OrderPrice = orderprice
+            formData.BuyOrSell = buyorsell === BuyOrSell.Buy ? BuyOrSell.Sell : BuyOrSell.Buy
+            formData.GoodsID = goodsid
+            formData.ListingSelectType = EListingSelectType.LISTINGSELECTTYPE_DELISTING
+            formData.DelistingType = EDelistingType.DELISTINGTYPE_SELECTED
+            formData.BuildType = buildType
+            formData.TimevalidType = EValidType.VALIDTYPE_DR
+            formData.OperateType = EOrderOperateType.ORDEROPERATETYPE_NORMAL
+            formData.OrderQty = orderQty.value / agreeunit.value // 数量÷合约乘数
+
+            formSubmit().then(() => {
+                ElMessage.success('提交成功')
+                onCancel(true)
+            }).catch((err) => {
+                ElMessage.error('提交失败:' + err)
+            })
+        }
+    })
+}
+</script>

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

@@ -1,20 +1,23 @@
+<!-- 交易市场-订单交易-买卖大厅 -->
 <template>
     <div class="market-trade-goods-detail-order">
-        <app-table :data="buyList" v-model:columns="buyColumns" :row-key="rowKey" :expand-row-keys="expandKeys"
-            @row-click="rowClick" showIndex>
+        <app-table class="sell" :data="sellList" v-model:columns="sellColumns" :row-key="rowKey"
+            :expand-row-keys="expandKeys" @row-click="rowClick" showIndex>
             <!-- 展开行 -->
-            <template #expand>
+            <template #expand="{ row }">
                 <div class="buttonbar">
-                    <el-button type="primary" size="small" @click="openComponent('delisting')">摘牌</el-button>
+                    <el-button type="primary" size="small" :disabled="row.userid === loginStore.userId"
+                        @click="openComponent('delisting')">摘牌</el-button>
                 </div>
             </template>
         </app-table>
-        <app-table :data="sellList" v-model:columns="sellColumns" :row-key="rowKey" :expand-row-keys="expandKeys"
+        <app-table class="buy" :data="buyList" v-model:columns="buyColumns" :row-key="rowKey" :expand-row-keys="expandKeys"
             @row-click="rowClick" showIndex>
             <!-- 展开行 -->
-            <template #expand>
+            <template #expand="{ row }">
                 <div class="buttonbar">
-                    <el-button type="primary" size="small" @click="openComponent('delisting')">摘牌</el-button>
+                    <el-button type="primary" size="small" :disabled="row.userid === loginStore.userId"
+                        @click="openComponent('delisting')">摘牌</el-button>
                 </div>
             </template>
         </app-table>
@@ -24,12 +27,14 @@
 </template>
 
 <script lang="ts" setup>
-import { shallowRef, defineAsyncComponent } from 'vue'
+import { shallowRef, defineAsyncComponent, onUnmounted } 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 { useLoginStore } from '@/stores'
+import eventBus from '@/services/bus'
 import AppTable from '@pc/components/base/table/index.vue'
 
 const props = defineProps({
@@ -43,17 +48,18 @@ const componentMap = new Map<string, unknown>([
     ['delisting', defineAsyncComponent(() => import('./delisting/index.vue'))], // 摘牌
 ])
 
+const loginStore = useLoginStore()
 const { rowKey, expandKeys, selectedRow, rowClick } = useComposeTable<Model.WrTradeOrderDetailRsp>({ rowKey: 'orderid' })
 const { componentRef, componentId, openComponent, closeComponent } = useComponent()
 
-const { dataList: buyList } = useRequest(queryWrTradeOrderDetail, {
+const { dataList: buyList, run: getBuyList } = useRequest(queryWrTradeOrderDetail, {
     params: {
         goodsid: props.goodsId,
         buyorsell: BuyOrSell.Buy
     },
 })
 
-const { dataList: sellList } = useRequest(queryWrTradeOrderDetail, {
+const { dataList: sellList, run: getSellList } = useRequest(queryWrTradeOrderDetail, {
     params: {
         goodsid: props.goodsId,
         buyorsell: BuyOrSell.Sell
@@ -71,8 +77,15 @@ const sellColumns = shallowRef<Model.TableColumn[]>([
     { prop: 'orderqty', label: '买量' },
     { prop: 'username', label: '购买方' },
 ])
-</script>
 
+// 接收资金变动通知
+const moneyChangedNotify = eventBus.$on('MoneyChangedNotify', () => {
+    getBuyList()
+    getSellList()
+})
+
+onUnmounted(() => moneyChangedNotify.cancel())
+</script>
 <style lang="less">
 @import './index.less';
 </style>