home_navigation.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. import React, {Component} from 'react';
  2. import {View, Image, TouchableOpacity} from 'react-native';
  3. import {createStackNavigator} from '@react-navigation/stack';
  4. import personal_center_page from '../../page/personalCenter/personal_center_page';
  5. import login from '../../page/login/login';
  6. import home_page from '../../page/homePage/home_page';
  7. import StackNavigator from '@react-navigation/stack/src/navigators/createStackNavigator';
  8. import product_add from '../../page/productInfo/product_add';
  9. import product_edit from '../../page/productInfo/product_edit';
  10. import tax_category_codes from '../../page/productInfo/tax_category_codes';
  11. import tax_category_detail from '../../page/productInfo/tax_category_detail';
  12. import login_head from '../../page/login/login_head';
  13. import forget_password from '../../page/login/forget_password';
  14. import invoice_customer_information from '../../page/invoice/invoice_customer_information';
  15. import invoice_product_number from '../../page/invoice/invoice_product_number';
  16. import invoice_product_list from '../../page/invoice/invoice_product_list';
  17. import invoice_product_list_add from '../../page/invoice/invoice_product_list_add';
  18. import invoice_user from '../../page/invoice/invoice_user';
  19. import customer_information from '../../page/customerInformation/customer_information';
  20. import customer_add from '../../page/customerInformation/customer_add';
  21. import customer_edit from '../../page/customerInformation/customer_edit';
  22. import customer_see from '../../page/customerInformation/customer_see';
  23. import product_infos from '../../page/productInfo/product_infos';
  24. import enterprise_list from '../../page/enterpriseInfo/enterpriseList';
  25. import invoice_select_customer from '../../page/invoice/invoice_select_customer';
  26. const HomeStack = createStackNavigator();
  27. export default class home_navigation extends Component {
  28. constructor(props) {
  29. super(props);
  30. this.state = {
  31. language: '',
  32. };
  33. }
  34. render() {
  35. return (
  36. <HomeStack.Navigator initialRouteName="home_page">
  37. <HomeStack.Screen
  38. name="home_page"
  39. component={home_page}
  40. options={{
  41. title: '首页',
  42. headerTitleAlign: 'center',
  43. headerStyle: {
  44. backgroundColor: '#1199EA',
  45. },
  46. headerTintColor: '#fff',
  47. }}
  48. />
  49. <HomeStack.Screen
  50. name="product_infos"
  51. component={product_infos}
  52. options={{
  53. headerTitle: '商品信息',
  54. headerTitleAlign: 'center',
  55. headerStyle: {
  56. backgroundColor: '#1199EA',
  57. },
  58. headerTintColor: '#fff',
  59. headerRight: () => (
  60. <View style={{marginRight: 20}}>
  61. <TouchableOpacity
  62. onPress={() => {
  63. this.props.navigation.navigate('product_add');
  64. }}>
  65. <Image
  66. source={require('../../source/img/productImg/newAddIcon.png')}
  67. style={{height: 16, width: 16}}
  68. />
  69. </TouchableOpacity>
  70. {/*<Text style={{fontSize: 16, color: 'red'}}>新增</Text>*/}
  71. </View>
  72. ),
  73. }}
  74. />
  75. <HomeStack.Screen
  76. name="product_add"
  77. component={product_add}
  78. options={{
  79. title: '新增商品',
  80. headerTintColor: 'white',
  81. headerTitleAlign: 'center',
  82. headerStyle: {
  83. backgroundColor: '#1199EA',
  84. borderBottomWidth: 0,
  85. },
  86. }}
  87. />
  88. <HomeStack.Screen
  89. name="product_edit"
  90. component={product_edit}
  91. options={{
  92. title: '修改商品信息',
  93. headerTintColor: 'white',
  94. headerTitleAlign: 'center',
  95. headerStyle: {
  96. backgroundColor: '#1199EA',
  97. borderBottomWidth: 0,
  98. },
  99. }}
  100. />
  101. <HomeStack.Screen
  102. name="tax_category_codes"
  103. component={tax_category_codes}
  104. options={{
  105. title: '税收分类编码',
  106. headerTintColor: 'white',
  107. headerTitleAlign: 'center',
  108. headerStyle: {
  109. backgroundColor: '#1199EA',
  110. borderBottomWidth: 0,
  111. },
  112. }}
  113. />
  114. <HomeStack.Screen
  115. name="tax_category_detail"
  116. component={tax_category_detail}
  117. options={{
  118. title: '税收分类编码详情',
  119. headerTintColor: 'white',
  120. headerTitleAlign: 'center',
  121. headerStyle: {
  122. backgroundColor: '#1199EA',
  123. borderBottomWidth: 0,
  124. },
  125. }}
  126. />
  127. <HomeStack.Screen
  128. name="login_head"
  129. component={login_head}
  130. options={{
  131. title: '登录',
  132. headerTitleAlign: 'center',
  133. headerStyle: {
  134. backgroundColor: '#1199EA',
  135. },
  136. headerTintColor: '#fff',
  137. }}
  138. />
  139. <HomeStack.Screen
  140. name="forget_password"
  141. component={forget_password}
  142. options={{
  143. title: '密码修改',
  144. headerTitleAlign: 'center',
  145. headerStyle: {
  146. backgroundColor: '#1199EA',
  147. },
  148. headerTintColor: '#fff',
  149. }}
  150. />
  151. {/*开票*/}
  152. <HomeStack.Screen
  153. name={'invoice_customer_information'}
  154. component={invoice_customer_information}
  155. options={{
  156. title: '开票确认',
  157. headerTitleAlign: 'center',
  158. headerStyle: {
  159. backgroundColor: '#1199EA',
  160. },
  161. headerTintColor: '#fff',
  162. }}
  163. />
  164. <HomeStack.Screen
  165. name={'invoice_product_number'}
  166. component={invoice_product_number}
  167. options={{
  168. title: '产品确认',
  169. headerTitleAlign: 'center',
  170. headerStyle: {
  171. backgroundColor: '#1199EA',
  172. },
  173. headerTintColor: '#fff',
  174. }}
  175. />
  176. <HomeStack.Screen
  177. name={'invoice_product_list'}
  178. component={invoice_product_list}
  179. options={{
  180. headerTitle: '产品列表',
  181. headerTitleAlign: 'center',
  182. headerRight: () => (
  183. <View style={{marginRight: 20}}>
  184. <TouchableOpacity
  185. onPress={() => {
  186. this.props.navigation.navigate('invoice_product_list_add');
  187. }}>
  188. <Image
  189. source={require('../../source/img/add.png')}
  190. style={{height: 16, width: 16}}
  191. />
  192. </TouchableOpacity>
  193. </View>
  194. ),
  195. headerStyle: {
  196. backgroundColor: '#1199EA',
  197. },
  198. headerTintColor: '#fff',
  199. }}
  200. />
  201. <HomeStack.Screen
  202. name={'invoice_product_list_add'}
  203. component={invoice_product_list_add}
  204. options={{
  205. title: '添加开票产品',
  206. headerTitleAlign: 'center',
  207. headerStyle: {
  208. backgroundColor: '#1199EA',
  209. },
  210. headerTintColor: '#fff',
  211. }}
  212. />
  213. <HomeStack.Screen
  214. name="invoice_user"
  215. component={invoice_user}
  216. options={{
  217. title: '人员信息编辑',
  218. headerTitleAlign: 'center',
  219. headerStyle: {
  220. backgroundColor: '#1199EA',
  221. },
  222. headerTintColor: '#fff',
  223. }}
  224. />
  225. <HomeStack.Screen
  226. name={'invoice_select_customer'}
  227. component={invoice_select_customer}
  228. options={{
  229. title: '客户信息选择',
  230. headerTitleAlign: 'center',
  231. headerStyle: {
  232. backgroundColor: '#1199EA',
  233. },
  234. headerTintColor: '#fff',
  235. }}
  236. />
  237. {/*客户信息*/}
  238. <HomeStack.Screen
  239. name="customer_information"
  240. component={customer_information}
  241. options={{
  242. headerTitle: '客户信息',
  243. headerTitleAlign: 'center',
  244. headerRight: () => (
  245. <View style={{marginRight: 20}}>
  246. <TouchableOpacity
  247. onPress={() => {
  248. this.props.navigation.navigate('customer_add');
  249. }}>
  250. <Image
  251. source={require('../../source/img/productImg/addIcon.png')}
  252. style={{height: 16, width: 16}}
  253. />
  254. </TouchableOpacity>
  255. </View>
  256. ),
  257. headerStyle: {
  258. backgroundColor: '#1199EA',
  259. },
  260. headerTintColor: '#fff',
  261. }}
  262. />
  263. <HomeStack.Screen
  264. name="customer_add"
  265. component={customer_add}
  266. options={{
  267. title: '新增客户信息',
  268. headerTitleAlign: 'center',
  269. headerStyle: {
  270. backgroundColor: '#1199EA',
  271. },
  272. headerTintColor: '#fff',
  273. }}
  274. />
  275. <HomeStack.Screen
  276. name="customer_edit"
  277. component={customer_edit}
  278. options={{
  279. title: '编辑客户信息',
  280. headerTitleAlign: 'center',
  281. headerStyle: {
  282. backgroundColor: '#1199EA',
  283. },
  284. headerTintColor: '#fff',
  285. }}
  286. />
  287. <HomeStack.Screen
  288. name="customer_see"
  289. component={customer_see}
  290. options={{
  291. title: '客户信息',
  292. headerTitleAlign: 'center',
  293. headerStyle: {
  294. backgroundColor: '#1199EA',
  295. },
  296. headerTintColor: '#fff',
  297. }}
  298. />
  299. <HomeStack.Screen
  300. name="enterprise_list"
  301. component={enterprise_list}
  302. options={{
  303. title: '企业信息',
  304. headerTitleAlign: 'center',
  305. headerStyle: {
  306. backgroundColor: '#1199EA',
  307. },
  308. headerTintColor: '#fff',
  309. }}
  310. />
  311. </HomeStack.Navigator>
  312. );
  313. }
  314. shouldComponentUpdate(
  315. nextProps: Readonly<P>,
  316. nextState: Readonly<S>,
  317. nextContext: any,
  318. ): boolean {
  319. //console.log("state: "+ JSON.stringify(nextProps.route));
  320. if (nextProps.route.name === 'home_navigation') {
  321. if (nextProps.route.state !== null && nextProps.route.state.index === 0) {
  322. this.props.navigation.setOptions({
  323. tabBarVisible: true,
  324. });
  325. }
  326. }
  327. return true;
  328. }
  329. }