罗广聪

可修改了

... ... @@ -23,23 +23,88 @@ export default class Edit extends Component {
super(props);
this.state = {
USER_ID: "",
customer_id: "",
customer_id: this.props.navigation.state.params.item.id,
name: "",
age: "",
phone: "",
sex: "",
is_sign: "",
recommend: "",
is_married: "",
is_marrid: "",
has_children: ""
};
}
componentWillMount() {}
componentWillMount() {
console.log("customer_id", this.state.customer_id);
this.getItemInfo();
}
componentDidMount() {}
getListData() {
post("/test/insurance/article", {}, res => {}, err => {});
getItemInfo() {
const that = this;
const { customer_id } = this.state;
post(
`/test/insurance/contact/get/detail/${customer_id}`,
{},
res => {
console.log("客户个人信息", res);
that.setState({
name: res.data.name,
age: res.data.age,
phone: res.data.phone,
sex: res.data.sex,
is_sign: res.data.is_sign,
recommend: res.data.recommend,
is_marrid: res.data.is_marrid,
has_children: res.data.has_children
});
},
err => {
console.log(err);
}
);
}
submit() {
const that = this;
const { customer_id } = this.state;
const { goBack } = this.props.navigation;
post(
`/test/insurance/contact/update/${customer_id}`,
{
name: this.state.name,
age: this.state.age,
phone: this.state.phone,
sex: this.state.sex,
is_sign: this.state.is_sign,
recommend: this.state.recommend,
is_marrid: this.state.is_marrid,
has_children: this.state.has_children
},
res => {
console.log("修改客户个人信息", res);
Alert.alert("提交成功", null, () => goBack());
},
err => {
Alert.alert(err);
}
);
}
delete() {
const that = this;
const { customer_id } = this.state;
post(
`/test/insurance/contact/del/${customer_id}`,
{},
res => {
console.log("修改客户个人信息", res);
Alert.alert("删除成功", null, () => goBack());
},
err => {
Alert.alert(err);
}
);
}
Alert_select(title, tips, statusName, select1, select2) {
... ... @@ -70,8 +135,7 @@ export default class Edit extends Component {
});
});
}
submit() {}
delete() {}
render() {
const { navigate } = this.props.navigation;
return (
... ... @@ -186,7 +250,7 @@ export default class Edit extends Component {
<TouchableOpacity
style={styles.itemContainer}
onPress={() => {
this.Alert_select("婚姻状态", "", "is_married", "已婚", "未婚");
this.Alert_select("婚姻状态", "", "is_marrid", "已婚", "未婚");
}}
>
<View style={styles.itemLeft}>
... ... @@ -194,7 +258,7 @@ export default class Edit extends Component {
</View>
<View style={styles.itemRight}>
<Text style={styles.itemRightContent}>
{this.state.is_married}
{this.state.is_marrid}
</Text>
<Image
style={styles.itemRightImg}
... ...
... ... @@ -160,7 +160,7 @@ export default class Customer extends Component {
<TouchableOpacity
key={index}
style={styles.mainCustomerItem}
onPress={() => navigate("CustomerEdit")}
onPress={() => navigate("CustomerEdit",{item: item})}
>
<Text style={styles.mainCustomerItemText}>{item.name}</Text>
<Image
... ...