فهرست منبع

销售线索调整联系人联系方式,新增保存联系人

qymljy 2 سال پیش
والد
کامیت
aa19ab3590

+ 84 - 5
src/SManagement/orderclue/components/add.vue

@@ -18,14 +18,37 @@
             </el-col>
             </el-col>
             <el-col :span="24">
             <el-col :span="24">
               <el-form-item label="联系人:" prop="name">
               <el-form-item label="联系人:" prop="name">
-                <el-input v-model="param.content.name"  placeholder="请填写联系人"></el-input>
+<!--                <el-input v-model="param.content.name"  placeholder="请填写联系人"></el-input>-->
+                <contactsTemplate ref="contactsRef" @contactSelect="contactSelect" :name="param.content.name"></contactsTemplate>
               </el-form-item>
               </el-form-item>
             </el-col>
             </el-col>
-            <el-col :span="24">
+<!--            <el-col :span="24">
               <el-form-item label="联系方式:" prop="phonenumber">
               <el-form-item label="联系方式:" prop="phonenumber">
                 <el-input v-model="param.content.phonenumber"  placeholder="请填写手机号"></el-input>
                 <el-input v-model="param.content.phonenumber"  placeholder="请填写手机号"></el-input>
               </el-form-item>
               </el-form-item>
+            </el-col>-->
+            <el-col :span="24">
+              <el-form-item>
+                <el-radio v-model="param.content.isTelephone" label="0" @change="phoneChange('手机')">手机号</el-radio>
+                <el-radio v-model="param.content.isTelephone" label="1" @change="phoneChange('座机')">座机电话</el-radio>
+              </el-form-item>
+            </el-col>
+            <el-col :span="24" v-if="param.content.isTelephone == '1'">
+              <el-form-item label="联系方式:" prop="telephone" >
+                <el-input v-model="param.content.areaCode" style="width: 25%" autocomplete="on" placeholder="请填写区号"></el-input>
+                <span style="color: #999999">——</span>
+                <el-input v-model="param.content.telephone" style="width: 68%" autocomplete="on" placeholder="请填写座机电话"></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="24"  >
+              <el-form-item v-if="param.content.isTelephone == '0'" label="联系方式:" prop="phonenumber" :rules="[
+              { required: true, message: '手机号码不能为空'},
+              { pattern:/^1[3-9][0-9]\d{8}$/, message: '请输入正确手机号码',trigger: 'change' }
+            ]">
+                <el-input v-model="param.content.phonenumber" autocomplete="on" placeholder="请填写手机号码"></el-input>
+              </el-form-item>
             </el-col>
             </el-col>
+
             <el-col :span="24">
             <el-col :span="24">
               <el-form-item label="微信:" prop="wechatnum">
               <el-form-item label="微信:" prop="wechatnum">
                 <el-input v-model="param.content.wechatnum" placeholder="请填写微信"></el-input>
                 <el-input v-model="param.content.wechatnum" placeholder="请填写微信"></el-input>
@@ -147,9 +170,23 @@
 <script>
 <script>
 import selectActivity from '@/SManagement/orderclue/components/selectActivity/selectActivity'
 import selectActivity from '@/SManagement/orderclue/components/selectActivity/selectActivity'
 import businessMessage from "@/components/businessMessage";
 import businessMessage from "@/components/businessMessage";
