Procházet zdrojové kódy

增加 预售转让-转让持仓-放弃功能

Handy_Cao před 1 rokem
rodič
revize
d6bf0c3417

+ 3 - 1
public/locales/en-US.json

@@ -113,7 +113,8 @@
         "closeall": "Close All",
         "openall": "Open All",
         "modifyavatar": "Modify Avatar",
-        "agree": "Agree"
+        "agree": "Agree",
+        "giveup": "Give Up"
     },
     "chart": {
         "time": "Time",
@@ -804,6 +805,7 @@
             "limitdown":"LimitDown",
             "transferprice":"TransferPrice",
             "transferqty":"TransferQty",
+            "giveupqty": "Qty",
             "tips1": "Is there any additional unpaid transfer deposit?",
             "tips2": "Submission is successful",
             "tips3": "Please enter the price",

+ 3 - 1
public/locales/th-TH.json

@@ -114,7 +114,8 @@
         "closeall": "ย่อทั้งหมด",
         "openall": "ขยายทั้งหมด",
         "modifyavatar": "เปลี่ยนรูปโปรไฟล์",
-        "agree": "เห็นด้วย"
+        "agree": "เห็นด้วย",
+        "giveup": "ยอมแพ้ซะ"
     },
     "chart": {
         "time": "แบ่งเวลา",
@@ -807,6 +808,7 @@
             "limitdown":"หยุดลง",
             "transferprice":"โอนราคา",
             "transferqty":"การถ่ายโอน",
+            "giveupqty": "ปริมาณการยอมแพ้",
             "tips1": "คุณจะเพิ่มเงินมัดจำ ที่ยังไม่ได้จ่ายเงินโอน หรือไม่?",
             "tips2": "ส่งสำเร็จแล้ว",
             "tips3": "กรุณาใส่ราคา",

+ 3 - 1
public/locales/zh-CN.json

@@ -114,7 +114,8 @@
         "closeall": "全部收起",
         "openall": "全部展开",
         "modifyavatar": "修改头像",
-        "agree": "同意"
+        "agree": "同意",
+        "giveup": "放弃"
     },
     "chart": {
         "time": "分时",
@@ -807,6 +808,7 @@
             "limitdown":"跌停",
             "transferprice":"转让价",
             "transferqty":"转让量",
+            "giveupqty": "放弃量",
             "tips1": "是否追加未付转让定金?",
             "tips2": "提交成功",
             "tips3": "请输入价格",

+ 60 - 0
public/proto/mtp.js

@@ -50618,6 +50618,66 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr
         id: 5
       }
     }
+  },
+  DeposiTransferOperateReq: {
+    fields: {
+      Header: {
+        type: "MessageHead",
+        id: 1
+      },
+      UserID: {
+        type: "uint32",
+        id: 2
+      },
+      AccountID: {
+        type: "uint64",
+        id: 3
+      },
+      GoodsID: {
+        type: "uint32",
+        id: 4
+      },
+      Qty: {
+        type: "uint64",
+        id: 5
+      },
+      OperateType: {
+        type: "uint32",
+        id: 6
+      },
+      OperateSrc: {
+        type: "uint32",
+        id: 7
+      },
+      OperatorID: {
+        type: "uint32",
+        id: 8
+      },
+      ClientSerialNo: {
+        type: "string",
+        id: 9
+      }
+    }
+  },
+  DeposiTransferOperateRsp: {
+    fields: {
+      Header: {
+        type: "MessageHead",
+        id: 1
+      },
+      RetCode: {
+        type: "int32",
+        id: 2
+      },
+      RetDesc: {
+        type: "string",
+        id: 3
+      },
+      ClientSerialNo: {
+        type: "string",
+        id: 4
+      }
+    }
   }
 });
 

+ 28 - 8
public/proto/mtp.proto

