marymelisa 4 éve
szülő
commit
f2a8428420
52 módosított fájl, 2502 hozzáadás és 1149 törlés
  1. 74 1
      public/proto/mtp.proto
  2. 5 0
      src/common/constants/buttonType.ts
  3. 1 1
      src/common/methods/format/index.ts
  4. 3 4
      src/layout/components/header.vue
  5. 32 0
      src/services/bus/user.ts
  6. 1 1
      src/services/dataCenter/index.ts
  7. 8 4
      src/services/funcode/index.ts
  8. 19 14
      src/services/go/ermcp/exposure/index.ts
  9. 30 15
      src/services/go/ermcp/goodsInfo/index.ts
  10. 65 0
      src/services/go/ermcp/goodsInfo/interface.ts
  11. 1 2
      src/services/go/ermcp/sell/index.ts
  12. 3 2
      src/services/go/ermcp/spot-contract/index.ts
  13. 0 1
      src/services/go/ermcp/spot-contract/interface.ts
  14. 10 11
      src/services/go/useInfo/index.ts
  15. 13 5
      src/services/proto/contract/index.ts
  16. 3 8
      src/services/proto/contract/interface.ts
  17. 3 4
      src/services/proto/delivery/index.ts
  18. 0 3
      src/services/proto/delivery/interface.ts
  19. 60 9
      src/services/proto/spotcontract/index.ts
  20. 86 22
      src/services/proto/spotcontract/interface.ts
  21. 3 3
      src/services/proto/warehouse/index.ts
  22. 9 0
      src/services/request/serviceURL.ts
  23. 0 1
      src/services/socket/account/index.ts
  24. 9 0
      src/utils/time/index.ts
  25. 8 4
      src/views/information/goods/components/add/index.vue
  26. 36 7
      src/views/information/goods/components/add/setup.ts
  27. 9 9
      src/views/information/goods/components/disable/index.vue
  28. 2 3
      src/views/information/goods/components/leftMenu/index.vue
  29. 1 2
      src/views/information/goods/components/modify/index.vue
  30. 25 5
      src/views/information/goods/components/rightSpot/index.vue
  31. 9 10
      src/views/information/goods/list/spot-variety/index.vue
  32. 10 16
      src/views/information/goods/setup.ts
  33. 320 177
      src/views/information/spot-contract/components/add/index.vue
  34. 38 0
      src/views/information/spot-contract/components/add/interface.ts
  35. 224 0
      src/views/information/spot-contract/components/add/setup.ts
  36. 203 165
      src/views/information/spot-contract/components/cancel/index.vue
  37. 41 21
      src/views/information/spot-contract/components/check/index.vue
  38. 203 165
      src/views/information/spot-contract/components/delete/index.vue
  39. 12 4
      src/views/information/spot-contract/components/detail/index.vue
  40. 203 165
      src/views/information/spot-contract/components/finish/index.vue
  41. 3 0
      src/views/information/spot-contract/components/resubmit/index.vue
  42. 112 0
      src/views/information/spot-contract/components/setup.ts
  43. 75 37
      src/views/information/spot-contract/list/checkpending/index.vue
  44. 27 2
      src/views/information/spot-contract/list/finished/index.vue
  45. 28 3
      src/views/information/spot-contract/list/performance/index.vue
  46. 87 41
      src/views/information/spot-contract/list/unsubmitted/index.vue
  47. 39 1
      src/views/information/spot-contract/setup.ts
  48. 114 79
      src/views/information/warehouse-info/compoments/disable/index.vue
  49. 113 79
      src/views/information/warehouse-info/compoments/recover/index.vue
  50. 58 0
      src/views/information/warehouse-info/compoments/setup.ts
  51. 61 42
      src/views/information/warehouse-info/list/normal-use/index.vue
  52. 3 1
      src/views/information/warehouse-info/list/stop-use/index.vue

+ 74 - 1
public/proto/mtp.proto

@@ -725,6 +725,16 @@ message DeliveryGoodsApplyReq {
 	repeated GLDDGFactoryItemEx glddgfactoryItems = 12; // GLDDGFactoryItemEx 现货商品品牌数据
 	repeated WRSConvertDetailEx wrsconvertdetails = 13; // WRSConvertDetailEx 现货商品折算配置明细数据
 }