+import contactsTemplate from '@/template/contactsTemplate/index'
 export default {
 export default {
-  components: {selectActivity,businessMessage},
+  components: {selectActivity,businessMessage,contactsTemplate},
   data () {
   data () {
+    var telephone = (rule,value,callback) =>{
+      if (this.param.content.areaCode === '' && this.param.content.telephone === ''){
+        callback(new Error('座机电话不能为空'))
+      } else {
+        var reg=/^0\d{2,3}-\d{7,8}$/
+        let telephone = this.param.content.areaCode + '-' + this.param.content.telephone
+        if (!reg.test(telephone)){
+          callback(new Error('请输入正确座机电话'))
+        }else {
+          callback();
+        }
+      }
+    }
     var begdateTime = (rule,value,callback) =>{
     var begdateTime = (rule,value,callback) =>{
       this.$refs.ruleForm.validateField('enddate_due')
       this.$refs.ruleForm.validateField('enddate_due')
       if (this.param.content.enddate_due !== ''){
       if (this.param.content.enddate_due !== ''){
@@ -207,7 +244,10 @@ export default {
           "begdate_due": "", //预计开工时间
           "begdate_due": "", //预计开工时间
           "enddate_due": "", //预计完工时间
           "enddate_due": "", //预计完工时间
           "tradefield":"",
           "tradefield":"",
-          "unitname":''
+          "unitname":'',
+          "areaCode":'',
+          "telephone":'',
+          "isTelephone":'0',
         }
         }
       },
       },
       unitnameList:[],
       unitnameList:[],
@@ -236,7 +276,12 @@ export default {
         ],
         ],
         costofconstruction:[
         costofconstruction:[
           {required: false,pattern:/^\d+(.\d{1,2})?$/, message: '请输入数字值', trigger: 'blur'}
           {required: false,pattern:/^\d+(.\d{1,2})?$/, message: '请输入数字值', trigger: 'blur'}
-        ]
+        ],
+        telephone:[
+          { required: true, validator: telephone, trigger: 'change' }
+          /* { required: true, message: '请输入座机电话', trigger: 'change' },
+           { pattern:/^0\d{2,3}-\d{7,8}$/, message: '请输入正确座机电话',trigger: 'change' }*/
+        ],
         /*totalinvestment:[
         /*totalinvestment:[
           {
           {
             validator: (rule, value, callback) => {
             validator: (rule, value, callback) => {
@@ -348,6 +393,9 @@ export default {
           } else if (this.areaSelectResult.length == 1) {
           } else if (this.areaSelectResult.length == 1) {
             this.param.content.province = this.areaSelectResult[0]
             this.param.content.province = this.areaSelectResult[0]
           }
           }
+        if (this.param.content.isTelephone == '1'){
+          this.param.content.phonenumber = this.param.content.areaCode + "-" + this.param.content.telephone
+        }
           let res = await this.$api.requested(this.param)
           let res = await this.$api.requested(this.param)
           this.tool.showMessage(res,() => {
           this.tool.showMessage(res,() => {
             this.$refs.ruleForm.resetFields()
             this.$refs.ruleForm.resetFields()
@@ -368,6 +416,10 @@ export default {
               "isprivate":1,
               "isprivate":1,
               "campaign_name":''
               "campaign_name":''
             }
             }
+            this.param.content.areaCode = ''
+            this.param.content.telephone = ''
+            this.param.content.phonenumber = ''
+            this.param.content.isTelephone = '0'
             this.$emit('onSuccess')
             this.$emit('onSuccess')
           })
           })
       })
       })
@@ -395,6 +447,10 @@ export default {
         "isprivate":1,
         "isprivate":1,
         "campaign_name":''
         "campaign_name":''
       }
       }
+      this.param.content.areaCode = ''
+      this.param.content.telephone = ''
+      this.param.content.phonenumber = ''
+      this.param.content.isTelephone = '0'
       this.$refs.businessMessage.businessShow = false
       this.$refs.businessMessage.businessShow = false
     },
     },
     centerChange (data) {
     centerChange (data) {
@@ -424,6 +480,29 @@ export default {
         this.unitnameList = res.data
         this.unitnameList = res.data
       })
       })
     },
     },
+    phoneChange(val){
+      if (val === '手机'){
+        this.param.content.telephone = ''
+        this.param.content.areaCode = ''
+      }else {
+        this.param.content.phonenumber = ''
+      }
+    },
+    /*联系人选择*/
+    contactSelect(val){
+      this.param.content.name = val.name
+      if (val.phonenumber.indexOf('-') != '-1'){
+        this.param.content.isTelephone = '1'
+        this.param.content.areaCode = val.phonenumber.substring(0,val.phonenumber.indexOf('-'))
+        this.param.content.telephone = val.phonenumber.substring(this.param.content.areaCode.length+1)
+        this.param.content.phonenumber = ''
+      }else {
+        this.param.content.isTelephone = '0'
+        this.param.content.phonenumber = val.phonenumber
+        this.param.content.areaCode = ''
+        this.param.content.telephone = ''
+      }
+    }
   }
   }
 }
 }
 
 

+ 78 - 5
src/SManagement/orderclue/components/edit.vue

@@ -18,14 +18,37 @@
             </el-col>
             </el-col>
             <el-col :span="24">
             <el-col :span="24">
               <el-form-item label="联系人:" prop="name">
               <el-form-item label="联系人:" prop="name">
-                <el-input v-model="param.name"  placeholder="请填写联系人"></el-input>
+<!--                <el-input v-model="param.name"  placeholder="请填写联系人"></el-input>-->
+                <contactsTemplate ref="contactsRef" @contactSelect="contactSelect" :name="param.name" :disabled="true"></contactsTemplate>
               </el-form-item>
               </el-form-item>
             </el-col>
             </el-col>