@@ -15282,28 +15282,48 @@ message CoupImportRsp {
 // �Ż�ȯ�������ͨ������
 message CoupConfirmPassReq {
 	optional MessageHead Header = 1;
-			optional uint64 reqid = 2; // ����ID
-			optional uint64 applyID = 3; // �������ID
+	optional uint64 reqid = 2; // ����ID
+	optional uint64 applyID = 3; // �������ID
 }
 // �Ż�ȯ�������ͨ��Ӧ��
 message CoupConfirmPassRsp {
 	optional MessageHead Header = 1; // ��Ϣͷ
 	optional int32 RetCode = 2; // ������
 	optional string RetDesc = 3; // ������Ϣ
-			optional uint64 reqid = 4; // ����ID
+	optional uint64 reqid = 4; // ����ID
 }
 // ɨ�账�������¼����
 message CoupScanAndDealImportRecordReq {
 	optional MessageHead Header = 1;
-			optional uint64 reqid = 2; // ����ID
-			optional uint64 srcReqFunCode = 3; // ԭʼ��������
-			optional string remark = 4; // ɨ��ԭ���ⲿ��Ҫ���õ��ô˽ӿڣ�
+	optional uint64 reqid = 2; // ����ID
+	optional uint64 srcReqFunCode = 3; // ԭʼ��������
+	optional string remark = 4; // ɨ��ԭ���ⲿ��Ҫ���õ��ô˽ӿڣ�
 }
 // ɨ�账�������¼Ӧ��
 message CoupScanAndDealImportRecordRsp {
 	optional MessageHead Header = 1; // ��Ϣͷ
 	optional int32 RetCode = 2; // ������
 	optional string RetDesc = 3; // ������Ϣ
-			optional uint64 reqid = 4; // ����ID
-			optional uint64 srcReqFunCode = 5; // ԭʼ��������
+	optional uint64 reqid = 4; // ����ID
+	optional uint64 srcReqFunCode = 5; // ԭʼ��������
+}
+
+// ɨ�账�������¼Ӧ��
+message DeposiTransferOperateReq {
+	optional MessageHead Header = 1;  // ��Ϣͷ
+	optional uint32 UserID = 2; // ������
+	optional uint64 AccountID = 3; // ������
+	optional uint32 GoodsID = 4; // ������
+	optional uint64 Qty = 5; // ������
+	optional uint32 OperateType = 6; // ������
+	optional uint32 OperateSrc = 7; // ������
+	optional uint32 OperatorID = 8; // ������
+	optional string ClientSerialNo = 9; // ������
+}
+// 定金转让持仓操作响应
+message DeposiTransferOperateRsp {
+	optional MessageHead Header = 1; // ������
+	optional int32 RetCode = 2; // ������
+	optional string RetDesc = 3; // ������
+	optional string ClientSerialNo = 4; // ������
 }

+ 27 - 1
src/business/trade/index.ts

@@ -21,7 +21,8 @@ import {
     order,
     offlineDeliveryApplyCancelOrder,
     offlineDelivery,
-    modifyOrder
+    modifyOrder,
+    deposiTransferOperate
 } from '@/services/api/trade'
 import { formatDate } from "@/filters";
 import Long from 'long'
@@ -675,3 +676,28 @@ export function useCanceofflineDeliveryApplyCancelOrderlOrder() {
     }
 }
 
+// 定金转让持仓操作
+export function useDeposiTransferOperate() {
+    const loading = shallowRef(false)
+    const formData = reactive<Partial<Proto.DeposiTransferOperateReq>>({})
+    const onSubmit = async () => {
+        try {
+            loading.value = true
+            return await deposiTransferOperate({
+                data: {
+                    ...formData
+                }
+            })
+        } finally {
+            loading.value = false
+        }
+    }
+
+    return {
+        loading,
+        formData,
+        onSubmit
+    }
+}
+
+

+ 3 - 0
src/constants/funcode.ts

