|
|
@@ -0,0 +1,87 @@
|
|
|
+<!-- 预售转让-转让持仓-转让 -->
|
|
|
+<template>
|
|
|
+ <app-drawer :title="t('operation.giveup')" v-model:show="show" :loading="loading" :refresh="refresh" :width="800">
|
|
|
+ <el-form ref="formRef" class="el-form--horizontal" label-width="120px" :model="formData" :rules="formRules">
|
|
|
+ <el-form-item :label="t('position.transfer.goodsname')">
|
|
|
+ <span>{{ selectedRow.goodscode }}/{{ selectedRow.goodsname }}</span>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item :label="t('quote.transfer.presaleprice2')">
|
|
|
+ <span>{{ selectedRow.presaleprice }}</span>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item :label="t('quote.transfer.limitup')">
|
|
|
+ <span>{{ handleNumberValue(quote?.limitup) }}</span>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item :label="t('position.transfer.enableqty')">
|
|
|
+ <span>{{ enableqty }}</span>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item :label="t('quote.transfer.limitdown')">
|
|
|
+ <span>{{ handleNumberValue(quote?.limitdown) }}</span>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="OrderQty" :label="t('position.transfer.giveupqty')">
|
|
|
+ <el-input-number :placeholder="t('position.transfer.tips4')" v-model="formData.Qty" :max="enableqty" :min="0" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <template #footer>
|
|
|
+ <el-button type="info" @click="onCancel(false)">{{ t('operation.cancel') }}</el-button>
|
|
|
+ <el-button type="primary" @click="onConfirm">{{ t('operation.submit') }}</el-button>
|
|
|
+ </template>
|
|
|
+ </app-drawer>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script lang="ts" setup>
|
|
|
+import { ref, PropType, computed } from 'vue'
|
|
|
+import { ElMessage, FormInstance, FormRules } from 'element-plus'
|
|
|
+import { handleNumberValue } from '@/filters'
|
|
|
+import { useDeposiTransferOperate } from '@/business/trade'
|
|
|
+import { useFuturesStore, i18n } from '@/stores'
|
|
|
+import AppDrawer from '@pc/components/base/drawer/index.vue'
|
|
|
+
|
|
|
+const props = defineProps({
|
|
|
+ selectedRow: {
|
|
|
+ type: Object as PropType<Model.MineTradePositionExsRsp>,
|
|
|
+ required: true
|
|
|
+ },
|
|
|
+ code: String
|
|
|
+})
|
|
|
+
|
|
|
+const { getGoodsQuote } = useFuturesStore()
|
|
|
+// 可用数量
|
|
|
+const enableqty = computed(() => props.selectedRow.buycurpositionqty - props.selectedRow.buyfrozenqty)
|
|
|
+/// 对应的行情信息
|
|
|
+const quote = getGoodsQuote(props.selectedRow.goodscode)
|
|
|
+const { t } = i18n.global
|
|
|
+const { loading, formData, onSubmit } = useDeposiTransferOperate()
|
|
|
+const show = ref(true)
|
|
|
+const refresh = ref(false)
|
|
|
+const formRef = ref<FormInstance>()
|
|
|
+
|
|
|
+const formRules: FormRules = {
|
|
|
+ OrderQty: [{
|
|
|
+ message: t('position.transfer.tips4'),
|
|
|
+ validator: () => {
|
|
|
+ return !!formData.Qty
|
|
|
+ }
|
|
|
+ }],
|
|
|
+}
|
|
|
+
|
|
|
+const onCancel = (isRefresh = false) => {
|
|
|
+ show.value = false
|
|
|
+ refresh.value = isRefresh
|
|
|
+}
|
|
|
+
|
|
|
+const onConfirm = () => {
|
|
|
+ formRef.value?.validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ const { goodsid } = props.selectedRow
|
|
|
+ formData.GoodsID = goodsid
|
|
|
+
|
|
|
+ onSubmit().then(() => {
|
|
|
+ ElMessage.success(t('position.transfer.tips1'))
|
|
|
+ onCancel(true)
|
|
|
+ }).catch((err) => {
|
|
|
+ ElMessage.error(t('common.submitfailure') + err)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
+</script>
|