Browse Source

资金账户

lxf 1 year ago
parent
commit
d25e0fa10c

+ 31 - 0
src/lang/cn.js

@@ -1103,5 +1103,36 @@ export const lang = {
 		bankAccountNumber: '银行账号',
 		otherInformation: '其他信息',
 		remark: '备注',
+	},
+	account: {
+		name: '资金账户',
+		company: '归属公司',
+		companyMsg: '请选择归属公司',
+		add: '添加账户',
+		edit: '编辑账户',
+		alias: '账户别名',
+		aliasMsg: '请输入账户别名',
+		openingBank: '开户银行',
+		openingBankMsg: '请输入开户银行',
+		accountName: '账户名',
+		accountNameMsg: '请输入账户名',
+		accountOpening: '银行账号',
+		accountOpeningMsg: '请输入银行账号',
+		interbankNumber: '联行号',
+		interbankNumberMsg: '请输入联行号',
+		foreignExchange: '外汇信息',
+		beneficiaryName: 'Beneficiary Name',
+		beneficiaryBank: 'Beneficiary Bank',
+		beneficiaryBankAddress: 'Beneficiary Bank Address',
+		beneficiaryAccountNumber: 'Beneficiary Account Number',
+		swiftCode: 'Swift Code',
+		beneficiaryAddress: 'Beneficiary Address',
+		currency: '币种',
+		currencyMsg: '请选择币种',
+		remainder: '余额',
+		remainderMsg: '请输入余额',
+		accountBalance: '账户余额',
+		submitMsgOne:'请添加至少一条账户余额',
+		submitMsgTwo:'请勿重复添加货币余额',
 	}
 }

+ 10 - 0
src/router/routerLXF.js

@@ -75,6 +75,16 @@ export function routesLXF() {
       name: "添加流水",
       component: () => import("../views/fund/flow-of-funds/add.vue"),
     },
+    {
+      path: "account",
+      name: "资金账户",
+      component: () => import("../views/fund/account/index.vue"),
+    },
+    {
+      path: "accountAdd",
+      name: "添加账户",
+      component: () => import("../views/fund/account/add.vue"),
+    },
   ];
   return routesLXF;
 }

+ 249 - 0
src/views/fund/account/add.vue

