|
|
@@ -45,14 +45,83 @@ export function handleFromState() {
|
|
|
PriceMove: null,// double 升贴水[2:点价3:暂定价]
|
|
|
StartDate: '', // 点价开始时间
|
|
|
EndDate: '', // 点价结束时间
|
|
|
- TradeUserID: 0, // 交易员ID
|
|
|
+ TradeUserID: undefined, // 交易员ID
|
|
|
})
|
|
|
// 业务类型
|
|
|
const businessType = [
|
|
|
{ key: 1, value: '套保' },
|
|
|
{ key: 2, value: '套利' },
|
|
|
];
|
|
|
- return { formState, businessType }
|
|
|
+ // 验证合同类型
|
|
|
+ async function v_ContractType(rule: RuleObject, value: number) {
|
|
|
+ return validateCommon(value, '请选择合同类型')
|
|
|
+ }
|
|
|
+
|
|
|
+ // 验证业务类型
|
|
|
+ // async function v_BizType(rule: RuleObject, value: number) {
|
|
|
+ // return validateCommon(value, '请选择业务类型')
|
|
|
+ // }
|
|
|
+
|
|
|
+ // 验证业务类型
|
|
|
+ async function v_BuyUser(rule: RuleObject, value: number) {
|
|
|
+ return validateCommon(value, '请选择采购方')
|
|
|
+ }
|
|
|
+
|
|
|
+ // 验证业务类型
|
|
|
+ async function v_SellUser(rule: RuleObject, value: number) {
|
|
|
+ return validateCommon(value, '请选择销售方')
|
|
|
+ }
|
|
|
+
|
|
|
+ // 验证现货品种
|
|
|
+ async function v_DeliveryGoods(rule: RuleObject, value: number) {
|
|
|
+ return validateCommon(value, '请选择现货品种')
|
|
|
+ }
|
|
|
+
|
|
|
+ // 验证品类
|
|
|
+ async function v_WrStandard(rule: RuleObject, value: number) {
|
|
|
+ const errorInfo = formState.DeliveryGoodsID ? '请选择品类' : '请先选择现货品种'
|
|
|
+ return validateCommon(value, errorInfo)
|
|
|
+ }
|
|
|
+
|
|
|
+ // 验证品牌
|
|
|
+ async function v_SpotGoodsBrand(rule: RuleObject, value: number) {
|
|
|
+ const errorInfo = formState.DeliveryGoodsID ? '请选择品牌' : '请先选择现货品种'
|
|
|
+ return validateCommon(value, errorInfo)
|
|
|
+ }
|
|
|
+
|
|
|
+ // 验证定价类型
|
|
|
+ async function v_PriceType(rule: RuleObject, value: number) {
|
|
|
+ return validateCommon(value, '请选择定价类型')
|
|
|
+ }
|
|
|
+
|
|
|
+ // 验证结算币种
|
|
|
+ async function v_Currency(rule: RuleObject, value: number) {
|
|
|
+ return validateCommon(value, '请选择结算币种')
|
|
|
+ }
|
|
|
+
|
|
|
+ // 验证点价合约
|
|
|
+ async function v_Goods(rule: RuleObject, value: number) {
|
|
|
+ return validateCommon(value, '请选择点价合约')
|
|
|
+ }
|
|
|
+ const rules = {
|
|
|
+ ContractNo: [{ required: true, message: '请输入合同编号', trigger: 'blur' }],
|
|
|
+ ContractType: [{ required: true, validator: v_ContractType, trigger: 'change' }],
|
|
|
+ // BizType: [{ required: true, validator: v_BizType, trigger: 'change' }],
|
|
|
+ BuyUserID: [{ required: true, validator: v_BuyUser, trigger: 'change' }],
|
|
|
+ SellUserID: [{ required: true, validator: v_SellUser, trigger: 'change' }],
|
|
|
+ DeliveryGoodsID: [{ required: true, validator: v_DeliveryGoods, trigger: 'change' }],
|
|
|
+ WrStandardID: [{ required: true, validator: v_WrStandard, trigger: 'blur' }],
|
|
|
+ SpotGoodsBrandID: [{ required: true, validator: v_SpotGoodsBrand, trigger: 'blur' }],
|
|
|
+ GoodsID: [{ required: true, validator: v_Goods, trigger: 'blur' }],
|
|
|
+ // ConvertFactor: [{ required: true, message: '请选择品类', trigger: 'blur' }],
|
|
|
+ SpotGoodsDesc: [{ required: true, message: '请输入商品规格', trigger: 'blur' }],
|
|
|
+ PriceType: [{ required: true, validator: v_PriceType, trigger: 'blur' }],
|
|
|
+ CurrencyID: [{ required: true, validator: v_Currency, trigger: 'blur' }],
|
|
|
+ Qty: [{ required: true, message: '请输入数量', trigger: 'blur' }],
|
|
|
+ Price: [{ required: true, message: '请输入价格', trigger: 'blur' }],
|
|
|
+ PriceMove: [{ required: true, message: '请输入升贴水', trigger: 'blur' }],
|
|
|
+ };
|
|
|
+ return { formState, businessType, rules }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -63,7 +132,7 @@ export function addContractReq() {
|
|
|
* @param form 表单信息
|
|
|
* @Param type 1: 保存草稿 2: 提交申请
|
|
|
*/
|
|
|
- function sendReq(form: FormState, type: number, loading: Ref<boolean>): Promise<string> {
|
|
|
+ function sendReq(form: FormState, loading: Ref<boolean>, OperateType: 1 | 2): Promise<string> {
|
|
|
loading.value = true
|
|
|
const info: GldSpotContractInfo = {
|
|
|
UserID: APP.get('userAccount').memberuserid,// 机构ID
|
|
|
@@ -88,7 +157,7 @@ export function addContractReq() {
|
|
|
BizType: form.BizType, // 业务类型 - 1:套保 2:套利
|
|
|
Remark: form.Remark, // 合同备注
|
|
|
// ContractAttachment: , // 合同附件
|
|
|
- ContractMargin: form.ContractMargin as number, // 合同保证金
|
|
|
+ ContractMargin: form.ContractMargin ? Number(form.ContractMargin) : 0, // 合同保证金
|
|
|
|
|
|
Amount: [1, 3].includes(form.PriceType) ? Number(form.Price) * Number(form.Qty) : 0, // 金额
|
|
|
PriceMove: Number(form.PriceMove as number), // 升贴水
|
|
|
@@ -100,16 +169,18 @@ export function addContractReq() {
|
|
|
|
|
|
GoodsID: form.GoodsID as number, // 点价合约ID-0:为现货,其它为期货商品合约ID[2:点价3:暂定价]
|
|
|
|
|
|
- // MerUserID: form.MerUserID, // 跟单员ID
|
|
|
- // TradeUserID: form.TradeUserID, // 交易员ID
|
|
|
- // SaleUserID: form.SaleUserID,// 业务员id
|
|
|
+ MerUserID: form.MerUserID || 0, // 跟单员ID
|
|
|
+ TradeUserID: form.TradeUserID || 0, // 交易员ID
|
|
|
+ SaleUserID: form.SaleUserID || 0,// 业务员id
|
|
|
}
|
|
|
const params: GldErmcpSpotContractOperateReq = {
|
|
|
SpotContractID: '0',
|
|
|
- OperateType: type,
|
|
|
+ OperateType,
|
|
|
Remark: '',
|
|
|
Info: info,
|
|
|
}
|
|
|
+ console.log('prams', params);
|
|
|
+
|
|
|
return orderContractControl(params, loading)
|
|
|
.then(res => {
|
|
|
return Promise.resolve(res);
|
|
|
@@ -155,67 +226,6 @@ export function handleContract() {
|
|
|
return { contractType, isSell, contractChange, customList, queryCustomList }
|
|
|
}
|
|
|
|
|
|
-/**
|
|
|
- * 自定义表单验证方法
|
|
|
- */
|
|
|
-export function handlevalidate(formState: UnwrapRef<FormState>) {
|
|
|
- // 验证合同类型
|
|
|
- async function v_ContractType(rule: RuleObject, value: number) {
|
|
|
- return validateCommon(value, '请选择合同类型')
|
|
|
- }
|
|
|
-
|
|
|
- // 验证业务类型
|
|
|
- async function v_BizType(rule: RuleObject, value: number) {
|
|
|
- return validateCommon(value, '请选择业务类型')
|
|
|
- }
|
|
|
-
|
|
|
- // 验证业务类型
|
|
|
- async function v_BuyUser(rule: RuleObject, value: number) {
|
|
|
- return validateCommon(value, '请选择采购方')
|
|
|
- }
|
|
|
-
|
|
|
- // 验证业务类型
|
|
|
- async function v_SellUser(rule: RuleObject, value: number) {
|
|
|
- return validateCommon(value, '请选择销售方')
|
|
|
- }
|
|
|
-
|
|
|
- // 验证现货品种
|
|
|
- async function v_DeliveryGoods(rule: RuleObject, value: number) {
|
|
|
- return validateCommon(value, '请选择现货品种')
|
|
|
- }
|
|
|
-
|
|
|
- // 验证品类
|
|
|
- async function v_WrStandard(rule: RuleObject, value: number) {
|
|
|
- const errorInfo = formState.DeliveryGoodsID ? '请选择品类' : '请先选择现货品种'
|
|
|
- return validateCommon(value, errorInfo)
|
|
|
- }
|
|
|
-
|
|
|
- // 验证品牌
|
|
|
- async function v_SpotGoodsBrand(rule: RuleObject, value: number) {
|
|
|
- const errorInfo = formState.DeliveryGoodsID ? '请选择品牌' : '请先选择现货品种'
|
|
|
- return validateCommon(value, errorInfo)
|
|
|
- }
|
|
|
-
|
|
|
- // 验证定价类型
|
|
|
- async function v_PriceType(rule: RuleObject, value: number) {
|
|
|
- return validateCommon(value, '请选择定价类型')
|
|
|
- }
|
|
|
-
|
|
|
- // 验证结算币种
|
|
|
- async function v_Currency(rule: RuleObject, value: number) {
|
|
|
- return validateCommon(value, '请选择结算币种')
|
|
|
- }
|
|
|
-
|
|
|
- // 验证点价合约
|
|
|
- async function v_Goods(rule: RuleObject, value: number) {
|
|
|
- return validateCommon(value, '请选择点价合约')
|
|
|
- }
|
|
|
-
|
|
|
- return {
|
|
|
- v_ContractType, v_BizType, v_BuyUser, v_SellUser, v_DeliveryGoods, v_WrStandard,
|
|
|
- v_SpotGoodsBrand, v_PriceType, v_Currency, v_Goods
|
|
|
- }
|
|
|
-}
|
|
|
|
|
|
/**
|
|
|
* 处理现货商品
|