li.shaoyi 2 роки тому
батько
коміт
df00b98efc

+ 32 - 0
src/hooks/hqchart/candlestick/types.ts

@@ -1,3 +1,35 @@
+export interface KLineChartContainer {
+    TitlePaint: {
+        Period: number;
+        GetColor: (price: number, yclose: number) => string;
+        GetFormatTitle: (data: FormatTitleData) => FormatTitleReturn;
+        AmountColor: string;
+        VolColor: string;
+        PositionColor: string;
+        DateTimeColor: string;
+    }[]
+}
+
+export interface FormatTitleData {
+    Data: {
+        Date: number;
+        Time: number;
+        Open: number;
+        High: number;
+        Low: number;
+        Close: number;
+        YClose: number;
+        Vol: number;
+    }
+}
+
+export interface FormatTitleReturn {
+    AryText: {
+        Text: string;
+        Color: string;
+    }[]
+}
+
 // https://blog.csdn.net/jones2000/article/details/100181279
 export interface NetworkFilterData {
     Name: string; // 原始的类名::函数名

+ 37 - 0
src/hooks/hqchart/timeline/types.ts

@@ -1,3 +1,40 @@
+export interface MinuteChartContainer {
+    TitlePaint: {
+        Period: number;
+        GetColor: (price: number, yclose: number) => string;
+        GetFormatTitle: (data: FormatTitleData) => FormatTitleReturn;
+        AmountColor: string;
+        VolColor: string;
+        PositionColor: string;
+        DateTimeColor: string;
+        IsShowDate: boolean;
+        IsShowTime: boolean;
+    }[]
+}
+
+export interface FormatTitleData {
+    Data: {
+        AvPrice: number;
+        Date: number;
+        Time: number;
+        DateTime: string;
+        Open: number;
+        High: number;
+        Low: number;
+        Close: number;
+        YClose: number;
+        Vol: number;
+        Increase: number;
+    }
+}
+
+export interface FormatTitleReturn {
+    AryText: {
+        Text: string;
+        Color: string;
+    }[]
+}
+
 // https://blog.csdn.net/jones2000/article/details/100181279
 export interface NetworkFilterData {
     Name: string; // 原始的类名::函数名

+ 23 - 16
src/packages/mobile/components/modules/hqchart/candlestick/index.vue

@@ -6,14 +6,13 @@
 </template>
 
 <script lang="ts" setup>
-import { shallowRef, watch, computed } from 'vue'
+import { shallowRef, shallowReactive, watch, computed } from 'vue'
 import { Chart } from 'hqchart'
 import { changeUnit, handleNumberValue } from '@/filters'
 import { ChartCycleType } from '@/constants/chart'
 import { useFuturesStore } from '@/stores'
 import { useDataset } from '@/hooks/hqchart/candlestick/dataset'
-import { NetworkFilterData, NetworkFilterCallback } from '@/hooks/hqchart/candlestick/types'
-import { KLineChartContainer } from './types'
+import { KLineChartContainer, NetworkFilterData, NetworkFilterCallback } from '@/hooks/hqchart/candlestick/types'
 import HQChart from '@/components/base/hqchart/index.vue'
 import Tabs from '@/components/base/tabs/index.vue'
 
@@ -37,13 +36,12 @@ const { quoteWatch, getGoodsQuote } = useFuturesStore()
 const goods = getGoodsQuote(props.goodsCode)
 const chartInstance = shallowRef() // 图表实例
 
-const tabs = [
+const tabs = shallowReactive([
     { label: 'MACD', value: 'MACD' },
-    { label: 'VOL', value: 'VOL' },
     { label: 'KDJ', value: 'KDJ' },
     { label: 'RSI', value: 'RSI' },
-    { label: 'CCI', value: 'CCI' }
-]
+    { label: 'WR', value: 'WR' }
+])
 
 // 自定义品种小数位
 // https://blog.csdn.net/jones2000/article/details/106592730/
@@ -82,8 +80,7 @@ const chartOption = {
     NetworkFilter: (data: NetworkFilterData, callback: NetworkFilterCallback) => networkFilter(data, callback),
     // https://blog.csdn.net/jones2000/article/details/102928907
     Windows: [
-        { Index: 'MA', Change: false, Modify: false },
-        { Index: 'MACD', Change: false, Modify: false, Close: false }
+        { Index: 'MA', Change: false, Modify: false, Close: false }
     ],
     IsCorssOnlyDrawKLine: true,  // 十字光标只能在K线上
     CorssCursorTouchEnd: true, // 手指离开屏幕 隐藏十字光标
@@ -140,14 +137,18 @@ const chartOption = {
             // 自定义标题栏,参考源码 DynamicKLineTitlePainting.GetFormatTitle
             paint.GetFormatTitle = (data) => {
                 const { Open, High, Low, Close, Vol, YClose } = data.Data
+                const AryText = [
+                    { Text: '开:' + handleNumberValue(Open), Color: paint.GetColor(Open, YClose) },
+                    { Text: '高:' + handleNumberValue(High), Color: paint.GetColor(High, YClose) },
+                    { Text: '低:' + handleNumberValue(Low), Color: paint.GetColor(Low, YClose) },
+                    { Text: '收:' + handleNumberValue(Close), Color: paint.GetColor(Close, YClose) },
+                    { Text: '量:' + changeUnit(Vol), Color: paint.VolColor }
+                ]
+                if (goods.value?.trademode === 99) {
+                    AryText.pop()
+                }
                 return {
-                    AryText: [
-                        { Text: '开:' + handleNumberValue(Open), Color: paint.GetColor(Open, YClose) },
-                        { Text: '高:' + handleNumberValue(High), Color: paint.GetColor(High, YClose) },
-                        { Text: '低:' + handleNumberValue(Low), Color: paint.GetColor(Low, YClose) },
-                        { Text: '收:' + handleNumberValue(Close), Color: paint.GetColor(Close, YClose) },
-                        { Text: '量:' + changeUnit(Vol), Color: paint.VolColor }
-                    ]
+                    AryText
                 }
             }
         }
@@ -161,6 +162,12 @@ const changeIndex = (index: number) => {
 }
 
 const onReady = (chart: unknown) => {
+    if (goods.value?.trademode === 99) {
+        chartOption.Windows.push({ Index: 'MACD', Change: true, Modify: false, Close: false })
+    } else {
+        tabs.unshift({ label: 'VOL', value: 'VOL' })
+        chartOption.Windows.push({ Index: 'VOL', Change: true, Modify: false, Close: false })
+    }
     chartInstance.value = chart
     chartInstance.value.SetOption(chartOption)
 }

+ 0 - 27
src/packages/mobile/components/modules/hqchart/candlestick/types.ts

@@ -1,27 +0,0 @@
-export interface KLineChartContainer {
-    TitlePaint: {
-        GetColor: (price: number, yclose: number) => string;
-        GetFormatTitle: (data: FormatTitleData) => FormatTitleReturn;
-        AmountColor: string;
-        VolColor: string;
-        PositionColor: string;
-    }[]
-}
-
-export interface FormatTitleData {
-    Data: {
-        Open: number;
-        High: number;
-        Low: number;
-        Close: number;
-        YClose: number;
-        Vol: number;
-    }
-}
-
-export interface FormatTitleReturn {
-    AryText: {
-        Text: string;
-        Color: string;
-    }[]
-}

+ 31 - 13
src/packages/mobile/components/modules/hqchart/timeline/index.vue

@@ -7,9 +7,10 @@
 <script lang="ts" setup>
 import { shallowRef } from 'vue'
 import { Chart } from 'hqchart'
+import { changeUnit, handleNumberValue } from '@/filters'
 import { useFuturesStore } from '@/stores'
 import { useDataset } from '@/hooks/hqchart/timeline/dataset'
-import { NetworkFilterData, NetworkFilterCallback } from '@/hooks/hqchart/timeline/types'
+import { MinuteChartContainer, NetworkFilterData, NetworkFilterCallback } from '@/hooks/hqchart/timeline/types'
 import HQChart from '@/components/base/hqchart/index.vue'
 
 const props = defineProps({
@@ -63,23 +64,40 @@ const chartOption = {
         IsShowTime: false,
     },
     Frame: [
-        // {
-        //     Custom: [
-        //         {
-        //             Type: 0,
-        //             Position: 'right',
-        //         }
-        //     ]
-        // },
-        // {
-        //     Height: 0 // 第2个成交量图高度设置0隐藏掉
-        // }
-    ]
+        {}
+    ],
+    OnCreatedCallback: (chart: MinuteChartContainer) => {
+        const paint = chart.TitlePaint[0]
+        if (paint) {
+            const { FormatDateTimeString } = Chart.IFrameSplitOperator
+            // 自定义标题栏,参考源码 DynamicMinuteTitlePainting.GetFormatTitle
+            paint.GetFormatTitle = (data) => {
+                const { DateTime, Open, Close, Vol, YClose, Increase } = data.Data
+                const AryText = [
+                    { Text: FormatDateTimeString(DateTime, paint.IsShowDate, paint.IsShowTime), Color: paint.DateTimeColor },
+                    { Text: '价:' + handleNumberValue(Close), Color: paint.GetColor(Open, YClose) },
+                    { Text: '幅:' + Increase.toFixed(2) + '%', Color: paint.GetColor(Increase, 0) },
+                    { Text: '量:' + changeUnit(Vol), Color: paint.VolColor }
+                ]
+                if (goods.value?.trademode === 99) {
+                    AryText.pop()
+                }
+                return {
+                    AryText
+                }
+            }
+        }
+    }
 }
 
 const onReady = (chart: unknown) => {
     chartInstance.value = chart
     getTSDataAsync.then(() => {
+        if (goods.value?.trademode === 99) {
+            chartOption.Frame.push({
+                Height: 0 // 第2个成交量图高度设置0隐藏掉
+            })
+        }
         // https://blog.csdn.net/jones2000/article/details/104165374
         const minuteTimeStringData = Chart.JSChart.GetMinuteTimeStringData()
         const minuteCoordinateData = Chart.JSChart.GetMinuteCoordinateData()

+ 9 - 3
src/packages/mobile/components/modules/quote/tik/index.vue

@@ -13,7 +13,7 @@
 </template>
 
 <script lang="ts" setup>
-import { ref } from 'vue'
+import { ref, shallowReactive, onMounted } from 'vue'
 import { formatDate, handleNumberValue } from '@/filters'
 import { useRequest } from '@/hooks/request'
 import { queryHistoryTikDatas, queryMarketRun } from '@/services/api/market'
@@ -31,11 +31,11 @@ const { getGoodsQuote, quoteWatch } = useFuturesStore()
 const quote = getGoodsQuote(props.goodsCode)
 const dataList = ref<Model.HistoryTikDatasRsp[]>([])
 
-const columns: Model.TableColumn[] = [
+const columns = shallowReactive<Model.TableColumn[]>([
     { prop: 'TS', label: '时间' },
     { prop: 'PE', label: '最新价' },
     { prop: 'Vol', label: '现量' },
-]
+])
 
 const { run: getHistoryTikDatas } = useRequest(queryHistoryTikDatas, {
     manual: true,
@@ -89,6 +89,12 @@ quoteWatch(props.goodsCode, (q) => {
         })
     }
 })
+
+onMounted(() => {
+    if (quote.value?.trademode === 99) {
+        columns.pop()
+    }
+})
 </script>
 
 <style lang="less">

+ 1 - 2
src/packages/mobile/views/transfer/delisting/Index.vue

@@ -20,7 +20,6 @@
 import { shallowRef, defineAsyncComponent } from 'vue'
 import { Button } from 'vant'
 import { useNavigation } from '@mobile/router/navigation'
-import { BuyOrSell } from '@/constants/order'
 import { useComponent } from '@/hooks/component'
 import { useRequest } from '@/hooks/request'
 import { queryPresaleDefault, queryWrTradeOrderDetail } from '@/services/api/transfer'
@@ -52,7 +51,7 @@ const { loading, pageIndex, pageCount, run } = useRequest(queryWrTradeOrderDetai
     params: {
         pagesize: 20,
         goodsid,
-        buyorsell: BuyOrSell.Sell,
+        buyorsell: getQueryStringToNumber('buyorsell'),
     },
     onSuccess: (res) => {
         if (pageIndex.value === 1) {

+ 4 - 3
src/packages/mobile/views/transfer/detail2/index.vue

@@ -34,7 +34,7 @@ import { useNavigation } from '@mobile/router/navigation'
 import { useFuturesStore } from '@/stores'
 
 const Price = defineAsyncComponent(() => import('@mobile/components/modules/quote/price/index.vue'))
-const Chart = defineAsyncComponent(() => import('@mobile/components/modules/quote/chart/index.vue'))
+const Chart = defineAsyncComponent(() => import('@mobile/components/modules/hqchart/index.vue'))
 const Forex = defineAsyncComponent(() => import('@mobile/components/modules/quote/forex/index.vue'))
 
 const componentMap = new Map<string, unknown>([
@@ -74,11 +74,12 @@ const showComponent = (type: BuyOrSell) => {
     openComponent('listing')
 }
 
-const onMoreClick = () => {
+const onMoreClick = (buyorsell: number) => {
     router.push({
         name: 'transfer-delisting',
         query: {
-            goodsid
+            goodsid,
+            buyorsell
         }
     })
 }

+ 43 - 11
src/packages/pc/components/modules/hqchart/candlestick/index.vue

@@ -6,12 +6,13 @@
 </template>
 
 <script lang="ts" setup>
-import { shallowRef, watch, computed } from 'vue'
+import { shallowRef, shallowReactive, watch, computed } from 'vue'
 import { Chart } from 'hqchart'
+import { changeUnit, handleNumberValue } from '@/filters'
 import { ChartCycleType } from '@/constants/chart'
 import { useFuturesStore } from '@/stores'
 import { useDataset } from '@/hooks/hqchart/candlestick/dataset'
-import { NetworkFilterData, NetworkFilterCallback } from '@/hooks/hqchart/candlestick/types'
+import { KLineChartContainer, NetworkFilterData, NetworkFilterCallback } from '@/hooks/hqchart/candlestick/types'
 import HQChart from '@/components/base/hqchart/index.vue'
 import Tabs from '@/components/base/tabs/index.vue'
 
@@ -40,16 +41,13 @@ const { quoteWatch, getGoodsQuote } = useFuturesStore()
 const goods = getGoodsQuote(props.goodsCode)
 const chartInstance = shallowRef() // 图表实例
 
-const tabs = [
+const tabs = shallowReactive([
     { label: 'MACD', value: 'MACD' },
-    { label: 'VOL', value: 'VOL' },
     { label: 'KDJ', value: 'KDJ' },
     { label: 'RSI', value: 'RSI' },
-    { label: 'WR', value: 'WR' },
-    { label: 'OBV', value: 'OBV' },
-    { label: 'CCI', value: 'CCI' },
-    { label: 'DMI', value: 'DMI' }
-]
+    { label: 'BOLL', value: 'BOLL副图' },
+    { label: 'WR', value: 'WR' }
+])
 
 // 自定义品种小数位
 // https://blog.csdn.net/jones2000/article/details/106592730/
@@ -132,7 +130,36 @@ const chartOption = {
         {
             IsShowLeftText: false // 是否显示Y轴右侧刻度
         }
-    ]
+    ],
+    OnCreatedCallback: (chart: KLineChartContainer) => {
+        const paint = chart.TitlePaint[0]
+        if (paint) {
+            const { FormatDateString, FormatTimeString } = Chart.IFrameSplitOperator
+            // 自定义标题栏,参考源码 DynamicKLineTitlePainting.GetFormatTitle
+            paint.GetFormatTitle = (data) => {
+                const { Date, Time, Open, High, Low, Close, Vol, YClose } = data.Data
+                const AryText = [
+                    { Text: FormatDateString(Date), Color: paint.DateTimeColor },
+                ]
+                if (Chart.ChartData.IsMinutePeriod(paint.Period, true)) {
+                    AryText.push({ Text: FormatTimeString(Time), Color: paint.DateTimeColor })
+                }
+                AryText.push(
+                    { Text: '开:' + handleNumberValue(Open), Color: paint.GetColor(Open, YClose) },
+                    { Text: '高:' + handleNumberValue(High), Color: paint.GetColor(High, YClose) },
+                    { Text: '低:' + handleNumberValue(Low), Color: paint.GetColor(Low, YClose) },
+                    { Text: '收:' + handleNumberValue(Close), Color: paint.GetColor(Close, YClose) },
+                    { Text: '量:' + changeUnit(Vol), Color: paint.VolColor }
+                )
+                if (goods.value?.trademode === 99) {
+                    AryText.pop()
+                }
+                return {
+                    AryText
+                }
+            }
+        }
+    }
 }
 
 // 切换指标
@@ -143,7 +170,12 @@ const changeIndex = (index: number) => {
 
 const onReady = (chart: unknown) => {
     if (props.showIndex) {
-        chartOption.Windows.push({ Index: 'MACD', Change: true, Close: false })
+        if (goods.value?.trademode === 99) {
+            chartOption.Windows.push({ Index: 'MACD', Change: true, Close: false })
+        } else {
+            tabs.unshift({ label: 'VOL', value: 'VOL' })
+            chartOption.Windows.push({ Index: 'VOL', Change: true, Close: false })
+        }
     }
     chartInstance.value = chart
     chartInstance.value.SetOption(chartOption)

+ 31 - 13
src/packages/pc/components/modules/hqchart/timeline/index.vue

@@ -5,9 +5,10 @@
 <script lang="ts" setup>
 import { shallowRef } from 'vue'
 import { Chart } from 'hqchart'
+import { changeUnit, handleNumberValue } from '@/filters'
 import { useFuturesStore } from '@/stores'
 import { useDataset } from '@/hooks/hqchart/timeline/dataset'
-import { NetworkFilterData, NetworkFilterCallback } from '@/hooks/hqchart/timeline/types'
+import { MinuteChartContainer, NetworkFilterData, NetworkFilterCallback } from '@/hooks/hqchart/timeline/types'
 import HQChart from '@/components/base/hqchart/index.vue'
 
 const props = defineProps({
@@ -54,23 +55,40 @@ const chartOption = {
         IsShowName: false, // 不显示股票名称
     },
     Frame: [
-        // {
-        //     Custom: [
-        //         {
-        //             Type: 0,
-        //             Position: 'right',
-        //         }
-        //     ]
-        // },
-        // {
-        //     Height: 0 // 第2个成交量图高度设置0隐藏掉
-        // }
-    ]
+        {}
+    ],
+    OnCreatedCallback: (chart: MinuteChartContainer) => {
+        const paint = chart.TitlePaint[0]
+        if (paint) {
+            const { FormatDateTimeString } = Chart.IFrameSplitOperator
+            // 自定义标题栏,参考源码 DynamicMinuteTitlePainting.GetFormatTitle
+            paint.GetFormatTitle = (data) => {
+                const { DateTime, Open, Close, Vol, YClose, Increase } = data.Data
+                const AryText = [
+                    { Text: FormatDateTimeString(DateTime, paint.IsShowDate, paint.IsShowTime), Color: paint.DateTimeColor },
+                    { Text: '价:' + handleNumberValue(Close), Color: paint.GetColor(Open, YClose) },
+                    { Text: '幅:' + Increase.toFixed(2) + '%', Color: paint.GetColor(Increase, 0) },
+                    { Text: '量:' + changeUnit(Vol), Color: paint.VolColor }
+                ]
+                if (goods.value?.trademode === 99) {
+                    AryText.pop()
+                }
+                return {
+                    AryText
+                }
+            }
+        }
+    }
 }
 
 const onReady = (chart: unknown) => {
     chartInstance.value = chart
     getTSDataAsync.then(() => {
+        if (goods.value?.trademode === 99) {
+            chartOption.Frame.push({
+                Height: 0 // 第2个成交量图高度设置0隐藏掉
+            })
+        }
         // https://blog.csdn.net/jones2000/article/details/104165374
         const minuteTimeStringData = Chart.JSChart.GetMinuteTimeStringData()
         const minuteCoordinateData = Chart.JSChart.GetMinuteCoordinateData()

+ 5 - 1
src/packages/pc/views/market/trade/presell/transfer/listing/index.vue

@@ -246,6 +246,11 @@ const getOrderPrice = () => {
     }
 }
 
+// 商品初始化完成后执行
+futuresStore.onResponse(() => {
+    onGoodsChange()
+})
+
 watch([selectedGoodsId, orderPriceType], () => {
     formData.OrderPrice = getOrderPrice()
 })
@@ -259,7 +264,6 @@ watch([() => formData.BuyOrSell, () => selectedGoods.value?.last, () => selected
 onMounted(() => {
     formData.OrderPrice = getOrderPrice()
     formData.OrderQty = qtyStep.value
-    onGoodsChange()
 })
 </script>
 

+ 1 - 1
src/services/http/index.ts

@@ -263,7 +263,7 @@ export default new (class {
                     return Promise.resolve(res)
                 }
                 const { getErrorInfoByCode } = useErrorInfoStore()
-                const msg = getErrorInfoByCode(res.Status && [6003, 6066, 6019, 6064].includes(res.Status) ? res.Status : res.RetCode)
+                const msg = getErrorInfoByCode(res.RetCode ?? res.Status)
                 const error = String(res.RetDesc || res.RetCode || res.Status)
                 return Promise.reject(msg ?? error)
             }