-            <el-col :span="24">
+<!--            <el-col :span="24">
               <el-form-item label="联系方式:" prop="phonenumber">
               <el-form-item label="联系方式:" prop="phonenumber">
                 <el-input v-model="param.phonenumber"  placeholder="请填写手机号"></el-input>
                 <el-input v-model="param.phonenumber"  placeholder="请填写手机号"></el-input>
               </el-form-item>
               </el-form-item>
+            </el-col>-->
+            <el-col :span="24">
+              <el-form-item>
+                <el-radio v-model="param.isTelephone" label="0" disabled>手机号</el-radio>
+                <el-radio v-model="param.isTelephone" label="1" disabled>座机电话</el-radio>
+              </el-form-item>
             </el-col>
             </el-col>
+            <el-col :span="24" v-if="param.isTelephone == '1'">
+              <el-form-item label="联系方式:" prop="telephone" >
+                <el-input v-model="param.areaCode" style="width: 25%" autocomplete="on" placeholder="请填写区号" disabled></el-input>
+                <span style="color: #999999">——</span>
+                <el-input v-model="param.telephone" style="width: 68%" autocomplete="on" placeholder="请填写座机电话" disabled></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="24"  >
+              <el-form-item v-if="param.isTelephone == '0'" label="联系方式:" prop="phonenumber" :rules="[
+              { required: true, message: '手机号码不能为空'},
+              { pattern:/^1[3-9][0-9]\d{8}$/, message: '请输入正确手机号码',trigger: 'change' }
+            ]">
+                <el-input v-model="param.phonenumber" autocomplete="on" placeholder="请填写手机号码" disabled></el-input>
+              </el-form-item>
+            </el-col>
+
             <el-col :span="24">
             <el-col :span="24">
               <el-form-item label="微信:" prop="wechatnum">
               <el-form-item label="微信:" prop="wechatnum">
                 <el-input v-model="param.wechatnum" placeholder="请填写微信"></el-input>
                 <el-input v-model="param.wechatnum" placeholder="请填写微信"></el-input>
@@ -144,11 +167,25 @@
 
 
 <script>
 <script>
 import selectActivity from '@/SManagement/orderclue/components/selectActivity/selectActivity'
 import selectActivity from '@/SManagement/orderclue/components/selectActivity/selectActivity'
