罗广聪

可修改了

@@ -23,23 +23,88 @@ export default class Edit extends Component { @@ -23,23 +23,88 @@ export default class Edit extends Component {
23 super(props); 23 super(props);
24 this.state = { 24 this.state = {
25 USER_ID: "", 25 USER_ID: "",
26 - customer_id: "", 26 + customer_id: this.props.navigation.state.params.item.id,
27 name: "", 27 name: "",
28 age: "", 28 age: "",
29 phone: "", 29 phone: "",
30 sex: "", 30 sex: "",
31 is_sign: "", 31 is_sign: "",
32 recommend: "", 32 recommend: "",
33 - is_married: "", 33 + is_marrid: "",
34 has_children: "" 34 has_children: ""
35 }; 35 };
36 } 36 }
37 - componentWillMount() {} 37 + componentWillMount() {
  38 + console.log("customer_id", this.state.customer_id);
  39 + this.getItemInfo();
  40 + }
38 41
39 componentDidMount() {} 42 componentDidMount() {}
40 43
41 - getListData() { 44 + getItemInfo() {
42 - post("/test/insurance/article", {}, res => {}, err => {}); 45 + const that = this;
  46 + const { customer_id } = this.state;
  47 + post(
  48 + `/test/insurance/contact/get/detail/${customer_id}`,
  49 + {},
  50 + res => {
  51 + console.log("客户个人信息", res);
  52 + that.setState({
  53 + name: res.data.name,
  54 + age: res.data.age,
  55 + phone: res.data.phone,
  56 + sex: res.data.sex,
  57 + is_sign: res.data.is_sign,
  58 + recommend: res.data.recommend,
  59 + is_marrid: res.data.is_marrid,
  60 + has_children: res.data.has_children
  61 + });
  62 + },
  63 + err => {
  64 + console.log(err);
  65 + }
  66 + );
  67 + }
  68 +
  69 + submit() {
  70 + const that = this;
  71 + const { customer_id } = this.state;
  72 + const { goBack } = this.props.navigation;
  73 + post(
  74 + `/test/insurance/contact/update/${customer_id}`,
  75 + {
  76 + name: this.state.name,
  77 + age: this.state.age,
  78 + phone: this.state.phone,
  79 + sex: this.state.sex,
  80 + is_sign: this.state.is_sign,
  81 + recommend: this.state.recommend,
  82 + is_marrid: this.state.is_marrid,
  83 + has_children: this.state.has_children
  84 + },
  85 + res => {
  86 + console.log("修改客户个人信息", res);
  87 + Alert.alert("提交成功", null, () => goBack());
  88 + },
  89 + err => {
  90 + Alert.alert(err);
  91 + }
  92 + );
  93 + }
  94 + delete() {
  95 + const that = this;
  96 + const { customer_id } = this.state;
  97 + post(
  98 + `/test/insurance/contact/del/${customer_id}`,
  99 + {},
  100 + res => {
  101 + console.log("修改客户个人信息", res);
  102 + Alert.alert("删除成功", null, () => goBack());
  103 + },
  104 + err => {
  105 + Alert.alert(err);
  106 + }
  107 + );
43 } 108 }
44 109
45 Alert_select(title, tips, statusName, select1, select2) { 110 Alert_select(title, tips, statusName, select1, select2) {
@@ -70,8 +135,7 @@ export default class Edit extends Component { @@ -70,8 +135,7 @@ export default class Edit extends Component {
70 }); 135 });
71 }); 136 });
72 } 137 }
73 - submit() {} 138 +
74 - delete() {}  
75 render() { 139 render() {
76 const { navigate } = this.props.navigation; 140 const { navigate } = this.props.navigation;
77 return ( 141 return (
@@ -186,7 +250,7 @@ export default class Edit extends Component { @@ -186,7 +250,7 @@ export default class Edit extends Component {
186 <TouchableOpacity 250 <TouchableOpacity
187 style={styles.itemContainer} 251 style={styles.itemContainer}
188 onPress={() => { 252 onPress={() => {
189 - this.Alert_select("婚姻状态", "", "is_married", "已婚", "未婚"); 253 + this.Alert_select("婚姻状态", "", "is_marrid", "已婚", "未婚");
190 }} 254 }}
191 > 255 >
192 <View style={styles.itemLeft}> 256 <View style={styles.itemLeft}>
@@ -194,7 +258,7 @@ export default class Edit extends Component { @@ -194,7 +258,7 @@ export default class Edit extends Component {
194 </View> 258 </View>
195 <View style={styles.itemRight}> 259 <View style={styles.itemRight}>
196 <Text style={styles.itemRightContent}> 260 <Text style={styles.itemRightContent}>
197 - {this.state.is_married} 261 + {this.state.is_marrid}
198 </Text> 262 </Text>
199 <Image 263 <Image
200 style={styles.itemRightImg} 264 style={styles.itemRightImg}
@@ -160,7 +160,7 @@ export default class Customer extends Component { @@ -160,7 +160,7 @@ export default class Customer extends Component {
160 <TouchableOpacity 160 <TouchableOpacity
161 key={index} 161 key={index}
162 style={styles.mainCustomerItem} 162 style={styles.mainCustomerItem}
163 - onPress={() => navigate("CustomerEdit")} 163 + onPress={() => navigate("CustomerEdit",{item: item})}
164 > 164 >
165 <Text style={styles.mainCustomerItemText}>{item.name}</Text> 165 <Text style={styles.mainCustomerItemText}>{item.name}</Text>
166 <Image 166 <Image