WriteInternalReport.js 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. import React, {Component} from 'react';
  2. import {
  3. View,
  4. Text,
  5. StatusBar,
  6. DeviceEventEmitter,
  7. StyleSheet,
  8. TextInput,
  9. ScrollView,
  10. } from 'react-native';
  11. import {Provider, Toast, Button, List} from '@ant-design/react-native';
  12. import {connect} from 'react-redux';
  13. import DatePicker from 'react-native-datepicker';
  14. import FormateDate from '../../components/FormateDate';
  15. import {ComponentsStyles} from '../../components/ComponentsStyles';
  16. import RadioModal from '../../components/RadioModal';
  17. @connect(customer => ({...customer}))
  18. class WriteInternalReport extends Component {
  19. // 填写跟踪报告
  20. constructor(props) {
  21. super(props);
  22. this.state = {
  23. item: this.props.navigation.state.params.item,
  24. next_time: '',
  25. instruction: '',
  26. is_copy: 0,
  27. };
  28. };
  29. onSave = () => {
  30. if (!this.state.description) {
  31. Toast.info('请填写回访情况', 1);
  32. return;
  33. }
  34. if (!this.state.next_time) {
  35. Toast.info('请填写下次回访日期', 1);
  36. return;
  37. }
  38. const date = new Date();
  39. const today = FormateDate(date, 'YYYY-MM-DD');
  40. if (this.state.next_time < today) {
  41. Toast.info('下次回访日期不能早于今天', 1);
  42. return;
  43. }
  44. this.props.dispatch({
  45. type: 'customer/addInternalReview',
  46. payload: this.state,
  47. callback: () => {
  48. // 返回,刷新潜客跟踪列表或潜客完善列表
  49. DeviceEventEmitter.emit('refeshReport');
  50. this.props.navigation.goBack();
  51. },
  52. });
  53. };
  54. render() {
  55. const {loading} = this.props.customer;
  56. return (
  57. <Provider>
  58. <StatusBar backgroundColor={'#fff'} barStyle='dark-content'/>
  59. <ScrollView>
  60. <View style={styles.infoContent}>
  61. <List>
  62. <List.Item extra={<Text style={ComponentsStyles.font15}>{this.state.item.name}</Text>}
  63. arrow="empty">
  64. <Text style={ComponentsStyles.font15}>姓名</Text>
  65. </List.Item>
  66. <List.Item extra={<Text style={ComponentsStyles.font15}>{this.state.item.tel}</Text>}
  67. arrow="empty">
  68. <Text style={ComponentsStyles.font15}>电话</Text>
  69. </List.Item>
  70. <List.Item
  71. extra={<Text style={ComponentsStyles.font15}>{this.state.item.project_text}</Text>}
  72. arrow="empty">
  73. <Text style={ComponentsStyles.font15}>项目</Text>
  74. </List.Item>
  75. </List>
  76. <TextInput
  77. style={{
  78. height: 140,
  79. borderColor: '#eee',
  80. textAlignVertical: 'top',
  81. borderBottomWidth: 1,
  82. paddingTop: 10,
  83. paddingHorizontal: 10,
  84. }}
  85. onChangeText={text => this.setState({description: text})}
  86. value={this.state.description}
  87. multiline={true}
  88. numberOfLines={4}
  89. maxLength={1000}
  90. placeholder={'请填写回访情况'}
  91. />
  92. <View style={ComponentsStyles.genderStyle}>
  93. <Text style={[ComponentsStyles.font15, {textAlignVertical: 'center'}]}>抄送业务员</Text>
  94. <RadioModal
  95. selectedValue={this.state.is_copy.toString()}
  96. onValueChange={id => this.setState({is_copy: id})}
  97. style={ComponentsStyles.radioStyle}
  98. innerStyle={{
  99. width: 50,
  100. }}
  101. >
  102. <Text value="1">是</Text>
  103. <Text value="0">否</Text>
  104. </RadioModal>
  105. </View>
  106. <List.Item
  107. extra={
  108. <DatePicker
  109. placeholder="日期"
  110. customStyles={styles}
  111. date={this.state.next_time}
  112. mode="date"
  113. confirmBtnText="确定"
  114. cancelBtnText="取消"
  115. showIcon={true}
  116. onDateChange={(datetime) => this.setState({next_time: datetime})}
  117. />
  118. }
  119. >
  120. <Text style={ComponentsStyles.font15}>
  121. 下次回访日期
  122. </Text>
  123. </List.Item>
  124. </View>
  125. </ScrollView>
  126. <Button
  127. type="primary"
  128. disabled={loading}
  129. onPress={() => this.onSave()}
  130. style={ComponentsStyles.button}
  131. >
  132. <Text style={{color: '#fff'}}>提交内部跟踪</Text></Button>
  133. </Provider>
  134. );
  135. }
  136. }
  137. const styles = StyleSheet.create({
  138. dateInput: {
  139. borderWidth: 0,
  140. alignItems: 'flex-end',
  141. },
  142. infoContent: {
  143. marginTop: 5,
  144. backgroundColor: '#fff',
  145. },
  146. infoItem: {
  147. flexDirection: 'row',
  148. paddingVertical: 10,
  149. borderBottomWidth: 1,
  150. borderColor: '#eaeaea',
  151. justifyContent: 'space-between',
  152. },
  153. infoItemLeft: {color: '#000', fontSize: 19},
  154. infoItemRight: {fontSize: 15, paddingTop: 2},
  155. modelItem: {
  156. borderBottomWidth: 1,
  157. borderColor: '#eaeaea',
  158. textAlign: 'center',
  159. paddingVertical: 8,
  160. fontSize: 18,
  161. color: '#000',
  162. },
  163. });
  164. export default WriteInternalReport;