WriteInternalReport.js 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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 WriteTrackReport 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. description: '',
  27. is_giveup: 0,
  28. is_entry: 0,
  29. };
  30. };
  31. onSave = () => {
  32. if (!this.state.description) {
  33. Toast.info('请填写回访情况', 1);
  34. return;
  35. }
  36. if (!this.state.next_time) {
  37. Toast.info('请填写下次回访日期', 1);
  38. return;
  39. }
  40. const date = new Date();
  41. const today = FormateDate(date, 'YYYY-MM-DD');
  42. if (this.state.next_time < today) {
  43. Toast.info('下次回访日期不能早于今天', 1);
  44. return;
  45. }
  46. this.props.dispatch({
  47. type: 'customer/addReview',
  48. payload: this.state,
  49. callback: () => {
  50. // 返回,刷新潜客跟踪列表或潜客完善列表
  51. DeviceEventEmitter.emit('refeshReport');
  52. this.props.navigation.goBack();
  53. },
  54. });
  55. };
  56. render() {
  57. const {loading} = this.props.customer;
  58. return (
  59. <Provider>
  60. <StatusBar backgroundColor={'#fff'} barStyle='dark-content'/>
  61. <ScrollView>
  62. <View style={styles.infoContent}>
  63. <List>
  64. <List.Item extra={<Text style={ComponentsStyles.font15}>{this.state.item.name}</Text>}
  65. arrow="empty">
  66. <Text style={ComponentsStyles.font15}>姓名</Text>
  67. </List.Item>
  68. <List.Item extra={<Text style={ComponentsStyles.font15}>{this.state.item.tel}</Text>}
  69. arrow="empty">
  70. <Text style={ComponentsStyles.font15}>电话</Text>
  71. </List.Item>
  72. <List.Item
  73. extra={<Text style={ComponentsStyles.font15}>{this.state.item.project_text}</Text>}
  74. arrow="empty">
  75. <Text style={ComponentsStyles.font15}>项目</Text>
  76. </List.Item>
  77. </List>
  78. <TextInput
  79. style={{
  80. height: 140,
  81. borderColor: '#eee',
  82. textAlignVertical: 'top',
  83. borderBottomWidth: 1,
  84. paddingTop: 10,
  85. paddingHorizontal: 10,
  86. }}
  87. onChangeText={text => this.setState({description: text})}
  88. value={this.state.description}
  89. multiline={true}
  90. numberOfLines={4}
  91. maxLength={1000}
  92. placeholder={'请填写回访情况'}
  93. />
  94. <TextInput
  95. style={{
  96. height: 140,
  97. borderColor: '#eee',
  98. textAlignVertical: 'top',
  99. borderBottomWidth: 1,
  100. paddingTop: 10,
  101. paddingHorizontal: 10,
  102. }}
  103. onChangeText={text => this.setState({instruction: text})}
  104. value={this.state.instruction}
  105. multiline={true}
  106. numberOfLines={4}
  107. maxLength={1000}
  108. placeholder={'支援或放弃'}
  109. />
  110. <View style={ComponentsStyles.genderStyle}>
  111. <Text style={[ComponentsStyles.font15, {textAlignVertical: 'center'}]}>是否进店</Text>
  112. <RadioModal
  113. selectedValue={this.state.is_entry.toString()}
  114. onValueChange={id => this.setState({is_entry: id})}
  115. style={ComponentsStyles.radioStyle}
  116. innerStyle={{
  117. width: 50,
  118. }}
  119. >
  120. <Text value="1">是</Text>
  121. <Text value="0">否</Text>
  122. </RadioModal>
  123. </View>
  124. <View style={ComponentsStyles.genderStyle}>
  125. <Text style={[ComponentsStyles.font15, {textAlignVertical: 'center'}]}>是否放弃</Text>
  126. <RadioModal
  127. selectedValue={this.state.is_giveup.toString()}
  128. onValueChange={id => this.setState({is_giveup: id})}
  129. style={ComponentsStyles.radioStyle}
  130. innerStyle={{
  131. width: 50,
  132. }}
  133. >
  134. <Text value="1">是</Text>
  135. <Text value="0">否</Text>
  136. </RadioModal>
  137. </View>
  138. <List.Item
  139. extra={
  140. <DatePicker
  141. placeholder="日期"
  142. customStyles={styles}
  143. date={this.state.next_time}
  144. mode="date"
  145. confirmBtnText="确定"
  146. cancelBtnText="取消"
  147. showIcon={true}
  148. onDateChange={(datetime) => this.setState({next_time: datetime})}
  149. />
  150. }
  151. >
  152. <Text style={ComponentsStyles.font15}>
  153. 下次回访日期
  154. </Text>
  155. </List.Item>
  156. </View>
  157. </ScrollView>
  158. <Button
  159. type="primary"
  160. disabled={loading}
  161. onPress={() => this.onSave()}
  162. style={ComponentsStyles.button}
  163. >
  164. <Text style={{color: '#fff'}}>提交跟踪报告</Text></Button>
  165. </Provider>
  166. );
  167. }
  168. }
  169. const styles = StyleSheet.create({
  170. dateInput: {
  171. borderWidth: 0,
  172. alignItems: 'flex-end',
  173. },
  174. infoContent: {
  175. marginTop: 5,
  176. backgroundColor: '#fff',
  177. },
  178. infoItem: {
  179. flexDirection: 'row',
  180. paddingVertical: 10,
  181. borderBottomWidth: 1,
  182. borderColor: '#eaeaea',
  183. justifyContent: 'space-between',
  184. },
  185. infoItemLeft: {color: '#000', fontSize: 19},
  186. infoItemRight: {fontSize: 15, paddingTop: 2},
  187. modelItem: {
  188. borderBottomWidth: 1,
  189. borderColor: '#eaeaea',
  190. textAlign: 'center',
  191. paddingVertical: 8,
  192. fontSize: 18,
  193. color: '#000',
  194. },
  195. });
  196. export default WriteTrackReport;