| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145 |
- <template>
- <div>
- <div class="borderless">
- <div class="customer-head">
- <div class="customer-back">
- <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" size="small" @click="editCustomer"> 保存数据 </el-button>
- <el-button
- v-if="form.id && (form.checkStatus == '录入' || form.checkStatus == '审核驳回')"
- class="el-button--small-yh"
- style="margin-left: 6px"
- type="success"
- size="small"
- @click="allClick('提交审批')"
- >提交审批
- </el-button>
- <el-button
- v-if="form.id && form.checkStatus == '提交'"
- class="el-button--small-yh"
- style="margin-left: 6px"
- type="success"
- size="small"
- @click="allClick('审批')"
- >审批
- </el-button>
- <el-button
- class="el-button--small-yh"
- :type="form.enableOrNot == 0 ? 'primary' : ''"
- size="small"
- v-if="form.id"
- @click="editEnable"
- >
- {{ form.enableOrNot == 0 ? "启用" : "禁用" }}
- </el-button>
- </div>
- </div>
- <trade-card title="基础资料" style="margin-top: 60px" v-loading="loadingBtn">
- <avue-form ref="form" class="trading-form" v-model="form" :option="option">
- <template slot="corpsTypeIdLabel">
- <span style="color: #409eff; cursor: pointer" @click="corpTypeVisible = true"> 客户分类 </span>
- </template>
- <template slot="corpsTypeId">
- <avue-input-tree
- v-model="form.corpsTypeId"
- :disabled="option.disabled"
- placeholder="请选择客户分类"
- :dic="corpTypeList"
- :props="props"
- >
- </avue-input-tree>
- </template>
- <tempalte slot="salesmanName">
- <dic-select
- v-model="form.salesmanName"
- placeholder="业务员"
- label="name"
- @selectChange="dicChange('salesmanName', $event)"
- :disabled="option.disabled"
- url="/blade-user/salerList"
- :filterable="true"
- dataName="name"
- >
- </dic-select>
- </tempalte>
- <tempalte slot="deliveryWarehouseName">
- <dic-select
- v-model="form.deliveryWarehouseName"
- placeholder="发货仓库"
- label="cname"
- res="records"
- url="/gubersail-admin/storageDesc/list?current=1&size=5"
- :filterable="true"
- :remote="true"
- dataName="cname"
- @selectChange="dicChange('deliveryWarehouseName', $event)"
- :disabled="option.disabled"
- ></dic-select>
- </tempalte>
- <tempalte slot="label">
- <dic-select
- :key="labelKey"
- v-model="form.label"
- placeholder="门店标签"
- label="label"
- res="records"
- url="/gubersail-admin/corpslabel/list?current=1&size=5"
- :filterable="true"
- :remote="true"
- dataName="label"
- :disabled="option.disabled"
- ></dic-select>
- </tempalte>
- <tempalte slot="brandName">
- <dic-select
- v-model="form.brandName"
- placeholder="品牌"
- label="cname"
- url="/gubersail-admin/brandDesc/listAllV1?type=PP"
- :filterable="true"
- @selectChange="dicChange('brandName', $event)"
- :multiple="true"
- :disabled="option.disabled"
- dataType="string"
- ></dic-select>
- </tempalte>
- <template slot="labelLabel">
- <span style="color: #409eff; cursor: pointer" @click="labelVisible = true"> 门店标签 </span>
- </template>
- </avue-form>
- </trade-card>
- <trade-card title="客户联系人" v-loading="loadingBtn">
- <avue-crud
- ref="crudTwo"
- :option="customerContactBack"
- v-model="contactsForm"
- :data="contactsData"
- @row-save="rowSave"
- @row-update="rowUpdate"
- @row-del="rowDelTwo"
- >
- <template slot="menuLeft">
- <el-button
- type="primary"
- icon="el-icon-plus"
- size="small"
- @click.stop="$refs.crudTwo.rowAdd()"
- :disabled="option.disabled"
- >录入明细
- </el-button>
- </template>
- <template slot-scope="{ type, size, row, disabled, index }" slot="menu">
- <el-button
- :size="size"
- :disabled="option.disabled"
- :type="type"
- :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
- @click="$refs.crudTwo.rowEdit(row, index)"
- >{{ row.$cellEdit ? "确认" : "修改" }}
- </el-button>
- <el-button
- icon="el-icon-delete"
- :size="size"
- :disabled="option.disabled"
- :type="type"
- @click="rowDelTwo(row, index)"
- >删除
- </el-button>
- <el-button
- icon="el-icon-check"
- :size="size"
- :type="type"
- @click="creatingUsers(row)"
- :disabled="option.disabled"
- >创建用户
- </el-button>
- </template>
- </avue-crud>
- </trade-card>
- <trade-card title="地址信息" v-loading="loadingBtn">
- <avue-crud :option="option2" ref="crud" :data="data" @row-save="rowSave" @row-update="rowUpdate">
- <template slot="headerSerial">
- <el-button
- type="primary"
- icon="el-icon-plus"
- size="mini"
- @click.stop="addRow"
- :disabled="detailData.status == 1"
- circle
- ></el-button>
- </template>
- <template slot="menuLeft">
- <el-button type="primary" icon="el-icon-plus" size="small" @click.stop="addRow" :disabled="option.disabled"
- >录入明细
- </el-button>
- </template>
- <template v-if="!row.$cellEdit" slot-scope="{ type, size, row, index, disabled }" slot="menu">
- <el-button
- :size="size"
- :disabled="option.disabled"
- :type="type"
- :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
- @click="$refs.crud.rowCell(row, index)"
- >{{ row.$cellEdit ? "确认" : "修改" }}
- </el-button>
- <el-button
- icon="el-icon-delete"
- :size="size"
- :disabled="option.disabled"
- :type="type"
- @click="rowDel(row, index)"
- >删除
- </el-button>
- </template>
- <template slot="defaultAddres" slot-scope="{ row, index, disabled }">
- <el-switch
- active-value="1"
- inactive-value="0"
- :disabled="option.disabled"
- v-model="row.defaultAddres"
- @change="addressUnique(row, index)"
- >
- </el-switch>
- </template>
- </avue-crud>
- </trade-card>
- <containerTitle title="上传附件"></containerTitle>
- <c-upload
- v-loading="loadingBtn"
- typeUpload="CD"
- deleteUrl="/api/gubersail-admin/corpsfiles/remove"
- :data="corpsFiles"
- display
- :enumerationValue="35.1"
- :disabled="option.disabled"
- :mainImageType="true"
- ></c-upload>
- <el-dialog
- title="设置客户分类"
- v-dialogDrag
- :visible.sync="corpTypeVisible"
- class="avue-dialog"
- width="80%"
- append-to-body
- @closed="corpTypeClosed"
- >
- <span>
- <corp-type v-if="corpTypeVisible"></corp-type>
- </span>
- <div class="avue-dialog__footer">
- <el-button @click="corpTypeVisible = false" size="mini">取 消</el-button>
- <el-button @click="addCorpType" type="primary" size="mini">确 定</el-button>
- </div>
- </el-dialog>
- </div>
- <el-dialog
- title="设置门店标签"
- v-dialogDrag
- :visible.sync="labelVisible"
- class="avue-dialog"
- width="80%"
- append-to-body
- @closed="labelClosed"
- >
- <span>
- <corp-label v-if="labelVisible"></corp-label>
- </span>
- <div class="avue-dialog__footer">
- <el-button @click="labelVisible = false" size="mini">取 消</el-button>
- <el-button @click="addLabel" type="primary" size="mini">确 定</el-button>
- </div>
- </el-dialog>
- <el-dialog title="创建用户" :visible.sync="dialogVisibleBt" append-to-body width="60%">
- <avue-form v-if="dialogVisibleBt" ref="formDataTwo" v-model="formDataTwo" :option="optionData"> </avue-form>
- <span slot="footer" class="dialog-footer">
- <el-button @click="dialogVisibleBt = false">取 消</el-button>
- <el-button type="primary" @click="confirmSynchronizationTwo">确 定</el-button>
- </span>
- </el-dialog>
- </div>
- </template>
- <script>
- // @ts-nocheck
- import {
- getDetails,
- getCorpType,
- submit,
- customerList,
- areaTypeTree,
- itemDel,
- corpsattn,
- editenable,
- getUserByRole,
- getBrandDesc,
- creatingUsersTwo,
- submitApply,
- review,
- } from "@/api/store/customerInformation";
- import { getRoleTree } from "@/api/system/role";
- import { getDeptTree } from "@/api/system/dept";
- import { getPostList } from "@/api/system/post";
- import corpType from "./components/index.vue";
- import corpLabel from "./components/label.vue";
- import website from "@/config/website";
- import dicSelect from "@/components/dicSelect/main.vue";
- import { getToken } from "@/util/auth";
- export default {
- name: "index",
- data() {
- return {
- labelKey: Date.now(),
- labelVisible: false,
- propsCk: {
- label: "cname",
- value: "id",
- },
- props: {
- label: "title",
- value: "value",
- },
- optionData: {
- span: 8,
- menuBtn: false,
- column: [
- {
- label: "所属角色",
- prop: "roleId",
- multiple: true,
- type: "tree",
- dicData: [],
- props: {
- label: "title",
- },
- checkStrictly: true,
- slot: true,
- rules: [
- {
- required: true,
- message: "请选择所属角色",
- trigger: "click",
- },
- ],
- },
- {
- label: "所属部门",
- prop: "deptId",
- type: "tree",
- multiple: true,
- dicData: [],
- props: {
- label: "title",
- },
- checkStrictly: true,
- slot: true,
- rules: [
- {
- required: true,
- message: "请选择所属部门",
- trigger: "click",
- },
- ],
- },
- {
- label: "所属岗位",
- prop: "postId",
- type: "tree",
- multiple: true,
- dicData: [],
- props: {
- label: "postName",
- value: "id",
- },
- rules: [
- {
- required: true,
- message: "请选择所属岗位",
- trigger: "click",
- },
- ],
- },
- ],
- },
- dialogVisibleBt: false,
- formDataTwo: false,
- customerContact: {},
- contactsForm: {},
- contactsData: [],
- corpTypeList: [],
- corpTypeVisible: false,
- loadingBtn: false,
- form: {
- ifLimitAmount: "0",
- },
- form4: {},
- data: [],
- data2: [],
- option: {
- menuBtn: false,
- span: 6,
- column: [
- {
- label: "客户名称",
- prop: "cname",
- rules: [
- {
- required: true,
- message: "",
- trigger: "blur",
- },
- ],
- },
- {
- label: "客户分类",
- prop: "corpsTypeId",
- rules: [
- {
- required: true,
- message: " ",
- trigger: "blur",
- },
- ],
- },
- {
- label: "电话",
- prop: "tel",
- },
- {
- label: "业务员",
- prop: "salesmanName",
- rules: [
- {
- required: true,
- message: " ",
- trigger: "blur",
- },
- ],
- },
- {
- label: "发货仓库",
- prop: "deliveryWarehouseName",
- rules: [
- {
- required: true,
- message: " ",
- trigger: "blur",
- },
- ],
- },
- {
- label: "商城价格",
- prop: "priceSystem",
- filterable: true,
- type: "select",
- dicUrl: "/api/blade-system/dict-biz/dictionary?code=mall_price",
- props: {
- label: "dictValue",
- value: "dictKey",
- },
- rules: [
- {
- required: true,
- message: " ",
- trigger: "blur",
- },
- ],
- },
- {
- label: "积分余额",
- prop: "pointsBalance",
- type: "number",
- controls: false,
- precision: 2,
- disabled: true,
- },
- {
- label: "品牌",
- prop: "brandName",
- rules: [
- {
- message: "请选择品牌",
- trigger: "click",
- },
- ],
- },
- {
- label: "门店标签",
- prop: "label",
- },
- {
- label: "店面属性",
- prop: "storeAttributes",
- type: "select",
- dicUrl: "/api/blade-system/dict-biz/dictionary?code=storeAttributes",
- props: {
- label: "dictValue",
- value: "dictKey",
- },
- },
- {
- label: "连锁属性",
- prop: "chainAttribute",
- type: "select",
- dicUrl: "/api/blade-system/dict-biz/dictionary?code=chainAttribute",
- props: {
- label: "dictValue",
- value: "dictKey",
- },
- },
- {
- label: "签约级别",
- prop: "signingLevel",
- type: "select",
- dicUrl: "/api/blade-system/dict-biz/dictionary?code=signingLevel",
- props: {
- label: "dictValue",
- value: "dictKey",
- },
- },
- {
- label: "签约条数",
- prop: "signingNumber",
- },
- {
- label: "签约期限起",
- prop: "signingPeriodStart",
- type: "month",
- format: "yyyy-MM",
- valueFormat: "yyyy-MM-01 00:00:00",
- },
- {
- label: "签约期限止",
- prop: "signingPeriodEnd",
- type: "month",
- format: "yyyy-MM",
- valueFormat: "yyyy-MM-01 00:00:00",
- },
- {
- label: "备注",
- prop: "remarks",
- type: "textarea",
- minRows: 2,
- },
- {
- label: "营业执照",
- prop: "businessLicenseUrl",
- type: "upload",
- listType: "picture-img",
- fileType: "img", //img/video/audio
- propsHttp: {
- res: "data",
- url: "link",
- },
- action: "/api/blade-resource/oss/endpoint/put-file",
- headers: { "Blade-Auth": "Bearer " + getToken() },
- },
- ],
- },
- option2: {
- align: "center",
- index: true,
- addBtnText: "录入明细",
- refreshBtn: false,
- dialogDrag: true,
- addBtn: false,
- span: 8,
- height: 300,
- editBtn: false,
- delBtn: false,
- menuWidth: 140,
- dialogTop: 25,
- dialogWidth: "80%",
- addRowBtn: false,
- cellBtn: true,
- rowKey: "index",
- cancelBtn: false,
- columnBtn: false,
- // saveBtn:false,
- column: [
- {
- label: "联系人",
- prop: "contacts",
- cell: true,
- rules: [
- {
- required: true,
- message: " ",
- trigger: "blur",
- },
- ],
- },
- {
- label: "电话",
- prop: "tel",
- cell: true,
- rules: [
- {
- required: true,
- message: " ",
- trigger: "blur",
- },
- ],
- },
- {
- label: "地址",
- prop: "belongtoarea",
- dicData: [],
- dataType: "string",
- type: "cascader",
- props: {
- label: "name",
- value: "name",
- },
- rules: [
- {
- required: true,
- message: " ",
- trigger: "blur",
- },
- ],
- filterable: true,
- cell: true,
- },
- {
- label: "详细地址",
- prop: "detailedAddress",
- cell: true,
- rules: [
- {
- required: true,
- message: " ",
- trigger: "blur",
- },
- ],
- },
- {
- label: "备注",
- prop: "remarks",
- cell: true,
- },
- {
- label: "默认地址",
- prop: "defaultAddres",
- display: false,
- width: 100,
- },
- ],
- },
- option3: {},
- option4: {
- menuBtn: false,
- labelWidth: 80,
- column: [
- {
- label: "分类名称",
- prop: "cname",
- rules: [
- {
- required: true,
- message: "",
- trigger: "blur",
- },
- ],
- span: 24,
- },
- {
- label: "上级类型",
- prop: "parentId",
- dicData: [],
- type: "tree",
- props: {
- label: "cname",
- value: "id",
- },
- span: 24,
- },
- ],
- },
- corpsFiles: [],
- customerContactBack: {
- align: "center",
- index: true,
- // addBtnText: "录入明细",
- refreshBtn: false,
- dialogDrag: true,
- addBtn: false,
- span: 8,
- height: 300,
- addRowBtn: false,
- editBtn: false,
- delBtn: false,
- menuWidth: 200,
- dialogTop: 25,
- dialogWidth: "80%",
- columnBtn: false,
- column: [
- {
- label: "联系人",
- prop: "cname",
- cell: true,
- rules: [
- {
- required: true,
- message: " ",
- trigger: "blur",
- },
- ],
- },
- {
- label: "电话",
- prop: "tel",
- cell: true,
- rules: [
- {
- required: true,
- message: " ",
- trigger: "blur",
- },
- ],
- },
- // {
- // label: "登录用户id",
- // prop: "userId",
- // cell: true
- // },
- {
- label: "备注",
- prop: "remarks",
- cell: true,
- },
- ],
- },
- userObj: {},
- };
- },
- components: { corpType, dicSelect, corpLabel },
- props: {
- detailData: {
- type: Object,
- },
- },
- async created() {
- if (this.detailData.id) {
- this.getDetail(this.detailData.id);
- }
- if (this.detailData.status == 1) {
- this.option.disabled = true;
- }
- if (!website.tenantMode) {
- this.initData(website.tenantId);
- } else {
- this.initData();
- }
- this.getCorpType();
- this.getAllWorkDicts();
- this.userObj = JSON.parse(localStorage.getItem("saber-userInfo")).content;
- },
- activated() {
- setTimeout(() => {
- this.$nextTick(() => {
- this.$refs.crud.doLayout();
- });
- }, 100);
- },
- methods: {
- allClick(name) {
- if (name == "提交审批") {
- this.$confirm("是否提交审批?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- }).then(() => {
- let obj = {
- id: this.form.id,
- };
- submitApply(obj).then((res) => {
- this.$message.success("操作成功");
- this.getDetail(this.form.id);
- });
- });
- }
- if (name == "审批") {
- this.$confirm("是否通过审核?", "提示", {
- distinguishCancelAndClose: true,
- confirmButtonText: "通过",
- cancelButtonText: "驳回",
- type: "warning",
- })
- .then(() => {
- let obj = {
- id: this.form.id,
- type: 1,
- };
- review(obj).then((res) => {
- this.$message.success("操作成功");
- this.getDetail(this.form.id);
- });
- })
- .catch((action) => {
- if (action == "cancel") {
- let obj = {
- id: this.form.id,
- type: 2,
- };
- review(obj).then((res) => {
- this.$message.success("操作成功");
- this.getDetail(this.form.id);
- });
- }
- });
- }
- },
- dicChange(name, row) {
- if (name == "salesmanName") {
- if (row) {
- this.form.salesmanId = row.id;
- } else {
- this.form.salesmanId = null;
- this.form.salesmanName = null;
- }
- }
- if (name == "brandName") {
- if (row) {
- this.form.brandId = row.ids;
- this.form.brandName = row.names;
- } else {
- this.form.brandId = null;
- this.form.brandName = null;
- }
- }
- if (name == "deliveryWarehouseName") {
- if (row) {
- this.form.deliveryWarehouseId = row.id;
- } else {
- this.form.deliveryWarehouseId = null;
- this.form.deliveryWarehouseName = null;
- }
- }
- },
- // 启用或禁用
- editEnable() {
- if (this.form.checkStatus != "审核通过") {
- return this.$message.error("审核通过以后可以启用");
- }
- let data = this.form;
- editenable({ id: data.id, enableOrNot: data.enableOrNot ? 0 : 1 }).then((res) => {
- this.$message({
- type: "success",
- message: data.enableOrNot ? "禁用成功!" : "启用成功!",
- });
- this.getDetail(this.detailData.id);
- // this.$set(this.form, 'enableOrNot', data.enableOrNot == 1 ? 0 : 1)
- });
- },
- addressUnique(row, index) {
- for (let item in this.data) {
- if (index != item) {
- if (this.data[item].defaultAddres == 1) {
- this.$message.warning("默认地址只能唯一");
- return (row.defaultAddres = 0);
- }
- }
- }
- },
- initData(tenantId) {
- getRoleTree(tenantId).then((res) => {
- const column = this.findObject(this.optionData.column, "roleId");
- column.dicData = res.data.data;
- });
- getDeptTree(tenantId).then((res) => {
- const column = this.findObject(this.optionData.column, "deptId");
- column.dicData = res.data.data;
- });
- getPostList(tenantId).then((res) => {
- const column = this.findObject(this.optionData.column, "postId");
- column.dicData = res.data.data;
- });
- },
- //确认创建用户
- confirmSynchronizationTwo() {
- this.$refs.formDataTwo.validate((valid, done) => {
- done();
- if (valid) {
- let data = JSON.parse(JSON.stringify(this.formDataTwo));
- data.deptId = data.deptId.join(",");
- data.roleId = data.roleId.join(",");
- data.postId = data.postId.join(",");
- creatingUsersTwo({
- ...data,
- id: this.formRow.id,
- }).then((res) => {
- this.dialogVisibleBt = false;
- this.formDataTwo = {};
- this.$message.success("创建用户成功,默认帐号:手机号。默认密码:123456");
- this.getDetail(this.form.id);
- });
- } else {
- return false;
- }
- });
- },
- getAllWorkDicts() {
- customerList({ corpType: "KH" }).then((res) => {
- this.findObject(this.option4.column, "parentId").dicData = res.data.data.records;
- });
- this.findObject(this.option2.column, "belongtoarea").dicData = JSON.parse(localStorage.getItem("areaTypeTree"))
- ? JSON.parse(localStorage.getItem("areaTypeTree"))
- : [];
- },
- getDetail(id) {
- this.loadingBtn = true;
- getDetails({ id: id })
- .then((res) => {
- if (res.data.data.enableOrNot == 1) {
- this.$set(this.option, "disabled", true);
- } else {
- this.$set(this.option, "disabled", false);
- }
- this.data = res.data.data.corpsAddrList;
- this.corpsFiles = res.data.data.corpsFilesList;
- this.contactsData = res.data.data.corpsAttnList;
- this.form = res.data.data;
- })
- .finally(() => {
- this.loadingBtn = false;
- });
- },
- addRow() {
- this.data.push({ $cellEdit: true });
- },
- rowDel(row, index) {
- this.$confirm("确定删除数据?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- }).then(() => {
- if (row.id) {
- itemDel(row.id).then((res) => {
- this.$message({
- type: "success",
- message: "删除成功!",
- });
- this.data.splice(index, 1);
- });
- } else {
- this.$message({
- type: "success",
- message: "删除成功!",
- });
- this.data.splice(index, 1);
- }
- });
- },
- addRow2() {
- this.data2.push({ $cellEdit: true, type: 1 });
- },
- rowCell2(row, index) {
- if (row.$cellEdit == true) {
- this.$set(row, "$cellEdit", false);
- } else {
- this.$set(row, "$cellEdit", true);
- }
- },
- rowDe2(row, index) {
- this.$confirm("确定删除数据?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- }).then(() => {
- if (row.id) {
- // itemDel(row.id).then(res => {
- // this.$message({
- // type: "success",
- // message: "删除成功!"
- // });
- // this.data2.splice(index, 1);
- // });
- } else {
- this.$message({
- type: "success",
- message: "删除成功!",
- });
- this.data2.splice(index, 1);
- }
- });
- },
- corpTypeClosed() {
- // this.reload = Math.random();
- // this.form4 = this.$options.data().form4
- },
- getCorpType() {
- getCorpType({ corpType: "KH" }).then((res) => {
- this.corpTypeList = res.data.data;
- });
- },
- addCorpType() {
- this.getCorpType();
- this.corpTypeVisible = false;
- },
- addLabel() {
- this.labelKey = Date.now();
- this.labelVisible = false;
- },
- //修改提交触发
- editCustomer() {
- this.$refs.form.validate((valid, done) => {
- done();
- if (valid) {
- if (this.contactsData.length == 0) return this.$message.error("请添加客户联系人");
- if (this.data.length == 0) return this.$message.error("请添加地址信息");
- if (this.corpsFiles.filter((item) => item.mainImage == 1).length > 1)
- return this.$message.error("附件主图只允许选一个");
- this.loadingBtn = true;
- submit({
- ...this.form,
- code: this.form.cname,
- corpType: "KH",
- corpsAddrList: this.data,
- corpsFilesList: this.corpsFiles,
- corpsAttnList: this.contactsData,
- billType: 1,
- })
- .then((res) => {
- this.$message.success("保存成功");
- this.form = res.data.data;
- this.data = res.data.data.corpsAddrList;
- this.corpsFiles = res.data.data.corpsFilesList;
- this.getDetail(res.data.data.id);
- })
- .finally(() => {
- this.loadingBtn = false;
- });
- } else {
- return false;
- }
- });
- },
- creatingUsers(row) {
- console.log("row", row);
- if (!row.id) {
- return this.$message.error("请保存数据");
- }
- if (!row.cname || !row.tel) {
- return this.$message.error("请完善联系人和电话");
- }
- if (!row.id) {
- return this.$message.error("请保存数据");
- }
- if (row.userId) {
- return this.$message.error("已创建,请勿重复操作");
- }
- this.$confirm("是否创建用户?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- }).then(() => {
- creatingUsersTwo({
- id: row.id,
- }).then((res) => {
- this.$message.success("创建用户成功,默认帐号:手机号。默认密码:123456");
- this.getDetail(this.form.id);
- });
- });
- },
- //新增客户联系人保存触发
- rowSave(row, done, loading) {
- if (this.data.length == 1) {
- this.$set(row, "defaultAddres", "1");
- }
- done(row);
- },
- //修改客户联系人触发
- rowUpdate(row, index, done, loading) {
- done(row);
- },
- //删除客户联系人触发
- rowDelTwo(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);
- }
- });
- },
- //返回列表
- backToList() {
- this.$emit("goBack");
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .trading-form ::v-deep .el-form-item {
- margin-bottom: 8px !important;
- }
- ::v-deep .el-dialog__body {
- padding: 0px 20px 15px 20px;
- }
- ::v-deep .el-form-item__error {
- display: none !important;
- }
- .el-dialog ::v-deep .el-form-item__error {
- display: none !important;
- }
- .img-form ::v-deep .el-form-item {
- height: 150px;
- line-height: 150px;
- margin-bottom: 8px !important;
- }
- .img-form ::v-deep .avue-upload__icon {
- font-size: 20px;
- width: 150px;
- height: 150px;
- line-height: 150px;
- }
- ::v-deep .el-table .cell {
- padding: 0 2px !important;
- }
- ::v-deep .avue-crud .el-table .el-form-item__label {
- left: -1px;
- }
- .addressTabs {
- display: flex;
- justify-content: center;
- span {
- width: 100px;
- font-size: 18px;
- font-weight: 600;
- text-align: center;
- }
- }
- </style>
|