li.shaoyi 2 سال پیش
والد
کامیت
767f454529

+ 21 - 24
oem/gstj/config/router.json

@@ -21,17 +21,24 @@
                         "children": [
                             {
                                 "authType": 3,
+                                "title": "转让",
+                                "code": "bottom_goods_position_transfer",
+                                "component": "views/footer/goods/position/components/transfer/index.vue",
+                                "className": "el-button--danger"
+                            },
+                            {
+                                "authType": 3,
                                 "title": "交收",
-                                "code": "bottom_goods_position_delivery",
+                                "code": "bottom_goods_position_delivery16",
                                 "component": "views/footer/goods/position/components/delivery/index.vue",
                                 "className": "el-button--primary"
                             },
                             {
                                 "authType": 3,
-                                "title": "转让",
-                                "code": "bottom_goods_position_transfer",
-                                "component": "views/footer/goods/position/components/transfer/index.vue",
-                                "className": "el-button--danger"
+                                "title": "交收",
+                                "code": "bottom_goods_position_delivery50",
+                                "component": "views/footer/goods/position/components/delivery/index.vue",
+                                "className": "el-button--primary"
                             }
                         ]
                     },
@@ -71,7 +78,7 @@
                 "title": "预售转让",
                 "code": "bottom_presell",
                 "component": "views/footer/index.vue",
-                "hidden":true,
+                "hidden": true,
                 "children": [
                     {
                         "authType": 2,
@@ -79,9 +86,7 @@
                         "title": "预售认购",
                         "code": "bottom_presell_presellposition",
                         "component": "views/footer/presell/presellposition/index.vue",
-                        "children": [
-                            
-                        ]
+                        "children": []
                     },
                     {
                         "authType": 2,
@@ -89,9 +94,7 @@
                         "title": "转让持仓",
                         "code": "bottom_presell_transferposition",
                         "component": "views/footer/presell/transferposition/index.vue",
-                        "children": [
-                            
-                        ]
+                        "children": []
                     },
                     {
                         "authType": 2,
@@ -99,9 +102,7 @@
                         "title": "转让委托",
                         "code": "bottom_presell_transferorder",
                         "component": "views/footer/presell/transferorder/index.vue",
-                        "children": [
-                            
-                        ]
+                        "children": []
                     },
                     {
                         "authType": 2,
@@ -109,9 +110,7 @@
                         "title": "转让成交",
                         "code": "bottom_presell_transfertrader",
                         "component": "views/footer/presell/transfertrader/index.vue",
-                        "children": [
-                            
-                        ]
+                        "children": []
                     },
                     {
                         "authType": 2,
@@ -119,9 +118,7 @@
                         "title": "点选交收",
                         "code": "bottom_presell_onlinedelivery",
                         "component": "views/footer/presell/onlinedelivery/index.vue",
-                        "children": [
-                            
-                        ]
+                        "children": []
                     }
                 ]
             },
@@ -262,7 +259,7 @@
                         "url": "presell",
                         "urlType": 1,
                         "component": "views/market/trade/presell/index.vue",