@@ -0,0 +1,249 @@
+<template>
+  <div class="form">
+    <van-nav-bar :title="$t('account.' + route.query.type)" :left-text="$t('common.back')" left-arrow @click-left="onClickLeft"> </van-nav-bar>
+    <testForm v-model="formData.data" :formOption="formOption" :formConfig="formConfig" :rules="rules" @onSubmit="onSubmit" ref="formDom"> </testForm>
+  </div>
+</template>
+
+<script setup>
+import { ref, getCurrentInstance, onMounted, reactive } from "vue";
+import { showSuccessToast, showFailToast } from "vant";
+import { useRoute } from "vue-router";
+import { getUserInfo } from "@/utils/auth";
+import testForm from "@/components/testForm/index.vue";
+
+const proxy = getCurrentInstance().proxy;
+const onClickLeft = () => history.back();
+const route = useRoute();
+const getDict = () => {
+  proxy
+    .post("/dictTenantData/page", {
+      pageNum: 1,
+      pageSize: 999,
+      dictCode: "account_currency",
+      tenantId: getUserInfo().tenantId,
+    })
+    .then((res) => {
+      if (res.data.rows && res.data.rows.length > 0) {
+        formOption.btnConfig.listConfig[0].data = res.data.rows.map((item) => {
+          return {
+            text: item.dictValue,
+            value: item.dictKey,
+          };
+        });
+      }
+    });
+  proxy.post("/corporation/page", { pageNum: 1, pageSize: 9999 }).then((res) => {
+    if (res.data.rows && res.data.rows.length > 0) {
+      formConfig[0].data = res.data.rows.map((item) => {
+        return {
+          ...item,
+          label: item.name,
+          value: item.id,
+        };
+      });
+    }
+  });
+};
+getDict();
+const formData = reactive({
+  data: {
+    corporationId: null,
+    alias: null,
+    name: null,
+    openingBank: null,
+    accountOpening: null,
+    interbankNumber: null,
+    beneficiaryName: null,
+    beneficiaryBank: null,
+    beneficiaryBankAddress: null,
+    beneficiaryAccountNumber: null,
+    swiftCode: null,
+    beneficiaryAddress: null,
+    accountRemainderList: [],
+  },
+});
+const formDom = ref(null);
+const formOption = reactive({
+  readonly: false, //用于控制整个表单是否只读
+  disabled: false,
+  labelAlign: "top",
+  scroll: true,
+  labelWidth: "62pk",
+  hiddenSubmitBtn: false,
+  btnConfig: {
+    isNeed: true,
+    prop: "accountRemainderList",
+    plain: true,
+    listTitle: proxy.t("account.accountBalance"),
+    listConfig: [
+      {
+        type: "picker",
+        label: proxy.t("account.currency"),
+        prop: "currency",
+        itemType: "onePicker",
+        showPicker: false,
+        readonly: false,
+        fieldNames: {
+          text: "text",
+          value: "value",
+        },
+        data: [],
+      },
+      {
+        type: "input",
+        label: proxy.t("account.remainder"),
+        prop: "remainder",
+        itemType: "number",
+      },
+    ],
+    clickFn: () => {
+      if (formData.data.accountRemainderList && formData.data.accountRemainderList.length > 0) {
+        formData.data.accountRemainderList.push({
+          currency: null,
+          remainder: null,
+        });
+      } else {
+        formData.data.accountRemainderList = [
+          {
+            currency: null,
+            remainder: null,
+          },
+        ];
+      }
+    },
+  },
+});
+const formConfig = reactive([
+  {
+    type: "picker",
+    label: proxy.t("account.company"),
+    prop: "corporationId",
+    itemType: "onePicker",
+    showPicker: false,
+    fieldNames: {
+      text: "label",
+      value: "value",
+    },
+    data: [],
+  },
+  {
+    type: "input",
+    label: proxy.t("account.alias"),
+    prop: "alias",
+    itemType: "text",
+  },
+  {
+    type: "input",
+    label: proxy.t("account.openingBank"),
+    prop: "openingBank",
+    itemType: "text",
+  },
+  {
+    type: "input",
+    label: proxy.t("account.accountName"),
+    prop: "name",
+    itemType: "text",
+  },
+  {
+    type: "input",
+    label: proxy.t("account.accountOpening"),
+    prop: "accountOpening",
+    itemType: "text",
+  },
+  {
+    type: "input",
+    label: proxy.t("account.interbankNumber"),
+    prop: "interbankNumber",
+    itemType: "text",
+  },
+  {
+    type: "title",
+    title: proxy.t("account.foreignExchange"),
+  },
+  {
+    type: "input",
+    label: proxy.t("account.beneficiaryName"),
+    prop: "beneficiaryName",
+    itemType: "text",
+  },
+  {
+    type: "input",
+    label: proxy.t("account.beneficiaryBank"),
+    prop: "beneficiaryBank",
+    itemType: "text",
+  },
+  {
+    type: "input",
+    label: proxy.t("account.beneficiaryBankAddress"),
+    prop: "beneficiaryBankAddress",
+    itemType: "text",
+  },
+  {
+    type: "input",
+    label: proxy.t("account.beneficiaryAccountNumber"),
+    prop: "beneficiaryAccountNumber",
+    itemType: "text",
+  },
+  {
+    type: "input",
+    label: proxy.t("account.swiftCode"),
+    prop: "swiftCode",
+    itemType: "text",
+  },
+  {
+    type: "input",
+    label: proxy.t("account.beneficiaryAddress"),
+    prop: "beneficiaryAddress",
+    itemType: "text",
+  },
+]);
+const rules = {
+  corporationId: [{ required: true, message: proxy.t("account.companyMsg") }],
+  alias: [{ required: true, message: proxy.t("account.aliasMsg") }],
+  openingBank: [{ required: true, message: proxy.t("account.openingBankMsg") }],
+  name: [{ required: true, message: proxy.t("account.accountNameMsg") }],
+  accountOpening: [{ required: true, message: proxy.t("account.accountOpeningMsg") }],
+  currency: [{ required: true, message: proxy.t("account.currencyMsg") }],
+  remainder: [{ required: true, message: proxy.t("account.remainderMsg") }],
+};
+const isRepeat = (arr) => {
+  var hash = {};
+  for (var i in arr) {
+    if (hash[arr[i].currency]) return true;
+    hash[arr[i].currency] = true;
+  }
+  return false;
+};
+const onSubmit = () => {
+  if (formData.data.accountRemainderList && formData.data.accountRemainderList.length > 0) {
+    if (isRepeat(formData.data.accountRemainderList)) {
+      showFailToast(proxy.t("account.submitMsgTwo"));
+    } else {
+      proxy.post("/accountManagement/" + route.query.type, formData.data).then(() => {
+        showSuccessToast(proxy.t("common.addSuccess"));
+        setTimeout(() => {
+          history.back();
+        }, 500);
+      });
+    }
+  } else {
+    showFailToast(proxy.t("account.submitMsgOne"));
+  }
+};
+onMounted(() => {
+  if (route.query.id) {
+    proxy.post("/accountManagement/detail", { id: route.query.id }).then((res) => {
+      formData.data = res.data;
+      if (formData.data.accountRemainderList && formData.data.accountRemainderList.length > 0) {
+        for (let i = 0; i < formData.data.accountRemainderList.length; i++) {
+          let data = formOption.btnConfig.listConfig[0].data.filter((item) => item.value === formData.data.accountRemainderList[i].currency);
+          if (data && data.length > 0) {
+            formData.data.accountRemainderList[i].currencyName = data[0].text;
+          }
+        }
+      }
+    });
+  }
+});
+</script>

