Переглянути джерело

修改商品合约 议价单

huangbin 4 роки тому
батько
коміт
df36e31a83

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

@@ -137,4 +137,9 @@ export enum UserType {
     investment, //投资者
     customer, //客户
     memberOfTheEnterprise, // 企业成员
+}
+
+export enum ApplyType {
+    my = 1, // 我的申请
+    counterpart, // 对方申请
 }

+ 3 - 0
src/common/constants/enumsName.ts

@@ -923,6 +923,9 @@ export function getPickUpStatusName(type: number) {
 export function getScfContractStatusName(type: number) {
     let result = "--"
     switch (type) {
+        case 0:
+            result = "未提交";
+            break;
         case 1:
             result = '待审核'
             break

+ 2 - 0
src/utils/eventBus/index.ts

@@ -20,6 +20,8 @@ interface EnentNamesOnlyOneValue {
     posChangedNtf: string; //接收到头寸变化通知
     moneyChangedNtf: string; //接收到资金变化通知
 
+    bargain: string; // 议价单
+
     orderCanceledNtf: string; //接收到委托单撤单通知
     quoteReceiveNtf: string; // 接收实时行情推送
 }

+ 35 - 11
src/views/order/commodity_contract/components/commodity_contract_bargain/index.vue

@@ -15,13 +15,19 @@
       <!-- 额外的展开行 -->
       <template v-if="btnList.length"
                 #expandedRowRender="{ record }">
-        <BtnList :btnList="btnList"
+        <BtnList :btnList="handleBtnList(record, btnList)"
                  :record="record"
                  class="btn-list-sticky"
                  @click="openComponent" />
       </template>
-      <template #createtime="{ record }">
-        <a>{{ formatTime(record.createtime) }}</a>
+      <template #applytime="{ text }">
+        <span>{{ formatTime(text) }}</span>
+      </template>
+      <template #buyorsell="{ text }">
+        <span>{{ getBuyOrSellName(text) }}</span>
+      </template>
+      <template #applystatus="{ text }">
+        <span>{{ getScfContractStatusName(text) }}</span>
       </template>
     </a-table>
     <component :is="componentId"
@@ -49,7 +55,11 @@ import { TradeMode } from '@/common/constants/enumCommon';
 import { BtnListType } from '@/common/components/btnList/interface';
 import { columns } from './setup';
 import { queryTjmdTransferApply } from '@/services/go/Tjmd';
-import { QueryTjmdTransferApplyReq } from '@/services/go/Tjmd/interface';
+import { QueryTjmdTransferApplyReq, QueryTjmdTransferApplyRsp } from '@/services/go/Tjmd/interface';
+import Bus from '@/utils/eventBus/index';
+import { ref } from 'vue';
+import { ApplyType } from '@/common/constants/enumCommon';
+import { getBuyOrSellName, getScfContractStatusName } from '@/common/constants/enumsName';
 
 export default defineComponent({
     name: 'commodity_contract_bargain',
@@ -60,12 +70,14 @@ export default defineComponent({
         // commodity_contract_summary_deal_closed: defineAsyncComponent(() => import('./components/commodity_contract_summary_deal_closed/index.vue')),
     },
     setup() {
+        // 类型 1-我的申请 2-对方申请
+        const margainType = ref<number>(ApplyType.my);
         // 表格列表数据
-        const { loading, tableList, queryTable } = queryTableList<QueryTradePositionRsp>();
+        const { loading, tableList, queryTable } = queryTableList<QueryTjmdTransferApplyRsp>();
         // 交割商品
         handleDeliveryRelation();
         // 获取列表数据
-        const queryTableAction = (applytype: 1 | 2) => {
+        const queryTableAction = (applytype: ApplyType) => {
             const param: QueryTjmdTransferApplyReq = {
                 applytype,
             };
@@ -76,12 +88,22 @@ export default defineComponent({
             queryFn: () => queryTableAction(1),
             recordList: getRecordItemTab(),
         };
-
-        function handleBtnList(record: QueryTradePositionRsp, btnList: BtnListType[]) {
-            if (findGoodsTradeModeById(record.goodsid) === TradeMode.DiaoQi) {
-                return btnList.filter((e) => e.code === 'commodity_contract_summary_deal_closed');
+        // 切换 我的申请和对方申请
+        Bus.$onOnly('bargain', (value: ApplyType) => {
+            margainType.value = value;
+            queryTableAction(value);
+        });
+        function handleBtnList(record: QueryTjmdTransferApplyRsp, btnList: BtnListType[]) {
+            if (record.applystatus === 1) {
+                if (margainType.value === ApplyType.my) {
+                    // 我的申请
+                    return btnList.filter((e) => e.code === 'commodity_contract_bargain_cancel_order');
+                } else {
+                    // 对方的申请
+                    return btnList.filter((e) => e.code !== 'commodity_contract_bargain_cancel_order');
+                }
             } else {
-                return btnList.filter((e) => e.code !== 'commodity_contract_summary_deal_closed');
+                return [];
             }
         }
         return {
@@ -92,6 +114,8 @@ export default defineComponent({
             formatTime,
             expandIcon,
             handleBtnList,
+            getBuyOrSellName,
+            getScfContractStatusName,
         };
     },
 });

+ 14 - 5
src/views/order/commodity_contract/index.vue

@@ -7,10 +7,11 @@
     <thirdMenu :list="tabList"
                @selectMenu="changeTab"
                :value="'title'">
+      <!-- 议价单 -->
       <div class="goods-apply"
-           v-if="componentId === 'commodity_contract_bargain'">
-        <span>我的申请</span>
-        <span>对方申请</span>
+           v-if="componentId === BARGIN">
+        <span @click="changeBargain(ApplyType.my)">我的议价</span>
+        <span @click="changeBargain(ApplyType.counterpart)">对方议价</span>
       </div>
     </thirdMenu>
   </section>
@@ -21,6 +22,10 @@ import { defineAsyncComponent, defineComponent } from 'vue';
 import { enumOrderComponents } from '@/common/constants/enumOrderComponents';
 import thirdMenu from '@/common/components/thirdMenu/index.vue';
 import { handleOrderDetailList } from '@/common/setup/order/orderData';
+import Bus from '@/utils/eventBus/index';
+import { ApplyType } from '@/common/constants/enumCommon';
+
+const BARGIN = 'commodity_contract_bargain'; // 议价单
 
 export default defineComponent({
     name: enumOrderComponents.commodity_contract,
@@ -30,10 +35,14 @@ export default defineComponent({
         [enumOrderComponents.commodity_contract_commission]: defineAsyncComponent(() => import('./components/commodity_contract_commission/index.vue')),
         [enumOrderComponents.commodity_contract_make_deal]: defineAsyncComponent(() => import('./components/commodity_contract_make_deal/index.vue')),
         [enumOrderComponents.commodity_contract_settlement]: defineAsyncComponent(() => import('./components/commodity_contract_settlement/index.vue')),
-        commodity_contract_bargain: defineAsyncComponent(() => import('./components/commodity_contract_bargain/index.vue')),
+        [BARGIN]: defineAsyncComponent(() => import('./components/commodity_contract_bargain/index.vue')),
     },
     setup() {
-        return { ...handleOrderDetailList(enumOrderComponents.commodity_contract) };
+        // 切换 我的
+        function changeBargain(value: ApplyType) {
+            Bus.$emit('bargain', value);
+        }
+        return { ...handleOrderDetailList(enumOrderComponents.commodity_contract), changeBargain, BARGIN, ApplyType };
     },
 });
 </script>