| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413 |
- <template>
- <!--上级企业 负责人-->
- <div>
- <el-button size="small" type="primary" @click="dialogFormVisible = true">新 建</el-button>
- <el-drawer
- direction="rtl"
- append-to-body
- title="创建公海客户"
- :show-close="false"
- :visible.sync="dialogFormVisible"
- @close="onClose"
- size="600px">
- <div class="drawer__panel">
- <el-row :gutter="20">
- <el-form :model="form" :rules="rules" ref="form" label-width="90px" label-position="right" size="mini">
- <el-col :span="20">
- <el-form-item label="客户名称:" prop="enterprisename">
- <el-input v-model="form.enterprisename" placeholder="客户名称"></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="4">
- <el-popover
- placement="right"
- width="900"
- v-model="businessShow"
- trigger="click">
- <el-table :data="businessData" @row-click="businessSelect" :header-cell-style="{background:'#EEEEEE',color:'#333'}" size="mini">
- <el-table-column width="260" label="客户名称">
- <template slot-scope="scope">
- <span style="margin-left: 10px">{{ scope.row.companyName?scope.row.companyName:'--' }}</span>
- </template>
- </el-table-column>
- <el-table-column label="客户地址">
- <template slot-scope="scope">
- <span style="margin-left: 10px">{{ scope.row.address?scope.row.address:'--' }}</span>
- </template>
- </el-table-column>
- <el-table-column width="200" label="客户税号">
- <template slot-scope="scope">
- <span style="margin-left: 10px">{{ scope.row.taxNum?scope.row.taxNum:'--' }}</span>
- </template>
- </el-table-column>
- </el-table>
- <!-- <div class="container normal-panel" style="text-align:right">
- <el-pagination
- background
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- :current-page="currentPage"
- :page-sizes="[5]"
- layout="total,sizes, prev, pager, next, jumper"
- :total="total">
- </el-pagination>
- </div>-->
- <el-button size="mini" type="primary" style="width: 100%" @click="businessSearch" slot="reference">工商查询</el-button>
- </el-popover>
- </el-col>
- <el-col :span="24">
- <el-form-item label="客户类型:" prop="type">
- <el-select v-model="form.type" placeholder="请选择客户类型" size="small">
- <el-option
- v-for="item in customerType()"
- :key="item.value"
- :label="item.value"
- :value="item.value">
- <span style="float: left">{{ item.value }}</span>
- <span v-if="item.remarks !== ''" style="float: right; color: #8492a6; font-size: 10px">{{ item.remarks }}</span>
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item label="客户来源:" prop="source">
- <el-input v-model="form.source" placeholder="客户来源"></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item label="客户等级:" prop="grade">
- <el-select v-model="form.grade" placeholder="请选择客户等级" size="small">
- <el-option
- v-for="item in customerLead()"
- :key="item.rowindex"
- :label="item.value"
- :value="item.rowindex">
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item label="详细地址:" prop="address">
- <el-input v-model="form.address" placeholder="详细地址"></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item label="企业简称:" prop="abbreviation">
- <el-input v-model="form.abbreviation" placeholder="企业简称"></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item label="税号:" prop="taxno">
- <el-input v-model="form.taxno" placeholder="税号"></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item label="所属行业:" prop="industry">
- <el-input v-model="form.industry" placeholder="所属行业"></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item label="联系人:" prop="contact">
- <el-input v-model="form.contact" placeholder="联系人"></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item label="联系电话:" prop="phonenumber">
- <el-input v-model="form.phonenumber" placeholder="联系电话"></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item label="省市县:" prop="province">
- <el-cascader
- size="small"
- v-model="form.province"
- :options="arealist()"
- @change="cascaderChange"
- ref="cascader">
- </el-cascader>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item label="公海池:" prop="sa_customerpoolid">
- <el-select v-model="form.sa_customerpoolid" placeholder="请选择公海池" size="small">
- <el-option
- v-for="item in publicList()"
- :key="item.sa_customerpoolid"
- :label="item.poolname"
- :value="item.sa_customerpoolid">
- </el-option>
- </el-select>
- </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">取 消</el-button>
- <duplicateCheck :data="form"></duplicateCheck>
- <el-button size="small" type="primary" @click="onSave" class="normal-btn-width">确 定</el-button>
- </div>
- </el-drawer>
- </div>
- </template>
- <script>
- import duplicateCheck from "@/SDrpManagement/salerPrivatecustomer/components/duplicateCheck";
- export default {
- name: "add",
- inject:['customerLead','customerType','arealist','publicList'],
- components:{duplicateCheck},
- data(){
- return {
- dialogFormVisible:false,
- isordercheck:true,
- isusedcheck:false,
- checkResults:'',
- 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": "", //客户类型
- "sa_customerpoolid": '', //客户池(公海池)ID,默认或没有的时候传0
- "source": "", //客户来源
- "province":"",//非必填,可选
- "city":"",//非必填,可选
- "county":"",//非必填,可选
- "address":"",//非必填,可选
- "abbreviation":"",//非必填,可选
- "taxno":"",//税号,非必填,可选
- "grade":'',// 客户等级(商户等级)
- "industry":"",//非必填,可选,所属行业
- "contact":"",//非必填,可选
- "phonenumber":"",//非必填,可选
- "ispublic":1
- },
- rules:{
- enterprisename:[
- { required: true, message: '输入客户名称', trigger: 'blur'},
- ],
- type: [
- { required: true, message: '还未选择客户类型', trigger: 'change' },
- ],
- source:[
- { required: false, message: '请填写客户来源', trigger: 'blur'}
- ],
- sa_customerpoolid:[
- { required: true, message: '请选择公海池', trigger: 'blur'}
- ]
- }
- }
- },
- methods:{
- /*工商查询*/
- 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
- },
- /*选择工商信息*/
- businessSelect(val){
- console.log("选择的工商信息",val)
- this.$confirm('是否以查询的工商信息更新客户信息?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- this.businessShow = false
- this.form.enterprisename = val.companyName
- this.form.address = val.address
- this.form.taxno = val.taxNum
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消更新'
- });
- })
- },
- /*handleSizeChange(val) {
- // console.log(`每页 ${val} 条`);
- this.param.content.pageSize = val
- this.businessSearch()
- },
- handleCurrentChange(val) {
- // console.log(`当前页: ${val}`);
- this.param.content.pageNumber = val
- this.businessSearch()
- },*/
- /*自动查重判断*/
- 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(){
- if (this.checkResults === ''){
- this.duplicateCheck()
- }else {
- if (this.checkResults !== 0){
- this.$confirm('该客户疑似重复,是否确认创建客户?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- this.onSubmit()
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消创建'
- });
- });
- }else {
- this.onSubmit()
- }
- }
- },
- onSubmit(){
- this.$refs['form'].validate(async (valid) => {
- if (!valid) return false
- if (this.form.province) {
- this.form.city = this.form.province[1]
- this.form.county = this.form.province[2]
- this.form.province = this.form.province[0]
- }
- const res = await this.$api.requested({
- "id": "20221010164302",
- "version":1,
- "content": this.form
- })
- this.tool.showMessage(res,()=>{
- if (this.checkResults === 0){
- this.$emit('onSuccess')
- this.$refs['form'].resetFields();
- this.form = {
- "sa_customersid": 0,//新增是传0
- "parentid": 0, //上级客户ID,默认或没有上级的时候传0
- "sys_enterpriseid": 0, //合作企业档案ID,新增是传0,更新
- "enterprisename":"",//客户名称(企业名称)
- "type": "", //客户类型
- "sa_customerpoolid": '', //客户池(公海池)ID,默认或没有的时候传0
- "source": "", //客户来源
- "province":"",//非必填,可选
- "city":"",//非必填,可选
- "county":"",//非必填,可选
- "address":"",//非必填,可选
- "abbreviation":"",//非必填,可选
- "taxno":"",//税号,非必填,可选
- "grade":'',// 客户等级(商户等级)
- "industry":"",//非必填,可选,所属行业
- "contact":"",//非必填,可选
- "phonenumber":""//非必填,可选
- }
- this.dialogFormVisible = false
- this.checkResults = ''
- }else {
- this.setTag(res.data.sa_customersid)
- }
- /*this.$router.push({path:'/PublicCustomerDetail',query:{id:res.data.sa_customersid,rowindex:0}})
- this.$store.dispatch('changeDetailDrawer',true)*/
- })
- })
- },
- 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.form = {
- "sa_customersid": 0,//新增是传0
- "parentid": 0, //上级客户ID,默认或没有上级的时候传0
- "sys_enterpriseid": 0, //合作企业档案ID,新增是传0,更新
- "enterprisename":"",//客户名称(企业名称)
- "type": "", //客户类型
- "sa_customerpoolid": '', //客户池(公海池)ID,默认或没有的时候传0
- "source": "", //客户来源
- "province":"",//非必填,可选
- "city":"",//非必填,可选
- "county":"",//非必填,可选
- "address":"",//非必填,可选
- "abbreviation":"",//非必填,可选
- "taxno":"",//税号,非必填,可选
- "grade":'',// 客户等级(商户等级)
- "industry":"",//非必填,可选,所属行业
- "contact":"",//非必填,可选
- "phonenumber":""//非必填,可选
- }
- this.dialogFormVisible = false
- this.checkResults = ''
- },
- onClose(){
- this.$refs['form'].resetFields();
- this.form = {
- "sa_customersid": 0,//新增是传0
- "parentid": 0, //上级客户ID,默认或没有上级的时候传0
- "sys_enterpriseid": 0, //合作企业档案ID,新增是传0,更新
- "enterprisename":"",//客户名称(企业名称)
- "type": "", //客户类型
- "sa_customerpoolid": '', //客户池(公海池)ID,默认或没有的时候传0
- "source": "", //客户来源
- "province":"",//非必填,可选
- "city":"",//非必填,可选
- "county":"",//非必填,可选
- "address":"",//非必填,可选
- "abbreviation":"",//非必填,可选
- "taxno":"",//税号,非必填,可选
- "grade":'',// 客户等级(商户等级)
- "industry":"",//非必填,可选,所属行业
- "contact":"",//非必填,可选
- "phonenumber":""//非必填,可选
- }
- this.dialogFormVisible = false
- this.checkResults = ''
- },
- cascaderChange() {
- }
- }
- }
- </script>
- <style scoped>
- /deep/.el-select,.el-cascader {
- width: 100%;
- }
- </style>
|