|
|
@@ -1,225 +1,114 @@
|
|
|
<template>
|
|
|
- <app-view class="market-detail">
|
|
|
- <template #header>
|
|
|
- <app-navbar :title="quote?.goodsname">
|
|
|
- <template #right>
|
|
|
- <Icon v-if="system_1012 != '0'" name="bars" size="20px" @click="showChart" />
|
|
|
- </template>
|
|
|
- </app-navbar>
|
|
|
+ <DetailsView @row-click="show = true">
|
|
|
+ <template #headerRight>
|
|
|
+ <Icon v-if="param1012 != '0'" name="bars" size="20px" @click="showChart" />
|
|
|
</template>
|
|
|
- <div class="market-detail__form" v-if="quote">
|
|
|
- <div class="form-price">
|
|
|
- <dl>
|
|
|
- <dt>回购价</dt>
|
|
|
- <dd :class="quote.bidColor">{{ handleNumberValue(formatDecimal(quote.bid, quote.decimalplace)) }}
|
|
|
- </dd>
|
|
|
- </dl>
|
|
|
- <dl>
|
|
|
- <dt>销售价</dt>
|
|
|
- <dd :class="quote.askColor">{{ handleNumberValue(formatDecimal(quote.ask, quote.decimalplace)) }}
|
|
|
- </dd>
|
|
|
- </dl>
|
|
|
- </div>
|
|
|
- <Form ref="formRef" @submit="onSubmit">
|
|
|
- <Field name="OrderQty" :rules="formRules.OrderQty">
|
|
|
- <template #input>
|
|
|
- <div class="g-qty-group">
|
|
|
- <div class="g-qty-group__stepper">
|
|
|
- <Stepper v-model="orderQty" :min="0" :step="qtyStep" integer />
|
|
|
- <span>{{ getGoodsUnitName(quote.goodunitid) }}</span>
|
|
|
- </div>
|
|
|
- <RadioGroup v-model="qtyStep" direction="horizontal" @change="onRadioChange">
|
|
|
- <Radio v-for="(value, index) in qtyStepList" :key="index" :name="value">
|
|
|
- {{ value + getGoodsUnitName(quote.goodunitid) }}
|
|
|
- </Radio>
|
|
|
- </RadioGroup>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </Field>
|
|
|
- <Cell name="IsAutoAddDeposit" title="允许自动补定金" v-if="goods?.canautoadddeposit === 1">
|
|
|
- <template #right-icon>
|
|
|
- <Switch v-model="formData.IsAutoAddDeposit" :active-value="1" :inactive-value="0" :size="24" />
|
|
|
- </template>
|
|
|
- </Cell>
|
|
|
- <Cell name="IsAutoRefundDeposit" title="允许自动退定金" v-if="goods?.canautorefunddeposit === 1">
|
|
|
- <template #right-icon>
|
|
|
- <Switch v-model="formData.IsAutoRefundDeposit" :active-value="1" :inactive-value="0"
|
|
|
- :size="24" />
|
|
|
- </template>
|
|
|
- </Cell>
|
|
|
- </Form>
|
|
|
- <div class="form-submit">
|
|
|
- <!-- 任务 #6712 -->
|
|
|
- <button class="buy" type="button" @click="commit(BuyOrSell.Buy)">买入提料</button>
|
|
|
- <button class="sell" type="button" @click="commit(BuyOrSell.Sell)">卖出交料</button>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="market-detail__list">
|
|
|
- <table cellspacing="0" cellpadding="0">
|
|
|
- <tr :class="item.tHDetailEx.tradeID === selectedRow?.tHDetailEx.tradeID ? 'is-active' : ''"
|
|
|
- v-for="(item, index) in orderList" :key="index" @click="showPopup(item)">
|
|
|
- <td>
|
|
|
- <span :class="item.tHDetailEx.buyOrSell === BuyOrSell.Buy ? 'g-price-up' : 'g-price-down'">
|
|
|
- {{ item.tHDetailEx.buyOrSell === BuyOrSell.Buy ? '买料' : '卖料' }}
|
|
|
- </span>
|
|
|
- </td>
|
|
|
- <td>
|
|
|
- <span>{{ enableqty(item) + getGoodsUnitName(item.goodsUnitID) }}</span>
|
|
|
- </td>
|
|
|
- <td>
|
|
|
- <span>{{ formatDecimal(item.tHDetailEx.holderPrice, item.decimalPlace) }}</span>
|
|
|
- </td>
|
|
|
- <td v-if="riskType === 1">
|
|
|
- <span
|
|
|
- :class="{ 'g-price-up': item.tHDetailEx.depositRate <= item.tHDetailEx.promptDepositRate }"
|
|
|
- v-if="item.tHDetailEx.payedDeposit">
|
|
|
- {{ parsePercent(item.tHDetailEx.depositRate) }}
|
|
|
- </span>
|
|
|
- <span v-else>
|
|
|
- {{ handleNumberValue() }}
|
|
|
- </span>
|
|
|
- </td>
|
|
|
- <td v-if="riskType === 2">
|
|
|
- <span :class="handlePriceColor(item.tHDetailEx.floatPL)">
|
|
|
- {{ formatDecimal(item.tHDetailEx.floatPL) }}
|
|
|
- </span>
|
|
|
- </td>
|
|
|
- </tr>
|
|
|
- </table>
|
|
|
- </div>
|
|
|
- <ActionSheet v-model:show="show" title="订单">
|
|
|
- <div class="g-order-list" style="padding-bottom: 60px;" v-if="selectedRow">
|
|
|
- <div class="g-order-list__box">
|
|
|
- <div class="g-order-list__titlebar">
|
|
|
- <div class="left">
|
|
|
- <h4
|
|
|
- :class="selectedRow.tHDetailEx.buyOrSell === BuyOrSell.Buy ? 'g-price-up' : 'g-price-down'">
|
|
|
- {{ selectedRow.tHDetailEx.buyOrSell === BuyOrSell.Buy ? $t('enum.BuyOrSell.Buy') :
|
|
|
- $t('enum.BuyOrSell.Sell') }}{{ ':' }}
|
|
|
- {{ selectedRow.goodsCode + '/' + selectedRow.goodsName }}
|
|
|
- {{ formatDecimal(selectedRow.tHDetailEx.holderPrice, selectedRow.decimalPlace) }}
|
|
|
- </h4>
|
|
|
- </div>
|
|
|
- <div class="right" v-if="riskType === 1">
|
|
|
- <span
|
|
|
- :class="{ 'g-price-up': selectedRow.tHDetailEx.depositRate <= selectedRow.tHDetailEx.promptDepositRate }"
|
|
|
- v-if="selectedRow.tHDetailEx.payedDeposit">
|
|
|
- {{ parsePercent(selectedRow.tHDetailEx.depositRate) }}
|
|
|
- </span>
|
|
|
- <span v-else>
|
|
|
- {{ handleNumberValue() }}
|
|
|
- </span>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="g-order-list__content">
|
|
|
- <ul>
|
|
|
- <li>
|
|
|
- <span>订单重量</span>
|
|
|
- <span>
|
|
|
- {{ selectedRow.tHDetailEx.openQty * selectedRow.agreeUnit }}
|
|
|
- {{ getGoodsUnitName(selectedRow.goodsUnitID) }}
|
|
|
- </span>
|
|
|
- </li>
|
|
|
- <li>
|
|
|
- <span>可用重量</span>
|
|
|
- <span>
|
|
|
- {{ enableqty(selectedRow) + getGoodsUnitName(selectedRow.goodsUnitID) }}
|
|
|
- </span>
|
|
|
- </li>
|
|
|
- <li>
|
|
|
- <span>订单价格</span>
|
|
|
- <span>
|
|
|
+ <template #default="{ selectedRow, riskType, canClose }">
|
|
|
+ <ActionSheet v-model:show="show" title="订单">
|
|
|
+ <div class="g-order-list" style="padding-bottom: 60px;" v-if="selectedRow">
|
|
|
+ <div class="g-order-list__box">
|
|
|
+ <div class="g-order-list__titlebar">
|
|
|
+ <div class="left">
|
|
|
+ <h4
|
|
|
+ :class="selectedRow.tHDetailEx.buyOrSell === BuyOrSell.Buy ? 'g-price-up' : 'g-price-down'">
|
|
|
+ {{ selectedRow.tHDetailEx.buyOrSell === BuyOrSell.Buy ? $t('enum.BuyOrSell.Buy') :
|
|
|
+ $t('enum.BuyOrSell.Sell') }}{{ ':' }}
|
|
|
+ {{ selectedRow.goodsCode + '/' + selectedRow.goodsName }}
|
|
|
{{ formatDecimal(selectedRow.tHDetailEx.holderPrice, selectedRow.decimalPlace) }}
|
|
|
+ </h4>
|
|
|
+ </div>
|
|
|
+ <div class="right" v-if="riskType === 1">
|
|
|
+ <span
|
|
|
+ :class="{ 'g-price-up': selectedRow.tHDetailEx.depositRate <= selectedRow.tHDetailEx.promptDepositRate }"
|
|
|
+ v-if="selectedRow.tHDetailEx.payedDeposit">
|
|
|
+ {{ parsePercent(selectedRow.tHDetailEx.depositRate) }}
|
|
|
</span>
|
|
|
- </li>
|
|
|
- <li>
|
|
|
- <span>已付定金</span>
|
|
|
- <span>{{ selectedRow.tHDetailEx.payedDeposit }}</span>
|
|
|
- </li>
|
|
|
- <li>
|
|
|
- <span>浮动权益</span>
|
|
|
- <span :class="handlePriceColor(selectedRow.tHDetailEx.floatPL)">
|
|
|
- {{ formatDecimal(selectedRow.tHDetailEx.floatPL) }}
|
|
|
+ <span v-else>
|
|
|
+ {{ handleNumberValue() }}
|
|
|
</span>
|
|
|
- </li>
|
|
|
- <li v-if="riskType === 1">
|
|
|
- <span>已补定金</span>
|
|
|
- <span>{{ handleNumberValue(selectedRow.tHDetailEx.restockDeposit) }}</span>
|
|
|
- </li>
|
|
|
- <li>
|
|
|
- <span>订单天数</span>
|
|
|
- <span>{{ selectedRow.tHDetailEx.holdDays + 1 }}天</span>
|
|
|
- </li>
|
|
|
- <li>
|
|
|
- <span>{{ $t('mine.callAteFee') }}</span>
|
|
|
- <span>{{ handleNumberValue(selectedRow.tHDetailEx.callAteFee) }}</span>
|
|
|
- </li>
|
|
|
- <!-- <li>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="g-order-list__content">
|
|
|
+ <ul>
|
|
|
+ <li>
|
|
|
+ <span>订单重量</span>
|
|
|
+ <span>
|
|
|
+ {{ selectedRow.tHDetailEx.openQty * selectedRow.agreeUnit }}
|
|
|
+ {{ getGoodsUnitName(selectedRow.goodsUnitID) }}
|
|
|
+ </span>
|
|
|
+ </li>
|
|
|
+ <li>
|
|
|
+ <span>可用重量</span>
|
|
|
+ <span>
|
|
|
+ {{ enableqty(selectedRow) + getGoodsUnitName(selectedRow.goodsUnitID) }}
|
|
|
+ </span>
|
|
|
+ </li>
|
|
|
+ <li>
|
|
|
+ <span>订单价格</span>
|
|
|
+ <span>
|
|
|
+ {{ formatDecimal(selectedRow.tHDetailEx.holderPrice, selectedRow.decimalPlace) }}
|
|
|
+ </span>
|
|
|
+ </li>
|
|
|
+ <li>
|
|
|
+ <span>已付定金</span>
|
|
|
+ <span>{{ selectedRow.tHDetailEx.payedDeposit }}</span>
|
|
|
+ </li>
|
|
|
+ <li>
|
|
|
+ <span>浮动权益</span>
|
|
|
+ <span :class="handlePriceColor(selectedRow.tHDetailEx.floatPL)">
|
|
|
+ {{ formatDecimal(selectedRow.tHDetailEx.floatPL) }}
|
|
|
+ </span>
|
|
|
+ </li>
|
|
|
+ <li v-if="riskType === 1">
|
|
|
+ <span>已补定金</span>
|
|
|
+ <span>{{ handleNumberValue(selectedRow.tHDetailEx.restockDeposit) }}</span>
|
|
|
+ </li>
|
|
|
+ <li>
|
|
|
+ <span>订单天数</span>
|
|
|
+ <span>{{ selectedRow.tHDetailEx.holdDays + 1 }}天</span>
|
|
|
+ </li>
|
|
|
+ <li>
|
|
|
+ <span>{{ $t('mine.callAteFee') }}</span>
|
|
|
+ <span>{{ handleNumberValue(selectedRow.tHDetailEx.callAteFee) }}</span>
|
|
|
+ </li>
|
|
|
+ <!-- <li>
|
|
|
<span>订单金额</span>
|
|
|
<span>{{ item.tHDetailEx.holderAmount }}</span>
|
|
|
</li>
|
|
|
-->
|
|
|
- </ul>
|
|
|
- </div>
|
|
|
- <div class="g-order-list__btnbar">
|
|
|
- <Button size="small" @click="showComponent('supplement')" round
|
|
|
- v-if="riskType === 1 && selectedRow.tHDetailEx.holderQty">补充</Button>
|
|
|
- <template v-if="enableqty(selectedRow)">
|
|
|
- <Button size="small" @click="showComponent('delivery')" round>
|
|
|
- {{ selectedRow.tHDetailEx.buyOrSell === BuyOrSell.Buy ? '提料' : '交料' }}
|
|
|
- </Button>
|
|
|
- <Button v-if="canClose" size="small" @click="showComponent('closeholder')" round>终止</Button>
|
|
|
- </template>
|
|
|
- <Button size="small" @click="showComponent('detail')" round>详情</Button>
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
+ <div class="g-order-list__btnbar">
|
|
|
+ <Button size="small" @click="showComponent('supplement')" round
|
|
|
+ v-if="riskType === 1 && selectedRow.tHDetailEx.holderQty">补充</Button>
|
|
|
+ <template v-if="enableqty(selectedRow)">
|
|
|
+ <Button size="small" @click="showComponent('delivery')" round>
|
|
|
+ {{ selectedRow.tHDetailEx.buyOrSell === BuyOrSell.Buy ? '提料' : '交料' }}
|
|
|
+ </Button>
|
|
|
+ <Button v-if="canClose" size="small" @click="showComponent('closeholder')"
|
|
|
+ round>终止</Button>
|
|
|
+ </template>
|
|
|
+ <Button size="small" @click="showComponent('detail')" round>详情</Button>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- </ActionSheet>
|
|
|
- <component ref="componentRef" v-bind="{ selectedRow }" :is="componentMap.get(componentId)"
|
|
|
- @closed="closeComponent" v-if="componentId" />
|
|
|
- </app-view>
|
|
|
+ </ActionSheet>
|
|
|
+ <component ref="componentRef" v-bind="{ selectedRow }" :is="componentMap.get(componentId)"
|
|
|
+ @closed="closeComponent" v-if="componentId" />
|
|
|
+ </template>
|
|
|
+ </DetailsView>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import { useOrder } from '@/business/trade'
|
|
|
-import { shallowRef, onMounted, onUnmounted, computed, onActivated, defineAsyncComponent } from 'vue'
|
|
|
-import { Form, Field, Stepper, Button, FieldRule, FormInstance, Radio, RadioGroup, showToast, ActionSheet, Cell, Switch, Icon } from 'vant'
|
|
|
+import { shallowRef, defineAsyncComponent } from 'vue'
|
|
|
+import { Button, ActionSheet, Icon } from 'vant'
|
|
|
import { useNavigation } from '@mobile/router/navigation'
|
|
|
-import { useGlobalStore, useFuturesStore, useUserStore, useSBYJOrderStore } from '@/stores'
|
|
|
import { getGoodsUnitName } from '@/constants/unit'
|
|
|
import { formatDecimal, parsePercent, handleNumberValue, handlePriceColor } from '@/filters'
|
|
|
import { useComponent } from '@/hooks/component'
|
|
|
-import { fullloading, dialog } from '@/utils/vant'
|
|
|
-import { EPriceMode, EValidType, EOrderOperateType, EBuildType } from '@/constants/client'
|
|
|
import { BuyOrSell } from '@/constants/order'
|
|
|
-import quoteSocket from '@/services/websocket/quote'
|
|
|
-import { queryMdUserSwapProtocol } from '@/services/api/swap'
|
|
|
-import { getUserId } from '@/services/methods/user'
|
|
|
-import { useRequest } from '@/hooks/request'
|
|
|
-import { queryUserTradeSettings } from '@/services/api/order'
|
|
|
-
|
|
|
-const { getQueryString, router } = useNavigation()
|
|
|
-const { formData, formSubmit } = useOrder()
|
|
|
-const { getSBYJMyOrders, getOrderListByGoodsId } = useSBYJOrderStore()
|
|
|
-const globalStore = useGlobalStore()
|
|
|
-const futuresStore = useFuturesStore()
|
|
|
-const userStore = useUserStore()
|
|
|
-
|
|
|
-const riskType = globalStore.getSystemInfo('riskType') // 风控类型
|
|
|
-const formRef = shallowRef<FormInstance>()
|
|
|
-const goodscode = getQueryString('goodscode') ?? ''
|
|
|
-const quote = futuresStore.getGoodsQuote(goodscode)
|
|
|
-const goods = futuresStore.getGoods(goodscode)
|
|
|
-const qtyStep = shallowRef(1) // 数量步长
|
|
|
-const orderQty = shallowRef(1) // 数量
|
|
|
-const subscribe = quoteSocket.createSubscribe()
|
|
|
-const selectedRow = shallowRef<Model.SBYJMyOrderRsp>()
|
|
|
-const show = shallowRef(false)
|
|
|
-/// 能否下单交易
|
|
|
-const canBankSign = shallowRef(false)
|
|
|
-
|
|
|
-const { getSystemParamValue } = useUserStore()
|
|
|
-const system_1012 = getSystemParamValue('1012') ?? '1'
|
|
|
+import { useSBYJOrderStore, useUserStore } from '@/stores'
|
|
|
+import DetailsView from './view.vue'
|
|
|
|
|
|
const componentMap = new Map<string, unknown>([
|
|
|
['detail', defineAsyncComponent(() => import('../../order/detail/index.vue'))], // 详情
|
|
|
@@ -228,12 +117,14 @@ const componentMap = new Map<string, unknown>([
|
|
|
['closeholder', defineAsyncComponent(() => import('../../order/list/components/close-holder/index.vue'))], // 转让
|
|
|
])
|
|
|
|
|
|
-const { componentRef, componentId, openComponent, closeComponent } = useComponent(() => getSBYJMyOrders())
|
|
|
+const userStore = useUserStore()
|
|
|
+const param1012 = userStore.getSystemParamValue('1012') ?? '1'
|
|
|
+const show = shallowRef(false)
|
|
|
|
|
|
-const orderList = computed(() => getOrderListByGoodsId(quote.value?.goodsid))
|
|
|
+const { getQueryString, router } = useNavigation()
|
|
|
+const { getSBYJMyOrders } = useSBYJOrderStore()
|
|
|
|
|
|
-// 合约乘数
|
|
|
-const agreeunit = computed(() => quote.value?.agreeunit ?? 0)
|
|
|
+const { componentRef, componentId, openComponent, closeComponent } = useComponent(() => getSBYJMyOrders())
|
|
|
|
|
|
// 可用重量
|
|
|
const enableqty = (item: Model.SBYJMyOrderRsp) => {
|
|
|
@@ -241,158 +132,17 @@ const enableqty = (item: Model.SBYJMyOrderRsp) => {
|
|
|
return (tHDetailEx.holderQty - tHDetailEx.freezeQty) * agreeUnit
|
|
|
}
|
|
|
|
|
|
-// 数量步长列表
|
|
|
-const qtyStepList = computed(() => {
|
|
|
- // 任务 #6640
|
|
|
- const param1009 = userStore.getSystemParamValue('1009')
|
|
|
-
|
|
|
- if (param1009) {
|
|
|
- const values = param1009.split(',')
|
|
|
- const { traderules = [], agreeunit = 0 } = quote.value ?? {}
|
|
|
- const { ParamValue = 1 } = traderules.find((e) => e.RuleID === 103) ?? {}
|
|
|
- const min = ParamValue * agreeunit // ParamValue 是数量
|
|
|
-
|
|
|
- return values.map((value) => (+value) * min)
|
|
|
- }
|
|
|
-
|
|
|
- return []
|
|
|
-})
|
|
|
+const showComponent = (componentName: string) => {
|
|
|
+ show.value = false
|
|
|
+ openComponent(componentName)
|
|
|
+}
|
|
|
|
|
|
const showChart = () => {
|
|
|
router.push({
|
|
|
name: 'market-chart',
|
|
|
query: {
|
|
|
- goodscode: quote.value?.goodscode ?? ''
|
|
|
+ goodscode: getQueryString('goodscode')
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
-// 获取用户交易个性化设置
|
|
|
-const { dataList: settings } = useRequest(queryUserTradeSettings, {})
|
|
|
-// 判断是否有终止按钮
|
|
|
-const canClose = computed(() => {
|
|
|
- //1. 获取用户交易个性化设置(sbyj/QueryUserTradeSettings)
|
|
|
- // 若有GoodsId对应配置,且goodstradetype in (1:可建可平, 3:不可建可平) 时则显示
|
|
|
- const setting = settings.value.find(e => e.goodsid === goods?.goodsid)
|
|
|
- if (setting) {
|
|
|
- const goodstradetype = setting.goodstradetype
|
|
|
- return ['1', '3'].includes(goodstradetype)
|
|
|
- } else {
|
|
|
- // 2. 若无GoodsId对应配置,则看商品缓存(Ermcp/GetErmcpGoods)返回对应商品的goodstradetype in (1:可建可平, 3:不可建可平) 时则显示
|
|
|
- const { goodstradetype = 0 } = goods ?? {}
|
|
|
- return [1, 3].includes(goodstradetype)
|
|
|
- }
|
|
|
-})
|
|
|
-
|
|
|
-const commit = (buyOrSell: BuyOrSell) => {
|
|
|
- /// 这里要去判断是否已经实名认证
|
|
|
- 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('未实名认证,请先去实名认证,如果已提交实名认证,请耐心等待审核通过!')
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-// 下单
|
|
|
-const onSubmit = () => {
|
|
|
- // 计算提示信息
|
|
|
- // const { marketid = 0, goodsid = 0, goodunitid = 0 } = quote.value ?? {}
|
|
|
- // const { marginalgorithm = 0, transferdepositratio = 0.0 } = goods ?? {}
|
|
|
- // const totalamount = orderQty.value*(formData.OrderPrice ?? 0)
|
|
|
- // const orderPrice = `定价价格:${formData.OrderPrice ?? 0}\n`
|
|
|
- // const qty = `订单数量:${orderQty.value}${getGoodsUnitName(goodunitid)}\n`
|
|
|
- // const orderamount = `订单总额:${formatDecimal(totalamount)}\n`
|
|
|
- // console.log(marginalgorithm, transferdepositratio)
|
|
|
- // const margin = `预付定金:${formatDecimal(marginalgorithm === 1 ? totalamount*transferdepositratio : orderQty.value*transferdepositratio)}\n`
|
|
|
- // const message = orderPrice + qty + orderamount + margin
|
|
|
-
|
|
|
- const { marketid = 0, goodsid = 0 } = quote.value ?? {}
|
|
|
- dialog({
|
|
|
- message: '确认要提交吗?',
|
|
|
- showCancelButton: true,
|
|
|
- }).then(() => {
|
|
|
- /// 获取对应的市场ID
|
|
|
- formData.MarketID = marketid
|
|
|
- formData.PriceMode = EPriceMode.PRICEMODE_MARKET
|
|
|
- formData.GoodsID = goodsid
|
|
|
- formData.TimevalidType = EValidType.VALIDTYPE_DR
|
|
|
- formData.OperateType = EOrderOperateType.ORDEROPERATETYPE_NORMAL
|
|
|
- formData.BuildType = EBuildType.BUILDTYPE_OPEN
|
|
|
- formData.OrderQty = orderQty.value / agreeunit.value // 数量÷合约乘数
|
|
|
-
|
|
|
- fullloading((hideLoading) => {
|
|
|
- formSubmit().then(() => {
|
|
|
- hideLoading('提交成功。', 'success')
|
|
|
- // 刷新订单列表
|
|
|
- getSBYJMyOrders()
|
|
|
- }).catch((err) => {
|
|
|
- hideLoading(err, 'fail')
|
|
|
- })
|
|
|
- })
|
|
|
- })
|
|
|
-}
|
|
|
-
|
|
|
-// 表单验证规则
|
|
|
-const formRules: { [key: string]: FieldRule[] } = {
|
|
|
- OrderQty: [{
|
|
|
- validator: () => {
|
|
|
- const qty = orderQty.value
|
|
|
- if (qty) {
|
|
|
- const { traderules = [], agreeunit = 0 } = quote.value ?? {}
|
|
|
- const { ParamValue = 1 } = traderules.find((e) => e.RuleID === 103) ?? {}
|
|
|
- const min = ParamValue * agreeunit // ParamValue 是数量
|
|
|
- if (qty % min !== 0) return '重量只能是' + min + '的整数倍'
|
|
|
- return true
|
|
|
- }
|
|
|
- return '请输入重量'
|
|
|
- }
|
|
|
- }],
|
|
|
-}
|
|
|
-
|
|
|
-const onRadioChange = (value: number) => {
|
|
|
- orderQty.value = value
|
|
|
-}
|
|
|
-
|
|
|
-const showPopup = (row: Model.SBYJMyOrderRsp) => {
|
|
|
- selectedRow.value = row
|
|
|
- show.value = true
|
|
|
-}
|
|
|
-
|
|
|
-const showComponent = (componentName: string) => {
|
|
|
- show.value = false
|
|
|
- openComponent(componentName)
|
|
|
-}
|
|
|
-
|
|
|
-onActivated(() => {
|
|
|
- /// 查询是否已签署合同
|
|
|
- queryMdUserSwapProtocol({
|
|
|
- data: {
|
|
|
- userId: getUserId()
|
|
|
- }
|
|
|
- }).then((res) => {
|
|
|
- canBankSign.value = res.data.some(e => e.protocolstatus === 4)
|
|
|
- })
|
|
|
-})
|
|
|
-
|
|
|
-onMounted(() => {
|
|
|
- subscribe.start(goodscode)
|
|
|
- if (goods?.canautoadddeposit === 1) { formData.IsAutoAddDeposit = 1 }
|
|
|
- orderQty.value = Math.min(...qtyStepList.value)
|
|
|
- qtyStep.value = Math.min(...qtyStepList.value)
|
|
|
- getSBYJMyOrders()
|
|
|
-})
|
|
|
-
|
|
|
-onUnmounted(() => {
|
|
|
- subscribe.stop()
|
|
|
-})
|
|
|
-</script>
|
|
|
-
|
|
|
-<style lang="less">
|
|
|
-@import './index.less';
|
|
|
-</style>
|
|
|
+</script>
|