浏览代码

客户搜索

shengxuefei 4 年之前
父节点
当前提交
2bf1cf2a9f

+ 3 - 0
src/assets/css/index.css

@@ -9,4 +9,7 @@
 }
 .floatleft{
     float:left;
+}
+.textLeft{
+    text-align: left;
 }

+ 18 - 0
src/common/api/loginApi.js

@@ -229,4 +229,22 @@ export function GetCognizeWayList(data) {
     method: 'post',
     data
   })
+}
+
+/* 客户查询列表*/
+export function GetSaClientList(data) {
+  return request({
+    url: '/GetSaClientList',
+    method: 'post',
+    data
+  })
+}
+
+/* 客户新增*/
+export function AddSaClient(data) {
+  return request({
+    url: '/AddSaClient',
+    method: 'post',
+    data
+  })
 }

+ 7 - 1
src/common/util.js

@@ -93,4 +93,10 @@ export function getDate(mydate){
     .getDate();
     var dateStr = year + "-" + month + "-" + day;
     return dateStr;
-} 
+} 
+
+/*判断是否为整数*/
+export function isInt(str){
+    var r = /^\d+$/;  //正整数    
+    return r.test(str);
+}

+ 391 - 0
src/components/addsaclient.vue

@@ -0,0 +1,391 @@
+<template>
+  <div>
+    <van-nav-bar
+      @click-left="onClickLeft"
+      @click-right="onClickRight"
+      style="background-color: #1989fa"
+    >
+      <template #title>
+        <van-col style="color: #ffffff">添加客户</van-col>
+      </template>
+      <template #left>
+        <i
+          class="fa fa-arrow-circle-left"
+          aria-hidden="true"
+          style="color: #ffffff; font-size: 18px"
+        ></i>
+      </template>
+    </van-nav-bar>
+
+    <van-form>
+      <van-field
+        v-model="name"
+        name="姓名"
+        label="姓名"
+        placeholder="请输入"
+        input-align="right"
+        required
+      />
+      <van-field
+        v-model="phone"
+        name="手机"
+        label="手机"
+        placeholder="请输入"
+        input-align="right"
+        required
+      ></van-field>
+      <van-cell
+        title="性别"
+        :value="sexName"
+        is-link
+        title-class="title1"
+        value-class="value1"
+        @click="showSex = true"
+        required
+      ></van-cell>
+      <van-popup v-model="showSex" round position="bottom">
+        <van-picker
+          show-toolbar
+          title="请选择"
+          :columns="sexData"
+          @cancel="showSex = false"
+          @confirm="onConfirmSex"
+          :default-index="sexIndex"
+        />
+      </van-popup>
+      
+      <van-cell
+        title="认知途径"
+        :value="cognizeWay"
+        is-link
+        title-class="title1"
+        value-class="value1"
+        @click="showCognizeWay = true"
+      ></van-cell>
+      <van-popup v-model="showCognizeWay" round position="bottom">
+        <van-picker
+          show-toolbar
+          title="请选择"
+          :columns="cognizeWayData"
+          @cancel="showCognizeWay = false"
+          @confirm="onConfirmCognizeWay"
+          :default-index="cognizeWayIndex"
+        />
+      </van-popup>
+      <van-field
+        v-model="remark"
+        rows="1"
+        autosize
+        label="备注"
+        type="textarea"
+        placeholder="请输入"
+        class="remarkBottom"
+        input-align="right"
+      />
+      <van-divider style="border-bottom:#cfcfcf solid 3px;"/>
+       <van-cell
+        title="跟进类型"
+        :value="visitType"
+        is-link
+        title-class="title1"
+        value-class="value1"
+        @click="showVisitType = true"
+      ></van-cell>
+      <van-popup v-model="showVisitType" round position="bottom">
+        <van-picker
+          show-toolbar
+          title="选择跟进类型"
+          value-key="name"
+          :columns="visitTypeData"
+          @cancel="showVisitType = false"
+          @confirm="onConfirm"
+        />
+      </van-popup>
+
+      <van-cell
+        title="意向强度"
+        :value="visitIntention"
+        is-link
+        title-class="title1"
+        value-class="value1"
+        @click="showintention = true"
+      ></van-cell>
+      <van-popup v-model="showintention" round position="bottom">
+        <van-picker
+          show-toolbar
+          title="选择意向强度"
+          :columns="intentionData"
+          @cancel="showintention = false"
+          @confirm="onConfirmIntention"
+        />
+      </van-popup>
+
+      <van-field
+        v-model="visitRemark"
+        rows="1"
+        autosize
+        label="接待信息"
+        type="textarea"
+        placeholder="请输入接待信息"
+      />
+
+      <van-row class="bottom">
+        <van-col span="12" class="bgGrey" @click="cancel">
+          <van-icon name="close" />取消
+        </van-col>
+        <van-col span="12" class="bgRed" @click="save"
+          ><van-icon name="passed" />保存
+        </van-col>
+      </van-row>
+    </van-form>
+  </div>
+</template>
+
+<script>
+import {
+ GetVisitTypeList,
+  GetCognizeWayList,
+  AddSaClient
+} from "@/common/api/loginApi.js";
+import "../assets/css/resetvant.css";
+export default {
+  name: "login",
+  data() {
+    return {
+      id: "",
+      name: "",
+      phone: "",
+      sex: 0,
+      sexName: "",
+      showSex: false,
+      sexData: [
+        { id: 0, text: "男" },
+        { id: 1, text: "女" },
+      ],
+      sexIndex: 0,
+      
+      remark: "",
+      cognizeWay: "",
+      showCognizeWay: false,
+      cognizeWayData: [],
+      cognizeWayIndex: 0,
+       visitType: "", //访问类型
+       visitTypeData:[],
+      showVisitType: false,
+      visitIntention: "", //意向强度
+      intentionData: [0,1,2,3,4,5],
+      showintention: false,
+      visitRemark:'',
+     
+    };
+  },
+  created: function () {
+    console.info("created");
+    //console.info(this.$util);
+    this.$util.persistLogin(this);
+    this.GetVisitTypeList();
+    this.GetCognizeWayList();
+    
+  },
+  computed: {
+    //计算属性
+    completion: function () {},
+  },
+  methods: {
+    GetVisitTypeList:function(){   //取访问类型
+     var that = this;
+      var data = {
+        projectId: that.$store.state.projectId
+      };
+      console.info("data", data);
+      GetVisitTypeList(data).then((res)=>{
+         console.info("GetVisitTypeList", res);
+        if (!res.result) {
+          that.$toast(res.msg);
+          return;
+        }
+        res.data.forEach(function(item,index,array) {
+          that.visitTypeData.push(item);
+        });
+      });
+    },
+    GetCognizeWayList: function () {
+      //获取认知途径
+      var that = this;
+      var data = {
+        projectId: that.$store.state.projectId,
+        clientId: that.id,
+      };
+      console.info("GetCognizeWayList data", data);
+      GetCognizeWayList(data).then((res) => {
+        console.info("GetCognizeWayList", res);
+        if (!res.result) {
+          that.$toast(res.msg);
+          return;
+        }
+        res.data.forEach(function (item, index, array) {
+          that.cognizeWayData.push(item.name);
+        });
+        that.GetSaClientInfo();
+      });
+    },
+    onConfirmSex: function (item, index) {
+      console.info("onConfirmSex", item);
+      this.sex = item.id;
+      this.sexName = item.text;
+      this.showSex = false;
+    },
+   
+    onConfirmCognizeWay: function (value, index) {
+      //认知途径
+      console.info("onConfirmCognizeWay", value);
+      this.cognizeWay = value;
+      this.showCognizeWay = false;
+    },
+    cancel: function () {
+      this.$router.go(-1);
+    },
+    save: function () {
+      let that = this;
+      let jsonData = {
+        name: that.name,
+        phone: that.phone,
+        sex: that.sex,
+        remark: that.remark,
+        credentialsType: that.credentialsType,
+        credentialsId: that.credentialsId,
+        nationality: that.nationality,
+        birth: that.birth,
+        marry: that.marry,
+        household: that.household,
+        post: that.post,
+        fax: that.fax,
+        email: that.email,
+        address: that.address,
+        cognizeWay: that.cognizeWay,
+        phoneList: that.phoneList,
+      };
+      //console.info("save jsonData", JSON.stringify(jsonData));
+      let data = {
+        userCode: that.$store.state.data.userCode,
+        projectId: that.$store.state.projectId,
+        clientId: that.id,
+        jsonData: JSON.stringify(jsonData),
+      };
+      console.info("save", data);
+      //return;
+      ModifySaClient(data).then((res) => {
+        console.info("ModifySaClient", res);
+        if (res.result) {
+          if (res.msg == null) {
+            that.$router.go(-1);
+          } else {
+            that.$dialog
+              .alert({
+                message: res.msg,
+              })
+              .then(() => {
+                // on close
+                if (res.result) {
+                  that.$router.go(-1);
+                }
+              });
+          }
+        } else {
+          that.$dialog.alert({
+            message: res.msg,
+          });
+        }
+      });
+    },
+    onClickLeft() {
+      // this.$toast('返回')
+      console.info("left");
+      this.$router.go(-1);
+    },
+    onClickRight() {
+      this.$router.go(0);
+    },
+  },
+};
+</script>
+
+<!-- Add "scoped" attribute to limit CSS to this component only -->
+<style scoped >
+.title1 {
+  color: #aaa;
+  font-size: 15px;
+
+  text-align: left;
+  height: 30px;
+}
+.title2 {
+  color: #ff0000;
+  text-align: left;
+  font-size: 13px;
+}
+.infoTitle {
+  color: #aaa;
+  text-align: left;
+}
+.value1 {
+  color: #000;
+  font-size: 13px;
+}
+.infoValue {
+  color: #0606af;
+}
+.size {
+  font-size: 16px;
+}
+.header {
+  margin-top: 10px;
+  height: 70px;
+  border-bottom: #cfcfcf solid 3px;
+}
+.titleClass {
+  border-bottom: #000 solid 1px;
+}
+.van-tab {
+  color: #ff0000;
+}
+.redColor {
+  color: #ff0000;
+}
+.bgBlue {
+  background: #a0a0f7;
+  height: 30px;
+  margin-top: 5px;
+  padding-top: 5px;
+}
+.bgBill {
+  height: 30px;
+  border-bottom: #aaa solid 1px;
+  padding-top: 5px;
+}
+.bottom {
+  /* left:0; */
+  bottom: 0px;
+  position: fixed;
+  width: 100%;
+}
+.bgGrey {
+  background: #999999;
+  height: 35px;
+  justify-content: center;
+  padding-top: 5px;
+}
+.bgRed {
+  background: #ff0000;
+  height: 35px;
+  justify-content: center;
+  color: #ffffff;
+  font-weight: 900;
+  padding-top: 5px;
+}
+.remarkBottom {
+  margin-bottom: 40px;
+}
+</style>
+
+ 

