dev01 3 months ago
parent
commit
7e239e6084

+ 33 - 19
src/pages/addEnterprise/index.jsx

@@ -11,6 +11,7 @@ import {
   AtModalAction,
   AtInput,
   AtTextarea,
+  AtIcon,
 } from "taro-ui";
 import {
   checkUserName,
@@ -122,7 +123,7 @@ class AddEnterprise extends Component {
   // 项目列表
   getBusinessProjectByName(val) {
     getBusinessProjectByName({
-      businessName: val,
+      businessName: val || "",
     })
       .then((v) => {
         if (v.error.length === 0) {
@@ -148,18 +149,10 @@ class AddEnterprise extends Component {
       });
   }
 
-  onSearchChange(value, lv = true) {
+  onSearchChange(value) {
     this.setState({
       value,
     });
-    if (value.length < 2 && !lv) {
-      Taro.showToast({ title: "最少输入两个字符", icon: "none" });
-      return;
-    }
-    if (value.length < 4 && lv) {
-      return;
-    }
-    this.getBusinessProjectByName(value);
   }
 
   // 新增企业
@@ -635,25 +628,46 @@ class AddEnterprise extends Component {
         >
           <AtModalHeader>请选择项目</AtModalHeader>
           <AtModalContent>
-            {/* <AtSearchBar
+            <AtSearchBar
               placeholder="请输入项目名称"
               showActionButton
               value={this.state.value}
               onChange={this.onSearchChange}
               onActionClick={() => {
-                this.onSearchChange(this.state.value, false);
-              }}
-              onConfirm={() => {
-                this.onSearchChange(this.state.value, false);
+                this.getBusinessProjectByName(this.state.value);
               }}
               onClear={() => {
                 this.setState({
                   value: "",
-                  options: [],
-                  checkOptions: [],
-                });
+                }, () => { this.getBusinessProjectByName(this.state.value) });
               }}
-            /> */}
+            />
+            {
+              checkOptions.length > 0 &&
+              <View className="selproject">
+                已选择:
+                {
+                  checkOptions.map((v, i) =>
+                    <View className="selptxt" key={i}
+                      onClick={() => {
+                        let list = checkOptions
+                        for (var j = 0; j < list.length; j++) {
+                          if (list[j] == v) {
+                            list.splice(j, 1)
+                            this.setState({
+                              checkOptions: list,
+                              info: Object.assign(info, {
+                                intendedProject: list.toString(),
+                              }),
+                            })
+                          }
+                        }
+                      }}
+                    >{v}&nbsp;<AtIcon className='atIcon' value='close-circle' size='12' color='#fff' /></View>
+                  )
+                }
+              </View>
+            }
             <AtCheckbox
               options={this.state.options}
               selectedList={checkOptions}

+ 23 - 3
src/pages/addEnterprise/index.less

@@ -8,7 +8,7 @@
       display: flex;
       flex-direction: row;
       align-items: center;
-      padding: 24px 32px 24px 0;
+      padding: 26px 32px 26px 0;
       margin-left: 32px;
       border-bottom: 1px;
 
@@ -28,12 +28,14 @@
       }
 
       .aval {
+        font-size: 32px;
         color: #CCC;
         display: flex;
         flex: 1;
       }
 
       .avals {
+        font-size: 32px;
         color: #000;
         display: flex;
         flex: 1;
@@ -58,13 +60,31 @@
       -webkit-transform: scale(0.5);
       -ms-transform: scale(0.5);
       transform: scale(0.5);
-      border-bottom-width: 1PX;
+      border-bottom-width: 2px;
     }
 
-    .bottom{
+    .bottom {
       margin-left: 32px;
       margin-top: 80px;
     }
 
   }
+
+  .selproject {
+    margin-left: 32px;
+    display: flex;
+    flex-direction: row;
+    align-items: center;
+    flex-wrap: wrap;
+    margin-bottom: 20px;
+
+    .selptxt {
+      background: #f50;
+      padding: 6px 16px;
+      margin: 6px;
+      border-radius: 8px;
+      color: #fff;
+
+    }
+  }
 }

+ 55 - 5
src/pages/customerProfile/index.jsx

@@ -2,6 +2,7 @@ import React, { Component } from "react";
 import { View, Input, Button, Text, Picker } from "@tarojs/components";
 import Taro, { getCurrentInstance } from "@tarojs/taro";
 import {
+  AtSearchBar,
   AtCheckbox,
   AtTextarea,
   AtModal,
@@ -9,6 +10,7 @@ import {
   AtModalContent,
   AtModalAction,
   AtInput,
+  AtIcon,
 } from "taro-ui";
 import Skeleton from "taro-skeleton";
 import {
@@ -29,6 +31,8 @@ import "taro-ui/dist/style/components/timeline.scss";
 import "taro-ui/dist/style/components/calendar.scss"; 2
 import "taro-ui/dist/style/components/input.scss";
 import "taro-ui/dist/style/components/checkbox.scss";
+import "taro-ui/dist/style/components/search-bar.scss";
+
 import MessageNoticebar from "../../components/common/messageNoticebar";
 import { industry, channelTypeList } from '../../utils/tools/config';
 import { getChannel } from "../../utils/tools";
@@ -59,7 +63,7 @@ class CustomerProfile extends Component {
     this.add = this.add.bind(this);
     this.getUserList = this.getUserList.bind(this);
     this.getBusinessProjectByName = this.getBusinessProjectByName.bind(this);
-
+    this.onSearchChange = this.onSearchChange.bind(this);
   }
 
   componentDidMount() {
@@ -213,9 +217,9 @@ class CustomerProfile extends Component {
     })
   }
   // 项目列表
-  getBusinessProjectByName() {
+  getBusinessProjectByName(val) {
     getBusinessProjectByName({
-      businessName: "",
+      businessName: val || "",
     })
       .then((v) => {
         if (v.error.length === 0) {
@@ -241,6 +245,12 @@ class CustomerProfile extends Component {
       });
   }
 
+  onSearchChange(value) {
+    this.setState({
+      value,
+    });
+  }
+
   getUserList() {
     findCustomerContacts({
       uid: this.$instance.router.params.id,
@@ -460,7 +470,7 @@ class CustomerProfile extends Component {
                         <View className="up"
                           onClick={e => {
                             e.stopPropagation()
-                            this.getBusinessProjectByName()
+                            this.getBusinessProjectByName("")
                             this.setState({
                               upType: 5,
                               isOpened: true,
@@ -521,7 +531,7 @@ class CustomerProfile extends Component {
                         <View className="up"
                           onClick={e => {
                             e.stopPropagation()
-                            this.getBusinessProjectByName()
+                            this.getBusinessProjectByName("")
                             this.setState({
                               upType: 5,
                               isOpened: true,
@@ -871,6 +881,46 @@ class CustomerProfile extends Component {
             {
               upType == 5 &&
               <View>
+                <AtSearchBar
+                  placeholder="请输入项目名称"
+                  showActionButton
+                  value={this.state.value}
+                  onChange={this.onSearchChange}
+                  onActionClick={() => {
+                    this.getBusinessProjectByName(this.state.value);
+                  }}
+                  onClear={() => {
+                    this.setState({
+                      value: "",
+                    }, () => { this.getBusinessProjectByName(this.state.value) });
+                  }}
+                />
+                {
+                  this.state.checkOptions.length > 0 &&
+                  <View className="selproject">
+                    已选择:
+                    {
+                      this.state.checkOptions.map((v, i) =>
+                        <View className="selptxt" key={i}
+                          onClick={() => {
+                            let list = this.state.checkOptions
+                            for (var j = 0; j < list.length; j++) {
+                              if (list[j] == v) {
+                                list.splice(j, 1)
+                                this.setState({
+                                  checkOptions: list,
+                                  info: Object.assign(info, {
+                                    intendedProject: list.toString(),
+                                  }),
+                                })
+                              }
+                            }
+                          }}
+                        >{v}&nbsp;<AtIcon className='atIcon' value='close-circle' size='12' color='#fff' /></View>
+                      )
+                    }
+                  </View>
+                }
                 <AtCheckbox
                   options={this.state.options}
                   selectedList={this.state.checkOptions}

+ 18 - 0
src/pages/customerProfile/index.less

@@ -188,4 +188,22 @@
 
   }
 
+}
+
+.selproject {
+  margin-left: 32px;
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  flex-wrap: wrap;
+  margin-bottom: 20px;
+
+  .selptxt {
+    background: #f50;
+    padding: 6px 16px;
+    margin: 6px;
+    border-radius: 8px;
+    color: #fff;
+
+  }
 }

+ 2 - 2
src/pages/examine/index.less

@@ -423,8 +423,8 @@
     height: 20px;
     border-radius: 50%;
     background: red;
-    top: 10px;
-    right: 10px;
+    top: 20px;
+    right: 20px;
 
   }
 }