|
@@ -90,7 +90,9 @@ class CustomerProfile extends Component {
|
|
|
checkCompShow: false,
|
|
|
checkCompList: [],
|
|
|
|
|
|
- currAddress: []
|
|
|
+ currAddress: [],
|
|
|
+
|
|
|
+ pageIsReadonly: false
|
|
|
};
|
|
|
this.queryByUidAll = this.queryByUidAll.bind(this);
|
|
|
this.update = this.update.bind(this);
|
|
@@ -113,10 +115,16 @@ class CustomerProfile extends Component {
|
|
|
if (!this.isLogin()) {
|
|
|
Taro.setStorageSync('currentPage', `/pages/customerProfile/index?id=${this.$instance.router.params.id}`)
|
|
|
}
|
|
|
+
|
|
|
+ let paramReadonly = this.$instance.router.params.readonly;
|
|
|
+ this.setState({ pageIsReadonly: paramReadonly ? Boolean(paramReadonly) : false });
|
|
|
}
|
|
|
|
|
|
addCommas(num) {
|
|
|
let newNum = num.toString().replace(/,/g, '');
|
|
|
+ if (num.toString().length > 1) {
|
|
|
+ newNum = newNum.toString().replace(/^0+/, '');
|
|
|
+ }
|
|
|
return newNum.replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,');
|
|
|
}
|
|
|
|
|
@@ -271,13 +279,18 @@ class CustomerProfile extends Component {
|
|
|
}
|
|
|
|
|
|
// 客户档案详情
|
|
|
- queryByUidAll() {
|
|
|
+ queryByUidAll(updateType) {
|
|
|
queryByUidAll(
|
|
|
this.$instance.router.params.notRequired,
|
|
|
{ id: this.$instance.router.params.id, }
|
|
|
)
|
|
|
.then((v) => {
|
|
|
if (v.error.length === 0) {
|
|
|
+ if (updateType === 'updateContact') {
|
|
|
+ // 只更新面谈联系信息
|
|
|
+ this.setState({ dtails: { ...this.state.dtails, contactList: v.data.contactList } });
|
|
|
+ return;
|
|
|
+ }
|
|
|
let dtailsData = {
|
|
|
...v.data,
|
|
|
companyCount: this.addCommas(v.data.companyCount || 0),
|
|
@@ -709,7 +722,7 @@ class CustomerProfile extends Component {
|
|
|
this.setState({
|
|
|
isAdd: false
|
|
|
})
|
|
|
- this.queryByUidAll()
|
|
|
+ this.queryByUidAll('updateContact')
|
|
|
} else {
|
|
|
Taro.showToast({
|
|
|
title: v.error[0].message,
|
|
@@ -979,10 +992,14 @@ class CustomerProfile extends Component {
|
|
|
<View className="item">
|
|
|
<View className="item-title">企业所在地省市区:</View>
|
|
|
<View className="item-value">
|
|
|
-
|
|
|
- <View className="link" onClick={() => this.openAddressPicker()}>
|
|
|
+ { this.state.pageIsReadonly ? (
|
|
|
+ <View>{dtails.locationProvince ? `${dtails.locationProvinceName}-${dtails.locationCityName}-${dtails.locationAreaName}` : ''}</View>
|
|
|
+ ) : (
|
|
|
+ <View className="link" onClick={() => this.openAddressPicker()}>
|
|
|
{dtails.locationProvince ? `${dtails.locationProvinceName}-${dtails.locationCityName}-${dtails.locationAreaName}` : '请选择'}
|
|
|
- </View>
|
|
|
+ </View>
|
|
|
+ ) }
|
|
|
+
|
|
|
|
|
|
</View>
|
|
|
</View>
|
|
@@ -992,22 +1009,25 @@ class CustomerProfile extends Component {
|
|
|
渠道类别:
|
|
|
</View>
|
|
|
<View className="item-value" 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 className="link">
|
|
|
- {!getChannel(dtails.channelType) ? "请选择" : getChannel(dtails.channelType)}
|
|
|
- </View>
|
|
|
- </Picker>
|
|
|
+ { this.state.pageIsReadonly ? (
|
|
|
+ <View>{ getChannel(dtails.channelType) }</View>
|
|
|
+ ) : (
|
|
|
+ <Picker
|
|
|
+ value={dtails.channelType}
|
|
|
+ range={channelTypeList}
|
|
|
+ rangeKey='title'
|
|
|
+ mode='selector'
|
|
|
+ onChange={(e) => {
|
|
|
+ const { dtails } = this.state;
|
|
|
+ dtails.channelType = e.detail.value;
|
|
|
+ this.setState({ dtails })
|
|
|
+ }}>
|
|
|
+ <View className="link">
|
|
|
+ {!getChannel(dtails.channelType) ? "请选择" : getChannel(dtails.channelType)}
|
|
|
+ </View>
|
|
|
+ </Picker>
|
|
|
+ ) }
|
|
|
+
|
|
|
</View>
|
|
|
</View>
|
|
|
|
|
@@ -1028,6 +1048,7 @@ class CustomerProfile extends Component {
|
|
|
this.setState({ dtails })
|
|
|
}}
|
|
|
cursor={-1}
|
|
|
+ disabled={this.state.pageIsReadonly}
|
|
|
/>
|
|
|
</View>
|
|
|
</View>
|
|
@@ -1046,6 +1067,7 @@ class CustomerProfile extends Component {
|
|
|
}}
|
|
|
maxLength={200}
|
|
|
placeholder='请填写渠道考核指标~'
|
|
|
+ disabled={this.state.pageIsReadonly}
|
|
|
/>
|
|
|
</View>
|
|
|
</View>
|
|
@@ -1063,7 +1085,7 @@ class CustomerProfile extends Component {
|
|
|
<View className="item-title">
|
|
|
主要面谈联系信息:
|
|
|
{
|
|
|
- dtails.myUser == 1 &&
|
|
|
+ !this.state.pageIsReadonly && dtails.myUser == 1 &&
|
|
|
<View className="tbuttom"
|
|
|
onClick={e => {
|
|
|
e.stopPropagation()
|
|
@@ -1118,18 +1140,30 @@ class CustomerProfile extends Component {
|
|
|
<View className="item">
|
|
|
<View className="item-title">企业所在地省市区:</View>
|
|
|
<View className="item-value">
|
|
|
- <View className="link" onClick={() => this.openAddressPicker()}>
|
|
|
- {dtails.locationProvince ? `${dtails.locationProvinceName}-${dtails.locationCityName}-${dtails.locationAreaName}` : '请选择'}
|
|
|
- </View>
|
|
|
+ { this.state.pageIsReadonly ? (
|
|
|
+ <View>
|
|
|
+ {dtails.locationProvince ? `${dtails.locationProvinceName}-${dtails.locationCityName}-${dtails.locationAreaName}` : ''}
|
|
|
+ </View>
|
|
|
+ ) : (
|
|
|
+ <View className="link" onClick={() => this.openAddressPicker()}>
|
|
|
+ {dtails.locationProvince ? `${dtails.locationProvinceName}-${dtails.locationCityName}-${dtails.locationAreaName}` : '请选择'}
|
|
|
+ </View>
|
|
|
+ ) }
|
|
|
+
|
|
|
</View>
|
|
|
</View>
|
|
|
|
|
|
<View className="item">
|
|
|
<View className="item-title">企业所属行业:</View>
|
|
|
<View className="item-value">
|
|
|
- <View className="link" onClick={() => this.handleOpenMultiplePicker('industry')}>
|
|
|
- {this.state.dtails.industryName || '请选择'}
|
|
|
- </View>
|
|
|
+ { this.state.pageIsReadonly ? (
|
|
|
+ <View>{ this.state.dtails.industryName }</View>
|
|
|
+ ) : (
|
|
|
+ <View className="link" onClick={() => this.handleOpenMultiplePicker('industry')}>
|
|
|
+ {this.state.dtails.industryName || '请选择'}
|
|
|
+ </View>
|
|
|
+ )}
|
|
|
+
|
|
|
</View>
|
|
|
</View>
|
|
|
|
|
@@ -1146,6 +1180,7 @@ class CustomerProfile extends Component {
|
|
|
this.setState({ dtails })
|
|
|
}}
|
|
|
cursor={-1}
|
|
|
+ disabled={this.state.pageIsReadonly}
|
|
|
/>
|
|
|
</View>
|
|
|
</View>
|
|
@@ -1166,6 +1201,7 @@ class CustomerProfile extends Component {
|
|
|
this.setState({ dtails })
|
|
|
}}
|
|
|
cursor={-1}
|
|
|
+ disabled={this.state.pageIsReadonly}
|
|
|
/>
|
|
|
</View>
|
|
|
</View>
|
|
@@ -1187,6 +1223,7 @@ class CustomerProfile extends Component {
|
|
|
this.setState({ dtails })
|
|
|
}}
|
|
|
cursor={-1}
|
|
|
+ disabled={this.state.pageIsReadonly}
|
|
|
/>
|
|
|
</View>
|
|
|
</View>
|
|
@@ -1208,6 +1245,7 @@ class CustomerProfile extends Component {
|
|
|
this.setState({ dtails })
|
|
|
}}
|
|
|
cursor={-1}
|
|
|
+ disabled={this.state.pageIsReadonly}
|
|
|
/>
|
|
|
</View>
|
|
|
</View>
|
|
@@ -1216,18 +1254,27 @@ class CustomerProfile extends Component {
|
|
|
<View className="item">
|
|
|
<View className="item-title">对外投资控股的行业:</View>
|
|
|
<View className="item-value">
|
|
|
- <View className="link" onClick={() => this.handleOpenMultiplePicker('externalInvestIndustry')}>
|
|
|
- {this.state.dtails.externalInvestIndustryName || '请选择'}
|
|
|
- </View>
|
|
|
+ { this.state.pageIsReadonly ? (
|
|
|
+ <View>{ dtails.externalInvestIndustryName }</View>
|
|
|
+ ) : (
|
|
|
+ <View className="link" onClick={() => this.handleOpenMultiplePicker('externalInvestIndustry')}>
|
|
|
+ { dtails.externalInvestIndustryName || '请选择' }
|
|
|
+ </View>
|
|
|
+ ) }
|
|
|
</View>
|
|
|
</View>
|
|
|
|
|
|
<View className="item">
|
|
|
<View className="item-title">对外投资控股的企业名称:</View>
|
|
|
<View className="item-value">
|
|
|
- <View className="link" onClick={() => this.handleSelComp()}>
|
|
|
+ { this.state.pageIsReadonly ? (
|
|
|
+ <View>{ dtails.externalInvestName }</View>
|
|
|
+ ) : (
|
|
|
+ <View className="link" onClick={() => this.handleSelComp()}>
|
|
|
{dtails.externalInvestName || '请选择'}
|
|
|
- </View>
|
|
|
+ </View>
|
|
|
+ ) }
|
|
|
+
|
|
|
</View>
|
|
|
</View>
|
|
|
|
|
@@ -1244,7 +1291,7 @@ class CustomerProfile extends Component {
|
|
|
<View className="item-title">
|
|
|
主要面谈联系信息:
|
|
|
{
|
|
|
- dtails.myUser == 1 &&
|
|
|
+ !this.state.pageIsReadonly && dtails.myUser == 1 &&
|
|
|
<View className="tbuttom"
|
|
|
onClick={e => {
|
|
|
e.stopPropagation()
|
|
@@ -1301,7 +1348,7 @@ class CustomerProfile extends Component {
|
|
|
<Text className="txt">(专利信息、标准、专利、软著)</Text>
|
|
|
</Text>
|
|
|
{
|
|
|
- dtails.myUser == 1 &&
|
|
|
+ !this.state.pageIsReadonly && dtails.myUser == 1 &&
|
|
|
<View className="up"
|
|
|
onClick={e => {
|
|
|
e.stopPropagation()
|
|
@@ -1349,6 +1396,7 @@ class CustomerProfile extends Component {
|
|
|
this.setState({ dtails })
|
|
|
}}
|
|
|
cursor={-1}
|
|
|
+ disabled={this.state.pageIsReadonly}
|
|
|
/>
|
|
|
</View>
|
|
|
</View>
|
|
@@ -1370,6 +1418,7 @@ class CustomerProfile extends Component {
|
|
|
this.setState({ dtails })
|
|
|
}}
|
|
|
cursor={-1}
|
|
|
+ disabled={this.state.pageIsReadonly}
|
|
|
/>
|
|
|
</View>
|
|
|
</View>
|
|
@@ -1391,6 +1440,7 @@ class CustomerProfile extends Component {
|
|
|
this.setState({ dtails })
|
|
|
}}
|
|
|
cursor={-1}
|
|
|
+ disabled={this.state.pageIsReadonly}
|
|
|
/>
|
|
|
</View>
|
|
|
</View>
|
|
@@ -1412,6 +1462,7 @@ class CustomerProfile extends Component {
|
|
|
this.setState({ dtails })
|
|
|
}}
|
|
|
cursor={-1}
|
|
|
+ disabled={this.state.pageIsReadonly}
|
|
|
/>
|
|
|
</View>
|
|
|
</View>
|
|
@@ -1421,9 +1472,14 @@ class CustomerProfile extends Component {
|
|
|
</View>
|
|
|
</View>
|
|
|
}
|
|
|
- <View style={{ marginTop: '24rpx' }}>
|
|
|
- <AtButton type="primary" onClick={this.onSaveAllData.bind(this)}>保存</AtButton>
|
|
|
- </View>
|
|
|
+ {
|
|
|
+ !this.state.pageIsReadonly && (
|
|
|
+ <View style={{ marginTop: '24rpx' }}>
|
|
|
+ <AtButton type="primary" onClick={this.onSaveAllData.bind(this)}>保存</AtButton>
|
|
|
+ </View>
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
{/* {
|
|
|
dtails.newChannel == 1
|
|
|
?
|
|
@@ -2126,7 +2182,7 @@ class CustomerProfile extends Component {
|
|
|
this.setState({
|
|
|
isAdd: false,
|
|
|
}, () => {
|
|
|
- this.queryByUidAll()
|
|
|
+ this.queryByUidAll('updateContact')
|
|
|
})
|
|
|
}}>取消</Button>
|
|
|
<Button type='primary' onClick={this.add}>保存</Button>
|