li.shaoyi преди 2 години
родител
ревизия
2936883cb9

+ 2 - 1
src/business/trade/index.ts

@@ -329,7 +329,7 @@ export function useHdWROrder() {
         CanBargain: 0,
         CanPart: 1,
         FixedPrice: 1,
-        OrderQty:1,
+        OrderQty: 1,
         UserID: loginStore.userId,
         AccountID: accountStore.accountId,
         OperatorID: loginStore.loginId,
@@ -560,6 +560,7 @@ export function useOrder() {
         ClientType: ClientType.Web,
         LoginID: loginStore.loginId,
         AccountID: accountStore.accountId,
+        BuyOrSell: BuyOrSell.Buy,
         OperateType: EOrderOperateType.ORDEROPERATETYPE_NORMAL,
         OrderSrc: OrderSrc.ORDERSRC_CLIENT,
         OperatorID: loginStore.loginId,

+ 3 - 4
src/packages/mobile/views/order/position/components/goods/list/Index.vue

@@ -45,10 +45,9 @@
                         </li>
                     </ul>
                 </div>
-                <div class="g-order-list__btnbar">
-                    <Button size="small" v-if="item.enableqty != 0" @click="showComponent('close', item)" round>转让</Button>
-                    <Button size="small" v-if="userStore.userType === 5" @click="showComponent('delivery', item)"
-                        round>交收</Button>
+                <div class="g-order-list__btnbar" v-if="item.enableqty">
+                    <Button size="small" @click="showComponent('close', item)" round>转让</Button>
+                    <Button size="small" @click="showComponent('delivery', item)" round>交收</Button>
                 </div>
             </div>
         </div>

+ 23 - 6
src/packages/pc/assets/themes/default/variable.less

@@ -149,23 +149,40 @@
         }
 
         &--info {
+            position: relative;
+            background-color: #181E22;
+
+            &::after {
+                content: '';
+                position: absolute;
+                bottom: 0;
+                width: 100%;
+                height: 1px;
+                background-color: #22292C;
+            }
+
             .tabs-item {
+                z-index: 1;
                 display: flex;
                 justify-content: center;
                 align-items: center;
                 color: #7a8a94;
                 cursor: pointer;
-                height: 22px;
                 border: 1px solid #22292c;
-                padding: 0 16px;
+                padding: 5px 16px;
 
-                &:not(:first-child) {
-                    border-left: 0;
+                &:not(:last-child) {
+                    border-right: 0;
                 }
 
                 &.is-active {
-                    color: #0866b8;
-                    background-color: #0e2f4c;
+                    color: #0D96FF;
+                    background-color: #0D283F;
+                    border-color: #013B6D;
+                }
+
+                &.is-active+.tabs-item {
+                    border-left-color: #013B6D;
                 }
             }
         }

+ 6 - 2
src/packages/pc/components/layouts/footer/index.less

@@ -5,7 +5,7 @@
     background-color: #0e0e0f;
     border-top: 1px solid #363f45;
 
-    &__info {
+    &__left {
         background-color: #272f36;
 
         table {
@@ -32,7 +32,7 @@
         }
     }
 
-    &__main {
+    &__center {
         flex: 1;
         overflow: hidden;
 
@@ -40,4 +40,8 @@
             background-color: #181e22;
         }
     }
+
+    &__right {
+        border-left: 1px solid #363f45;
+    }
 }

+ 8 - 3
src/packages/pc/components/layouts/footer/index.vue

@@ -1,6 +1,6 @@
 <template>
     <div class="app-footer" v-if="accountList.length">
-        <div class="app-footer__info">
+        <div class="app-footer__left" v-if="false">
             <div>{{ accountInfo.accountid }}</div>
             <table>
                 <colgroup>
@@ -32,20 +32,25 @@
                 </tbody>
             </table>
         </div>
-        <div class="app-footer__main">
+        <div class="app-footer__center">
             <app-auth-component code="bottom">
-                <el-select placeholder="请选择资金账户" :disabled="loading" v-model="accountId" @change="onAccountChange">
+                <el-select placeholder="请选择资金账户" :disabled="loading" v-model="accountId" @change="onAccountChange"
+                    v-if="false">
                     <el-option :label="item.accountid" :value="item.accountid" v-for="(item, index) in accountList"
                         :key="index" />
                 </el-select>
             </app-auth-component>
         </div>
+        <div class="app-footer__right" v-if="$route.name === 'market_trade_goods'">
+            <app-listing />
+        </div>
     </div>
 </template>
 
 <script lang="ts" setup>
 import { useAccountStore } from '@/stores'
 import AppAuthComponent from '@pc/components/modules/auth-component/index.vue'
+import AppListing from '@pc/components/modules/listing/index.vue'
 
 const { accountList, accountInfo, accountId, loading, getAccountPositionList } = useAccountStore()
 

+ 31 - 0
src/packages/pc/components/modules/listing/index.less

@@ -0,0 +1,31 @@
+.app-listing {
+    display: flex;
+    height: 100%;
+    background-color: #14181B;
+
+    &__forex {
+        width: 160px;
+        padding: 10px;
+    }
+
+    &__form {
+        width: 240px;
+        padding: 10px;
+        border-left: 1px solid #363f45;
+
+        .block-title {
+            text-align: center;
+            margin-bottom: 15px;
+        }
+
+        .el-form-item {
+            &--small {
+                margin-bottom: 10px;
+            }
+
+            &__label {
+                color: #ACB8C0;
+            }
+        }
+    }
+}

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

@@ -0,0 +1,158 @@
+<template>
+    <div class="app-listing">
+        <div class="app-listing__forex">
+            <Forex v-bind="{ goodsCode: goodsStore.goodsCode }" />
+        </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-item prop="GoodsID" label="商品">
+                    <el-select placeholder="请选择" v-model="goodsStore.goodsId">
+                        <el-option :label="item.goodsname" :value="item.goodsid"
+                            v-for="(item, index) in goodsStore.quoteGoodsList" :key="index" />
+                    </el-select>
+                </el-form-item>
+                <el-form-item prop="BuyOrSell" label="方向">
+                    <el-radio-group v-model="formData.BuyOrSell">
+                        <el-radio v-for="(item, index) in getBuyOrSellList()" :key="index" :label="item.value">
+                            {{ item.label }}
+                        </el-radio>
+                    </el-radio-group>
+                </el-form-item>
+                <el-form-item prop="OrderPrice" label="价格">
+                    <el-input-number placeholder="请输入" v-model="formData.OrderPrice" />
+                </el-form-item>
+                <el-form-item prop="OrderQty" label="数量">
+                    <el-input-number placeholder="请输入" v-model="orderQty" />
+                </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)">
+                        <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)">
+                        <span>转让卖出</span>
+                        <span v-if="buyQty">(≤{{ buyQty }})</span>
+                    </el-button>
+                </template>
+            </div>
+        </div>
+    </div>
+</template>
+
+<script lang="ts" setup>
+import { shallowRef, computed, watch } from 'vue'
+import { ElMessage } from 'element-plus'
+import { EPriceMode, EListingSelectType, EDelistingType, EBuildType, EValidType, EOrderOperateType } from '@/constants/client'
+import { BuyOrSell, getBuyOrSellList } from '@/constants/order'
+import { useRequest } from '@/hooks/request'
+import { queryTradePosition } from '@/services/api/order'
+import { useOrder } from '@/business/trade'
+import { useGoodsStore, useFuturesStore } from '@/stores'
+import eventBus from '@/services/bus'
+import Forex from '@pc/components/modules/quote/forex/index.vue'
+
+const goodsStore = useGoodsStore()
+const futuresStore = useFuturesStore()
+const { formData, formSubmit } = useOrder()
+const orderQty = shallowRef(1) // 数量
+const qtyStep = shallowRef(1) // 数量步长
+
+// 持仓列表
+const { dataList: positionList, run: getTradePosition } = useRequest(queryTradePosition, {
+    params: {
+        tradeMode: '50'
+    },
+})
+
+// 商品行情
+const quote = computed(() => futuresStore.getQuoteInfo(goodsStore.goodsCode).value)
+
+// 合约乘数
+const agreeunit = computed(() => quote.value?.agreeunit ?? 0)
+
+// 价格步长
+const priceStep = computed(() => {
+    const { quoteminunit = 0, decimalplace = 0 } = quote.value ?? {}
+    if (quoteminunit) {
+        return quoteminunit * Math.pow(10, decimalplace * -1)
+    }
+    return 1
+})
+
+// 数量步长列表
+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.goodscode === goodsStore.goodsCode && e.buyorsell === BuyOrSell.Buy)
+    if (item) {
+        return item.enableqty * agreeunit.value
+    }
+    return 0
+})
+
+// 卖方向持仓数量
+const sellQty = computed(() => {
+    const item = positionList.value.find((e) => e.goodscode === goodsStore.goodsCode && e.buyorsell === BuyOrSell.Sell)
+    if (item) {
+        return item.enableqty * agreeunit.value
+    }
+    return 0
+})
+
+// 提交挂牌
+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)
+    })
+}
+
+watch(() => goodsStore.goodsId, () => {
+    const { last = 0, agreeunit = 0, presettle = 0 } = quote.value ?? {}
+    formData.OrderPrice = last || presettle
+    orderQty.value = agreeunit
+    qtyStep.value = qtyStepList.value[0]
+}, {
+    immediate: true
+})
+
+// 接收资金变动通知
+eventBus.$on('MoneyChangedNotify', () => getTradePosition())
+</script>
+
+<style lang="less">
+@import './index.less';
+</style>

