Sfoglia il codice sorgente

客户档案增加渠道客户必填校验

雷佳斌 2 settimane fa
parent
commit
e076d8e9d9
2 ha cambiato i file con 213 aggiunte e 285 eliminazioni
  1. 207 285
      src/pages/customerProfile/index.jsx
  2. 6 0
      src/pages/interview/index.config.js

+ 207 - 285
src/pages/customerProfile/index.jsx

@@ -117,6 +117,10 @@ class CustomerProfile extends Component {
   }
 
   toggleAddressPicker(e) {
+      if (!Object.keys(e).length) {
+        this.setState({ addressPickerShow: false });
+        return;
+      }
       const addressIds = getProvince(e.province, e.city, e.area);
       const { dtails } = this.state;
       dtails.locationProvince = addressIds[0];
@@ -236,6 +240,7 @@ class CustomerProfile extends Component {
                 financialTax: v.data.financialTax || 0,
                 financialProperty: v.data.financialProperty || 0,
                 financialRd: v.data.financialRd || 0,
+                enterpriseCount: v.data.enterpriseCount || 0,
                 earlyCommunication: '',
                 customerDemand: '',
                 interviewIdeas: '',
@@ -264,118 +269,123 @@ class CustomerProfile extends Component {
   }
 
   validParams(params) {
+    const { dtails } = this.state;
     let flag = true;
     let message = '';
-    if (!params.locationProvince) {
-        message = '请选择企业所在地省市区';
-        flag = false;
-    } else if (!params.industry) {
-        message = '请选择企业所属行业';
-        flag = false;
-    } else if (!params.businessScope) {
-        message = '主营产品不能为空';
-        flag = false;
-    } else if (params.companyCount === '' || params.companyCount === undefined || params.companyCount === null) {
-        message = '请输入母/子公司数';
-        flag = false;
-    } else if (params.socialSecurityCount === '' || params.socialSecurityCount === undefined || params.socialSecurityCount === null) {
-        message = '请输入社保人数';
-        flag = false;
-    } else if (params.externalInvestCount === '' || params.externalInvestCount === undefined || params.externalInvestCount === null) {
-        message = '请输入对外投资控股的企业数';
-        flag = false;
-    } else if (params.financialRevenue === '' || params.financialRevenue === undefined || params.financialRevenue === null) {
-        message = '请输入营收数据';
-        flag = false;
-    } else if (params.financialTax === '' || params.financialTax === undefined || params.financialTax === null) {
-        message = '请输入税收数据';
-        flag = false;
-    } else if (params.financialProperty === '' || params.financialProperty === undefined || params.financialProperty === null) {
-        message = '请输入资产数据';
-        flag = false;
-    } else if (params.financialRd === '' || params.financialRd === undefined || params.financialRd === null) {
-        message = '请输入研发费用';
-        flag = false;
-    } else if (!params.externalInvestIndustry) {
-        message = '请选择对外投资控股的行业';
-        flag = false;
-    } else if (!params.externalInvestName) {
-        message = '请选择对外投资控股的企业';
-        flag = false;
-    } else if (!params.earlyCommunication || (params.earlyCommunication && params.earlyCommunication.length < 20)) {
-        message = '请输入客户的难处,并且在20字以上';
-        flag = false;
-    } else if (!params.customerDemand || (params.customerDemand && params.customerDemand.length < 20)) {
-        message = '请输入客户的需求,并且在20字以上';
-        flag = false;
-    } else if (!params.interviewIdeas || (params.interviewIdeas && params.interviewIdeas.length < 20)) {
-        message = '请输入面谈思路,并且在20字以上';
-        flag = false;
-    } else if (!params.interviewPurpose || (params.interviewPurpose && params.interviewPurpose.length < 20)) {
-        message = '请输入面谈达成的目的,并且在20字以上';
-        flag = false;
-    } else if (!params.interviewRecommend || (params.interviewRecommend && params.interviewRecommend.length < 20)) {
-        message = '请输入经理/上级面谈建议,并且在20字以上';
-        flag = false;
+    if (dtails.newChannel == 1) {
+        // 渠道客户
+        if (!params.channelType) {
+            flag = false;
+            message = '请选择渠道性质';
+        } else if (!params.enterpriseCount) {
+            flag = false;
+            message = '请输入渠道所覆盖企业数';
+        } else if (!params.channelIndicators) {
+            flag = false;
+            message = '请输入渠道考核指标';
+        }
     } else {
-        if (this.state.dtails.interviewList.length) {
-            if (!params.interviewFeedback || (params.interviewFeedback && params.interviewFeedback.length < 20)) {
-                message = '请输入面谈后的反馈,并且在20字以上';
-                flag = false;
-            } else if (!params.followUpPlan || (params.followUpPlan && params.followUpPlan.length < 20)) {
-                message = '请输入后续跟进计划,并且在20字以上';
-                flag = false;
-            }
+        if (!params.locationProvince) {
+            message = '请选择企业所在地省市区';
+            flag = false;
+        } else if (!params.industry) {
+            message = '请选择企业所属行业';
+            flag = false;
+        } else if (!params.businessScope) {
+            message = '主营产品不能为空';
+            flag = false;
+        } else if (params.companyCount === '' || params.companyCount === undefined || params.companyCount === null) {
+            message = '请输入母/子公司数';
+            flag = false;
+        } else if (params.socialSecurityCount === '' || params.socialSecurityCount === undefined || params.socialSecurityCount === null) {
+            message = '请输入社保人数';
+            flag = false;
+        } else if (params.externalInvestCount === '' || params.externalInvestCount === undefined || params.externalInvestCount === null) {
+            message = '请输入对外投资控股的企业数';
+            flag = false;
+        } else if (params.financialRevenue === '' || params.financialRevenue === undefined || params.financialRevenue === null) {
+            message = '请输入营收数据';
+            flag = false;
+        } else if (params.financialTax === '' || params.financialTax === undefined || params.financialTax === null) {
+            message = '请输入税收数据';
+            flag = false;
+        } else if (params.financialProperty === '' || params.financialProperty === undefined || params.financialProperty === null) {
+            message = '请输入资产数据';
+            flag = false;
+        } else if (params.financialRd === '' || params.financialRd === undefined || params.financialRd === null) {
+            message = '请输入研发费用';
+            flag = false;
+        } else if (!params.externalInvestIndustry) {
+            message = '请选择对外投资控股的行业';
+            flag = false;
+        } else if (!params.externalInvestName) {
+            message = '请选择对外投资控股的企业';
+            flag = false;
         }
     }
+    
 
     return { flag, message };
   }
 
   onSaveAllData() {
     const { dtails } = this.state;
-    const externalInvestIdArr = dtails.externalInvestName.split[','].map(() => {
-        return '0';
-    })
     const params = {
         id: dtails.id,
         uid: dtails.uid,
-        industry: dtails.industry,
-        industryName: dtails.industryName,
-        earlyCommunication: dtails.earlyCommunication,
-        customerDemand: dtails.customerDemand,
-        interviewIdeas: dtails.interviewIdeas,
-        interviewPurpose: dtails.interviewPurpose,
-        interviewRecommend: dtails.interviewRecommend,
-        interviewFeedback: dtails.interviewFeedback,
-        followUpPlan: dtails.followUpPlan,
-        patentCount: dtails.patentCount,
-        inventionPatentCount: dtails.inventionPatentCount,
-        utilityModelCount: dtails.utilityModelCount,
-        appearancePatentCount: dtails.appearancePatentCount,
-        softwareWorksCount: dtails.softwareWorksCount,
-        otherCount: dtails.otherCount,
-        financialData: dtails.financialData,
-        companyCount: dtails.companyCount,
-        socialSecurityCount: dtails.socialSecurityCount,
-        externalInvestCount: dtails.externalInvestCount,
-        externalInvestIndustry: dtails.externalInvestIndustry,
-        externalInvestIndustryName: dtails.externalInvestIndustryName,
-        externalInvestId: externalInvestIdArr.join(','),
-        externalInvestName: dtails.externalInvestName,
-        financialRevenue: dtails.financialRevenue,
-        financialTax: dtails.financialTax,
-        financialProperty: dtails.financialProperty,
-        financialRd: dtails.financialRd,
         locationProvince: dtails.locationProvince,
         locationProvinceName: dtails.locationProvinceName,
         locationCity: dtails.locationCity,
         locationCityName: dtails.locationCityName,
         locationArea: dtails.locationArea,
         locationAreaName: dtails.locationAreaName,
-        standard: dtails.standard,
-        businessScope: dtails.businessScope
     };
+    if (dtails.newChannel == 1) {
+        // 渠道客户
+        params = {
+            ...params,
+            channelType: dtails.channelType,
+            enterpriseCount: dtails.enterpriseCount,
+            channelIndicators: dtails.channelIndicators,
+        };
+    } else {
+        const externalInvestIdArr = dtails.externalInvestName.split[','].map(() => {
+            return '0';
+        })
+        params = {
+            ...params,
+            industry: dtails.industry,
+            industryName: dtails.industryName,
+        //     earlyCommunication: dtails.earlyCommunication,
+        //     customerDemand: dtails.customerDemand,
+        //     interviewIdeas: dtails.interviewIdeas,
+        //     interviewPurpose: dtails.interviewPurpose,
+        //     interviewRecommend: dtails.interviewRecommend,
+        //     interviewFeedback: dtails.interviewFeedback,
+        //     followUpPlan: dtails.followUpPlan,
+            patentCount: dtails.patentCount,
+            inventionPatentCount: dtails.inventionPatentCount,
+            utilityModelCount: dtails.utilityModelCount,
+            appearancePatentCount: dtails.appearancePatentCount,
+            softwareWorksCount: dtails.softwareWorksCount,
+            otherCount: dtails.otherCount,
+        //     financialData: dtails.financialData,
+            companyCount: dtails.companyCount,
+            socialSecurityCount: dtails.socialSecurityCount,
+            externalInvestCount: dtails.externalInvestCount,
+            externalInvestIndustry: dtails.externalInvestIndustry,
+            externalInvestIndustryName: dtails.externalInvestIndustryName,
+            externalInvestId: externalInvestIdArr.join(','),
+            externalInvestName: dtails.externalInvestName,
+            financialRevenue: dtails.financialRevenue,
+            financialTax: dtails.financialTax,
+            financialProperty: dtails.financialProperty,
+            financialRd: dtails.financialRd,
+            standard: dtails.standard,
+            businessScope: dtails.businessScope,
+        };
+    }
+    
     for (let key in params) {
         if (params[key] === undefined || params[key] === 'undefined' || params[key] === null || params[key] === 'null') {
             delete params[key];
@@ -877,35 +887,69 @@ class CustomerProfile extends Component {
                 dtails.newChannel == 1
                   ?
                   <View className="first">
-                    <View className="tit">
-                      已知渠道情况
-                      {
-                        dtails.myUser == 1 &&
-                        <View className="up"
-                          onClick={e => {
-                            e.stopPropagation()
-                            this.setState({
-                              upType: 7,
-                              isOpened: true,
-                              info: {
-                                uid: this.$instance.router.params.id,
-                                channelType: dtails.channelType,
-                                enterpriseCount: dtails.enterpriseCount,
-                                channelIndicators: dtails.channelIndicators,
-                              },
-                              channe: {
-                                id: dtails.channelType,
-                                title: getChannel(dtails.channelType)
-                              }
-                            })
-                          }}
-                        >修改</View>
-                      }
+                      <View className="title">渠道档案</View>
+                    <View className="val" style={{ display: 'flex' }}>
+                        企业所在地省市区:
+                        <View onClick={() => {this.setState({ addressPickerShow: true })}}>
+                            { dtails.locationProvince ? `${dtails.locationProvinceName}-${dtails.locationCityName}-${dtails.locationAreaName}` : '请选择' }
+                        </View>
+                        <AddressPicker
+                            pickerShow={this.state.addressPickerShow}
+                            onHandleToggleShow={this.toggleAddressPicker.bind(this)}
+                        />
                     </View>
-                    <View className="val">渠道类别:{getChannel(dtails.channelType)}</View>
-                    <View className="val">渠道企业数:{dtails.enterpriseCount}</View>
-                    <View className="val">渠道考核指标:{dtails.channelIndicators}</View>
-                    <View className="tit">
+                    <View className="val" style={{ display: 'flex', alignItems: 'center' }}>
+                        渠道类别:
+                        <Picker
+                            value={dtails.channelType}
+                            range={channelTypeList}
+                            rangeKey='title'
+                            mode='selector'
+                            onChange={(e) => {
+                                const { dtails } = this.state; 
+                                dtails.channelType = e.detail.value;
+                                console.log(dtails.channelType)
+                                this.setState({ dtails })
+                            }}>
+                            <View>
+                            {!getChannel(dtails.channelType) ? "请选择" : getChannel(dtails.channelType)}
+                            </View>
+                        </Picker>
+                    </View>
+                    <View className="val" style={{ display: 'flex', alignItems: 'center' }}>
+                        渠道企业数:
+                        <View style={{width: '120rpx'}}>
+                            <AtInputNumber
+                            min={0}
+                            max={99999}
+                            value={dtails.enterpriseCount}
+                            name='companyCount'
+                            type='number'
+                            placeholder='请输入数量'
+                            size='mini'
+                            onChange={value => {
+                                dtails.enterpriseCount = value;
+                                this.setState({ dtails })
+                            }}
+                            />
+                        </View>
+                    </View>
+                    <View className="val" style={{display: 'flex'}}>
+                        渠道考核指标:
+                        <AtTextarea
+                            value={dtails.channelIndicators || ''}
+                            onChange={e => {
+                                this.setState({
+                                    dtails: Object.assign(dtails, {
+                                        channelIndicators: e,
+                                    }),
+                                })
+                            }}
+                            maxLength={200}
+                            placeholder='请填写渠道考核指标~'
+                        />
+                    </View>
+                    <View className="tit" style={{ marginTop: '60rpx' }}>
                       <Text>
                         联系人
                         <Text className="txt">(面谈人)</Text>
@@ -935,10 +979,41 @@ class CustomerProfile extends Component {
                         <View className="val" key={k}>{v.name}&nbsp;&nbsp;{v.position}&nbsp;&nbsp;{v.department}&nbsp;&nbsp;{v.mobile}</View>
                       )
                     }
+                    <View className="tit" style={{marginTop: '60rpx'}}>
+                      已面谈项目
+                      {/* {
+                        dtails.myUser == 1 &&
+                        <View className="up"
+                          onClick={e => {
+                            e.stopPropagation()
+                            this.getBusinessProjectByName("")
+                            this.setState({
+                              upType: 5,
+                              isOpened: true,
+                              info: {
+                                uid: this.$instance.router.params.id,
+                                intendedProject: dtails.intendedProject,
+                              },
+                              checkOptions: []
+                            })
+                          }}
+                        >新增</View>
+                      } */}
+                    </View>
+                    <View className="val">{
+                        this.state.projectList.map(item => {
+                            return <View style={{ display: 'flex', alignItems: 'center' }}>
+                                <Text style={{ fontSize: '30rpx' }} style={{marginRight: '10rpx'}}>
+                                    { this.renderProjectItemName(item) }
+                                </Text>
+                                {/* <AtIcon value="close" size='15' color="#f00" onClick={() => {this.handleDelProject(item)}} /> */}
+                            </View>
+                        })
+                    }</View>
                   </View>
                   :
                   <View className="first">
-                    <View className="title">企业面谈思路表</View>
+                    <View className="title">企业档案表</View>
                     <View className="val" style={{ display: 'flex' }}>
                         企业所在地省市区:
                         {/* <Picker
@@ -1108,8 +1183,8 @@ class CustomerProfile extends Component {
                     }
 
                     <View className="tit">
-                      本次面谈项目
-                      {
+                      面谈项目
+                      {/* {
                         dtails.myUser == 1 &&
                         <View className="up"
                           onClick={e => {
@@ -1126,7 +1201,7 @@ class CustomerProfile extends Component {
                             })
                           }}
                         >新增</View>
-                      }
+                      } */}
                     </View>
                     <View className="val">{
                         this.state.projectList.map(item => {
@@ -1134,19 +1209,19 @@ class CustomerProfile extends Component {
                                 <Text style={{ fontSize: '30rpx' }} style={{marginRight: '10rpx'}}>
                                     { this.renderProjectItemName(item) }
                                 </Text>
-                                <AtIcon value="close" size='15' color="#f00" onClick={() => {this.handleDelProject(item)}} />
+                                {/* <AtIcon value="close" size='15' color="#f00" onClick={() => {this.handleDelProject(item)}} /> */}
                             </View>
                         })
                     }</View>
 
                     <View style={{marginTop: '60rpx'}}>
-                        <View className="title">面谈已知企业情况</View>
+                        <View className="title">企业情况</View>
                         <View className="tit">
                             <Text>
                                 1.知识产权情况
-                                <Text className="txt">(专利信息、标准、专利、软著)</Text>
+                                {/* <Text className="txt">(专利信息、标准、专利、软著)</Text> */}
                             </Text>
-                            {
+                            {/* {
                             dtails.myUser == 1 &&
                             <View className="up"
                             onClick={e => {
@@ -1166,7 +1241,7 @@ class CustomerProfile extends Component {
                                 })
                             }}
                             >修改</View>
-                        }
+                        } */}
                         </View>
                         <View className="val">
                             专利&nbsp;<Text className="num">{dtails.patentCount || 0}</Text>&nbsp;&nbsp;&nbsp;
@@ -1253,166 +1328,13 @@ class CustomerProfile extends Component {
                             </View>
                         </View>
 
-                        <View className="tit">3.前期沟通情况</View>
-                        <View className="tit">
-                            <Text>
-                            客户的难处
-                            <Text className="txt">(20字以上)</Text>
-                            </Text>
-                            { dtails.interviewList.length ? (
-                                <AtIcon value='clock' size='20' color='#1E90FF' onClick={() => this.openInteractHis('earlyCommunication')}></AtIcon>
-                            ) : null }
-                            
-                        </View>
-                        <View className="val">
-                            <AtTextarea
-                            value={dtails.earlyCommunication}
-                            maxLength={200}
-                            placeholder='请编写本次面谈客户难处~'
-                            height={70}
-                            onChange={value => {
-                                dtails.earlyCommunication = value;
-                                this.setState({ dtails });
-                            }}
-                            />
-                        </View>
-                        <View className="tit">
-                            <Text>
-                            客户的需求
-                            <Text className="txt">(20字以上)</Text>
-                            </Text>
-                            { dtails.interviewList.length ? (
-                                <AtIcon value='clock' size='20' color='#1E90FF' onClick={() => this.openInteractHis('customerDemand')}></AtIcon>
-                            ) : null }
-                            
-                        </View>
-                        <View className="val">
-                            <AtTextarea
-                            value={dtails.customerDemand}
-                            maxLength={200}
-                            placeholder='请编写本次面谈客户需求~'
-                            height={70}
-                            onChange={value => {
-                                dtails.customerDemand = value;
-                                this.setState({ dtails });
-                            }}
-                            />
-                        </View>
-                        <View className="tit">
-                            <Text>
-                            面谈思路
-                            <Text className="txt">(20字以上)</Text>
-                            </Text>
-                            { dtails.interviewList.length ? (
-                                <AtIcon value='clock' size='20' color='#1E90FF' onClick={() => this.openInteractHis('interviewIdeas')}></AtIcon>
-                            ) : null }
-                            
-                        </View>
-                        <View className="val">
-                            <AtTextarea
-                            value={dtails.interviewIdeas}
-                            maxLength={200}
-                            placeholder='请编写本次面谈客户思路~'
-                            height={70}
-                            onChange={value => {
-                                dtails.interviewIdeas = value;
-                                this.setState({ dtails });
-                            }}
-                            />
-                        </View>
-                        <View className="tit">
-                            <Text>
-                            面谈达成的目的
-                            <Text className="txt">(20字以上)</Text>
-                            </Text>
-                            { dtails.interviewList.length ? (
-                                <AtIcon value='clock' size='20' color='#1E90FF' onClick={() => this.openInteractHis('interviewPurpose')}></AtIcon>
-                            ) : null }
-                        </View>
-                        <View className="val">
-                            <AtTextarea
-                            value={dtails.interviewPurpose}
-                            maxLength={200}
-                            placeholder='请编写本次面谈达成的目的~'
-                            height={70}
-                            onChange={value => {
-                                dtails.interviewPurpose = value;
-                                this.setState({ dtails });
-                            }}
-                            />
-                        </View>
-                        <View className="tit">
-                            <Text>
-                            经理/上级面谈建议
-                            <Text className="txt">(由经理/上级口述,本人整理,20字以上)</Text>
-                            </Text>
-                            { dtails.interviewList.length ? (
-                                <AtIcon value='clock' size='20' color='#1E90FF' onClick={() => this.openInteractHis('interviewRecommend')}></AtIcon>
-                            ) : null }
-                        </View>
-                        <View className="val">
-                            <AtTextarea
-                            value={dtails.interviewRecommend}
-                            maxLength={200}
-                            placeholder='请编写本次面谈建议~'
-                            height={70}
-                            onChange={value => {
-                                dtails.interviewRecommend = value;
-                                this.setState({ dtails });
-                            }}
-                            />
-                        </View>
-
-                        { dtails.interviewList && dtails.interviewList.length ? (
-                            <>
-                                <View className="tit">
-                                    <Text>
-                                    面谈后的反馈
-                                    <Text className="txt">(20字以上)</Text>
-                                    </Text>
-                                    <AtIcon value='clock' size='20' color='#1E90FF' onClick={() => this.openInteractHis('interviewFeedback')}></AtIcon>
-                                </View>
-                                <View className="val">
-                                    <AtTextarea
-                                    value={dtails.interviewFeedback}
-                                    maxLength={200}
-                                    placeholder='请编写本次面谈后的反馈~'
-                                    height={70}
-                                    onChange={value => {
-                                        dtails.interviewFeedback = value;
-                                        this.setState({ dtails });
-                                    }}
-                                    />
-                                </View>
-
-                                <View className="tit">
-                                    <Text>
-                                    后续跟进计划
-                                    <Text className="txt">(20字以上)</Text>
-                                    </Text>
-                                    <AtIcon value='clock' size='20' color='#1E90FF' onClick={() => this.openInteractHis('followUpPlan')}></AtIcon>
-                                </View>
-                                <View className="val">
-                                    <AtTextarea
-                                    value={dtails.followUpPlan}
-                                    maxLength={200}
-                                    placeholder='请编写后续跟进计划~'
-                                    height={70}
-                                    onChange={value => {
-                                        dtails.followUpPlan = value;
-                                        this.setState({ dtails });
-                                    }}
-                                    />
-                                </View>
-                            </>
-                        ) : null }
-
-                        <View style={{ marginTop: '24rpx'}}>
-                            <AtButton type="primary" onClick={this.onSaveAllData.bind(this)}>保存</AtButton>
-                        </View>
+                        
                     </View>
                   </View>
               }
+              <View style={{ marginTop: '24rpx'}}>
+                <AtButton type="primary" onClick={this.onSaveAllData.bind(this)}>保存</AtButton>
+              </View>
               {/* {
                 dtails.newChannel == 1
                   ?

+ 6 - 0
src/pages/interview/index.config.js

@@ -0,0 +1,6 @@
+export default {
+  navigationBarTitleText: '客户档案',
+  usingComponents: {
+    timePicker: '../../components/common/timePicker/timePicker'
+  }
+}