123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732 |
- <template>
- <div class="borderless">
- <div class="customer-head">
- <div class="customer-back">
- <!-- <i class="back-icon el-icon-arrow-left"></i><i style="font-style:normal">返回管理列表</i>-->
- <el-button
- type="danger"
- style="border: none;background: none;color: red"
- icon="el-icon-arrow-left"
- @click="backToList"
- >返回列表
- </el-button>
- </div>
- <div class="add-customer-btn">
- <el-button type="primary" @click="openFlow" size="small"
- >审 核
- </el-button>
- <el-button
- type="primary"
- :disabled="disabled"
- @click="editCustomer"
- size="small"
- >{{ form.id ? "确认修改" : "确认新增" }}
- </el-button>
- </div>
- </div>
- <div class="customer-main">
- <el-form
- :model="form"
- ref="form"
- label-width="100px"
- class="demo-ruleForm"
- >
- <containerTitle title="基础资料"></containerTitle>
- <basic-container>
- <el-row>
- <el-col
- v-for="(item, index) in basicData.column"
- :key="index"
- :span="item.span ? item.span : 8"
- >
- <el-form-item
- :label="item.label"
- :prop="item.prop"
- :rules="item.rules"
- >
- <avue-input-tree
- v-if="item.prop === 'corpsTypeId'"
- leaf-only
- multiple
- style="width: 100%;"
- size="small"
- :props="{ label: 'title' }"
- v-model="form[item.prop]"
- placeholder=" "
- type="tree"
- :dic="dic"
- ></avue-input-tree>
- <avue-input-tree
- v-else-if="item.prop === 'belongtoarea'"
- leaf-only
- multiple
- style="width: 100%;"
- size="small"
- :props="{ label: 'name', value: 'name' }"
- v-model="form[item.prop]"
- placeholder=" "
- type="tree"
- :dic="dicArea"
- ></avue-input-tree>
- <el-input
- type="age"
- v-else
- v-model="form[item.prop]"
- size="small"
- autocomplete="off"
- ></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- </basic-container>
- <containerTitle title="联系方式"></containerTitle>
- <basic-container>
- <el-row>
- <el-col
- v-for="(item, index) in contactInformation.column"
- :key="index"
- :span="item.span ? item.span : 8"
- >
- <el-form-item
- :label="item.label"
- :prop="item.prop"
- :rules="item.rules"
- >
- <el-input
- type="age"
- v-model="form[item.prop]"
- size="small"
- autocomplete="off"
- ></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- </basic-container>
- <containerTitle title="财务资料"></containerTitle>
- <basic-container>
- <el-row>
- <el-col
- v-for="(item, index) in financialInformation.column"
- :key="index"
- :span="item.span ? item.span : 8"
- >
- <el-form-item
- :label="item.label"
- :prop="item.prop"
- :rules="item.rules"
- >
- <el-switch
- v-if="item.prop === 'creditstatus'"
- v-model="form[item.prop]"
- active-value="0"
- inactive-value="1"
- active-text="开启"
- inactive-text="关闭"
- >
- </el-switch>
- <el-select
- v-else-if="item.prop === 'paymentType'"
- v-model="form[item.prop]"
- clearable
- filterable
- size="small"
- style="width: 100%;"
- >
- <el-option
- v-for="(item, index) in paymentOption"
- :key="index"
- :label="item.dictValue"
- :value="item.dictValue"
- ></el-option>
- </el-select>
- <el-input
- v-else
- type="age"
- v-model="form[item.prop]"
- size="small"
- autocomplete="off"
- ></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- </basic-container>
- <containerTitle title="客户联系人"></containerTitle>
- <basic-container>
- <avue-crud
- :option="customerContact"
- v-model="contactsForm"
- :data="contactsData"
- @row-save="rowSave"
- @row-update="rowUpdate"
- @row-del="rowDel"
- ></avue-crud>
- </basic-container>
- <!-- <containerTitle title="客户优势项目"></containerTitle>
- <basic-container style="margin-bottom: 10px">
- <avue-crud
- :option="advantageProject"
- v-model="advantageProjectForm"
- :data="advantageProjectData"
- @row-save="rowSaveProject"
- @row-update="rowUpdateProject"
- @row-del="rowDelProject"
- ></avue-crud>
- </basic-container> -->
- <containerTitle title="客户开户行"></containerTitle>
- <basic-container>
- <avue-crud
- :option="bankOfDeposit"
- v-model="bankOfDepositForm"
- :data="bankOfDepositData"
- @row-save="rowSaveBankOfDeposit"
- @row-update="rowUpdateBankOfDeposit"
- @row-del="rowDelBankOfDeposit"
- ></avue-crud>
- </basic-container>
- </el-form>
- </div>
- <flow-dialog :switchDialog="switchDialog" @onClose="onClose()">
- <template slot="content"> </template>
- </flow-dialog>
- </div>
- </template>
- <script>
- import {
- customerList,
- typeSave,
- detail,
- deleteDetails,
- corpstypeTree,
- corpsattn,
- corpsbank,
- corpsfiles,
- corpsitem,
- areaTypeTree
- } from "@/api/basicData/customerInformation";
- import customerContact from "./configuration/customerContact.json";
- import advantageProject from "./configuration/advantageProject.json";
- import bankOfDeposit from "./configuration/bankOfDeposit.json";
- import flowDialog from "@/components/flow-dialog/main";
- import { supplierParameter} from "@/enums/management-type";
- export default {
- name: "detailsPage",
- data() {
- return {
- switchDialog: false,
- form: {},
- disabled: false,
- contactsForm: {},
- advantageProjectForm: {},
- bankOfDepositForm: {},
- contactsData: [],
- advantageProjectData: [],
- bankOfDepositData: [],
- dic: [],
- dicArea: [],
- customerContact: customerContact,
- advantageProject: advantageProject,
- bankOfDeposit: bankOfDeposit,
- contactInformation: {
- column: [
- {
- label: "联系人",
- prop: "attn",
- rules: [
- {
- required: false,
- message: "请输入联系人",
- trigger: "blur"
- }
- ]
- },
- {
- label: "联系电话",
- prop: "tel",
- rules: [
- {
- required: false,
- message: "请输入联系电话",
- trigger: "blur"
- }
- ]
- },
- {
- label: "职位",
- prop: "positoin",
- rules: [
- {
- required: false,
- message: "请输入联系电话",
- trigger: "blur"
- }
- ]
- },
- {
- label: "单位地址",
- prop: "addr",
- rules: [
- {
- required: false,
- message: "请输入单位地址",
- trigger: "blur"
- }
- ]
- },
- {
- label: "仓库地址",
- prop: "storageAddr",
- rules: [
- {
- required: false,
- message: "请输入仓库地址",
- trigger: "blur"
- }
- ]
- },
- {
- label: "分仓地址",
- prop: "subStorageAddr",
- rules: [
- {
- required: false,
- message: "请输入分仓地址",
- trigger: "blur"
- }
- ]
- }
- ]
- },
- financialInformation: {
- column: [
- {
- label: "账户名称",
- prop: "accountName",
- rules: [
- {
- required: false,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "开户银行",
- prop: "accountBank",
- rules: [
- {
- required: false,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "银行帐号",
- prop: "accountNo",
- rules: [
- {
- required: false,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "外币账户名称",
- prop: "accountNameFcy",
- rules: [
- {
- required: false,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "外币开户银行",
- prop: "accountBankFcy",
- rules: [
- {
- required: false,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "外币银行账号",
- prop: "accountNoFcy",
- rules: [
- {
- required: false,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "授信状态",
- prop: "creditstatus",
- rules: [
- {
- required: false,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "授信等级",
- prop: "creditLevel",
- rules: [
- {
- required: false,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "授信额度",
- prop: "creditGrant",
- rules: [
- {
- required: false,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "授信天数",
- prop: "creditDay",
- rules: [
- {
- required: false,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "授信利率",
- prop: "creditRate",
- rules: [
- {
- required: false,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "FOB系数",
- prop: "coefficient"
- },
- {
- label: "付款方式",
- prop: "paymentType"
- }
- ]
- },
- basicData: {
- column: [
- {
- label: "编码",
- prop: "code",
- rules: [
- {
- required: true,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "名称",
- prop: "cname",
- rules: [
- {
- required: true,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "类别",
- prop: "corpsTypeId",
- rules: [
- {
- required: true,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "企业类型",
- prop: "companytype",
- rules: [
- {
- required: false,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "代理品牌",
- prop: "goodtypes",
- rules: [
- {
- required: false,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "所属公司",
- prop: "belongtocompany",
- rules: [
- {
- required: false,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "代理区域",
- prop: "belongtoarea",
- span: 24,
- mock: {
- type: "county"
- }
- },
- {
- label: "备注",
- prop: "remarks",
- span: 24,
- mock: {
- type: "county"
- }
- }
- ]
- },
- paymentOption: []
- };
- },
- components: {
- flowDialog
- },
- created() {
- corpstypeTree({ corpType: supplierParameter.code }).then(res => {
- this.dic = res.data.data;
- });
- areaTypeTree().then(res => {
- this.dicArea = res.data.data;
- });
- this.getWorkDicts("payment_term").then(res => {
- this.paymentOption = res.data.data;
- });
- if (this.$route.query.id) {
- let id = this.$route.query.id.replace(/\"/g, "");
- // let id = parseInt(this.$route.query.id)
- detail(id).then(res => {
- console.log(res.data.data);
- this.form = res.data.data;
- this.contactsData = this.form.corpsAttnList;
- this.bankOfDepositData = this.form.corpsBankList;
- this.advantageProjectData = this.form.corpsItems;
- delete this.form.corpsAttnList;
- delete this.form.corpsBankList;
- delete this.form.corpsItems;
- });
- } else {
- //新增时根据左侧选中树结构给客户类别赋值
- this.$set(this.form, "corpsTypeId", this.$route.query.treeDeptId);
- }
- },
- watch: {
- $route(to, from) {
- console.log(to, from);
- if (this.$route.query.id) {
- let id = JSON.parse(this.$route.query.id).replace(/\"/g, "");
- detail(id).then(res => {
- console.log(res.data.data);
- this.form = res.data.data;
- });
- } else {
- this.form = {};
- }
- }
- },
- methods: {
- //新增客户联系人保存触发
- rowSave(row, done, loading) {
- console.log(row, done, loading);
- this.contactsData.push(row);
- done();
- },
- //修改客户联系人触发
- rowUpdate(row, index, done, loading) {
- done(row);
- },
- //删除客户联系人触发
- rowDel(row, index, donerowDel) {
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- // 数据回调进行刷新
- if (row.id) {
- corpsattn(row.id).then(res => {
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.contactsData.splice(index, 1);
- });
- } else {
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.contactsData.splice(index, 1);
- }
- });
- },
- //新增客户优势项目保存触发
- rowSaveProject(row, done, loading) {
- console.log(row, done, loading);
- this.advantageProjectData.push(row);
- done();
- },
- //修改客户优势项目触发
- rowUpdateProject(row, index, done, loading) {
- done(row);
- },
- //删除客户优势项目触发
- rowDelProject(row, index, donerowDel) {
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- if (row.id) {
- corpsitem(row.id).then(res => {
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.advantageProjectData.splice(index, 1);
- });
- } else {
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.advantageProjectData.splice(index, 1);
- }
- });
- },
- //新增客户优势项目保存触发
- rowSaveBankOfDeposit(row, done, loading) {
- console.log(row, done, loading);
- this.bankOfDepositData.push(row);
- done();
- },
- //修改客户优势项目触发
- rowUpdateBankOfDeposit(row, index, done, loading) {
- done(row);
- },
- //删除客户优势项目触发
- rowDelBankOfDeposit(row, index, donerowDel) {
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- if (row.id) {
- corpsbank(row.id).then(res => {
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.bankOfDepositData.splice(index, 1);
- });
- } else {
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.bankOfDepositData.splice(index, 1);
- }
- });
- },
- //修改提交触发
- editCustomer() {
- this.$refs["form"].validate(valid => {
- if (valid) {
- this.form.corpsAttnList = this.contactsData;
- this.form.corpsBankList = this.bankOfDepositData;
- this.form.corpsItems = this.advantageProjectData;
- if (typeof this.form.corpsTypeId == "object") {
- this.form.corpsTypeId = this.form.corpsTypeId.join(",");
- }
- this.disabled = true;
- if (this.form.belongtoarea) {
- this.form.belongtoarea = this.form.belongtoarea.toString();
- }
- this.form.corpType = supplierParameter.code;
- typeSave(this.form).then(res => {
- if (res.data.data === "error") {
- this.disabled = false;
- this.$message({
- showClose: true,
- message: res.data.msg,
- type: "error"
- });
- } else {
- this.$message({
- type: "success",
- message: this.form.id ? "修改成功!" : "新增成功!"
- });
- this.$router.$avueRouter.closeTag();
- this.$router.push({
- path: "/basicData/customerManagement/supplierMaterial/index",
- query: {}
- });
- }
- });
- } else {
- return false;
- }
- });
- },
- backToList() {
- this.$router.$avueRouter.closeTag();
- this.$router.push({
- path: "/basicData/customerManagement/supplierMaterial/index",
- query: {}
- });
- },
- openFlow() {
- this.switchDialog = !this.switchDialog;
- },
- onClose(val) {
- this.switchDialog = val;
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- ::v-deep .el-form-item {
- margin-bottom: 0;
- }
- </style>
|