-                        "hidden":true
+                        "hidden": true
                     },
                     {
                         "authType": 1,
@@ -329,7 +326,7 @@
                         "url": "spot",
                         "urlType": 1,
                         "component": "views/query/order/presell/index.vue",
-                        "hidden":true,
+                        "hidden": true,
                         "children": [
                             {
                                 "authType": 2,
@@ -430,7 +427,7 @@
                         "url": "spot",
                         "urlType": 1,
                         "component": "views/query/trade/presell/index.vue",
-                        "hidden":true,
+                        "hidden": true,
                         "children": [
                             {
                                 "authType": 2,

+ 15 - 7
oem/qxst/config/router.json

@@ -14,18 +14,26 @@
                 "children": [
                     {
                         "authType": 3,
+                        "title": "转让",
+                        "code": "bottom_goods_position_transfer",
+                        "component": "views/footer/goods/position/components/transfer/index.vue",
+                        "className": "el-button--danger"
+                    },
+                    {
+                        "authType": 3,
                         "title": "交收",
-                        "code": "bottom_goods_position_delivery",
+                        "code": "bottom_goods_position_delivery16",
                         "component": "views/footer/goods/position/components/delivery/index.vue",
-                        "hidden": true,
-                        "className": "el-button--primary"
+                        "className": "el-button--primary",
+                        "hidden": true
                     },
                     {
                         "authType": 3,
-                        "title": "转让",
-                        "code": "bottom_goods_position_transfer",
-                        "component": "views/footer/goods/position/components/transfer/index.vue",
-                        "className": "el-button--danger"
+                        "title": "交收",
+                        "code": "bottom_goods_position_delivery50",
+                        "component": "views/footer/goods/position/components/delivery/index.vue",
+                        "className": "el-button--primary",
+                        "hidden": true
                     }
                 ]
             },

+ 24 - 16
oem/zrwyt/config/router.json

@@ -21,18 +21,26 @@
                         "children": [
                             {
                                 "authType": 3,
+                                "title": "转让",
+                                "code": "bottom_goods_position_transfer",
+                                "component": "views/footer/goods/position/components/transfer/index.vue",
+                                "className": "el-button--danger"
+                            },
+                            {
+                                "authType": 3,
                                 "title": "交收",
-                                "code": "bottom_goods_position_delivery",
-								"hidden":true,
+                                "code": "bottom_goods_position_delivery16",
                                 "component": "views/footer/goods/position/components/delivery/index.vue",
-                                "className": "el-button--primary"
+                                "className": "el-button--primary",
+                                "hidden": true
                             },
                             {
                                 "authType": 3,
-                                "title": "转让",
-                                "code": "bottom_goods_position_transfer",
-                                "component": "views/footer/goods/position/components/transfer/index.vue",
-                                "className": "el-button--danger"
+                                "title": "交收",
+                                "code": "bottom_goods_position_delivery50",
+                                "component": "views/footer/goods/position/components/delivery/index.vue",
+                                "className": "el-button--primary",
+                                "hidden": true
                             }
                         ]
                     },
@@ -116,7 +124,7 @@
                 "title": "现货仓单",
                 "code": "bottom_spot",
                 "component": "views/footer/index.vue",
-				"hidden": true,
+                "hidden": true,
                 "children": [
                     {
                         "authType": 2,
@@ -236,7 +244,7 @@
                                 "sort": 2,
                                 "title": "中远期挂牌",
                                 "code": "market_trade_goods_50102",
-								"hidden": true,
+                                "hidden": true,
                                 "component": "views/market/trade/goods/list/index.vue"
                             },
                             {
@@ -244,7 +252,7 @@
                                 "sort": 3,
                                 "title": "周结挂牌",
                                 "code": "market_trade_goods_50103",
-								"hidden": true,
+                                "hidden": true,
                                 "component": "views/market/trade/goods/list/index.vue"
                             },
                             {
@@ -252,7 +260,7 @@
                                 "sort": 4,
                                 "title": "月结挂牌",
                                 "code": "market_trade_goods_50104",
-								"hidden": true,
+                                "hidden": true,
                                 "component": "views/market/trade/goods/list/index.vue"
                             }
                         ]
@@ -266,7 +274,7 @@
                         "urlType": 1,
                         "component": "views/market/trade/presell/index.vue",
                         "children": [
-						 {
+                            {
                                 "authType": 2,
                                 "sort": 3,
                                 "title": "全款挂牌",
@@ -286,7 +294,7 @@
                                 "title": "定金转让",
                                 "code": "market_trade_presell_49201",
                                 "component": "views/market/trade/presell/transfer/index.vue"
-                            }                           
+                            }
                         ]
                     },
                     {
@@ -296,7 +304,7 @@
                         "code": "market_trade_spot",
                         "url": "spot",
                         "urlType": 1,
-						"hidden": true,
+                        "hidden": true,
                         "component": "views/market/trade/spot/index.vue"
                     }
                 ]
@@ -393,7 +401,7 @@
                         "code": "query_order_spot",
                         "url": "spot",
                         "urlType": 1,
-						"hidden": true,
+                        "hidden": true,
                         "component": "views/query/order/spot/index.vue",
                         "children": [
                             {
@@ -480,7 +488,7 @@
                         "code": "query_trade_spot",
                         "url": "spot",
                         "urlType": 1,
-						"hidden": true,
+                        "hidden": true,
                         "component": "views/query/trade/spot/index.vue",
                         "children": [
                             {

+ 1 - 1
public/config/appconfig.json

@@ -1,5 +1,5 @@
 {
   "version": "1.0.0",
   "versionCode": "100000",
-  "apiUrl": "http://192.168.31.204:8080/cfg?key=test_204"
+  "apiUrl": "http://192.168.31.134:8080/cfg?key=test_134"
 }

+ 1 - 1
public/config/router.json

@@ -30,7 +30,7 @@
                                 "authType": 3,
                                 "title": "交收",
                                 "code": "bottom_goods_position_delivery16",
-                                "component": "views/footer/goods/position/components/delivery/index.vue",
+                                "component": "views/footer/goods/position/components/delivery16/index.vue",
                                 "className": "el-button--primary"
                             },
                             {

+ 0 - 1
src/business/position/index.ts

@@ -28,7 +28,6 @@ export const usePosition = (...tradeMode: number[]) => {
     onUnmounted(() => subscribe.stop())
 
     return {
-        ...store.$toRefs(),
         positionList,
         getOrderQty
     }

+ 1 - 1
src/packages/pc/components/layouts/header/index.vue

@@ -10,7 +10,7 @@
                 <el-badge type="danger" :is-dot="noticeStore.unreadList.length > 0">
                     <app-icon icon="g-icon--notice" @click="openComponent('notice')" />
                 </el-badge>
-                <app-icon icon="Tickets" @click="openComponent('report')" />
+                <!-- <app-icon icon="Tickets" @click="openComponent('report')" /> -->
                 <app-icon icon="Setting" @click="openComponent('setting')" />
                 <span class="g-icon--minimize" @click="exitFullSreen" v-if="fullScreen"></span>
                 <span class="g-icon--maximize" @click="setFullSreen" v-else></span>

+ 1 - 1
src/packages/pc/views/footer/goods/order/index.vue

@@ -1,6 +1,6 @@
 <!-- 商品订单- 委托 -->
 <template>
-    <app-table :data="dataList" selection-type="single" v-model:columns="tableColumns" :loading="loading"
+    <app-table :data="dataList" selection-type="multiple" v-model:columns="tableColumns" :loading="loading"
         @selection-change="onTableSelect">
         <template #headerRight>
             <el-button type="danger" size="small" :disabled="selectedRows.length === 0"

+ 145 - 0
src/packages/pc/views/footer/goods/position/components/delivery16/index.vue

@@ -0,0 +1,145 @@
+<!-- 商品订单-合约汇总-交收 -->
+<template>
+    <app-drawer title="交收" :width="600" v-model:show="show" :loading="loading" :refresh="refresh">
+        <div>
+            <span>持仓数量:{{ selectedRow.curpositionqty }}</span>
+            <span>可用数量:{{ selectedRow.enableqty }}</span>
+        </div>
+        <table class="table-form" cellspacing="0" cellpadding="0" border="1" style="width: 100%;text-align: center;">
+            <tr>
+                <th>持有人/商品/仓库</th>
+                <th>升贴水</th>
+                <th>数量</th>
+                <th>选择数量</th>
+            </tr>
+            <template v-for="(item, index) in dataList" :key="index">
+                <tr>
+                    <td colspan="4">{{ item.username }}</td>
+                </tr>
+                <tr>
+                    <td>{{ item.wrstandardname }}</td>
+                    <td rowspan="2">{{ item.pricemove }}</td>
+                    <td rowspan="2">{{ item.avalidqty }}</td>
+                    <td rowspan="2">
+                        <el-input-number placeholder="请输入" v-model="item.deliveryLot" :precision="0" :max="item.avalidqty"
+                            :min="0" />
+                    </td>
+                </tr>
+                <tr>
+                    <td>{{ item.warehousename }}</td>
+                </tr>
+                <tr v-if="(dataList.length - 1) > index">
+                    <td colspan="4"></td>
+                </tr>
+            </template>
+        </table>
+        <div>
+            <span>已点选数量:{{ totalQty }}</span>
+        </div>
+        <div>
+            <span>点选合约:{{ selectedRow.goodscode }}</span>
+        </div>
+        <div>
+            <span :class="selectedRow.lastColor">现价:{{ selectedRow.lastprice }}</span>
+        </div>
+        <template #footer>
+            <el-button type="info" @click="onCancel(false)">取消</el-button>
+            <el-button type="primary" @click="onSubmit">交收</el-button>
+        </template>
+    </app-drawer>
+</template>
+
+<script lang="ts" setup>
+import { ref, PropType, computed } from 'vue'
+import { ElMessage, FormInstance, FormRules } from 'element-plus'
+import { useOfflineDelivery } from '@/business/trade'
+import { useFuturesStore } from '@/stores'
+import { getBuyOrSellName, BuyOrSell } from '@/constants/order'
+import { formatDecimal, handlePriceColor } from '@/filters'
+import { useRequest } from '@/hooks/request'
+import { queryWrDeliveryAvalidHoldLB } from '@/services/api/transfer'
+import AppDrawer from '@pc/components/base/drawer/index.vue'
+
+const props = defineProps({
+    selectedRow: {
+        type: Object as PropType<Model.TradePositionRsp & { lastColor: string }>,
+        required: true,
+    }
+})
+
+const { formSubmit, formData, loading } = useOfflineDelivery()
+const show = ref(true)
+const refresh = ref(false)
+const formRef = ref<FormInstance>()
+const futuresStore = useFuturesStore()
+const dataList = ref<(Model.WrDeliveryAvalidHoldLBRsp & { deliveryLot: number })[]>([])
+const quote = futuresStore.getGoodsQuote(props.selectedRow.goodscode)
+
+useRequest(queryWrDeliveryAvalidHoldLB, {
+    params: {
+        goodsid: props.selectedRow.goodsid,
+    },
+    onSuccess: (res) => {
+        dataList.value = res.data.map((e) => ({
+            ...e,
+            deliveryLot: 0,
+        }))
+    }
+})
+
+// 已点选数量
+const totalQty = computed(() => dataList.value.reduce((pre, cur) => pre + cur.deliveryLot, 0))
+
+// 剩余可用点选数量
+const remainQty = computed(() => props.selectedRow.enableqty - totalQty.value)
+
+/// 计算参考损益
+const closepl = computed(() => {
+    const { last = 0 } = quote.value ?? {}
+    const { curpositionqty, curholderamount, agreeunit, buyorsell } = props.selectedRow
+    return (last * curpositionqty * agreeunit - curholderamount) * (buyorsell === BuyOrSell.Buy ? 1 : -1)
+})
+
+// 表单验证规则
+const formRules: FormRules = {
+    DeliveryLot: [{
+        message: '请输入交收数量',
+        validator: () => {
+            return !!formData.DeliveryLot
+        }
+    }],
+    DeliveryInfo: [{
+        required: true,
+        message: '请输入交收信息',
+        validator: () => {
+            return !!formData.DeliveryInfo
+        }
+    }],
+}
+
+const onCancel = (isRefresh = false) => {
+    show.value = false
+    refresh.value = isRefresh
+}
+
+const onSubmit = () => {
+    formRef.value?.validate((valid) => {
+        if (valid) {
+            const { marketid, goodsid, goodscode, buyorsell } = props.selectedRow
+            /// 市场ID
+            formData.Header = { MarketID: marketid, GoodsID: goodsid }
+            formData.GoodsCode = goodscode
+            formData.GoodsID = goodsid
+            formData.BuyOrSell = buyorsell
+            formSubmit().then(() => {
+                ElMessage.success('交收成功')
+                onCancel(true)
+            }).catch((err) => {
+                ElMessage.error('交收失败:' + err)
+            })
+        }
+    })
+
+}
+
+</script>

+ 17 - 4
src/packages/pc/views/footer/goods/position/index.vue

@@ -1,6 +1,6 @@
 <!-- 商品订单-持仓汇总 -->
 <template>
-    <app-table :data="positionList" v-model:columns="tableColumns" :loading="loading" @row-click="showComponent">
+    <app-table :data="positionList" v-model:columns="tableColumns" @row-click="showComponent">
         <!-- 挂牌类型 -->
         <template #buyorsell="{ value }">
             {{ getBuyOrSellName(value) }}
@@ -8,7 +8,7 @@
         <!-- 最新价 -->
         <template #lastprice="{ row }">
             <span :class="row.lastColor">
-                {{ handleNumberValue(formatDecimal(row.last, row.decimalplace)) }}
+                {{ handleNumberValue(formatDecimal(row.lastprice, row.decimalplace)) }}
             </span>
         </template>
         <!-- 市值-->
@@ -21,7 +21,7 @@
         </template>
         <!-- 操作 -->
         <template #operate="{ row }">
-            <app-auth-operation :code="code" :options="{ selectedRow: row }" />
+            <app-auth-operation :code="code" :menus="handleOperateButtons(row)" :options="{ selectedRow: row }" />
         </template>
         <template #footer>
             <component ref="componentRef" v-bind="{ selectedRow }" :is="componentMap.get(componentId)"
@@ -48,7 +48,7 @@ const componentMap = new Map<string, unknown>([
     ['transfer', defineAsyncComponent(() => import('./components/transfer/index.vue'))],
 ])
 
-const { positionList, loading } = usePosition(50, 16)
+const { positionList } = usePosition(50, 16)
 const selectedRow = shallowRef<Model.TradePositionRsp>()
 const { componentRef, componentId, openComponent, closeComponent } = useComponent()
 
@@ -66,6 +66,19 @@ const tableColumns = shallowRef<Model.TableColumn[]>([
     { prop: 'operate', label: '操作', fixed: 'right', width: 140 },
 ])
 
+const handleOperateButtons = (row: Model.TradePositionRsp) => {
+    const buttons = ['bottom_goods_position_transfer']
+    switch (row.trademode) {
+        case 16:
+            buttons.push('bottom_goods_position_delivery16')
+            break;
+        case 50:
+            buttons.push('bottom_goods_position_delivery50')
+            break;
+    }
+    return buttons
+}
+
 const showComponent = (row: Model.TradePositionRsp) => {
     selectedRow.value = row
     openComponent('transfer')

+ 4 - 6
src/packages/pc/views/market/trade/presell/transfer/listing/index.vue

@@ -68,14 +68,13 @@ import { BuyOrSell, getBuyOrSellList } from '@/constants/order'
 import { useRequest } from '@/hooks/request'
 import { queryMineTradePositionExs } from '@/services/api/transfer'
 import { useOrder } from '@/business/trade'
-import { usePosition } from '@/business/position'
-import { useFuturesStore, useSettingStore } from '@/stores'
+import { useFuturesStore, useSettingStore, usePositionStore } from '@/stores'
 import Forex from '@pc/components/modules/quote/forex/index.vue'
 import Icon from '@pc/components/base/icon/index.vue'
 
 const settingStore = useSettingStore()
 const futuresStore = useFuturesStore()
-const { getOrderQty, positionList: ll } = usePosition(16)
+const positionStore = usePositionStore()
 const { selectedGoodsId, selectedGoods, marketGoodsList } = futuresStore.$toRefs()
 const { formData, loading, formSubmit } = useOrder()
 const formRef = shallowRef<FormInstance>()
@@ -99,10 +98,9 @@ const { dataList: positionList, run: getMineTradePositionExs } = useRequest(quer
 
 // 可用数量
 const enableqty = computed(() => {
-    console.log(ll.value, selectedGoods.value)
     if (selectedGoods.value?.trademode === 16) {
-
-        return getOrderQty(BuyOrSell.Buy, selectedGoodsId.value)
+        const item = positionStore.positionList.find((e) => e.trademode === 16 && e.goodsid === selectedGoodsId.value)
+        return item?.enableqty ?? 0
     } else {
         const [firstItem] = positionList.value
         return firstItem ? firstItem.buycurpositionqty - firstItem.buyfrozenqty : 0

+ 8 - 2
src/stores/modules/futures.ts

@@ -77,8 +77,14 @@ export const useFuturesStore = defineStore(() => {
                     goodsCodes: codes.join(',')
                 }
             }).then((res) => {
-                res.data.forEach((item) => {
-                    updateGoodsQuote(item)
+                // 只遍历有盘面的商品
+                // res.data.forEach((item) => {
+                //     updateGoodsQuote(item)
+                // })
+                // 遍历所有商品
+                codes.forEach((goodscode) => {
+                    const item = res.data.find((e) => e.goodscode === goodscode)
+                    updateGoodsQuote(item ?? { goodscode })
                 })
                 rsponseTask.forEach((fn) => fn())
                 rsponseTask.clear()

+ 1 - 2
src/stores/modules/position.ts

@@ -30,7 +30,6 @@ export const usePositionStore = defineStore(() => {
     // 持仓汇总计算列表
     const positionComputedList = computed(() => {
         const result: (Model.TradePositionRsp & {
-            last: number; // 最新价
             lastColor: string; // 最新价颜色
             closepl: number; // 浮动盈亏
             closeplColor: string; // 浮动盈亏颜色
@@ -49,7 +48,7 @@ export const usePositionStore = defineStore(() => {
 
             result.push({
                 ...item,
-                last: price,
+                lastprice: price,
                 lastColor: handlePriceColor(price, presettle),
                 closepl,
                 closeplColor: handlePriceColor(closepl, 0),