Parcourir la source

Merge branch 'master' of http://47.101.159.18:3000/Muchinfo/MTP2.0_WEB

marymelisa il y a 4 ans
Parent
commit
9e9a3fa81d

+ 1 - 0
src/services/go/ermcp/account/index.ts

@@ -32,6 +32,7 @@ export function QueryAccMgrTaaccount(): Promise<ErmcpTaAccountEx>{
 }
 
 /**
+ * 业务员 跟单员 接口querytype 传1 业务员roletype 22 跟单员roletype23 交易用户接口querytype 传2
  * 信息 - 账户管理 - (业务账户, 交易账户, 管理账户)
  * 查询账户管理登录账号(账户管理/登录账号) /Ermcp/QueryAccMgrLoginUser
  * @param querytype 查询类型 1-业务账户 2-交易账户 3-管理账户

+ 1 - 0
src/services/proto/spotcontract/index.ts

@@ -34,6 +34,7 @@ export const orderContract = (param: GldErmcpSpotContractOperateReq): Promise<an
         APP.sendTradingServer(package50, undefined, {
             onSuccess: (res) => {
                 const { isSuccess, result } = parseProtoRsp50(res, 'GldErmcpSpotContractOperateRsp');
+                debugger
                 if (isSuccess) {
                     resolve(result);
                 } else {

+ 17 - 17
src/services/proto/spotcontract/interface.ts

@@ -33,8 +33,8 @@ export interface GldSpotContractInfo {
     BuyUserID: number // uint64 采购方ID
     SellUserID: number // uint64 客户ID
     SignDate: string // string 签订日期
-    ContractAttachment: Uint8Array // bytes 合同附件
-    ContractMargin: number // double 合同保证金
+    ContractAttachment?: Uint8Array // bytes 合同附件
+    ContractMargin?: number // double 合同保证金
     DeliveryGoodsID: number  // uint64 现货品种ID
     WrStandardID: number  // uint64 现货商品ID
     ProductType: number  // uint32 产品类型-1:标准仓单2:等标3:非标
@@ -48,19 +48,19 @@ export interface GldSpotContractInfo {
     DeliveryEndDate: string // string 交收期(结束)
     GoodsID: number // uint64 点价合约ID-0:为现货,其它为期货商品合约ID[2:点价3:暂定价]
     PriceMove: number// double 升贴水[2:点价3:暂定价]
-    StartDate: string // string 点价开始日期[2:点价3:暂定价]
-    EndDate: string // string 点价结束日期[2:点价3:暂定价]
-    PointDesc: string // string 点价备注[2:点价3:暂定价]
-    DeliveryDesc: string  // string 交收方式
-    MerUserID: number // uint64 跟单员ID
-    TradeUserID: number // uint64 交易员ID
-    PricedQty: number // double 已定价量
-    PricedAmount: number // double 已定价金额
+    StartDate?: string // string 点价开始日期[2:点价3:暂定价]
+    EndDate?: string // string 点价结束日期[2:点价3:暂定价]
+    PointDesc?: string // string 点价备注[2:点价3:暂定价]
+    DeliveryDesc?: string  // string 交收方式
+    MerUserID?: number // uint64 跟单员ID
+    TradeUserID?: number // uint64 交易员ID
+    PricedQty?: number // double 已定价量
+    PricedAmount?: number // double 已定价金额
     SpotGoodsBrandID: number // uint64 现货品牌ID
-    Remark: string // string 合同备注
-    SaleUserID: number // uint64 业务员ID
-    AccountID: number // uint64 期货账户ID
-    BizType: number // uint32 业务类型 - 1:套保 2:套利
+    Remark?: string // string 合同备注
+    SaleUserID?: number // uint64 业务员ID
+    AccountID?: number // uint64 期货账户ID
+    BizType?: number // uint32 业务类型 - 1:套保 2:套利
     CurrencyID: number // 结算币种ID
 }
 
@@ -78,7 +78,7 @@ export interface SpotContractInfo {
     UserID: number; // uint32 机构ID
     BuyUserID: number; // uint32 采购方ID
     SellUserID: number; // uint32 客户ID
-    SignDate: string; // string 签订日期
+    SignDate?: string; // string 签订日期
     ContractAttachment: Uint8Array; // bytes 合同附件
     ContractMargin: number; // double 合同保证金
     DeliveryGoodsID: number; // uint32 现货品种ID
@@ -90,8 +90,8 @@ export interface SpotContractInfo {
     Qty: number; // double 数量
     Price: number; // double 价格暂定价[1:一口价、3:暂定价]
     Amount: number; // double 金额[1:一口价、3:暂定价]
-    DeliveryStartDate: string; // string 交收期(开始)
-    DeliveryEndDate: string; // string 交收期(结束)
+    DeliveryStartDate?: string; // string 交收期(开始)
+    DeliveryEndDate?: string; // string 交收期(结束)
     GoodsID: number; // uint32 点价合约ID-0:为现货,其它为期货商品合约ID[2:点价3:暂定价]
     PriceMove: number; // double 升贴水[2:点价3:暂定价]
     StartDate: string; // string 点价开始日期[2:点价3:暂定价]

+ 9 - 7
src/services/socket/protobuf/buildReq.ts

@@ -1,13 +1,13 @@
+import APP from '@/services';
+import { getAccount_longType, getUserId } from '@/services/bus/account';
+import { getErrorInfoByCode } from '@/services/bus/error';
+import { funCode } from '@/services/funcode/index';
 import ProtobufCtr from '@/services/socket/protobuf/index';
 import { Package50 } from '@/utils/websocket/package';
-import { funCode } from '@/services/funcode/index';
 import { v4 as uuidv4 } from 'uuid';
-import { SoleSearchParam, CommonSearchParam, ParseRsp } from './interface';
 import * as type from './interface';
+import { CommonSearchParam, ParseRsp, SoleSearchParam } from './interface';
 import { IMessageHead } from './proto.d';
-import APP from '@/services';
-import { getAccount_longType, getUserId } from '@/services/bus/account';
-import { getErrorInfoByCode } from '@/services/bus/error';
 
 /**
  * 构建proto50 报文
@@ -179,11 +179,13 @@ function isErrer(rspPackage: any, funCodeName: string): void {
 function parseSoleProtoRsp(rspPackage: any, funCodeName: string): ParseRsp {
     isErrer(rspPackage, funCodeName);
     const reqPackage = ProtobufCtr.generateProtoContent(funCodeName, rspPackage.content);
-    const { RetCode, Status } = reqPackage;
+    const { RetCode, Status, RetDesc } = reqPackage;
     if (RetCode !== null) {
         if (RetCode === 0) {
             return { isSuccess: true, result: reqPackage };
-        } else {
+        } if (RetCode === -1) { // 管理端错误消息
+            return { isSuccess: false, result: RetDesc };
+        } else {    // 数据库获取的错误信息
             const errMsg = getErrorInfoByCode(String(RetCode));
             const result = errMsg ? errMsg : `未知错误:${RetCode}`;
             return { isSuccess: false, result };

+ 32 - 24
src/views/information/spot-contract/components/add/index.vue

@@ -221,7 +221,7 @@
                         placeholder="请选择结算币种">
                 <a-select-option v-for="item in payCurrency"
                                  :key="item.enumdicid"
-                                 :value="item.enumdicname">
+                                 :value="item.enumdicid">
                   {{item.enumdicname}}
                 </a-select-option>
               </a-select>
@@ -233,6 +233,7 @@
               <a-input class="dialogInput suffixGrey"
                        v-model:value="formState.Qty"
                        style="width: 200px"
+                       @change="getAmout"
                        placeholder="请输入数量"
                        :suffix="numberUnit" />
             </a-form-item>
@@ -300,6 +301,7 @@
                            name="Price">
                 <a-input class="dialogInput suffixGrey"
                          v-model:value="formState.Price"
+                         @change="getAmout"
                          placeholder="请输入价格"
                          :suffix="`${payCurrencyUnit}/${numberUnit}`"
                          style="width: 200px" />
@@ -307,8 +309,10 @@
             </a-col>
             <a-col :span="12">
               <a-form-item label="金额"
-                           class="relative">
+                           class="relative"
+                           name="Amount">
                 <a-input class="dialogInput suffixGrey"
+                         v-model:value="formState.Amount"
                          readonly
                          placeholder="输入数量和价格后自动算"
                          :suffix="payCurrencyUnit"
@@ -323,21 +327,6 @@
                                 :disabled-date="disabledDate"
                                 :show-time="{hideDisabledOptions: true}"
                                 format="YYYY-MM-DD" />
-                <!-- <a-select class="inlineFormSelect"
-                          style="width: 95px"
-                          placeholder="请选择定价类型">
-                  <a-select-option value="1">
-                    日期一
-                  </a-select-option>
-                </a-select>
-                <span class="to">-</span>
-                <a-select class="inlineFormSelect"
-                          style="width: 95px"
-                          placeholder="请选择定价类型">
-                  <a-select-option value="1">
-                    日期二
-                  </a-select-option>
-                </a-select> -->
               </a-form-item>
             </a-col>
           </template>
@@ -414,24 +403,30 @@
 </template>
 
 <script lang="ts">
-import { defineComponent, ref, toRaw } from 'vue';
+import {defineComponent, PropType, ref, toRaw} from 'vue';
 import { closeModal } from '@/common/setup/modal/index';
 import { initData } from '@/common/methods';
-import { handleFromState, handleContract, handlevalidate, handleDeliveryGoods, handlePrice, handleDate } from './setup';
-import { getUserName } from '@/services/bus/user';
+import { handleFromState, handleContract, handlevalidate, handleDeliveryGoods, handleAmout, handlePrice, handleDate, addContractReq } from './setup';
+import { getUserName, getUsrId } from '@/services/bus/user';
 import { getGoodsList } from '@/services/bus/goods';
 import { Goods } from '@/services/go/ermcp/goodsInfo/interface';
 import { ValidateErrorEntity } from 'ant-design-vue/lib/form/interface';
 import { FormState } from './interface';
 import { formatTime } from '@/common/methods/format';
-import moment from 'moment';
+import {Ermcp3ContractRsp} from "@/services/go/ermcp/spot-contract/interface";
 
 export default defineComponent({
     name: 'add-spot-contract',
     components: {},
-    setup() {
+    props: {
+        selectedRow: {
+            type: Object as PropType<Ermcp3ContractRsp>,
+            default: {},
+        },
+    },
+    setup(props,context) {
         const { visible, cancel } = closeModal('spot_contract_btn_add');
-        const loading = ref<boolean>(false);
+        const { loading, sendReq } = addContractReq();
 
         // 表单
         const formRef = ref();
@@ -443,7 +438,7 @@ export default defineComponent({
         const rules = {
             ContractNo: [{ required: true, message: '请输入合同编号', trigger: 'blur' }],
             ContractType: [{ required: true, validator: v_ContractType, trigger: 'change' }],
-            BizType: [{ required: true, validator: v_BizType, 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' }],
@@ -464,6 +459,8 @@ export default defineComponent({
         const { priceType, payCurrency, payCurrencyUnit, parCurrencyChange } = handlePrice(formState);
         // 日期
         const { deliveryDate, priceDate, disabledDate } = handleDate();
+        // 处理金额
+        const { getAmout } = handleAmout(formState);
         // 现货商品列表
         const goodsList = ref<Goods[]>([]);
         function submit(OperateType: number) {
@@ -471,6 +468,8 @@ export default defineComponent({
                 .validate()
                 .then(() => {
                     const param = toRaw(formState);
+                    const id = getUsrId();
+                    isSell.value ? (param.SellUserID = id) : (param.BuyUserID = id);
 
                     // 交收期
                     const dDate = deliveryDate.value;
@@ -483,11 +482,19 @@ export default defineComponent({
                     // 点价期
                     const pDate = priceDate.value;
                     if (pDate.length && param.PriceType !== 1) {
+                        // 点价日期[2:点价3:暂定价]
                         const StartDate = formatTime(dDate[0], 'd') + '00:00:00';
                         const EndDate = formatTime(dDate[1], 'd') + '00:00:00';
                         Object.assign(param, { StartDate, EndDate });
                     }
                     console.log('values', formState);
+
+                    sendReq(param, OperateType)
+                        .then((res) => {
+                            context.emit('refresh');
+                            cancel();
+                        })
+                        .catch((err) => {});
                 })
                 .catch((error: ValidateErrorEntity<FormState>) => {
                     console.log('error', error);
@@ -527,6 +534,7 @@ export default defineComponent({
             priceDate,
             disabledDate,
             goodsList,
+            getAmout,
         };
     },
 });

+ 3 - 4
src/views/information/spot-contract/components/add/interface.ts

@@ -21,13 +21,12 @@ export interface FormState {
     DeliveryEndDate: string // string 交收期(结束)
     PriceMove: number | null// double 升贴水[2:点价3:暂定价]
     GoodsID: number | undefined // uint64 点价合约ID-0:为现货,其它为期货商品合约ID[2:点价3:暂定价]
-    // PriceMove: number// double 升贴水[2:点价3:暂定价]
-    // StartDate: string // string 点价开始日期[2:点价3:暂定价]
-    // EndDate: string // string 点价结束日期[2:点价3:暂定价]
+    StartDate: string // string 点价开始日期[2:点价3:暂定价]
+    EndDate: string // string 点价结束日期[2:点价3:暂定价]
     // PointDesc: string // string 点价备注[2:点价3:暂定价]
     // DeliveryDesc: string  // string 交收方式
     MerUserID: number | undefined // uint64 跟单员ID
-    // TradeUserID: number // uint64 交易员ID
+    TradeUserID: number // uint64 交易员ID
     // PricedQty: number // double 已定价量
     // PricedAmount: number // double 已定价金额
     SpotGoodsBrandID: number | undefined // uint64 现货品牌ID

+ 111 - 8
src/views/information/spot-contract/components/add/setup.ts

@@ -1,9 +1,12 @@
 import { validateCommon } from '@/common/setup/validate';
+import APP from "@/services";
 import { getItemEnum } from '@/services/bus/allEnum';
 import { QueryCustomInfo } from '@/services/go/ermcp/customInfo';
 import { QueryCustomInfoType } from '@/services/go/ermcp/customInfo/interface';
 import { QueryDeliveryGoods, QueryDeliveryGoodsDetail } from '@/services/go/ermcp/goodsInfo';
 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 { RuleObject } from 'ant-design-vue/lib/form/interface';
 import moment, { Moment } from 'moment';
@@ -36,7 +39,10 @@ export function handleFromState() {
         Remark: '', // string 合同备注
         CurrencyID: undefined, // 结算币种ID
         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 = [
@@ -45,6 +51,68 @@ export function handleFromState() {
     ];
     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) {
         isSell.value = value === 1 ? false : true;
     }
+
     const customList = ref<QueryCustomInfoType[]>([])
+
     function queryCustomList() {
         QueryCustomInfo(3)
             .then((res) => {
@@ -72,6 +142,7 @@ export function handleContract() {
                 message.error(err);
             })
     }
+
     return { contractType, isSell, contractChange, customList, queryCustomList }
 }
 
@@ -83,44 +154,54 @@ 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
@@ -147,6 +228,7 @@ export function handleDeliveryGoods(formState: UnwrapRef<FormState>) {
             message.error(err)
         })
     }
+
     // 切换现货商品
     function deliveryGoodsChange(value: number | undefined) {
         if (value !== undefined) {
@@ -156,6 +238,7 @@ export function handleDeliveryGoods(formState: UnwrapRef<FormState>) {
             gmlist.value.length = 0
         }
     }
+
     // 查询现货商品详情
     function getDeliveryGoodsDetail(deliverygoodsid: number) {
         QueryDeliveryGoodsDetail(deliverygoodsid).then(res => {
@@ -168,7 +251,9 @@ export function handleDeliveryGoods(formState: UnwrapRef<FormState>) {
             message.error(err)
         })
     }
+
     const numberUnit = ref<string>('')
+
     // 品类变更
     function WrStandardChange(value: number) {
         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);
     // 目前写死,获取枚举信息里面没有 单位名称,后期进行优化
     const payCurrencyUnit = ref<string>('元')
+
     // 切换币种
     function parCurrencyChange(value: number) {
         const obj = payCurrency.find(e => e.enumdicid === value)
@@ -207,13 +303,8 @@ export function handlePrice(formState: UnwrapRef<FormState>) {
 
         // 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 priceDate = ref<Moment[]>([]);
+
     function disabledDate(current: Moment) {
         // Can not select days before today and today
         return current && current < moment().endOf('day');
     }
+
     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 }
 }

+ 46 - 8
src/views/information/spot-contract/components/check/index.vue

@@ -10,7 +10,7 @@
      <template #footer>
        <a-button key="submit"
                 class="cancelBtn"
-                @click="cancel">审核拒绝</a-button>
+                @click="refuse">审核拒绝</a-button>
         <a-button key="submit"
                 type="primary"
                 :loading="loading"
@@ -226,6 +226,8 @@ import {
 } from "@/views/information/spot-contract/setup";
 import {Ermcp3ContractRsp} from "@/services/go/ermcp/spot-contract/interface";
 import {formatTime, formatValue} from "@/common/methods";
+import {changeOrderContract, OrderContractControl} from "@/views/information/spot-contract/components/setup";
+import {Modal} from "ant-design-vue";
 
 export default defineComponent({
     name: 'spot-contract-detail',
@@ -236,16 +238,51 @@ export default defineComponent({
             default: {},
         },
     },
-    setup() {
+    setup(props, context) {
         const { visible, cancel } = closeModal('spot_contract_btn_check');
-        const loading = ref<boolean>(false);
+        const  { loading, orderContractState } = changeOrderContract()
         const maskClosableFlag = ref<boolean>(false);
         function submit() {
-            loading.value = true;
-            setTimeout(() => {
-                loading.value = false;
-                cancel();
-            }, 2000);
+            Modal.confirm({
+                title: '是否确认审核通过',
+                okText: '确认审核通过',
+                cancelText: '取消',
+                onOk() {
+                    // 审核通过
+                    orderContractState(props.selectedRow.spotcontractid, 4)
+                        .then(res => {
+                            cancel()
+                            context.emit('refresh')
+                        })
+                        .catch(err => {
+
+                        })
+                },
+                onCancel() {
+                    console.log('Cancel');
+                },
+            });
+        }
+        function refuse(){
+            Modal.confirm({
+                title: '是否确认审核拒绝',
+                okText: '确认审核拒绝',
+                cancelText: '取消',
+                onOk() {
+                    // 审核拒绝
+                    OrderContractControl().orderContractState(props.selectedRow.spotcontractid, 4)
+                        .then(res => {
+                            cancel()
+                            context.emit('refresh')
+                        })
+                        .catch(err => {
+
+                        })
+                },
+                onCancel() {
+                    console.log('Cancel');
+                },
+            });
         }
         return {
             visible,
@@ -259,6 +296,7 @@ export default defineComponent({
             getContractStatusName,
             formatTime,
             getPriceTypeName,
+            refuse,
         };
     },
 });

+ 3 - 4
src/views/information/spot-contract/components/delete/index.vue

@@ -188,7 +188,7 @@ import {
     getPriceTypeName
 } from "@/views/information/spot-contract/setup";
 import {message, Modal} from "ant-design-vue";
-import {OrderContractControl} from "@/views/information/spot-contract/components/setup";
+import {changeOrderContract, OrderContractControl} from "@/views/information/spot-contract/components/setup";
 
 export default defineComponent({
     name: 'delete-spot-contract',
@@ -201,17 +201,16 @@ export default defineComponent({
     },
     setup(props, context) {
         const { visible, cancel } = closeModal('spot_contract_btn_delete');
-        const {loading, orderContractState} = OrderContractControl()
+        const  { loading, orderContractState } = changeOrderContract()
         const maskClosableFlag = ref<boolean>(false);
         function submit() {
-            loading.value = true;
             Modal.confirm({
                 title: '是否确认删除',
                 okText: '确认删除',
                 cancelText: '取消',
                 onOk() {
                     // 删除客户资料
-                    orderContractState(props.selectedRow.spotcontractid, 1)
+                    orderContractState(props.selectedRow.spotcontractid, 3)
                         .then(res => {
                             // 通知上层  刷新数据
                             context.emit('refresh');

+ 11 - 5
src/views/information/spot-contract/components/setup.ts

@@ -23,21 +23,26 @@ export function changeOrderContract() {
      * @param info 合同信息
      */
     function orderContractState(id: string, type: number, info?: GldSpotContractInfo): Promise<string> {
-        const reqs: GldErmcpSpotContractOperateReq = {
-            SpotContractID: Number(id),
+        loading.value = true
+        const reqs: GldErmcpSpotContractOperateReq = info === undefined ? {
+            SpotContractID: Long.fromString(id),
+            OperateType: type,
+            Remark: '',
+        } : {
+            SpotContractID: Long.fromString(id),
             OperateType: type,
             Remark: '',
             Info: info,
         }
-        const sign = getRequestResultInfo(GldContractStateSign, type)  // 接口请求后的返回提示 这里统一进行管理
 
+        const sign = getRequestResultInfo(GldContractStateSign, type)  // 接口请求后的返回提示 这里统一进行管理
         return orderContract(reqs)
             .then(res => {
                 message.success(sign[0])
                 return Promise.resolve(sign[0])
             })
             .catch(err => {
-                message.success(sign[1])
+                message.error(sign[1] + err)
                 return Promise.reject(sign[1] + err)
             }).finally(() => {
                 loading.value = false
@@ -68,7 +73,7 @@ export function OrderContractControl() {
                 return Promise.resolve(sign[0])
             })
             .catch(err => {
-                message.success(sign[1])
+                message.error(sign[1] + err)
                 return Promise.reject(sign[1] + err)
             }).finally(() => {
                 loading.value = false
@@ -77,3 +82,4 @@ export function OrderContractControl() {
 
     return { loading, orderContractState }
 }
+

+ 1 - 1
src/views/information/spot-contract/list/unsubmitted/index.vue

@@ -38,7 +38,7 @@
             </a-table>
         </contextMenu>
         <!-- 新增现货合同 -->
-        <AddSpotContract/>
+        <AddSpotContract  @refresh="queryTable"/>
         <!-- 现货合同: 详情 -->
         <SpotContractDeatil :selectedRow="selectedRow"
                             @refresh="queryTable"/>

+ 4 - 1
src/views/information/spot-contract/setup.ts

@@ -2,13 +2,16 @@
  * 现货合同状态返回
  * @param state
  * //合同状态 - number;
- //:未提交 1:待审核 2:执行中 3:正常完结 4:审核拒绝 5:异常完结 6:已撤回
+ //0:未提交 1:待审核 2:执行中 3:正常完结 4:审核拒绝 5:异常完结 6:已撤回
  */
 import {ResultInfo} from "@/common/methods/request/interface";
 
 export function getContractStatusName(state: number): string {
     let result = "--";
     switch (state) {
+        case 0:
+            result = "未提交";
+            break;
         case 1:
             result = "待审核";
             break