+ 85 - 0
src/views/fund/account/index.vue

@@ -0,0 +1,85 @@
+<template>
+  <van-nav-bar :title="$t('account.name')" left-text="" left-arrow @click-left="onClickLeft" @click-right="onClickRight">
+    <template #right>{{ $t("common.add") }}</template>
+  </van-nav-bar>
+  <van-search v-model="req.keyword" :placeholder="$t('common.pleaseEnterKeywords')" @search="onRefresh" />
+  <van-pull-refresh v-model="loading" @refresh="onRefresh">
+    <div class="list">
+      <van-list v-model:loading="loading" :finished="finished" :finished-text="$t('common.noMore')" @load="getList" style="margin-bottom: 60px">
+        <commonList :data="listData" @onClick="toDtl" :config="listConfig"></commonList>
+      </van-list>
+    </div>
+  </van-pull-refresh>
+</template>
+<script setup>
+import { ref, getCurrentInstance } from "vue";
+import commonList from "@/components/common-list.vue";
+
+const proxy = getCurrentInstance().proxy;
+const onClickLeft = () => proxy.$router.push("/main/working");
+const onClickRight = () => {
+  proxy.$router.push({
+    path: "accountAdd",
+    query: {
+      type: "add",
+    },
+  });
+};
+const req = ref({
+  pageNum: 1,
+  keyword: null,
+});
+const finished = ref(false);
+const onRefresh = () => {
+  req.value.pageNum = 1;
+  finished.value = false;
+  getList("refresh");
+};
+const loading = ref(false);
+const listData = ref([]);
+const getList = (type) => {
+  loading.value = true;
+  proxy
+    .post("/accountManagement/page", req.value)
+    .then((res) => {
+      listData.value = type === "refresh" ? res.data.rows : listData.value.concat(res.data.rows);
+      if (req.value.pageNum * 10 >= res.data.total) {
+        finished.value = true;
+      }
+      req.value.pageNum++;
+      loading.value = false;
+    })
+    .catch(() => {
+      loading.value = false;
+    });
+};
+const toDtl = (row) => {
+  proxy.$router.push({
+    path: "accountAdd",
+    query: {
+      id: row.id,
+      type: "edit",
+    },
+  });
+};
+const listConfig = ref([
+  {
+    label: proxy.t("account.company"),
+    prop: "corporationName",
+  },
+  {
+    label: proxy.t("account.alias"),
+    prop: "alias",
+  },
+  {
+    label: proxy.t("account.accountOpening"),
+    prop: "accountOpening",
+  },
+]);
+</script>
+
+<style lang="scss" scoped>
+.list {
+  min-height: 70vh;
+}
+</style>

+ 1 - 5
src/views/fund/flow-of-funds/index.vue

@@ -50,13 +50,9 @@
               status = "-";
               style = "color: red";
             }
-            let currency = "";
-            if (item.currency) {
-              currency = item.currency;
-            }
             return {
               ...item,
-              currencyAmount: currency + " " + status + item.amount,
+              currencyAmount: item.currency + " " + status + item.amount,
               style: style,
             };
           });