service_handle.js 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389
  1. import React, {Component} from 'react';
  2. import {
  3. View,
  4. Text,
  5. FlatList,
  6. RefreshControl,
  7. Alert,
  8. SafeAreaView,
  9. Image,
  10. ScrollView,
  11. TouchableOpacity,
  12. } from 'react-native';
  13. import {
  14. List,
  15. SearchBar,
  16. Tabs,
  17. WhiteSpace,
  18. Modal,
  19. Radio,
  20. } from '@ant-design/react-native';
  21. import {IndividualStorageData, RetrieveData} from '../../data/storage';
  22. import {RequestNetwork} from '../../data/encryption';
  23. import public_css from '../../source/css/public_css';
  24. import {CleanAll} from '../../components/abnormalMessage/abnormal_message';
  25. import {ToastShow} from '../../components/toast/toast';
  26. import personal_center_css from '../personalCenter/personal_center_css';
  27. import {SvgXml} from 'react-native-svg';
  28. import {downArrowIcon, upArrowIcon} from '../../source/icon/icon';
  29. const Item = List.Item;
  30. let pageNo = 1; //当前页码
  31. let totalPage = 5; //总的页数
  32. let pageSize = 10; //每页数量
  33. export default class service_handle extends Component {
  34. constructor(props) {
  35. super(props);
  36. this.props.navigation.dangerouslyGetParent().setOptions({
  37. tabBarVisible: false,
  38. });
  39. this.state = {
  40. userName: '',
  41. spinner: false,
  42. user: '',
  43. headImage: '',
  44. sex: '',
  45. messageList: [],
  46. showFoot: 0, // 控制foot, 0:无数据 1:加载中 2 :上拉加载
  47. isLoading: false,
  48. amount: 0,
  49. discount: 0,
  50. tab: 0,
  51. messageNumber: 0,
  52. isShowPay: false,
  53. paySelect: {},
  54. hideStatusText: '更多',
  55. hideStatus: false,
  56. productList: [],
  57. productNumber: 0,
  58. flexStyle: 'column',
  59. itemList: [],
  60. productDiscount: 0,
  61. productAmount: 0,
  62. };
  63. }
  64. render() {
  65. const tabs = [{title: '服务办理'}, {title: '短信续费'}];
  66. return (
  67. <SafeAreaView style={public_css.body}>
  68. <View
  69. style={{
  70. height: 130,
  71. backgroundColor: '#2A2C44',
  72. flexDirection: 'row',
  73. }}>
  74. <View style={{width: 90}}>
  75. <View
  76. style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}>
  77. {this.state.headImage === '' || this.state.headImage === null ? (
  78. this.state.sex === 'F' ? (
  79. <Image
  80. source={require('../../source/img/personal/woman.png')}
  81. style={[personal_center_css.headImg]}
  82. />
  83. ) : (
  84. <Image
  85. source={require('../../source/img/personal/man.png')}
  86. style={[personal_center_css.headImg]}
  87. />
  88. )
  89. ) : (
  90. <Image
  91. source={{uri: this.state.headImage}}
  92. style={[personal_center_css.headImg]}
  93. />
  94. )}
  95. </View>
  96. <View style={{height: 25, alignItems: 'center'}}>
  97. <Text
  98. style={{
  99. color: '#FFFFFF',
  100. fontSize: 13,
  101. fontWeight: 'bold',
  102. }}
  103. numberOfLines={1}
  104. ellipsizeMode={'tail'}>
  105. {this.state.userName}
  106. </Text>
  107. </View>
  108. </View>
  109. <View style={{flex: 1, justifyContent: 'center'}}>
  110. <View
  111. style={{
  112. height: 40,
  113. flexDirection: 'row',
  114. justifyContent: 'flex-start',
  115. alignItems: 'flex-end',
  116. }}>
  117. <Text
  118. style={{color: '#FFFFFF', fontSize: 13, marginLeft: 10}}
  119. numberOfLines={1}
  120. ellipsizeMode={'tail'}>
  121. 续费企业:{this.state.companyName}
  122. </Text>
  123. </View>
  124. <View style={{flexDirection: 'row', flex: 1}}>
  125. <View style={{flex: 1}}>
  126. <Text
  127. style={{
  128. color: '#FFFFFF',
  129. fontSize: 13,
  130. marginLeft: 10,
  131. marginTop: 10,
  132. }}>
  133. 服务购买时间:--------
  134. </Text>
  135. <Text
  136. style={{
  137. color: '#FFFFFF',
  138. fontSize: 13,
  139. marginLeft: 10,
  140. marginTop: 10,
  141. }}>
  142. 服务到期剩余:--------
  143. </Text>
  144. </View>
  145. <View style={{alignItems: 'center', width: 120, marginTop: 10}}>
  146. <Text style={{color: '#FFFFFF', fontSize: 20}}>
  147. --/{this.state.messageNumber}
  148. </Text>
  149. <Text style={{color: '#FFFFFF', fontSize: 13, marginTop: 5}}>
  150. 年度短信发送量
  151. </Text>
  152. </View>
  153. </View>
  154. </View>
  155. </View>
  156. <Tabs
  157. tabs={tabs}
  158. onChange={(i, l) => this.onChanges(i, l)}
  159. page={0}
  160. tabBarUnderlineStyle={{backgroundColor: '#ECC385'}}
  161. tabBarActiveTextColor={'#EABC78'}
  162. tabBarInactiveTextColor={'#646464'}
  163. tabBarTextStyle={{fontSize: 16}}>
  164. <ScrollView>
  165. <View
  166. style={{flexDirection: this.state.flexStyle, flexWrap: 'wrap'}}>
  167. {this.state.productList.map((item, index) => {
  168. if (this.state.hideStatus) {
  169. if (this.state.productNumber > 1) {
  170. if (item.isSelect) {
  171. return (
  172. <TouchableOpacity onPress={() => this.selectData(item)}>
  173. <View
  174. style={{
  175. backgroundColor: 'rgba(236, 195, 133, 0.13)',
  176. height: 120,
  177. width: 100,
  178. borderWidth: 1,
  179. borderColor: '#DDDDDD',
  180. borderRadius: 6,
  181. margin: 10,
  182. justifyContent: 'center',
  183. alignItems: 'center',
  184. }}>
  185. <Text
  186. style={{
  187. color: '#2B2B2B',
  188. fontSize: 16,
  189. }}>
  190. {item.productName}
  191. </Text>
  192. {/*<Text*/}
  193. {/* style={{*/}
  194. {/* color: '#2B2B2B',*/}
  195. {/* fontSize: 16,*/}
  196. {/* }}>*/}
  197. {/* {item.tags}*/}
  198. {/*</Text>*/}
  199. <Text
  200. style={{
  201. color: '#ECC385',
  202. fontWeight: 'bold',
  203. fontSize: 25,
  204. }}>
  205. <Text style={{fontSize: 16}}>¥</Text>
  206. {item.favouredPrice}
  207. </Text>
  208. <Text
  209. style={{
  210. color: '#AAAAAA',
  211. textDecorationLine: 'line-through',
  212. }}>
  213. ¥{item.oriPrice}
  214. </Text>
  215. </View>
  216. </TouchableOpacity>
  217. );
  218. } else {
  219. return (
  220. <TouchableOpacity onPress={() => this.selectData(item)}>
  221. <View
  222. style={{
  223. backgroundColor: 'rgba(255, 255, 255, 1)',
  224. height: 120,
  225. width: 100,
  226. borderWidth: 1,
  227. borderColor: '#DDDDDD',
  228. borderRadius: 6,
  229. margin: 10,
  230. justifyContent: 'center',
  231. alignItems: 'center',
  232. }}>
  233. <Text
  234. style={{
  235. color: '#2B2B2B',
  236. fontSize: 16,
  237. }}>
  238. {item.productName}
  239. </Text>
  240. {/*<Text*/}
  241. {/* style={{*/}
  242. {/* color: '#2B2B2B',*/}
  243. {/* fontSize: 16,*/}
  244. {/* }}>*/}
  245. {/* {item.tags}*/}
  246. {/*</Text>*/}
  247. <Text
  248. style={{
  249. color: '#ECC385',
  250. fontWeight: 'bold',
  251. fontSize: 25,
  252. }}>
  253. <Text style={{fontSize: 16}}>¥</Text>
  254. {item.favouredPrice}
  255. </Text>
  256. <Text
  257. style={{
  258. color: '#AAAAAA',
  259. textDecorationLine: 'line-through',
  260. }}>
  261. ¥{item.oriPrice}
  262. </Text>
  263. </View>
  264. </TouchableOpacity>
  265. );
  266. }
  267. } else {
  268. if (item.isSelect) {
  269. return (
  270. <TouchableOpacity
  271. onPress={() => this.selectData(item)}
  272. style={{
  273. backgroundColor: 'rgba(236, 195, 133, 0.13)',
  274. flexDirection: 'row',
  275. height: 80,
  276. borderWidth: 1,
  277. borderColor: '#DDDDDD',
  278. borderRadius: 6,
  279. margin: 10,
  280. }}>
  281. <View style={{flex: 1, flexDirection: 'column'}}>
  282. <View style={{flex: 1}}>
  283. <Text
  284. style={{
  285. color: '#2B2B2B',
  286. fontWeight: 'bold',
  287. fontSize: 18,
  288. marginTop: 10,
  289. marginLeft: 10,
  290. }}>
  291. {item.productName}
  292. </Text>
  293. </View>
  294. <View style={{flex: 1}}>
  295. {/*<Text*/}
  296. {/* style={{*/}
  297. {/* color: '#777777',*/}
  298. {/* fontSize: 16,*/}
  299. {/* marginTop: 10,*/}
  300. {/* marginLeft: 10,*/}
  301. {/* }}>*/}
  302. {/* {item.tags}*/}
  303. {/*</Text>*/}
  304. </View>
  305. </View>
  306. <View
  307. style={{
  308. width: 120,
  309. justifyContent: 'center',
  310. alignItems: 'center',
  311. }}>
  312. <Text
  313. style={{
  314. color: '#ECC385',
  315. fontWeight: 'bold',
  316. fontSize: 25,
  317. }}>
  318. <Text style={{fontSize: 16}}>¥</Text>
  319. {item.favouredPrice}
  320. </Text>
  321. <Text
  322. style={{
  323. color: '#AAAAAA',
  324. textDecorationLine: 'line-through',
  325. }}>
  326. ¥{item.oriPrice}
  327. </Text>
  328. </View>
  329. </TouchableOpacity>
  330. );
  331. } else {
  332. return (
  333. <TouchableOpacity
  334. onPress={() => this.selectData(item)}
  335. style={{
  336. backgroundColor: 'rgba(255, 255, 255, 1)',
  337. flexDirection: 'row',
  338. height: 80,
  339. borderWidth: 1,
  340. borderColor: '#DDDDDD',
  341. borderRadius: 6,
  342. margin: 10,
  343. }}>
  344. <View style={{flex: 1, flexDirection: 'column'}}>
  345. <View style={{flex: 1}}>
  346. <Text
  347. style={{
  348. color: '#2B2B2B',
  349. fontWeight: 'bold',
  350. fontSize: 18,
  351. marginTop: 10,
  352. marginLeft: 10,
  353. }}>
  354. {item.productName}
  355. </Text>
  356. </View>
  357. <View style={{flex: 1}}>
  358. {/*<Text*/}
  359. {/* style={{*/}
  360. {/* color: '#777777',*/}
  361. {/* fontSize: 16,*/}
  362. {/* marginTop: 10,*/}
  363. {/* marginLeft: 10,*/}
  364. {/* }}>*/}
  365. {/* {item.tags}*/}
  366. {/*</Text>*/}
  367. </View>
  368. </View>
  369. <View
  370. style={{
  371. width: 120,
  372. justifyContent: 'center',
  373. alignItems: 'center',
  374. }}>
  375. <Text
  376. style={{
  377. color: '#ECC385',
  378. fontWeight: 'bold',
  379. fontSize: 25,
  380. }}>
  381. <Text style={{fontSize: 16}}>¥</Text>
  382. {item.favouredPrice}
  383. </Text>
  384. <Text
  385. style={{
  386. color: '#AAAAAA',
  387. textDecorationLine: 'line-through',
  388. }}>
  389. ¥{item.oriPrice}
  390. </Text>
  391. </View>
  392. </TouchableOpacity>
  393. );
  394. }
  395. }
  396. } else {
  397. if (index === 0) {
  398. if (item.isSelect) {
  399. return (
  400. <TouchableOpacity
  401. onPress={() => this.selectData(item)}
  402. style={{
  403. backgroundColor: 'rgba(236, 195, 133, 0.13)',
  404. flexDirection: 'row',
  405. height: 80,
  406. borderWidth: 1,
  407. borderColor: '#DDDDDD',
  408. borderRadius: 6,
  409. margin: 10,
  410. }}>
  411. <View style={{flex: 1, flexDirection: 'column'}}>
  412. <View style={{flex: 1}}>
  413. <Text
  414. style={{
  415. color: '#2B2B2B',
  416. fontWeight: 'bold',
  417. fontSize: 18,
  418. marginTop: 10,
  419. marginLeft: 10,
  420. }}>
  421. {item.productName}
  422. </Text>
  423. </View>
  424. <View style={{flex: 1}}>
  425. {/*<Text*/}
  426. {/* style={{*/}
  427. {/* color: '#777777',*/}
  428. {/* fontSize: 16,*/}
  429. {/* marginTop: 10,*/}
  430. {/* marginLeft: 10,*/}
  431. {/* }}>*/}
  432. {/* {item.tags}*/}
  433. {/*</Text>*/}
  434. </View>
  435. </View>
  436. <View
  437. style={{
  438. width: 120,
  439. justifyContent: 'center',
  440. alignItems: 'center',
  441. }}>
  442. <Text
  443. style={{
  444. color: '#ECC385',
  445. fontWeight: 'bold',
  446. fontSize: 25,
  447. }}>
  448. <Text style={{fontSize: 16}}>¥</Text>
  449. {item.favouredPrice}
  450. </Text>
  451. <Text
  452. style={{
  453. color: '#AAAAAA',
  454. textDecorationLine: 'line-through',
  455. }}>
  456. ¥{item.oriPrice}
  457. </Text>
  458. </View>
  459. </TouchableOpacity>
  460. );
  461. } else {
  462. return (
  463. <TouchableOpacity
  464. onPress={() => this.selectData(item)}
  465. style={{
  466. backgroundColor: 'rgba(255, 255, 255, 1)',
  467. flexDirection: 'row',
  468. height: 80,
  469. borderWidth: 1,
  470. borderColor: '#DDDDDD',
  471. borderRadius: 6,
  472. margin: 10,
  473. }}>
  474. <View style={{flex: 1, flexDirection: 'column'}}>
  475. <View style={{flex: 1}}>
  476. <Text
  477. style={{
  478. color: '#2B2B2B',
  479. fontWeight: 'bold',
  480. fontSize: 18,
  481. marginTop: 10,
  482. marginLeft: 10,
  483. }}>
  484. {item.productName}
  485. </Text>
  486. </View>
  487. <View style={{flex: 1}}>
  488. {/*<Text*/}
  489. {/* style={{*/}
  490. {/* color: '#777777',*/}
  491. {/* fontSize: 16,*/}
  492. {/* marginTop: 10,*/}
  493. {/* marginLeft: 10,*/}
  494. {/* }}>*/}
  495. {/* {item.tags}*/}
  496. {/*</Text>*/}
  497. </View>
  498. </View>
  499. <View
  500. style={{
  501. width: 120,
  502. justifyContent: 'center',
  503. alignItems: 'center',
  504. }}>
  505. <Text
  506. style={{
  507. color: '#ECC385',
  508. fontWeight: 'bold',
  509. fontSize: 25,
  510. }}>
  511. <Text style={{fontSize: 16}}>¥</Text>
  512. {item.favouredPrice}
  513. </Text>
  514. <Text
  515. style={{
  516. color: '#AAAAAA',
  517. textDecorationLine: 'line-through',
  518. }}>
  519. ¥{item.oriPrice}
  520. </Text>
  521. </View>
  522. </TouchableOpacity>
  523. );
  524. }
  525. }
  526. }
  527. })}
  528. </View>
  529. <View style={[public_css.view, {justifyContent: 'center'}]}>
  530. <TouchableOpacity
  531. style={{
  532. width: 120,
  533. height: 30,
  534. backgroundColor: '#F8F8F8',
  535. opacity: 1,
  536. borderRadius: 99,
  537. flexDirection: 'row',
  538. justifyContent: 'center',
  539. alignItems: 'center',
  540. }}
  541. onPress={() => this.hideChange()}>
  542. {this.state.hideStatus === false ? (
  543. <View style={{flexDirection: 'row', alignItems: 'center'}}>
  544. <Text style={{color: '#B6B6BA', fontSize: 16}}>
  545. {this.state.hideStatusText}
  546. </Text>
  547. <SvgXml style={{marginLeft: 5}} xml={downArrowIcon()} />
  548. </View>
  549. ) : (
  550. <View style={{flexDirection: 'row', alignItems: 'center'}}>
  551. <Text style={{color: '#B6B6BA', fontSize: 16}}>
  552. {this.state.hideStatusText}
  553. </Text>
  554. <SvgXml style={{marginLeft: 5}} xml={upArrowIcon()} />
  555. </View>
  556. )}
  557. </TouchableOpacity>
  558. </View>
  559. <View style={{backgroundColor: '#F7F7F7', height: 10}} />
  560. <View style={{backgroundColor: '#ffffff'}}>
  561. <Text
  562. style={{
  563. color: '#2C2C2C',
  564. marginLeft: 10,
  565. marginTop: 10,
  566. fontWeight: 'bold',
  567. fontSize: 16,
  568. }}>
  569. 套餐特权
  570. </Text>
  571. <View style={{flexDirection: 'row', flexWrap: 'wrap'}}>
  572. {this.state.itemList.map((item) => {
  573. return (
  574. <View
  575. style={{
  576. alignItems: 'center',
  577. marginLeft: 10,
  578. marginTop: 10,
  579. justifyContent: 'center',
  580. }}>
  581. <Image
  582. source={{uri: item.featureImgUrl}}
  583. style={{height: 44, width: 44}}
  584. />
  585. <Text style={{width: 70, textAlign: 'center'}}>
  586. {item.featureName}
  587. </Text>
  588. </View>
  589. );
  590. })}
  591. </View>
  592. </View>
  593. <View style={{backgroundColor: '#F7F7F7', height: 10}} />
  594. <List style={{}}>
  595. <Item
  596. arrow="horizontal"
  597. onPress={() => {
  598. this.props.navigation.navigate('agreement');
  599. }}>
  600. <View style={{flexDirection: 'row', alignItems: 'center'}}>
  601. <Text style={{marginLeft: 5, color: '#000000'}}>
  602. 会员服务协议
  603. </Text>
  604. </View>
  605. </Item>
  606. <Item
  607. arrow="horizontal"
  608. onPress={() => {
  609. this.props.navigation.navigate('problem');
  610. }}>
  611. <View style={{flexDirection: 'row', alignItems: 'center'}}>
  612. <Text style={{marginLeft: 5, color: '#000000'}}>
  613. 常见问题
  614. </Text>
  615. </View>
  616. </Item>
  617. </List>
  618. <TouchableOpacity
  619. onPress={() => {
  620. // this.setState({
  621. // isShowPay: true,
  622. // });
  623. Alert.alert(
  624. '提示',
  625. '云票在线App暂未开放,请到网页版进行支付!',
  626. [
  627. {
  628. text: '确定',
  629. // onPress: () => {
  630. // this.props.navigation.goBack();
  631. // },
  632. },
  633. ],
  634. {cancelable: false},
  635. );
  636. }}
  637. style={{
  638. height: 40,
  639. backgroundColor: '#2A2C44',
  640. alignItems: 'center',
  641. justifyContent: 'center',
  642. marginLeft: 10,
  643. marginRight: 10,
  644. borderRadius: 500,
  645. flexDirection: 'row',
  646. }}>
  647. <Text
  648. style={{color: '#ECC385', fontWeight: 'bold', fontSize: 16}}>
  649. 立即支付{this.state.productDiscount}元
  650. </Text>
  651. <Text
  652. style={{
  653. color: '#ECC385',
  654. fontSize: 13,
  655. textDecorationLine: 'line-through',
  656. marginLeft: 5,
  657. }}>
  658. ¥{this.state.productAmount}
  659. </Text>
  660. </TouchableOpacity>
  661. <WhiteSpace />
  662. </ScrollView>
  663. <View style={{flex: 1, backgroundColor: '#ffffff'}}>
  664. <View style={{flex: 1}}>
  665. <FlatList
  666. style={{flexGrow: 0}}
  667. data={this.state.messageList}
  668. renderItem={(item) => this.renderItem(item)}
  669. // onRefresh={this.initData()}
  670. // refreshing={this.state.isLoading}
  671. // refreshControl={
  672. // <RefreshControl
  673. // title={'加载中...'}
  674. // colors={['#B7B7B7']} //此颜色无效
  675. // tintColor={'#B7B7B7'}
  676. // titleColor={'#B7B7B7'} //只有ios有效
  677. // refreshing={this.state.isLoading}
  678. // onRefresh={() => {
  679. // this.initData();
  680. // }}
  681. // />
  682. // }
  683. // onEndReached={() => this.onEndReached()}
  684. // onEndReachedThreshold={0.1}
  685. />
  686. <View style={{backgroundColor: '#F7F7F7', height: 10}} />
  687. <View style={{backgroundColor: '#ffffff'}}>
  688. <Text
  689. style={{
  690. color: '#2C2C2C',
  691. marginLeft: 10,
  692. marginTop: 10,
  693. fontWeight: 'bold',
  694. fontSize: 16,
  695. }}>
  696. 套餐说明
  697. </Text>
  698. <Text style={{color: '#AAAAAA', margin: 10}}>
  699. 该产品为配合云票在线发票短信使用,即当您开票后选择接收方式为短信时,我们将以短信的形式给您发送该发票的链接。
  700. </Text>
  701. </View>
  702. <View style={{backgroundColor: '#F7F7F7', height: 10}} />
  703. <List style={{}}>
  704. <Item
  705. arrow="horizontal"
  706. onPress={() => {
  707. this.props.navigation.navigate('agreement');
  708. }}>
  709. <View style={{flexDirection: 'row', alignItems: 'center'}}>
  710. <Text style={{marginLeft: 5, color: '#000000'}}>
  711. 会员服务协议
  712. </Text>
  713. </View>
  714. </Item>
  715. <Item
  716. arrow="horizontal"
  717. onPress={() => {
  718. this.props.navigation.navigate('problem');
  719. }}>
  720. <View style={{flexDirection: 'row', alignItems: 'center'}}>
  721. <Text style={{marginLeft: 5, color: '#000000'}}>
  722. 常见问题
  723. </Text>
  724. </View>
  725. </Item>
  726. </List>
  727. </View>
  728. <TouchableOpacity
  729. onPress={() => {
  730. // this.setState({
  731. // isShowPay: true,
  732. // });
  733. Alert.alert(
  734. '提示',
  735. '云票在线App暂未开放,请到网页版进行支付!',
  736. [
  737. {
  738. text: '确定',
  739. // onPress: () => {
  740. // this.props.navigation.goBack();
  741. // },
  742. },
  743. ],
  744. {cancelable: false},
  745. );
  746. }}
  747. style={{
  748. height: 40,
  749. backgroundColor: '#2A2C44',
  750. alignItems: 'center',
  751. justifyContent: 'center',
  752. marginLeft: 10,
  753. marginRight: 10,
  754. borderRadius: 500,
  755. }}>
  756. <Text
  757. style={{color: '#ECC385', fontWeight: 'bold', fontSize: 16}}>
  758. 立即支付{this.state.discount}元
  759. <Text
  760. style={{
  761. fontSize: 13,
  762. textDecorationLine: 'line-through',
  763. }}>
  764. ¥{this.state.amount}
  765. </Text>
  766. </Text>
  767. </TouchableOpacity>
  768. <WhiteSpace />
  769. </View>
  770. </Tabs>
  771. <Modal
  772. popup
  773. maskClosable
  774. visible={this.state.isShowPay}
  775. animationType="slide-up"
  776. onClose={this.showModal}>
  777. <View
  778. style={{
  779. paddingVertical: 20,
  780. paddingHorizontal: 20,
  781. backgroundColor: '#ffffff',
  782. }}>
  783. <View
  784. style={{
  785. flex: 1,
  786. backgroundColor: 'rgba(236, 195, 133, 0.13)',
  787. flexDirection: 'row',
  788. height: 80,
  789. borderWidth: 1,
  790. borderColor: '#DDDDDD',
  791. borderRadius: 6,
  792. }}>
  793. <View style={{flex: 1}}>
  794. <Text
  795. style={{
  796. color: '#2B2B2B',
  797. fontWeight: 'bold',
  798. fontSize: 18,
  799. marginTop: 10,
  800. marginLeft: 10,
  801. }}>
  802. {this.state.paySelect.title}
  803. </Text>
  804. <Text
  805. style={{
  806. color: '#777777',
  807. fontSize: 16,
  808. marginTop: 10,
  809. marginLeft: 10,
  810. }}>
  811. {this.state.paySelect.desc}
  812. </Text>
  813. </View>
  814. <View
  815. style={{
  816. width: 120,
  817. justifyContent: 'center',
  818. alignItems: 'center',
  819. }}>
  820. <Text
  821. style={{color: '#ECC385', fontWeight: 'bold', fontSize: 25}}>
  822. <Text style={{fontSize: 16}}>¥</Text>
  823. {this.state.paySelect.discount}
  824. </Text>
  825. <Text
  826. style={{
  827. color: '#AAAAAA',
  828. textDecorationLine: 'line-through',
  829. }}>
  830. ¥{this.state.paySelect.amount}
  831. </Text>
  832. </View>
  833. </View>
  834. <Radio
  835. checked={true}
  836. onChange={(event) => {
  837. if (event.target.checked) {
  838. console.log(123);
  839. }
  840. }}
  841. style={{
  842. borderWidth: 1,
  843. borderColor: '#999',
  844. margin: 10,
  845. backgroundColor: 'red',
  846. }}
  847. />
  848. <Radio
  849. checked={false}
  850. onChange={(event) => {
  851. if (event.target.checked) {
  852. this.setState({part1Value: 1});
  853. }
  854. }}
  855. style={{borderWidth: 1, borderColor: '#999', margin: 10}}>
  856. Support
  857. </Radio>
  858. <View
  859. style={{
  860. backgroundColor: '#ffffff',
  861. height: 60,
  862. justifyContent: 'center',
  863. }}>
  864. <TouchableOpacity
  865. onPress={() => {
  866. this.setState({
  867. isShowPay: true,
  868. });
  869. }}
  870. style={{
  871. height: 40,
  872. backgroundColor: '#2A2C44',
  873. alignItems: 'center',
  874. justifyContent: 'center',
  875. marginLeft: 10,
  876. marginRight: 10,
  877. borderRadius: 500,
  878. }}>
  879. <Text
  880. style={{color: '#ECC385', fontWeight: 'bold', fontSize: 16}}>
  881. 立即支付{this.state.discount}元
  882. <Text
  883. style={{
  884. fontSize: 13,
  885. textDecorationLine: 'line-through',
  886. }}>
  887. ¥{this.state.amount}
  888. </Text>
  889. </Text>
  890. </TouchableOpacity>
  891. </View>
  892. </View>
  893. {/*<Button type="primary" onPress={this.onClose2}>*/}
  894. {/* close modal*/}
  895. {/*</Button>*/}
  896. </Modal>
  897. </SafeAreaView>
  898. );
  899. }
  900. //页面渲染完成后加载
  901. async componentDidMount(): void {
  902. pageNo = 1;
  903. this.setState({
  904. messageList: [],
  905. showFoot: 1,
  906. });
  907. this.getSignIn();
  908. await this.getProductList();
  909. await this.getMessageList();
  910. await this.getMessageNumber();
  911. }
  912. //tab变化事件
  913. onChanges = (i, l) => {
  914. if (this.state.tab !== l) {
  915. this.setState({
  916. tab: l,
  917. });
  918. this.initData();
  919. }
  920. };
  921. //获取登录信息
  922. getSignIn = async () => {
  923. let userHeadImg = JSON.parse(await RetrieveData('userHeadImg'));
  924. let userName = await RetrieveData('userName');
  925. let company = await RetrieveData('company');
  926. if (company) {
  927. company = JSON.parse(company);
  928. }
  929. if (userName && company) {
  930. this.setState({
  931. userName: userName,
  932. companyName: company.entName,
  933. });
  934. }
  935. if (userHeadImg) {
  936. this.setState({
  937. headImage: userHeadImg.headImage,
  938. sex: userHeadImg.sex,
  939. });
  940. } else {
  941. this.setState({
  942. headImage: '',
  943. sex: '',
  944. });
  945. }
  946. };
  947. //初始化数据
  948. initData = async () => {
  949. pageNo = 1;
  950. this.setState({
  951. messageList: [],
  952. showFoot: 1,
  953. isLoading: true,
  954. hideStatusText: '更多',
  955. hideStatus: false,
  956. flexStyle: 'column',
  957. });
  958. await this.getMessageList();
  959. await this.getProductList();
  960. };
  961. //获取短信产品列表
  962. getMessageList = async () => {
  963. let token = await RetrieveData('token');
  964. if (token) {
  965. const url = '/marketing/feature/product/findPage';
  966. let res = await RequestNetwork(
  967. url,
  968. token,
  969. {
  970. featureId: 'F0000001',
  971. featureName: '短信服务',
  972. enable: true,
  973. pageNum: pageNo,
  974. pageSize: pageSize,
  975. },
  976. false,
  977. 2,
  978. );
  979. if (res) {
  980. if (res.code === 0) {
  981. totalPage = res.data.pages;
  982. this.setList(res.data.records);
  983. } else {
  984. this.setState({
  985. showFoot: 0,
  986. });
  987. await this.abnormalMessage(res);
  988. }
  989. }
  990. }
  991. };
  992. //获取短信数量
  993. getMessageNumber = async () => {
  994. let company = JSON.parse(await RetrieveData('company'));
  995. let token = await RetrieveData('token');
  996. if (token && company) {
  997. const url = '/marketing/ent/features/findPage';
  998. let res = await RequestNetwork(
  999. url,
  1000. token,
  1001. {
  1002. entTaxId: company.entTaxId,
  1003. featureId: 'F0000001',
  1004. featureName: '短信服务',
  1005. pageNum: 1,
  1006. pageSize: 10,
  1007. },
  1008. false,
  1009. 2,
  1010. );
  1011. if (res) {
  1012. if (res.code === 0) {
  1013. console.log(res);
  1014. res.data.records.map((item) => {
  1015. if (item.featureId === 'F0000001') {
  1016. this.messageNumber = parseFloat(item.surplus);
  1017. }
  1018. });
  1019. } else {
  1020. await this.abnormalMessage(res);
  1021. }
  1022. }
  1023. }
  1024. };
  1025. //加载产品列表
  1026. setList = (data) => {
  1027. let listData = {};
  1028. let list = [];
  1029. data.map((_, i) => {
  1030. if (i === 0) {
  1031. listData = {
  1032. key: data[i].productId,
  1033. title: data[i].productName,
  1034. tags: data[i].tags,
  1035. desc: data[i].productDesc,
  1036. amount: data[i].oriPrice,
  1037. discount: data[i].favouredPrice,
  1038. isSelect: true,
  1039. };
  1040. this.setState({
  1041. paySelect: listData,
  1042. amount: listData.amount,
  1043. discount: listData.discount,
  1044. });
  1045. } else {
  1046. listData = {
  1047. key: data[i].productId,
  1048. title: data[i].productName,
  1049. tags: data[i].tags,
  1050. desc: data[i].productDesc,
  1051. amount: data[i].oriPrice,
  1052. discount: data[i].favouredPrice,
  1053. isSelect: false,
  1054. };
  1055. }
  1056. list = list.concat(listData);
  1057. });
  1058. if (list.length > 0) {
  1059. this.setState({
  1060. showFoot: 2,
  1061. isLoading: false,
  1062. messageList: list,
  1063. });
  1064. } else {
  1065. this.setState({
  1066. showFoot: 0,
  1067. isLoading: false,
  1068. messageList: list,
  1069. });
  1070. }
  1071. };
  1072. //显示短信列表
  1073. renderItem = (data) => (
  1074. <List.Item
  1075. onPress={() => {
  1076. this.messageChange(data);
  1077. }}
  1078. style={{display: 'flex', backgroundColor: '#ffffff'}}>
  1079. {data.item.isSelect === true ? (
  1080. <View
  1081. style={{
  1082. flex: 1,
  1083. backgroundColor: 'rgba(236, 195, 133, 0.13)',
  1084. flexDirection: 'row',
  1085. height: 80,
  1086. borderWidth: 1,
  1087. borderColor: '#DDDDDD',
  1088. borderRadius: 6,
  1089. }}>
  1090. <View style={{flex: 1, flexDirection: 'column'}}>
  1091. <View style={{flex: 1}}>
  1092. <Text
  1093. style={{
  1094. color: '#2B2B2B',
  1095. fontWeight: 'bold',
  1096. fontSize: 18,
  1097. marginTop: 10,
  1098. marginLeft: 10,
  1099. }}>
  1100. {data.item.title}
  1101. </Text>
  1102. </View>
  1103. <View style={{flex: 1}}>
  1104. <Text
  1105. style={{
  1106. color: '#777777',
  1107. fontSize: 16,
  1108. marginTop: 10,
  1109. marginLeft: 10,
  1110. }}>
  1111. {data.item.desc}
  1112. </Text>
  1113. </View>
  1114. </View>
  1115. <View
  1116. style={{
  1117. width: 120,
  1118. justifyContent: 'center',
  1119. alignItems: 'center',
  1120. }}>
  1121. <Text style={{color: '#ECC385', fontWeight: 'bold', fontSize: 25}}>
  1122. <Text style={{fontSize: 16}}>¥</Text>
  1123. {data.item.discount}
  1124. </Text>
  1125. <Text
  1126. style={{color: '#AAAAAA', textDecorationLine: 'line-through'}}>
  1127. ¥{data.item.amount}
  1128. </Text>
  1129. </View>
  1130. </View>
  1131. ) : (
  1132. <View
  1133. style={{
  1134. flex: 1,
  1135. backgroundColor: '#ffffff',
  1136. flexDirection: 'row',
  1137. height: 80,
  1138. borderWidth: 1,
  1139. borderColor: '#DDDDDD',
  1140. borderRadius: 6,
  1141. }}>
  1142. <View style={{flex: 1}}>
  1143. <Text
  1144. style={{
  1145. color: '#2B2B2B',
  1146. fontWeight: 'bold',
  1147. fontSize: 18,
  1148. marginTop: 10,
  1149. marginLeft: 10,
  1150. }}>
  1151. {data.item.title}
  1152. </Text>
  1153. <Text
  1154. style={{
  1155. color: '#777777',
  1156. fontSize: 16,
  1157. marginTop: 10,
  1158. marginLeft: 10,
  1159. }}>
  1160. {data.item.desc}
  1161. </Text>
  1162. </View>
  1163. <View
  1164. style={{
  1165. width: 120,
  1166. justifyContent: 'center',
  1167. alignItems: 'center',
  1168. }}>
  1169. <Text style={{color: '#ECC385', fontWeight: 'bold', fontSize: 25}}>
  1170. <Text style={{fontSize: 16}}>¥</Text>
  1171. {data.item.discount}
  1172. </Text>
  1173. <Text
  1174. style={{color: '#AAAAAA', textDecorationLine: 'line-through'}}>
  1175. ¥{data.item.amount}
  1176. </Text>
  1177. </View>
  1178. </View>
  1179. )}
  1180. </List.Item>
  1181. );
  1182. // 处理短信选择
  1183. messageChange = (data) => {
  1184. this.state.messageList.map((item) => {
  1185. if (item.key === data.item.key) {
  1186. item.isSelect = true;
  1187. } else {
  1188. item.isSelect = false;
  1189. }
  1190. });
  1191. this.setState({
  1192. paySelect: data.item,
  1193. amount: data.item.amount,
  1194. discount: data.item.discount,
  1195. });
  1196. };
  1197. //列表上拉加载
  1198. onEndReached = async () => {
  1199. if (this.state.showFoot === 2) {
  1200. if (pageNo >= totalPage) {
  1201. this.setState({showFoot: 0});
  1202. return;
  1203. } else {
  1204. pageNo++;
  1205. this.setState({showFoot: 1});
  1206. await this.getMessageList();
  1207. }
  1208. }
  1209. };
  1210. // 支付弹出层点击阴影关闭
  1211. showModal = () => {
  1212. this.setState({
  1213. isShowPay: false,
  1214. });
  1215. };
  1216. // 字段隐藏切换
  1217. hideChange = () => {
  1218. this.setState({
  1219. hideStatus: !this.state.hideStatus,
  1220. hideStatusText: '收起',
  1221. });
  1222. if (this.state.hideStatus) {
  1223. this.setState({
  1224. flexStyle: 'column',
  1225. });
  1226. } else {
  1227. this.setState({
  1228. flexStyle: 'row',
  1229. });
  1230. }
  1231. };
  1232. //获取产品列表
  1233. getProductList = async () => {
  1234. let token = await RetrieveData('token');
  1235. if (token) {
  1236. const url = '/marketing/feature/product/findPage';
  1237. let res = await RequestNetwork(
  1238. url,
  1239. token,
  1240. {
  1241. enable: true,
  1242. },
  1243. false,
  1244. 2,
  1245. );
  1246. if (res) {
  1247. console.log('产品信息');
  1248. console.log(res);
  1249. if (res.code === 0) {
  1250. this.setState({
  1251. productNumber: res.data.total,
  1252. });
  1253. this.setProductList(res.data.records);
  1254. } else {
  1255. await this.abnormalMessage(res);
  1256. }
  1257. }
  1258. }
  1259. };
  1260. // 处理产品的列表信息
  1261. setProductList = (list) => {
  1262. let listData = [];
  1263. list.map((item, index) => {
  1264. let data = {};
  1265. if (index === 0) {
  1266. data = {
  1267. id: item.productId,
  1268. productName: item.productName,
  1269. tags: item.tags,
  1270. oriPrice: item.oriPrice,
  1271. favouredPrice: item.favouredPrice,
  1272. productDesc: item.productDesc,
  1273. imgid: item.imgid,
  1274. imgUrl: item.imgUrl,
  1275. enable: item.enable,
  1276. ispId: item.ispId,
  1277. featureItemList: item.featureItemList,
  1278. isSelect: true,
  1279. };
  1280. let listInfo = [];
  1281. if (item.featureItemList) {
  1282. listInfo = item.featureItemList;
  1283. }
  1284. this.setState({
  1285. itemList: listInfo,
  1286. productDiscount: item.favouredPrice,
  1287. productAmount: item.oriPrice,
  1288. });
  1289. } else {
  1290. data = {
  1291. id: item.productId,
  1292. productName: item.productName,
  1293. tags: item.tags,
  1294. oriPrice: item.oriPrice,
  1295. favouredPrice: item.favouredPrice,
  1296. productDesc: item.productDesc,
  1297. imgid: item.imgid,
  1298. imgUrl: item.imgUrl,
  1299. enable: item.enable,
  1300. ispId: item.ispId,
  1301. featureItemList: item.featureItemList,
  1302. isSelect: false,
  1303. };
  1304. }
  1305. listData = listData.concat(data);
  1306. });
  1307. this.setState({
  1308. productList: listData,
  1309. });
  1310. };
  1311. // 选择数据
  1312. selectData = (data) => {
  1313. this.state.productList.map((item) => {
  1314. if (item.id === data.id) {
  1315. item.isSelect = true;
  1316. } else {
  1317. item.isSelect = false;
  1318. }
  1319. });
  1320. if (data.featureItemList) {
  1321. this.setState({
  1322. itemList: data.featureItemList,
  1323. });
  1324. } else {
  1325. this.setState({
  1326. itemList: [],
  1327. productDiscount: data.favouredPrice,
  1328. productAmount: data.oriPrice,
  1329. });
  1330. }
  1331. console.log(data);
  1332. };
  1333. // 处理网络请求数据
  1334. abnormalMessage = async (jason) => {
  1335. if (jason.code === 401) {
  1336. await Alert.alert(
  1337. '登录失效',
  1338. '登录状态已失效,请重新登录!',
  1339. [
  1340. {
  1341. text: '确定',
  1342. onPress: () => {
  1343. CleanAll();
  1344. this.props.navigation.popToTop();
  1345. },
  1346. },
  1347. ],
  1348. {cancelable: false},
  1349. );
  1350. }
  1351. if (jason.code === 403) {
  1352. Alert.alert(
  1353. '权限',
  1354. '暂无权限操作此模块!',
  1355. [
  1356. {
  1357. text: '确定',
  1358. onPress: () => {
  1359. this.props.navigation.goBack();
  1360. },
  1361. },
  1362. ],
  1363. {cancelable: false},
  1364. );
  1365. }
  1366. if (jason.code !== 401 && jason.code !== 403) {
  1367. ToastShow(1, jason.msg);
  1368. }
  1369. };
  1370. }