|
|
@@ -2,7 +2,7 @@ import { ref, shallowRef } from 'vue'
|
|
|
import { v4 } from 'uuid'
|
|
|
import { ClientType, OrderSrc } from '@/constants/client'
|
|
|
import { useLoginStore } from '@/stores'
|
|
|
-import { spotPresaleDestingOrder, spotPresalePlayment, wrListingCancelOrder, spotPresaleDeliveryConfirm, spotPresaleBreachOfContractConfirm, spotPresaleBreachOfContractApply } from '@/services/api/trade'
|
|
|
+import { spotPresaleDestingOrder, spotPresaleTransferCancel, spotPresaleTransferDesting, spotPresaleTransferListing, spotPresalePlayment, wrListingCancelOrder, spotPresaleDeliveryConfirm, spotPresaleBreachOfContractConfirm, spotPresaleBreachOfContractApply } from '@/services/api/trade'
|
|
|
import { formatDate } from "@/filters";
|
|
|
import { useNavigation } from '@/hooks/navigation'
|
|
|
import Long from 'long'
|
|
|
@@ -44,104 +44,256 @@ export function useSpotPresaleDeliveryConfirm() {
|
|
|
const { getUserId } = useLoginStore()
|
|
|
const loading = shallowRef(false)
|
|
|
|
|
|
- const confirmSubmit = (id: number) => {
|
|
|
- loading.value = true
|
|
|
- return spotPresaleDeliveryConfirm({
|
|
|
- data: {
|
|
|
+ const { route } = useNavigation()
|
|
|
+ const item = route.params.item
|
|
|
+ const detail = shallowRef<Model.THJPurchaseTradeDetailRsp>()
|
|
|
+
|
|
|
+ if (item) {
|
|
|
+ detail.value = JSON.parse(item.toString())
|
|
|
+ }
|
|
|
+
|
|
|
+ const confirmSubmit = () => {
|
|
|
+ const param = detail.value
|
|
|
+
|
|
|
+ if (param) {
|
|
|
+ loading.value = true
|
|
|
+ const data: Partial<Proto.SpotPresaleDeliveryConfirmReq>={
|
|
|
UserID: getUserId(),
|
|
|
Remark: '',
|
|
|
- ClientType: ClientType.Web, // 终端类型
|
|
|
- WRTradeDetailID: id,
|
|
|
- ClientSerialNo: v4() // 客户端流水号
|
|
|
- },
|
|
|
- complete: () => {
|
|
|
- loading.value = false
|
|
|
+ WRTradeDetailID: Long.fromNumber(param.wrtradedetailid),
|
|
|
+ ClientSerialNo: v4(), // 客户端流水号
|
|
|
+ ClientType: ClientType.Web // 终端类型
|
|
|
}
|
|
|
- })
|
|
|
+ return spotPresaleDeliveryConfirm({
|
|
|
+ data,
|
|
|
+ complete: () => {
|
|
|
+ loading.value = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ return Promise.reject('预售交收申请失败')
|
|
|
}
|
|
|
|
|
|
return {
|
|
|
loading,
|
|
|
confirmSubmit,
|
|
|
+ detail
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// 铁合金现货预售违约确认
|
|
|
-export function useSpotPresaleBreachOfContractConfirm() {
|
|
|
+// 铁合金现货预售违约申请
|
|
|
+export function useSpotPresaleBreachOfContractApply() {
|
|
|
const loading = shallowRef(false)
|
|
|
+ const { getUserId } = useLoginStore()
|
|
|
|
|
|
- const breachSubmit = (buyAmount: number, exchangeAmount: number, id: number ) => {
|
|
|
- loading.value = true
|
|
|
- return spotPresaleBreachOfContractConfirm({
|
|
|
- data: {
|
|
|
- HandleRemark: '',
|
|
|
- WRTradeDetailID: id,
|
|
|
- BuyAmount: buyAmount,
|
|
|
- ExchangeAmount: exchangeAmount,
|
|
|
+ const { route } = useNavigation()
|
|
|
+ const item = route.params.item
|
|
|
+ const detail = shallowRef<Model.THJPurchaseTradeDetailRsp>()
|
|
|
+
|
|
|
+ if (item) {
|
|
|
+ detail.value = JSON.parse(item.toString())
|
|
|
+ }
|
|
|
+
|
|
|
+ const applySubmit = () => {
|
|
|
+ const param = detail.value
|
|
|
+
|
|
|
+ if (param) {
|
|
|
+ loading.value = true
|
|
|
+ const data: Partial<Proto.SpotPresaleBreachOfContractApplyReq>={
|
|
|
+ UserID: getUserId(),
|
|
|
+ WRTradeDetailID: Long.fromNumber(param.wrtradedetailid),
|
|
|
ClientSerialNo: v4(), // 客户端流水号
|
|
|
ClientType: ClientType.Web // 终端类型
|
|
|
- },
|
|
|
- complete: () => {
|
|
|
- loading.value = false
|
|
|
}
|
|
|
- })
|
|
|
+ return spotPresaleBreachOfContractApply({
|
|
|
+ data,
|
|
|
+ complete: () => {
|
|
|
+ loading.value = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ return Promise.reject('违约申请失败')
|
|
|
}
|
|
|
|
|
|
return {
|
|
|
loading,
|
|
|
- breachSubmit,
|
|
|
+ applySubmit,
|
|
|
+ detail
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// 铁合金现货预售违约确认
|
|
|
-export function useSpotPresaleBreachOfContractApply() {
|
|
|
+// 铁合金现货预售付款处理接口
|
|
|
+export function useSpotPresalePlayment() {
|
|
|
const loading = shallowRef(false)
|
|
|
const { getUserId } = useLoginStore()
|
|
|
|
|
|
- const applySubmit = (id: number ) => {
|
|
|
- loading.value = true
|
|
|
- return spotPresaleBreachOfContractApply({
|
|
|
- data: {
|
|
|
+ const formData = ref<Partial<Proto.SpotPresalePlaymentReq>>({
|
|
|
+ UserID: getUserId(), // 用户ID,必填
|
|
|
+ ClientType: ClientType.Web, // 终端类型
|
|
|
+ ClientSerialNo: v4(), // 客户端流水号
|
|
|
+ })
|
|
|
+
|
|
|
+ const { route } = useNavigation()
|
|
|
+ const item = route.params.item
|
|
|
+ const detail = shallowRef<Model.THJPurchaseTradeDetailRsp>()
|
|
|
+
|
|
|
+ if (item) {
|
|
|
+ detail.value = JSON.parse(item.toString())
|
|
|
+ }
|
|
|
+
|
|
|
+ const playmentSubmit = () => {
|
|
|
+ const param = detail.value
|
|
|
+
|
|
|
+ if (param) {
|
|
|
+ loading.value = true
|
|
|
+ const data: Partial<Proto.SpotPresaleTransferListingReq>={
|
|
|
+ ...formData,
|
|
|
+ WRTradeDetailID: Long.fromNumber(param.wrtradedetailid),
|
|
|
+ }
|
|
|
+ return spotPresalePlayment({
|
|
|
+ data,
|
|
|
+ complete: () => {
|
|
|
+ loading.value = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ return Promise.reject('付款失败')
|
|
|
+ }
|
|
|
+
|
|
|
+ return {
|
|
|
+ loading,
|
|
|
+ playmentSubmit,
|
|
|
+ detail
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// 铁合金现货预售转让挂牌接口
|
|
|
+export function useSpotPresaleTransferListing() {
|
|
|
+ const loading = shallowRef(false)
|
|
|
+ const { getUserId } = useLoginStore()
|
|
|
+
|
|
|
+ const formData = ref<Partial<Proto.SpotPresaleTransferListingReq>>({
|
|
|
+ UserID: getUserId(), // 用户ID,必填
|
|
|
+ ClientType: ClientType.Web, // 终端类型
|
|
|
+ ClientSerialNo: v4(), // 客户端流水号
|
|
|
+ })
|
|
|
+
|
|
|
+ const { route } = useNavigation()
|
|
|
+ const item = route.params.item
|
|
|
+ const detail = shallowRef<Model.THJPurchaseTradeDetailRsp>()
|
|
|
+
|
|
|
+ if (item) {
|
|
|
+ detail.value = JSON.parse(item.toString())
|
|
|
+ }
|
|
|
+
|
|
|
+ const listingSubmit = () => {
|
|
|
+ const param = detail.value
|
|
|
+ if (param) {
|
|
|
+ loading.value = true
|
|
|
+ const data:Partial<Proto.SpotPresaleTransferListingReq>={
|
|
|
+ ...formData,
|
|
|
+ WRTradeDetailID: Long.fromNumber(param.wrtradedetailid),
|
|
|
+ }
|
|
|
+
|
|
|
+ return spotPresaleTransferListing({
|
|
|
+ data,
|
|
|
+ complete: () => {
|
|
|
+ loading.value = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ return Promise.reject('预售转让失败')
|
|
|
+ }
|
|
|
+
|
|
|
+ return {
|
|
|
+ loading,
|
|
|
+ formData,
|
|
|
+ listingSubmit,
|
|
|
+ detail
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// 铁合金现货预售转让撤销接口请求
|
|
|
+export function useSpotPresaleTransferCancel() {
|
|
|
+ const loading = shallowRef(false)
|
|
|
+ const { getUserId } = useLoginStore()
|
|
|
+
|
|
|
+ const { route } = useNavigation()
|
|
|
+ const item = route.params.item
|
|
|
+ const detail = shallowRef<Model.THJPurchaseTradeDetailRsp>()
|
|
|
+
|
|
|
+ if (item) {
|
|
|
+ detail.value = JSON.parse(item.toString())
|
|
|
+ }
|
|
|
+
|
|
|
+ const transferCancelSubmit = () => {
|
|
|
+ const param = detail.value
|
|
|
+ if (param) {
|
|
|
+ loading.value = true
|
|
|
+ const data: Partial<Proto.SpotPresaleTransferCancelReq>={
|
|
|
UserID: getUserId(),
|
|
|
- WRTradeDetailID: id,
|
|
|
+ WRTradeDetailID: Long.fromNumber(param.wrtradedetailid),
|
|
|
ClientSerialNo: v4(), // 客户端流水号
|
|
|
ClientType: ClientType.Web // 终端类型
|
|
|
- },
|
|
|
- complete: () => {
|
|
|
- loading.value = false
|
|
|
}
|
|
|
- })
|
|
|
+
|
|
|
+ return spotPresaleTransferCancel({
|
|
|
+ data,
|
|
|
+ complete: () => {
|
|
|
+ loading.value = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ Promise.reject('转让撤销失败')
|
|
|
}
|
|
|
|
|
|
return {
|
|
|
loading,
|
|
|
- applySubmit,
|
|
|
+ transferCancelSubmit,
|
|
|
+ detail
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// 铁合金现货预售付款处理接口
|
|
|
-export function useSpotPresalePlayment() {
|
|
|
+// 铁合金现货预售转让摘牌接口请求
|
|
|
+export function useSpotPresaleTransferDesting() {
|
|
|
const loading = shallowRef(false)
|
|
|
- const { getUserId } = useLoginStore()
|
|
|
+ const { getUserId , getFirstAccountId} = useLoginStore()
|
|
|
|
|
|
- const playmentSubmit = (id: number ) => {
|
|
|
- loading.value = true
|
|
|
- return spotPresalePlayment({
|
|
|
- data: {
|
|
|
+ const { route } = useNavigation()
|
|
|
+ const item = route.params.item
|
|
|
+ const detail = shallowRef<Model.THJPurchaseTradeDetailRsp>()
|
|
|
+
|
|
|
+ if (item) {
|
|
|
+ detail.value = JSON.parse(item.toString())
|
|
|
+ }
|
|
|
+
|
|
|
+ const destingSubmit = () => {
|
|
|
+ const param = detail.value
|
|
|
+ if (param) {
|
|
|
+ loading.value = true
|
|
|
+ const data: Partial<Proto.SpotPresaleTransferDestingReq>={
|
|
|
UserID: getUserId(),
|
|
|
- WRTradeDetailID: id,
|
|
|
+ AccountID: getFirstAccountId(),
|
|
|
+ TransferID: Long.fromNumber(param.wrtradedetailid),
|
|
|
ClientSerialNo: v4(), // 客户端流水号
|
|
|
ClientType: ClientType.Web // 终端类型
|
|
|
- },
|
|
|
- complete: () => {
|
|
|
- loading.value = false
|
|
|
}
|
|
|
- })
|
|
|
+
|
|
|
+ return spotPresaleTransferDesting({
|
|
|
+ data,
|
|
|
+ complete: () => {
|
|
|
+ loading.value = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ return Promise.reject('预售转让失败')
|
|
|
}
|
|
|
|
|
|
return {
|
|
|
loading,
|
|
|
- playmentSubmit,
|
|
|
+ destingSubmit,
|
|
|
+ detail
|
|
|
}
|
|
|
}
|
|
|
|