罗广聪

add

... ... @@ -26,6 +26,7 @@ export default class Edit extends Component {
USER_ID: "",
IS_LOGIN: "",
customer_id: this.props.navigation.state.params.item.id,
todo: this.props.navigation.state.params.todo,
name: "",
age: "",
phone: "",
... ... @@ -109,6 +110,31 @@ export default class Edit extends Component {
}
);
}
add() {
const that = this;
const { USER_ID } = this.state;
const { goBack, state } = this.props.navigation;
post(
`/test/insurance/contact/update/${USER_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;
... ... @@ -312,7 +338,11 @@ export default class Edit extends Component {
<View style={styles.btnContainer}>
<TouchableOpacity
onPress={() => {
if(this.state.todo == 'edit') {
this.submit();
} else {
this.add();
}
}}
style={styles.confirmBtn}
>
... ...
... ... @@ -136,7 +136,7 @@ export default class Customer extends Component {
<TouchableOpacity
style={styles.mainBtnContaierLeft}
onPress={() => {
navigate("CustomerEdit");
navigate("CustomerEdit",{todo: 'add'});
}}
>
<Image
... ... @@ -162,6 +162,7 @@ export default class Customer extends Component {
onPress={() =>
navigate("CustomerEdit", {
item: item,
todo: 'edit',
refreshCallback: this.getAsyncStorage
})}
>
... ...