li.shaoyi 2 年之前
父節點
當前提交
88662fdddd

+ 11 - 2
src/packages/mobile/views/order/position/components/goods/close/Index.vue

@@ -25,7 +25,7 @@
                     <Field name="OrderPrice" :rules="formRules.OrderPrice" label="转让价格">
                         <template #input>
                             <Stepper v-model="formData.OrderPrice" theme="round" button-size="22" :min="0"
-                                :decimal-length="selectedRow.decimalplace" :auto-fixed="false" />
+                                :decimal-length="selectedRow.decimalplace" :step="priceStep" :auto-fixed="false" />
                         </template>
                     </Field>
                     <Field name="OrderQty" :rules="formRules.OrderQty" label="转让数量">
@@ -44,7 +44,7 @@
 </template>
 
 <script lang="ts" setup>
-import { shallowRef, PropType, onMounted } from 'vue'
+import { shallowRef, PropType, onMounted, computed } from 'vue'
 import AppModal from '@/components/base/modal/index.vue'
 import { CellGroup, Cell, Button, FieldRule, Form, Field, Stepper, FormInstance } from 'vant'
 import { getBuyOrSellName, BuyOrSell } from '@/constants/order'
@@ -72,6 +72,15 @@ const showModal = shallowRef(true)
 const refresh = shallowRef(false)
 const { formSubmit, formData } = useOrder()
 