+ 6 - 1
src/components/clientdetail.vue

@@ -200,7 +200,7 @@ export default {
     this.$util.persistLogin(this);
     this.id = this.$route.query.id;
     this.name = this.$route.query.name;
-    this.state = this.$route.query.state;
+    //this.state = this.$route.query.state;
 
     this.GetSaClientInfo();
   },
@@ -278,6 +278,7 @@ export default {
           return;
         }
         that.data2 = res.data;
+        that.state=res.data.SaleState;
       });
     },
     AddSaClientContact: function () {
@@ -290,6 +291,10 @@ export default {
     },
     editClientInfo:function(){    //编辑客户信息
       var that = this;
+      if(that.$store.state.data.userCode!=this.data2.SalesMan){
+        this.$toast("非客户业务员,不能编辑客户资料");
+        return;
+      }
       this.$router.push({
         path: "/saclientmodify",
         query: { id: that.id, name: that.name },

+ 1 - 1
src/components/getproject.vue

@@ -62,7 +62,7 @@ export default {
     // 单选按钮点击事件
     routerTo:function(projectname){
        console.info('routerto radio',this.radio);
-       console.info('projectname',projectname);
+       console.info('routerTo projectname',projectname);
        this.$store.commit('setProjectId',this.radio);   //给项目ID赋值
        this.$router.push({path:'/saleindex',query:{projectId:this.radio,projectname:projectname}});
     },

+ 1 - 0
src/components/getsaclientcontactlist.vue

@@ -125,6 +125,7 @@ export default {
       }, 500)
     },
     onRefresh () {
+      console.info('onRefresh');
       setTimeout(() => {
         // 重新初始化这些属性
         this.isLoading = false

+ 185 - 0
src/components/getsaclientlist.vue

@@ -0,0 +1,185 @@
+<template>
+  <div>
+    <form action="/">
+      <van-col span="24" class="bgBlue">
+            <van-search
+            v-model="searchstr"
+            show-action
+            placeholder="请输入姓名/电话"
+            @search="onSearch"
+            @cancel="onCancel"
+            class="bgBlue"
+            />
+            <div v-if="totalCount>0" class="textLeft">查询结果:共查询到{{totalCount}}条数据</div>
+      </van-col>
+    </form>
+
+   
+        <van-list
+        v-model="loading"
+        :finished="finished"
+        loading-text="加载中..."
+        finished-text="我是有底线的~"
+        @load="onLoad"
+        >
+        <van-cell
+            v-for="item in listdata"
+            :key="item.clientId"
+            :to="'/clientdetail?id='+item.clientId+'&name='+item.name"
+        >
+            <template #title>
+            <van-col span="24" class="title1">{{item.name}}</van-col>
+            <van-col span="24">
+                <van-row>
+                    <van-col span="9" class="title2">业务员:</van-col>
+                    <van-col span="15" class="title2">{{item.cUserName}}</van-col>
+                </van-row>
+                </van-col>
+            </template>
+            <template #default>
+                <van-col span="24" class="star" > 
+                    <span v-for="i in item.intention" :key="i+'x'" class="size">★</span>
+                    <span v-for="i in 5-item.intention" :key="i" class="size">☆</span>
+                </van-col>           
+            </template>
+        </van-cell>
+        </van-list>
+   
+  </div>
+</template>
+
+<script>
+import { GetSaClientList } from "@/common/api/loginApi.js";
+import Decimal from "decimal.js";
+export default {
+  name: "login",
+  data() {
+    return {
+      listdata: [], 
+      loading: false,
+      finished: false,
+      isLoading: false,
+      page:1,
+      searchstr:'' ,  //搜索串
+      totalCount:0
+    };
+  },
+  created: function () {
+    console.info("created");
+    //console.info(this.$util);
+    this.$util.persistLogin(this);
+    this.searchstr=this.$route.query.search;
+    console.info('created search',this.searchstr);
+  },
+  methods: {
+    GetSaClientList: function () {
+      var that = this;
+      let name='';
+      let phone='';
+      if(this.$util.isInt(this.searchstr)){
+          phone=this.searchstr;
+      }
+      else{
+          name=this.searchstr;
+      }
+      let jsonQuery={name:name,phone:phone};
+      var data = {
+        userCode: that.$store.state.data.userCode,
+        projectId: that.$store.state.projectId,
+        page: that.page,
+        pageCount: "10",
+        jsonQuery: JSON.stringify(jsonQuery),
+        sortby: "",
+      };
+      console.info("data", data);
+      GetSaClientList(data).then((res) => {
+        console.info("GetSaClientList", res);
+        if (!res.result) {
+          that.$toast(res.msg);
+          return;
+        }
+        if(res.data!=null&&res.data.listdata.length>0){
+          that.loading=false;
+          that.totalCount=res.data.page.totalCount;
+          res.data.listdata.forEach(function (item, index, array) {
+            that.listdata.push(item);
+            
+            if(res.data.listdata.length-1==index){
+              that.page++;
+              console.info('that.page:',that.page);
+              if(res.data.page.totalPages==that.page-1){
+                  
+                  that.finished=true;
+                  console.info('that.finished1:',that.finished);
+              }
+            }
+          });
+          console.info('listdata',that.listdata);
+          if(res.data==null||res.data.listdata==null||res.data.listdata.length==0){
+              
+              that.finished = true;
+              console.info('that.finished2:',that.finished);
+          }
+          
+        }
+         else{
+          that.finished=true;
+          console.info('that.finished3:',that.finished);
+          that.page=1;
+          that.totalCount=0;
+        }
+      });
+    },
+    // 列表加载
+    onLoad () {
+      setTimeout(() => {
+        this.GetSaClientList()
+        this.loading = true
+      }, 500)
+    },
+     onSearch(val) {     //搜索事件
+      console.info('onSearch',val);
+      this.listdata=[];
+      this.page=1;
+      this.finished=false;
+      this.GetSaClientList();
+    },
+    onCancel() {      //搜索的取消事件
+      console.info('onCancel');
+      this.$router.push('/getsaclientsummary');
+    },
+  },
+};
+</script>
+
+<!-- Add "scoped" attribute to limit CSS to this component only -->
+<style scoped>
+.title1 {
+   color:#0f0fa7;
+    font-size:16px;
+    font-weight:900;
+    text-align: left;
+    margin-left:15px;
+    height:35px;
+}
+.star{
+    height:35px;
+}
+.size{
+    font-size:16px;
+    color:orange;
+}
+.title2{
+    color:#999;
+    
+}
+.bgBlue{
+    padding-top:15px;
+    padding-bottom: 15px;
+}
+.textLeft{
+    padding-left:15px;
+    font-size:15px;
+    font-weight: 100;
+}
+</style>

+ 38 - 1
src/components/getsaclientsummary.vue

@@ -19,7 +19,32 @@
         <van-icon name="replay" size="18" color="#ffffff" />
       </template>
     </van-nav-bar>
-
+    
+    <form action="/">
+      
+            <van-search
+            v-model="searchstr"
+            show-action
+            placeholder="请输入姓名/电话"
+            @search="onSearch"
+            @cancel="onCancel"
+            />
+            
+     
+    </form>
+    <van-row class="iconArea">
+      <van-col span="24">
+        <van-col span="5">
+          <router-link to="/addsaclient">
+            <van-icon name="friends" badge="+" size="50"/><br/>
+            <span>添加</span>
+          </router-link>
+        </van-col>
+         <van-col span="19">
+         
+        </van-col>
+      </van-col>
+    </van-row>
     <van-list
       v-model="loading"
       :finished="finished"
@@ -61,6 +86,7 @@ export default {
       data: [], 
       loading: false,
       finished: false,
+      searchstr:''
     };
   },
   created: function () {
@@ -111,6 +137,14 @@ export default {
     },
     onClickRight() {
       this.$router.go(0);
+    },
+      onSearch(val) {     //搜索事件
+      console.info('onSearch',val);
+      this.$router.push('/getsaclientlist?search='+val);
+    },
+    onCancel() {      //搜索的取消事件
+      console.info('onCancel');
+      
     },
   },
 };
@@ -128,4 +162,7 @@ export default {
 .size{
     font-size:16px;
 }
+.iconArea{
+  border-bottom: #cfcfcf solid 5px;
+}
 </style>

+ 2 - 0
src/components/saclientmodify.vue

@@ -144,6 +144,7 @@
         label="联系地址"
         type="textarea"
         placeholder="请输入"
+        input-align="right"
       />
       <van-field
         v-model="post"
@@ -192,6 +193,7 @@
         type="textarea"
         placeholder="请输入"
         class="remarkBottom"
+        input-align="right"
       />
 
       <van-row class="bottom">

+ 1 - 1
src/components/saleindex.vue

@@ -187,7 +187,7 @@ export default {
       var that = this;
       var data = {
         userCode: that.$store.state.data.userCode,
-        projectId: that.projectId,
+        projectId: that.$store.state.projectId,
       };
       //console.info("data", data);
       SaReportToday(data).then((res) => {

+ 2 - 1
src/main.js

@@ -13,7 +13,7 @@ import {
   Form,
   Col,
   Row,
-  NavBar, RadioGroup, Radio, Cell, CellGroup, Grid, GridItem, Image as VanImage, Circle, Icon, List, Divider, PullRefresh, Picker, Popup, Tab, Tabs, Calendar, DatetimePicker
+  NavBar, RadioGroup, Radio, Cell, CellGroup, Grid, GridItem, Image as VanImage, Circle, Icon, List, Divider, PullRefresh, Picker, Popup, Tab, Tabs, Calendar, DatetimePicker,Search
 } from 'vant'
 
 // 引入全局css
@@ -53,6 +53,7 @@ Vue.use(Button)
   .use(Tabs)
   .use(Calendar)
   .use(DatetimePicker)
+  .use(Search)
   
 
 /* eslint-disable no-new */

+ 12 - 0
src/router/index.js

@@ -21,6 +21,8 @@ import getsaroomlist from '@/components/getsaroomlist'
 import clientdetail from '@/components/clientdetail'
 import addsaclientcontact from '@/components/addsaclientcontact'
 import saclientmodify from '@/components/saclientmodify'
+import getsaclientlist from '@/components/getsaclientlist'
+import addsaclient from '@/components/addsaclient'
 Vue.use(Router)
 
 export default new Router({
@@ -130,5 +132,15 @@ export default new Router({
       name: 'saclientmodify',
       component: saclientmodify
     },
+    {     //客户查询
+      path: '/getsaclientlist',
+      name: 'getsaclientlist',
+      component: getsaclientlist
+    },
+    {     //添加客户
+      path: '/addsaclient',
+      name: 'addsaclient',
+      component: addsaclient
+    },
   ]
 })