asd26269546 1 年之前
父節點
當前提交
8eea3eb2b5

+ 1 - 1
src/components/byForm/index.vue

@@ -18,7 +18,7 @@
           v-if="i.isShow || i.isShow == undefined && i.type"
           :style="
             i.type == 'title'
-              ? 'width:100%'
+              ? 'width:100%;display:none'
               : i.itemWidth
               ? 'width:' + i.itemWidth + '%'
               : formOption.itemWidth

+ 1 - 1
src/components/byTable/index.vue

@@ -5,7 +5,7 @@
         v-for="(item, index) in getActionList"
         :key="index"
         :type="item.type || 'primary'"
-        :plain="item.plain || false"
+        :plain="item.plain ? item.plain : index != 0"
         v-bind="getHeaderActions(item)"
         @click="item.action"
         :disabled="item.disabled || false"

+ 131 - 11
src/views/finance/fundManage/accountStatement/index.vue

@@ -10,14 +10,14 @@
         highlight-current-row
         :action-list="[
           {
-            text: '添加借款',
-            action: () => addloan(),
-          },
-          {
             text: '导出Excel',
             action: () => deriveExcel(),
           },
           {
+            text: '添加借款',
+            action: () => addloan(),
+          },
+          {
             text: '内部转账',
             action: () => openTransferMoney('add'),
           },
@@ -107,13 +107,13 @@
         :formConfig="settlementFormConfig"
         :formOption="formOption"
         v-model="formData3.data"
-        :rules="rules"
-        ref="submit"
+        :rules="rules3"
+        ref="submit3"
       >
       </byForm>
       <template #footer>
         <el-button @click="dialogVisible = false" size="large">取 消</el-button>
-        <el-button type="primary" @click="submitForm()" size="large"
+        <el-button type="primary" @click="settlementSubmitForm()" size="large"
           >确 定</el-button
         >
       </template>
@@ -372,6 +372,7 @@ const { proxy } = getCurrentInstance();
 const accountCurrency = ref([]);
 const accountList = ref([]);
 const contractList = ref([]);