+// 价格步长
+const priceStep = computed(() => {
+    const { quoteminunit = 0, decimalplace = 0 } = quote.value ?? {}
+    if (quoteminunit) {
+        return quoteminunit * Math.pow(10, decimalplace * -1)
+    }
+    return 1
+})
+
 // 表单验证规则
 const formRules: { [key: string]: FieldRule[] } = {
     OrderPrice: [{

+ 3 - 3
src/packages/mobile/views/order/position/components/goods/delivery50/index.vue

@@ -25,7 +25,7 @@
                     <Cell title="交收对手方" :value="selectedRow.matchname" />
                     <Field name="DeliveryLot" type="digit" :rules="formRules.DeliveryLot" label="交收数量">
                         <template #input>
-                            <Stepper v-model="formData.DeliveryLot" theme="round" button-size="22" :min="selectedRow.mindeliverylot"
+                            <Stepper v-model="formData.DeliveryLot" theme="round" button-size="22" :min="0"
                                 :max="selectedRow.enableqty" :auto-fixed="false" integer />
                         </template>
                     </Field>
@@ -71,10 +71,10 @@ const formRules: { [key: string]: FieldRule[] } = {
     DeliveryLot: [{
         message: '请输入交收数量',
         validator: (val) => {
-            if (val <= props.selectedRow.enableqty) {
+            if (val <= props.selectedRow.mindeliverylot) {
                 return true
             }
-            return '超过可用交收数量'
+            return '不能小于最小交收数量' + `${props.selectedRow.mindeliverylot}`
         }
     }],
     DeliveryInfo: [{

+ 11 - 2
src/packages/mobile/views/order/position/components/goods/detail/components/transfer/Index.vue

@@ -26,7 +26,7 @@
                     <Field name="OrderPrice" :rules="formRules.OrderPrice" label="转让价格">
                         <template #input>
                             <Stepper v-model="formData.OrderPrice" theme="round" button-size="22" :min="0"
-                                :decimal-length="selectedRow.decimalplace" :auto-fixed="false" />
+                                :decimal-length="selectedRow.decimalplace" :step="priceStep" :auto-fixed="false" />
                         </template>
                     </Field>
                     <Field name="OrderQty" :rules="formRules.OrderQty" label="转让数量">
@@ -64,6 +64,16 @@ const props = defineProps({
 
 const futuresStore = useFuturesStore()
 const positionStore = usePositionStore()
+const quote = futuresStore.getGoodsQuote(props.selectedRow.goodscode)
+
+// 价格步长
+const priceStep = computed(() => {
+    const { quoteminunit = 0, decimalplace = 0 } = quote.value ?? {}
+    if (quoteminunit) {
+        return quoteminunit * Math.pow(10, decimalplace * -1)
+    }
+    return 1
+})
 
 // 可用数量
 const maxQty = computed(() => {
@@ -71,7 +81,6 @@ const maxQty = computed(() => {
     return Math.min(item?.enableqty ?? 0, props.selectedRow.holderqty)
 })
 
-const quote = futuresStore.getGoodsQuote(props.selectedRow.goodscode)
 // 损益
 const closepl = computed(() => {
     const { presettle = 0, last = 0 } = quote.value ?? {}

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

@@ -43,7 +43,7 @@ const props = defineProps({
     title: String,
     data: {
         type: Object,
-        required: true
+        default: () => ({})
     },
     cellProps: {
         type: Array as PropType<cellProp[]>,

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

@@ -1,6 +1,6 @@
 .app-footer {
     display: flex;
-    height: 330px;
+    height: 100%;
     color: #fff;
     background-color: #0e0e0f;
     border-top: 1px solid #363f45;

+ 80 - 57
src/packages/pc/components/layouts/header/components/report/index.vue

@@ -23,12 +23,11 @@
                 {{ 'RMB' }}
             </template>
             <!-- 结算时间 -->
-            <template #tradestatuschangetime="{ value }">
-                {{ formatDate(value) }}
+            <template #tradedate>
+                {{ tradeDate }}
             </template>
         </app-table-details>
-        <app-table-details title="资金信息" :data="taaccount" :label-width="180" :cell-props="taDetailProps" :column="2"
-            v-if="taaccount" />
+        <app-table-details title="资金信息" :data="taaccount" :label-width="180" :cell-props="taDetailProps" :column="2" />
         <fieldset class="g-fieldset">
             <legend class="g-fieldset__legend">出入金明细</legend>
             <app-table :data="logs" v-model:columns="logsTableColumns" />
@@ -52,12 +51,12 @@
 </template>
 
 <script lang="ts" setup>
-import { ref, shallowRef, computed } from 'vue'
+import { ref, shallowRef, computed, onMounted } from 'vue'
 import eventBus from '@/services/bus'
 import { useLoginStore, useAccountStore, useUserStore } from '@/stores'
 import { formatDate } from '@/filters'
 import { localData } from '@/stores/storage'
-import { onMounted } from 'vue'
+import { queryMarketRun } from '@/services/api/market'
 import { queryReportBankAccountOutInLog, queryReportMonthTaaccount, queryReportReckonDayPosition, queryReportReckonDayTaaccount, queryReportTradeDetail } from '@/services/api/report'
 import AppDrawer from '@pc/components/base/drawer/index.vue'
 import AppTable from '@pc/components/base/table/index.vue'
@@ -68,14 +67,28 @@ const loading = ref(false)
 /// 报表类型 日报表-1 月报表-2
 const reporttype = ref(1)
 /// 查询时间
-const cycletime = shallowRef(formatDate(new Date().toISOString(), 'YYYYMMDD'))
+const cycletime = shallowRef('')
 
 const pickerType = computed(() => reporttype.value === 1 ? 'date' : 'month')
 const pickerFormat = computed(() => reporttype.value === 1 ? 'YYYYMMDD' : 'YYYYMM')
 
+// 结算日期
+const tradeDate = computed(() => {
+    if (taaccount.value) {
+        if ('reckondate' in taaccount.value) {
+            return formatDate(taaccount.value.reckondate, 'YYYY-MM-DD')
+        }
+        if ('cycletime' in taaccount.value) {
+            return formatDate(taaccount.value.cycletime, 'YYYY-MM')
+        }
+    }
+    return '--'
+})
+
 const loginStore = useLoginStore()
 const currentAccount = useAccountStore().currentAccount
 const userInfo = useUserStore().userInfo
+const marketInfo = shallowRef<Model.MarketRunRsp>()
 
 const taaccount = shallowRef<Model.ReportMonthTaaccountRsp | Model.ReportReckonDayTaaccountRsp>()
 const logs = shallowRef<Model.ReportBankAccountOutInLogRsp[]>([])
@@ -110,67 +123,77 @@ const onDisAgree = () => {
     eventBus.$emit('LogoutNotify')
 }
 
+const onChange = () => {
+    const dateString = marketInfo.value?.pretradedate ?? new Date().toISOString()
+    cycletime.value = formatDate(dateString, pickerFormat.value)
+}
+
+// 查询市场上个交易日
+const getMarketRun = queryMarketRun().then((res) => {
+    marketInfo.value = res.data.find((e) => e.marketid === 0)
+    const dateString = marketInfo.value?.pretradedate ?? new Date().toISOString()
+    cycletime.value = formatDate(dateString, 'YYYYMMDD')
+})
+
 const reloadData = () => {
     loading.value = true
-    Promise.all([
-        /// 报表 - 交易商结算单 - 出入金明细
-        queryReportBankAccountOutInLog({
-            data: {
-                tradedate: cycletime.value,
-                reporttype: reporttype.value,
-            }
-        }),
-        (() => {
-            if (reporttype.value === 2) {
-                /// 表 - 交易商结算单 - 资金信息(月)
-                return queryReportMonthTaaccount({
-                    data: {
-                        cycletime: cycletime.value,
-                    }
-                })
-            } else {
-                /// 报表 - 交易商结算单 - 资金信息(日)
-                return queryReportReckonDayTaaccount({
-                    data: {
-                        reckondate: cycletime.value,
-                    }
-                })
-            }
-        })(),
-        /// 报表 - 交易商结算单 - 持仓汇总
-        queryReportReckonDayPosition({
-            data: {
-                reckondate: cycletime.value,
-                reporttype: reporttype.value
-            }
-        }),
-        /// 报表 - 交易商结算单 - 成交明细
-        queryReportTradeDetail({
-            data: {
-                histradedate: cycletime.value,
-                reporttype: reporttype.value
-            }
+    getMarketRun.finally(() => {
+        Promise.all([
+            /// 报表 - 交易商结算单 - 出入金明细
+            queryReportBankAccountOutInLog({
+                data: {
+                    tradedate: cycletime.value,
+                    reporttype: reporttype.value,
+                }
+            }),
+            (() => {
+                if (reporttype.value === 2) {
+                    /// 表 - 交易商结算单 - 资金信息(月)
+                    return queryReportMonthTaaccount({
+                        data: {
+                            cycletime: cycletime.value,
+                        }
+                    })
+                } else {
+                    /// 报表 - 交易商结算单 - 资金信息(日)
+                    return queryReportReckonDayTaaccount({
+                        data: {
+                            reckondate: cycletime.value,
+                        }
+                    })
+                }
+            })(),
+            /// 报表 - 交易商结算单 - 持仓汇总
+            queryReportReckonDayPosition({
+                data: {
+                    reckondate: cycletime.value,
+                    reporttype: reporttype.value
+                }
+            }),
+            /// 报表 - 交易商结算单 - 成交明细
+            queryReportTradeDetail({
+                data: {
+                    histradedate: cycletime.value,
+                    reporttype: reporttype.value
+                }
+            })
+        ]).then(([res1, res2, res3, res4]) => {
+            logs.value = res1.data
+            taaccount.value = res2.data[0]
+            dpostions.value = res3.data
+            tradedetails.value = res4.data
+        }).finally(() => {
+            loading.value = false
         })
-    ]).then(([res1, res2, res3, res4]) => {
-        logs.value = res1.data
-        taaccount.value = res2.data[0]
-        dpostions.value = res3.data
-        tradedetails.value = res4.data
-    }).finally(() => {
-        loading.value = false
     })
 }
 
-const onChange = () => {
-    cycletime.value = formatDate(new Date().toISOString(), pickerFormat.value)
-}
-
 /// 账户信息
 const accountDetailProps = [
     { prop: 'currencyid', label: '币种:' },
     { prop: 'accountid', label: '账号:' },
     { prop: 'accountname', label: '名称:' },
-    { prop: 'tradestatuschangetime', label: '结算日期:' },
+    { prop: 'tradedate', label: '结算日期:' },
 ]
 
 /// 资金信息

+ 4 - 0
src/packages/pc/components/layouts/page/index.less

@@ -58,6 +58,10 @@
         }
     }
 
+    &__footer{
+        height: 330px;
+    }
+
     &__wrapper {
         flex: 1;
         display: flex;

+ 12 - 3
src/packages/pc/views/footer/goods/detail/components/transfer/index.vue

@@ -30,8 +30,8 @@
                 </div>
             </el-form-item>
             <el-form-item prop="OrderPrice" label="转让价格">
-                <el-input-number placeholder="请输入价格" v-model="formData.OrderPrice"
-                    :decimal-length="selectedRow.decimalplace" />
+                <el-input-number placeholder="请输入价格" v-model="formData.OrderPrice" :step="priceStep"
+                    :precision="selectedRow.decimalplace" />
             </el-form-item>
         </el-form>
         <template #footer>
@@ -60,6 +60,7 @@ const props = defineProps({
 
 const futuresStore = useFuturesStore()
 const positionStore = usePositionStore()
+const quote = futuresStore.getGoodsQuote(props.selectedRow.goodscode)
 
 // 可用数量
 const maxQty = computed(() => {
@@ -67,7 +68,15 @@ const maxQty = computed(() => {
     return Math.min(item?.enableqty ?? 0, props.selectedRow.holderqty)
 })
 
-const quote = futuresStore.getGoodsQuote(props.selectedRow.goodscode)
+// 价格步长
+const priceStep = computed(() => {
+    const { quoteminunit = 0, decimalplace = 0 } = quote.value ?? {}
+    if (quoteminunit) {
+        return quoteminunit * Math.pow(10, decimalplace * -1)
+    }
+    return 1
+})
+
 // 损益
 const closepl = computed(() => {
     const { presettle = 0, last = 0 } = quote.value ?? {}

+ 2 - 2
src/packages/pc/views/footer/goods/position/components/delivery50/index.vue

@@ -34,7 +34,7 @@
             </el-form-item>
             <el-form-item prop="DeliveryLot" label="交收数量">
                 <el-input-number placeholder="请输入数量" v-model="formData.DeliveryLot" :precision="0"
-                    :max="selectedRow.enableqty" :min="selectedRow.mindeliverylot" />
+                    :max="selectedRow.enableqty" :min="0" />
             </el-form-item>
             <el-form-item prop="DeliveryInfo" label="交收信息">
                 <el-input type="textarea" placeholder="请输入交收信息" v-model="formData.DeliveryInfo" />
@@ -78,7 +78,7 @@ const formRules: FormRules = {
             if (value >= props.selectedRow.mindeliverylot) {
                 callback()
             } else {
-                callback(new Error('不能小于最小交收数量'+`${props.selectedRow.mindeliverylot}`))
+                callback(new Error('不能小于最小交收数量' + `${props.selectedRow.mindeliverylot}`))
             }
         }
     }],

+ 12 - 3
src/packages/pc/views/footer/goods/position/components/transfer/index.vue

@@ -39,8 +39,8 @@
                 </div>
             </el-form-item>
             <el-form-item prop="OrderPrice" label="转让价格">
-                <el-input-number placeholder="请输入价格" v-model="formData.OrderPrice"
-                    :decimal-length="selectedRow.decimalplace" />
+                <el-input-number placeholder="请输入价格" v-model="formData.OrderPrice" :step="priceStep"
+                    :precision="selectedRow.decimalplace" />
             </el-form-item>
         </el-form>
         <template #footer>
@@ -51,7 +51,7 @@
 </template>
 
 <script lang="ts" setup>
-import { ref, PropType, onMounted } from 'vue'
+import { ref, PropType, onMounted,computed } from 'vue'
 import { ElMessage, FormInstance, FormRules } from 'element-plus'
 import { useOrder } from '@/business/trade'
 import { formatDecimal, parsePercent } from '@/filters'
@@ -80,6 +80,15 @@ const formRef = ref<FormInstance>()
 const qtyStepList = [0.25, 0.5, 0.75, 1] // 数量步长列表
 const qtyStep = ref<number>() // 数量步长
 
+// 价格步长
+const priceStep = computed(() => {
+    const { quoteminunit = 0, decimalplace = 0 } = quote.value ?? {}
+    if (quoteminunit) {
+        return quoteminunit * Math.pow(10, decimalplace * -1)
+    }
+    return 1
+})
+
 const formRules: FormRules = {
     OrderPrice: [{
         message: '请输入转让价格',