+
+// 现货品种申请响应 0 29 128
+message DeliveryGoodsApplyRsp {
+	optional MessageHead Header = 1; // MessageHead 消息头
+	optional int32 RetCode = 2; // int32 返回码
+	optional string RetDesc = 3; // string 描述信息
+	optional uint64 wrstandardid = 4; // uint64 现货商品ID
+	optional uint64 deliverygoodsid = 5; // uint64 现货品种ID
+}
+
 // 现货商品型号数据 0 29 172
 message GLDWRStandardEx {
 		optional uint64 wrstandardid = 1; // uint64 型号ID(修改时有值)
@@ -838,9 +848,10 @@ message GldSpotContractInfo {
 	optional double PricedAmount = 30; // double 已定价金额
 	optional uint64 SpotGoodsBrandID = 31; // uint64 现货品牌ID
 	optional string Remark = 32; // string 合同备注
-	optional uint64 SaleUserID = 33; // uint64 业务员ID
+	optional uint64 SaleUserID = 33; // uint64 业务员IDSpotContractOperateReq
 	optional uint64 AccountID = 34; // uint64 期货账户ID
 	optional uint32 BizType = 35; // uint32 业务类型 - 1:套保 2:套利
+	optional uint32 CurrencyID = 36; // uint32 结算币种ID
 }
 // 合同操作请求 0 29 170
 message ErmcpContractOperateApplyReq {
@@ -913,5 +924,67 @@ message UserInfoCheckMangeRsp {
 	optional uint64 userid = 4; // uint64 客户userid
 }
 
+// 现货合同操作请求 0 18 5
+message SpotContractOperateReq {
+	optional MessageHead Header = 1; // MessageHead
+	optional uint64 SpotContractID = 2; // uint64 现货合同ID(602+Unix秒时间戳(10位)+xxxxxx)
+	optional uint32 OperateType = 3; // uint32 操作类型-1:保存草稿2:提交申请3:审核通过4:审核拒绝5:撤回6:正常完结7:异常终止
+	optional uint32 OperateSrc = 4; // uint32 操作来源-1:管理端2:终端
+	optional uint64 UserID = 5; // uint64 操作用户ID
+	optional string Remark = 6; // string 操作备注
+	optional string ClientTicket = 7; // string 客户端流水号
+	optional SpotContractInfo Info = 8; // SpotContractInfo 现货合同信息
+}
+// 现货合同操作响应 0 18 6
+message SpotContractOperateRsp {
+	optional MessageHead Header = 1; // MessageHead 消息头
+	optional int32 RetCode = 2; // int32 返回码
+	optional string RetDesc = 3; // string 描述信息
+	optional uint64 SpotContractID = 4; // uint64 现货合同ID(602+Unix秒时间戳(10位)+xxxxxx)
+	optional uint32 OperateType = 5; // uint32 操作类型-1:保存草稿2:提交申请3:审核通过4:审核拒绝5:撤回6:正常完结7:异常终止
+	optional uint32 OperateSrc = 6; // uint32 操作来源-1:管理端2:终端
+	optional string ClientTicket = 7; // string 客户端流水号
+}
+
+// 现货合同信息 0 18 4
+message SpotContractInfo {
+	optional string ContractNo = 1; // string 现货合同编号
+	optional int32 ContractType = 2; // int32 现货合同类型-1:采购-1:销售
+	optional uint32 UserID = 3; // uint32 机构ID
+	optional uint32 BuyUserID = 4; // uint32 采购方ID
+	optional uint32 SellUserID = 5; // uint32 客户ID
+	optional string SignDate = 6; // string 签订日期
+	optional bytes ContractAttachment = 7; // bytes 合同附件
+	optional double ContractMargin = 8; // double 合同保证金
+	optional uint32 DeliveryGoodsID = 9; // uint32 现货品种ID
+	optional uint32 WrStandardID = 10; // uint32 现货商品ID
+	optional uint32 ProductType = 11; // uint32 产品类型-1:标准仓单2:等标3:非标
+	optional double ConvertFactor = 12; // double 标仓系数
+	optional string SpotGoodsDesc = 13; // string 商品型号
+	optional uint32 PriceType = 14; // uint32 定价类型-1:一口价2:点价3:暂定价
+	optional double Qty = 15; // double 数量
+	optional double Price = 16; // double 价格暂定价[1:一口价、3:暂定价]
+	optional double Amount = 17; // double 金额[1:一口价、3:暂定价]
+	optional string DeliveryStartDate = 18; // string 交收期(开始)
+	optional string DeliveryEndDate = 19; // string 交收期(结束)
+	optional uint32 GoodsID = 20; // uint32 点价合约ID-0:为现货,其它为期货商品合约ID[2:点价3:暂定价]
+	optional double PriceMove = 21; // double 升贴水[2:点价3:暂定价]
+	optional string StartDate = 22; // string 点价开始日期[2:点价3:暂定价]
+	optional string EndDate = 23; // string 点价结束日期[2:点价3:暂定价]
+	optional string PointDesc = 24; // string 点价备注[2:点价3:暂定价]
+	optional string DeliveryDesc = 25; // string 交收方式
+	optional uint32 MerUserID = 26; // uint32 跟单员ID
+	optional uint32 TradeUserID = 27; // uint32 交易员ID
+	optional double PricedQty = 28; // double 已定价量
+	optional double PricedAmount = 29; // double 已定价金额
+	optional uint32 SpotGoodsBrandID = 30; // uint32 现货品牌ID
+	optional string Remark = 31; // string 合同备注
+	optional uint32 SaleUserID = 32; // uint32 业务员ID
+	optional uint64 AccountID = 33; // uint64 期货账户ID
+	optional uint32 BizType = 34; // uint32 业务类型 - 1:套保 2:套利
+	optional uint64 WrFactorTypeID = 35; // uint64 仓单要素类型ID(212+Unix秒时间戳(10位)+xxxxxx)
+	optional uint32 CustomerUserID = 36; // uint32 客户ID
+	optional uint32 RelatedUserID = 37; // uint32 关联用户ID
+}
 
 

+ 5 - 0
src/common/constants/buttonType.ts

@@ -9,6 +9,11 @@ export interface ButtonType {
     custom_info_btn_cancel: string; // 客户资料 撤销
     custom_info_btn_check: string; // 客户资料 审核
 
+    goods_info_spot_normal_add: string; // 现货品种 新增
+    goods_info_spot_normal_modify: string; // 现货品种 修改
+    goods_info_spot_normal_disable: string; // 现货品种 停用
+    goods_info_spot_disable_recover: string; // 现货品种 恢复
+
     spot_contract_btn_add: string; // 现货合同 添加
     spot_contract_btn_resubmit: string; // 现货合同 重新提交
     spot_contract_btn_modify: string; // 现货合同 修改

+ 1 - 1
src/common/methods/format/index.ts

@@ -73,4 +73,4 @@ export function formatTime(value: string | Date, type: TIME) {
     }
     if (value) return moment(value).format(str);
     return value;
-}
+}

+ 3 - 4
src/layout/components/header.vue

@@ -5,7 +5,7 @@
   </div>
   <div class="m-layout-header-right">
     <div @click="openDrawer">
-      <span>{{ username }},您好!</span>
+      <span>{{ getUserName() }},您好!</span>
     </div>
     <div class="relative">
       <!-- <a-input-search ref="userNameInput"
@@ -46,10 +46,10 @@
 
 <script lang="ts">
 import { defineComponent, ref, provide } from 'vue';
-import APP from '@/services';
 import { openModal } from '@/common/setup/modal/index';
 import { UserOutlined } from '@ant-design/icons-vue';
 import Setting from '@/views/setting/index.vue';
+import { getUserName } from '@/services/bus/user';
 
 // 设置
 const setFn = () => {
@@ -94,11 +94,10 @@ export default defineComponent({
         },
     },
     setup() {
-        const username = APP.get('username');
         const { openAction: openNotice } = openModal('notice');
         return {
-            username,
             openNotice,
+            getUserName,
             ...setFn(),
             ...onSearch(),
         };

+ 32 - 0
src/services/bus/user.ts

@@ -0,0 +1,32 @@
+import APP from '@/services';
+
+/**
+ * 获取用户账户类型
+ * @returns 
+ */
+export function getUserAccountType() {
+    return APP.get('userAccount').usertype
+}
+
+/**
+ * 获取用户
+ */
+export function getUserInfo() {
+    return APP.get('userInfo')
+}
+
+/**
+ * 获取用户名
+ * @returns 
+ */
+export function getUserName() {
+    return getUserInfo().customername
+}
+
+/**
+ * 获取用户id 
+ * 登录中也写了一个 获取用户id的方法,那个方法是在登录信息里面获取用户id,这个方法是在go服务修改登录请求方法,返回用户信息,后期有时间进行优化
+ */
+export function getUsrId() {
+    return getUserInfo().userid
+}

+ 1 - 1
src/services/dataCenter/index.ts

@@ -12,7 +12,7 @@ const needClearSourceData: NeedClearSourceDataType = {
     loginAccount: new LoginaccountModel(),
     markets: [],
     systemParams: [], // 系统参数
-    userAccount: new userAccountModel(),
+    userAccount: new userAccountModel(), // 用户账号信息
     userInfo: new UserInfoModel(), // 用户信息
     username: '',
     menus: [],

+ 8 - 4
src/services/funcode/index.ts

@@ -71,15 +71,19 @@ export const funCode: Code = {
     // 仓库信息
     WareHouseApplyReq: 1900685,     /// 仓库申请请求
     WareHouseApplyRsp: 1900686,    /// 仓库申请响应
-    WareHouseStateChangeReq: 1900687,    /// 仓库状态修改请求
-    WareHouseStateChangeRsp: 1900688,    /// 仓库状态修改响应
+    WarehouseStateChangeReq: 1900687,    /// 仓库状态修改请求
+    WarehouseStateChangeRsp: 1900688,    /// 仓库状态修改响应
 
     // 现货合同 -- 新增现货合同
     GldErmcpSpotContractOperateReq: 1900711,    /// 现货合同操作请求(1179653)
     GldErmcpSpotContractOperateRsp: 1900712,    /// 现货合同操作响应(1179654)
 
-    ContractOperateApplyReq: 1179656, // 合同操作请求(1179656)
-    ContractOperateApplyRsp: 1179657, // 合同操作响应(1179657)
+    SpotContractOperateReq: 1179653, // 现货合同操作请求(1179653)
+    SpotContractOperateRsp: 1179654, // 现货合同操作响应(1179654)
+
+    // 业务 - 合同
+    ErmcpContractOperateApplyReq: 1900714, /// 合同操作请求(1179656)
+    ErmcpContractOperateApplyRsp: 1900715, /// 合同操作响应(1179657)
 
     // 套保计划 -- 新增套保计划
     ErmcpHedgePlanReq: 1900708,  /// 套保计划操作请求(1179650)

+ 19 - 14
src/services/go/ermcp/exposure/index.ts

@@ -1,6 +1,8 @@
 import APP from '@/services';
 import { commonSearch_go } from '@/services/go';
 import { Ermcp3AreaSpot, Ermcp3AreaSpotDetail, Ermcp3AreaSpotDetailReq, Ermcp3ExposureDetail, Ermcp3ExposureReq, ErmcpExposurePostion, ErmcpExposurePostionReq, ErmcpHedgePosition, ErmcpHedgePositionDetail, ErmcpHedgePositionDetailReq, ErmcpRealExposureModel } from '@/services/go/ermcp/exposure/interface';
+import {getUserId} from "@/services/bus/account";
+import {getUserAccountType} from "@/services/bus/user";
 
 /** ================================= 业务 - 敞口 ================================**/
 
@@ -9,8 +11,8 @@ import { Ermcp3AreaSpot, Ermcp3AreaSpotDetail, Ermcp3AreaSpotDetailReq, Ermcp3Ex
  * @constructor
  */
 export function QueryActualExposure(): Promise<ErmcpRealExposureModel[]> {
-    const AreaUserID = APP.get('userAccount').memberuserid; // 所属机构id
-    return commonSearch_go('/Ermcp/QueryRealtimeExposure', { AreaUserID }).catch((err) => {
+    const userid = getUserId(); // 所属机构id
+    return commonSearch_go('/Ermcp/QueryRealtimeExposure', { userid }).catch((err) => {
         throw new Error(`查询敞口 -> 实时敞口: ${err.message}`);
     });
 }
@@ -21,8 +23,9 @@ export function QueryActualExposure(): Promise<ErmcpRealExposureModel[]> {
  * @constructor
  */
 export function QueryActualExposureDetail(req: Ermcp3ExposureReq): Promise<Ermcp3ExposureDetail[]> {
-    const areauserid = APP.get('userAccount').memberuserid; // 所属机构id
-    return commonSearch_go('/Ermcp3/QueryExposureDetail', { areauserid, ...req }).catch((err) => {
+    const userid = getUserId(); // 用户id
+    const usertype = getUserAccountType();  // 用户类型 2-机构 7-企业成员
+    return commonSearch_go('/Ermcp3/QueryExposureDetail', { userid, usertype, ...req }).catch((err) => {
         throw new Error(`查询敞口 ->实时敞口 -> 现货明细: ${err.message}`);
     });
 }
@@ -33,8 +36,8 @@ export function QueryActualExposureDetail(req: Ermcp3ExposureReq): Promise<Ermcp
  * @constructor
  */
 export function QueryAutualExposurePosition(req: ErmcpExposurePostionReq): Promise<ErmcpExposurePostion[]> {
-    const areaUserId = APP.get('userAccount').memberuserid; // 所属机构id
-    return commonSearch_go('/Ermcp/QueryRealtimeExposurePosition', { areaUserId, ...req }).catch((err) => {
+    const userid = getUserId(); // 所属机构id
+    return commonSearch_go('/Ermcp/QueryRealtimeExposurePosition', { userid, ...req }).catch((err) => {
         throw new Error(`查询敞口 ->实时敞口 -> 期货明细: ${err.message}`);
     });
 }
@@ -44,8 +47,9 @@ export function QueryAutualExposurePosition(req: ErmcpExposurePostionReq): Promi
  * @constructor
  */
 export function QuerySpotPosition(): Promise<Ermcp3AreaSpot[]> {
-    const areauserid = APP.get('userAccount').memberuserid; // 所属机构id
-    return commonSearch_go('/Ermcp3/QueryExposureSpot', { areauserid }).catch((err) => {
+    const userid = getUserId(); // 用户id
+    const usertype = getUserAccountType();  // 用户类型 2-机构 7-企业成员
+    return commonSearch_go('/Ermcp3/QueryExposureSpot', { userid, usertype }).catch((err) => {
         throw new Error(`查询敞口 -> 现货头寸: ${err.message}`);
     });
 }
@@ -56,8 +60,9 @@ export function QuerySpotPosition(): Promise<Ermcp3AreaSpot[]> {
  * @constructor
  */
 export function QuerySpotPositionDetail(req: Ermcp3AreaSpotDetailReq): Promise<Ermcp3AreaSpotDetail[]> {
-    const areauserid = APP.get('userAccount').memberuserid; // 所属机构id
-    return commonSearch_go('/Ermcp3/QueryExposureSpotDetail', { areauserid, ...req }).catch((err) => {
+    const userid = getUserId(); // 用户id
+    const usertype = getUserAccountType();  // 用户类型 2-机构 7-企业成员
+    return commonSearch_go('/Ermcp3/QueryExposureSpotDetail', { userid, usertype, ...req }).catch((err) => {
         throw new Error(`查询敞口 -> 现货头寸 -> 现货明细: ${err.message}`);
     });
 }
@@ -67,8 +72,8 @@ export function QuerySpotPositionDetail(req: Ermcp3AreaSpotDetailReq): Promise<E
  * @constructor
  */
 export function QueryExposureHedgePosition(): Promise<ErmcpHedgePosition[]> {
-    const areaUserId = APP.get('userAccount').memberuserid; // 所属机构id
-    return commonSearch_go('/Ermcp/QueryExposureHedgePosition', { areaUserId }).catch((err) => {
+    const userid = getUserId(); // 所属机构id
+    return commonSearch_go('/Ermcp/QueryExposureHedgePosition', { userid }).catch((err) => {
         throw new Error(`查询敞口 -> 期货头寸: ${err.message}`);
     });
 }
@@ -79,8 +84,8 @@ export function QueryExposureHedgePosition(): Promise<ErmcpHedgePosition[]> {
  * @constructor
  */
 export function QueryExposureHedgePositionDetail(req: ErmcpHedgePositionDetailReq): Promise<ErmcpHedgePositionDetail[]> {
-    const areaUserId = APP.get('userAccount').memberuserid; // 所属机构id
-    return commonSearch_go('/Ermcp/QueryExposureHedgePositionDetail', { areaUserId, ...req }).catch((err) => {
+    const userid = getUserId(); // 所属机构id
+    return commonSearch_go('/Ermcp/QueryExposureHedgePositionDetail', { userid, ...req }).catch((err) => {
         throw new Error(`查询敞口->期货头寸->期货明细: ${err.message}`);
     });
 }

+ 30 - 15
src/services/go/ermcp/goodsInfo/index.ts

@@ -1,14 +1,14 @@
 /** ================================= 信息 - 现货商品信息 ================================**/
 
-import APP from '@/services';
 import { getUserId } from "@/services/bus/account";
+import { getUserAccountType } from "@/services/bus/user";
 import { commonSearch_go } from '@/services/go/index';
 import {
     Ermcp3Brand, Ermcp3GoodsGroup, Ermcp3MiddleGoodsDetailEx,
     Ermcp3Wrstandard,
     ErmcpDeliveryGoodsDetailEx,
     ErmcpDeliveryGoodsReq,
-    ErmcpDeliveryGoodsRsp, ErmcpMiddleGoodsModel
+    ErmcpDeliveryGoodsRsp, ErmcpMiddleGoodsModel, Goods
 } from './interface';
 
 /**
@@ -17,8 +17,9 @@ import {
  * @constructor
  */
 export function QueryDeliveryGoods(req: ErmcpDeliveryGoodsReq): Promise<ErmcpDeliveryGoodsRsp[]> {
-    const areauserid = APP.get('userAccount').memberuserid; // 所属机构id
-    return commonSearch_go('/Ermcp3/QueryDeliveryGoods', { areauserid, ...req }).catch((err) => {
+    const userid = getUserId(); // 所属机构id
+    const usertype = getUserAccountType();  //  用户类型 2-机构 7-企业成员
+    return commonSearch_go('/Ermcp3/QueryDeliveryGoods', { usertype, userid, ...req }).catch((err) => {
         throw new Error(`查询现货商品: ${err.message}`);
     });
 }
@@ -29,8 +30,9 @@ export function QueryDeliveryGoods(req: ErmcpDeliveryGoodsReq): Promise<ErmcpDel
  * @constructor
  */
 export function QueryGoodsWrstandard(deliverygoodsid: number): Promise<Ermcp3Wrstandard[]> {
-    const areauserid = APP.get('userAccount').memberuserid; // 所属机构id
-    return commonSearch_go('/Ermcp3/QueryGoodsWrstandard', { areauserid, deliverygoodsid }).catch((err) => {
+    const userid = getUserId(); // 所属机构id
+    const usertype = getUserAccountType(); //  用户类型 2-机构 7-企业成员
+    return commonSearch_go('/Ermcp3/QueryGoodsWrstandard', { userid, usertype, deliverygoodsid }).catch((err) => {
         throw new Error(`查询商品品类: ${err.message}`);
     });
 }
@@ -40,8 +42,9 @@ export function QueryGoodsWrstandard(deliverygoodsid: number): Promise<Ermcp3Wrs
  * @constructor
  */
 export function QueryGoodsbrand(): Promise<Ermcp3Brand[]> {
-    const areauserid = APP.get('userAccount').memberuserid; // 所属机构id
-    return commonSearch_go('/Ermcp3/QueryGoodsbrand', { areauserid }).catch((err) => {
+    const userid = getUserId(); // 用户id
+    const usertype = getUserAccountType();  // 用户类型 2-机构 7-企业成员
+    return commonSearch_go('/Ermcp3/QueryGoodsbrand', { userid, usertype }).catch((err) => {
         throw new Error(`查询商品品牌: ${err.message}`);
     });
 }
@@ -52,9 +55,8 @@ export function QueryGoodsbrand(): Promise<Ermcp3Brand[]> {
  * @constructor
  */
 export function QueryDeliveryGoodsDetail(deliverygoodsid?: number): Promise<ErmcpDeliveryGoodsDetailEx[]> {
-    const areauserid = APP.get('userAccount').memberuserid; // 所属机构id
-    const param = deliverygoodsid ? { areauserid, deliverygoodsid } : { areauserid }
-    return commonSearch_go('/Ermcp3/QueryDeliveryGoodsDetail', param).catch((err) => {
+    const req = deliverygoodsid ? { deliverygoodsid, userid: getUserId() } : { userid: getUserId() }
+    return commonSearch_go('/Ermcp3/QueryDeliveryGoodsDetail', req).catch((err) => {
         throw new Error(`查询现货商品详情: ${err.message}`);
     });
 }
@@ -65,8 +67,9 @@ export function QueryDeliveryGoodsDetail(deliverygoodsid?: number): Promise<Ermc
  * @constructor
  */
 export function QueryGoodsfGroup(excludecfg?: number): Promise<Ermcp3GoodsGroup[]> {
-    const areauserid = APP.get('userAccount').memberuserid; // 所属机构id
-    const param = excludecfg ? { areauserid, excludecfg } : { areauserid }
+    const userid = getUserId(); // 用户id
+    const usertype = getUserAccountType(); // 用户类型 2-机构 7-企业成员
+    const param = excludecfg ? { userid, excludecfg, usertype } : { userid, usertype }
     return commonSearch_go('/Ermcp3/QueryGoodsGroup', param).catch((err) => {
         throw new Error(`查询期货商品组: ${err.message}`);
     });
@@ -91,9 +94,21 @@ export function QueryMiddleGoods(status: number): Promise<ErmcpMiddleGoodsModel[
  * @constructor
  */
 export function QueryMiddleGoodsDetail(middlegoodsid: number): Promise<Ermcp3MiddleGoodsDetailEx[]> {
-    const areauserid = APP.get('userAccount').memberuserid; // 所属机构id
-    return commonSearch_go('/Ermcp3/QueryMiddleGoodsDetail', { areauserid, middlegoodsid }).catch((err) => {
+    const userid = getUserId(); // 用户id
+    const usertype = getUserAccountType()  // 用户类型 2-机构 7-企业成员
+    return commonSearch_go('/Ermcp3/QueryMiddleGoodsDetail', { userid, usertype, middlegoodsid }).catch((err) => {
         throw new Error(`查询套保品种详情(套保品种/商品详情): ${err.message}`);
     });
 }
 
+/**
+ * 查询企业风管期货商品信息 /Ermcp/GetErmcpGoods
+ * @param lastUpdateTime 最后修改时间 - 闭区间,格式:yyyy-MM-dd HH:mm:ss
+ * @constructor
+ */
+export function GetErmcpGoods(lastUpdateTime?: string): Promise<Goods[]> {
+    return commonSearch_go('/Ermcp3/QueryMiddleGoodsDetail', { lastUpdateTime }).catch((err) => {
+        throw new Error(`查询企业风管期货商品信息: ${err.message}`);
+    });
+}
+

+ 65 - 0
src/services/go/ermcp/goodsInfo/interface.ts

@@ -65,6 +65,15 @@ export interface Ermcp3Brand {
 }
 
 /**
+ * 查询现货商品请求
+ */
+export interface DeliveryGoodsDetailReq {
+    userid: number;            // 用户id
+    usertype?: number;         // 用户类型 2-机构 7-企业成员
+    deliverygoodsid?: number;  // 现货商品id
+}
+
+/**
  * 查询新货商品详情
  */
 export interface ErmcpDeliveryGoodsDetailEx {
@@ -229,6 +238,62 @@ export interface ErmcpDeliveryGoodsDetail2{
     gmlist: Ermcp3Wrstandard[] // 品类列表(仓单标准)
 }
 
+/**
+ * 期货商品信息
+ */
+export interface Goods{
+    agreeunit	:number;//合约单位
+    auditaccountid	:number;//审核操作员账号
+    audittime	:string;//审核时间
+    cancelaccountid	:number;//注销操作员账号
+    canceltime	:string;//注销时间
+    closepricemode	:number;//强平价格方式 - 1:市价 2:最新价 3:涨跌停(未实现)
+    closepriceparam	:number;//强平最新价浮动比例 - 方式为2时使用 (<1)买 上浮 (1+x)最新价卖 下浮 (1-x)最新价
+    createtime	:string;//创建时间
+    creatorid	:number;//创建人
+    currencyid	:number;//报价货币ID
+    cutmode	:number;//斩仓方式 - 1:不斩仓 2:自动斩仓 3:半自动斩仓
+    decimalplace	:number;//报价小数位
+    delistingdate	:string;//商品退市时间(状态:退市) – 已作废
+    delistingmode	:number;//退市方式 - 1:退市平仓 2:退市交收 3:不处理(仅期权\币币兑换)
+    deliveryflag	:number;//交割标志 - number;
+//:不可交割 1:可交割
+    forceclosemode	:number;//定期强平方式 - 1:无 2:每日 3:每周 4:每月[收益权]
+    forceclosevalue	:number;//定期强平参数 [收益权]
+    goodscode	:string;//商品代码(内部)
+    goodscurrencyid	:number;//合约货币ID
+    goodsgroupid	:number;//所属商品组ID
+    goodsid	:number;//商品ID(自增ID SEQ_GOODS)
+    goodsname	:string;//商品名称
+    goodsquotetype	:number;//合约报价类型: 1-直接报价 2-间接报价
+    goodsstatus	:number;//商品状态- 1:待审核 2:未上市 3:上市 4:已注销 5:审核拒绝 6:退市 7:待退市
+    goodstradetype	:number;//商品交易权限类型 - 1:可建可平 3:不可建可平
+    goodunitid	:number;//报价单位ID
+    hasquoter	:number;//是否有报价商 - number;
+//:无报价商 1:有报价商
+    hqprotecttime	:number;//行情保护时间(秒)
+    innerdealmode	:number;//内部成交方式[通道交易] - 1:净头寸 2:开平 3:平今
+    isbuylimited	:number;//是否限制建仓量 - number;
+//:不限制 1:限制
+    lasttradedate	:string;//最后交易日期(状态:待退市)
+    listingdate	:string;//交易开始日期
+    marketid	:number;//所属市场ID
+    modifierid	:number;//修改人
+    modifystatus	:number;//变更状态 - 1:未变更 2:变更中 3:待审核 4:已审核
+    modifytime	:string;//修改时间
+    outerdealmode	:number;//外部成交方式[通道交易]- 1:净头寸 2:开平 3:平今
+    outgoodscode	:string;//商品代码(外部)
+    qtydecimalplace	:number;//成交量小数位
+    quotegear	:number;//行情档位(1-1number;
+//)
+    quoteminunit	:number;//行情最小变动单位 [整数,报价小数位一起使用]
+    quoteshowtype	:number;//行情报价类型: 1:成交价 2:买卖中间价 3:含买价 4:含卖价做市模式固定为3:含买价
+    quoteshowtypeinterval	:number;//行情报价间隔时间(秒)(成交价时为number;
+//)
+    remark	:string;//备注
+}
+
+
 
 interface MenuItem {
     key: string;

+ 1 - 2
src/services/go/ermcp/sell/index.ts

@@ -14,8 +14,7 @@ import { Ermcp3SellBuyContract, SellBuyContractReq } from '@/services/go/ermcp/p
 export function QueryWareHouse(req: SellBuyContractReq): Promise<Ermcp3SellBuyContract[]> {
     const param = {
         userid: getUserId(),
-        areauserid: APP.get('userAccount').memberuserid, // 所属机构id
-        contracttype: -1, // 销售
+        contracttype: -1, // 销售 合同类型 1-采购, -1-销售
     }
     Object.assign(param, req)
     return commonSearch_go('/Ermcp3/QuerySpotContractBS', param).catch((err) => {

+ 3 - 2
src/services/go/ermcp/spot-contract/index.ts

@@ -2,6 +2,7 @@
 import APP from '@/services';
 import { commonSearch_go } from '@/services/go';
 import { Ermcp3ContractReq, Ermcp3ContractRsp } from '@/services/go/ermcp/spot-contract/interface';
+import {getUserId} from "@/services/bus/account";
 
 /**
  * 查询现货合同 /Ermcp3/QuerySpotContract
@@ -12,9 +13,9 @@ import { Ermcp3ContractReq, Ermcp3ContractRsp } from '@/services/go/ermcp/spot-c
  * @constructor
  */
 export function QuerySpotContract(req: Ermcp3ContractReq): Promise<Ermcp3ContractRsp[]> {
-    const areauserid = APP.get('userAccount').memberuserid; // 所属机构id
+    const userid = getUserId(); // 所属机构id
     // const areauserid = 10000; // 所属机构id
-    return commonSearch_go('/Ermcp3/QuerySpotContract', { areauserid, ...req }).catch((err) => {
+    return commonSearch_go('/Ermcp3/QuerySpotContract', { userid, ...req }).catch((err) => {
         throw new Error(`查询现货合同: ${err.message}`);
     });
 }

+ 0 - 1
src/services/go/ermcp/spot-contract/interface.ts

@@ -3,7 +3,6 @@
  */
 export interface Ermcp3ContractReq {
     querytype: number    //  查询类型 1-未提交 2-待审核 3-履约中 4-已完成
-    userid?: number    //  用户ID
     usertype?: number    //  用户类型 2-机构 7-企业成员
     contractid?: string  //  合同ID(SpotContractId)
 }

+ 10 - 11
src/services/go/useInfo/index.ts

@@ -1,7 +1,7 @@
-import { commonSearch_go } from '../index'
-import * as type from './interface'
 import APP from '@/services';
 import { getLongTypeLoginID } from '@/services/bus/login';
+import { commonSearch_go } from '../index';
+import * as type from './interface';
 
 /**
  * 获取登录ID
@@ -30,13 +30,13 @@ export function LoginQuery(): Promise<type.LoginQueryRsp> {
     const id = getLongTypeLoginID();
     return commonSearch_go('/User/LoginQuery', { loginID: Number(id) }).then(res => {
         const { externalExchanges,
-                goodsgroups,
-                loginAccount,
-                markets,
-                systemParams,
-                userAccount,
-                userInfo,
-                username }= res;
+            goodsgroups,
+            loginAccount,
+            markets,
+            systemParams,
+            userAccount,
+            userInfo,
+            username } = res;
         externalExchanges && APP.set('externalexchange', externalExchanges);
         goodsgroups && APP.set('goodsgroups', goodsgroups);
         loginAccount && APP.set('loginAccount', loginAccount);
@@ -46,7 +46,6 @@ export function LoginQuery(): Promise<type.LoginQueryRsp> {
         userInfo && APP.set('userInfo', userInfo);
         username && APP.set('username', username);
         console.log('LoginQuery', res);
-
         return res
     })
 }
@@ -56,6 +55,6 @@ export function LoginQuery(): Promise<type.LoginQueryRsp> {
  * @returns
  */
 export function QueryUserInfo(userID: number, isDecrypt?: boolean): Promise<type.Userinfo> {
-    const param = isDecrypt ? { isDecrypt, userID } : {userID }
+    const param = isDecrypt ? { isDecrypt, userID } : { userID }
     return commonSearch_go('/User/QueryUserInfo', param)
 }

+ 13 - 5
src/services/proto/contract/index.ts

@@ -2,19 +2,27 @@ import {buildProtoReq50, parseProtoRsp50} from "@/services/socket/protobuf/build
 import APP from "@/services";
 import {Callback} from "@/utils/websocket";
 import {ErmcpContractOperateApplyReq} from "@/services/proto/contract/interface";
+import {getSelectedAccountId, getUserId} from "@/services/bus/account";
+import {getUUID} from "@/utils/qt/common";
 
 /**
  * 合同
  * @param param
  */
 export const operationContractReq = (param: ErmcpContractOperateApplyReq): Promise<any> => {
+
+    const OperateSrc = 2;
+    const UserID = getUserId()
+    const ClientTicket = getUUID()
+    const OperateApplyID = getUUID()
+
     return new Promise((resolve, reject) => {
         const params = {
-            protobufName: 'ContractOperateApplyReq',
-            funCodeName: 'ContractOperateApplyReq',
-            reqParams:  param,
+            protobufName: 'ErmcpContractOperateApplyReq',
+            funCodeName: 'ErmcpContractOperateApplyReq',
+            reqParams:  { OperateApplyID, OperateSrc, UserID, ClientTicket, ...param },
             msgHeadParams: {
-                AccountID: param.accountid,
+                AccountID: getSelectedAccountId(),
                 MarketID: 18,
                 GoodsID: 0,
             }
@@ -22,7 +30,7 @@ export const operationContractReq = (param: ErmcpContractOperateApplyReq): Promi
         const package50 = buildProtoReq50(params);
         APP.sendTradingServer(package50, undefined, {
             onSuccess: (res) => {
-                const { isSuccess, result } = parseProtoRsp50(res, 'ContractOperateApplyRsp');
+                const { isSuccess, result } = parseProtoRsp50(res, 'ErmcpContractOperateApplyRsp');
                 if (isSuccess) {
                     resolve(result);
                 } else {

+ 3 - 8
src/services/proto/contract/interface.ts

@@ -1,13 +1,8 @@
 // 合同操作请求 0 29 170
 export interface ErmcpContractOperateApplyReq {
-    accountid: number
-    OperateApplyID: number // uint64 操作申请ID(603+Unix秒时间戳(10位)+xxxxxx)
     OperateType: number // uint32 操作类型-1:登记2:确认3:拒绝4:撤销
-    OperateSrc: number // uint32 操作来源-1:管理端2:终端
-    UserID: number // uint64 操作用户ID
-    Remark: string // string 备注
-    ClientTicket: string  // string 客户端流水号
-    Info : ErmcpContractOperateApplyInfo // ErmcpContractOperateApplyInfo 合同操作信息
+    Remark?: string // string 备注
+    Info: ErmcpContractOperateApplyInfo // ErmcpContractOperateApplyInfo 合同操作信息
 }
 // 合同操作响应 0 29 171
 export interface ErmcpContractOperateApplyRsp {
@@ -24,5 +19,5 @@ export interface ErmcpContractOperateApplyInfo {
     OperateApplyType: number // uint32 操作申请类型-1:点价2:结算3:款项4:发票
     RelatedID: number // uint64 现货合同ID(602+Unix秒时间戳(10位)+xxxxxx)
     DetailJson : Uint8Array // bytes 明细JSON
-    AttachUrl: Uint8Array // bytes 附件
+    AttachUrl?: Uint8Array // bytes 附件
 }

+ 3 - 4
src/services/proto/delivery/index.ts

@@ -13,16 +13,15 @@ export const addDeliveryGoodsApply = (param: DeliveryGoodsApplyReq): Promise<any
     return new Promise((resolve, reject) => {
         const req = {
             version: "3.2",
-            accountid: getSelectedAccountId(),
             userid: getUserId(),
-            loginid: getLongTypeLoginID(),
+            loginid: getLongTypeLoginID() ,
         };
         const params = {
             protobufName: 'DeliveryGoodsApplyReq',
             funCodeName: 'DeliveryGoodsApplyReq',
             reqParams: Object.assign(req, param),
             msgHeadParams: {
-                AccountID: getSelectedAccountId(),
+                AccountID: getSelectedAccountId() === null ? 0 : getSelectedAccountId(),
                 MarketID: 18,   // 目前写死
                 GoodsID: 0, // 目前写死
             }
@@ -30,7 +29,7 @@ export const addDeliveryGoodsApply = (param: DeliveryGoodsApplyReq): Promise<any
         const package50 = buildProtoReq50(params);
         APP.sendTradingServer(package50, undefined, {
             onSuccess: (res) => {
-                const { isSuccess, result } = parseProtoRsp50(res, 'DelUserReceiveInfoRsp');
+                const { isSuccess, result } = parseProtoRsp50(res, 'DeliveryGoodsApplyRsp');
                 if (isSuccess) {
                     resolve(result);
                 } else {

+ 0 - 3
src/services/proto/delivery/interface.ts

@@ -1,8 +1,5 @@
 // 现货品种申请请求 0 29 124
 export interface DeliveryGoodsApplyReq {
-    // accountid: string  // header 需要用到
-    // userid: number // uint64 用户ID
-    // loginid: number // uint64 登录ID
     deliverygoodscode?: string // string 交割商品代码(新增时有值)
     deliverygoodsname?: string // string 交割商品名称(新增时有值)
     deliverygoodsid?: number// uint64 交割商品id(修改时有值)

+ 60 - 9
src/services/proto/spotcontract/index.ts

@@ -1,21 +1,32 @@
-import {buildProtoReq50, parseProtoRsp50} from "@/services/socket/protobuf/buildReq";
 import APP from "@/services";
-import {Callback} from "@/utils/websocket";
-import {GldErmcpSpotContractOperateReq} from "@/services/proto/spotcontract/interface";
+import { getSelectedAccountId, getUserId } from "@/services/bus/account";
+import {GldErmcpSpotContractOperateReq, SpotContractOperateReq} from "@/services/proto/spotcontract/interface";
+import { buildProtoReq50, parseProtoRsp50 } from "@/services/socket/protobuf/buildReq";
+import { Callback } from "@/utils/websocket";
+import { v4 as uuidv4 } from 'uuid';
+import {getTimeValue} from "@/utils/time";
 
 /**(重点提醒 这里属于管理端接口,仅用于新增)以上来自android代码  回头需要确认
- * 获取新增采购合同报文
- * @param
- * @param param
+ * 新增 / 修改采购合同报文 (很多修改合同操作也在这)
+ * @param param 1:保存草稿2:提交申请3:删除4:审核通过
  */
 export const orderContract = (param: GldErmcpSpotContractOperateReq): Promise<any> => {
+
+    const OperateSrc = 2; // uint32 操作来源-1:管理端2:终端
+    const ClientTicket: string = uuidv4();  // 客户端流水号
+    const UserID: number = getUserId(); // 用户id
+
+    const reqParams = {
+        ...param, OperateSrc, ClientTicket, UserID
+    }
+
     return new Promise((resolve, reject) => {
         const params = {
             protobufName: 'GldErmcpSpotContractOperateReq',
             funCodeName: 'GldErmcpSpotContractOperateReq',
-            reqParams: param,
+            reqParams: reqParams,
             msgHeadParams: {
-                AccountID: param.accountid,
+                AccountID: getSelectedAccountId(),
                 MarketID: 18,
                 GoodsID: 0,
             }
@@ -33,4 +44,44 @@ export const orderContract = (param: GldErmcpSpotContractOperateReq): Promise<an
             onFail: (err) => reject(err.message),
         } as Callback);
     });
-}
+}
+
+/**
+ *现货合同操作请求
+ * @param param 2 操作类型-1:保存草稿2:提交申请3:审核通过4:审核拒绝5:撤回6:正常完结7:异常终止
+ */
+export const spotContractStatus = (param: SpotContractOperateReq): Promise<any> => {
+
+    const OperateSrc = 2; // uint32 操作来源-1:管理端2:终端
+    const ClientTicket: string = uuidv4();  // 客户端流水号
+    const UserID: number = getUserId(); // 用户id
+
+    const reqParams = {
+        ...param, OperateSrc, ClientTicket, UserID
+    }
+    debugger
+    return new Promise((resolve, reject) => {
+        const params = {
+            protobufName: 'SpotContractOperateReq',
+            funCodeName: 'SpotContractOperateReq',
+            reqParams: reqParams,
+            msgHeadParams: {
+                AccountID: getSelectedAccountId(),
+                MarketID: 18,
+                GoodsID: 0,
+            }
+        };
+        const package50 = buildProtoReq50(params);
+        APP.sendTradingServer(package50, undefined, {
+            onSuccess: (res) => {
+                const { isSuccess, result } = parseProtoRsp50(res, 'SpotContractOperateRsp');
+                if (isSuccess) {
+                    resolve(result);
+                } else {
+                    reject(result);
+                }
+            },
+            onFail: (err) => reject(err.message),
+        } as Callback);
+    });
+}

+ 86 - 22
src/services/proto/spotcontract/interface.ts

@@ -1,14 +1,19 @@
 // 现货合同操作请求 0 29 167
 export interface GldErmcpSpotContractOperateReq {
-    accountid: number  // header
     SpotContractID: number // uint64 现货合同ID(602+Unix秒时间戳(10位)+xxxxxx)
-    OperateType : number // uint32 操作类型-1:保存草稿2:提交申请3:审核通过4:审核拒绝5:撤回6:正常完结7:异常终止
-    OperateSrc : number // uint32 操作来源-1:管理端2:终端
-    UserID: number // uint64 操作用户ID
+    OperateType: number // uint32 操作类型-1:保存草稿2:提交申请3:审核通过4:审核拒绝5:撤回6:正常完结7:异常终止
     Remark: string // string 操作备注
-    ClientTicket: string // string 客户端流水号
-    Info: GldSpotContractInfo // GldSpotContractInfo 现货合同信息
+    Info?: GldSpotContractInfo // GldSpotContractInfo 现货合同信息
+}
+
+/**
+ * 修改现货合同状态
+ */
+export interface SpotContractStatusModifyReq {
+    SpotContractID: number // uint64 现货合同ID(602+Unix秒时间戳(10位)+xxxxxx)
+    OperateType: number // uint32 操作类型-1:保存草稿2:提交申请3:审核通过4:审核拒绝5:撤回6:正常完结7:异常终止
 }
+
 // 现货合同操作响应 0 29 168
 export interface GldErmcpSpotContractOperateRsp {
     RetCode: number // int32 返回码
@@ -24,22 +29,22 @@ export interface GldSpotContractInfo {
     TradeDate: string // string 交易日(yyyyMMdd)
     ContractNo: string // string 现货合同编号
     ContractType: number// int32 现货合同类型-1:采购-1:销售
-    UserID :number // uint64 机构ID
-    BuyUserID :number // uint64 采购方ID
-    SellUserID :number // uint64 客户ID
-    SignDate : string // string 签订日期
-    ContractAttachment : Uint8Array // bytes 合同附件
-    ContractMargin : number // double 合同保证金
-    DeliveryGoodsID : number  // uint64 现货品种ID
-    WrStandardID : number  // uint64 现货商品ID
-    ProductType : number  // uint32 产品类型-1:标准仓单2:等标3:非标
-    ConvertFactor : number  // double 标仓系数
-    SpotGoodsDesc : string // string 商品型号
-    PriceType : number // uint32 定价类型-1:一口价2:点价3:暂定价
-    Qty  : number // double 数量
-    Price : number// double 价格暂定价[1:一口价、3:暂定价]
-    Amount : number // double 金额[1:一口价、3:暂定价]
-    DeliveryStartDate : string// string 交收期(开始)
+    UserID: number // uint64 机构ID
+    BuyUserID: number // uint64 采购方ID
+    SellUserID: number // uint64 客户ID
+    SignDate: string // string 签订日期
+    ContractAttachment: Uint8Array // bytes 合同附件
+    ContractMargin: number // double 合同保证金
+    DeliveryGoodsID: number  // uint64 现货品种ID
+    WrStandardID: number  // uint64 现货商品ID
+    ProductType: number  // uint32 产品类型-1:标准仓单2:等标3:非标
+    ConvertFactor: number  // double 标仓系数
+    SpotGoodsDesc: string // string 商品型号
+    PriceType: number // uint32 定价类型-1:一口价2:点价3:暂定价
+    Qty: number // double 数量
+    Price: number// double 价格暂定价[1:一口价、3:暂定价]
+    Amount: number // double 金额[1:一口价、3:暂定价]
+    DeliveryStartDate: string// string 交收期(开始)
     DeliveryEndDate: string // string 交收期(结束)
     GoodsID: number // uint64 点价合约ID-0:为现货,其它为期货商品合约ID[2:点价3:暂定价]
     PriceMove: number// double 升贴水[2:点价3:暂定价]
@@ -56,4 +61,63 @@ export interface GldSpotContractInfo {
     SaleUserID: number // uint64 业务员ID
     AccountID: number // uint64 期货账户ID
     BizType: number // uint32 业务类型 - 1:套保 2:套利
+    CurrencyID: number // 结算币种ID
+}
+
+//现货合同操作请求  (一部分操作用这个借口)
+export interface SpotContractOperateReq {
+    SpotContractID: number; // 现货合同id
+    OperateType: number; // uint32 操作类型-1:保存草稿2:提交申请3:审核通过4:审核拒绝5:撤回6:正常完结7:异常终止
+    Remark: string; // string 操作备注
+    Info?: SpotContractInfo; // SpotContractInfo 现货合同信息
+}
+
+export interface SpotContractInfo {
+    ContractNo: string; // string 现货合同编号
+    ContractType: number; // int32 现货合同类型-1:采购-1:销售
+    UserID: number; // uint32 机构ID
+    BuyUserID: number; // uint32 采购方ID
+    SellUserID: number; // uint32 客户ID
+    SignDate: string; // string 签订日期
+    ContractAttachment: Uint8Array; // bytes 合同附件
+    ContractMargin: number; // double 合同保证金
+    DeliveryGoodsID: number; // uint32 现货品种ID
+    WrStandardID: number; // uint32 现货商品ID
+    ProductType: number; // uint32 产品类型-1:标准仓单2:等标3:非标
+    ConvertFactor: number; // double 标仓系数
+    SpotGoodsDesc: string; // string 商品型号
+    PriceType: number; // uint32 定价类型-1:一口价2:点价3:暂定价
+    Qty: number; // double 数量
+    Price: number; // double 价格暂定价[1:一口价、3:暂定价]
+    Amount: number; // double 金额[1:一口价、3:暂定价]
+    DeliveryStartDate: string; // string 交收期(开始)
+    DeliveryEndDate: string; // string 交收期(结束)
+    GoodsID: number; // uint32 点价合约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; // uint32 跟单员ID
+    TradeUserID : number; // uint32 交易员ID
+    PricedQty: number; // double 已定价量
+    PricedAmount: number; // double 已定价金额
+    SpotGoodsBrandID: number; // uint32 现货品牌ID
+    Remark: string; // string 合同备注
+    SaleUserID: number; // uint32 业务员ID
+    AccountID: number; // uint64 期货账户ID
+    BizType: number; // uint32 业务类型 - 1:套保 2:套利
+    WrFactorTypeID: number; // uint64 仓单要素类型ID(212+Unix秒时间戳(10位)+xxxxxx)
+    CustomerUserID: number; // uint32 客户ID
+    RelatedUserID: number; // uint32 关联用户ID
+}
+
+// 现货合同操作响应 0 18 6
+export interface SpotContractOperateRsp {
+    RetCode: number; // int32 返回码
+    RetDesc: string; // string 描述信息
+    SpotContractID: number; // uint64 现货合同ID(602+Unix秒时间戳(10位)+xxxxxx)
+    OperateType: number; // uint32 操作类型-1:保存草稿2:提交申请3:审核通过4:审核拒绝5:撤回6:正常完结7:异常终止
+    OperateSrc: number; // uint32 操作来源-1:管理端2:终端
+    ClientTicket: string; // string 客户端流水号
 }

+ 3 - 3
src/services/proto/warehouse/index.ts

@@ -45,8 +45,8 @@ export const addWarehouseApply = (param: WarehouseApplyReq): Promise<any> => {
 export const warehouseStateChangeReq = (param: WarehouseStateChangeReq): Promise<any> => {
     return new Promise((resolve, reject) => {
         const params = {
-            protobufName: 'WareHouseStateChangeReq',
-            funCodeName: 'WareHouseStateChangeReq',
+            protobufName: 'WarehouseStateChangeReq',
+            funCodeName: 'WarehouseStateChangeReq',
             reqParams: param,
             msgHeadParams: {
                 AccountID: param.accountid,
@@ -57,7 +57,7 @@ export const warehouseStateChangeReq = (param: WarehouseStateChangeReq): Promise
         const package50 = buildProtoReq50(params);
         APP.sendTradingServer(package50, undefined, {
             onSuccess: (res) => {
-                const { isSuccess, result } = parseProtoRsp50(res, 'WareHouseStateChangeRsp');
+                const { isSuccess, result } = parseProtoRsp50(res, 'WarehouseStateChangeRsp');
                 if (isSuccess) {
                     resolve(result);
                 } else {

+ 9 - 0
src/services/request/serviceURL.ts

@@ -73,6 +73,7 @@ export const commonSearchUrl = (url: string): string => {
 export const setServiceURL = (config: URL): void => {
     // console.log('URL', config);
     // 外网环境(175),外包同事使用
+<<<<<<< HEAD
     // if (process.env.NODE_ENV === 'development') {
     //     serviceURL.goCommonSearchUrl = 'http://218.17.158.45:21001/api';
     //     serviceURL.quoteUrl = 'ws://218.17.158.45:21004';
@@ -82,4 +83,12 @@ export const setServiceURL = (config: URL): void => {
     serviceURL.goCommonSearchUrl = 'http://218.17.158.45:21001/api';
     serviceURL.quoteUrl = 'ws://218.17.158.45:21004';
     serviceURL.tradeUrl = 'ws://218.17.158.45:21005';
+=======
+    if (process.env.NODE_ENV === 'development') {
+        serviceURL.goCommonSearchUrl = 'http://218.17.158.45:21001/api';
+        serviceURL.quoteUrl = 'ws://218.17.158.45:21004';
+        serviceURL.tradeUrl = 'ws://218.17.158.45:21005';
+    }
+    serviceURL = config;
+>>>>>>> 8342b930e1b0ec81127da97e63ddb4b1d8afa6d2
 };

+ 0 - 1
src/services/socket/account/index.ts

@@ -41,7 +41,6 @@ export const queryAccountInfo = (QueryItem: string | number): Promise<string> =>
                     const accountList = TAAccountList.map((el: any) => {
                         return el.TaAccountInfo;
                     });
-
                     // 数据中心存入资金账号列表
                     APP.set('accountList', accountList);
                     // 时间戳集合

+ 9 - 0
src/utils/time/index.ts

@@ -0,0 +1,9 @@
+import moment from "moment";
+
+/**
+ * 获取number类型时间戳
+ * @returns 
+ */
+export function getTimeValue(): number {
+    return moment().valueOf()
+}

+ 8 - 4
src/views/information/goods/components/add/index.vue

@@ -305,8 +305,8 @@
                           v-model:value="domain.middlegoodsid"
                           placeholder="请选择套保品种">
                   <a-select-option v-for="item in goodsGroup"
-                                   :value="item.groupcategroyid"
-                                   :key="item.groupcategroyid">
+                                   :value="item.goodsgroupid"
+                                   :key="item.goodsgroupid">
                     {{item.goodsgroupname}}
                   </a-select-option>
                 </a-select>
@@ -434,9 +434,9 @@ export default defineComponent({
         PlusOutlined,
         MinusOutlined,
     },
-    setup() {
+    setup(props, context) {
         // 控制关闭弹窗
-        const { visible, cancel } = closeModal('spot_contract_btn_add');
+        const { visible, cancel } = closeModal('goods_info_spot_normal_add');
         // 下单方法
         const { loading, addAction } = handleAdd();
         // 单位列表
@@ -525,6 +525,10 @@ export default defineComponent({
                 .validate()
                 .then(() => {
                     const param = toRaw(formState);
+                    addAction(param).then(() => {
+                        cancel();
+                        context.emit('refresh', true);
+                    });
                     console.log('param', param);
                 })
                 .catch((error: ValidateErrorEntity<FormState>) => {

+ 36 - 7
src/views/information/goods/components/add/setup.ts

@@ -13,13 +13,42 @@ import { FormState } from './interface';
  */
 export function handleAdd() {
     const loading = ref<boolean>(false);
-    function addAction(param: DeliveryGoodsApplyReq) {
+    function addAction(param: FormState): Promise<void> {
+        const unitid = param.unitid === undefined ? 0 : param.unitid
+        const reqParam: DeliveryGoodsApplyReq = {
+            deliverygoodscode: param.deliverygoodscode,
+            deliverygoodsname: param.deliverygoodsname,
+            deliverygoodsid: param.deliverygoodsid,
+            unitid: unitid,
+            type: 1,
+            remark: param.remark,
+            gldwrstandards: param.gldwrstandards.map(value => {
+                const gldunitid = value.unitid === undefined ? 0 : value.unitid
+                const convertfactors: any = value.convertfactor === null ? 0 : value.convertfactor
+                return {
+                    wrstandardid: value.wrstandardid,
+                    wrstandardname: value.wrstandardname,
+                    unitid: gldunitid,
+                    convertfactor: (convertfactors as string) ? Number(convertfactors) : convertfactors
+                }
+            }),
+            glddgfactoryItems: param.glddgfactoryItems,
+            wrsconvertdetails: param.wrsconvertdetails.map(value => {
+                const middlegoodsid = value.middlegoodsid === undefined ? 0 : value.middlegoodsid
+                const convertratio: any = value.convertratio === null ? 0 : value.convertratio
+                const wrsunitid = value.unitid === null ? 0 : value.unitid
+                return {
+                    middlegoodsid: middlegoodsid,
+                    convertratio: (convertratio as string) ? Number(convertratio) : convertratio,
+                    unitid: wrsunitid
+                }
+            })
+        }
         loading.value = true;
-        addDeliveryGoodsApply(param).then(() => {
+        return addDeliveryGoodsApply(reqParam).then(() => {
             message.success('新增现货品种成功!')
-        }).catch(err => {
-            message.error(err.message)
-        }).finally(() => loading.value = false)
+            Promise.resolve()
+        }).catch(err => message.error(err.message)).finally(() => loading.value = false)
     }
     return { loading, addAction }
 }
@@ -31,7 +60,7 @@ export function handleAdd() {
 export function handleFromState() {
     const formState: UnwrapRef<FormState> = reactive({
         deliverygoodscode: '', // string 交割商品代码(新增时有值)
-        deliverygoodsname: '', // string 交割商品名称(新增时有值)
+        deliverygoodsname: '', // string 交割商品名称(新增时有值) // 可能没值  有值不能为中文
         deliverygoodsid: 0,// uint64 交割商品id(修改时有值)
         unitid: undefined, // uint64 单位ID
         type: 1,// int32 类型 1 新增 2 修改
@@ -96,4 +125,4 @@ export function handleGoodsGroup() {
 export function getGoodsUnit(unit: number): string {
     const obj = getItemEnum('goodsunit').find(e => e.enumitemname === unit);
     return obj ? obj.enumdicname : '--'
-}
+}

+ 9 - 9
src/views/information/goods/components/disable/index.vue

@@ -110,13 +110,13 @@
 </template>
 
 <script lang="ts">
-import {defineComponent, PropType, ref} from 'vue';
+import { defineComponent, PropType, ref } from 'vue';
 import { closeModal } from '@/common/setup/modal/index';
-import {updateUserAccount} from "@/views/information/custom/compoments/setup";
-import {QueryCustomInfoType} from "@/services/go/ermcp/customInfo/interface";
-import {formatValue} from "@/common/methods";
-import {getStatusName} from "@/views/information/custom/setup";
-import {Modal} from "ant-design-vue";
+import { updateUserAccount } from '@/views/information/custom/compoments/setup';
+import { QueryCustomInfoType } from '@/services/go/ermcp/customInfo/interface';
+import { formatValue } from '@/common/methods';
+import { getStatusName } from '@/views/information/custom/setup';
+import { Modal } from 'ant-design-vue';
 
 export default defineComponent({
     name: 'custom-disable',
@@ -128,16 +128,16 @@ export default defineComponent({
         },
     },
     setup(props) {
-        const { visible, cancel } = closeModal('custom_info_btn_disable');
+        const { visible, cancel } = closeModal('goods_info_spot_normal_disable');
         const maskClosableFlag = ref<boolean>(false);
-        const  {loading, ModifyUserInfo} = updateUserAccount();
+        const { loading, ModifyUserInfo } = updateUserAccount();
         function submit() {
             Modal.confirm({
                 title: '是否确认停用客户资料',
                 okText: '确认停用',
                 cancelText: '取消',
                 onOk() {
-                    ModifyUserInfo(props.selectedRow.userid, 6, cancel);
+                    ModifyUserInfo(props.selectedRow.userid, 6);
                 },
                 onCancel() {
                     console.log('Cancel');

+ 2 - 3
src/views/information/goods/components/leftMenu/index.vue

@@ -35,9 +35,8 @@ const handleMenu = (context: SetupContext) => {
     const openKeys = ref<string[]>(['1']);
 
     function menuClick(value: any) {
-        console.log('value', value);
-
-        context.emit('chooseMenu', value.key);
+        const is = value.keyPath.includes('goods_info_spot_normal') ? true : false;
+        context.emit('chooseMenu', { key: value.key, is });
     }
     return { collapsed, selectedKeys, openKeys, menuClick };
 };

+ 1 - 2
src/views/information/goods/components/modify/index.vue

@@ -201,8 +201,7 @@ export default defineComponent({
         // }
     },
     setup() {
-        // const { visible, cancel } = closeModal('modifyCustomInfo');
-        const { visible, cancel } = closeModal('custom_info_btn_modify');
+        const { visible, cancel } = closeModal('goods_info_spot_normal_modify');
 
         const loading = ref<boolean>(false);
         const maskClosableFlag = ref<boolean>(false);

+ 25 - 5
src/views/information/goods/components/rightSpot/index.vue

@@ -12,8 +12,15 @@
         <span class="green ml10">{{selctedDeliveryGoods.data.dgstatus ? '正常' : '停用'}}</span>
       </div>
       <div class="tltBtns">
-        <a-button class="blueBtn">修改</a-button>
-        <a-button class="redBtn">停用</a-button>
+        <template v-if="isNormal">
+          <a-button class="blueBtn"
+                    @click="modifyAction">修改</a-button>
+          <a-button class="redBtn"
+                    @click="disableAction">停用</a-button>
+        </template>
+        <template>
+          <a-button class="blueBtn">恢复</a-button>
+        </template>
       </div>
     </div>
     <div class="spotCont">
@@ -108,6 +115,8 @@
         </a-collapse-panel>
       </a-collapse>
     </div>
+    <Modify />
+    <Disable />
   </div>
 </template>
 
@@ -115,8 +124,10 @@
 import { defineComponent, ref, PropType } from 'vue';
 import { handleDG, getGoodsUnit } from '../../setup';
 import { ErmcpDeliveryGoodsDetailEx } from '@/services/go/ermcp/goodsInfo/interface';
-import APP from '@/services';
 import { initData } from '@/common/methods';
+import { openModal } from '@/common/setup/modal/index';
+import Modify from '../modify/index.vue';
+import Disable from '../disable/index.vue';
 
 export default defineComponent({
     name: 'rightSpot',
@@ -125,11 +136,20 @@ export default defineComponent({
             default: handleDG,
             type: Object as PropType<ErmcpDeliveryGoodsDetailEx>,
         },
+        isNormal: {
+            default: true,
+            type: Boolean,
+        },
+    },
+    components: {
+        Modify,
+        Disable,
     },
-    components: {},
     setup(props, context) {
+        const { openAction: modifyAction } = openModal('goods_info_spot_normal_modify');
+        const { openAction: disableAction } = openModal('goods_info_spot_normal_disable');
         initData(() => {});
-        return { getGoodsUnit };
+        return { getGoodsUnit, modifyAction, disableAction };
     },
 });
 </script>

+ 9 - 10
src/views/information/goods/list/spot-variety/index.vue

@@ -4,6 +4,7 @@
        :loading="loading">
     <filterCustomTable @search="search">
       <a-button class="operBtn"
+                v-if="isNormal"
                 @click="addAction">新增</a-button>
     </filterCustomTable>
     <div class="spotTableCont">
@@ -12,25 +13,24 @@
                   @chooseMenu="chooseDG"></leftMenu>
       </div>
       <div class="rightCont">
-        <rightSpot :selctedDeliveryGoods="selctedDeliveryGoods"></rightSpot>
+        <rightSpot :selctedDeliveryGoods="selctedDeliveryGoods"
+                   :isNormal="isNormal"></rightSpot>
       </div>
     </div>
     <!-- 新增商品 -->
-    <AddGoods />
+    <AddGoods @refresh="queryDG" />
   </div>
 </template>
 
 <script lang="ts">
-import { defineComponent, ref } from 'vue';
-
+import { defineComponent } from 'vue';
 import filterCustomTable from '@/views/information/goods/components/filterTable/index.vue';
 import leftMenu from '@/views/information/goods/components/leftMenu/index.vue';
 import rightSpot from '@/views/information/goods/components/rightSpot/index.vue';
 import { openModal } from '@/common/setup/modal/index';
 import { initData } from '@/common/methods/index';
 import AddGoods from '@/views/information/goods/components/add/index.vue';
-import { handleDG, handleGDStatue } from '../../setup';
-import { getThirdMenuData } from '@/common/setup/table/button';
+import { handleDG } from '../../setup';
 
 export default defineComponent({
     name: 'spot-variety',
@@ -42,15 +42,14 @@ export default defineComponent({
     },
     setup() {
         // 控制弹窗
-        const { openAction: addAction } = openModal('spot_contract_btn_add');
-        const { loading, selctedDeliveryGoods, chooseDG, menuList, queryDG } = handleDG();
-        const { isNormal, changeStatue } = handleGDStatue();
+        const { openAction: addAction } = openModal('goods_info_spot_normal_add');
+        const { loading, selctedDeliveryGoods, chooseDG, isNormal, menuList, queryDG } = handleDG();
 
         initData(() => {
             // 加载数据在这里
             queryDG();
         });
-        return { addAction, loading, selctedDeliveryGoods, chooseDG, menuList };
+        return { addAction, loading, selctedDeliveryGoods, chooseDG, isNormal, menuList };
     },
 });
 </script>

+ 10 - 16
src/views/information/goods/setup.ts

@@ -81,6 +81,7 @@ export function handleDG() {
     const deliveryGoodsList = ref<ErmcpDeliveryGoodsDetailEx[]>([])
     // 选中的具体某一天现货品种数据
     const selctedDeliveryGoods = reactive<ErmcpDeliveryGoodsDetailEx>(initDG())
+    const isNormal = ref<boolean>(true) // true => 正常; false => 停用
     // const menuList = ref<MenuList[]>(initMenu());
     // 获取现货品种数据
     function queryDG(param?: number) {
@@ -107,23 +108,28 @@ export function handleDG() {
             })
             // 获取默认第一条数据
             if (menuList.value[0].children?.length) {
-                chooseDG(menuList.value[0].children[0].key)
+                chooseDG({ key: menuList.value[0].children[0].key, is: true })
             } else if (menuList.value[1].children?.length) {
-                chooseDG(menuList.value[1].children[0].key)
+                chooseDG({ key: menuList.value[1].children[0].key, is: false })
             }
         }).catch(err => {
             message.error(err)
         }).finally(() => loading.value = false)
     }
+    interface Value {
+        key: string;
+        is: boolean;
+    }
     // 选择某条现货数据
-    function chooseDG(key: string) {
+    function chooseDG({ key, is }: Value) {
+        isNormal.value = is
         const obj = deliveryGoodsList.value.find(e => e.data.deliverygoodsid === Number(key))
         if (obj) {
             mergeObj(selctedDeliveryGoods, obj)
             console.log('selctedDeliveryGoods', selctedDeliveryGoods);
         }
     }
-    return { loading, deliveryGoodsList, menuList, queryDG, selctedDeliveryGoods, chooseDG }
+    return { loading, deliveryGoodsList, menuList, queryDG, isNormal, selctedDeliveryGoods, chooseDG }
 }
 
 /**
@@ -141,15 +147,3 @@ export function getGoodsUnit(unit: number) {
 export function getGoodsUnitList() {
     return getItemEnum('goodsunit')
 }
-
-/**
- * 处理现货品种的状态
- * @returns 
- */
-export function handleGDStatue() {
-    const isNormal = ref<boolean>(true) // true => 正常; false => 停用
-    function changeStatue(value: boolean) {
-        isNormal.value = value;
-    }
-    return { isNormal, changeStatue }
-}

+ 320 - 177
src/views/information/spot-contract/components/add/index.vue

@@ -16,77 +16,111 @@
                 :loading="loading"
                 @click="submit">提交审核</a-button>
     </template>
-    <a-form class="inlineForm">
+    <a-form class="inlineForm"
+            ref="formRef"
+            :model="formState"
+            :rules="rules">
       <fieldset class="formFieldSet">
         <legend>基本信息</legend>
         <a-row :gutter="24">
           <a-col :span="12">
-            <a-form-item label="合同编号">
+            <a-form-item label="合同编号"
+                         name="ContractNo">
               <a-input class="dialogInput"
-                      style="width: 200px"
-                      placeholder="请输入合同编号" />
+                       style="width: 200px"
+                       v-model:value="formState.ContractNo"
+                       placeholder="请输入合同编号" />
             </a-form-item>
           </a-col>
           <a-col :span="12">
-            <a-form-item label="合同类型">
+            <a-form-item label="合同类型"
+                         name="ContractType">
               <a-select class="inlineFormSelect"
                         style="width: 200px"
+                        @change="contractChange"
+                        v-model:value="formState.ContractType"
                         placeholder="请选择合同类型">
-                <a-select-option value="1">
-                  客户一
-                </a-select-option>
-                <a-select-option value="2">
-                  客户二
+                <a-select-option v-for="item in contractType"
+                                 :key="item.key"
+                                 :value="item.key">
+                  {{item.value}}
                 </a-select-option>
               </a-select>
             </a-form-item>
           </a-col>
-        </a-row>
-        <a-row :gutter="24">
           <a-col :span="12">
-            <a-form-item label="业务类型">
+            <a-form-item label="业务类型"
+                         name="BizType">
               <a-select class="inlineFormSelect"
                         style="width: 200px"
+                        v-model:value="formState.BizType"
                         placeholder="请选择业务类型">
-                <a-select-option value="1">
-                  客户一
-                </a-select-option>
-                <a-select-option value="2">
-                  客户二
+                <a-select-option v-for="item in businessType"
+                                 :key="item.key"
+                                 :value="item.key">
+                  {{item.value}}
                 </a-select-option>
               </a-select>
             </a-form-item>
           </a-col>
+          <template v-if="isSell">
+            <a-col :span="12">
+              <a-form-item label="采购方"
+                           name="BuyUserID">
+                <a-select class="inlineFormSelect"
+                          style="width: 200px"
+                          v-model:value="formState.BuyUserID"
+                          placeholder="请选择客户">
+                  <!-- 客户资料列表 正常 -->
+                  <a-select-option :value="i"
+                                   v-for="(item, i) in customList"
+                                   :key="item.userid">
+                    {{item.customername}}
+                  </a-select-option>
+                </a-select>
+              </a-form-item>
+            </a-col>
+            <a-col :span="12">
+              <a-form-item label="销售方"
+                           name="SellUserID">
+                <span class="white">{{getUserName()}}</span>
+              </a-form-item>
+            </a-col>
+          </template>
+          <template v-else>
+            <a-col :span="12">
+              <a-form-item label="采购方"
+                           name="BuyUserID">
+                <span class="white">{{getUserName()}}</span>
+              </a-form-item>
+            </a-col>
+            <a-col :span="12">
+              <a-form-item label="销售方"
+                           name="SellUserID">
+                <a-select class="inlineFormSelect"
+                          v-model:value="formState.SellUserID"
+                          style="width: 200px"
+                          placeholder="请选择客户">
+                  <!-- 客户资料列表 正常 -->
+                  <a-select-option :value="i"
+                                   v-for="(item, i) in customList"
+                                   :key="item.userid">
+                    {{item.customername}}
+                  </a-select-option>
+                </a-select>
+              </a-form-item>
+            </a-col>
+          </template>
           <a-col :span="12">
-            <a-form-item label="采购方">
-                <span class="white">河北石家庄刚强矿石公司</span>
-            </a-form-item>
-          </a-col>
-      </a-row>
-      <a-row :gutter="24">
-          <a-col :span="12">
-            <a-form-item label="销售方">
-              <a-select class="inlineFormSelect"
-                        style="width: 200px"
-                        placeholder="请选择销售方">
-                <a-select-option value="1">
-                  客户一
-                </a-select-option>
-                <a-select-option value="2">
-                  客户二
-                </a-select-option>
-              </a-select>
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-item label="合同附件">
-                <div class="upload">
-                    <a-upload action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
-                                :transform-file="transformFile">
-                        <a-button class="uploadBtn">上传</a-button>
-                    </a-upload>
-                    <div class="look">查看附件</div>
-                </div>
+            <a-form-item label="合同附件"
+                         name="ContractAttachment">
+              <div class="upload">
+                <a-upload action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
+                          :transform-file="transformFile">
+                  <a-button class="uploadBtn">上传</a-button>
+                </a-upload>
+                <div class="look">查看附件</div>
+              </div>
             </a-form-item>
           </a-col>
         </a-row>
@@ -95,61 +129,69 @@
         <legend>现货信息</legend>
         <a-row :gutter="24">
           <a-col :span="12">
-            <a-form-item label="现货品种">
+            <a-form-item label="现货品种"
+                         name="DeliveryGoodsID">
               <a-select class="inlineFormSelect"
                         style="width: 200px"
+                        @change="deliveryGoodsChange"
+                        v-model:value="formState.DeliveryGoodsID"
                         placeholder="请选择现货品种">
-                <a-select-option value="1">
-                  客户一
-                </a-select-option>
-                <a-select-option value="2">
-                  客户二
+                <a-select-option v-for="item in deliveryGoodsList"
+                                 :key="item.deliverygoodsid"
+                                 :value="item.deliverygoodsid">
+                  {{item.deliverygoodsname}}
                 </a-select-option>
               </a-select>
             </a-form-item>
           </a-col>
           <a-col :span="12">
-            <a-form-item label="品类">
+            <a-form-item label="品类"
+                         name="WrStandardID">
               <a-select class="inlineFormSelect"
                         style="width: 200px"
+                        @change="WrStandardChange"
+                        v-model:value="formState.WrStandardID"
                         placeholder="请选择品类">
-                <a-select-option value="1">
-                  客户一
-                </a-select-option>
-                <a-select-option value="2">
-                  客户二
+                <a-select-option v-for="item in gmlist"
+                                 :key="item.wrstandardid"
+                                 :value="item.wrstandardid">
+                  {{item.wrstandardname}}
                 </a-select-option>
               </a-select>
             </a-form-item>
           </a-col>
-        </a-row>
-        <a-row :gutter="24">
           <a-col :span="12">
-            <a-form-item label="品牌">
+            <a-form-item label="品牌"
+                         name="SpotGoodsBrandID">
               <a-select class="inlineFormSelect"
                         style="width: 200px"
+                        v-model:value="formState.SpotGoodsBrandID"
                         placeholder="请选择品牌">
-                <a-select-option value="1">
-                  客户一
-                </a-select-option>
-                <a-select-option value="2">
-                  客户二
+                <a-select-option v-for="item in gblist"
+                                 :key="item.brandid"
+                                 :value="item.brandid">
+                  {{item.brandname}}
                 </a-select-option>
               </a-select>
             </a-form-item>
           </a-col>
           <a-col :span="12">
-            <a-form-item label="标仓系数">
-                <span class="white">输入数量和价格后自动算</span>
+            <a-form-item label="标仓系数"
+                         name="ConvertFactor">
+              <a-input class="dialogInput"
+                       style="width: 200px"
+                       v-model:value="formState.ConvertFactor"
+                       readonly
+                       placeholder="选择品类后自动填入" />
             </a-form-item>
           </a-col>
-      </a-row>
-      <a-row :gutter="24">
           <a-col :span="24">
-            <a-form-item label="商品规格">
+            <a-form-item label="商品规格"
+                         name="SpotGoodsDesc">
               <a-input class="dialogInput"
-                      style="width: 200px"
-                      placeholder="请输入商品规格" />
+                       style="width: 200px"
+                       v-model:value="formState.SpotGoodsDesc"
+                       placeholder="请输入商品规格" />
             </a-form-item>
           </a-col>
         </a-row>
@@ -158,121 +200,161 @@
         <legend>价格信息</legend>
         <a-row :gutter="24">
           <a-col :span="12">
-            <a-form-item label="定价类型">
+            <a-form-item label="定价类型"
+                         name="PriceType">
               <a-select class="inlineFormSelect"
                         style="width: 200px"
+                        v-model:value="formState.PriceType"
                         placeholder="请选择定价类型">
-                <a-select-option value="1">
-                  点价
-                </a-select-option>
-                <a-select-option value="2">
-                  一口价
+                <a-select-option v-for="item in priceType"
+                                 :key="item.key"
+                                 :value="item.key">
+                  {{item.value}}
                 </a-select-option>
               </a-select>
             </a-form-item>
           </a-col>
           <a-col :span="12">
-            <a-form-item label="数量">
-              <a-input class="dialogInput suffixGrey" placeholder="请输入数量" suffix="单位" />
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <!-- 以下是点价的价格信息 start -->
-        <!-- <a-row :gutter="24">
-          <a-col :span="12">
-            <a-form-item label="点价合约">
+            <a-form-item label="结算币种"
+                         name="CurrencyID">
               <a-select class="inlineFormSelect"
+                        v-model:value="formState.CurrencyID"
                         style="width: 200px"
-                        placeholder="请选择点价合约">
-                <a-select-option value="1">
-                  合约一
-                </a-select-option>
-                <a-select-option value="2">
-                  合约二
+                        placeholder="请选择结算币种">
+                <a-select-option v-for="item in payCurrency"
+                                 :key="item.enumdicid"
+                                 :value="item.enumdicname">
+                  {{item.enumdicname}}
                 </a-select-option>
               </a-select>
             </a-form-item>
           </a-col>
           <a-col :span="12">
-            <a-form-item label="升贴水">
-              <a-input class="dialogInput suffixGrey" placeholder="请输入升贴水" suffix="元/单位" style="width: 200px"/>
+            <a-form-item label="数量"
+                         name="Qty">
+              <a-input class="dialogInput suffixGrey"
+                       v-model:value="formState.Qty"
+                       placeholder="请输入数量"
+                       :suffix="numberUnit" />
             </a-form-item>
           </a-col>
-        </a-row>
-        <a-row :gutter="24">
-          <a-col :span="12">
-            <a-form-item label="点价期">
-              <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>
-          <a-col :span="12">
-            <a-form-item label="交收期">
-              <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>
-        </a-row> -->
-        <!-- 以上是点价的价格信息 end -->
-        <a-row :gutter="24">
-          <a-col :span="12">
-            <a-form-item label="价格">
-              <a-input class="dialogInput suffixGrey" placeholder="请输入价格" suffix="元/单位" style="width: 200px"/>
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-item label="金额" class="relative">
-                <span class="white">输入数量和价格后自动算</span>
-                <span class="unit">元</span>
-            </a-form-item>
-          </a-col>
-      </a-row>
-      <a-row :gutter="24">
-          <a-col :span="24">
-            <a-form-item label="交收期">
-              <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-col :span="12"
+                 v-if="formState.PriceType === 3">
+            <a-form-item label="暂定价">
+              <a-input class="dialogInput suffixGrey"
+                       :suffix="payCurrencyUnit"
+                       placeholder="请输入暂定价" />
             </a-form-item>
           </a-col>
+          <!-- 以下是点价的价格信息 start -->
+          <template v-if="formState.PriceType === 2 || formState.PriceType === 3">
+            <a-col :span="12">
+              <a-form-item label="点价合约">
+                <a-select class="inlineFormSelect"
+                          style="width: 200px"
+                          placeholder="请选择点价合约">
+                  <a-select-option value="1">
+                    合约一
+                  </a-select-option>
+                  <a-select-option value="2">
+                    合约二
+                  </a-select-option>
+                </a-select>
+              </a-form-item>
+            </a-col>
+            <a-col :span="12">
+              <a-form-item label="升贴水">
+                <a-input class="dialogInput suffixGrey"
+                         placeholder="请输入升贴水"
+                         :suffix="`${payCurrencyUnit}/${numberUnit}`"
+                         style="width: 200px" />
+              </a-form-item>
+            </a-col>
+            <a-col :span="12">
+              <a-form-item label="点价期">
+                <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>
+            <a-col :span="12">
+              <a-form-item label="交收期">
+                <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>
+          <!-- 以上是点价的价格信息 end -->
+          <template v-if="formState.PriceType === 1">
+            <a-col :span="12">
+              <a-form-item label="价格"
+                           name="Price">
+                <a-input class="dialogInput suffixGrey"
+                         v-model:value="formState.Price"
+                         placeholder="请输入价格"
+                         :suffix="`${payCurrencyUnit}/${numberUnit}`"
+                         style="width: 200px" />
+              </a-form-item>
+            </a-col>
+            <a-col :span="12">
+              <a-form-item label="金额"
+                           class="relative">
+                <a-input class="dialogInput suffixGrey"
+                         readonly
+                         placeholder="输入数量和价格后自动算"
+                         :suffix="payCurrencyUnit"
+                         style="width: 200px" />
+              </a-form-item>
+            </a-col>
+            <a-col :span="24">
+              <a-form-item label="交收期">
+                <a-range-picker v-model:value="deliveryDate"
+                                :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>
         </a-row>
       </fieldset>
       <fieldset class="formFieldSet">
@@ -280,7 +362,9 @@
         <a-row :gutter="24">
           <a-col :span="12">
             <a-form-item label="保证金">
-              <a-input class="dialogInput suffixGrey" placeholder="请输入保证金" suffix="元" />
+              <a-input class="dialogInput suffixGrey"
+                       placeholder="请输入保证金"
+                       :suffix="payCurrencyUnit" />
             </a-form-item>
           </a-col>
           <a-col :span="12">
@@ -315,7 +399,7 @@
           </a-col>
           <a-col :span="12">
             <a-form-item label="期货账户">
-                <a-select class="inlineFormSelect"
+              <a-select class="inlineFormSelect"
                         style="width: 200px"
                         placeholder="请选择期货账户">
                 <a-select-option value="1">
@@ -327,13 +411,18 @@
               </a-select>
             </a-form-item>
           </a-col>
-      </a-row>
-      <a-row :gutter="24">
+        </a-row>
+        <a-row :gutter="24">
           <a-col :span="24">
             <a-form-item label="备注">
               <a-input class="dialogInput"
+<<<<<<< HEAD
                       style="width: 608px"
                       placeholder="请输入备注" />
+=======
+                       style="width: 620px"
+                       placeholder="请输入备注" />
+>>>>>>> 8342b930e1b0ec81127da97e63ddb4b1d8afa6d2
             </a-form-item>
           </a-col>
         </a-row>
@@ -346,6 +435,8 @@
 import { defineComponent, ref } 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';
 
 export default defineComponent({
     name: 'add-spot-contract',
@@ -353,7 +444,36 @@ export default defineComponent({
     setup() {
         const { visible, cancel } = closeModal('spot_contract_btn_add');
         const loading = ref<boolean>(false);
-        const maskClosableFlag = ref<boolean>(false);
+
+        // 表单
+        const formRef = ref();
+        const { formState, businessType } = handleFromState();
+        // 合同类型
+        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 } = 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' }],
+            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' }],
+        };
+        //  处理现货商品
+        const { deliveryGoodsList, gblist, gmlist, numberUnit, WrStandardChange, getDeliveryGoods, deliveryGoodsChange } = handleDeliveryGoods(formState);
+        // 价格信息
+        const { priceType, payCurrency, payCurrencyUnit, parCurrencyChange } = handlePrice(formState);
+        // 日期
+        const { deliveryDate, disabledDate } = handleDate();
         function submit() {
             loading.value = true;
             setTimeout(() => {
@@ -361,13 +481,36 @@ export default defineComponent({
                 cancel();
             }, 2000);
         }
-        initData(() => {});
+        initData(() => {
+            queryCustomList();
+            getDeliveryGoods();
+        });
         return {
             visible,
             cancel,
             submit,
             loading,
-            maskClosableFlag,
+            maskClosableFlag: false,
+            formState,
+            rules,
+            businessType,
+            contractType,
+            isSell,
+            contractChange,
+            customList,
+            deliveryGoodsList,
+            gblist,
+            gmlist,
+            deliveryGoodsChange,
+            WrStandardChange,
+            priceType,
+            payCurrency,
+            payCurrencyUnit,
+            parCurrencyChange,
+            numberUnit,
+            getUserName,
+            deliveryDate,
+            disabledDate,
         };
     },
 });

+ 38 - 0
src/views/information/spot-contract/components/add/interface.ts

@@ -0,0 +1,38 @@
+export interface FormState {
+    // TradeDate: string // string 交易日(yyyyMMdd)
+    ContractNo: string // string 现货合同编号
+    ContractType: number// int32 现货合同类型-1:采购-1:销售
+    // UserID: number // uint64 机构ID
+    BuyUserID: number // uint64 采购方ID
+    SellUserID: number // uint64 客户ID
+    // SignDate: string // string 签订日期
+    ContractAttachment: Uint8Array // bytes 合同附件
+    ContractMargin: number | null // double 合同保证金
+    DeliveryGoodsID: number | undefined  // uint64 现货品种ID
+    WrStandardID: number | undefined   // uint64 现货商品ID
+    // ProductType: number  // uint32 产品类型-1:标准仓单2:等标3:非标
+    ConvertFactor: number | undefined  // double 标仓系数
+    SpotGoodsDesc: string // string 商品型号
+    PriceType: number // uint32 定价类型-1:一口价2:点价3:暂定价
+    Qty: number | null // double 数量
+    Price: number | null// double 价格暂定价[1:一口价、3:暂定价]
+    Amount: number | null// double 金额[1:一口价、3:暂定价]
+    DeliveryStartDate: string// string 交收期(开始)
+    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 | undefined // uint64 跟单员ID
+    // TradeUserID: number // uint64 交易员ID
+    // PricedQty: number // double 已定价量
+    // PricedAmount: number // double 已定价金额
+    SpotGoodsBrandID: number | undefined // uint64 现货品牌ID
+    Remark: string // string 合同备注
+    SaleUserID: number | undefined // uint64 业务员ID
+    AccountID: number | undefined // uint64 期货账户ID
+    BizType: number // uint32 业务类型 - 1:套保 2:套利
+    CurrencyID: number | undefined // 结算币种ID
+}

+ 224 - 0
src/views/information/spot-contract/components/add/setup.ts

@@ -0,0 +1,224 @@
+import { validateCommon } from '@/common/setup/validate';
+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 { message } from 'ant-design-vue';
+import { RuleObject } from 'ant-design-vue/lib/form/interface';
+import moment, { Moment } from 'moment';
+import { reactive, ref, UnwrapRef } from 'vue';
+import { FormState } from "./interface";
+
+export function handleFromState() {
+    const formState: UnwrapRef<FormState> = reactive({
+        ContractNo: '', // 现货合同编号
+        ContractType: 1, // int32 现货合同类型-1:采购-1:销售
+        BizType: 1, // uint32 业务类型 - 1:套保 2:套利
+        BuyUserID: 0, // uint64 采购方ID
+        SellUserID: 0,// uint64 客户ID
+        ContractAttachment: new Uint8Array(),// bytes 合同附件
+        DeliveryGoodsID: undefined, // 现货品种ID
+        WrStandardID: undefined,  // uint64 现货商品ID
+        SpotGoodsBrandID: undefined, // uint64 现货品牌ID
+        ConvertFactor: undefined,// double 标仓系数
+        SpotGoodsDesc: '', // string 商品型号
+        PriceType: 1, // uint32 定价类型-1:一口价2:点价3:暂定价
+        Qty: null, // double 数量
+        Price: null,// double 价格暂定价[1:一口价、3:暂定价]
+        Amount: null, // double 金额[1:一口价、3:暂定价]
+        DeliveryStartDate: '', // string 交收期(开始)
+        DeliveryEndDate: '', // string 交收期(结束)
+        ContractMargin: null, // double 合同保证金
+        SaleUserID: undefined, // uint64 业务员ID
+        MerUserID: undefined, // uint64 跟单员ID
+        AccountID: undefined, // uint64 期货账户ID
+        Remark: '', // string 合同备注
+        CurrencyID: undefined, // 结算币种ID
+    })
+    // 业务类型
+    const businessType = [
+        { key: 1, value: '套保' },
+        { key: 2, value: '套利' },
+    ];
+    return { formState, businessType }
+}
+/**
+ * 合同类型
+ */
+export function handleContract() {
+    // 合同类型
+    const contractType = [
+        { key: 1, value: '采购' },
+        { key: -1, value: '销售' },
+    ];
+    const isSell = ref<boolean>(false)  // true => 销售 false => 采购
+    /**
+     * 合同类型变更
+     */
+    function contractChange(value: number) {
+        isSell.value = value === 1 ? false : true;
+    }
+    const customList = ref<QueryCustomInfoType[]>([])
+    function queryCustomList() {
+        QueryCustomInfo(3)
+            .then((res) => {
+                customList.value = res
+                console.log('客户资料', customList);
+            })
+            .catch((err) => {
+                message.error(err);
+            })
+    }
+    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, '请选择结算币种')
+    }
+
+    return {
+        v_ContractType, v_BizType, v_BuyUser, v_SellUser, v_DeliveryGoods, v_WrStandard,
+        v_SpotGoodsBrand, v_PriceType, v_Currency
+    }
+}
+
+/**
+ * 处理现货商品
+ */
+export function handleDeliveryGoods(formState: UnwrapRef<FormState>) {
+    // 现货品种
+    const deliveryGoodsList = ref<ErmcpDeliveryGoodsRsp[]>([])
+    // 品牌
+    const gblist = ref<Ermcp3Brand[]>([])
+    // 品类列表
+    const gmlist = ref<Ermcp3Wrstandard[]>([])
+
+    // 查询现货商品
+    function getDeliveryGoods() {
+        QueryDeliveryGoods({}).then(res => {
+            console.log('查询现货商品', res);
+            deliveryGoodsList.value = res;
+        }).catch(err => {
+            message.error(err)
+        })
+    }
+    // 切换现货商品
+    function deliveryGoodsChange(value: number | undefined) {
+        if (value !== undefined) {
+            getDeliveryGoodsDetail(value)
+        } else {
+            gblist.value.length = 0
+            gmlist.value.length = 0
+        }
+    }
+    // 查询现货商品详情
+    function getDeliveryGoodsDetail(deliverygoodsid: number) {
+        QueryDeliveryGoodsDetail(deliverygoodsid).then(res => {
+            if (res.length) {
+                gblist.value = res[0].gblist
+                gmlist.value = res[0].gmlist
+            }
+            console.log('查询品类', res);
+        }).catch(err => {
+            message.error(err)
+        })
+    }
+    const numberUnit = ref<string>('')
+    // 品类变更
+    function WrStandardChange(value: number) {
+        const obj = gmlist.value.find((e) => e.wrstandardid === value);
+        if (obj) {
+            //标仓系数
+            formState.ConvertFactor = obj.convertfactor;
+            // 单位
+            const unitInfo = getItemEnum('goodsunit').find(e => e.enumitemname === obj.unitid)
+            if (unitInfo) {
+                numberUnit.value = unitInfo.enumdicname
+            }
+        }
+    }
+    return { deliveryGoodsList, gblist, gmlist, numberUnit, WrStandardChange, getDeliveryGoods, getDeliveryGoodsDetail, deliveryGoodsChange }
+}
+
+/**
+ * 价格信息
+ */
+export function handlePrice(formState: UnwrapRef<FormState>) {
+    // 定价类型
+    const priceType = [
+        { key: 1, value: '一口价' },
+        { key: 2, value: '点价' },
+        { key: 3, value: '暂定价' },
+    ];
+    // 币种
+    const payCurrency = getItemEnum('paycurrency')
+    console.log('payCurrency', payCurrency);
+    // 目前写死,获取枚举信息里面没有 单位名称,后期进行优化
+    const payCurrencyUnit = ref<string>('元')
+    // 切换币种
+    function parCurrencyChange(value: number) {
+        const obj = payCurrency.find(e => e.enumdicid === value)
+        console.log('切换币种', obj);
+
+        // payCurrencyUnit.value = obj?.enumdicname
+    }
+    return { priceType, payCurrency, payCurrencyUnit, parCurrencyChange }
+}
+
+export function handleAddAction() {
+    function addAction() {
+        // orderContract()
+    }
+}
+
+/**
+ * 处理日期
+ */
+export function handleDate() {
+    const deliveryDate = ref<Moment[]>([])
+    function disabledDate(current: Moment) {
+        // Can not select days before today and today
+        return current && current < moment().endOf('day');
+    }
+    return { deliveryDate, disabledDate }
+}

+ 203 - 165
src/views/information/spot-contract/components/cancel/index.vue

@@ -1,6 +1,6 @@
 <template>
   <!-- 现货合同撤销-->
-  <a-modal class="add-custom custom-detail"
+  <a-modal class="add-custom custom-detail commonModal addSpotVariety"
            title="现货合同撤销"
            v-model:visible="visible"
            centered
@@ -16,183 +16,215 @@
                 :loading="loading"
                 @click="submit">确认撤销</a-button>
     </template>
-    <a-form class="inlineForm">
-      <fieldset class="formFieldSet">
-        <legend>基本信息</legend>
-        <a-row :gutter="24">
-          <a-col :span="12">
-            <a-form-item label="合同编号">
-              <span class="white">NPCQ-2020121001</span>
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-item label="合同类型">
-              <span class="white">采购合同</span>
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <a-row :gutter="24">
-          <a-col :span="12">
-            <a-form-item label="业务类型">
-              <span class="white">套保</span>
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-item label="采购方">
-                <span class="white">河北石家庄刚强矿石公司</span>
-            </a-form-item>
-          </a-col>
-      </a-row>
-      <a-row :gutter="24">
-          <a-col :span="12">
-            <a-form-item label="销售方">
-             <span class="white">菏泽已成钢材有限公司</span>
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-item label="合同附件">
-                <div class="upload">
-                    <div class="look">查看附件</div>
-                </div>
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <a-row :gutter="24">
-          <a-col :span="24">
-            <a-form-item label="状态">
-             <span class="yellow">待审核</span>
-            </a-form-item>
-          </a-col>
-        </a-row>
-      </fieldset>
-      <fieldset class="formFieldSet">
-        <legend>现货信息</legend>
-        <a-row :gutter="24">
-          <a-col :span="12">
-            <a-form-item label="现货品种">
-              <span class="white">螺纹钢12</span>
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-item label="品类">
-              <span class="white">10mm</span>
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <a-row :gutter="24">
-          <a-col :span="12">
-            <a-form-item label="品牌">
-              <span class="white">江铜</span>
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-item label="标仓系数">
-                <span class="white">1.1</span>
-            </a-form-item>
-          </a-col>
-      </a-row>
-      <a-row :gutter="24">
-          <a-col :span="24">
-            <a-form-item label="商品规格">
-              <span class="white">符合国际GB/T1196-2008AL99.70规定,其中铝含量不低于99.7%</span>
-            </a-form-item>
-          </a-col>
-        </a-row>
-      </fieldset>
-      <fieldset class="formFieldSet">
-        <legend>价格信息</legend>
-        <a-row :gutter="24">
-          <a-col :span="12">
-            <a-form-item label="定价类型">
-              <span class="white">点价</span>
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-item label="数量">
-              <span class="white">菏泽已成钢材有限公司</span>
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <a-row :gutter="24">
-          <a-col :span="12">
-            <a-form-item label="点价合约">
-              <span class="white">CU2011</span>
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-item label="升贴水">
-              <span class="white">100元/吨</span>
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <a-row :gutter="24">
-          <a-col :span="12">
-            <a-form-item label="点价期">
-              <span class="white">2020-12-10~2021-02-10</span>
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-item label="交收期">
-              <span class="white">2020-12-10~2021-02-10</span>
-            </a-form-item>
-          </a-col>
-        </a-row>
-      </fieldset>
-      <fieldset class="formFieldSet">
-        <legend>其他信息</legend>
-        <a-row :gutter="24">
-          <a-col :span="12">
-            <a-form-item label="保证金">
-              <span class="white">13700元</span>
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-item label="业务员">
-              <span class="white">李顺利(lishunli)</span>
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <a-row :gutter="24">
-          <a-col :span="12">
-            <a-form-item label="跟单员">
-              <span class="white">王平(wangping)</span>
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-item label="期货账户">
-                <span class="white">25000000001</span>
-            </a-form-item>
-          </a-col>
-      </a-row>
-      <a-row :gutter="24">
-          <a-col :span="24">
-            <a-form-item label="备注">
-              <span class="white">符合国际GB/T1196-2008AL99.70规定,其中铝含量不低于99.7%</span>
-            </a-form-item>
-          </a-col>
-        </a-row>
-      </fieldset>
-    </a-form>
+      <a-form class="inlineForm"
+              :form="form"
+              @submit="handleSearch">
+          <fieldset class="formFieldSet">
+              <legend>基本信息</legend>
+              <a-row :gutter="24">
+                  <a-col :span="12">
+                      <a-form-item label="合同编号">
+                          <span class="white">{{ formatValue(selectedRow.contractno) }}</span>
+                      </a-form-item>
+                  </a-col>
+                  <a-col :span="12">
+                      <a-form-item label="合同类型">
+                          <span class="white">{{ getContractTypeName(selectedRow.contracttype) }}</span>
+                      </a-form-item>
+                  </a-col>
+              </a-row>
+              <a-row :gutter="24">
+                  <a-col :span="12">
+                      <a-form-item label="业务类型">
+                          <span class="white">{{ getBizTypeName(selectedRow.biztype) }}</span>
+                      </a-form-item>
+                  </a-col>
+                  <a-col :span="12">
+                      <a-form-item label="采购方">
+                          <span class="white">{{ formatValue(selectedRow.buyusername) }}</span>
+                      </a-form-item>
+                  </a-col>
+              </a-row>
+              <a-row :gutter="24">
+                  <a-col :span="12">
+                      <a-form-item label="销售方">
+                          <span class="white">{{ formatValue(selectedRow.sellusername) }}</span>
+                      </a-form-item>
+                  </a-col>
+                  <a-col :span="12">
+                      <a-form-item label="合同附件">
+                          <span class="white">{{ formatValue(selectedRow.contracctstatus) }}</span>
+                      </a-form-item>
+                  </a-col>
+              </a-row>
+              <a-row :gutter="24">
+                  <a-col :span="12">
+                      <a-form-item label="状态">
+                          <span class="yellow">{{ formatValue(getContractStatusName(selectedRow.contracctstatus)) }}</span>
+                      </a-form-item>
+                  </a-col>
+              </a-row>
+          </fieldset>
+          <fieldset class="formFieldSet">
+              <legend>现货信息</legend>
+              <a-row :gutter="24">
+                  <a-col :span="12">
+                      <a-form-item label="现货品种">
+                          <span class="white">{{ formatValue(selectedRow.deliverygoodsname) }}</span>
+                      </a-form-item>
+                  </a-col>
+                  <a-col :span="12">
+                      <a-form-item label="品类">
+                          <span class="white">{{ formatValue(selectedRow.wrstandardname) }}</span>
+                      </a-form-item>
+                  </a-col>
+              </a-row>
+              <a-row :gutter="24">
+                  <a-col :span="12">
+                      <a-form-item label="品牌">
+                          <span class="white">{{ formatValue(selectedRow.brandname) }}</span>
+                      </a-form-item>
+                  </a-col>
+                  <a-col :span="12">
+                      <a-form-item label="标仓系数">
+                          <span class="white">{{ formatValue(selectedRow.convertfactor) }}</span>
+                      </a-form-item>
+                  </a-col>
+              </a-row>
+              <a-row :gutter="24">
+                  <a-col :span="12">
+                      <a-form-item label="商品规格">
+                          <span class="white">{{ formatValue(selectedRow.spotgoodsdesc) }}</span>
+                      </a-form-item>
+                  </a-col>
+              </a-row>
+          </fieldset>
+          <fieldset class="formFieldSet">
+              <legend>价格信息</legend>
+              <a-row :gutter="24">
+                  <a-col :span="12">
+                      <a-form-item label="定价类型">
+                          <span class="white">{{ getPriceTypeName(formatValue(selectedRow.pricetype)) }}</span>
+                      </a-form-item>
+                  </a-col>
+                  <a-col :span="12">
+                      <a-form-item label="数量">
+                          <span class="white">{{ formatValue(selectedRow.qty) }}</span>
+                      </a-form-item>
+                  </a-col>
+              </a-row>
+              <a-row :gutter="24">
+                  <a-col :span="12">
+                      <a-form-item label="点价合约">
+                          <span class="white">{{ formatValue(selectedRow.goodscode) }}</span>
+                      </a-form-item>
+                  </a-col>
+                  <a-col :span="12">
+                      <a-form-item label="升贴水">
+                          <span class="white">{{ formatValue(selectedRow.pricemove) }}</span>
+                      </a-form-item>
+                  </a-col>
+              </a-row>
+              <a-row :gutter="24">
+                  <a-col :span="12">
+                      <a-form-item label="点价期">
+                          <span class="white">{{ formatValue(formatTime(selectedRow.startdate, "d") + '--' + formatTime(selectedRow.enddate, "d")) }}</span>
+                      </a-form-item>
+                  </a-col>
+                  <a-col :span="12">
+                      <a-form-item label="交收期">
+                          <span class="white">{{ formatValue(formatTime(selectedRow.deliverystartdate, "d") + '--' + formatTime(selectedRow.deliveryenddate, "d"))}}</span>
+                      </a-form-item>
+                  </a-col>
+              </a-row>
+          </fieldset>
+          <fieldset class="formFieldSet">
+              <legend>其它信息</legend>
+              <a-row :gutter="24">
+                  <a-col :span="12">
+                      <a-form-item label="保证金">
+                          <span class="white">{{ formatValue(selectedRow.contractmargin) }}</span>
+                      </a-form-item>
+                  </a-col>
+                  <a-col :span="12">
+                      <a-form-item label="业务员">
+                          <span class="white">{{ formatValue(selectedRow.saleuserlogincode) }}</span>
+                      </a-form-item>
+                  </a-col>
+              </a-row>
+              <a-row :gutter="24">
+                  <a-col :span="12">
+                      <a-form-item label="跟单员">
+                          <span class="white">{{ formatValue(selectedRow.meruserlogincode) }}</span>
+                      </a-form-item>
+                  </a-col>
+                  <a-col :span="12">
+                      <a-form-item label="期货账户">
+                          <span class="white">{{ formatValue(selectedRow.accountid) }}</span>
+                      </a-form-item>
+                  </a-col>
+              </a-row>
+              <a-row :gutter="24">
+                  <a-col :span="12">
+                      <a-form-item label="备注">
+                          <span class="white">{{ formatValue(selectedRow.remark) }}</span>
+                      </a-form-item>
+                  </a-col>
+              </a-row>
+          </fieldset>
+      </a-form>
   </a-modal>
 </template>
 
 <script lang="ts">
-import { defineComponent, ref } from 'vue';
+import {defineComponent, PropType, ref} from 'vue';
 import { closeModal } from '@/common/setup/modal/index';
+import {Ermcp3ContractRsp} from "@/services/go/ermcp/spot-contract/interface";
+import {formatTime, formatValue} from "@/common/methods";
+import {
+    getBizTypeName,
+    getContractStatusName,
+    getContractTypeName,
+    getPriceTypeName
+} from "@/views/information/spot-contract/setup";
+import {message, Modal} from "ant-design-vue";
+import { OrderContractControl} from "@/views/information/spot-contract/components/setup";
 
 export default defineComponent({
     name: 'spot-contract-detail',
     components: {},
-    setup() {
+    props: {
+        selectedRow: {
+            type: Object as PropType<Ermcp3ContractRsp>,
+            default: {},
+        },
+    },
+    setup(props, context) {
         const { visible, cancel } = closeModal('spot_contract_btn_cancel');
-        const loading = ref<boolean>(false);
+        const {loading, orderContractState} = OrderContractControl()
         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, 5)
+                        .then(res => {
+                            message.success(res);
+                            // 通知上层  刷新数据
+                            context.emit('refresh');
+                            cancel();
+                        }).catch(err => {
+                        message.error(err);
+                    });
+                },
+                onCancel() {
+                    console.log('Cancel');
+                },
+            });
         }
         return {
             visible,
@@ -200,6 +232,12 @@ export default defineComponent({
             submit,
             loading,
             maskClosableFlag,
+            formatValue,
+            getPriceTypeName,
+            getContractStatusName,
+            formatTime,
+            getContractTypeName,
+            getBizTypeName,
         };
     },
 });

+ 41 - 21
src/views/information/spot-contract/components/check/index.vue

@@ -22,37 +22,37 @@
         <a-row :gutter="24">
           <a-col :span="12">
             <a-form-item label="合同编号">
-              <span class="white">NPCQ-2020121001</span>
+              <span class="white">{{ formatValue(selectedRow.contractno) }}</span>
             </a-form-item>
           </a-col>
           <a-col :span="12">
             <a-form-item label="合同类型">
-              <span class="white">采购合同</span>
+              <span class="white">{{ getContractTypeName(selectedRow.contracttype) }}</span>
             </a-form-item>
           </a-col>
         </a-row>
         <a-row :gutter="24">
           <a-col :span="12">
             <a-form-item label="业务类型">
-              <span class="white">套保</span>
+              <span class="white">{{ getBizTypeName(selectedRow.biztype) }}</span>
             </a-form-item>
           </a-col>
           <a-col :span="12">
             <a-form-item label="采购方">
-                <span class="white">河北石家庄刚强矿石公司</span>
+                <span class="white">{{ formatValue(selectedRow.buyusername) }}</span>
             </a-form-item>
           </a-col>
       </a-row>
       <a-row :gutter="24">
           <a-col :span="12">
             <a-form-item label="销售方">
-             <span class="white">菏泽已成钢材有限公司</span>
+             <span class="white">{{ formatValue(selectedRow.sellusername) }}</span>
             </a-form-item>
           </a-col>
           <a-col :span="12">
             <a-form-item label="合同附件">
                 <div class="upload">
-                    <div class="look">查看附件</div>
+                    <div class="look">{{ formatValue(selectedRow.contracctstatus) }}</div>
                 </div>
             </a-form-item>
           </a-col>
@@ -60,7 +60,7 @@
         <a-row :gutter="24">
           <a-col :span="24">
             <a-form-item label="状态">
-             <span class="green">正常</span>
+             <span class="green">{{ formatValue(getContractStatusName(selectedRow.contracctstatus)) }}</span>
             </a-form-item>
           </a-col>
         </a-row>
@@ -70,31 +70,31 @@
         <a-row :gutter="24">
           <a-col :span="12">
             <a-form-item label="现货品种">
-              <span class="white">螺纹钢12</span>
+              <span class="white">{{ formatValue(selectedRow.deliverygoodsname) }}</span>
             </a-form-item>
           </a-col>
           <a-col :span="12">
             <a-form-item label="品类">
-              <span class="white">10mm</span>
+              <span class="white">{{ formatValue(selectedRow.wrstandardname) }}</span>
             </a-form-item>
           </a-col>
         </a-row>
         <a-row :gutter="24">
           <a-col :span="12">
             <a-form-item label="品牌">
-              <span class="white">江铜</span>
+              <span class="white">{{ formatValue(selectedRow.brandname) }}</span>
             </a-form-item>
           </a-col>
           <a-col :span="12">
             <a-form-item label="标仓系数">
-                <span class="white">1.1</span>
+                <span class="white">{{ formatValue(selectedRow.convertfactor) }}</span>
             </a-form-item>
           </a-col>
       </a-row>
       <a-row :gutter="24">
           <a-col :span="24">
             <a-form-item label="商品规格">
-              <span class="white">符合国际GB/T1196-2008AL99.70规定,其中铝含量不低于99.7%</span>
+              <span class="white">{{ formatValue(selectedRow.spotgoodsdesc) }}</span>
             </a-form-item>
           </a-col>
         </a-row>
@@ -104,36 +104,36 @@
         <a-row :gutter="24">
           <a-col :span="12">
             <a-form-item label="定价类型">
-              <span class="white">点价</span>
+              <span class="white">{{ getPriceTypeName(formatValue(selectedRow.pricetype)) }}</span>
             </a-form-item>
           </a-col>
           <a-col :span="12">
             <a-form-item label="数量">
-              <span class="white">菏泽已成钢材有限公司</span>
+              <span class="white">{{ formatValue(selectedRow.qty) }}</span>
             </a-form-item>
           </a-col>
         </a-row>
         <a-row :gutter="24">
           <a-col :span="12">
             <a-form-item label="点价合约">
-              <span class="white">CU2011</span>
+              <span class="white">{{ formatValue(selectedRow.goodscode) }}</span>
             </a-form-item>
           </a-col>
           <a-col :span="12">
             <a-form-item label="升贴水">
-              <span class="white">100元/吨</span>
+              <span class="white">{{ formatValue(selectedRow.pricemove) }}</span>
             </a-form-item>
           </a-col>
         </a-row>
         <a-row :gutter="24">
           <a-col :span="12">
             <a-form-item label="点价期">
-              <span class="white">2020-12-10~2021-02-10</span>
+              <span class="white">{{ formatValue(formatTime(selectedRow.startdate, "d") + '--' + formatTime(selectedRow.enddate, "d")) }}</span>
             </a-form-item>
           </a-col>
           <a-col :span="12">
             <a-form-item label="交收期">
-              <span class="white">2020-12-10~2021-02-10</span>
+              <span class="white">{{ formatValue(formatTime(selectedRow.deliverystartdate, "d") + '--' + formatTime(selectedRow.deliveryenddate, "d"))}}</span>
             </a-form-item>
           </a-col>
         </a-row>
@@ -143,7 +143,7 @@
         <a-row :gutter="24">
           <a-col :span="12">
             <a-form-item label="保证金">
-              <span class="white">13700元</span>
+              <span class="white">{{ formatValue(selectedRow.contractmargin) }}</span>
             </a-form-item>
           </a-col>
           <a-col :span="12">
@@ -194,7 +194,7 @@
       <a-row :gutter="24">
           <a-col :span="24">
             <a-form-item label="备注">
-              <span class="white">符合国际GB/T1196-2008AL99.70规定,其中铝含量不低于99.7%</span>
+              <span class="white">{{ formatValue(selectedRow.remark) }}</span>
             </a-form-item>
           </a-col>
         </a-row>
@@ -216,12 +216,26 @@
 </template>
 
 <script lang="ts">
-import { defineComponent, ref } from 'vue';
+import {defineComponent, PropType, ref} from 'vue';
 import { closeModal } from '@/common/setup/modal/index';
+import {
+    getBizTypeName,
+    getContractStatusName,
+    getContractTypeName,
+    getPriceTypeName
+} from "@/views/information/spot-contract/setup";
+import {Ermcp3ContractRsp} from "@/services/go/ermcp/spot-contract/interface";
+import {formatTime, formatValue} from "@/common/methods";
 
 export default defineComponent({
     name: 'spot-contract-detail',
     components: {},
+    props: {
+        selectedRow: {
+            type: Object as PropType<Ermcp3ContractRsp>,
+            default: {},
+        },
+    },
     setup() {
         const { visible, cancel } = closeModal('spot_contract_btn_check');
         const loading = ref<boolean>(false);
@@ -239,6 +253,12 @@ export default defineComponent({
             submit,
             loading,
             maskClosableFlag,
+            getContractTypeName,
+            getBizTypeName,
+            formatValue,
+            getContractStatusName,
+            formatTime,
+            getPriceTypeName,
         };
     },
 });

+ 203 - 165
src/views/information/spot-contract/components/delete/index.vue

@@ -1,6 +1,6 @@
 <template>
   <!-- 删除现货合同--->
-  <a-modal class="recover-custom"
+  <a-modal class="recover-custom commonModal addSpotVariety"
            title="删除现货合同"
            v-model:visible="visible"
            centered
@@ -16,183 +16,215 @@
                 :loading="loading"
                 @click="submit">确认删除</a-button>
     </template>
-    <a-form class="inlineForm"
-            :form="form"
-            @submit="handleSearch">
-      <fieldset class="formFieldSet">
-        <legend>基本信息</legend>
-          <a-row :gutter="24">
-            <a-col :span="12">
-              <a-form-item label="合同编号">
-                <span class="white">{{ formatValue(selectedRow.contractno) }}</span>
-              </a-form-item>
-            </a-col>
-            <a-col :span="12">
-              <a-form-item label="合同类型">
-                <span class="white">{{ formatValue(selectedRow.contractno) }}</span>
-              </a-form-item>
-            </a-col>
-          </a-row>
-          <a-row :gutter="24">
-            <a-col :span="12">
-              <a-form-item label="业务类型">
-                <span class="white">{{ formatValue(selectedRow.biztype) }}</span>
-              </a-form-item>
-            </a-col>
-            <a-col :span="12">
-              <a-form-item label="采购方">
-                <span class="white">{{ formatValue(selectedRow.buyusername) }}</span>
-              </a-form-item>
-            </a-col>
-          </a-row>
-          <a-row :gutter="24">
-            <a-col :span="12">
-              <a-form-item label="销售方">
-                <span class="white">{{ formatValue(selectedRow.sellusername) }}</span>
-              </a-form-item>
-            </a-col>
-            <a-col :span="12">
-              <a-form-item label="合同附件">
-                <span class="white">{{ formatValue(selectedRow.contracctstatus) }}</span>
-              </a-form-item>
-            </a-col>
-          </a-row>
-          <a-row :gutter="24">
-            <a-col :span="12">
-              <a-form-item label="状态">
-                <span class="blue">{{ formatValue(getContractStatusName(selectedRow.contracctstatus)) }}</span>
-              </a-form-item>
-            </a-col>
-          </a-row>
-      </fieldset>
-      <fieldset class="formFieldSet">
-        <legend>现货信息</legend>
-        <a-row :gutter="24">
-          <a-col :span="12">
-            <a-form-item label="现货品种">
-              <span class="white">{{ formatValue(selectedRow.deliverygoodsname) }}</span>
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-item label="品类">
-              <span class="white">{{ formatValue(selectedRow.wrstandardname) }}</span>
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <a-row :gutter="24">
-          <a-col :span="12">
-            <a-form-item label="品牌">
-              <span class="white">{{ formatValue(selectedRow.brandname) }}</span>
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-item label="标仓系数">
-              <span class="white">{{ formatValue(selectedRow.convertfactor) }}</span>
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <a-row :gutter="24">
-          <a-col :span="12">
-            <a-form-item label="商品规格">
-              <span class="white">{{ formatValue(selectedRow.spotgoodsdesc) }}</span>
-            </a-form-item>
-          </a-col>
-        </a-row>
-      </fieldset>
-      <fieldset class="formFieldSet">
-        <legend>价格信息</legend>
-        <a-row :gutter="24">
-          <a-col :span="12">
-            <a-form-item label="定价类型">
-              <span class="white">{{ getPriceTypeName(formatValue(selectedRow.pricetype)) }}</span>
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-item label="数量">
-              <span class="white">{{ formatValue(selectedRow.qty) }}</span>
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <a-row :gutter="24">
-          <a-col :span="12">
-            <a-form-item label="点价合约">
-              <span class="white">{{ formatValue(selectedRow.goodscode) }}</span>
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-item label="升贴水">
-              <span class="white">{{ formatValue(selectedRow.pricemove) }}</span>
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <a-row :gutter="24">
-          <a-col :span="12">
-            <a-form-item label="点价期">
-              <span class="white">{{ formatValue(formatTime(selectedRow.startdate, "d") + '--' + formatTime(selectedRow.enddate, "d")) }}</span>
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-item label="交收期">
-              <span class="white">{{ formatValue(formatTime(selectedRow.deliverystartdate, "d") + '--' + formatTime(selectedRow.deliveryenddate, "d"))}}</span>
-            </a-form-item>
-          </a-col>
-        </a-row>
-      </fieldset>
-      <fieldset class="formFieldSet">
-        <legend>其它信息</legend>
-        <a-row :gutter="24">
-          <a-col :span="12">
-            <a-form-item label="保证金">
-              <span class="white">{{ formatValue(selectedRow.contractmargin) }}</span>
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-item label="业务员">
-              <span class="white">{{ formatValue(selectedRow.saleuserlogincode) }}</span>
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <a-row :gutter="24">
-          <a-col :span="12">
-            <a-form-item label="跟单员">
-              <span class="white">{{ formatValue(selectedRow.meruserlogincode) }}</span>
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-item label="期货账户">
-              <span class="white">{{ formatValue(selectedRow.accountid) }}</span>
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <a-row :gutter="24">
-          <a-col :span="12">
-            <a-form-item label="备注">
-              <span class="white">{{ formatValue(selectedRow.remark) }}</span>
-            </a-form-item>
-          </a-col>
-        </a-row>
-      </fieldset>
-    </a-form>
+      <a-form class="inlineForm"
+              :form="form"
+              @submit="handleSearch">
+          <fieldset class="formFieldSet">
+              <legend>基本信息</legend>
+              <a-row :gutter="24">
+                  <a-col :span="12">
+                      <a-form-item label="合同编号">
+                          <span class="white">{{ formatValue(selectedRow.contractno) }}</span>
+                      </a-form-item>
+                  </a-col>
+                  <a-col :span="12">
+                      <a-form-item label="合同类型">
+                          <span class="white">{{ getContractTypeName(selectedRow.contracttype) }}</span>
+                      </a-form-item>
+                  </a-col>
+              </a-row>
+              <a-row :gutter="24">
+                  <a-col :span="12">
+                      <a-form-item label="业务类型">
+                          <span class="white">{{ getBizTypeName(selectedRow.biztype) }}</span>
+                      </a-form-item>
+                  </a-col>
+                  <a-col :span="12">
+                      <a-form-item label="采购方">
+                          <span class="white">{{ formatValue(selectedRow.buyusername) }}</span>
+                      </a-form-item>
+                  </a-col>
+              </a-row>
+              <a-row :gutter="24">
+                  <a-col :span="12">
+                      <a-form-item label="销售方">
+                          <span class="white">{{ formatValue(selectedRow.sellusername) }}</span>
+                      </a-form-item>
+                  </a-col>
+                  <a-col :span="12">
+                      <a-form-item label="合同附件">
+                          <span class="white">{{ formatValue(selectedRow.contracctstatus) }}</span>
+                      </a-form-item>
+                  </a-col>
+              </a-row>
+              <a-row :gutter="24">
+                  <a-col :span="12">
+                      <a-form-item label="状态">
+                          <span class="yellow">{{ formatValue(getContractStatusName(selectedRow.contracctstatus)) }}</span>
+                      </a-form-item>
+                  </a-col>
+              </a-row>
+          </fieldset>
+          <fieldset class="formFieldSet">
+              <legend>现货信息</legend>
+              <a-row :gutter="24">
+                  <a-col :span="12">
+                      <a-form-item label="现货品种">
+                          <span class="white">{{ formatValue(selectedRow.deliverygoodsname) }}</span>
+                      </a-form-item>
+                  </a-col>
+                  <a-col :span="12">
+                      <a-form-item label="品类">
+                          <span class="white">{{ formatValue(selectedRow.wrstandardname) }}</span>
+                      </a-form-item>
+                  </a-col>
+              </a-row>
+              <a-row :gutter="24">
+                  <a-col :span="12">
+                      <a-form-item label="品牌">
+                          <span class="white">{{ formatValue(selectedRow.brandname) }}</span>
+                      </a-form-item>
+                  </a-col>
+                  <a-col :span="12">
+                      <a-form-item label="标仓系数">
+                          <span class="white">{{ formatValue(selectedRow.convertfactor) }}</span>
+                      </a-form-item>
+                  </a-col>
+              </a-row>
+              <a-row :gutter="24">
+                  <a-col :span="12">
+                      <a-form-item label="商品规格">
+                          <span class="white">{{ formatValue(selectedRow.spotgoodsdesc) }}</span>
+                      </a-form-item>
+                  </a-col>
+              </a-row>
+          </fieldset>
+          <fieldset class="formFieldSet">
+              <legend>价格信息</legend>
+              <a-row :gutter="24">
+                  <a-col :span="12">
+                      <a-form-item label="定价类型">
+                          <span class="white">{{ getPriceTypeName(formatValue(selectedRow.pricetype)) }}</span>
+                      </a-form-item>
+                  </a-col>
+                  <a-col :span="12">
+                      <a-form-item label="数量">
+                          <span class="white">{{ formatValue(selectedRow.qty) }}</span>
+                      </a-form-item>
+                  </a-col>
+              </a-row>
+              <a-row :gutter="24">
+                  <a-col :span="12">
+                      <a-form-item label="点价合约">
+                          <span class="white">{{ formatValue(selectedRow.goodscode) }}</span>
+                      </a-form-item>
+                  </a-col>
+                  <a-col :span="12">
+                      <a-form-item label="升贴水">
+                          <span class="white">{{ formatValue(selectedRow.pricemove) }}</span>
+                      </a-form-item>
+                  </a-col>
+              </a-row>
+              <a-row :gutter="24">
+                  <a-col :span="12">
+                      <a-form-item label="点价期">
+                          <span class="white">{{ formatValue(formatTime(selectedRow.startdate, "d") + '--' + formatTime(selectedRow.enddate, "d")) }}</span>
+                      </a-form-item>
+                  </a-col>
+                  <a-col :span="12">
+                      <a-form-item label="交收期">
+                          <span class="white">{{ formatValue(formatTime(selectedRow.deliverystartdate, "d") + '--' + formatTime(selectedRow.deliveryenddate, "d"))}}</span>
+                      </a-form-item>
+                  </a-col>
+              </a-row>
+          </fieldset>
+          <fieldset class="formFieldSet">
+              <legend>其它信息</legend>
+              <a-row :gutter="24">
+                  <a-col :span="12">
+                      <a-form-item label="保证金">
+                          <span class="white">{{ formatValue(selectedRow.contractmargin) }}</span>
+                      </a-form-item>
+                  </a-col>
+                  <a-col :span="12">
+                      <a-form-item label="业务员">
+                          <span class="white">{{ formatValue(selectedRow.saleuserlogincode) }}</span>
+                      </a-form-item>
+                  </a-col>
+              </a-row>
+              <a-row :gutter="24">
+                  <a-col :span="12">
+                      <a-form-item label="跟单员">
+                          <span class="white">{{ formatValue(selectedRow.meruserlogincode) }}</span>
+                      </a-form-item>
+                  </a-col>
+                  <a-col :span="12">
+                      <a-form-item label="期货账户">
+                          <span class="white">{{ formatValue(selectedRow.accountid) }}</span>
+                      </a-form-item>
+                  </a-col>
+              </a-row>
+              <a-row :gutter="24">
+                  <a-col :span="12">
+                      <a-form-item label="备注">
+                          <span class="white">{{ formatValue(selectedRow.remark) }}</span>
+                      </a-form-item>
+                  </a-col>
+              </a-row>
+          </fieldset>
+      </a-form>
   </a-modal>
 </template>
 
 <script lang="ts">
-import { defineComponent, ref } from 'vue';
+import {defineComponent, PropType, ref} from 'vue';
 import { closeModal } from '@/common/setup/modal/index';
+import {Ermcp3ContractRsp} from "@/services/go/ermcp/spot-contract/interface";
+import {formatTime, formatValue} from "@/common/methods";
+import {
+    getBizTypeName,
+    getContractStatusName,
+    getContractTypeName,
+    getPriceTypeName
+} from "@/views/information/spot-contract/setup";
+import {message, Modal} from "ant-design-vue";
+import {OrderContractControl} from "@/views/information/spot-contract/components/setup";
 
 export default defineComponent({
     name: 'delete-spot-contract',
     components: {},
-    setup() {
+    props: {
+        selectedRow: {
+            type: Object as PropType<Ermcp3ContractRsp>,
+            default: {},
+        },
+    },
+    setup(props, context) {
         const { visible, cancel } = closeModal('spot_contract_btn_delete');
-        const loading = ref<boolean>(false);
+        const {loading, orderContractState} = OrderContractControl()
         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, 1)
+                        .then(res => {
+                            message.success(res);
+                            // 通知上层  刷新数据
+                            context.emit('refresh');
+                            cancel();
+                        }).catch(err => {
+                        message.error(err);
+                    });
+                },
+                onCancel() {
+                    console.log('Cancel');
+                },
+            });
         }
         return {
             visible,
@@ -200,6 +232,12 @@ export default defineComponent({
             submit,
             loading,
             maskClosableFlag,
+            formatValue,
+            getPriceTypeName,
+            getContractStatusName,
+            formatTime,
+            getContractTypeName,
+            getBizTypeName,
         };
     },
 });

+ 12 - 4
src/views/information/spot-contract/components/detail/index.vue

@@ -26,14 +26,14 @@
             </a-col>
             <a-col :span="12">
               <a-form-item label="合同类型">
-                <span class="white">{{ formatValue(selectedRow.contractno) }}</span>
+                <span class="white">{{ getContractTypeName(selectedRow.contracttype) }}</span>
               </a-form-item>
             </a-col>
           </a-row>
           <a-row :gutter="24">
             <a-col :span="12">
               <a-form-item label="业务类型">
-                <span class="white">{{ formatValue(selectedRow.biztype) }}</span>
+                <span class="white">{{ getBizTypeName(selectedRow.biztype) }}</span>
               </a-form-item>
             </a-col>
             <a-col :span="12">
@@ -179,8 +179,14 @@ import { closeModal } from '@/common/setup/modal/index';
 import { QueryCustomInfoType } from '@/services/go/ermcp/customInfo/interface';
 import { Ermcp3ContractRsp } from '@/services/go/ermcp/spot-contract/interface';
 import { getStatusName } from '@/views/information/custom/setup';
-import { getContractStatusName, getPriceTypeName } from '@/views/information/spot-contract/setup';
+import {
+    getBizTypeName,
+    getContractStatusName,
+    getContractTypeName,
+    getPriceTypeName
+} from '@/views/information/spot-contract/setup';
 import { formatValue, formatTime } from '@/common/methods/format';
+import {v4 as uuidv4} from "uuid";
 
 export default defineComponent({
     name: 'spot-contract-detail',
@@ -200,7 +206,7 @@ export default defineComponent({
             setTimeout(() => {
                 loading.value = false;
                 cancel();
-            }, 2000);
+            }, 200);
         }
         return {
             visible,
@@ -212,6 +218,8 @@ export default defineComponent({
             getPriceTypeName,
             formatTime,
             maskClosableFlag,
+            getContractTypeName,
+            getBizTypeName,
         };
     },
 });

+ 203 - 165
src/views/information/spot-contract/components/finish/index.vue

@@ -16,190 +16,228 @@
                 :loading="loading"
                 @click="submit">确认完结</a-button>
     </template>
-    <a-form class="inlineForm">
-      <fieldset class="formFieldSet">
-        <legend>基本信息</legend>
-        <a-row :gutter="24">
-          <a-col :span="12">
-            <a-form-item label="合同编号">
-              <span class="white">NPCQ-2020121001</span>
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-item label="合同类型">
-              <span class="white">采购合同</span>
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <a-row :gutter="24">
-          <a-col :span="12">
-            <a-form-item label="业务类型">
-              <span class="white">套保</span>
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-item label="采购方">
-                <span class="white">河北石家庄刚强矿石公司</span>
-            </a-form-item>
-          </a-col>
-      </a-row>
-      <a-row :gutter="24">
-          <a-col :span="12">
-            <a-form-item label="销售方">
-             <span class="white">菏泽已成钢材有限公司</span>
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-item label="合同附件">
-                <div class="upload">
-                    <div class="look">查看附件</div>
-                </div>
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <a-row :gutter="24">
-          <a-col :span="24">
-            <a-form-item label="状态">
-             <span class="green">正常</span>
-            </a-form-item>
-          </a-col>
-        </a-row>
-      </fieldset>
-      <fieldset class="formFieldSet">
-        <legend>现货信息</legend>
-        <a-row :gutter="24">
-          <a-col :span="12">
-            <a-form-item label="现货品种">
-              <span class="white">螺纹钢12</span>
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-item label="品类">
-              <span class="white">10mm</span>
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <a-row :gutter="24">
-          <a-col :span="12">
-            <a-form-item label="品牌">
-              <span class="white">江铜</span>
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-item label="标仓系数">
-                <span class="white">1.1</span>
-            </a-form-item>
-          </a-col>
-      </a-row>
-      <a-row :gutter="24">
-          <a-col :span="24">
-            <a-form-item label="商品规格">
-              <span class="white">符合国际GB/T1196-2008AL99.70规定,其中铝含量不低于99.7%</span>
-            </a-form-item>
-          </a-col>
-        </a-row>
-      </fieldset>
-      <fieldset class="formFieldSet">
-        <legend>价格信息</legend>
-        <a-row :gutter="24">
-          <a-col :span="12">
-            <a-form-item label="定价类型">
-              <span class="white">点价</span>
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-item label="数量">
-              <span class="white">菏泽已成钢材有限公司</span>
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <a-row :gutter="24">
-          <a-col :span="12">
-            <a-form-item label="点价合约">
-              <span class="white">CU2011</span>
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-item label="升贴水">
-              <span class="white">100元/吨</span>
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <a-row :gutter="24">
-          <a-col :span="12">
-            <a-form-item label="点价期">
-              <span class="white">2020-12-10~2021-02-10</span>
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-item label="交收期">
-              <span class="white">2020-12-10~2021-02-10</span>
-            </a-form-item>
-          </a-col>
-        </a-row>
-      </fieldset>
-      <fieldset class="formFieldSet">
-        <legend>其他信息</legend>
-        <a-row :gutter="24">
-          <a-col :span="12">
-            <a-form-item label="保证金">
-              <span class="white">13700元</span>
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-item label="业务员">
-              <span class="white">李顺利(lishunli)</span>
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <a-row :gutter="24">
-          <a-col :span="12">
-            <a-form-item label="跟单员">
-              <span class="white">王平(wangping)</span>
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-item label="期货账户">
-                <span class="white">25000000001</span>
-            </a-form-item>
-          </a-col>
-      </a-row>
-      <a-row :gutter="24">
-          <a-col :span="24">
-            <a-form-item label="备注">
-              <span class="white">符合国际GB/T1196-2008AL99.70规定,其中铝含量不低于99.7%</span>
-            </a-form-item>
-          </a-col>
-        </a-row>
-      </fieldset>
-    </a-form>
+      <a-form class="inlineForm"
+              :form="form"
+              @submit="handleSearch">
+          <fieldset class="formFieldSet">
+              <legend>基本信息</legend>
+              <a-row :gutter="24">
+                  <a-col :span="12">
+                      <a-form-item label="合同编号">
+                          <span class="white">{{ formatValue(selectedRow.contractno) }}</span>
+                      </a-form-item>
+                  </a-col>
+                  <a-col :span="12">
+                      <a-form-item label="合同类型">
+                          <span class="white">{{ getContractTypeName(selectedRow.contracttype) }}</span>
+                      </a-form-item>
+                  </a-col>
+              </a-row>
+              <a-row :gutter="24">
+                  <a-col :span="12">
+                      <a-form-item label="业务类型">
+                          <span class="white">{{ getBizTypeName(selectedRow.biztype) }}</span>
+                      </a-form-item>
+                  </a-col>
+                  <a-col :span="12">
+                      <a-form-item label="采购方">
+                          <span class="white">{{ formatValue(selectedRow.buyusername) }}</span>
+                      </a-form-item>
+                  </a-col>
+              </a-row>
+              <a-row :gutter="24">
+                  <a-col :span="12">
+                      <a-form-item label="销售方">
+                          <span class="white">{{ formatValue(selectedRow.sellusername) }}</span>
+                      </a-form-item>
+                  </a-col>
+                  <a-col :span="12">
+                      <a-form-item label="合同附件">
+                          <span class="white">{{ formatValue(selectedRow.contracctstatus) }}</span>
+                      </a-form-item>
+                  </a-col>
+              </a-row>
+              <a-row :gutter="24">
+                  <a-col :span="12">
+                      <a-form-item label="状态">
+                          <span class="yellow">{{ formatValue(getContractStatusName(selectedRow.contracctstatus)) }}</span>
+                      </a-form-item>
+                  </a-col>
+              </a-row>
+          </fieldset>
+          <fieldset class="formFieldSet">
+              <legend>现货信息</legend>
+              <a-row :gutter="24">
+                  <a-col :span="12">
+                      <a-form-item label="现货品种">
+                          <span class="white">{{ formatValue(selectedRow.deliverygoodsname) }}</span>
+                      </a-form-item>
+                  </a-col>
+                  <a-col :span="12">
+                      <a-form-item label="品类">
+                          <span class="white">{{ formatValue(selectedRow.wrstandardname) }}</span>
+                      </a-form-item>
+                  </a-col>
+              </a-row>
+              <a-row :gutter="24">
+                  <a-col :span="12">
+                      <a-form-item label="品牌">
+                          <span class="white">{{ formatValue(selectedRow.brandname) }}</span>
+                      </a-form-item>
+                  </a-col>
+                  <a-col :span="12">
+                      <a-form-item label="标仓系数">
+                          <span class="white">{{ formatValue(selectedRow.convertfactor) }}</span>
+                      </a-form-item>
+                  </a-col>
+              </a-row>
+              <a-row :gutter="24">
+                  <a-col :span="12">
+                      <a-form-item label="商品规格">
+                          <span class="white">{{ formatValue(selectedRow.spotgoodsdesc) }}</span>
+                      </a-form-item>
+                  </a-col>
+              </a-row>
+          </fieldset>
+          <fieldset class="formFieldSet">
+              <legend>价格信息</legend>
+              <a-row :gutter="24">
+                  <a-col :span="12">
+                      <a-form-item label="定价类型">
+                          <span class="white">{{ getPriceTypeName(formatValue(selectedRow.pricetype)) }}</span>
+                      </a-form-item>
+                  </a-col>
+                  <a-col :span="12">
+                      <a-form-item label="数量">
+                          <span class="white">{{ formatValue(selectedRow.qty) }}</span>
+                      </a-form-item>
+                  </a-col>
+              </a-row>
+              <a-row :gutter="24">
+                  <a-col :span="12">
+                      <a-form-item label="点价合约">
+                          <span class="white">{{ formatValue(selectedRow.goodscode) }}</span>
+                      </a-form-item>
+                  </a-col>
+                  <a-col :span="12">
+                      <a-form-item label="升贴水">
+                          <span class="white">{{ formatValue(selectedRow.pricemove) }}</span>
+                      </a-form-item>
+                  </a-col>
+              </a-row>
+              <a-row :gutter="24">
+                  <a-col :span="12">
+                      <a-form-item label="点价期">
+                          <span class="white">{{ formatValue(formatTime(selectedRow.startdate, "d") + '--' + formatTime(selectedRow.enddate, "d")) }}</span>
+                      </a-form-item>
+                  </a-col>
+                  <a-col :span="12">
+                      <a-form-item label="交收期">
+                          <span class="white">{{ formatValue(formatTime(selectedRow.deliverystartdate, "d") + '--' + formatTime(selectedRow.deliveryenddate, "d"))}}</span>
+                      </a-form-item>
+                  </a-col>
+              </a-row>
+          </fieldset>
+          <fieldset class="formFieldSet">
+              <legend>其它信息</legend>
+              <a-row :gutter="24">
+                  <a-col :span="12">
+                      <a-form-item label="保证金">
+                          <span class="white">{{ formatValue(selectedRow.contractmargin) }}</span>
+                      </a-form-item>
+                  </a-col>
+                  <a-col :span="12">
+                      <a-form-item label="业务员">
+                          <span class="white">{{ formatValue(selectedRow.saleuserlogincode) }}</span>
+                      </a-form-item>
+                  </a-col>
+              </a-row>
+              <a-row :gutter="24">
+                  <a-col :span="12">
+                      <a-form-item label="跟单员">
+                          <span class="white">{{ formatValue(selectedRow.meruserlogincode) }}</span>
+                      </a-form-item>
+                  </a-col>
+                  <a-col :span="12">
+                      <a-form-item label="期货账户">
+                          <span class="white">{{ formatValue(selectedRow.accountid) }}</span>
+                      </a-form-item>
+                  </a-col>
+              </a-row>
+              <a-row :gutter="24">
+                  <a-col :span="12">
+                      <a-form-item label="备注">
+                          <span class="white">{{ formatValue(selectedRow.remark) }}</span>
+                      </a-form-item>
+                  </a-col>
+              </a-row>
+          </fieldset>
+      </a-form>
   </a-modal>
 </template>
 
 <script lang="ts">
-import { defineComponent, ref } from 'vue';
+import {defineComponent, PropType, ref} from 'vue';
 import { closeModal } from '@/common/setup/modal/index';
+import {formatTime, formatValue} from "@/common/methods";
+import {
+    getBizTypeName,
+    getContractStatusName,
+    getContractTypeName,
+    getPriceTypeName
+} from "@/views/information/spot-contract/setup";
+import {Ermcp3ContractRsp} from "@/services/go/ermcp/spot-contract/interface";
+import { OrderContractControl} from "@/views/information/spot-contract/components/setup";
+import {message, Modal} from "ant-design-vue";
 
 export default defineComponent({
     name: 'spot-contract-detail',
     components: {},
-    setup() {
+    props: {
+        selectedRow: {
+            type: Object as PropType<Ermcp3ContractRsp>,
+            default: {},
+        },
+    },
+    setup(props, context) {
         const { visible, cancel } = closeModal('spot_contract_btn_finish');
-        const loading = ref<boolean>(false);
+        const {loading, orderContractState} = OrderContractControl()
         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, 6)
+                        .then(res => {
+                            message.success(res);
+                            // 通知上层  刷新数据
+                            context.emit('refresh');
+                            cancel();
+                        }).catch(err => {
+                        message.error(err);
+                    });
+                },
+                onCancel() {
+                    console.log('Cancel');
+                },
+            });
         }
         return {
             visible,
             cancel,
             submit,
             loading,
-            maskClosableFlag
+            maskClosableFlag,
+            formatValue,
+            getPriceTypeName,
+            getContractStatusName,
+            formatTime,
+            getContractTypeName,
+            getBizTypeName,
         };
     },
 });

+ 3 - 0
src/views/information/spot-contract/components/resubmit/index.vue

@@ -17,6 +17,7 @@
 <script lang="ts">
 import { defineComponent, ref } from 'vue';
 import { closeModal } from '@/common/setup/modal/index';
+import {getBizTypeName, getContractTypeName} from "@/views/information/spot-contract/setup";
 
 export default defineComponent({
     name: 'resubmit-spot-contract',
@@ -36,6 +37,8 @@ export default defineComponent({
             cancel,
             submit,
             loading,
+            getContractTypeName,
+            getBizTypeName,
         };
     },
 });

+ 112 - 0
src/views/information/spot-contract/components/setup.ts

@@ -0,0 +1,112 @@
+import {
+    GldErmcpSpotContractOperateReq,
+    GldSpotContractInfo,
+    SpotContractOperateReq
+} from "@/services/proto/spotcontract/interface";
+import {orderContract, spotContractStatus} from "@/services/proto/spotcontract";
+import {ref} from "vue";
+import {getSelectedAccountId} from "@/services/bus/account";
+import * as Long from "long";
+
+/**
+ * 合同操作相关
+ */
+export function changeOrderContract() {
+    const loading = ref<boolean>(false);
+
+    /**
+     * 合同操作
+     * @param id 合同id
+     * @param type 操作类型 1: 保存草稿  2: 提交申请 3: 删除成功 4:审核通过
+     * @param info 合同信息
+     */
+    function orderContractState(id: string, type: number, info?: GldSpotContractInfo): Promise<string> {
+        const reqs: GldErmcpSpotContractOperateReq = {
+            SpotContractID: Number(id),
+            OperateType: type,
+            Remark: '',
+            Info: info,
+        }
+        let successText = "成功"
+        let errorText = "失败"
+
+        switch (type){
+            case 1:
+                successText = "保存草稿成功"
+                errorText = "保存草稿失败:"
+                break;
+            case 2:
+                successText = "提交申请成功"
+                errorText = "提交申请失败:"
+                break;
+            case 3:
+                successText = "删除成功"
+                errorText = "删除失败:"
+                break;
+            case 4:
+                successText = "审核通过"
+                errorText = "审核失败:"
+                break;
+        }
+
+        return orderContract(reqs)
+            .then(res => {
+                return Promise.resolve(successText)
+            })
+            .catch(err => {
+                return Promise.reject(errorText + err)
+            }).finally(() => {
+                loading.value = false
+            })
+    }
+
+    return {loading, orderContractState}
+}
+
+
+/**
+ * 修改合同类型
+ * 4:审核拒绝 6:正常完结 5:撤销
+ */
+export function OrderContractControl() {
+    const loading = ref<boolean>(false);
+
+    function orderContractState(id: string, type: number): Promise<string> {
+        const reqs: SpotContractOperateReq = {
+            SpotContractID: Number(id),
+            OperateType: type,
+            Remark: '',
+        }
+        let successText = "成功"
+        let errorText = "失败"
+
+        switch (type) {
+            case 4:
+                successText = "审核拒绝成功"
+                errorText = "审核拒绝失败:"
+                break;
+            case 5:
+                successText = "撤销成功"
+                errorText = "撤销失败:"
+                break;
+            case 6:
+                successText = "正常完结"
+                errorText = "合同完结失败:"
+                break;
+        }
+
+        return spotContractStatus(reqs)
+            .then(res => {
+                return Promise.resolve(successText)
+            })
+            .catch(err => {
+                return Promise.reject(errorText + err)
+            }).finally(() => {
+                loading.value = false
+            })
+    }
+
+    return {loading, orderContractState}
+}
+
+

+ 75 - 37
src/views/information/spot-contract/list/checkpending/index.vue

@@ -1,40 +1,71 @@
 <template>
-  <!-- 现货合同: 待审核-->
-  <div class="spot-contract-peddding"
-       :loading="loading">
-    <filterCustomTable @search="search">
-      <BtnList :btnList="commonBtn" />
-    </filterCustomTable>
-    <contextMenu :contextMenuList="forDataBtn">
-      <a-table :columns="columns"
-               class="topTable hiddenFirstCol"
-               :pagination="false"
-               rowKey="key"
-               :expandedRowKeys="expandedRowKeys"
-               :customRow="Rowclick"
-               :data-source="spotContractList">
-        <!-- 额外的展开行 -->
-        <template #expandedRowRender="{  }">
-          <BtnList :btnList="forDataBtn" />
-        </template>
-        <!-- <template #userinfotype="{ text }">
-          <a>{{ text === '2' ? '企业' : '个人'}}</a>
-        </template> -->
-      </a-table>
-    </contextMenu>
-    <!-- 现货合同: 详情 -->
-    <SpotContractDeatil :selectedRow="selectedRow" />
-    <!-- 现货合同: 审核 -->
-    <Check />
-    <!-- 现货合同: 撤销 -->
-    <Cancel />
-  </div>
+    <!-- 现货合同: 待审核-->
+    <div class="spot-contract-peddding"
+         :loading="loading">
+        <filterCustomTable @search="search">
+            <BtnList :btnList="commonBtn"/>
+        </filterCustomTable>
+        <contextMenu :contextMenuList="forDataBtn">
+            <a-table :columns="columns"
+                     class="topTable hiddenFirstCol"
+                     :pagination="false"
+                     rowKey="key"
+                     :expandedRowKeys="expandedRowKeys"
+                     :customRow="Rowclick"
+                     :data-source="tableList">
+                <!-- 额外的展开行 -->
+                <template #expandedRowRender="{  }">
+                    <BtnList :btnList="forDataBtn"/>
+                </template>
+                <!-- <template #userinfotype="{ text }">
+                  <a>{{ text === '2' ? '企业' : '个人'}}</a>
+                </template> -->
+
+                <template #biztype="{ text }">
+                    <a>{{ getBizTypeName(text) }}</a>
+                </template>
+
+                <template #pricetype="{ text }">
+                    <a>{{ getPriceTypeName(text) }}</a>
+                </template>
+
+                <template #contracctstatus="{ text }">
+                    <a>{{ getContractStatusName(text) }}</a>
+                </template>
+
+                <template #contracttype="{ text }">
+                    <a>{{ getContractTypeName(text) }}</a>
+                </template>
+
+            </a-table>
+        </contextMenu>
+        <!-- 现货合同: 详情 -->
+        <SpotContractDeatil :selectedRow="selectedRow" @refresh="queryTable"/>
+        <!-- 现货合同: 审核 -->
+        <Check :selectedRow="selectedRow" @refresh="queryTable"/>
+        <!-- 现货合同: 撤销 -->
+        <Cancel :selectedRow="selectedRow" @refresh="queryTable"/>
+    </div>
 </template>
 
 <script lang="ts">
-import { defineComponent, initData, getTableColumns, getTableEvent, getBtnList, contextMenu, BtnList } from '@/common/export/table';
-import { AddSpotContract, SpotContractDeatil, Check, Cancel, filterCustomTable } from '../../components';
-import { queryTableList, getFilterTableCB, Ermcp3ContractRsp } from '../index';
+import {
+    defineComponent,
+    initData,
+    getTableColumns,
+    getTableEvent,
+    getBtnList,
+    contextMenu,
+    BtnList
+} from '@/common/export/table';
+import {AddSpotContract, SpotContractDeatil, Check, Cancel, filterCustomTable} from '../../components';
+import {queryTableList, getFilterTableCB, Ermcp3ContractRsp} from '../index';
+import {
+    getBizTypeName,
+    getContractStatusName,
+    getContractTypeName,
+    getPriceTypeName
+} from "@/views/information/spot-contract/setup";
 
 export default defineComponent({
     name: 'spot-contract-peddding',
@@ -49,19 +80,21 @@ export default defineComponent({
     },
     setup() {
         // 表头数据
-        const { columns, registerColumn, updateColumn, filteredInfo } = getTableColumns();
+        const {columns, registerColumn, updateColumn, filteredInfo} = getTableColumns();
         // 表格事件
-        const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<Ermcp3ContractRsp>({});
+        const {expandedRowKeys, selectedRow, Rowclick} = getTableEvent<Ermcp3ContractRsp>({});
         // 表格操作按钮列表
-        const { commonBtn, forDataBtn } = getBtnList('spot_contract_checkpending', true);
+        const {commonBtn, forDataBtn} = getBtnList('spot_contract_checkpending', true);
         // 表格列表数据
-        const { loading, tableList, queryTable } = queryTableList(2);
+        const {loading, tableList, queryTable} = queryTableList(2);
+
         // 查询
         function search(value: any) {
             filteredInfo.value = value;
             // 更新表信息
             updateColumn();
         }
+
         initData(() => {
             // 获取列表数据
             queryTable();
@@ -79,6 +112,11 @@ export default defineComponent({
             loading,
             tableList,
             search,
+            queryTable,
+            getBizTypeName,
+            getPriceTypeName,
+            getContractStatusName,
+            getContractTypeName,
         };
     },
 });

+ 27 - 2
src/views/information/spot-contract/list/finished/index.vue

@@ -12,7 +12,7 @@
                :expandedRowKeys="expandedRowKeys"
                :customRow="Rowclick"
                rowKey="key"
-               :data-source="spotContractList">
+               :data-source="tableList">
         <!-- 额外的展开行 -->
         <template #expandedRowRender="{  }">
           <BtnList :btnList="forDataBtn" />
@@ -20,12 +20,27 @@
         <!-- <template #userinfotype="{ text }">
           <a>{{ text === '2' ? '企业' : '个人'}}</a>
         </template> -->
+          <template #biztype="{ text }">
+              <a>{{ getBizTypeName(text) }}</a>
+          </template>
+
+          <template #pricetype="{ text }">
+              <a>{{ getPriceTypeName(text) }}</a>
+          </template>
+
+          <template #contracctstatus="{ text }">
+              <a>{{ getContractStatusName(text) }}</a>
+          </template>
+
+          <template #contracttype="{ text }">
+              <a>{{ getContractTypeName(text) }}</a>
+          </template>
       </a-table>
     </contextMenu>
     <!-- 新增现货合同 -->
     <AddSpotContract />
     <!-- 现货合同: 详情 -->
-    <SpotContractDeatil :selectedRow="selectedRow" />
+    <SpotContractDeatil :selectedRow="selectedRow" @refresh="queryTable"/>
   </div>
 </template>
 
@@ -34,6 +49,12 @@ import { defineComponent, initData, getTableColumns, getTableEvent, getBtnList,
 import { AddSpotContract, SpotContractDeatil, filterCustomTable } from '../../components';
 
 import { queryTableList, getFilterTableCB, Ermcp3ContractRsp } from '../index';
+import {
+    getBizTypeName,
+    getContractStatusName,
+    getContractTypeName,
+    getPriceTypeName
+} from "@/views/information/spot-contract/setup";
 
 export default defineComponent({
     name: 'spot-contract-done',
@@ -76,6 +97,10 @@ export default defineComponent({
             loading,
             tableList,
             search,
+            getBizTypeName,
+            getPriceTypeName,
+            getContractStatusName,
+            getContractTypeName,
         };
     },
 });

+ 28 - 3
src/views/information/spot-contract/list/performance/index.vue

@@ -12,7 +12,7 @@
                :expandedRowKeys="expandedRowKeys"
                :customRow="Rowclick"
                rowKey="key"
-               :data-source="spotContractList">
+               :data-source="tableList">
         <!-- 额外的展开行 -->
         <template #expandedRowRender="{  }">
           <BtnList :btnList="forDataBtn" />
@@ -20,12 +20,27 @@
         <!-- <template #userinfotype="{ text }">
           <a>{{ text === '2' ? '企业' : '个人'}}</a>
         </template> -->
+          <template #biztype="{ text }">
+              <a>{{ getBizTypeName(text) }}</a>
+          </template>
+
+          <template #pricetype="{ text }">
+              <a>{{ getPriceTypeName(text) }}</a>
+          </template>
+
+          <template #contracctstatus="{ text }">
+              <a>{{ getContractStatusName(text) }}</a>
+          </template>
+
+          <template #contracttype="{ text }">
+              <a>{{ getContractTypeName(text) }}</a>
+          </template>
       </a-table>
     </contextMenu>
     <!-- 现货合同: 详情 -->
-    <SpotContractDeatil :selectedRow="selectedRow" />
+    <SpotContractDeatil :selectedRow="selectedRow" @refresh="queryTable"/>
     <!-- 现货合同: 正常完结 -->
-    <Finish />
+    <Finish :selectedRow="selectedRow" @refresh="queryTable"/>
   </div>
 </template>
 
@@ -34,6 +49,12 @@ import { defineComponent, initData, getTableColumns, getTableEvent, getBtnList,
 import { AddSpotContract, SpotContractDeatil, filterCustomTable, Finish } from '../../components';
 
 import { queryTableList, getFilterTableCB, Ermcp3ContractRsp } from '../index';
+import {
+    getBizTypeName,
+    getContractStatusName,
+    getContractTypeName,
+    getPriceTypeName
+} from "@/views/information/spot-contract/setup";
 
 export default defineComponent({
     name: 'spot-contract-performance',
@@ -77,6 +98,10 @@ export default defineComponent({
             loading,
             tableList,
             search,
+            getBizTypeName,
+            getPriceTypeName,
+            getContractStatusName,
+            getContractTypeName,
         };
     },
 });

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

@@ -1,45 +1,84 @@
 <template>
-  <!-- 现货合同: 未提交-->
-  <div class="spot-contract-not-commit"
-       :loading="loading">
-    <filterCustomTable @search="search">
-      <BtnList :btnList="commonBtn" />
-    </filterCustomTable>
-    <contextMenu :contextMenuList="forDataBtn">
-      <a-table :columns="columns"
-               class="topTable"
-               :pagination="false"
-               :expandedRowKeys="expandedRowKeys"
-               :customRow="Rowclick"
-               rowKey="key"
-               :data-source="spotContractList">
-        <!-- 额外的展开行 -->
-        <template #expandedRowRender="{  }">
-          <BtnList :btnList="forDataBtn" />
-        </template>
-        <!-- <template #userinfotype="{ text }">
-          <a>{{ text === '2' ? '企业' : '个人'}}</a>
-        </template> -->
-      </a-table>
-    </contextMenu>
-    <!-- 新增现货合同 -->
-    <AddSpotContract />
-    <!-- 现货合同: 详情 -->
-    <SpotContractDeatil :selectedRow="selectedRow" />
-    <!-- 现货合同: 修改 -->
-    <ModifySpotContract />
-    <!-- 现货合同: 删除 -->
-    <DeleteSpotContract />
-    <!-- 现货合同: 重新提交 -->
-    <ResubmitSpotContract />
-  </div>
+    <!-- 现货合同: 未提交-->
+    <div class="spot-contract-not-commit"
+         :loading="loading">
+        <filterCustomTable @search="search">
+            <BtnList :btnList="commonBtn"/>
+        </filterCustomTable>
+        <contextMenu :contextMenuList="forDataBtn">
+            <a-table :columns="columns"
+                     class="topTable"
+                     :pagination="false"
+                     :expandedRowKeys="expandedRowKeys"
+                     :customRow="Rowclick"
+                     rowKey="key"
+                     :data-source="tableList">
+                <!-- 额外的展开行 -->
+                <template #expandedRowRender="{  }">
+                    <BtnList :btnList="forDataBtn"/>
+                </template>
+                <!-- <template #userinfotype="{ text }">
+                  <a>{{ text === '2' ? '企业' : '个人'}}</a>
+                </template> -->
+                <template #biztype="{ text }">
+                    <a>{{ getBizTypeName(text) }}</a>
+                </template>
+
+                <template #pricetype="{ text }">
+                    <a>{{ getPriceTypeName(text) }}</a>
+                </template>
+
+                <template #contracctstatus="{ text }">
+                    <a>{{ getContractStatusName(text) }}</a>
+                </template>
+
+                <template #contracttype="{ text }">
+                    <a>{{ getContractTypeName(text) }}</a>
+                </template>
+            </a-table>
+        </contextMenu>
+        <!-- 新增现货合同 -->
+        <AddSpotContract/>
+        <!-- 现货合同: 详情 -->
+        <SpotContractDeatil :selectedRow="selectedRow"
+                            @refresh="queryTable"/>
+        <!-- 现货合同: 修改 -->
+        <ModifySpotContract :selectedRow="selectedRow"
+                            @refresh="queryTable"/>
+        <!-- 现货合同: 删除 -->
+        <DeleteSpotContract :selectedRow="selectedRow"
+                            @refresh="queryTable"/>
+        <!-- 现货合同: 重新提交 -->
+        <ResubmitSpotContract/>
+    </div>
 </template>
 
 <script lang="ts">
-import { defineComponent, initData, getTableColumns, getTableEvent, getBtnList, contextMenu, BtnList } from '@/common/export/table';
-import { AddSpotContract, SpotContractDeatil, filterCustomTable, ModifySpotContract, DeleteSpotContract, ResubmitSpotContract } from '../../components';
+import {
+    defineComponent,
+    initData,
+    getTableColumns,
+    getTableEvent,
+    getBtnList,
+    contextMenu,
+    BtnList
+} from '@/common/export/table';
+import {
+    AddSpotContract,
+    SpotContractDeatil,
+    filterCustomTable,
+    ModifySpotContract,
+    DeleteSpotContract,
+    ResubmitSpotContract
+} from '../../components';
 
-import { queryTableList, getFilterTableCB, Ermcp3ContractRsp } from '../index';
+import {queryTableList, getFilterTableCB, Ermcp3ContractRsp} from '../index';
+import {
+    getBizTypeName,
+    getContractStatusName,
+    getContractTypeName,
+    getPriceTypeName
+} from "@/views/information/spot-contract/setup";
 
 export default defineComponent({
     name: 'spot-contract-not-commit',
@@ -55,19 +94,21 @@ export default defineComponent({
     },
     setup() {
         // 表头数据
-        const { columns, registerColumn, updateColumn, filteredInfo } = getTableColumns();
+        const {columns, registerColumn, updateColumn, filteredInfo} = getTableColumns();
         // 表格事件
-        const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<Ermcp3ContractRsp>({});
+        const {expandedRowKeys, selectedRow, Rowclick} = getTableEvent<Ermcp3ContractRsp>({});
         // 表格操作按钮列表
-        const { commonBtn, forDataBtn } = getBtnList('spot_contract_unsubmitted', true);
+        const {commonBtn, forDataBtn} = getBtnList('spot_contract_unsubmitted', true);
         // 表格列表数据
-        const { loading, tableList, queryTable } = queryTableList(1);
+        const {loading, tableList, queryTable} = queryTableList(1);
+
         // 查询
         function search(value: any) {
             filteredInfo.value = value;
             // 更新表信息
             updateColumn();
         }
+
         initData(() => {
             // 获取列表数据
             queryTable();
@@ -85,6 +126,11 @@ export default defineComponent({
             loading,
             tableList,
             search,
+            queryTable,
+            getBizTypeName,
+            getPriceTypeName,
+            getContractStatusName,
+            getContractTypeName,
         };
     },
 });

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

@@ -47,4 +47,42 @@ export function getPriceTypeName(state: number): string {
             break
     }
     return result
-}
+}
+
+/**
+ * 业务类型返回 业务类型 1-套保 2-套利
+ * @param state
+ */
+export function getBizTypeName(state: number): string {
+    let result = "--";
+    switch (state) {
+        case 1:
+            result = "套保";
+            break
+        case 2:
+            result = "套利";
+            break
+    }
+    return result
+}
+
+/**
+ * 获取合同类型名称 现货合同类型 - 1:采购 -1:销售
+ */
+export function getContractTypeName(type: number): string{
+    let result = "--";
+    switch (type){
+        case 1:
+            result = "采购"
+            break;
+        case -1:
+            result = "销售"
+            break;
+    }
+    return result
+}
+
+
+/************** 接口相关提示 **************** /
+ *
+ */

+ 114 - 79
src/views/information/warehouse-info/compoments/disable/index.vue

@@ -1,100 +1,135 @@
 <template>
-  <!-- 停用仓库信息-->
-  <a-modal class="commonModal warehouse-disable"
-           title="停用仓库信息"
-           v-model:visible="visible"
-           centered
-           :maskClosable="maskClosableFlag"
-           @cancel="cancel"
-           width="890px">
-    <template #footer>
-      <a-button key="submit"
-                class="cancelBtn"
-                @click="cancel">取消</a-button>
-      <a-button key="submit"
-                type="primary"
-                :loading="loading"
-                @click="submit">确认停用</a-button>
-    </template>
-    <a-form class="inlineForm"
-            :form="form"
-            @submit="handleSearch">
-      <a-row :gutter="24">
-        <a-col :span="12">
-          <a-form-item label="仓库类型">
-            <span class="white">自有库</span>
-          </a-form-item>
-        </a-col>
-        <a-col :span="12">
-          <a-form-item label="仓库名称">
-            <span class="white">深圳市南储公司2号库房</span>
-          </a-form-item>
-        </a-col>
-      </a-row>
-      <a-row :gutter="24">
-        <a-col :span="12">
-          <a-form-item label="仓库简称">
-            <span class="white">南储深圳2号库</span>
-          </a-form-item>
-        </a-col>
-        <a-col :span="12">
-          <a-form-item label="联系人">
-            <span class="white">王平</span>
-          </a-form-item>
-        </a-col>
-      </a-row>
-      <a-row :gutter="24">
-        <a-col :span="12">
-          <a-form-item label="联系电话">
-            <span class="white">13832676234</span>
-          </a-form-item>
-        </a-col>
-        <a-col :span="12">
-          <a-form-item label="状态">
-            <span class="green">正常</span>
-          </a-form-item>
-        </a-col>
-      </a-row>
-      <a-row :gutter="24">
-        <a-col :span="12">
-          <a-form-item label="所在地区">
-            <span class="white">广东省深圳市南山区</span>
-          </a-form-item>
-        </a-col>
-        <a-col :span="12">
-          <a-form-item label="详细地址">
-            <span class="white">深南大道1290号仓库</span>
-          </a-form-item>
-        </a-col>
-      </a-row>
-    </a-form>
-  </a-modal>
+    <!-- 停用仓库信息-->
+    <a-modal class="commonModal warehouse-disable"
+             title="停用仓库信息"
+             v-model:visible="visible"
+             centered
+             :maskClosable="maskClosableFlag"
+             @cancel="cancel"
+             width="890px">
+        <template #footer>
+            <a-button key="cancel"
+                      class="cancelBtn"
+                      @click="cancel">取消
+            </a-button>
+            <a-button key="submit"
+                      type="primary"
+                      :loading="loading"
+                      @click="submit">确认停用
+            </a-button>
+        </template>
+        <a-form class="inlineForm"
+                :form="form"
+                @submit="handleSearch">
+            <a-row :gutter="24">
+                <a-col :span="12">
+                    <a-form-item label="仓库类型">
+                        <span class="white">{{ getWareHouseTypeName(selectedRow.warehousetype) }}</span>
+                    </a-form-item>
+                </a-col>
+                <a-col :span="12">
+                    <a-form-item label="仓库名称">
+                        <span class="white">{{ formatValue(selectedRow.warehousename) }}</span>
+                    </a-form-item>
+                </a-col>
+            </a-row>
+            <a-row :gutter="24">
+                <a-col :span="12">
+                    <a-form-item label="仓库简称">
+                        <span class="white">{{ formatValue(selectedRow.warehousecode) }}</span>
+                    </a-form-item>
+                </a-col>
+                <a-col :span="12">
+                    <a-form-item label="联系人">
+                        <span class="white">{{ formatValue(selectedRow.contactname) }}</span>
+                    </a-form-item>
+                </a-col>
+            </a-row>
+            <a-row :gutter="24">
+                <a-col :span="12">
+                    <a-form-item label="联系电话">
+                        <span class="white">{{ formatValue(selectedRow.contactnum) }}</span>
+                    </a-form-item>
+                </a-col>
+                <a-col :span="12">
+                    <a-form-item label="状态">
+                        <span class="white">{{ gerWareHouseStatusName(selectedRow.warehousestatus) }}</span>
+                    </a-form-item>
+                </a-col>
+            </a-row>
+            <a-row :gutter="24">
+                <a-col :span="12">
+                    <a-form-item label="所在地区">
+                        <span class="white">{{ formatValue(selectedRow.address) }}</span>
+                    </a-form-item>
+                </a-col>
+                <a-col :span="12">
+                    <a-form-item label="详细地址">
+                        <span class="white">{{ formatValue(selectedRow.address) }}</span>
+                    </a-form-item>
+                </a-col>
+            </a-row>
+        </a-form>
+    </a-modal>
 </template>
 
 <script lang="ts">
-import { defineComponent, ref } from 'vue';
-import { closeModal } from '@/common/setup/modal/index';
+import {defineComponent, PropType, ref} from 'vue';
+import {closeModal} from '@/common/setup/modal/index';
+import {stopOrResumeWarehouse, wareType} from "@/views/information/warehouse-info/compoments/setup";
+import {ErmcpWareHouseInfo} from "@/services/go/ermcp/warehouse-info/interface";
+import {message, Modal} from "ant-design-vue";
+import {gerWareHouseStatusName, getWareHouseTypeName} from "@/views/information/warehouse-info/setup";
+import {formatValue} from "@/common/methods";
 
 export default defineComponent({
     name: 'warehouse_info_btn_disable',
     components: {},
-    setup() {
-        const { visible, cancel } = closeModal('warehouse_info_btn_disable');
-        const loading = ref<boolean>(false);
+    props: {
+        selectedRow: {
+            type: Object as PropType<ErmcpWareHouseInfo>,
+            default: {},
+        },
+    },
+    setup(props, context) {
+        const {visible, cancel} = closeModal('warehouse_info_btn_disable');
         const maskClosableFlag = ref<boolean>(false);
+        const {loading, changeStatus} = stopOrResumeWarehouse(wareType.stop);
+
         function submit() {
             loading.value = true;
-            setTimeout(() => {
-                loading.value = false;
-                cancel();
-            }, 2000);
+            Modal.confirm({
+                title: '是否确认停用仓库信息',
+                okText: '确认停用',
+                cancelText: '取消',
+                onOk() {
+                    console.log('OK');
+                    changeStatus(props.selectedRow.autoid)
+                        .then(res => {
+
+                            message.success(res)
+                            context.emit('refresh')
+                            cancel()
+                        })
+                        .catch(err => {
+                            message.error(err)
+                        })
+                },
+                onCancel() {
+                    console.log('Cancel');
+                },
+            });
         }
+
         return {
             visible,
             cancel,
             submit,
             loading,
             maskClosableFlag,
+            gerWareHouseStatusName,
+            getWareHouseTypeName,
+            formatValue,
         };
     },
 });

+ 113 - 79
src/views/information/warehouse-info/compoments/recover/index.vue

@@ -1,100 +1,134 @@
 <template>
-  <!-- 恢复仓库信息-->
-  <a-modal class="modify-custom"
-           title="恢复仓库信息"
-           v-model:visible="visible"
-           centered
-           :maskClosable="maskClosableFlag"
-           @cancel="cancel"
-           width="890px">
-    <template #footer>
-      <a-button key="submit"
-                class="cancelBtn"
-                @click="cancel">取消</a-button>
-      <a-button key="submit"
-                type="primary"
-                :loading="loading"
-                @click="submit">确认恢复</a-button>
-    </template>
-    <a-form class="inlineForm"
-              :form="form"
-              @submit="handleSearch">
-          <a-row :gutter="24">
-              <a-col :span="12">
-                  <a-form-item label="仓库类型">
-                      <span class="white">{{ getWareHouseTypeName(selectedRow.warehousetype) }}</span>
-                  </a-form-item>
-              </a-col>
-              <a-col :span="12">
-                  <a-form-item label="仓库名称">
-                      <span class="white">{{ formatValue(selectedRow.warehousename)}}</span>
-                  </a-form-item>
-              </a-col>
-          </a-row>
-          <a-row :gutter="24">
-              <a-col :span="12">
-                  <a-form-item label="仓库简称">
-                      <span class="white">{{ formatValue(selectedRow.warehousecode) }}</span>
-                  </a-form-item>
-              </a-col>
-              <a-col :span="12">
-                  <a-form-item label="联系人">
-                      <span class="white">{{ formatValue(selectedRow.contactname) }}</span>
-                  </a-form-item>
-              </a-col>
-          </a-row>
-          <a-row :gutter="24">
-              <a-col :span="12">
-                  <a-form-item label="联系电话">
-                      <span class="white">{{ formatValue(selectedRow.contactnum) }}</span>
-                  </a-form-item>
-              </a-col>
-              <a-col :span="12">
-                  <a-form-item label="状态">
-                      <span class="red">{{ gerWareHouseStatusName(selectedRow.warehousestatus) }}</span>
-                  </a-form-item>
-              </a-col>
-          </a-row>
-          <a-row :gutter="24">
-              <a-col :span="12">
-                  <a-form-item label="所在地区">
-                      <span class="white">{{ formatValue(selectedRow.address) }}</span>
-                  </a-form-item>
-              </a-col>
-              <a-col :span="12">
-                  <a-form-item label="详细地址">
-                      <span class="white">{{ formatValue(selectedRow.address) }}</span>
-                  </a-form-item>
-              </a-col>
-          </a-row>
-      </a-form>
-  </a-modal>
+    <!-- 恢复仓库信息-->
+    <a-modal class="modify-custom"
+             title="恢复仓库信息"
+             v-model:visible="visible"
+             centered
+             :maskClosable="maskClosableFlag"
+             @cancel="cancel"
+             width="890px">
+        <template #footer>
+            <a-button key="submit"
+                      class="cancelBtn"
+                      @click="cancel">取消
+            </a-button>
+            <a-button key="submit"
+                      type="primary"
+                      :loading="loading"
+                      @click="submit">确认恢复
+            </a-button>
+        </template>
+        <a-form class="inlineForm"
+                :form="form"
+                @submit="handleSearch">
+            <a-row :gutter="24">
+                <a-col :span="12">
+                    <a-form-item label="仓库类型">
+                        <span class="white">{{ getWareHouseTypeName(selectedRow.warehousetype) }}</span>
+                    </a-form-item>
+                </a-col>
+                <a-col :span="12">
+                    <a-form-item label="仓库名称">
+                        <span class="white">{{ formatValue(selectedRow.warehousename) }}</span>
+                    </a-form-item>
+                </a-col>
+            </a-row>
+            <a-row :gutter="24">
+                <a-col :span="12">
+                    <a-form-item label="仓库简称">
+                        <span class="white">{{ formatValue(selectedRow.warehousecode) }}</span>
+                    </a-form-item>
+                </a-col>
+                <a-col :span="12">
+                    <a-form-item label="联系人">
+                        <span class="white">{{ formatValue(selectedRow.contactname) }}</span>
+                    </a-form-item>
+                </a-col>
+            </a-row>
+            <a-row :gutter="24">
+                <a-col :span="12">
+                    <a-form-item label="联系电话">
+                        <span class="white">{{ formatValue(selectedRow.contactnum) }}</span>
+                    </a-form-item>
+                </a-col>
+                <a-col :span="12">
+                    <a-form-item label="状态">
+                        <span class="white">{{ gerWareHouseStatusName(selectedRow.warehousestatus) }}</span>
+                    </a-form-item>
+                </a-col>
+            </a-row>
+            <a-row :gutter="24">
+                <a-col :span="12">
+                    <a-form-item label="所在地区">
+                        <span class="white">{{ formatValue(selectedRow.address) }}</span>
+                    </a-form-item>
+                </a-col>
+                <a-col :span="12">
+                    <a-form-item label="详细地址">
+                        <span class="white">{{ formatValue(selectedRow.address) }}</span>
+                    </a-form-item>
+                </a-col>
+            </a-row>
+        </a-form>
+    </a-modal>
 </template>
 
 <script lang="ts">
-import { defineComponent, ref } from 'vue';
-import { closeModal } from '@/common/setup/modal/index';
+import {defineComponent, PropType, ref} from 'vue';
+import {closeModal} from '@/common/setup/modal/index';
+import {ErmcpWareHouseInfo} from "@/services/go/ermcp/warehouse-info/interface";
+import {stopOrResumeWarehouse, wareType} from "@/views/information/warehouse-info/compoments/setup";
+import {message, Modal} from "ant-design-vue";
+import {gerWareHouseStatusName, getWareHouseTypeName} from "@/views/information/warehouse-info/setup";
+import {formatValue} from "@/common/methods";
 
 export default defineComponent({
     name: 'warehouse_info_btn_recover',
     components: {},
-    setup() {
-        const { visible, cancel } = closeModal('warehouse_info_btn_recover');
-        const loading = ref<boolean>(false);
+    props: {
+        selectedRow: {
+            type: Object as PropType<ErmcpWareHouseInfo>,
+            default: {},
+        },
+    },
+    setup(props, context) {
+        const {visible, cancel} = closeModal('warehouse_info_btn_recover');
+        const {loading, changeStatus} = stopOrResumeWarehouse(wareType.normal);
         const maskClosableFlag = ref<boolean>(false);
+
         function submit() {
             loading.value = true;
-            setTimeout(() => {
-                loading.value = false;
-                cancel();
-            }, 2000);
+            Modal.confirm({
+                title: '是否确认恢复仓库信息',
+                okText: '确认恢复',
+                cancelText: '取消',
+                onOk() {
+                    console.log('OK');
+                    changeStatus(props.selectedRow.autoid)
+                        .then(res => {
+                            message.success(res)
+                            context.emit('refresh')
+                            cancel()
+                        })
+                        .catch(err => {
+                            message.error(err)
+                        })
+                },
+                onCancel() {
+                    console.log('Cancel');
+                },
+            });
         }
+
         return {
             visible,
             cancel,
             submit,
             loading,
             maskClosableFlag,
+            gerWareHouseStatusName,
+            getWareHouseTypeName,
+            formatValue,
         };
     },
 });

+ 58 - 0
src/views/information/warehouse-info/compoments/setup.ts

@@ -0,0 +1,58 @@
+import {warehouseStateChangeReq} from "@/services/proto/warehouse";
+import {WarehouseStateChangeReq} from "@/services/proto/warehouse/interface";
+import {getSelectedAccountId} from "@/services/bus/account";
+import {ref} from "vue";
+
+export const enum wareType {
+    normal = 1, // 正常
+    stop = 2, // 停用
+}
+
+/**
+ * 更变仓库信息状态
+ * @param type normal: 将停用恢复成正常  stop: 将正常设置为停用
+ */
+export function stopOrResumeWarehouse(type: wareType){
+    const loading = ref<boolean>(false);
+    let warehousestatus = 1;
+    switch (type) {
+        case wareType.normal:
+            warehousestatus = 1  // 恢复
+            break;
+        case wareType.stop:
+            warehousestatus = 2  // 停用
+            break;
+    }
+    /**
+     * 提交切换状态请求
+     * @param warehouseid 操作的仓库id
+     */
+    function changeStatus(warehouseid: number): Promise<string>{
+        let accountid = getSelectedAccountId()?.toNumber()
+        const req: WarehouseStateChangeReq = {
+            accountid: accountid === undefined ? 0 : accountid,
+            warehouseid: warehouseid,
+            warehousestatus: warehousestatus
+        }
+        debugger
+        return warehouseStateChangeReq(req)
+            .then(res => {
+                if(warehousestatus === 1){
+                    return Promise.resolve("恢复成功")
+                }else{
+                    return Promise.resolve("停用成功")
+                }
+            })
+            .catch(err => {
+                if(warehousestatus === 1){
+                    return Promise.reject("恢复失败:"+ err)
+                }else{
+                    return Promise.reject("停用失败:"+ err)
+                }
+            })
+            .finally(() => {
+                loading.value = false
+            })
+    }
+    return {loading, changeStatus}
+}

+ 61 - 42
src/views/information/warehouse-info/list/normal-use/index.vue

@@ -1,45 +1,61 @@
 <template>
-  <!-- 仓库信息: 正常 -->
-  <div class="warehouse-info-normal"
-       :loading="loading">
-    <filterCustomTable @search="search">
-      <BtnList :btnList="commonBtn" />
-    </filterCustomTable>
-    <contextMenu :contextMenuList="forDataBtn">
-      <a-table :columns="columns"
-               class="topTable"
-               :pagination="false"
-               :expandedRowKeys="expandedRowKeys"
-               :customRow="Rowclick"
-               rowKey="key"
-               :data-source="tableList">
-        <!-- 额外的展开行 -->
-        <template #expandedRowRender="{  }">
-          <BtnList :btnList="forDataBtn" />
-        </template>
-        <template #warehousetype="{ text }">
-          <span>{{ getWareHouseTypeName(text) }}</span>
-        </template>
-        <template #warehousestatus="{ text }">
-          <span>{{ gerWareHouseStatusName(text) }}</span>
-        </template>
-      </a-table>
-    </contextMenu>
-    <!-- 新增仓库信息 -->
-    <Add />
-    <!-- 停用仓库信息 -->
-    <Disable />
-    <!-- 仓库信息详情 -->
-    <Detail :selectedRow="selectedRow" />
-    <!-- 修改仓息库信 -->
-    <Modify />
-  </div>
+    <!-- 仓库信息: 正常 -->
+    <div class="warehouse-info-normal"
+         :loading="loading">
+        <filterCustomTable @search="search">
+            <BtnList :btnList="commonBtn"/>
+        </filterCustomTable>
+        <contextMenu :contextMenuList="forDataBtn">
+            <a-table :columns="columns"
+                     class="topTable"
+                     :pagination="false"
+                     :expandedRowKeys="expandedRowKeys"
+                     :customRow="Rowclick"
+                     rowKey="key"
+                     :data-source="tableList">
+                <!-- 额外的展开行 -->
+                <template #expandedRowRender="{  }">
+                    <BtnList :btnList="forDataBtn"/>
+                </template>
+                <template #warehousetype="{ text }">
+                    <span>{{ getWareHouseTypeName(text) }}</span>
+                </template>
+                <template #warehousestatus="{ text }">
+                    <span>{{ gerWareHouseStatusName(text) }}</span>
+                </template>
+            </a-table>
+        </contextMenu>
+        <!-- 新增仓库信息 -->
+        <Add/>
+        <!-- 停用仓库信息 -->
+        <Disable :selectedRow="selectedRow"
+                 @refresh="queryTable"/>
+        <!-- 仓库信息详情 -->
+        <Detail :selectedRow="selectedRow"
+                @refresh="queryTable"/>
+        <!-- 修改仓息库信 -->
+        <Modify/>
+    </div>
 </template>
 
 <script lang="ts">
-import { defineComponent, initData, getTableColumns, getTableEvent, getBtnList, contextMenu, BtnList } from '@/common/export/table';
-import { filterCustomTable, Add, Disable, Detail, Modify } from '../../compoments';
-import { gerWareHouseStatusName, getWareHouseTypeName, queryTableList, getFilterTableCB, ErmcpWareHouseInfo } from '../index';
+import {
+    defineComponent,
+    initData,
+    getTableColumns,
+    getTableEvent,
+    getBtnList,
+    contextMenu,
+    BtnList
+} from '@/common/export/table';
+import {filterCustomTable, Add, Disable, Detail, Modify} from '../../compoments';
+import {
+    gerWareHouseStatusName,
+    getWareHouseTypeName,
+    queryTableList,
+    getFilterTableCB,
+    ErmcpWareHouseInfo
+} from '../index';
 
 export default defineComponent({
     name: 'warehouse-info-normal',
@@ -54,25 +70,27 @@ export default defineComponent({
     },
     setup() {
         // 表头数据
-        const { columns, registerColumn, updateColumn, filteredInfo } = getTableColumns();
+        const {columns, registerColumn, updateColumn, filteredInfo} = getTableColumns();
         // 表格事件
-        const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<ErmcpWareHouseInfo>({});
+        const {expandedRowKeys, selectedRow, Rowclick} = getTableEvent<ErmcpWareHouseInfo>({});
         // 表格操作按钮列表
-        const { commonBtn, forDataBtn } = getBtnList('warehouse_info_normal', true);
+        const {commonBtn, forDataBtn} = getBtnList('warehouse_info_normal', true);
         // 表格列表数据
-        const { loading, tableList, queryTable } = queryTableList('1');
+        const {loading, tableList, queryTable} = queryTableList('1');
         initData(() => {
             // 获取列表数据
             queryTable();
             // 注册表头信息 过滤
             registerColumn('table_pcweb_warehouse', getFilterTableCB);
         });
+
         // 查询
         function search(value: any) {
             filteredInfo.value = value;
             // 更新表信息
             updateColumn();
         }
+
         return {
             columns,
             filteredInfo,
@@ -86,6 +104,7 @@ export default defineComponent({
             search,
             getWareHouseTypeName,
             gerWareHouseStatusName,
+            queryTable,
         };
     },
 });

+ 3 - 1
src/views/information/warehouse-info/list/stop-use/index.vue

@@ -27,7 +27,8 @@
     <!-- 新增仓库信息 -->
     <Add />
     <!-- 恢复仓库信息 -->
-    <Recover />
+    <Recover :selectedRow="selectedRow"
+             @refresh="queryTable"/>
   </div>
 </template>
 
@@ -79,6 +80,7 @@ export default defineComponent({
             search,
             getWareHouseTypeName,
             gerWareHouseStatusName,
+            queryTable,
         };
     },
 });