Browse Source

客户等级管理模块

cz 1 year ago
parent
commit
3acdcad2f2

+ 15 - 2
src/views/customer/addCustomer.vue

@@ -283,6 +283,7 @@ const { proxy } = getCurrentInstance();
 const loading = ref(false);
 const userList = ref([]);
 const deptData = ref([]);
+const customerSlevelData = ref([]);
 const customerTag = computed(
   () => proxy.useUserStore().allDict["customer_tag"]
 );
@@ -340,6 +341,18 @@ const getDict = () => {
     });
 
   proxy
+    .post("/customerLv/page", {
+      pageNum: 1,
+      pageSize: 999,
+    })
+    .then((res) => {
+      customerSlevelData.value = res.rows.map((x) => ({
+        label: x.lvName,
+        value: x.id,
+      }));
+    });
+
+  proxy
     .get("/tenantDept/list", {
       pageNum: 1,
       pageSize: 9999,
@@ -562,9 +575,9 @@ const formConfig = computed(() => {
     {
       type: "select",
       label: "客户分级",
-      prop: "level",
+      prop: "customerLvId",
       itemWidth: 25,
-      data: customerSlevel.value,
+      data: customerSlevelData.value,
     },
     {
       type: "input",

+ 288 - 0
src/views/customer/level/index.vue

@@ -0,0 +1,288 @@
+<template>
+  <div class="pageIndexClass">
+    <div class="content">
+      <byTable :source="sourceList.data" :pagination="sourceList.pagination" :config="config" :loading="loading" highlight-current-row :action-list="[
+          {
+            text: '添加',
+            action: () => openModal('add'),
+          },
+        ]" @get-list="getList">
+      </byTable>
+    </div>
+
+    <el-dialog :title="modalType == 'add' ? '添加' : '编辑'" v-if="dialogVisible" v-model="dialogVisible" width="50%">
+      <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit" v-loading="loadingDialog">
+
+      </byForm>
+      <template #footer>
+        <el-button @click="dialogVisible = false" size="default">取 消</el-button>
+        <el-button type="primary" @click="submitForm()" size="default">确 定</el-button>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+
+<script setup>
+import { computed, ref } from "vue";
+import byTable from "@/components/byTable/index";
+import byForm from "@/components/byForm/index";
+import useUserStore from "@/store/modules/user";
+import { ElMessage, ElMessageBox } from "element-plus";
+
+const { proxy } = getCurrentInstance();
+const accountCurrency = ref([]);
+const typeData = ref([
+  {
+    label: "收入",
+    value: "10",
+  },
+  {
+    label: "支出",
+    value: "20",
+  },
+]);
+const sourceList = ref({
+  data: [],
+  pagination: {
+    total: 0,
+    pageNum: 1,
+    pageSize: 10,
+    keyword: "",
+  },
+});
+const loading = ref(false);
+const config = computed(() => {
+  return [
+    {
+      attrs: {
+        label: "等级名称",
+        prop: "lvName",
+      },
+    },
+
+    {
+      attrs: {
+        label: "至少几天跟进一次",
+        prop: "minNotFollow",
+      },
+    },
+    {
+      attrs: {
+        label: "超几天未跟进转公海",
+        prop: "maxNotFollow",
+      },
+    },
+
+    {
+      attrs: {
+        label: "操作",
+        width: "120",
+        align: "center",
+      },
+      renderHTML(row) {
+        return [
+          {
+            attrs: {
+              label: "修改",
+              type: "primary",
+              text: true,
+            },
+            el: "button",
+            click() {
+              update(row);
+            },
+          },
+          {
+            attrs: {
+              label: "删除",
+              type: "danger",
+              text: true,
+            },
+            el: "button",
+            click() {
+              proxy
+                .msgConfirm()
+                .then((res) => {
+                  proxy
+                    .post("/customerLv/delete", {
+                      id: row.id,
+                    })
+                    .then((res) => {
+                      proxy.msgTip("操作成功", 1);
+                      getList();
+                    });
+                })
+                .catch((err) => {});
+            },
+          },
+        ];
+      },
+    },
+  ];
+});
+const corporationList = ref([]);
+
+const getList = async (req) => {
+  sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
+  loading.value = true;
+  proxy.post("/customerLv/page", sourceList.value.pagination).then((res) => {
+    sourceList.value.data = res.rows;
+    sourceList.value.pagination.total = res.total;
+    setTimeout(() => {
+      loading.value = false;
+    }, 200);
+  });
+};
+getList();
+const modalType = ref("add");
+const dialogVisible = ref(false);
+const loadingDialog = ref(false);
+const submit = ref(null);
+const formOption = reactive({
+  inline: true,
+  labelWidth: 150,
+  itemWidth: 100,
+  rules: [],
+});
+const formConfig = computed(() => {
+  return [
+    // {
+    //   type: "title1",
+    //   title: "基本信息",
+    // },
+    {
+      type: "input",
+      prop: "lvName",
+      label: "等级名称",
+      required: true,
+      itemWidth: 100,
+      itemType: "text",
+    },
+    {
+      type: "number",
+      prop: "minNotFollow",
+      label: "至少几天跟进一次",
+      precision: 0,
+      min: 0,
+      // max: 100,
+      controls: false,
+      itemWidth: 100,
+    },
+    {
+      type: "number",
+      prop: "maxNotFollow",
+      label: "超几天未跟进转公海",
+      precision: 0,
+      min: 0,
+      // max: 100,
+      controls: false,
+      itemWidth: 100,
+    },
+  ];
+});
+const rules = ref({
+  lvName: [{ required: true, message: "请输入等级名称", trigger: "blur" }],
+  minNotFollow: [
+    { required: true, message: "请输入至少几天跟进一次", trigger: "blur" },
+  ],
+  maxNotFollow: [
+    { required: true, message: "请输入超几天未跟进转公海", trigger: "blur" },
+  ],
+});
+const formData = reactive({
+  data: {
+    accountRemainderList: [{ currency: "", remainder: undefined }],
+  },
+});
+const openModal = (val) => {
+  modalType.value = val;
+  formData.data = {
+    accountRemainderList: [{ currency: "", remainder: undefined }],
+  };
+  loadingDialog.value = false;
+  dialogVisible.value = true;
+};
+const clickBalance = () => {
+  if (
+    formData.data.accountRemainderList &&
+    formData.data.accountRemainderList.length > 0
+  ) {
+    formData.data.accountRemainderList.push({
+      currency: "",
+      remainder: undefined,
+    });
+  } else {
+    formData.data.accountRemainderList = [
+      { currency: "", remainder: undefined },
+    ];
+  }
+};
+const handleRemove = (index) => {
+  formData.data.accountRemainderList.splice(index, 1);
+};
+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 submitForm = () => {
+  submit.value.handleSubmit(() => {
+    loadingDialog.value = true;
+    proxy.post("/customerLv/" + modalType.value, formData.data).then(
+      () => {
+        proxy.msgTip("操作成功", 1);
+        dialogVisible.value = false;
+        getList();
+      },
+      (err) => {
+        console.log(err);
+        loadingDialog.value = false;
+      }
+    );
+    // if (
+    //   formData.data.accountRemainderList &&
+    //   formData.data.accountRemainderList.length > 0
+    // ) {
+    //   if (isRepeat(formData.data.accountRemainderList)) {
+    //     return ElMessage("请勿重复添加货币余额");
+    //   } else {
+    //     loadingDialog.value = true;
+    //     proxy.post("/accountManagement/" + modalType.value, formData.data).then(
+    //       () => {
+    //         ElMessage({
+    //           message: modalType.value == "add" ? "添加成功" : "编辑成功",
+    //           type: "success",
+    //         });
+    //         dialogVisible.value = false;
+    //         getList();
+    //       },
+    //       (err) => {
+    //         console.log(err);
+    //         loadingDialog.value = false;
+    //       }
+    //     );
+    //   }
+    // } else {
+    //   return ElMessage("请添加至少一条类型余额");
+    // }
+  });
+};
+const update = (row) => {
+  loadingDialog.value = false;
+  modalType.value = "edit";
+  formData.data = proxy.deepClone(row);
+  dialogVisible.value = true;
+};
+</script>
+
+<style lang="scss" scoped>
+.tenant {
+  padding: 20px;
+}
+::v-deep(.el-input-number .el-input__inner) {
+  text-align: left;
+}
+</style>

+ 23 - 22
src/views/finance/fundManage/accountPayment/index.vue

@@ -214,7 +214,7 @@ const config = computed(() => {
       attrs: {
         label: "业务公司",
         prop: "corporationName",
-        width: 110,
+        width: 130,
       },
     },
     {
@@ -227,18 +227,18 @@ const config = computed(() => {
     {
       attrs: {
         label: "付款类型",
-        prop: "type",
+        prop: "typeName",
         width: 130,
       },
-      render(type) {
-        if (type == 40) {
-          return "售后";
-        } else if (type == 20) {
-          return "采购付款 - 申请";
-        } else {
-          return "请款: " + proxy.dictValueLabel(type, fundsType.value);
-        }
-      },
+      // render(type) {
+      //   if (type == 40) {
+      //     return "售后";
+      //   } else if (type == 20) {
+      //     return "采购付款 - 申请";
+      //   } else {
+      //     return "请款: " + proxy.dictValueLabel(type, fundsType.value);
+      //   }
+      // },
     },
     {
       attrs: {
@@ -345,17 +345,17 @@ const config = computed(() => {
                     .catch(() => {});
                 },
               },
-          {
-            attrs: {
-              label: "打印",
-              type: "primary",
-              text: true,
-            },
-            el: "button",
-            click() {
-              clickPrint(row);
-            },
-          },
+          // {
+          //   attrs: {
+          //     label: "打印",
+          //     type: "primary",
+          //     text: true,
+          //   },
+          //   el: "button",
+          //   click() {
+          //     clickPrint(row);
+          //   },
+          // },
           {
             attrs: {
               label: "查看",
@@ -655,6 +655,7 @@ const submitForm = () => {
 
 const getDtl = (row) => {
   proxy.post("/accountPayment/detail", { id: row.id }).then((res) => {
+    // res.paymentMethod = "bank1";
     formData.data = res;
     formData.data.fileList = [];
     if (submitType.value === "add") {

+ 1 - 0
src/views/finance/fundManage/costControl/index.vue

@@ -681,6 +681,7 @@ const getDtl = (row) => {
   proxy
     .post("/accountPayment/detail", { id: row.accountPaymentId })
     .then((res) => {
+      // res.paymentMethod = "bank1";
       formData.data = res;
       formData.data.fileList = [];
       formData.data.expensesTime = formData.data.updateTime;