|
@@ -113,10 +113,10 @@
|
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
|
|
|
|
|
|
import { useOrder } from '@/business/trade'
|
|
import { useOrder } from '@/business/trade'
|
|
|
-import { shallowRef, onMounted, onUnmounted, computed, defineAsyncComponent } from 'vue'
|
|
|
|
|
-import { Form, Field, Stepper, Button, FieldRule, FormInstance, Radio, RadioGroup } from 'vant'
|
|
|
|
|
|
|
+import { shallowRef, onMounted, onUnmounted, computed, onActivated, defineAsyncComponent } from 'vue'
|
|
|
|
|
+import { Form, Field, Stepper, Button, FieldRule, FormInstance, Radio, RadioGroup, showToast } from 'vant'
|
|
|
import { useNavigation } from '@mobile/router/navigation'
|
|
import { useNavigation } from '@mobile/router/navigation'
|
|
|
-import { useFuturesStore } from '@/stores'
|
|
|
|
|
|
|
+import { useFuturesStore, useUserStore } from '@/stores'
|
|
|
import { getGoodsUnitName } from '@/constants/unit'
|
|
import { getGoodsUnitName } from '@/constants/unit'
|
|
|
import { formatDecimal, parsePercent, handleNumberValue } from '@/filters'
|
|
import { formatDecimal, parsePercent, handleNumberValue } from '@/filters'
|
|
|
import { useComponent } from '@/hooks/component'
|
|
import { useComponent } from '@/hooks/component'
|
|
@@ -126,10 +126,13 @@ import { BuyOrSell } from '@/constants/order'
|
|
|
import { useSBYJOrder } from '@/business/order'
|
|
import { useSBYJOrder } from '@/business/order'
|
|
|
import quoteSocket from '@/services/websocket/quote'
|
|
import quoteSocket from '@/services/websocket/quote'
|
|
|
import eventBus from '@/services/bus'
|
|
import eventBus from '@/services/bus'
|
|
|
|
|
+import { queryMdUserSwapProtocol } from '@/services/api/swap'
|
|
|
|
|
+import { getUserId } from '@/services/methods/user'
|
|
|
|
|
|
|
|
const { getQueryString } = useNavigation()
|
|
const { getQueryString } = useNavigation()
|
|
|
const { formData, formSubmit } = useOrder()
|
|
const { formData, formSubmit } = useOrder()
|
|
|
const futuresStore = useFuturesStore()
|
|
const futuresStore = useFuturesStore()
|
|
|
|
|
+const userStore = useUserStore()
|
|
|
const formRef = shallowRef<FormInstance>()
|
|
const formRef = shallowRef<FormInstance>()
|
|
|
const goodscode = getQueryString('goodscode')
|
|
const goodscode = getQueryString('goodscode')
|
|
|
const quote = futuresStore.getGoodsQuote(goodscode)
|
|
const quote = futuresStore.getGoodsQuote(goodscode)
|
|
@@ -137,6 +140,8 @@ const qtyStep = shallowRef(1) // 数量步长
|
|
|
const subscribe = quoteSocket.createSubscribe()
|
|
const subscribe = quoteSocket.createSubscribe()
|
|
|
const selectedRow = shallowRef<Model.SBYJMyOrderRsp>()
|
|
const selectedRow = shallowRef<Model.SBYJMyOrderRsp>()
|
|
|
const orderQty = shallowRef(1) // 数量
|
|
const orderQty = shallowRef(1) // 数量
|
|
|
|
|
+/// 能否下单交易
|
|
|
|
|
+const canBankSign = shallowRef(false)
|
|
|
|
|
|
|
|
const componentMap = new Map<string, unknown>([
|
|
const componentMap = new Map<string, unknown>([
|
|
|
['detail', defineAsyncComponent(() => import('../../order/detail/index.vue'))], // 详情
|
|
['detail', defineAsyncComponent(() => import('../../order/detail/index.vue'))], // 详情
|
|
@@ -174,9 +179,18 @@ const getOrderList = () => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const commit = (buyOrSell: BuyOrSell) => {
|
|
const commit = (buyOrSell: BuyOrSell) => {
|
|
|
- formData.BuyOrSell = buyOrSell
|
|
|
|
|
- formData.OrderPrice = buyOrSell === BuyOrSell.Buy ? quote.value?.ask : quote.value?.bid
|
|
|
|
|
- formRef.value?.submit()
|
|
|
|
|
|
|
+ /// 这里要去判断是否已经实名认证
|
|
|
|
|
+ if (userStore.hasAuth) {
|
|
|
|
|
+ if (userStore.userInfo.usertype != 2 && !canBankSign.value) {
|
|
|
|
|
+ showToast('请先通过“我的”-“合同签署”功能菜单签署相应的合同!')
|
|
|
|
|
+ } else {
|
|
|
|
|
+ formData.BuyOrSell = buyOrSell
|
|
|
|
|
+ formData.OrderPrice = buyOrSell === BuyOrSell.Buy ? quote.value?.ask : quote.value?.bid
|
|
|
|
|
+ formRef.value?.submit()
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ showToast('未实名认证,请先去实名认证,如果已提交实名认证,请耐心等待审核通过!')
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 下单
|
|
// 下单
|
|
@@ -233,6 +247,17 @@ const showComponent = (componentName: string, row: Model.SBYJMyOrderRsp) => {
|
|
|
// 接收委托单成交通知
|
|
// 接收委托单成交通知
|
|
|
const orderDealedNtf = eventBus.$on('OrderDealedNtf', () => getOrderList())
|
|
const orderDealedNtf = eventBus.$on('OrderDealedNtf', () => getOrderList())
|
|
|
|
|
|
|
|
|
|
+onActivated(() => {
|
|
|
|
|
+ /// 查询是否已签署合同
|
|
|
|
|
+ queryMdUserSwapProtocol({
|
|
|
|
|
+ data: {
|
|
|
|
|
+ userId: getUserId()
|
|
|
|
|
+ }
|
|
|
|
|
+ }).then((res) => {
|
|
|
|
|
+ canBankSign.value = res.data.some(e => e.protocolstatus === 4)
|
|
|
|
|
+ })
|
|
|
|
|
+})
|
|
|
|
|
+
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
subscribe.start(goodscode)
|
|
subscribe.start(goodscode)
|
|
|
orderQty.value = agreeunit.value
|
|
orderQty.value = agreeunit.value
|