| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017 |
- <template>
- <div>
- <el-button
- size="mini"
- :disabled="data.datastatus === 2 || !data.disabled || data.status == '已终止'"
- :type="data.datastatus === 2 || !data.disabled || data.status == '已终止' ? '' : 'primary'"
- @click="show"
- >{{ $t("编 辑") }}</el-button
- >
- <el-drawer
- :title="$t(`编辑客户`)"
- :visible.sync="dialogFormVisible"
- size="600px"
- direction="rtl"
- :show-close="false"
- append-to-body
- @close="onClose"
- >
- <div class="drawer__panel">
- <el-row :gutter="20">
- <el-form
- :model="form"
- :rules="rules"
- ref="form"
- :label-width="tool.onlyZh('100px')"
- label-position="right"
- size="mini"
- >
- <el-col :span="20">
- <el-form-item :label="$t('客户名称') + ':'" prop="enterprisename">
- <el-input
- v-model="form.enterprisename"
- :placeholder="$t('请输入客户名称')"
- style="width: 100%"
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="4">
- <businessInquiry
- ref="businessRef"
- @businessData="businessSelect"
- :keyword="form.enterprisename"
- ></businessInquiry>
- </el-col>
- <el-col :span="24">
- <el-form-item :label="$t('企业简称') + ':'">
- <el-input
- v-model="form.abbreviation"
- :placeholder="$t('请输入企业简称')"
- style="width: 100%"
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item :label="$t('客户类型') + ':'" prop="type">
- <el-select
- v-model="form.type"
- :placeholder="$t('请选择客户类型')"
- style="width: 100%"
- >
- <el-option
- v-for="item in options.type"
- :key="item.value"
- :label="$t(item.value)"
- :value="item.value"
- >
- <span style="float: left">{{ $t(item.value) }}</span>
- <span
- style="float: right; color: #8492a6; font-size: 12px"
- >{{
- item.remarks ? $t(item.remarks) : $t("暂无描述")
- }}</span
- >
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item :label="$t('客户等级') + ':'">
- <el-select
- v-model="form.grade"
- :placeholder="$t('请选择客户等级')"
- style="width: 100%"
- >
- <el-option
- v-for="item in options.customerGrade"
- :key="item.rowindex"
- :label="$t(item.value)"
- :value="item.value"
- >
- <span style="float: left">{{ $t(item.value) }}</span>
- <span
- style="float: right; color: #8492a6; font-size: 12px"
- >{{
- item.remarks ? $t(item.remarks) : $t("暂无描述")
- }}</span
- >
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item :label="$t('客户分类') + ':'" prop="customergrade">
- <el-select
- v-model="form.customergrade"
- :placeholder="$t('请选择客户分类')"
- style="width: 100%"
- >
- <el-option
- v-for="item in options.customerClassification"
- :key="item.rowindex"
- :label="$t(item.value)"
- :value="item.value"
- >
- <span style="float: left">{{ $t(item.value) }}</span>
- <span
- style="float: right; color: #8492a6; font-size: 12px"
- >{{
- item.remarks ? $t(item.remarks) : $t("暂无描述")
- }}</span
- >
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item :label="$t('客户行业') + ':'" prop="industry">
- <el-select
- ref="sle"
- style="width: 100%"
- v-model="form.industry"
- multiple
- :placeholder="$t('请选择所属行业')"
- size="mini"
- >
- <el-option
- v-for="item in options.industryData"
- :key="item.value"
- :label="$t(item.value)"
- :value="item.value"
- >
- <span style="float: left">{{ $t(item.value) }}</span>
- <span
- style="float: right; color: #8492a6; font-size: 12px"
- >{{
- item.remarks ? $t(item.remarks) : $t("暂无描述")
- }}</span
- >
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item :label="$t('联系人') + ':'">
- <el-input
- autosize
- v-model="form.contactsinfo.name"
- :placeholder="$t(`请输入联系人姓名`)"
- disabled
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="24" v-if="isPhone">
- <el-form-item
- :label="$t('联系方式') + ':'"
- prop="contactsinfo.phonenumber"
- >
- <el-button-group>
- <el-radio v-model="isPhone" :label="true" disabled>{{
- $t("手机号")
- }}</el-radio>
- <el-radio v-model="isPhone" :label="false" disabled>{{
- $t("座机电话")
- }}</el-radio>
- </el-button-group>
- <el-input
- v-model="form.contactsinfo.phonenumber"
- :placeholder="$t('请输入手机号')"
- style="width: 100%; margin-top: 10px"
- disabled
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="24" v-if="!isPhone">
- <el-form-item
- :label="$t('联系方式') + ':'"
- prop="contactsinfo.telephone"
- >
- <el-button-group>
- <el-radio v-model="isPhone" :label="true" disabled>{{
- $t("手机号")
- }}</el-radio>
- <el-radio v-model="isPhone" :label="false" disabled>{{
- $t("座机电话")
- }}</el-radio>
- </el-button-group>
- <div style="width: 100%">
- <el-input
- v-model="areaCode"
- :placeholder="$t('请输入区号')"
- style="width: 25%; margin-top: 10px"
- disabled
- ></el-input>
- <span style="color: #999999">——</span>
- <el-input
- v-model="telephone"
- :placeholder="$t('请输入座机电话')"
- style="width: 68%; margin-top: 10px"
- disabled
- ></el-input>
- </div>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item :label="$t('税号') + ':'">
- <el-input
- v-model="form.taxno"
- :placeholder="$t('请输入企业税号')"
- style="width: 100%"
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item :label="$t('法人') + ':'" prop="contact">
- <el-input
- v-model="form.contact"
- :placeholder="$t('请输入法人信息')"
- style="width: 100%"
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item :label="$t('联系电话') + ':'" prop="telephone">
- <el-input
- v-model="form.telephone"
- :placeholder="$t('请输入联系电话')"
- style="width: 100%"
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item :label="$t('省市县') + ':'" prop="province">
- <el-cascader
- :placeholder="$t('请选择')"
- style="width: 100%"
- v-model="form.value"
- :options="basicData.data().areaData"
- @change="cascaderChange"
- clearable
- >
- </el-cascader>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item :label="$t('详细地址') + ':'">
- <el-input
- v-model="form.address"
- :placeholder="$t('请输入详细地址')"
- style="width: 100%"
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item
- :label="$t('上级企业') + ':'"
- prop="superiorenterprisename"
- >
- <el-popover
- placement="bottom"
- width="700"
- trigger="click"
- v-model="customerShow"
- @show="customerList"
- >
- <el-input
- style="width: 300px; margin-bottom: 10px"
- :placeholder="$t('请输入内容')"
- v-model="customerParam.content.where.condition"
- clearable
- @clear="
- customerList((customerParam.content.pageNumber = 1))
- "
- size="mini"
- @keyup.enter.native="
- customerList((customerParam.content.pageNumber = 1))
- "
- >
- <i
- slot="prefix"
- class="el-icon-search"
- @click="
- customerList((customerParam.content.pageNumber = 1))
- "
- ></i>
- </el-input>
- <el-table
- :data="customer.customerData"
- @row-click="customerData"
- height="396px"
- :header-cell-style="{
- background: '#EEEEEE',
- color: '#333',
- }"
- size="mini"
- >
- <el-table-column :label="$t('客户编号')" width="100">
- <template slot-scope="scope">
- <span style="margin-left: 10px">{{
- scope.row.sa_customersid
- ? scope.row.sa_customersid
- : "--"
- }}</span>
- </template>
- </el-table-column>
- <el-table-column :label="$t('客户名称')" width="260">
- <template slot-scope="scope">
- <span style="margin-left: 10px">{{
- scope.row.enterprisename
- ? scope.row.enterprisename
- : "--"
- }}</span>
- </template>
- </el-table-column>
- <el-table-column :label="$t('地址')">
- <template slot-scope="scope">
- <span style="margin-left: 10px">{{
- scope.row.address ? scope.row.address : "--"
- }}</span>
- </template>
- </el-table-column>
- </el-table>
- <div class="container normal-panel" style="text-align: right">
- <el-pagination
- background
- small
- @size-change="handleSizeChangeCustomer"
- @current-change="handleCurrentChangeCustomer"
- :page-sizes="[20, 50, 100]"
- layout="total,sizes, prev, pager, next, jumper"
- :current-page="customer.currentPage"
- :total="customer.total"
- >
- </el-pagination>
- </div>
- <el-input
- slot="reference"
- :readonly="true"
- v-model="form.superiorenterprisename"
- autocomplete="off"
- :placeholder="$t('请选择客户')"
- @input="selectCustomer"
- ></el-input>
- </el-popover>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item :label="$t('客户来源') + ':'">
- <selectTemp
- ref="sourceRef"
- :placeholder="$t('请选择来源')"
- payload="cluesource"
- @selectChange="selectSource"
- :cluesource="form.source"
- ></selectTemp>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item :label="$t(`归属经销商`) + ':'">
- <el-popover
- placement="bottom"
- width="700"
- trigger="click"
- v-model="agentsShow"
- @show="queryAgents"
- >
- <el-input
- style="width: 300px; margin-bottom: 10px"
- :placeholder="$t('请输入内容')"
- v-model="agentsParam.content.where.condition"
- clearable
- @clear="queryAgents((agentsParam.content.pageNumber = 1))"
- size="mini"
- @keyup.enter.native="
- queryAgents((agentsParam.content.pageNumber = 1))
- "
- >
- <i
- slot="prefix"
- class="el-icon-search"
- @click="queryAgents((agentsParam.content.pageNumber = 1))"
- ></i>
- </el-input>
- <el-table
- :data="agents.agentsData"
- @row-click="agentsData"
- height="396px"
- :header-cell-style="{
- background: '#EEEEEE',
- color: '#333',
- }"
- size="mini"
- >
- <el-table-column :label="$t(`经销商编码`)" width="100">
- <template slot-scope="scope">
- <span style="margin-left: 10px">{{
- scope.row.agentnum ? scope.row.agentnum : "--"
- }}</span>
- </template>
- </el-table-column>
- <el-table-column :label="$t('经销商名称')" width="260">
- <template slot-scope="scope">
- <span style="margin-left: 10px">{{
- scope.row.enterprisename
- ? scope.row.enterprisename
- : "--"
- }}</span>
- </template>
- </el-table-column>
- <el-table-column :label="$t('地址')">
- <template slot-scope="scope">
- <span style="margin-left: 10px">{{
- scope.row.address ? scope.row.address : "--"
- }}</span>
- </template>
- </el-table-column>
- </el-table>
- <div class="container normal-panel" style="text-align: right">
- <el-pagination
- background
- small
- @size-change="handleSizeChangeAgent"
- @current-change="handleCurrentChangeAgent"
- :page-sizes="[20, 50, 100]"
- layout="total,sizes, prev, pager, next, jumper"
- :current-page="agents.currentPage"
- :total="agents.total"
- >
- </el-pagination>
- </div>
- <el-input
- slot="reference"
- :readonly="true"
- v-model="form.agentname"
- autocomplete="off"
- :placeholder="$t(`请选择经销商`)"
- @input="selectAgents"
- ></el-input>
- </el-popover>
- </el-form-item>
- </el-col>
- </el-form>
- </el-row>
- </div>
- <div class="fixed__btn__panel">
- <el-button
- size="small"
- @click="onClose"
- class="normal-btn-width inline-16"
- >{{ $t("取 消") }}</el-button
- >
- <duplicateCheck
- :data="form"
- ref="check"
- @onSuccess="onClose"
- @onCheck="onCheck"
- ></duplicateCheck>
- <el-button
- size="small"
- type="warning"
- :loading="loading"
- @click="onSave"
- class="normal-btn-width"
- >{{ $t("保 存") }}</el-button
- >
- </div>
- </el-drawer>
- <enterprise
- :visible="visibleEnterprise"
- :index="index"
- :sa_projectid="form.sa_projectid"
- v-if="visibleEnterprise"
- @onEnterprise="onEnterprise"
- >
- </enterprise>
- </div>
- </template>
- <script>
- import enterprise from "@/SDrpManagement/salerPrivatecustomer/components/enterprise";
- import duplicateCheck from "@/components/duplicatesCheck/customerCheck";
- import businessInquiry from "@/template/businessInquiry/index";
- import { mapGetters } from "vuex";
- export default {
- name: "edit",
- props: ["data", "btnType"],
- components: { enterprise, duplicateCheck, businessInquiry },
- data() {
- return {
- isPhone: true,
- dialogFormVisible: false,
- visibleEnterprise: false,
- checkResults: "",
- index: "",
- disabled: true,
- userInfo: JSON.parse(window.sessionStorage.getItem("userInfo")),
- businessData: [],
- businessParam: {
- id: 20221208103601,
- content: {
- pageNumber: 1,
- pageSize: 5,
- keyword: "",
- },
- },
- businessShow: false,
- total: 0,
- currentPage: 0,
- form: {
- sa_customersid: 0, //新增是传0
- parentid: 0, //上级客户ID,默认或没有上级的时候传0
- sys_enterpriseid: 0, //合作企业档案ID,新增是传0,更新
- enterprisename: "", //客户名称(企业名称)
- type: "", //客户类型
- source: "", //客户来源
- province: "", //非必填,可选
- city: "", //非必填,可选
- county: "", //非必填,可选
- address: "", //非必填,可选
- abbreviation: "", //非必填,可选
- taxno: "", //税号,非必填,可选
- grade: "", // 客户等级(商户等级)
- industry: [], //非必填,可选,所属行业
- contact: "", //非必填,可选
- phonenumber: "", //非必填,可选
- customergrade: "",
- ispublic: 0, //1:公海客户,0:私域客户,自己新建的
- telephone: "",
- sa_agentsid: "",
- value: "",
- contactsinfo: {
- name: "",
- telephone: "",
- phonenumber: "",
- oldcontactsid: "",
- },
- },
- options: {
- type: [],
- parentCustomers: [],
- industryData: [],
- customerGrade: [],
- customerClassification: [],
- distributor: [],
- },
- rules: {
- enterprisename: [
- { required: true, message: this.$t("输入客户"), trigger: "blur" },
- ],
- type: [
- {
- required: true,
- message: this.$t("请选择客户类型"),
- trigger: "change",
- },
- ],
- contact: [
- {
- required: false,
- message: this.$t("请输入法人"),
- trigger: "change,blur",
- },
- ],
- telephone: [
- {
- required: false,
- message: this.$t("请输入联系电话"),
- trigger: "change,blur",
- },
- /* { pattern:/^1[3-9]\d{9}$/, message: this.$t('请输入正确手机号码'),trigger: 'change' }*/
- ],
- province: [
- {
- required: true,
- message: this.$t("请选择省市县"),
- trigger: "change,blur",
- },
- ],
- source: [
- {
- required: true,
- message: this.$t("请选择客户来源"),
- trigger: "change",
- },
- ],
- "contactsinfo.name": [
- {
- required: false,
- message: this.$t("请输入联系人姓名"),
- trigger: "change,blur",
- },
- ],
- "contactsinfo.phonenumber": [
- {
- required: false,
- message: this.$t("请输入联系电话"),
- trigger: "change",
- },
- {
- pattern: /^1[3-9]\d{9}$/,
- message: this.$t("请输入正确手机号码"),
- trigger: "change",
- },
- ],
- "contactsinfo.telephone": [
- {
- required: false,
- message: this.$t("请输入座机电话"),
- trigger: "change",
- },
- {
- pattern: /^0\d{2,3}-\d{7,8}$/,
- message: this.$t("请输入正确座机电话"),
- trigger: "change",
- },
- ],
- customergrade: [
- { required:JSON.parse(sessionStorage.getItem('active_account')).siteid == 'HY'?true:false, message: this.$t('请选择客户分类'), trigger: 'change' },
- ],
- industry: [
- { required:JSON.parse(sessionStorage.getItem('active_account')).siteid == 'HY'?true:false, message: this.$t('请选择客户行业'), trigger: 'change' },
- ],
- },
- areaCode: "",
- telephone: "",
- agentsShow: false,
- agentsParam: {
- id: 20230214162602,
- content: {
- hrid: "",
- pageNumber: 1,
- pageSize: 20,
- where: {
- condition: "",
- },
- },
- },
- agents: {
- agentsData: [],
- total: 0,
- currentPage: 0,
- },
- customerParam: {
- id: 20220920083901,
- content: {
- pageNumber: 1,
- pageSize: 20,
- where: {
- condition: "",
- type: 2,
- sa_projectid: "",
- },
- },
- },
- customer: {
- customerData: [],
- total: 0,
- currentPage: 0,
- },
- customerShow: false,
- };
- },
- watch: {
- mainData(val) {
- if (this.data.leader.length !== 0) {
- if (
- JSON.parse(window.sessionStorage.getItem("userInfo")).userid ===
- this.data.leader[0].userid
- ) {
- this.disabled = false;
- } else {
- this.disabled = true;
- }
- }
- console.log("权限结果", this.disabled);
- },
- },
- computed: {
- ...mapGetters({
- loading: "loading",
- }),
- },
- methods: {
- onClose() {
- this.dialogFormVisible = false;
- this.businessShow = false;
- this.$emit("onSuccess");
- },
- show() {
- this.dialogFormVisible = true;
- this.typeList();
- /*this.parentCustomer()*/
- this.gradeList();
- this.industryList();
- this.queryCustomerGrade();
- /*let arr = ['province','city','county']
- arr.forEach(e=>{
- this.data[e] !== '' ?this.form.value.push(this.data[e]):''
- })*/
- this.form = Object.assign({}, this.form, this.data);
- this.form.value = [this.form.province, this.form.city, this.form.county];
- if (this.form.grade === 0) {
- this.form.grade = "";
- }
- if (this.form.sa_agentsid === 0) {
- this.form.sa_agentsid = "";
- }
- this.form.contactsinfo.name = this.form.contactsinfo[0].name;
- if (
- this.form.contactsinfo[0].phonenumber.substring(
- 0,
- this.form.contactsinfo[0].phonenumber.indexOf("-")
- )
- ) {
- this.isPhone = false;
- this.areaCode = this.form.contactsinfo[0].phonenumber.substring(
- 0,
- this.form.contactsinfo[0].phonenumber.indexOf("-")
- );
- this.telephone = this.form.contactsinfo[0].phonenumber.substring(
- this.areaCode.length + 1
- );
- this.form.contactsinfo.phonenumber =
- this.areaCode + "-" + this.telephone;
- } else {
- this.isPhone = true;
- this.form.contactsinfo.phonenumber =
- this.form.contactsinfo[0].phonenumber;
- }
- /*if (this.form.parentid === 0){
- this.form.parentid = '未选择'
- }*/
- },
- /*工商查询*/
- async businessSearch() {
- this.businessParam.content.keyword = this.form.enterprisename;
- const res = await this.$api.requested(this.businessParam);
- console.log(res, "工商查询结果");
- this.businessData = res.data;
- this.total = res.total;
- this.currentPage = res.pageNumber;
- this.businessShow = true;
- },
- /*选择工商信息*/
- businessSelect(val, regProvince) {
- this.$confirm(
- this.$t("是否以查询的工商信息更新客户信息") + "?",
- this.$t("提示"),
- {
- confirmButtonText: this.$t("确定"),
- cancelButtonText: this.$t("取消"),
- type: "warning",
- }
- )
- .then(() => {
- this.$refs.businessRef.businessShow = false;
- this.form.enterprisename = val.companyName;
- this.form.address = val.address === "-" ? "" : val.address;
- this.form.taxno = val.taxNum;
- this.form.value = [regProvince, val.regCity, val.regArea];
- this.form.province = regProvince;
- this.form.city = val.regCity;
- this.form.county = val.regArea;
- this.form.contact = val.legalPerson;
- this.form.telephone = val.phone;
- })
- .catch(() => {
- this.$refs.businessRef.businessShow = false;
- this.$message({
- type: "info",
- message: this.$t("已取消更新"),
- });
- });
- },
- /*查重检查*/
- onCheck() {
- this.$refs.form.validate((valid) => {
- if (!valid) return false;
- this.$refs.check.creatShow = false;
- this.$refs.check.queryRule();
- });
- },
- /*自动查重判断*/
- duplicateCheck() {
- this.$refs.form.validate(async (valid) => {
- if (!valid) return false;
- const res = await this.$api.requested({
- id: 20221208172002,
- content: {
- sa_customersid: this.form.sa_customersid,
- enterprisename: this.form.enterprisename,
- taxno: this.form.taxno,
- address: this.form.address,
- },
- });
- console.log(res, "查重结果");
- if (res.data.length !== 0) {
- console.log("重复");
- }
- this.checkResults = res.data.length;
- this.onSave();
- });
- },
- onSave() {
- this.$refs.form.validate((valid) => {
- if (!valid) return false;
- this.$refs.check.creatShow = true;
- this.$refs.check.buttonTitle = "确定保存";
- this.$store.commit("setLoading", true);
- this.$refs.check.queryRule(() => {
- this.$store.commit("setLoading", false);
- });
- });
- },
- onSubmit() {
- console.log(this.form);
- this.$refs["form"].validate(async (valid) => {
- if (!valid) return false;
- const res = await this.$api.requested({
- id: 20221012163902,
- content: this.form,
- });
- this.tool.showMessage(res, () => {
- if (this.checkResults === 0) {
- this.$emit("onSuccess");
- this.$refs["form"].resetFields();
- this.dialogFormVisible = false;
- this.checkResults = "";
- } else {
- this.setTag(this.form.sa_customersid);
- }
- });
- });
- },
- async setTag(id) {
- const res = await this.$api.requested({
- id: 20220929090901,
- content: {
- ownertable: "sa_customers",
- ownerid: id,
- datatag: ["疑似重复"],
- },
- });
- this.$emit("onSuccess");
- this.$refs["form"].resetFields();
- this.dialogFormVisible = false;
- this.checkResults = "";
- },
- /*客户类型列表*/
- async typeList() {
- const siteid = JSON.parse(
- sessionStorage.getItem("active_account")
- ).siteid;
- const res = await this.$api.requested({
- classname: "sysmanage.develop.optiontype.optiontype",
- method: "optiontypeselect",
- content: {
- pageNumber: 1,
- pageSize: 20,
- typename: "customertypemx",
- parameter: {
- siteid: siteid,
- },
- },
- });
- this.options.type = res.data;
- },
- enterpriseList() {
- this.visibleEnterprise = true;
- },
- /*上级客户列表*/
- onEnterprise(data) {
- this.visibleEnterprise = false;
- console.log("企业信息", data);
- this.form.parentid = data.sys_enterpriseid;
- this.form.superiorenterprisename = data.enterprisename;
- },
- /*省市县*/
- cascaderChange(val) {
- this.form.province = val[0];
- if (val.length === 1)
- return (this.form = Object.assign({}, this.form, {
- province: val[0],
- city: "",
- county: "",
- }));
- this.form = Object.assign({}, this.form, {
- province: val[0],
- city: val[1],
- county: val[2],
- });
- this.$refs.form.validateField("province");
- },
- /*客户分类*/
- async gradeList() {
- const siteid = JSON.parse(
- sessionStorage.getItem("active_account")
- ).siteid;
- const res = await this.$api.requested({
- classname: "sysmanage.develop.optiontype.optiontype",
- method: "optiontypeselect",
- content: {
- pageNumber: 1,
- pageSize: 20,
- typename: "customergrade",
- parameter: {
- siteid: siteid,
- },
- },
- });
- this.options.customerClassification = res.data;
- },
- /*客户等级*/
- queryCustomerGrade() {
- this.$store.dispatch("optiontypeselect", "agentgrade").then((res) => {
- this.options.customerGrade = res.data;
- });
- },
- /*行业列表*/
- async industryList() {
- const siteid = JSON.parse(
- sessionStorage.getItem("active_account")
- ).siteid;
- const res = await this.$api.requested({
- classname: "sysmanage.develop.optiontype.optiontype",
- method: "optiontypeselect",
- content: {
- pageNumber: 1,
- pageSize: 20,
- typename: "industry",
- parameter: {
- siteid: siteid,
- },
- },
- });
- this.options.industryData = res.data;
- },
- /*所属经销商*/
- async queryAgents() {
- var sessionData = sessionStorage.getItem("active_account");
- this.agentsParam.content.hrid = JSON.parse(sessionData).hrid;
- const res = await this.$api.requested(this.agentsParam);
- this.agents.agentsData = res.data;
- this.agents.total = res.total;
- this.agents.currentPage = res.pageNumber;
- console.log(this.agents.agentsData, "经销商");
- },
- selectAgents() {
- this.agentsParam.content.where.condition = this.form.agentname;
- this.queryAgents();
- },
- /*客户选择信息*/
- agentsData(val) {
- this.form.sa_agentsid = val.sa_agentsid;
- this.form.agentname = val.enterprisename;
- this.agentsShow = false;
- },
- /*客户分页*/
- handleSizeChangeAgent(val) {
- // console.log(`每页 ${val} 条`);
- this.agentsParam.content.pageSize = val;
- this.queryAgents();
- },
- handleCurrentChangeAgent(val) {
- // console.log(`当前页: ${val}`);
- this.agentsParam.content.pageNumber = val;
- this.queryAgents();
- },
- async customerList() {
- const res = await this.$api.requested(this.customerParam);
- this.customer.customerData = res.data;
- this.customer.total = res.total;
- this.customer.currentPage = res.pageNumber;
- },
- selectCustomer() {
- this.customerParam.content.where.condition = this.form.enterprisename;
- this.customerList();
- },
- /*客户选择信息*/
- customerData(val) {
- this.form.parentid = val.sa_customersid;
- this.form.superiorenterprisename = val.enterprisename;
- this.customerShow = false;
- },
- /*客户分页*/
- handleSizeChangeCustomer(val) {
- // console.log(`每页 ${val} 条`);
- this.customerParam.content.pageSize = val;
- this.customerList();
- },
- handleCurrentChangeCustomer(val) {
- // console.log(`当前页: ${val}`);
- this.customerParam.content.pageNumber = val;
- this.customerList();
- },
- selectSource(data) {
- this.form.source = data;
- },
- },
- };
- </script>
- <style scoped>
- </style>
|