+const contractList2 = ref([])
 const corporationList = ref([]);
 const status = ref([
   {
@@ -737,9 +738,25 @@ const getDict = () => {
   proxy
     .post("/contract/page", { pageNum: 1, pageSize: 9999, status: 30 })
     .then((res) => {
-      contractList.value = res.rows;
+      contractList.value = res.rows.map((item) => {
+        return {
+          ...item,
+          label: item.code,
+          value: item.id,
+        };
+      });
+    });
+  proxy
+    .post("/contract/page1", { pageNum: 1, pageSize: 9999, isExchangeSettlement: 0 })
+    .then((res) => {
+      contractList2.value = res.rows.map((item) => {
+        return {
+          ...item,
+          label: item.code,
+          value: item.id,
+        };
+      });
     });
-
   proxy.post("/corporation/page", { pageNum: 1, pageSize: 999 }).then((res) => {
     if (res.rows && res.rows.length > 0) {
       corporationList.value = res.rows.map((item) => {
@@ -804,8 +821,40 @@ const openSettlementModal = (type, row) => {
 };
 
 const formData3 = reactive({
-  data: {},
+  data: {
+    accountManagementId:null,
+    amount:null,
+    currency:null,
+    inAccountManagementId:null,
+    inAmount:null,
+    inCurrency:null,
+    rate:null,
+    commissionAmount:null,
+    commissionCurrency:null,
+    remarks:null,
+    businessId:null,
+  },
 });
+const submit3 = ref(null);
+const settlementSubmitForm = () => {
+  submit3.value.handleSubmit(() => {
+    loadingDialog.value = true;
+    proxy.post("/accountRunningWater/exchangeSettlement", formData3.data).then(
+      () => {
+        ElMessage({
+          message:"结汇成功",
+          type: "success",
+        });
+        settlementModal.value = false;
+        getList();
+      },
+      (err) => {
+        console.log(err);
+        loadingDialog.value = false;
+      }
+    );
+  });
+};
 
 const settlementFormConfig = computed(() => {
   return [
@@ -829,10 +878,13 @@ const settlementFormConfig = computed(() => {
       selectPlaceholder: "币种",
       selectProp: "currency",
       fn: (value) => {
+        
         //判断value的类型
         if (isNaN(value)) {
           formData3.data.inCurrency = formData3.data.currency;
           formData3.data.commissionCurrency = formData3.data.currency;
+          console.log(formData3.data.inAmount)
+          
         } else {
           if (value != "") {
             if (value.indexOf(".") > -1) {
@@ -843,6 +895,9 @@ const settlementFormConfig = computed(() => {
           }
           formData3.data.inAmount = formData3.data.amount;
         }
+        if(formData3.data.amount && formData3.data.inAmount) {
+          formData3.data.rate = (formData3.data.inAmount / formData3.data.amount).toFixed(4)
+        }
       },
     },
     {
@@ -853,7 +908,7 @@ const settlementFormConfig = computed(() => {
     },
     {
       type: "selectInput",
-      label: "汇金额",
+      label: "汇金额",
       prop: "inAmount",
       itemWidth: 60,
       data: accountCurrency.value,
@@ -865,6 +920,7 @@ const settlementFormConfig = computed(() => {
         if (isNaN(value)) {
           formData2.data.inCurrency = formData2.data.currency;
           formData2.data.commissionCurrency = formData2.data.currency;
+          
         } else {
           if (value != "") {
             if (value.indexOf(".") > -1) {
@@ -875,6 +931,9 @@ const settlementFormConfig = computed(() => {
           }
           formData2.data.inAmount = formData2.data.amount;
         }
+        if(formData3.data.amount && formData3.data.inAmount) {
+          formData3.data.rate = (formData3.data.inAmount / formData3.data.amount).toFixed(4)
+        }
       },
     },
     {
@@ -882,6 +941,7 @@ const settlementFormConfig = computed(() => {
       prop: "rate",
       label: "汇率",
       itemType: "text",
+      disabled: true,
     },
     {
       type: "selectInput",
@@ -893,6 +953,23 @@ const settlementFormConfig = computed(() => {
       selectPlaceholder: "币种",
       selectProp: "commissionCurrency",
     },
+    {
+      type: "input",
+      prop: "remarks",
+      label: "摘要",
+      itemType: "textarea",
+    },
+    //关联合同
+    {
+      type: "title",
+      title: "关联合同",
+    },
+    {
+      type: "select",
+      prop: "businessId",
+      label: "选择合同",
+      data: contractList2.value,
+    },
   ];
 });
 const formConfig = computed(() => {
@@ -1148,6 +1225,49 @@ const rules = ref({
   // accountOpening: [{ required: true, message: "请输入银行账号", trigger: "blur" }],
 });
 
+const validatePass4 = (rule, value, callback) => {
+  console.log(formData3.data.currency);
+  if (!formData3.data.currency) {
+    callback(new Error("请输入金额和选择币种"));
+  } else {
+    callback();
+  }
+};
+
+const validatePass3 = (rule, value, callback) => {
+  if (!formData3.data.inCurrency) {
+    callback(new Error("请输入金额和选择币种"));
+  } else {
+    callback();
+  }
+};
+
+const rules3 = ref({
+  accountManagementId: [
+    { required: true, message: "请选择账户", trigger: "change" },
+  ],
+  currency: [{ required: true, message: "请选择币种", trigger: "change" }],
+  received: [
+    { required: true, message: "请选择合同是否到账", trigger: "change" },
+  ],
+  amount:[
+    { required: true, message: "请输入金额和选择币种", trigger: "blur" },
+    { required: true, validator: validatePass4, trigger: "blur" },
+  ],
+  inAccountManagementId: [
+    { required: true, message: "请选择账户", trigger: "change" },
+  ],
+  inAmount: [
+    { required: true, message: "请输入金额和选择币种", trigger: "blur" },
+    { required: true, validator: validatePass3, trigger: "blur" },
+  ],
+  businessId:[
+    { required: true, message: "请选择合同", trigger: "change" },
+  ],
+});
+
+
+
 const rules2 = ref({
   accountManagementId: [
     { required: true, message: "请选择账户", trigger: "change" },

+ 255 - 5
src/views/finance/fundManage/flow/index.vue

@@ -10,14 +10,15 @@
         highlight-current-row
         :action-list="[
           {
-            text: '添加借款',
-            action: () => addloan(),
-          },
-          {
             text: '导出Excel',
             action: () => deriveExcel(),
           },
           {
+            text: '添加借款',
+            action: () => addloan(),
+          },
+          
+          {
             text: '添加流水',
             action: () => openModal('add'),
           },
@@ -25,6 +26,10 @@
             text: '内部转账',
             action: () => openTransferMoney('add'),
           },
+          {
+            text: '结汇',
+            action: () => openSettlementModal('add'),
+          },
         ]"
         @moreSearch="moreSearch"
         @get-list="getList"
@@ -312,6 +317,29 @@
         >
       </template>
     </el-dialog>
+    <!-- 结汇 -->
+    <el-dialog
+      title="结汇" 
+      v-if="settlementModal"
+      v-model="settlementModal"
+      width="600"
+      v-loading="loadingDialog"
+    >
+      <byForm
+        :formConfig="settlementFormConfig"
+        :formOption="formOption"
+        v-model="formData3.data"
+        :rules="rules3"
+        ref="submit3"
+      >
+      </byForm>
+      <template #footer>
+        <el-button @click="dialogVisible = false" size="large">取 消</el-button>
+        <el-button type="primary" @click="settlementSubmitForm()" size="large"
+          >确 定</el-button
+        >
+      </template>
+    </el-dialog>
   </div>
 </template>
 
@@ -366,6 +394,218 @@ const sourceList = ref({
     remarks: "",
   },
 });
+
+//结汇
+const contractList2 = ref([])
+const settlementModal = ref(false);
+const openSettlementModal = (type, row) => {
+  modalType.value = type;
+  if (type == "add") {
+    formData2.data = {
+      transactionTime: moment().format("yyyy-MM-DD HH:mm:ss"),
+    };
+  } else {
+    formData2.data = { ...row };
+  }
+  settlementModal.value = true;
+};
+
+const validatePass4 = (rule, value, callback) => {
+  console.log(formData3.data.currency);
+  if (!formData3.data.currency) {
+    callback(new Error("请输入金额和选择币种"));
+  } else {
+    callback();
+  }
+};
+
+const validatePass3 = (rule, value, callback) => {
+  if (!formData3.data.inCurrency) {
+    callback(new Error("请输入金额和选择币种"));
+  } else {
+    callback();
+  }
+};
+
+const rules3 = ref({
+  accountManagementId: [
+    { required: true, message: "请选择账户", trigger: "change" },
+  ],
+  currency: [{ required: true, message: "请选择币种", trigger: "change" }],
+  received: [
+    { required: true, message: "请选择合同是否到账", trigger: "change" },
+  ],
+  amount:[
+    { required: true, message: "请输入金额和选择币种", trigger: "blur" },
+    { required: true, validator: validatePass4, trigger: "blur" },
+  ],
+  inAccountManagementId: [
+    { required: true, message: "请选择账户", trigger: "change" },
+  ],
+  inAmount: [
+    { required: true, message: "请输入金额和选择币种", trigger: "blur" },
+    { required: true, validator: validatePass3, trigger: "blur" },
+  ],
+  businessId:[
+    { required: true, message: "请选择合同", trigger: "change" },
+  ],
+});
+
+const formData3 = reactive({
+  data: {
+    accountManagementId:null,
+    amount:null,
+    currency:null,
+    inAccountManagementId:null,
+    inAmount:null,
+    inCurrency:null,
+    rate:null,
+    commissionAmount:null,
+    commissionCurrency:null,
+    remarks:null,
+    businessId:null,
+  },
+});
+const submit3 = ref(null);
+const settlementSubmitForm = () => {
+  submit3.value.handleSubmit(() => {
+    loadingDialog.value = true;
+    proxy.post("/accountRunningWater/exchangeSettlement", formData3.data).then(
+      () => {
+        ElMessage({
+          message:"结汇成功",
+          type: "success",
+        });
+        settlementModal.value = false;
+        getList();
+      },
+      (err) => {
+        console.log(err);
+        loadingDialog.value = false;
+      }
+    );
+  });
+};
+
+const settlementFormConfig = computed(() => {
+  return [
+    {
+      type: "title",
+      title: "结汇信息",
+    },
+    {
+      type: "select",
+      prop: "accountManagementId",
+      label: "汇出账户",
+      data: accountList.value,
+    },
+    {
+      type: "selectInput",
+      label: "汇出金额",
+      prop: "amount",
+      itemWidth: 60,
+      data: accountCurrency.value,
+      placeholder: "请输入",
+      selectPlaceholder: "币种",
+      selectProp: "currency",
+      fn: (value) => {
+        
+        //判断value的类型
+        if (isNaN(value)) {
+          formData3.data.inCurrency = formData3.data.currency;
+          formData3.data.commissionCurrency = formData3.data.currency;
+          console.log(formData3.data.inAmount)
+          
+        } else {
+          if (value != "") {
+            if (value.indexOf(".") > -1) {
+              formData3.data.amount = value.slice(0, value.indexOf(".") + 3);
+            } else {
+              formData3.data.amount = value;
+            }
+          }
+          formData3.data.inAmount = formData3.data.amount;
+        }
+        if(formData3.data.amount && formData3.data.inAmount) {
+          formData3.data.rate = (formData3.data.inAmount / formData3.data.amount).toFixed(4)
+        }
+      },
+    },
+    {
+      type: "select",
+      prop: "inAccountManagementId",
+      label: "汇入账户",
+      data: accountList.value,
+    },
+    {
+      type: "selectInput",
+      label: "汇入金额",
+      prop: "inAmount",
+      itemWidth: 60,
+      data: accountCurrency.value,
+      placeholder: "请输入",
+      selectPlaceholder: "币种",
+      selectProp: "inCurrency",
+      fn: (value) => {
+        //判断value的类型
+        if (isNaN(value)) {
+          formData2.data.inCurrency = formData2.data.currency;
+          formData2.data.commissionCurrency = formData2.data.currency;
+          
+        } else {
+          if (value != "") {
+            if (value.indexOf(".") > -1) {
+              formData2.data.amount = value.slice(0, value.indexOf(".") + 3);
+            } else {
+              formData2.data.amount = value;
+            }
+          }
+          formData2.data.inAmount = formData2.data.amount;
+        }
+        if(formData3.data.amount && formData3.data.inAmount) {
+          formData3.data.rate = (formData3.data.inAmount / formData3.data.amount).toFixed(4)
+        }
+      },
+    },
+    {
+      type: "input",
+      prop: "rate",
+      label: "汇率",
+      itemType: "text",
+      disabled: true,
+    },
+    {
+      type: "selectInput",
+      label: "手续费",
+      prop: "commissionAmount",
+      itemWidth: 60,
+      data: accountCurrency.value,
+      placeholder: "请输入",
+      selectPlaceholder: "币种",
+      selectProp: "commissionCurrency",
+    },
+    {
+      type: "input",
+      prop: "remarks",
+      label: "摘要",
+      itemType: "textarea",
+    },
+    //关联合同
+    {
+      type: "title",
+      title: "关联合同",
+    },
+    {
+      type: "select",
+      prop: "businessId",
+      label: "选择合同",
+      data: contractList2.value,
+    },
+  ];
+});
+
+
+
 const loading = ref(false);
 const selectConfig = computed(() => {
   return [
@@ -523,7 +763,17 @@ const getDict = () => {
         });
       }
     });
-
+  proxy
+    .post("/contract/page1", { pageNum: 1, pageSize: 9999, isExchangeSettlement: 0 })
+    .then((res) => {
+      contractList2.value = res.rows.map((item) => {
+        return {
+          ...item,
+          label: item.code,
+          value: item.id,
+        };
+      });
+    });
   proxy.post("/corporation/page", { pageNum: 1, pageSize: 999 }).then((res) => {
     if (res.rows && res.rows.length > 0) {
       corporationList.value = res.rows.map((item) => {