123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592 |
- <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>
- <el-button
- class="el-button--small-yh add-customer-btn"
- type="primary"
- @click="editCustomer"
- >{{form.id?'确认修改':'确认新增'}}
- </el-button>
- </div>
- <div style="margin-top: 60px">
- <el-form :model="form" ref="form" label-width="100px" class="demo-ruleForm">
- <containerTitle title="基础资料"></containerTitle>
- <basic-container style="margin-bottom: 10px">
- <el-row>
- <el-col v-for="item in basicData.column" :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 :props="{label:'title'}" v-model="form[item.prop]" placeholder="请选择内容" type="tree" :dic="dic"
- ></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 style="margin-bottom: 10px">
- <el-row>
- <el-col v-for="item in contactInformation.column" :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 style="margin-bottom: 10px">
- <el-row>
- <el-col v-for="item in financialInformation.column" :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-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 style="margin-bottom: 10px">
- <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 style="margin-bottom: 40px">
- <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>
- </div>
- </template>
- <script>
- import {customerList, typeSave, detail, deleteDetails,
- corpstypeTree,
- corpsattn,
- corpsbank,
- corpsfiles,
- corpsitem} from "@/api/basicData/customerInformation"
- import customerContact from "./configuration/customerContact.json"
- import advantageProject from "./configuration/advantageProject.json"
- import bankOfDeposit from "./configuration/bankOfDeposit.json"
- export default {
- name: "detailsPage",
- data() {
- return {
- form: {},
- contactsForm: {},
- advantageProjectForm: {},
- bankOfDepositForm: {},
- contactsData: [],
- advantageProjectData: [],
- bankOfDepositData: [],
- dic:[],
- 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'
- }
- ]
- }
- ]
- },
- basicData: {
- column: [
- {
- label: '客户编码',
- prop: 'code',
- rules: [
- {
- required: true,
- message: ' ',
- trigger: 'blur'
- }
- ]
- }, {
- label: '代理品牌',
- prop: 'goodtypes',
- rules: [
- {
- required: true,
- message: ' ',
- trigger: 'blur'
- }
- ]
- }, {
- label: '所属公司',
- prop: 'belongtocompany',
- 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: true,
- message: ' ',
- trigger: 'blur'
- }
- ]
- }, {
- label: "代理区域",
- span: 24,
- prop: "belongtoarea",
- mock: {
- type: 'county'
- }
- }
- ]
- }
- }
- },
- created() {
- corpstypeTree().then(res=>{
- this.dic = 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
- });
- }
- },
- 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() {
- console.log(this.form)
- this.$refs["form"].validate((valid) => {
- if (valid) {
- this.form.corpsAttnList = this.contactsData
- this.form.corpsBankList = this.bankOfDepositData
- this.form.corpsItems = this.advantageProjectData
- // console.log(typeof(this.form.companytype))
- // this.form.corpsTypeId = JSON.stringify(this.form.corpsTypeId).replace(/[\[\]]/g,"")
- // console.log(typeof this.form.corpsTypeId)
- if (typeof this.form.corpsTypeId == 'object'){
- this.form.corpsTypeId = this.form.corpsTypeId.join(",")
- }
- typeSave(this.form).then(res => {
- console.log(res.data)
- this.$message({
- type: "success",
- message: this.form.id ? "修改成功!" : "新增成功!"
- });
- this.$router.$avueRouter.closeTag();
- this.$router.push({
- path: '/basicData/customerInformation/index',
- query: {}
- });
- })
- } else {
- return false;
- }
- });
- },
- backToList() {
- this.$router.$avueRouter.closeTag();
- this.$router.push({
- path: '/basicData/customerInformation/index',
- query: {}
- });
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .customer-head {
- position: fixed;
- top: 105px;
- width: 100%;
- margin-left: -10px;
- height: 62px;
- background: #ffffff;
- box-shadow: 0 4px 12px 0px rgba(232, 232, 235, 1);
- z-index: 999;
- /* display: flex;
- justify-content: left; */
- }
- .customer-back {
- cursor: pointer;
- line-height: 62px;
- font-size: 16px;
- color: #323233;
- font-weight: 400;
- }
- .back-icon {
- line-height: 64px;
- font-size: 20px;
- margin-right: 8px;
- }
- .add-customer-btn {
- position: fixed;
- right: 36px;
- top: 115px;
- }
- ::v-deep .el-form-item {
- margin-bottom: 0;
- }
- </style>
|