+ 0 - 1
src/packages/pc/components/modules/quote/chart/index.less

@@ -2,7 +2,6 @@
     display: flex;
     flex-direction: column;
     height: 100%;
-    padding: 10px;
 
     &__body {
         flex: 1;

+ 18 - 2
src/packages/pc/components/modules/quote/chart/kline/index.less

@@ -32,12 +32,28 @@
         }
     }
 
-    .app-tabs {
+    &__indicator {
         height: 30%;
 
         .tabs {
+            width: 100%;
+            font-size: 12px;
+            border-top: 1px solid #22292c;
+            padding: 1px;
+
             &-item {
-                font-size: 12px;
+                z-index: 1;
+                display: flex;
+                justify-content: center;
+                align-items: center;
+                color: #7a8a94;
+                cursor: pointer;
+                padding: 5px 16px;
+
+                &.is-active {
+                    color: #0D96FF;
+                    background-color: #181E22;
+                }
             }
         }
     }

+ 2 - 2
src/packages/pc/components/modules/quote/chart/kline/index.vue

@@ -15,8 +15,8 @@
                 </ul>
                 <app-echarts :option="options.candlestick" v-model:dataIndex="dataIndex" @ready="mainReady" />
             </div>
-            <app-tabs class="app-tabs--info" direction="bottom" :data-list="chartSeriesTypeList" @change="tabChange"
-                v-if="showIndicator">
+            <app-tabs class="app-echats-kline__indicator" direction="bottom" :data-list="chartSeriesTypeList"
+                @change="tabChange" v-if="showIndicator">
                 <!-- MACD -->
                 <div class="app-echats-kline__container" v-if="activeSeriesType === ChartSeriesType.MACD">
                     <ul class="legend">

+ 4 - 4
src/packages/pc/components/modules/quote/forex/index.less

@@ -1,8 +1,8 @@
 .app-quote-forex {
-    color: #fff;
+    color: #ACB8C0;
 
     ul {
-        padding: .24rem;
+        padding: 5px;
 
         +ul {
             border-top: 1px solid #666;
@@ -10,9 +10,9 @@
 
         li {
             display: flex;
-            font-size: .24rem;
+            font-size: 12px;
             text-align: center;
-            padding: .1rem 0;
+            padding: 3px 0;
 
             span {
                 flex: 1;

+ 2 - 5
src/packages/pc/components/modules/quote/forex/index.vue

@@ -58,6 +58,7 @@
 </template>
 
 <script lang="ts" setup>
+import { computed } from 'vue'
 import { handleNumberValue } from '@/filters'
 import { useFuturesStore } from '@/stores'
 
@@ -66,15 +67,11 @@ const props = defineProps({
         type: String,
         required: true
     },
-    showMore: {
-        type: Boolean,
-        default: true
-    }
 })
 
 const emit = defineEmits(['sellclick', 'buyclick'])
 const futuresStore = useFuturesStore()
-const quote = futuresStore.getQuoteInfo(props.goodsCode)
+const quote = computed(() => futuresStore.getQuoteInfo(props.goodsCode).value)
 
 const onBuyClick = (index: number) => {
     emit('buyclick', index)

+ 12 - 9
src/packages/pc/components/modules/quote/price/index.less

@@ -1,9 +1,10 @@
 .app-quote-price {
-    color: #fff;
+    color: #ACB8C0;
     border-bottom: 1px solid #333;
 
     &__main {
         border-bottom: 1px solid #333;
+        padding: 8px;
 
         .block {
             &-top {
@@ -14,7 +15,8 @@
                 span {
                     &:last-child {
                         font-size: 20px;
-                        color: coral;
+                        color: #F0D523;
+                        margin-left: 10px;
                     }
                 }
             }
@@ -23,10 +25,12 @@
                 display: flex;
                 justify-content: center;
                 align-items: center;
+                margin-top: 10px;
 
                 &-left {
-                    width: 80px;
+                    font-size: 18px;
                     text-align: center;
+                    margin-right: 20px;
                 }
 
                 &-right {
@@ -35,6 +39,7 @@
 
                     span {
                         font-size: 12px;
+                        line-height: normal;
                     }
                 }
             }
@@ -42,6 +47,8 @@
     }
 
     &__more {
+        padding: 5px;
+
         ul {
             display: flex;
             flex-wrap: wrap;
@@ -53,21 +60,17 @@
                 width: 50%;
 
                 &:nth-child(even) {
-                    padding: 2px 10px;
+                    padding: 3px 10px;
                     padding-right: 0;
                 }
 
                 &:nth-child(odd) {
-                    padding: 2px 10px;
+                    padding: 3px 10px;
                     padding-left: 0;
                 }
 
                 span {
                     font-size: 12px;
-
-                    &:first-child {
-                        color: #888;
-                    }
                 }
             }
         }

+ 1 - 0
src/packages/pc/views/market/trade/goods/detail/components/order/index.less

@@ -1,5 +1,6 @@
 .market-trade-goods-detail-order {
     display: flex;
+    height: 100%;
 
     .app-table {
         flex: 1;

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

@@ -1,14 +1,31 @@
 <template>
     <div class="market-trade-goods-detail-order">
-        <app-table v-model:columns="buyColumns"></app-table>
-        <app-table v-model:columns="sellColumns"></app-table>
+        <app-table :data-list="dataList" v-model:columns="buyColumns" showIndex></app-table>
+        <app-table :data-list="dataList" v-model:columns="sellColumns" showIndex></app-table>
     </div>
 </template>
 
 <script lang="ts" setup>
 import { shallowRef } from 'vue'
+import { useRequest } from '@/hooks/request'
+import { BuyOrSell } from '@/constants/order'
+import { queryWrTradeOrderDetail } from '@/services/api/transfer'
 import AppTable from '@pc/components/base/table/index.vue'
 
+const props = defineProps({
+    goodsId: {
+        type: Number,
+        required: true
+    },
+})
+
+const { dataList } = useRequest(queryWrTradeOrderDetail, {
+    params: {
+        goodsid: props.goodsId,
+        buyorsell: BuyOrSell.Buy
+    },
+})
+
 const buyColumns = shallowRef<Model.TableColumn[]>([
     { prop: 'goodscode', label: '销售方' },
     { prop: 'buildtype', label: '卖量' },

+ 17 - 2
src/packages/pc/views/market/trade/goods/detail/index.less

@@ -1,7 +1,20 @@
-.market-trade-goods-detail {
-    .app-view__header {
+.g-view-detail {
+    &__header {
+        display: flex;
+        align-items: center;
+        gap: 10px;
+        width: 100%;
         background-color: #181e22;
         border-bottom: 1px solid #3a87f7;
+        padding: 4px;
+
+        .breadcrumb {
+            color: #0D96FF;
+        }
+
+        .btnbar {
+            margin-left: auto;
+        }
     }
 
     &__container {
@@ -16,6 +29,8 @@
             display: flex;
             flex-direction: column;
             width: 240px;
+            background-color: #14181B;
+            border-left: 1px solid #33393D;
 
             .app-quote-tik {
                 flex: 1;

+ 25 - 10
src/packages/pc/views/market/trade/goods/detail/index.vue

@@ -1,33 +1,48 @@
 <!-- 交易市场-订单交易-详情 -->
 <template>
     <teleport to="#appPageTeleport">
-        <app-view class="market-trade-goods-detail">
+        <app-view class="g-view-detail">
             <template #header>
-                <el-button type="primary" icon="ArrowLeftBold" @click="emit('closed')" />
-                <el-button type="primary" @click="active = false" v-if="active">买卖大厅</el-button>
-                <el-button type="primary" @click="active = true" v-else>图表</el-button>
+                <div class="g-view-detail__header">
+                    <el-button type="primary" icon="ArrowLeftBold" @click="emit('closed')" link />
+                    <ul class="breadcrumb" v-if="quote">
+                        <li class="breadcrumb-item">
+                            <span>{{ quote.goodscode }}</span>
+                            <span>{{ quote.goodsname }}</span>
+                        </li>
+                    </ul>
+                    <div class="btnbar">
+                        <el-button type="primary" @click="active = false" v-if="active">买卖大厅</el-button>
+                        <el-button type="primary" @click="active = true" v-else>图表</el-button>
+                    </div>
+                </div>
             </template>
-            <Chart v-bind="{ goodsCode }" v-if="active" />
-            <Order v-bind="{ goodsCode }" v-else />
+            <Chart class="g-view-detail__container" v-bind="{ goodsCode }" v-if="active" />
+            <Order class="g-view-detail__container" v-bind="{ goodsId }" v-else />
         </app-view>
     </teleport>
 </template>
 
 <script lang="ts" setup>
-import { shallowRef, defineAsyncComponent } from 'vue'
+import { shallowRef, computed, defineAsyncComponent } from 'vue'
+import { useFuturesStore } from '@/stores'
 
 const Chart = defineAsyncComponent(() => import('./components/chart/index.vue'))
 const Order = defineAsyncComponent(() => import('./components/order/index.vue'))
 
-defineProps({
-    goodsCode: {
-        type: String,
+const props = defineProps({
+    goodsId: {
+        type: Number,
         required: true
     },
 })
 
 const emit = defineEmits(['closed'])
+const futuresStore = useFuturesStore()
+const quote = futuresStore.getQuoteInfo(props.goodsId)
 const active = shallowRef(true)
+
+const goodsCode = computed(() => quote.value?.goodscode ?? '')
 </script>
 
 <style lang="less">

+ 14 - 23
src/packages/pc/views/market/trade/goods/index.vue

@@ -1,43 +1,28 @@
 <!-- 交易市场-订单交易 -->
 <template>
     <app-table :data="tableList" v-model:columns="tableColumns" :loading="loading" @row-click="onRowClick" showIndex />
-    <component ref="componentRef" :is="Detail" v-bind="{ goodsCode }" @closed="closeComponent" v-if="componentId" />
+    <component ref="componentRef" :is="Detail" v-bind="{ goodsId }" @closed="closeComponent" v-if="componentId" />
 </template>
 
 <script lang="ts" setup>
-import { shallowRef, computed, onUnmounted, defineAsyncComponent } from 'vue'
+import { shallowRef, computed, onMounted, onUnmounted, defineAsyncComponent } from 'vue'
 import { parsePercent, handleNumberValue } from '@/filters'
-import { useRequest } from '@/hooks/request'
 import { useComponent } from '@/hooks/component'
-import { queryQuoteGoodsList } from '@/services/api/swap'
-import { useFuturesStore, useUserStore } from '@/stores'
+import { useFuturesStore, useGoodsStore } from '@/stores'
 import quoteSocket from '@/services/websocket/quote'
 import AppTable from '@pc/components/base/table/index.vue'
 
 const Detail = defineAsyncComponent(() => import('./detail/index.vue')) // 详情
 
 const futuresStore = useFuturesStore()
-const userStore = useUserStore()
+const goodsStore = useGoodsStore()
 const subscribe = quoteSocket.createSubscribe()
-const goodsCode = shallowRef('')
 
-const { componentRef, componentId, openComponent, closeComponent } = useComponent(() => run(), false)
-
-const { dataList, loading, run } = useRequest(queryQuoteGoodsList, {
-    params: {
-        usertype: userStore.userType ?? 0,
-        marketids: '50101'
-    },
-    onSuccess: (res) => {
-        const goodsCodes = res.data.map((e) => e.goodscode)
-        if (goodsCodes.length) {
-            subscribe.start(...goodsCodes)
-        }
-    }
-})
+const { loading, goodsId, quoteGoodsList } = goodsStore.$toRefs()
+const { componentRef, componentId, openComponent, closeComponent } = useComponent(() => goodsStore.getQuoteGoodsList(), false)
 
 const tableList = computed(() => {
-    return dataList.value.map((item) => {
+    return quoteGoodsList.value.map((item) => {
         const quote = futuresStore.getQuoteInfo(item.goodscode)
         const { bid, bidColor, bidvolume, ask, askColor, askvolume, limitdown, limitup, lastColor, openedColor, lowestColor, highestColor, last, presettle, rise, change, amplitude, highest, lowest, opened } = quote.value ?? {}
         return {
@@ -86,9 +71,15 @@ const tableColumns = shallowRef<Model.TableColumn[]>([
 ])
 
 const onRowClick = (row: Model.OrderQuoteRsp) => {
-    goodsCode.value = row.goodscode
+    goodsId.value = row.goodsid
     openComponent('detail')
 }
 
+onMounted(() => {
+    goodsStore.getQuoteGoodsList().then(() => {
+        const goodsCodes = goodsStore.quoteGoodsList.map((e) => e.goodscode)
+        subscribe.start(...goodsCodes)
+    })
+})
 onUnmounted(() => subscribe.stop())
 </script>

+ 2 - 1
src/stores/index.ts

@@ -7,4 +7,5 @@ export { useFuturesStore } from './modules/futures'
 //export { i18n, useLanguageStore } from './modules/language'
 export { useEnumStore } from './modules/enum'
 export { useErrorInfoStore } from './modules/errorInfo'
-export { useNotice } from './modules/notice'
+export { useNoticeStore } from './modules/notice'
+export { useGoodsStore } from './modules/goods'

+ 59 - 0
src/stores/modules/goods.ts

@@ -0,0 +1,59 @@
+import { toRefs, computed, reactive } from 'vue'
+import { queryQuoteGoodsList } from '@/services/api/swap'
+import { defineStore } from '../store'
+import { useUserStore } from './user'
+
+/**
+ * 订单交易存储对象
+ * @returns 
+ */
+export const useGoodsStore = defineStore(() => {
+    const userStore = useUserStore()
+
+    const state = reactive({
+        loading: false,
+        quoteGoodsList: <Model.QuoteGoodsListRsp[]>[],
+        goodsId: 0,
+    })
+
+    // 当前选中的商品信息
+    const goodsInfo = computed(() => {
+        return {
+            ...state.quoteGoodsList.find((e) => e.goodsid === state.goodsId)
+        }
+    })
+
+    // 当前选中的商品代码
+    const goodsCode = computed(() => {
+        return goodsInfo.value.goodscode ?? ''
+    })
+
+    // 获取商品列表
+    const getQuoteGoodsList = async () => {
+        try {
+            state.loading = true
+            const res = await queryQuoteGoodsList({
+                data: {
+                    usertype: userStore.userType ?? 0,
+                    marketids: '50101'
+                }
+            })
+            const data = res.data
+            state.quoteGoodsList = data
+
+            // 查找当前选中的商品
+            if (!data.every((e) => e.goodsid === state.goodsId)) {
+                state.goodsId = data[0]?.goodsid ?? 0
+            }
+        } finally {
+            state.loading = false
+        }
+    }
+
+    return {
+        ...toRefs(state),
+        goodsInfo,
+        goodsCode,
+        getQuoteGoodsList,
+    }
+})

+ 1 - 1
src/stores/modules/notice.ts

@@ -6,7 +6,7 @@ import { defineStore } from '../store'
 /**
  * 系统通知存储对象
  */
-export const useNotice = defineStore(() => {
+export const useNoticeStore = defineStore(() => {
     const state = reactive({
         loading: false,
         noticeList: <Model.NoticeRsp[]>[], // 通知列表