|
@@ -337,23 +337,26 @@
|
|
|
<legend>其他信息</legend>
|
|
<legend>其他信息</legend>
|
|
|
<a-row :gutter="24">
|
|
<a-row :gutter="24">
|
|
|
<a-col :span="12">
|
|
<a-col :span="12">
|
|
|
- <a-form-item label="保证金">
|
|
|
|
|
|
|
+ <a-form-item label="保证金"
|
|
|
|
|
+ name="ContractMargin">
|
|
|
<a-input class="dialogInput suffixGrey"
|
|
<a-input class="dialogInput suffixGrey"
|
|
|
placeholder="请输入保证金"
|
|
placeholder="请输入保证金"
|
|
|
|
|
+ v-model:value="formState.ContractMargin"
|
|
|
style="width: 200px"
|
|
style="width: 200px"
|
|
|
:suffix="payCurrencyUnit" />
|
|
:suffix="payCurrencyUnit" />
|
|
|
</a-form-item>
|
|
</a-form-item>
|
|
|
</a-col>
|
|
</a-col>
|
|
|
<a-col :span="12">
|
|
<a-col :span="12">
|
|
|
- <a-form-item label="业务员">
|
|
|
|
|
|
|
+ <a-form-item label="业务员"
|
|
|
|
|
+ name="SaleUserID">
|
|
|
<a-select class="inlineFormSelect"
|
|
<a-select class="inlineFormSelect"
|
|
|
|
|
+ v-model:value="formState.SaleUserID"
|
|
|
style="width: 200px"
|
|
style="width: 200px"
|
|
|
placeholder="请选择业务员">
|
|
placeholder="请选择业务员">
|
|
|
- <a-select-option value="1">
|
|
|
|
|
- 客户一
|
|
|
|
|
- </a-select-option>
|
|
|
|
|
- <a-select-option value="2">
|
|
|
|
|
- 客户二
|
|
|
|
|
|
|
+ <a-select-option v-for="item in businesserList"
|
|
|
|
|
+ :key="item.id"
|
|
|
|
|
+ :value="item.id">
|
|
|
|
|
+ {{item.name}}
|
|
|
</a-select-option>
|
|
</a-select-option>
|
|
|
</a-select>
|
|
</a-select>
|
|
|
</a-form-item>
|
|
</a-form-item>
|
|
@@ -361,29 +364,31 @@
|
|
|
</a-row>
|
|
</a-row>
|
|
|
<a-row :gutter="24">
|
|
<a-row :gutter="24">
|
|
|
<a-col :span="12">
|
|
<a-col :span="12">
|
|
|
- <a-form-item label="跟单员">
|
|
|
|
|
|
|
+ <a-form-item label="跟单员"
|
|
|
|
|
+ name="MerUserID">
|
|
|
<a-select class="inlineFormSelect"
|
|
<a-select class="inlineFormSelect"
|
|
|
|
|
+ v-model:value="formState.MerUserID"
|
|
|
style="width: 200px"
|
|
style="width: 200px"
|
|
|
placeholder="请选择跟单员">
|
|
placeholder="请选择跟单员">
|
|
|
- <a-select-option value="1">
|
|
|
|
|
- 客户一
|
|
|
|
|
- </a-select-option>
|
|
|
|
|
- <a-select-option value="2">
|
|
|
|
|
- 客户二
|
|
|
|
|
|
|
+ <a-select-option v-for="item in merchandiserList"
|
|
|
|
|
+ :key="item.id"
|
|
|
|
|
+ :value="item.id">
|
|
|
|
|
+ {{item.name}}
|
|
|
</a-select-option>
|
|
</a-select-option>
|
|
|
</a-select>
|
|
</a-select>
|
|
|
</a-form-item>
|
|
</a-form-item>
|
|
|
</a-col>
|
|
</a-col>
|
|
|
<a-col :span="12">
|
|
<a-col :span="12">
|
|
|
- <a-form-item label="期货账户">
|
|
|
|
|
|
|
+ <a-form-item label="交易用户"
|
|
|
|
|
+ name="TradeUserID">
|
|
|
<a-select class="inlineFormSelect"
|
|
<a-select class="inlineFormSelect"
|
|
|
style="width: 200px"
|
|
style="width: 200px"
|
|
|
|
|
+ v-model:value="formState.TradeUserID"
|
|
|
placeholder="请选择期货账户">
|
|
placeholder="请选择期货账户">
|
|
|
- <a-select-option value="1">
|
|
|
|
|
- 客户一
|
|
|
|
|
- </a-select-option>
|
|
|
|
|
- <a-select-option value="2">
|
|
|
|
|
- 客户二
|
|
|
|
|
|
|
+ <a-select-option v-for="item in traderList"
|
|
|
|
|
+ :key="item.id"
|
|
|
|
|
+ :value="item.id">
|
|
|
|
|
+ {{item.name}}
|
|
|
</a-select-option>
|
|
</a-select-option>
|
|
|
</a-select>
|
|
</a-select>
|
|
|
</a-form-item>
|
|
</a-form-item>
|
|
@@ -404,17 +409,19 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
<script lang="ts">
|
|
|
-import {defineComponent, PropType, ref, toRaw} from 'vue';
|
|
|
|
|
|
|
+import { defineComponent, PropType, ref, toRaw } from 'vue';
|
|
|
import { closeModal } from '@/common/setup/modal/index';
|
|
import { closeModal } from '@/common/setup/modal/index';
|
|
|
import { initData } from '@/common/methods';
|
|
import { initData } from '@/common/methods';
|
|
|
-import { handleFromState, handleContract, handlevalidate, handleDeliveryGoods, handleAmout, handlePrice, handleDate, addContractReq } from './setup';
|
|
|
|
|
|
|
+import { handleFromState, handleContract, handleDeliveryGoods, handleAmout, handlePrice, handleDate, addContractReq } from './setup';
|
|
|
import { getUserName, getUsrId } from '@/services/bus/user';
|
|
import { getUserName, getUsrId } from '@/services/bus/user';
|
|
|
import { getGoodsList } from '@/services/bus/goods';
|
|
import { getGoodsList } from '@/services/bus/goods';
|
|
|
import { Goods } from '@/services/go/ermcp/goodsInfo/interface';
|
|
import { Goods } from '@/services/go/ermcp/goodsInfo/interface';
|
|
|
import { ValidateErrorEntity } from 'ant-design-vue/lib/form/interface';
|
|
import { ValidateErrorEntity } from 'ant-design-vue/lib/form/interface';
|
|
|
import { FormState } from './interface';
|
|
import { FormState } from './interface';
|
|
|
import { formatTime } from '@/common/methods/format';
|
|
import { formatTime } from '@/common/methods/format';
|
|
|
-import {Ermcp3ContractRsp} from "@/services/go/ermcp/spot-contract/interface";
|
|
|
|
|
|
|
+import { Ermcp3ContractRsp } from '@/services/go/ermcp/spot-contract/interface';
|
|
|
|
|
+import { handleAccountManager } from '../setup';
|
|
|
|
|
+import { Moment } from 'moment';
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
|
name: 'add-spot-contract',
|
|
name: 'add-spot-contract',
|
|
@@ -425,36 +432,17 @@ export default defineComponent({
|
|
|
default: {},
|
|
default: {},
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
- setup(props,context) {
|
|
|
|
|
|
|
+ setup(props, context) {
|
|
|
const { visible, cancel } = closeModal('spot_contract_btn_add');
|
|
const { visible, cancel } = closeModal('spot_contract_btn_add');
|
|
|
const { sendReq } = addContractReq();
|
|
const { sendReq } = addContractReq();
|
|
|
const loading = ref<boolean>(false);
|
|
const loading = ref<boolean>(false);
|
|
|
|
|
|
|
|
// 表单
|
|
// 表单
|
|
|
const formRef = ref();
|
|
const formRef = ref();
|
|
|
- const { formState, businessType } = handleFromState();
|
|
|
|
|
|
|
+ const { formState, businessType, rules } = handleFromState();
|
|
|
// 合同类型
|
|
// 合同类型
|
|
|
const { contractType, isSell, contractChange, customList, queryCustomList } = handleContract();
|
|
const { contractType, isSell, contractChange, customList, queryCustomList } = handleContract();
|
|
|
- // 自定义表单验证方法
|
|
|
|
|
- const { v_ContractType, v_BizType, v_BuyUser, v_SellUser, v_DeliveryGoods, v_WrStandard, v_SpotGoodsBrand, v_PriceType, v_Currency, v_Goods } = handlevalidate(formState);
|
|
|
|
|
- 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' }],
|
|
|
|
|
- };
|
|
|
|
|
|
|
+
|
|
|
// 处理现货商品
|
|
// 处理现货商品
|
|
|
const { deliveryGoodsList, gblist, gmlist, numberUnit, WrStandardChange, getDeliveryGoods, deliveryGoodsChange } = handleDeliveryGoods(formState);
|
|
const { deliveryGoodsList, gblist, gmlist, numberUnit, WrStandardChange, getDeliveryGoods, deliveryGoodsChange } = handleDeliveryGoods(formState);
|
|
|
// 价格信息
|
|
// 价格信息
|
|
@@ -463,21 +451,26 @@ export default defineComponent({
|
|
|
const { deliveryDate, priceDate, disabledDate } = handleDate();
|
|
const { deliveryDate, priceDate, disabledDate } = handleDate();
|
|
|
// 处理金额
|
|
// 处理金额
|
|
|
const { getAmout } = handleAmout(formState);
|
|
const { getAmout } = handleAmout(formState);
|
|
|
|
|
+ // 账号列表: 交易用户 业务员 跟单员
|
|
|
|
|
+ const { traderList, businesserList, merchandiserList, getRoleList, getBusinesserList } = handleAccountManager();
|
|
|
// 现货商品列表
|
|
// 现货商品列表
|
|
|
const goodsList = ref<Goods[]>([]);
|
|
const goodsList = ref<Goods[]>([]);
|
|
|
- function submit(OperateType: number) {
|
|
|
|
|
|
|
+
|
|
|
|
|
+ function submit(OperateType: 1 | 2) {
|
|
|
formRef.value
|
|
formRef.value
|
|
|
.validate()
|
|
.validate()
|
|
|
.then(() => {
|
|
.then(() => {
|
|
|
const param = toRaw(formState);
|
|
const param = toRaw(formState);
|
|
|
const id = getUsrId();
|
|
const id = getUsrId();
|
|
|
isSell.value ? (param.SellUserID = id) : (param.BuyUserID = id);
|
|
isSell.value ? (param.SellUserID = id) : (param.BuyUserID = id);
|
|
|
-
|
|
|
|
|
|
|
+ const fn = (value: Moment) => {
|
|
|
|
|
+ return formatTime(value, 'd') + ' ' + '00:00:00';
|
|
|
|
|
+ };
|
|
|
// 交收期
|
|
// 交收期
|
|
|
const dDate = deliveryDate.value;
|
|
const dDate = deliveryDate.value;
|
|
|
if (dDate.length) {
|
|
if (dDate.length) {
|
|
|
- const DeliveryStartDate = formatTime(dDate[0], 'd') + '00:00:00';
|
|
|
|
|
- const DeliveryEndDate = formatTime(dDate[1], 'd') + '00:00:00';
|
|
|
|
|
|
|
+ const DeliveryStartDate = fn(dDate[0]);
|
|
|
|
|
+ const DeliveryEndDate = fn(dDate[1]);
|
|
|
Object.assign(param, { DeliveryStartDate, DeliveryEndDate });
|
|
Object.assign(param, { DeliveryStartDate, DeliveryEndDate });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -485,13 +478,13 @@ export default defineComponent({
|
|
|
const pDate = priceDate.value;
|
|
const pDate = priceDate.value;
|
|
|
if (pDate.length && param.PriceType !== 1) {
|
|
if (pDate.length && param.PriceType !== 1) {
|
|
|
// 点价日期[2:点价3:暂定价]
|
|
// 点价日期[2:点价3:暂定价]
|
|
|
- const StartDate = formatTime(dDate[0], 'd') + '00:00:00';
|
|
|
|
|
- const EndDate = formatTime(dDate[1], 'd') + '00:00:00';
|
|
|
|
|
|
|
+ const StartDate = fn(pDate[0]);
|
|
|
|
|
+ const EndDate = fn(pDate[1]);
|
|
|
Object.assign(param, { StartDate, EndDate });
|
|
Object.assign(param, { StartDate, EndDate });
|
|
|
}
|
|
}
|
|
|
console.log('values', formState);
|
|
console.log('values', formState);
|
|
|
|
|
|
|
|
- sendReq(param, OperateType, loading)
|
|
|
|
|
|
|
+ sendReq(param, loading, OperateType)
|
|
|
.then((res) => {
|
|
.then((res) => {
|
|
|
context.emit('refresh');
|
|
context.emit('refresh');
|
|
|
cancel();
|
|
cancel();
|
|
@@ -506,6 +499,8 @@ export default defineComponent({
|
|
|
queryCustomList();
|
|
queryCustomList();
|
|
|
getDeliveryGoods();
|
|
getDeliveryGoods();
|
|
|
goodsList.value = getGoodsList();
|
|
goodsList.value = getGoodsList();
|
|
|
|
|
+ getRoleList();
|
|
|
|
|
+ getBusinesserList();
|
|
|
});
|
|
});
|
|
|
return {
|
|
return {
|
|
|
visible,
|
|
visible,
|
|
@@ -537,6 +532,9 @@ export default defineComponent({
|
|
|
disabledDate,
|
|
disabledDate,
|
|
|
goodsList,
|
|
goodsList,
|
|
|
getAmout,
|
|
getAmout,
|
|
|
|
|
+ traderList,
|
|
|
|
|
+ businesserList,
|
|
|
|
|
+ merchandiserList,
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
});
|
|
});
|