@@ -150,4 +150,7 @@ export enum FunCode {
 
     ModifyOrderReq = 196761,   // MAKE_FID(0, 3, 153) 修改订单接口请求(196761)
     ModifyOrderRsp = 196762,   // MAKE_FID(0, 3, 154) 修改订单接口响应(196762)
+
+    DeposiTransferOperateReq = 196763,   // 定金转让持仓操作请求
+    DeposiTransferOperateRsp = 196764,   // 定金转让持仓操作响应
 } 

+ 87 - 0
src/packages/pc/views/footer/presell/transferposition/giveup/index.vue

@@ -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>

+ 3 - 0
src/packages/pc/views/footer/presell/transferposition/index.vue

@@ -33,6 +33,8 @@
                     @click="showComponent('append', row)">{{ t('operation.deposit2') }}</el-button>
                 <el-button type="danger" v-if="row.paystatus === 2" size="small"
                     @click="showComponent('listing', row)">{{ t('operation.transfer') }}</el-button>
+                <el-button type="success" v-if="row.paystatus === 2" size="small"
+                    @click="showComponent('giveup', row)">{{ t('operation.giveup') }}</el-button>
                 <el-button type="primary" v-if="row.paystatus === 2 && row.accountid != row.provideraccountid" size="small"
                     @click="showComponent('delivery', row)">{{ t('operation.delivery') }}</el-button>
             </div>
@@ -59,6 +61,7 @@ const componentMap = new Map<string, unknown>([
     ['append', defineAsyncComponent(() => import('./append/index.vue'))], // 追加定金
     ['delivery', defineAsyncComponent(() => import('./delivery/index.vue'))], // 交收
     ['listing', defineAsyncComponent(() => import('./listing/index.vue'))], // 转让
+    ['giveup', defineAsyncComponent(() => import('./giveup/index.vue'))], // 放弃
 ])
 
 const { getTableColumns } = useTableColumnsStore()

+ 19 - 0
src/services/api/trade/index.ts

@@ -394,4 +394,23 @@ export function modifyOrder(config: RequestConfig<Partial<Proto.ModifyOrderReq>>
         requestCode: 'ModifyOrderReq',
         responseCode: 'ModifyOrderRsp',
     })
+}
+
+/**
+ * 定金转让持仓操作
+ */
+export function deposiTransferOperate(config: RequestConfig<Partial<Proto.DeposiTransferOperateReq>>) {
+    return http.mqRequest<Proto.DeposiTransferOperateRsp>({
+        data: {
+            AccountID: accountStore.currentAccountId,
+            UserID: loginStore.userId,
+            ClientSerialNo: v4(),
+            OperateType: 1,
+            OperatorID: loginStore.loginId,
+            OperateSrc: 2,
+            ...config.data
+        },
+        requestCode: 'DeposiTransferOperateReq',
+        responseCode: 'DeposiTransferOperateRsp'
+    })
 }

+ 21 - 0
src/types/proto/trade.d.ts

@@ -804,5 +804,26 @@ declare global {
             ApplyID: number; // 申请ID,必填
             ClientSerialNo: string; // 客户端流水号
         }
+
+        // 定金转让持仓操作请求
+        interface DeposiTransferOperateReq {
+            Header: IMessageHead; // 消息头
+			UserID: number; // 用户ID,必填
+            AccountID: number; // 交易账号,必填
+            GoodsID: number; // 商品ID,必填
+            Qty: number; // 头寸数量
+            OperateType?: number; // 操作类型1:手动放弃,2:持仓作废,3:交收服务商违约
+            OperateSrc?: number; // 操作来源1:管理端,2:终端,3:交易服务
+            OperatorID?: number; // 操作人ID
+            ClientSerialNo: string; // 客户端流水号
+        }
+        
+        // 定金转让持仓操作响应
+        interface DeposiTransferOperateRsp {
+            Header: IMessageHead; // 消息头
+            RetCode: number; // 返回码
+            RetDesc: string; // 描述信息
+            ClientSerialNo: string; // 客户端流水号
+        }
     }
 }