罗广聪

add

@@ -26,6 +26,7 @@ export default class Edit extends Component { @@ -26,6 +26,7 @@ export default class Edit extends Component {
26 USER_ID: "", 26 USER_ID: "",
27 IS_LOGIN: "", 27 IS_LOGIN: "",
28 customer_id: this.props.navigation.state.params.item.id, 28 customer_id: this.props.navigation.state.params.item.id,
  29 + todo: this.props.navigation.state.params.todo,
29 name: "", 30 name: "",
30 age: "", 31 age: "",
31 phone: "", 32 phone: "",
@@ -109,6 +110,31 @@ export default class Edit extends Component { @@ -109,6 +110,31 @@ export default class Edit extends Component {
109 } 110 }
110 ); 111 );
111 } 112 }
  113 + add() {
  114 + const that = this;
  115 + const { USER_ID } = this.state;
  116 + const { goBack, state } = this.props.navigation;
  117 + post(
  118 + `/test/insurance/contact/update/${USER_ID}`,
  119 + {
  120 + name: this.state.name,
  121 + age: this.state.age,
  122 + phone: this.state.phone,
  123 + sex: this.state.sex,
  124 + is_sign: this.state.is_sign,
  125 + recommend: this.state.recommend,
  126 + is_marrid: this.state.is_marrid,
  127 + has_children: this.state.has_children
  128 + },
  129 + res => {
  130 + // console.log("修改客户个人信息", res);
  131 + Alert.alert("提交成功", null, () => goBack());
  132 + },
  133 + err => {
  134 + Alert.alert(err);
  135 + }
  136 + );
  137 + }
112 delete() { 138 delete() {
113 const that = this; 139 const that = this;
114 const { customer_id } = this.state; 140 const { customer_id } = this.state;
@@ -312,7 +338,11 @@ export default class Edit extends Component { @@ -312,7 +338,11 @@ export default class Edit extends Component {
312 <View style={styles.btnContainer}> 338 <View style={styles.btnContainer}>
313 <TouchableOpacity 339 <TouchableOpacity
314 onPress={() => { 340 onPress={() => {
  341 + if(this.state.todo == 'edit') {
315 this.submit(); 342 this.submit();
  343 + } else {
  344 + this.add();
  345 + }
316 }} 346 }}
317 style={styles.confirmBtn} 347 style={styles.confirmBtn}
318 > 348 >
@@ -136,7 +136,7 @@ export default class Customer extends Component { @@ -136,7 +136,7 @@ export default class Customer extends Component {
136 <TouchableOpacity 136 <TouchableOpacity
137 style={styles.mainBtnContaierLeft} 137 style={styles.mainBtnContaierLeft}
138 onPress={() => { 138 onPress={() => {
139 - navigate("CustomerEdit"); 139 + navigate("CustomerEdit",{todo: 'add'});
140 }} 140 }}
141 > 141 >
142 <Image 142 <Image
@@ -162,6 +162,7 @@ export default class Customer extends Component { @@ -162,6 +162,7 @@ export default class Customer extends Component {
162 onPress={() => 162 onPress={() =>
163 navigate("CustomerEdit", { 163 navigate("CustomerEdit", {
164 item: item, 164 item: item,
  165 + todo: 'edit',
165 refreshCallback: this.getAsyncStorage 166 refreshCallback: this.getAsyncStorage
166 })} 167 })}
167 > 168 >