|
@@ -1,9 +1,12 @@
|
|
|
import { validateCommon } from '@/common/setup/validate';
|
|
import { validateCommon } from '@/common/setup/validate';
|
|
|
|
|
+import APP from "@/services";
|
|
|
import { getItemEnum } from '@/services/bus/allEnum';
|
|
import { getItemEnum } from '@/services/bus/allEnum';
|
|
|
import { QueryCustomInfo } from '@/services/go/ermcp/customInfo';
|
|
import { QueryCustomInfo } from '@/services/go/ermcp/customInfo';
|
|
|
import { QueryCustomInfoType } from '@/services/go/ermcp/customInfo/interface';
|
|
import { QueryCustomInfoType } from '@/services/go/ermcp/customInfo/interface';
|
|
|
import { QueryDeliveryGoods, QueryDeliveryGoodsDetail } from '@/services/go/ermcp/goodsInfo';
|
|
import { QueryDeliveryGoods, QueryDeliveryGoodsDetail } from '@/services/go/ermcp/goodsInfo';
|
|
|
import { Ermcp3Brand, Ermcp3Wrstandard, ErmcpDeliveryGoodsRsp } from '@/services/go/ermcp/goodsInfo/interface';
|
|
import { Ermcp3Brand, Ermcp3Wrstandard, ErmcpDeliveryGoodsRsp } from '@/services/go/ermcp/goodsInfo/interface';
|
|
|
|
|
+import { GldSpotContractInfo } from "@/services/proto/spotcontract/interface";
|
|
|
|
|
+import { changeOrderContract } from "@/views/information/spot-contract/components/setup";
|
|
|
import { message } from 'ant-design-vue';
|
|
import { message } from 'ant-design-vue';
|
|
|
import { RuleObject } from 'ant-design-vue/lib/form/interface';
|
|
import { RuleObject } from 'ant-design-vue/lib/form/interface';
|
|
|
import moment, { Moment } from 'moment';
|
|
import moment, { Moment } from 'moment';
|
|
@@ -36,7 +39,10 @@ export function handleFromState() {
|
|
|
Remark: '', // string 合同备注
|
|
Remark: '', // string 合同备注
|
|
|
CurrencyID: undefined, // 结算币种ID
|
|
CurrencyID: undefined, // 结算币种ID
|
|
|
GoodsID: undefined, // uint64 点价合约ID-0:为现货,其它为期货商品合约ID[2:点价3:暂定价]
|
|
GoodsID: undefined, // uint64 点价合约ID-0:为现货,其它为期货商品合约ID[2:点价3:暂定价]
|
|
|
- PriceMove: null// double 升贴水[2:点价3:暂定价]
|
|
|
|
|
|
|
+ PriceMove: null,// double 升贴水[2:点价3:暂定价]
|
|
|
|
|
+ StartDate: '', // 点价开始时间
|
|
|
|
|
+ EndDate: '', // 点价结束时间
|
|
|
|
|
+ TradeUserID: 0, // 交易员ID
|
|
|
})
|
|
})
|
|
|
// 业务类型
|
|
// 业务类型
|
|
|
const businessType = [
|
|
const businessType = [
|
|
@@ -45,6 +51,68 @@ export function handleFromState() {
|
|
|
];
|
|
];
|
|
|
return { formState, businessType }
|
|
return { formState, businessType }
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * 新增现货合同 表单提交
|
|
|
|
|
+ */
|
|
|
|
|
+export function addContractReq() {
|
|
|
|
|
+ const { loading, orderContractState } = changeOrderContract()
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @param form 表单信息
|
|
|
|
|
+ * @Param type 1: 保存草稿 2: 提交申请
|
|
|
|
|
+ */
|
|
|
|
|
+ function sendReq(form: FormState, type: number): Promise<string> {
|
|
|
|
|
+ const info: GldSpotContractInfo = {
|
|
|
|
|
+ UserID: APP.get('userAccount').memberuserid,// 机构ID
|
|
|
|
|
+ ProductType: 1, // 产品类型 产品类型-1:标准仓单2:等标3:非标
|
|
|
|
|
+ ContractNo: form.ContractNo, // 现货合同编号
|
|
|
|
|
+ ContractType: form.ContractType, // 现货合同类型-1:采购-1:销售
|
|
|
|
|
+ BuyUserID: form.BuyUserID, // 采购方ID
|
|
|
|
|
+ SellUserID: form.SellUserID,// 客户ID
|
|
|
|
|
+ DeliveryGoodsID: form.DeliveryGoodsID as number,// 现货品种ID
|
|
|
|
|
+ WrStandardID: form.WrStandardID as number,// 品类ID
|
|
|
|
|
+ SpotGoodsBrandID: form.SpotGoodsBrandID as number,// 品牌ID
|
|
|
|
|
+ ConvertFactor: form.ConvertFactor as number, // 标仓系数
|
|
|
|
|
+ SpotGoodsDesc: form.SpotGoodsDesc, // 商品规格
|
|
|
|
|
+ PriceType: form.PriceType,// 定价类型
|
|
|
|
|
+ CurrencyID: form.CurrencyID as number,// 结算币种
|
|
|
|
|
+ Qty: Number(form.Qty as number), // 数量
|
|
|
|
|
+ Price: Number(form.Price as number), // 价格
|
|
|
|
|
+ TradeDate: moment().format("YYYYMMDD"),// 交易日
|
|
|
|
|
+ SignDate: moment().format("YYYY-MM-DD HH:mm:ss"), // 签订日期
|
|
|
|
|
+ // 以上必填
|
|
|
|
|
+ // 以下选填
|
|
|
|
|
+ BizType: form.BizType, // 业务类型 - 1:套保 2:套利
|
|
|
|
|
+ Remark: form.Remark, // 合同备注
|
|
|
|
|
+ // ContractAttachment: , // 合同附件
|
|
|
|
|
+ ContractMargin: form.ContractMargin as number, // 合同保证金
|
|
|
|
|
+
|
|
|
|
|
+ Amount: [1, 3].includes(form.PriceType) ? Number(form.Price) * Number(form.Qty) : 0, // 金额
|
|
|
|
|
+ PriceMove: form.PriceMove as number, // 升贴水
|
|
|
|
|
+
|
|
|
|
|
+ StartDate: form.StartDate, // 点价开始时间
|
|
|
|
|
+ EndDate: form.EndDate, // 点价结束时间
|
|
|
|
|
+ DeliveryStartDate: form.DeliveryStartDate,// 交收期开始
|
|
|
|
|
+ DeliveryEndDate: form.DeliveryEndDate, // 交收期结束
|
|
|
|
|
+
|
|
|
|
|
+ GoodsID: form.GoodsID as number, // 点价合约ID-0:为现货,其它为期货商品合约ID[2:点价3:暂定价]
|
|
|
|
|
+
|
|
|
|
|
+ // MerUserID: form.MerUserID, // 跟单员ID
|
|
|
|
|
+ // TradeUserID: form.TradeUserID, // 交易员ID
|
|
|
|
|
+ // SaleUserID: form.SaleUserID,// 业务员id
|
|
|
|
|
+ }
|
|
|
|
|
+ return orderContractState('0', type, info)
|
|
|
|
|
+ .then(res => {
|
|
|
|
|
+ return Promise.resolve(res);
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch(err => {
|
|
|
|
|
+ return Promise.reject(err);
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return { loading, sendReq }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 合同类型
|
|
* 合同类型
|
|
|
*/
|
|
*/
|
|
@@ -61,7 +129,9 @@ export function handleContract() {
|
|
|
function contractChange(value: number) {
|
|
function contractChange(value: number) {
|
|
|
isSell.value = value === 1 ? false : true;
|
|
isSell.value = value === 1 ? false : true;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
const customList = ref<QueryCustomInfoType[]>([])
|
|
const customList = ref<QueryCustomInfoType[]>([])
|
|
|
|
|
+
|
|
|
function queryCustomList() {
|
|
function queryCustomList() {
|
|
|
QueryCustomInfo(3)
|
|
QueryCustomInfo(3)
|
|
|
.then((res) => {
|
|
.then((res) => {
|
|
@@ -72,6 +142,7 @@ export function handleContract() {
|
|
|
message.error(err);
|
|
message.error(err);
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
return { contractType, isSell, contractChange, customList, queryCustomList }
|
|
return { contractType, isSell, contractChange, customList, queryCustomList }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -83,44 +154,54 @@ export function handlevalidate(formState: UnwrapRef<FormState>) {
|
|
|
async function v_ContractType(rule: RuleObject, value: number) {
|
|
async function v_ContractType(rule: RuleObject, value: number) {
|
|
|
return validateCommon(value, '请选择合同类型')
|
|
return validateCommon(value, '请选择合同类型')
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
// 验证业务类型
|
|
// 验证业务类型
|
|
|
async function v_BizType(rule: RuleObject, value: number) {
|
|
async function v_BizType(rule: RuleObject, value: number) {
|
|
|
return validateCommon(value, '请选择业务类型')
|
|
return validateCommon(value, '请选择业务类型')
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
// 验证业务类型
|
|
// 验证业务类型
|
|
|
async function v_BuyUser(rule: RuleObject, value: number) {
|
|
async function v_BuyUser(rule: RuleObject, value: number) {
|
|
|
return validateCommon(value, '请选择采购方')
|
|
return validateCommon(value, '请选择采购方')
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
// 验证业务类型
|
|
// 验证业务类型
|
|
|
async function v_SellUser(rule: RuleObject, value: number) {
|
|
async function v_SellUser(rule: RuleObject, value: number) {
|
|
|
return validateCommon(value, '请选择销售方')
|
|
return validateCommon(value, '请选择销售方')
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
// 验证现货品种
|
|
// 验证现货品种
|
|
|
async function v_DeliveryGoods(rule: RuleObject, value: number) {
|
|
async function v_DeliveryGoods(rule: RuleObject, value: number) {
|
|
|
return validateCommon(value, '请选择现货品种')
|
|
return validateCommon(value, '请选择现货品种')
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
// 验证品类
|
|
// 验证品类
|
|
|
async function v_WrStandard(rule: RuleObject, value: number) {
|
|
async function v_WrStandard(rule: RuleObject, value: number) {
|
|
|
const errorInfo = formState.DeliveryGoodsID ? '请选择品类' : '请先选择现货品种'
|
|
const errorInfo = formState.DeliveryGoodsID ? '请选择品类' : '请先选择现货品种'
|
|
|
return validateCommon(value, errorInfo)
|
|
return validateCommon(value, errorInfo)
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
// 验证品牌
|
|
// 验证品牌
|
|
|
async function v_SpotGoodsBrand(rule: RuleObject, value: number) {
|
|
async function v_SpotGoodsBrand(rule: RuleObject, value: number) {
|
|
|
const errorInfo = formState.DeliveryGoodsID ? '请选择品牌' : '请先选择现货品种'
|
|
const errorInfo = formState.DeliveryGoodsID ? '请选择品牌' : '请先选择现货品种'
|
|
|
return validateCommon(value, errorInfo)
|
|
return validateCommon(value, errorInfo)
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
// 验证定价类型
|
|
// 验证定价类型
|
|
|
async function v_PriceType(rule: RuleObject, value: number) {
|
|
async function v_PriceType(rule: RuleObject, value: number) {
|
|
|
return validateCommon(value, '请选择定价类型')
|
|
return validateCommon(value, '请选择定价类型')
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
// 验证结算币种
|
|
// 验证结算币种
|
|
|
async function v_Currency(rule: RuleObject, value: number) {
|
|
async function v_Currency(rule: RuleObject, value: number) {
|
|
|
return validateCommon(value, '请选择结算币种')
|
|
return validateCommon(value, '请选择结算币种')
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
// 验证点价合约
|
|
// 验证点价合约
|
|
|
async function v_Goods(rule: RuleObject, value: number) {
|
|
async function v_Goods(rule: RuleObject, value: number) {
|
|
|
return validateCommon(value, '请选择点价合约')
|
|
return validateCommon(value, '请选择点价合约')
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
return {
|
|
return {
|
|
|
v_ContractType, v_BizType, v_BuyUser, v_SellUser, v_DeliveryGoods, v_WrStandard,
|
|
v_ContractType, v_BizType, v_BuyUser, v_SellUser, v_DeliveryGoods, v_WrStandard,
|
|
|
v_SpotGoodsBrand, v_PriceType, v_Currency, v_Goods
|
|
v_SpotGoodsBrand, v_PriceType, v_Currency, v_Goods
|
|
@@ -147,6 +228,7 @@ export function handleDeliveryGoods(formState: UnwrapRef<FormState>) {
|
|
|
message.error(err)
|
|
message.error(err)
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
// 切换现货商品
|
|
// 切换现货商品
|
|
|
function deliveryGoodsChange(value: number | undefined) {
|
|
function deliveryGoodsChange(value: number | undefined) {
|
|
|
if (value !== undefined) {
|
|
if (value !== undefined) {
|
|
@@ -156,6 +238,7 @@ export function handleDeliveryGoods(formState: UnwrapRef<FormState>) {
|
|
|
gmlist.value.length = 0
|
|
gmlist.value.length = 0
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
// 查询现货商品详情
|
|
// 查询现货商品详情
|
|
|
function getDeliveryGoodsDetail(deliverygoodsid: number) {
|
|
function getDeliveryGoodsDetail(deliverygoodsid: number) {
|
|
|
QueryDeliveryGoodsDetail(deliverygoodsid).then(res => {
|
|
QueryDeliveryGoodsDetail(deliverygoodsid).then(res => {
|
|
@@ -168,7 +251,9 @@ export function handleDeliveryGoods(formState: UnwrapRef<FormState>) {
|
|
|
message.error(err)
|
|
message.error(err)
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
const numberUnit = ref<string>('')
|
|
const numberUnit = ref<string>('')
|
|
|
|
|
+
|
|
|
// 品类变更
|
|
// 品类变更
|
|
|
function WrStandardChange(value: number) {
|
|
function WrStandardChange(value: number) {
|
|
|
const obj = gmlist.value.find((e) => e.wrstandardid === value);
|
|
const obj = gmlist.value.find((e) => e.wrstandardid === value);
|
|
@@ -182,7 +267,17 @@ export function handleDeliveryGoods(formState: UnwrapRef<FormState>) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- return { deliveryGoodsList, gblist, gmlist, numberUnit, WrStandardChange, getDeliveryGoods, getDeliveryGoodsDetail, deliveryGoodsChange }
|
|
|
|
|
|
|
+
|
|
|
|
|
+ return {
|
|
|
|
|
+ deliveryGoodsList,
|
|
|
|
|
+ gblist,
|
|
|
|
|
+ gmlist,
|
|
|
|
|
+ numberUnit,
|
|
|
|
|
+ WrStandardChange,
|
|
|
|
|
+ getDeliveryGoods,
|
|
|
|
|
+ getDeliveryGoodsDetail,
|
|
|
|
|
+ deliveryGoodsChange
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -200,6 +295,7 @@ export function handlePrice(formState: UnwrapRef<FormState>) {
|
|
|
console.log('payCurrency', payCurrency);
|
|
console.log('payCurrency', payCurrency);
|
|
|
// 目前写死,获取枚举信息里面没有 单位名称,后期进行优化
|
|
// 目前写死,获取枚举信息里面没有 单位名称,后期进行优化
|
|
|
const payCurrencyUnit = ref<string>('元')
|
|
const payCurrencyUnit = ref<string>('元')
|
|
|
|
|
+
|
|
|
// 切换币种
|
|
// 切换币种
|
|
|
function parCurrencyChange(value: number) {
|
|
function parCurrencyChange(value: number) {
|
|
|
const obj = payCurrency.find(e => e.enumdicid === value)
|
|
const obj = payCurrency.find(e => e.enumdicid === value)
|
|
@@ -207,13 +303,8 @@ export function handlePrice(formState: UnwrapRef<FormState>) {
|
|
|
|
|
|
|
|
// payCurrencyUnit.value = obj?.enumdicname
|
|
// payCurrencyUnit.value = obj?.enumdicname
|
|
|
}
|
|
}
|
|
|
- return { priceType, payCurrency, payCurrencyUnit, parCurrencyChange }
|
|
|
|
|
-}
|
|
|
|
|
|
|
|
|
|
-export function handleAddAction() {
|
|
|
|
|
- function addAction() {
|
|
|
|
|
- // orderContract()
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ return { priceType, payCurrency, payCurrencyUnit, parCurrencyChange }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -224,9 +315,21 @@ export function handleDate() {
|
|
|
const deliveryDate = ref<Moment[]>([])
|
|
const deliveryDate = ref<Moment[]>([])
|
|
|
// 点价期
|
|
// 点价期
|
|
|
const priceDate = ref<Moment[]>([]);
|
|
const priceDate = ref<Moment[]>([]);
|
|
|
|
|
+
|
|
|
function disabledDate(current: Moment) {
|
|
function disabledDate(current: Moment) {
|
|
|
// Can not select days before today and today
|
|
// Can not select days before today and today
|
|
|
return current && current < moment().endOf('day');
|
|
return current && current < moment().endOf('day');
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
return { deliveryDate, priceDate, disabledDate }
|
|
return { deliveryDate, priceDate, disabledDate }
|
|
|
|
|
+}
|
|
|
|
|
+/**
|
|
|
|
|
+ * 处理金额
|
|
|
|
|
+ */
|
|
|
|
|
+export function handleAmout(formState: UnwrapRef<FormState>) {
|
|
|
|
|
+ function getAmout() {
|
|
|
|
|
+ const { Price, Qty } = formState
|
|
|
|
|
+ formState.Amount = (Price && Qty) ? Price * Qty : 0
|
|
|
|
|
+ }
|
|
|
|
|
+ return { getAmout }
|
|
|
}
|
|
}
|