Selaa lähdekoodia

feat: 迁入 rulesManagement 收/付款条件模块

从 kd-aiot-frontend 复制 rulesManagement/paymentTerms 整块及其硬依赖
receiveTerms 到 EOM,含列表页、搜索表单、收/付款条件弹窗与接口层。

接口统一走 /main/paymentConditionRules/*。EOM 与源项目网关前缀同为 /api,
指向同一后端,该地址在 EOM 已由 api/financialManage/advanceReceipt 使用;
而源项目 paymentTerms 自带的 /api/paymentTerms/* 会拼成 /api/api/...,
其 index.vue 实际引用的本就是 receiveTerms 那套,属于源项目里的死代码。

枚举沿用源项目字符串口径(ORDER_DATE 等),与后端 dateType 存储值一致。
因 EOM 的 enum/dict.js 已有同名 calcReceiveDateTypeOp(数字码 1~5),
同名导出会重复定义,改动全局那份又会波及既有 receiveTermsDialog,
故本模块枚举单独收敛在 views/rulesManagement/enum/dict.js,既有页面不受影响。

paymentTerms 的弹窗改为封装共用的收/付款条件弹窗并固定 terms,
替代源项目那份走失效接口、字段模型也不匹配的独立弹窗。

列 prop 与真实字段对齐,cacheKeyUrl 改 eom- 前缀避免与源项目列配置串号,
支付方式字典取值补齐空值兜底。生产构建通过。
xieyong 2 viikkoa sitten
vanhempi
commit
5c19b151be

+ 63 - 0
src/api/rulesManagement/paymentTerms/index.js

@@ -0,0 +1,63 @@
+import request from '@/utils/request';
+
+/**
+ * 付款条件接口
+ *
+ * 与收款条件共用后端 paymentConditionRules 一套接口,
+ * 通过请求体/表单里的 conditionConfigurationType 区分:
+ * rules = 收款条件,terms = 付款条件。
+ */
+
+// 获取付款条件列表
+export async function getTableList(data) {
+  const res = await request.post(`/main/paymentConditionRules/page`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 获取付款条件详情
+export async function getInfo(id) {
+  const res = await request.get(`/main/paymentConditionRules/getById/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 新增付款条件
+export async function addPaymentTerms(data) {
+  const res = await request.post(`/main/paymentConditionRules/save`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 修改付款条件
+export async function updatePaymentTerms(data) {
+  const res = await request.put(`/main/paymentConditionRules/update`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 启用停用
+export async function updateRuleState(data) {
+  const res = await request.put(`/main/paymentConditionRules/updateRuleState`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 删除付款条件
+export async function deleteInformation(id) {
+  const res = await request.get(`/main/paymentConditionRules/delete/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 55 - 0
src/api/rulesManagement/receiveTerms/index.js

@@ -0,0 +1,55 @@
+import request from '@/utils/request';
+
+// 获取收款条件列表
+export async function getTableList(data) {
+  const res = await request.post(`/main/paymentConditionRules/page`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 获取收款条件详情
+export async function getInfo(id) {
+  const res = await request.get(`/main/paymentConditionRules/getById/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 新增收款条件
+export async function addReceiveTerms(data) {
+  const res = await request.post(`/main/paymentConditionRules/save`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 修改收款条件
+export async function updateReceiveTerms(data) {
+  const res = await request.put(`/main/paymentConditionRules/update`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 启用停用
+export async function updateRuleState(data) {
+  const res = await request.put(`/main/paymentConditionRules/updateRuleState`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 删除收款条件
+export async function deleteInformation(id) {
+  const res = await request.get(`/main/paymentConditionRules/delete/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 79 - 0
src/views/rulesManagement/enum/dict.js

@@ -0,0 +1,79 @@
+/**
+ * rulesManagement(收/付款条件)模块专用枚举
+ *
+ * 取值口径沿用源项目 kd-aiot-frontend:dateType 存字符串枚举
+ * (ORDER_DATE / RECEIVABLE_DATE / PAYMENT_DATE ...),
+ * 与后端 paymentConditionRules.dateType 的实际存储值一致。
+ *
+ * 之所以独立成文件而不并入 @/enum/dict:
+ * EOM 的 @/enum/dict 里已存在一份同名 calcReceiveDateTypeOp(数字码 1~5),
+ * 被 financialManage/advanceReceipt/components/receiveTermsDialog.vue 使用;
+ * 两份同名导出会造成重复定义,改动全局那份又会波及既有页面。
+ * 因此本模块的枚举单独收敛在此处,既有页面行为不受影响。
+ */
+
+// 收款日计算日期枚举
+export const ReceiveDateCalcTypeEnum = {
+  ORDER_DATE: 'ORDER_DATE',
+  RECEIVABLE_DATE: 'RECEIVABLE_DATE',
+  INVOICE_DATE: 'INVOICE_DATE',
+  INVOICE_NATURAL_MONTH_END: 'INVOICE_NATURAL_MONTH_END',
+  STATEMENT_DATE: 'STATEMENT_DATE'
+};
+
+// 付款日计算日期枚举
+export const PaymentDateCalcTypeEnum = {
+  ORDER_DATE: 'ORDER_DATE',
+  PAYMENT_DATE: 'PAYMENT_DATE',
+  INVOICE_DATE: 'INVOICE_DATE',
+  INVOICE_NATURAL_MONTH_END: 'INVOICE_NATURAL_MONTH_END',
+  STATEMENT_DATE: 'STATEMENT_DATE'
+};
+
+// 收款日计算日期
+export const calcReceiveDateTypeOp = [
+  {
+    label: '订单日期',
+    value: ReceiveDateCalcTypeEnum.ORDER_DATE
+  },
+  {
+    label: '应收单日期',
+    value: ReceiveDateCalcTypeEnum.RECEIVABLE_DATE
+  },
+  {
+    label: '开票日期',
+    value: ReceiveDateCalcTypeEnum.INVOICE_DATE
+  },
+  {
+    label: '开票自然月截止日',
+    value: ReceiveDateCalcTypeEnum.INVOICE_NATURAL_MONTH_END
+  },
+  {
+    label: '对账单日期',
+    value: ReceiveDateCalcTypeEnum.STATEMENT_DATE
+  }
+];
+
+// 付款日计算日期
+export const calcPayDateTypeOp = [
+  {
+    label: '订单日期',
+    value: PaymentDateCalcTypeEnum.ORDER_DATE
+  },
+  {
+    label: '应付单日期',
+    value: PaymentDateCalcTypeEnum.PAYMENT_DATE
+  },
+  {
+    label: '开票日期',
+    value: PaymentDateCalcTypeEnum.INVOICE_DATE
+  },
+  {
+    label: '开票自然月截止日',
+    value: PaymentDateCalcTypeEnum.INVOICE_NATURAL_MONTH_END
+  },
+  {
+    label: '对账单日期',
+    value: PaymentDateCalcTypeEnum.STATEMENT_DATE
+  }
+];

+ 39 - 0
src/views/rulesManagement/paymentTerms/components/addDialog.vue

@@ -0,0 +1,39 @@
+<!-- 付款条件新增/编辑弹窗 -->
+<template>
+  <receive-terms-dialog
+    ref="dialog"
+    condition-type="terms"
+    @done="onDone"
+  />
+</template>
+
+<script>
+  import ReceiveTermsDialog from '@/views/rulesManagement/receiveTerms/components/addDialog.vue';
+
+  /**
+   * 付款条件弹窗
+   *
+   * 收款条件与付款条件在后端共用 paymentConditionRules 一套接口,
+   * 差异仅在 conditionConfigurationType(rules / terms)和对应的日计算日期枚举,
+   * 因此这里复用收/付款共用弹窗并固定 condition-type="terms",
+   * 避免两份字段模型一致的弹窗重复维护。
+   *
+   * 对外契约与列表页一致:open(type, row),type 取 add / edit / detail。
+   */
+  export default {
+    name: 'PaymentTermsAddDialog',
+    components: {
+      ReceiveTermsDialog
+    },
+    methods: {
+      // 新增/修改/详情入口
+      open(type, row) {
+        this.$refs.dialog.open(type, row);
+      },
+      // 弹窗保存成功后通知列表刷新
+      onDone() {
+        this.$emit('done');
+      }
+    }
+  };
+</script>

+ 55 - 0
src/views/rulesManagement/paymentTerms/components/searchForm.vue

@@ -0,0 +1,55 @@
+<!-- 搜索表单 -->
+<template>
+  <seekPage :seekList="seekList" :formLength="3" @search="search"></seekPage>
+</template>
+
+<script>
+  export default {
+    data() {
+      return {};
+    },
+    computed: {
+      seekList() {
+        return [
+          {
+            label: '关键词:',
+            value: 'keyword',
+            type: 'input',
+            placeholder: '编码、名称'
+          },
+          // {
+          //   label: '下拉检索:',
+          //   value: 'searchType',
+          //   type: 'select',
+          //   placeholder: '请选择',
+          //   planList: [
+          //     { value: 1, label: '选项一' },
+          //     { value: 2, label: '选项二' },
+          //     { value: 3, label: '选项三' }
+          //   ]
+          // },
+          // {
+          //   label: '关键词:',
+          //   value: 'searchName2',
+          //   type: 'input',
+          //   placeholder: '编码、名称、型号、规格'
+          // },
+          {
+            label: '创建时间:',
+            value: 'createTime',
+            type: 'date',
+            dateType: 'daterange',
+            placeholder: '',
+            width: 380,
+            valueAr: ['startCreateTime', 'endCreateTime']
+          }
+        ];
+      }
+    },
+    methods: {
+      search(e) {
+        this.$emit('search', { ...e });
+      }
+    }
+  };
+</script>

+ 288 - 0
src/views/rulesManagement/paymentTerms/index.vue

@@ -0,0 +1,288 @@
+<template>
+  <div class="ele-body">
+    <el-card shadow="never" v-loading="loading">
+      <div class="ele-border-lighter form-content" v-loading="loading">
+        <search-form @search="reload"> </search-form>
+
+        <!-- 数据表格 -->
+        <ele-pro-table
+          ref="table"
+          :columns="columns"
+          :datasource="datasource"
+          height="calc(100vh - 375px)"
+          full-height="calc(100vh - 116px)"
+          tool-class="ele-toolbar-form"
+          :selection.sync="selection"
+          :page-size="20"
+          @columns-change="handleColumnChange"
+          :cache-key="cacheKeyUrl"
+        >
+          <!-- 表头工具栏 -->
+          <template v-slot:toolbar>
+            <el-button
+              size="small"
+              type="primary"
+              icon="el-icon-plus"
+              class="ele-btn-icon"
+              @click="openEdit('add', {})"
+            >
+              新增
+            </el-button>
+          </template>
+          <template v-slot:ruleState="{ row }">
+            <el-switch
+              v-model="row.ruleState"
+              active-color="#13ce66"
+              inactive-color="#ff4949"
+              active-value="1"
+              inactive-value="0"
+              @change="(val) => handleStatus(row, val)"
+            >
+            </el-switch>
+          </template>
+
+          <!-- 操作列 -->
+          <template v-slot:action="{ row }">
+            <el-link
+              type="primary"
+              :underline="false"
+              icon="el-icon-view"
+              @click="openDetail(row)"
+            >
+              详情
+            </el-link>
+            <el-link
+              type="primary"
+              :underline="false"
+              icon="el-icon-edit"
+              @click="openEdit('edit', row)"
+            >
+              修改
+            </el-link>
+            <el-popconfirm
+              class="ele-action"
+              title="确定要删除此信息吗?"
+              @confirm="remove([row.id])"
+            >
+              <template v-slot:reference>
+                <el-link type="danger" :underline="false" icon="el-icon-delete">
+                  删除
+                </el-link>
+              </template>
+            </el-popconfirm>
+          </template>
+        </ele-pro-table>
+      </div>
+    </el-card>
+
+    <add-dialog ref="addDialogRef" @done="reload"></add-dialog>
+  </div>
+</template>
+
+<script>
+  import searchForm from './components/searchForm.vue';
+  import addDialog from './components/addDialog.vue';
+  import tabMixins from '@/mixins/tableColumnsMixin';
+  import { calcPayDateTypeOp } from '@/views/rulesManagement/enum/dict';
+  import { payConfirmTypeOp, dateUnitOptions } from '@/enum/dict';
+  import {
+    getTableList,
+    deleteInformation,
+    updateRuleState
+  } from '@/api/rulesManagement/paymentTerms';
+  import dictMixins from '@/mixins/dictMixins';
+
+  export default {
+    mixins: [tabMixins, dictMixins],
+    components: {
+      searchForm,
+      addDialog
+    },
+    data() {
+      return {
+        selection: [],
+        loading: false,
+        columns: [
+          {
+            width: 45,
+            type: 'selection',
+            columnKey: 'selection',
+            align: 'center'
+          },
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true,
+            fixed: 'left'
+          },
+          {
+            prop: 'code',
+            label: '编码',
+            align: 'center',
+            sortable: true,
+            showOverflowTooltip: true,
+            minWidth: 160
+          },
+          {
+            prop: 'name',
+            label: '付款条件名称',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 160
+          },
+          {
+            prop: 'dateType',
+            label: '付款日计算日期',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 160,
+            formatter: (row) => {
+              return calcPayDateTypeOp.find(item => item.value === row.dateType)?.label || '';
+            }
+          },
+          {
+            prop: 'rulesTypePOList',
+            label: '支付方式',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 180,
+            formatter: (row) => {
+              return this.buildPaymentMethod(row.rulesTypePOList);
+            }
+          },
+          {
+            prop: 'determinationMethod',
+            label: '付款日确认方式',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 140,
+            formatter: (row) => {
+              return payConfirmTypeOp.find(item => item.value === row.determinationMethod)?.label || '';
+            }
+          },
+          {
+            prop: 'remark',
+            label: '备注',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 180
+          },
+          {
+            prop: 'createUserName',
+            label: '创建人',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 120
+          },
+          {
+            prop: 'createTime',
+            label: '创建时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 120
+          },
+          {
+            prop: 'ruleState',
+            slot: 'ruleState',
+            label: '状态',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 120
+          },
+          {
+            columnKey: 'action',
+            label: '操作',
+            width: 170,
+            align: 'center',
+            resizable: false,
+            slot: 'action',
+            showOverflowTooltip: true,
+            fixed: 'right'
+          }
+        ],
+        cacheKeyUrl: 'eom-paymentTerms-list'
+      };
+    },
+    created() {
+      this.requestDict('支付类型');
+    },
+    methods: {
+      /* 表格数据源 */
+      datasource({ page, limit, where }) {
+        return getTableList({
+          pageNum: page,
+          conditionConfigurationType: 'terms',
+          size: limit,
+          ...where
+        });
+      },
+
+      handleStatus(row, val) {
+        console.log('row', row);
+        console.log('val', val);
+        let msg = val == 1 ? '是否启用该规则' : '是否关闭该规则';
+        this.$confirm(msg, '提示', {
+          type: 'warning'
+        })
+          .then(async () => {
+            await updateRuleState({
+              id: row.id,
+              ruleState: val
+            });
+            this.$message.success('操作成功');
+          })
+          .catch(() => {
+            row.ruleState = val == 1 ? 0 : 1;
+          });
+      },
+
+      // 构建支付方式字符串
+      buildPaymentMethod(list) {
+        return (list || [])
+          .map(item => {
+            const unit =
+              (dateUnitOptions.find(opt => opt.value === item.dateType) || {}).label ||
+              '月';
+            const typeName =
+              (this.dict['payment_type'] || []).find(
+                opt => String(opt.dictCode) === String(item.paymentType)
+              )?.dictValue || '';
+            return `${item.percentage}% ${item.paymentSum}${unit} ${typeName}`;
+          })
+          .join(',');
+      },
+
+      /* 刷新表格 */
+      reload(where) {
+        this.$refs.table.reload({ page: 1, where });
+      },
+
+      // 新增编辑
+      openEdit(type, row) {
+        this.$refs.addDialogRef.open(type, row);
+      },
+
+      // 查看详情
+      openDetail(row) {
+        this.$refs.addDialogRef.open('detail', row);
+      },
+
+      // 删除
+      remove(delData) {
+        deleteInformation(delData).then(() => {
+          this.$message.success('删除成功!');
+          this.reload();
+        });
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  :deep(.el-link--inner) {
+    margin-left: 0px !important;
+  }
+</style>

+ 418 - 0
src/views/rulesManagement/receiveTerms/components/addDialog.vue

@@ -0,0 +1,418 @@
+<!-- 收/付款条件新增/编辑弹窗 -->
+<template>
+  <ele-modal
+    width="700px"
+    :visible="visible"
+    :append-to-body="true"
+    :close-on-click-modal="false"
+    custom-class="ele-dialog-form"
+    :title="dialogTitle"
+    @update:visible="updateVisible"
+  >
+    <el-form
+      ref="form"
+      :model="form"
+      :rules="rules"
+      label-width="140px"
+    >
+      <!-- 收/付款条件编码 -->
+      <el-form-item :label="conditionLabel + '编码:'" prop="code">
+        <el-input
+          v-model="form.code"
+          placeholder="自动生成"
+          :disabled="true"
+        />
+      </el-form-item>
+
+      <!-- 收款条件名称 -->
+      <el-form-item :label="conditionLabel + '名称:'" prop="name">
+        <el-input
+          clearable
+          v-model="form.name"
+          placeholder="请输入条件名称"
+          :disabled="isDetail"
+        />
+      </el-form-item>
+
+      <!-- 收/付款日计算日期 -->
+      <el-form-item :label="conditionLabel + '日计算日期:'" prop="dateType">
+        <el-select
+          v-model="form.dateType"
+          placeholder="请选择"
+          style="width: 100%"
+          :disabled="isDetail"
+        >
+          <el-option v-for="item in dateTypeOptions" :key="item.value" :label="item.label" :value="item.value" />
+        </el-select>
+      </el-form-item>
+
+      <!-- 收/付款日确定方式 -->
+      <el-form-item :label="conditionLabel + '日确定方式:'" prop="determinationMethod">
+        <el-select
+          v-model="form.determinationMethod"
+          placeholder="请选择"
+          style="width: 100%"
+          :disabled="isDetail"
+          @change="handleConfirmTypeChange"
+        >
+          <el-option v-for="item in payConfirmTypeOp" :key="item.value" :label="item.label" :value="item.value" />
+        </el-select>
+      </el-form-item>
+
+      <!-- 月数(X天后显示) -->
+      <el-form-item label="月数:" v-if="form.determinationMethod == 2">
+        <el-input-number
+          v-model="form.determinationMethodMonth"
+          :min="0"
+          :precision="0"
+          controls-position="right"
+          style="width: 100%"
+          :disabled="isDetail"
+        />
+      </el-form-item>
+
+      <!-- 天数(X天后显示) -->
+      <el-form-item label="天数:" v-if="form.determinationMethod == 2">
+        <el-input-number
+          v-model="form.determinationMethodDay"
+          :min="0"
+          :precision="0"
+          controls-position="right"
+          style="width: 100%"
+          :disabled="isDetail"
+        />
+      </el-form-item>
+
+      <!-- 支付方式列表 -->
+      <el-form-item
+        v-for="(item, index) in form.rulesTypePOList"
+        :key="item.id"
+        :label="index === 0 ? '支付方式:' : ''"
+        :required="index === 0"
+        class="payment-method-item"
+      >
+        <div class="payment-method-row">
+          <el-input-number
+            v-model="item.percentage"
+            :min="0"
+            :max="100"
+            :precision="0"
+            controls-position="right"
+            class="payment-input"
+            placeholder="比例"
+            :disabled="isDetail"
+          />
+          <span class="payment-unit">%</span>
+          <el-input-number
+            v-model="item.paymentSum"
+            :min="0"
+            :precision="0"
+            controls-position="right"
+            class="payment-input"
+            placeholder="请输入"
+            :disabled="isDetail"
+          />
+          <el-select
+            v-model="item.dateType"
+            placeholder="请选择"
+            class="payment-unit-select"
+            :disabled="isDetail"
+          >
+            <el-option v-for="opt in dateUnitOptions" :key="opt.value" :label="opt.label" :value="opt.value" />
+          </el-select>
+          <DictSelection
+            v-model="item.paymentType"
+            dictName="支付类型"
+            placeholder="请选择"
+            class="payment-select"
+            :disabled="isDetail"
+            :isProhibit="isDetail"
+          />
+          <el-button
+            v-if="!isDetail && index === form.rulesTypePOList.length - 1"
+            type="text"
+            icon="el-icon-circle-plus-outline"
+            class="add-payment-btn"
+            @click="addPaymentRow"
+          />
+          <el-button
+            v-if="!isDetail && form.rulesTypePOList.length > 1 && index !== 0"
+            type="text"
+            icon="el-icon-remove-outline"
+            class="remove-payment-btn"
+            @click="removePaymentRow(index)"
+          />
+        </div>
+      </el-form-item>
+
+      <!-- 备注 -->
+      <el-form-item label="备注:" prop="remark">
+        <el-input
+          type="textarea"
+          :rows="3"
+          v-model="form.remark"
+          placeholder="请输入"
+          :disabled="isDetail"
+        />
+      </el-form-item>
+    </el-form>
+
+    <template v-slot:footer>
+      <template v-if="isDetail">
+        <el-button @click="updateVisible(false)">关闭</el-button>
+      </template>
+      <template v-else>
+        <el-button type="primary" :loading="loading" @click="save">
+          确定
+        </el-button>
+        <el-button @click="updateVisible(false)">取消</el-button>
+      </template>
+    </template>
+  </ele-modal>
+</template>
+
+<script>
+  import { addReceiveTerms, updateReceiveTerms, getInfo } from '@/api/rulesManagement/receiveTerms';
+  import {
+    calcReceiveDateTypeOp,
+    calcPayDateTypeOp,
+    PaymentDateCalcTypeEnum,
+    ReceiveDateCalcTypeEnum
+  } from '@/views/rulesManagement/enum/dict';
+  import { payConfirmTypeOp, dateUnitOptions } from '@/enum/dict';
+
+  let paymentId = 0;
+
+  export default {
+    props: {
+      // 收款/付款:rules/terms
+      conditionType: {
+        type: String,
+        default: ''
+      }
+    },
+    data() {
+      return {
+        visible: false,
+        loading: false,
+        isUpdate: false,
+        isDetail: false,
+        payConfirmTypeOp,
+        // 支付周期单位(天/月/年)
+        dateUnitOptions,
+        form: {
+          id: null,
+          code: '',
+          name: '',
+          dateType: null,
+          determinationMethod: null,
+          determinationMethodMonth: 0,
+          determinationMethodDay: 0,
+          rulesTypePOList: [],
+          remark: '',
+          ruleState: 1,
+          conditionConfigurationType: this.conditionType
+        },
+        rules: {
+          // code: [{ required: true, message: '请输入收款条件编码', trigger: 'blur' }],
+          name: [{ required: true, message: '请输入条件名称', trigger: 'blur' }],
+          dateType: [{ required: true, message: '请选择计算日期', trigger: 'change' }],
+          determinationMethod: [{ required: true, message: '请选择确定方式', trigger: 'change' }]
+        }
+      };
+    },
+    computed: {
+      // 收/付款日计算日期:根据 conditionType 切换对应枚举选项
+      dateTypeOptions() {
+        return this.conditionType === 'rules' ? calcReceiveDateTypeOp : calcPayDateTypeOp;
+      },
+      // 收/付款条件:rules 收款,terms 付款
+      conditionLabel() {
+        return this.conditionType === 'rules' ? '收款条件' : '付款条件';
+      },
+      // 弹窗标题
+      dialogTitle() {
+        if (this.isDetail) {
+          return this.conditionLabel + '详情';
+        }
+        return (this.isUpdate ? '修改' : '新增') + this.conditionLabel;
+      }
+    },
+    methods: {
+      // 生成编码 SKTJ+年月日+3位数字
+      generateCode() {
+        const now = new Date();
+        const year = now.getFullYear();
+        const month = String(now.getMonth() + 1).padStart(2, '0');
+        const day = String(now.getDate()).padStart(2, '0');
+        const random = String(Math.floor(Math.random() * 900) + 100);
+        this.form.code = `SKTJ${year}${month}${day}${random}`;
+      },
+
+      open(type, row) {
+        this.visible = true;
+        this.isUpdate = type === 'edit';
+        this.isDetail = type === 'detail';
+        if ((this.isUpdate || this.isDetail) && row) {
+          this.getDetail(row.id)
+        } else {
+          this.resetForm();
+          // this.generateCode();
+        }
+        this.$nextTick(() => {
+          this.$refs.form && this.$refs.form.clearValidate();
+        });
+      },
+
+      getDetail(id) {
+        getInfo(id).then(res => {
+          console.log('getInfo res', res);
+          this.form = {
+            ...res,
+          };
+
+        })
+      },
+
+      resetForm() {
+        // 收/付款日计算日期默认值:按当前条件类型取对应枚举的"订单日期"
+        const defaultDateType = this.conditionType === 'rules'
+          ? ReceiveDateCalcTypeEnum.ORDER_DATE
+          : PaymentDateCalcTypeEnum.ORDER_DATE;
+        this.form = {
+          // id: null,
+          code: '',
+          name: '',
+          dateType: defaultDateType,        // 默认:订单日期
+          determinationMethod: '1',         // 默认:交易日(隐藏月数、天数)
+          determinationMethodMonth: 0,
+          determinationMethodDay: 0,
+          rulesTypePOList: [this.createEmptyPayment()], // 默认:100% 0月 现金
+          remark: '',
+          ruleState: 1,
+          conditionConfigurationType: this.conditionType
+        };
+      },
+
+      createEmptyPayment() {
+        return {
+          key: ++paymentId,
+          percentage: 100,
+          paymentSum: 0,
+          dateType: 'month',
+          paymentType: '1'
+        };
+      },
+
+      // 收款日确定方式变化
+      handleConfirmTypeChange() {
+        if (this.form.determinationMethod == 1) {
+          this.form.determinationMethodMonth = 0;
+          this.form.determinationMethodDay = 0;
+        }
+      },
+
+      // 添加支付方式行
+      addPaymentRow() {
+        this.form.rulesTypePOList.push(this.createEmptyPayment());
+      },
+
+      // 移除支付方式行
+      removePaymentRow(index) {
+        this.form.rulesTypePOList.splice(index, 1);
+      },
+
+      // 构建支付方式字符串
+      buildPaymentMethod() {
+        return this.form.rulesTypePOList
+          .map(item => `${item.percentage}% ${item.paymentSum}${item.dateType || 'month'} ${item.paymentType}`)
+          .join(',');
+      },
+
+      // 构建确认方式描述
+      buildConfirmDesc() {
+        if (this.form.determinationMethod === 1) {
+          return '交易日';
+        }
+        const parts = [];
+        if (this.form.determinationMethodMonth > 0) parts.push(`月数:${this.form.determinationMethodMonth}`);
+        if (this.form.determinationMethodDay > 0) parts.push(`天数:${this.form.determinationMethodDay}`);
+        if (parts.length === 0) return '0月0天即交易日';
+        return parts.join(',');
+      },
+
+      save() {
+        this.$refs.form.validate((valid) => {
+          if (!valid) return;
+
+          // 校验支付方式比例总和
+          const totalRatio = this.form.rulesTypePOList.reduce((sum, item) => sum + item.percentage, 0);
+          if (totalRatio !== 100) {
+            this.$message.warning('支付比例总和必须等于100%');
+            return;
+          }
+
+          this.loading = true;
+
+          const data = {
+            ...this.form,
+            // paymentMethod: this.buildPaymentMethod(),
+            // confirmDesc: this.buildConfirmDesc()
+          };
+          // delete data.rulesTypePOList;
+
+          console.log('save data', data);
+          // return
+
+          const saveOrUpdate = this.isUpdate ? updateReceiveTerms : addReceiveTerms;
+          saveOrUpdate(data)
+            .then(() => {
+              this.loading = false;
+              this.$message.success(this.isUpdate ? '修改成功' : '新增成功');
+              this.updateVisible(false);
+              this.$emit('done');
+            })
+            .catch(() => {
+              this.loading = false;
+            });
+        });
+      },
+
+      updateVisible(value) {
+        this.visible = value;
+        if (!value) {
+          this.resetForm();
+        }
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .payment-method-row {
+    display: flex;
+    align-items: center;
+    gap: 8px;
+  }
+  .payment-input {
+    width: 100px;
+  }
+  .payment-unit {
+    color: #606266;
+    font-size: 14px;
+  }
+  .payment-unit-select {
+    width: 80px;
+  }
+  .payment-select {
+    width: 120px!important;
+  }
+  .add-payment-btn,
+  .remove-payment-btn {
+    font-size: 18px;
+    padding: 0;
+  }
+  .remove-payment-btn {
+    color: #f56c6c;
+  }
+</style>

+ 55 - 0
src/views/rulesManagement/receiveTerms/components/searchForm.vue

@@ -0,0 +1,55 @@
+<!-- 搜索表单 -->
+<template>
+  <seekPage :seekList="seekList" :formLength="3" @search="search"></seekPage>
+</template>
+
+<script>
+  export default {
+    data() {
+      return {};
+    },
+    computed: {
+      seekList() {
+        return [
+          {
+            label: '关键词:',
+            value: 'keyword',
+            type: 'input',
+            placeholder: '编码、名称'
+          },
+          // {
+          //   label: '下拉检索:',
+          //   value: 'searchType',
+          //   type: 'select',
+          //   placeholder: '请选择',
+          //   planList: [
+          //     { value: 1, label: '选项一' },
+          //     { value: 2, label: '选项二' },
+          //     { value: 3, label: '选项三' }
+          //   ]
+          // },
+          // {
+          //   label: '关键词:',
+          //   value: 'searchName2',
+          //   type: 'input',
+          //   placeholder: '编码、名称、型号、规格'
+          // },
+          {
+            label: '创建时间:',
+            value: 'createTime',
+            type: 'date',
+            dateType: 'daterange',
+            placeholder: '',
+            width: 380,
+            valueAr: ['startCreateTime', 'endCreateTime']
+          }
+        ];
+      }
+    },
+    methods: {
+      search(e) {
+        this.$emit('search', { ...e });
+      }
+    }
+  };
+</script>

+ 289 - 0
src/views/rulesManagement/receiveTerms/index.vue

@@ -0,0 +1,289 @@
+<template>
+  <div class="ele-body">
+    <el-card shadow="never" v-loading="loading">
+      <div class="ele-border-lighter form-content" v-loading="loading">
+        <search-form @search="reload"> </search-form>
+
+        <!-- 数据表格 -->
+        <ele-pro-table
+          ref="table"
+          :columns="columns"
+          :datasource="datasource"
+          height="calc(100vh - 375px)"
+          full-height="calc(100vh - 116px)"
+          tool-class="ele-toolbar-form"
+          :selection.sync="selection"
+          :page-size="20"
+          @columns-change="handleColumnChange"
+          :cache-key="cacheKeyUrl"
+        >
+          <!-- 表头工具栏 -->
+          <template v-slot:toolbar>
+            <el-button
+              size="small"
+              type="primary"
+              icon="el-icon-plus"
+              class="ele-btn-icon"
+              @click="openEdit('add', {})"
+            >
+              新增
+            </el-button>
+          </template>
+          <template v-slot:ruleState="{ row }">
+            <el-switch
+              v-model="row.ruleState"
+              active-color="#13ce66"
+              inactive-color="#ff4949"
+              active-value="1"
+              inactive-value="0"
+              @change="(val) => handleStatus(row, val)"
+            >
+            </el-switch>
+          </template>
+
+          <!-- 操作列 -->
+          <template v-slot:action="{ row }">
+            <el-link
+              type="primary"
+              :underline="false"
+              icon="el-icon-view"
+              @click="openDetail(row)"
+            >
+              详情
+            </el-link>
+            <el-link
+              type="primary"
+              :underline="false"
+              icon="el-icon-edit"
+              @click="openEdit('edit', row)"
+            >
+              修改
+            </el-link>
+            <el-popconfirm
+              class="ele-action"
+              title="确定要删除此信息吗?"
+              @confirm="remove([row.id])"
+            >
+              <template v-slot:reference>
+                <el-link type="danger" :underline="false" icon="el-icon-delete">
+                  删除
+                </el-link>
+              </template>
+            </el-popconfirm>
+          </template>
+        </ele-pro-table>
+      </div>
+    </el-card>
+
+    <add-dialog ref="addDialogRef" conditionType="rules" @done="reload"></add-dialog>
+  </div>
+</template>
+
+<script>
+  import searchForm from './components/searchForm.vue';
+  import addDialog from './components/addDialog.vue';
+  import tabMixins from '@/mixins/tableColumnsMixin';
+  import {
+    getTableList,
+    deleteInformation,
+    updateRuleState
+  } from '@/api/rulesManagement/receiveTerms';
+  import { calcReceiveDateTypeOp } from '@/views/rulesManagement/enum/dict';
+  import { payConfirmTypeOp, dateUnitOptions } from '@/enum/dict';
+  import dictMixins from '@/mixins/dictMixins';
+
+  export default {
+    mixins: [tabMixins, dictMixins],
+    components: {
+      searchForm,
+      addDialog
+    },
+    data() {
+      return {
+        selection: [],
+        loading: false,
+        columns: [
+          {
+            width: 45,
+            type: 'selection',
+            columnKey: 'selection',
+            align: 'center'
+          },
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true,
+            fixed: 'left'
+          },
+          {
+            prop: 'code',
+            label: '编码',
+            align: 'center',
+            // sortable: true,
+            showOverflowTooltip: true,
+            minWidth: 160
+          },
+          {
+            prop: 'name',
+            label: '收款条件名称',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 160
+          },
+          {
+            prop: 'dateType',
+            label: '收款日计算日期',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 160,
+            formatter: (row) => {
+              return calcReceiveDateTypeOp.find(item => item.value === row.dateType)?.label || '';
+            }
+          },
+          {
+            prop: 'rulesTypePOList',
+            label: '支付方式',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 140,
+            formatter: (row) => {
+              return this.buildPaymentMethod(row.rulesTypePOList);
+            }
+          },
+          {
+            prop: 'determinationMethod',
+            label: '收款日确认方式',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 140,
+            formatter: (row) => {
+              return payConfirmTypeOp.find(item => item.value === row.determinationMethod)?.label || '';
+            }
+          },
+          {
+            prop: 'remark',
+            label: '备注',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 180
+          },
+          {
+            prop: 'createUserName',
+            label: '创建人',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 120
+          },
+          {
+            prop: 'createTime',
+            label: '创建时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 120
+          },
+          {
+            prop: 'ruleState',
+            slot: 'ruleState',
+            label: '状态',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 120
+          },
+          {
+            columnKey: 'action',
+            label: '操作',
+            width: 170,
+            align: 'center',
+            resizable: false,
+            slot: 'action',
+            showOverflowTooltip: true,
+            fixed: 'right'
+          }
+        ],
+        cacheKeyUrl: 'eom-receiveTerms-list'
+      };
+    },
+    created() {
+      this.requestDict('支付类型');
+    },
+    methods: {
+      /* 表格数据源 */
+      async datasource({ page, limit, where, order }) {
+
+        const res = await getTableList({
+          pageNum: page,
+          size: limit,
+          conditionConfigurationType: 'rules',
+          ...where
+        });
+        console.log('res', res);
+        return res
+      },
+
+      /* 刷新表格 */
+      reload(where) {
+        this.$refs.table.reload({ page: 1, where });
+      },
+
+      // 新增编辑
+      openEdit(type, row) {
+        this.$refs.addDialogRef.open(type, row);
+      },
+
+      // 查看详情
+      openDetail(row) {
+        this.$refs.addDialogRef.open('detail', row);
+      },
+
+      // 删除
+      remove(delData) {
+        deleteInformation(delData).then(() => {
+          this.$message.success('删除成功!');
+          this.reload();
+        });
+      },
+      // 构建支付方式字符串
+      buildPaymentMethod(list) {
+        return (list || [])
+          .map(item => {
+            const unit =
+              (dateUnitOptions.find(opt => opt.value === item.dateType) || {}).label ||
+              '月';
+            const typeName =
+              (this.dict['payment_type'] || []).find(
+                opt => String(opt.dictCode) === String(item.paymentType)
+              )?.dictValue || '';
+            return `${item.percentage}% ${item.paymentSum}${unit} ${typeName}`;
+          })
+          .join(',');
+      },
+      handleStatus(row, val) {
+        console.log('row', row);
+        console.log('val', val);
+        let msg = val == 1 ? '是否启用该规则' : '是否关闭该规则';
+        this.$confirm(msg, '提示', {
+          type: 'warning'
+        })
+          .then(async () => {
+            await updateRuleState({
+              id: row.id,
+              ruleState: val
+            });
+            this.$message.success('操作成功');
+          })
+          .catch(() => {
+            row.ruleState = val == 1 ? 0 : 1;
+          });
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  :deep(.el-link--inner) {
+    margin-left: 0px !important;
+  }
+</style>