+import contactsTemplate from '@/template/contactsTemplate/index'
 import { log } from '@antv/g2plot/lib/utils'
 import { log } from '@antv/g2plot/lib/utils'
 import businessMessage from "@/components/businessMessage";
 import businessMessage from "@/components/businessMessage";
 export default {
 export default {
-  components: {selectActivity,businessMessage},
+  components: {selectActivity,businessMessage,contactsTemplate},
   data () {
   data () {
+    var telephone = (rule,value,callback) =>{
+      if (this.param.areaCode === '' && this.param.telephone === ''){
+        callback(new Error('座机电话不能为空'))
+      } else {
+        var reg=/^0\d{2,3}-\d{7,8}$/
+        let telephone = this.param.areaCode + '-' + this.param.telephone
+        if (!reg.test(telephone)){
+          callback(new Error('请输入正确座机电话'))
+        }else {
+          callback();
+        }
+      }
+    }
     var begdateTime = (rule,value,callback) =>{
     var begdateTime = (rule,value,callback) =>{
       this.$refs.ruleForm.validateField('enddate_due')
       this.$refs.ruleForm.validateField('enddate_due')
       if (this.param.enddate_due !== ''){
       if (this.param.enddate_due !== ''){
@@ -202,7 +239,10 @@ export default {
         "begdate_due": "", //预计开工时间
         "begdate_due": "", //预计开工时间
         "enddate_due": "", //预计完工时间
         "enddate_due": "", //预计完工时间
         "tradefield":"",
         "tradefield":"",
-        "unitname":''
+        "unitname":'',
+        "areaCode":'',
+        "telephone":'',
+        "isTelephone":'0',
       },
       },
       rules: {
       rules: {
         phonenumber: [
         phonenumber: [
@@ -229,7 +269,12 @@ export default {
         ],
         ],
         costofconstruction:[
         costofconstruction:[
           {required: false,pattern:/^\d+(.\d{1,2})?$/, message: '请输入数字值', trigger: 'blur'}
           {required: false,pattern:/^\d+(.\d{1,2})?$/, message: '请输入数字值', trigger: 'blur'}
-        ]
+        ],
+        telephone:[
+          { required: true, validator: telephone, trigger: 'change' }
+          /* { required: true, message: '请输入座机电话', trigger: 'change' },
+           { pattern:/^0\d{2,3}-\d{7,8}$/, message: '请输入正确座机电话',trigger: 'change' }*/
+        ],
        /* totalinvestment:[
        /* totalinvestment:[
           {
           {
             validator: (rule, value, callback) => {
             validator: (rule, value, callback) => {
@@ -310,6 +355,16 @@ export default {
       this.areaSelectResult = this.param.province
       this.areaSelectResult = this.param.province
       this.param.totalinvestment !== 0 ? this.param.totalinvestment =  this.tool.formatAmount(this.param.totalinvestment,2): this.param.totalinvestment =''
       this.param.totalinvestment !== 0 ? this.param.totalinvestment =  this.tool.formatAmount(this.param.totalinvestment,2): this.param.totalinvestment =''
       this.param.costofconstruction !== 0 ? this.param.costofconstruction =  this.tool.formatAmount(this.param.costofconstruction,2): this.param.costofconstruction =''
       this.param.costofconstruction !== 0 ? this.param.costofconstruction =  this.tool.formatAmount(this.param.costofconstruction,2): this.param.costofconstruction =''
+      if ((this.param.phonenumber.indexOf('-')) != '-1'){
+        this.param.isTelephone = '1'
+        this.param.areaCode = this.data.phonenumber.substring(0,this.param.phonenumber.indexOf('-'))
+        this.param.telephone = this.data.phonenumber.substring(this.param.areaCode.length+1)
+        this.param.phonenumber = ''
+      }else {
+        this.param.isTelephone = '0'
+        this.param.areaCode = ''
+        this.param.telephone = ''
+      }
       this.queryTradefield()
       this.queryTradefield()
       this.queryUnitname()
       this.queryUnitname()
       this.siteid = JSON.parse(sessionStorage.getItem('active_account')).siteid
       this.siteid = JSON.parse(sessionStorage.getItem('active_account')).siteid
@@ -361,6 +416,9 @@ export default {
           });
           });
           return false
           return false
         }
         }
+        if (this.param.isTelephone == '1'){
+          this.param.phonenumber = this.param.areaCode + "-" + this.param.telephone
+        }
         let res = await this.$api.requested({
         let res = await this.$api.requested({
           "id":20221205162402,
           "id":20221205162402,
           "content": this.param
           "content": this.param
@@ -410,6 +468,21 @@ export default {
         this.unitnameList = res.data
         this.unitnameList = res.data
       })
       })
     },
     },
+    /*联系人选择*/
+    contactSelect(val){
+      this.param.name = val.name
+      if (val.phonenumber.indexOf('-') != '-1'){
+        this.param.isTelephone = '1'
+        this.param.areaCode = val.phonenumber.substring(0,val.phonenumber.indexOf('-'))
+        this.param.telephone = val.phonenumber.substring(this.param.areaCode.length+1)
+        this.param.phonenumber = ''
+      }else {
+        this.param.isTelephone = '0'
+        this.param.phonenumber = val.phonenumber
+        this.param.areaCode = ''
+        this.param.telephone = ''
+      }
+    }
   },
   },
 }
 }
 
 

+ 62 - 0
src/SManagement/orderclue_detail/components/saveContact.vue

@@ -0,0 +1,62 @@
+<template>
+  <div>
+    <el-button size="mini" :type="disabled ?'':'primary'" @click="saveBtn" :disabled="disabled">保存联系人</el-button>
+  </div>
+</template>
+
+<script>
+import {Message} from "element-ui";
+
+export default {
+  name: "saveContact",
+  props:{
+    disabled: Boolean,
+    data: Object
+  },
+  methods:{
+    saveBtn(){
+      this.$confirm('是否将当前线索联系人保存到通讯录?', '提示', {
+        confirmButtonText: '确定保存',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.onSave()
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '已取消'
+        });
+      });
+    },
+    async onSave(){
+      const res = await this.$api.requested({
+        "id":"20240425135604",
+        "content":{
+          "sat_orderclueid":this.data.sat_orderclueid
+        }
+      })
+      if (res.code === 0){
+        Message({
+          message: res.msg,
+          type: 'error',
+          duration:3000,
+          showClose:true
+        });
+        this.$emit('contactSuccess')
+      }else {
+        Message({
+          message: res.data,
+          type: 'success',
+          duration:3000,
+          showClose:true
+        });
+        this.$emit('contactSuccess')
+      }
+    }
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

+ 7 - 5
src/SManagement/orderclue_detail/index.vue

@@ -17,6 +17,7 @@
         @detailCreate="detailCreate">
         @detailCreate="detailCreate">
       <div slot="customOperation">
       <div slot="customOperation">
         <edit class="inline-16" v-if="Object.keys(mainData).length > 0 && tool.checkAuth($route.name,'update')" :disabled="!isHandle" :data="mainData" @onSuccess="queryMainData"/>
         <edit class="inline-16" v-if="Object.keys(mainData).length > 0 && tool.checkAuth($route.name,'update')" :disabled="!isHandle" :data="mainData" @onSuccess="queryMainData"/>
+        <saveContact class="inline-16" @contactSuccess="queryMainData" v-if="mainData.isphonebook == 0 && tool.checkAuth($route.name,'saveContact')" :disabled="!isHandle" :data="mainData"></saveContact>
         <follow :detailInfo="mainData"
         <follow :detailInfo="mainData"
           v-if="tool.checkAuth($route.name,'follow')"
           v-if="tool.checkAuth($route.name,'follow')"
           @updataList="queryMainData();$refs.followDetail.getFollowDetail()" @onSuccess="onFollow" :disabled="!isHandle" :data="mainData"></follow>
           @updataList="queryMainData();$refs.followDetail.getFollowDetail()" @onSuccess="onFollow" :disabled="!isHandle" :data="mainData"></follow>
@@ -57,6 +58,7 @@ import changeProject from './components/changeProject'
 import changeCustomer from './components/changeCustomer'
 import changeCustomer from './components/changeCustomer'
 import sourceClues from '@/HManagement/clueManage/clue_public/modules/sourceClues'
 import sourceClues from '@/HManagement/clueManage/clue_public/modules/sourceClues'
 import changeSite from '@/HManagement/clueManage/clue_private/modules/changeToSite.vue'
 import changeSite from '@/HManagement/clueManage/clue_private/modules/changeToSite.vue'
+import saveContact from './components/saveContact'
 export default {
 export default {
   name: "detail",
   name: "detail",
   inject:['teamList'],
   inject:['teamList'],
@@ -80,7 +82,8 @@ export default {
     changeCustomer,
     changeCustomer,
     edit,
     edit,
     sourceClues,
     sourceClues,
-    changeSite
+    changeSite,
+    saveContact
   },
   },
   watch: {
   watch: {
    async mainData(val) {
    async mainData(val) {
@@ -154,7 +157,6 @@ export default {
       })
       })
       this.mainData = res.data
       this.mainData = res.data
       this.$refs.details.param.content.type = this.$route.query.tabIndex
       this.$refs.details.param.content.type = this.$route.query.tabIndex
-      console.log(this.mainData,"销售线索手机号数据");
 
 
       this.changeDataStructure()
       this.changeDataStructure()
     },
     },
@@ -172,7 +174,7 @@ export default {
           value:this.mainData.name
           value:this.mainData.name
         },
         },
         {
         {
-          label:'手机号',
+          label:'联系方式',
           value:this.mainData.phonenumber
           value:this.mainData.phonenumber
         },
         },
         {
         {
@@ -244,7 +246,7 @@ export default {
             value:this.mainData.contactsrole
             value:this.mainData.contactsrole
           },
           },
           {
           {
-            label:'手机号',
+            label:'联系方式',
             value:this.mainData.phonenumber
             value:this.mainData.phonenumber
           },
           },
           {
           {
@@ -409,7 +411,7 @@ export default {
                 value:this.mainData.contactsrole
                 value:this.mainData.contactsrole
               },
               },
               {
               {
-                label:'手机号',
+                label:'联系方式',
                 value:this.mainData.phonenumber
                 value:this.mainData.phonenumber
               },
               },
               {
               {

+ 2 - 2
src/template/contactsTemplate/index.vue

@@ -119,7 +119,7 @@
           </el-table>
           </el-table>
         </el-tab-pane>
         </el-tab-pane>
       </el-tabs>
       </el-tabs>
-      <el-input  slot="reference"  autosize v-model="name" placeholder="请填写联系人" @focus="searchData" @change="searchData"></el-input>
+      <el-input  slot="reference"  autosize v-model="name" placeholder="请填写联系人" @focus="searchData" @change="searchData" :disabled="disabled"></el-input>
     </el-popover>
     </el-popover>
   </div>
   </div>
 </template>
 </template>
@@ -127,7 +127,7 @@
 <script>
 <script>
 export default {
 export default {
   name: "index",
   name: "index",
-  props:['name'],
+  props:['name','disabled'],
   data(){
   data(){
     return {
     return {
       activeName:'企业联系人',
       activeName:'企业联系人',