123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389 |
- import React, {Component} from 'react';
- import {
- View,
- Text,
- FlatList,
- RefreshControl,
- Alert,
- SafeAreaView,
- Image,
- ScrollView,
- TouchableOpacity,
- } from 'react-native';
- import {
- List,
- SearchBar,
- Tabs,
- WhiteSpace,
- Modal,
- Radio,
- } from '@ant-design/react-native';
- import {IndividualStorageData, RetrieveData} from '../../data/storage';
- import {RequestNetwork} from '../../data/encryption';
- import public_css from '../../source/css/public_css';
- import {CleanAll} from '../../components/abnormalMessage/abnormal_message';
- import {ToastShow} from '../../components/toast/toast';
- import personal_center_css from '../personalCenter/personal_center_css';
- import {SvgXml} from 'react-native-svg';
- import {downArrowIcon, upArrowIcon} from '../../source/icon/icon';
- const Item = List.Item;
- let pageNo = 1; //当前页码
- let totalPage = 5; //总的页数
- let pageSize = 10; //每页数量
- export default class service_handle extends Component {
- constructor(props) {
- super(props);
- this.props.navigation.dangerouslyGetParent().setOptions({
- tabBarVisible: false,
- });
- this.state = {
- userName: '',
- spinner: false,
- user: '',
- headImage: '',
- sex: '',
- messageList: [],
- showFoot: 0, // 控制foot, 0:无数据 1:加载中 2 :上拉加载
- isLoading: false,
- amount: 0,
- discount: 0,
- tab: 0,
- messageNumber: 0,
- isShowPay: false,
- paySelect: {},
- hideStatusText: '更多',
- hideStatus: false,
- productList: [],
- productNumber: 0,
- flexStyle: 'column',
- itemList: [],
- productDiscount: 0,
- productAmount: 0,
- };
- }
- render() {
- const tabs = [{title: '服务办理'}, {title: '短信续费'}];
- return (
- <SafeAreaView style={public_css.body}>
- <View
- style={{
- height: 130,
- backgroundColor: '#2A2C44',
- flexDirection: 'row',
- }}>
- <View style={{width: 90}}>
- <View
- style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}>
- {this.state.headImage === '' || this.state.headImage === null ? (
- this.state.sex === 'F' ? (
- <Image
- source={require('../../source/img/personal/woman.png')}
- style={[personal_center_css.headImg]}
- />
- ) : (
- <Image
- source={require('../../source/img/personal/man.png')}
- style={[personal_center_css.headImg]}
- />
- )
- ) : (
- <Image
- source={{uri: this.state.headImage}}
- style={[personal_center_css.headImg]}
- />
- )}
- </View>
- <View style={{height: 25, alignItems: 'center'}}>
- <Text
- style={{
- color: '#FFFFFF',
- fontSize: 13,
- fontWeight: 'bold',
- }}
- numberOfLines={1}
- ellipsizeMode={'tail'}>
- {this.state.userName}
- </Text>
- </View>
- </View>
- <View style={{flex: 1, justifyContent: 'center'}}>
- <View
- style={{
- height: 40,
- flexDirection: 'row',
- justifyContent: 'flex-start',
- alignItems: 'flex-end',
- }}>
- <Text
- style={{color: '#FFFFFF', fontSize: 13, marginLeft: 10}}
- numberOfLines={1}
- ellipsizeMode={'tail'}>
- 续费企业:{this.state.companyName}
- </Text>
- </View>
- <View style={{flexDirection: 'row', flex: 1}}>
- <View style={{flex: 1}}>
- <Text
- style={{
- color: '#FFFFFF',
- fontSize: 13,
- marginLeft: 10,
- marginTop: 10,
- }}>
- 服务购买时间:--------
- </Text>
- <Text
- style={{
- color: '#FFFFFF',
- fontSize: 13,
- marginLeft: 10,
- marginTop: 10,
- }}>
- 服务到期剩余:--------
- </Text>
- </View>
- <View style={{alignItems: 'center', width: 120, marginTop: 10}}>
- <Text style={{color: '#FFFFFF', fontSize: 20}}>
- --/{this.state.messageNumber}
- </Text>
- <Text style={{color: '#FFFFFF', fontSize: 13, marginTop: 5}}>
- 年度短信发送量
- </Text>
- </View>
- </View>
- </View>
- </View>
- <Tabs
- tabs={tabs}
- onChange={(i, l) => this.onChanges(i, l)}
- page={0}
- tabBarUnderlineStyle={{backgroundColor: '#ECC385'}}
- tabBarActiveTextColor={'#EABC78'}
- tabBarInactiveTextColor={'#646464'}
- tabBarTextStyle={{fontSize: 16}}>
- <ScrollView>
- <View
- style={{flexDirection: this.state.flexStyle, flexWrap: 'wrap'}}>
- {this.state.productList.map((item, index) => {
- if (this.state.hideStatus) {
- if (this.state.productNumber > 1) {
- if (item.isSelect) {
- return (
- <TouchableOpacity onPress={() => this.selectData(item)}>
- <View
- style={{
- backgroundColor: 'rgba(236, 195, 133, 0.13)',
- height: 120,
- width: 100,
- borderWidth: 1,
- borderColor: '#DDDDDD',
- borderRadius: 6,
- margin: 10,
- justifyContent: 'center',
- alignItems: 'center',
- }}>
- <Text
- style={{
- color: '#2B2B2B',
- fontSize: 16,
- }}>
- {item.productName}
- </Text>
- {/*<Text*/}
- {/* style={{*/}
- {/* color: '#2B2B2B',*/}
- {/* fontSize: 16,*/}
- {/* }}>*/}
- {/* {item.tags}*/}
- {/*</Text>*/}
- <Text
- style={{
- color: '#ECC385',
- fontWeight: 'bold',
- fontSize: 25,
- }}>
- <Text style={{fontSize: 16}}>¥</Text>
- {item.favouredPrice}
- </Text>
- <Text
- style={{
- color: '#AAAAAA',
- textDecorationLine: 'line-through',
- }}>
- ¥{item.oriPrice}
- </Text>
- </View>
- </TouchableOpacity>
- );
- } else {
- return (
- <TouchableOpacity onPress={() => this.selectData(item)}>
- <View
- style={{
- backgroundColor: 'rgba(255, 255, 255, 1)',
- height: 120,
- width: 100,
- borderWidth: 1,
- borderColor: '#DDDDDD',
- borderRadius: 6,
- margin: 10,
- justifyContent: 'center',
- alignItems: 'center',
- }}>
- <Text
- style={{
- color: '#2B2B2B',
- fontSize: 16,
- }}>
- {item.productName}
- </Text>
- {/*<Text*/}
- {/* style={{*/}
- {/* color: '#2B2B2B',*/}
- {/* fontSize: 16,*/}
- {/* }}>*/}
- {/* {item.tags}*/}
- {/*</Text>*/}
- <Text
- style={{
- color: '#ECC385',
- fontWeight: 'bold',
- fontSize: 25,
- }}>
- <Text style={{fontSize: 16}}>¥</Text>
- {item.favouredPrice}
- </Text>
- <Text
- style={{
- color: '#AAAAAA',
- textDecorationLine: 'line-through',
- }}>
- ¥{item.oriPrice}
- </Text>
- </View>
- </TouchableOpacity>
- );
- }
- } else {
- if (item.isSelect) {
- return (
- <TouchableOpacity
- onPress={() => this.selectData(item)}
- style={{
- backgroundColor: 'rgba(236, 195, 133, 0.13)',
- flexDirection: 'row',
- height: 80,
- borderWidth: 1,
- borderColor: '#DDDDDD',
- borderRadius: 6,
- margin: 10,
- }}>
- <View style={{flex: 1, flexDirection: 'column'}}>
- <View style={{flex: 1}}>
- <Text
- style={{
- color: '#2B2B2B',
- fontWeight: 'bold',
- fontSize: 18,
- marginTop: 10,
- marginLeft: 10,
- }}>
- {item.productName}
- </Text>
- </View>
- <View style={{flex: 1}}>
- {/*<Text*/}
- {/* style={{*/}
- {/* color: '#777777',*/}
- {/* fontSize: 16,*/}
- {/* marginTop: 10,*/}
- {/* marginLeft: 10,*/}
- {/* }}>*/}
- {/* {item.tags}*/}
- {/*</Text>*/}
- </View>
- </View>
- <View
- style={{
- width: 120,
- justifyContent: 'center',
- alignItems: 'center',
- }}>
- <Text
- style={{
- color: '#ECC385',
- fontWeight: 'bold',
- fontSize: 25,
- }}>
- <Text style={{fontSize: 16}}>¥</Text>
- {item.favouredPrice}
- </Text>
- <Text
- style={{
- color: '#AAAAAA',
- textDecorationLine: 'line-through',
- }}>
- ¥{item.oriPrice}
- </Text>
- </View>
- </TouchableOpacity>
- );
- } else {
- return (
- <TouchableOpacity
- onPress={() => this.selectData(item)}
- style={{
- backgroundColor: 'rgba(255, 255, 255, 1)',
- flexDirection: 'row',
- height: 80,
- borderWidth: 1,
- borderColor: '#DDDDDD',
- borderRadius: 6,
- margin: 10,
- }}>
- <View style={{flex: 1, flexDirection: 'column'}}>
- <View style={{flex: 1}}>
- <Text
- style={{
- color: '#2B2B2B',
- fontWeight: 'bold',
- fontSize: 18,
- marginTop: 10,
- marginLeft: 10,
- }}>
- {item.productName}
- </Text>
- </View>
- <View style={{flex: 1}}>
- {/*<Text*/}
- {/* style={{*/}
- {/* color: '#777777',*/}
- {/* fontSize: 16,*/}
- {/* marginTop: 10,*/}
- {/* marginLeft: 10,*/}
- {/* }}>*/}
- {/* {item.tags}*/}
- {/*</Text>*/}
- </View>
- </View>
- <View
- style={{
- width: 120,
- justifyContent: 'center',
- alignItems: 'center',
- }}>
- <Text
- style={{
- color: '#ECC385',
- fontWeight: 'bold',
- fontSize: 25,
- }}>
- <Text style={{fontSize: 16}}>¥</Text>
- {item.favouredPrice}
- </Text>
- <Text
- style={{
- color: '#AAAAAA',
- textDecorationLine: 'line-through',
- }}>
- ¥{item.oriPrice}
- </Text>
- </View>
- </TouchableOpacity>
- );
- }
- }
- } else {
- if (index === 0) {
- if (item.isSelect) {
- return (
- <TouchableOpacity
- onPress={() => this.selectData(item)}
- style={{
- backgroundColor: 'rgba(236, 195, 133, 0.13)',
- flexDirection: 'row',
- height: 80,
- borderWidth: 1,
- borderColor: '#DDDDDD',
- borderRadius: 6,
- margin: 10,
- }}>
- <View style={{flex: 1, flexDirection: 'column'}}>
- <View style={{flex: 1}}>
- <Text
- style={{
- color: '#2B2B2B',
- fontWeight: 'bold',
- fontSize: 18,
- marginTop: 10,
- marginLeft: 10,
- }}>
- {item.productName}
- </Text>
- </View>
- <View style={{flex: 1}}>
- {/*<Text*/}
- {/* style={{*/}
- {/* color: '#777777',*/}
- {/* fontSize: 16,*/}
- {/* marginTop: 10,*/}
- {/* marginLeft: 10,*/}
- {/* }}>*/}
- {/* {item.tags}*/}
- {/*</Text>*/}
- </View>
- </View>
- <View
- style={{
- width: 120,
- justifyContent: 'center',
- alignItems: 'center',
- }}>
- <Text
- style={{
- color: '#ECC385',
- fontWeight: 'bold',
- fontSize: 25,
- }}>
- <Text style={{fontSize: 16}}>¥</Text>
- {item.favouredPrice}
- </Text>
- <Text
- style={{
- color: '#AAAAAA',
- textDecorationLine: 'line-through',
- }}>
- ¥{item.oriPrice}
- </Text>
- </View>
- </TouchableOpacity>
- );
- } else {
- return (
- <TouchableOpacity
- onPress={() => this.selectData(item)}
- style={{
- backgroundColor: 'rgba(255, 255, 255, 1)',
- flexDirection: 'row',
- height: 80,
- borderWidth: 1,
- borderColor: '#DDDDDD',
- borderRadius: 6,
- margin: 10,
- }}>
- <View style={{flex: 1, flexDirection: 'column'}}>
- <View style={{flex: 1}}>
- <Text
- style={{
- color: '#2B2B2B',
- fontWeight: 'bold',
- fontSize: 18,
- marginTop: 10,
- marginLeft: 10,
- }}>
- {item.productName}
- </Text>
- </View>
- <View style={{flex: 1}}>
- {/*<Text*/}
- {/* style={{*/}
- {/* color: '#777777',*/}
- {/* fontSize: 16,*/}
- {/* marginTop: 10,*/}
- {/* marginLeft: 10,*/}
- {/* }}>*/}
- {/* {item.tags}*/}
- {/*</Text>*/}
- </View>
- </View>
- <View
- style={{
- width: 120,
- justifyContent: 'center',
- alignItems: 'center',
- }}>
- <Text
- style={{
- color: '#ECC385',
- fontWeight: 'bold',
- fontSize: 25,
- }}>
- <Text style={{fontSize: 16}}>¥</Text>
- {item.favouredPrice}
- </Text>
- <Text
- style={{
- color: '#AAAAAA',
- textDecorationLine: 'line-through',
- }}>
- ¥{item.oriPrice}
- </Text>
- </View>
- </TouchableOpacity>
- );
- }
- }
- }
- })}
- </View>
- <View style={[public_css.view, {justifyContent: 'center'}]}>
- <TouchableOpacity
- style={{
- width: 120,
- height: 30,
- backgroundColor: '#F8F8F8',
- opacity: 1,
- borderRadius: 99,
- flexDirection: 'row',
- justifyContent: 'center',
- alignItems: 'center',
- }}
- onPress={() => this.hideChange()}>
- {this.state.hideStatus === false ? (
- <View style={{flexDirection: 'row', alignItems: 'center'}}>
- <Text style={{color: '#B6B6BA', fontSize: 16}}>
- {this.state.hideStatusText}
- </Text>
- <SvgXml style={{marginLeft: 5}} xml={downArrowIcon()} />
- </View>
- ) : (
- <View style={{flexDirection: 'row', alignItems: 'center'}}>
- <Text style={{color: '#B6B6BA', fontSize: 16}}>
- {this.state.hideStatusText}
- </Text>
- <SvgXml style={{marginLeft: 5}} xml={upArrowIcon()} />
- </View>
- )}
- </TouchableOpacity>
- </View>
- <View style={{backgroundColor: '#F7F7F7', height: 10}} />
- <View style={{backgroundColor: '#ffffff'}}>
- <Text
- style={{
- color: '#2C2C2C',
- marginLeft: 10,
- marginTop: 10,
- fontWeight: 'bold',
- fontSize: 16,
- }}>
- 套餐特权
- </Text>
- <View style={{flexDirection: 'row', flexWrap: 'wrap'}}>
- {this.state.itemList.map((item) => {
- return (
- <View
- style={{
- alignItems: 'center',
- marginLeft: 10,
- marginTop: 10,
- justifyContent: 'center',
- }}>
- <Image
- source={{uri: item.featureImgUrl}}
- style={{height: 44, width: 44}}
- />
- <Text style={{width: 70, textAlign: 'center'}}>
- {item.featureName}
- </Text>
- </View>
- );
- })}
- </View>
- </View>
- <View style={{backgroundColor: '#F7F7F7', height: 10}} />
- <List style={{}}>
- <Item
- arrow="horizontal"
- onPress={() => {
- this.props.navigation.navigate('agreement');
- }}>
- <View style={{flexDirection: 'row', alignItems: 'center'}}>
- <Text style={{marginLeft: 5, color: '#000000'}}>
- 会员服务协议
- </Text>
- </View>
- </Item>
- <Item
- arrow="horizontal"
- onPress={() => {
- this.props.navigation.navigate('problem');
- }}>
- <View style={{flexDirection: 'row', alignItems: 'center'}}>
- <Text style={{marginLeft: 5, color: '#000000'}}>
- 常见问题
- </Text>
- </View>
- </Item>
- </List>
- <TouchableOpacity
- onPress={() => {
- // this.setState({
- // isShowPay: true,
- // });
- Alert.alert(
- '提示',
- '云票在线App暂未开放,请到网页版进行支付!',
- [
- {
- text: '确定',
- // onPress: () => {
- // this.props.navigation.goBack();
- // },
- },
- ],
- {cancelable: false},
- );
- }}
- style={{
- height: 40,
- backgroundColor: '#2A2C44',
- alignItems: 'center',
- justifyContent: 'center',
- marginLeft: 10,
- marginRight: 10,
- borderRadius: 500,
- flexDirection: 'row',
- }}>
- <Text
- style={{color: '#ECC385', fontWeight: 'bold', fontSize: 16}}>
- 立即支付{this.state.productDiscount}元
- </Text>
- <Text
- style={{
- color: '#ECC385',
- fontSize: 13,
- textDecorationLine: 'line-through',
- marginLeft: 5,
- }}>
- ¥{this.state.productAmount}
- </Text>
- </TouchableOpacity>
- <WhiteSpace />
- </ScrollView>
- <View style={{flex: 1, backgroundColor: '#ffffff'}}>
- <View style={{flex: 1}}>
- <FlatList
- style={{flexGrow: 0}}
- data={this.state.messageList}
- renderItem={(item) => this.renderItem(item)}
- // onRefresh={this.initData()}
- // refreshing={this.state.isLoading}
- // refreshControl={
- // <RefreshControl
- // title={'加载中...'}
- // colors={['#B7B7B7']} //此颜色无效
- // tintColor={'#B7B7B7'}
- // titleColor={'#B7B7B7'} //只有ios有效
- // refreshing={this.state.isLoading}
- // onRefresh={() => {
- // this.initData();
- // }}
- // />
- // }
- // onEndReached={() => this.onEndReached()}
- // onEndReachedThreshold={0.1}
- />
- <View style={{backgroundColor: '#F7F7F7', height: 10}} />
- <View style={{backgroundColor: '#ffffff'}}>
- <Text
- style={{
- color: '#2C2C2C',
- marginLeft: 10,
- marginTop: 10,
- fontWeight: 'bold',
- fontSize: 16,
- }}>
- 套餐说明
- </Text>
- <Text style={{color: '#AAAAAA', margin: 10}}>
- 该产品为配合云票在线发票短信使用,即当您开票后选择接收方式为短信时,我们将以短信的形式给您发送该发票的链接。
- </Text>
- </View>
- <View style={{backgroundColor: '#F7F7F7', height: 10}} />
- <List style={{}}>
- <Item
- arrow="horizontal"
- onPress={() => {
- this.props.navigation.navigate('agreement');
- }}>
- <View style={{flexDirection: 'row', alignItems: 'center'}}>
- <Text style={{marginLeft: 5, color: '#000000'}}>
- 会员服务协议
- </Text>
- </View>
- </Item>
- <Item
- arrow="horizontal"
- onPress={() => {
- this.props.navigation.navigate('problem');
- }}>
- <View style={{flexDirection: 'row', alignItems: 'center'}}>
- <Text style={{marginLeft: 5, color: '#000000'}}>
- 常见问题
- </Text>
- </View>
- </Item>
- </List>
- </View>
- <TouchableOpacity
- onPress={() => {
- // this.setState({
- // isShowPay: true,
- // });
- Alert.alert(
- '提示',
- '云票在线App暂未开放,请到网页版进行支付!',
- [
- {
- text: '确定',
- // onPress: () => {
- // this.props.navigation.goBack();
- // },
- },
- ],
- {cancelable: false},
- );
- }}
- style={{
- height: 40,
- backgroundColor: '#2A2C44',
- alignItems: 'center',
- justifyContent: 'center',
- marginLeft: 10,
- marginRight: 10,
- borderRadius: 500,
- }}>
- <Text
- style={{color: '#ECC385', fontWeight: 'bold', fontSize: 16}}>
- 立即支付{this.state.discount}元
- <Text
- style={{
- fontSize: 13,
- textDecorationLine: 'line-through',
- }}>
- ¥{this.state.amount}
- </Text>
- </Text>
- </TouchableOpacity>
- <WhiteSpace />
- </View>
- </Tabs>
- <Modal
- popup
- maskClosable
- visible={this.state.isShowPay}
- animationType="slide-up"
- onClose={this.showModal}>
- <View
- style={{
- paddingVertical: 20,
- paddingHorizontal: 20,
- backgroundColor: '#ffffff',
- }}>
- <View
- style={{
- flex: 1,
- backgroundColor: 'rgba(236, 195, 133, 0.13)',
- flexDirection: 'row',
- height: 80,
- borderWidth: 1,
- borderColor: '#DDDDDD',
- borderRadius: 6,
- }}>
- <View style={{flex: 1}}>
- <Text
- style={{
- color: '#2B2B2B',
- fontWeight: 'bold',
- fontSize: 18,
- marginTop: 10,
- marginLeft: 10,
- }}>
- {this.state.paySelect.title}
- </Text>
- <Text
- style={{
- color: '#777777',
- fontSize: 16,
- marginTop: 10,
- marginLeft: 10,
- }}>
- {this.state.paySelect.desc}
- </Text>
- </View>
- <View
- style={{
- width: 120,
- justifyContent: 'center',
- alignItems: 'center',
- }}>
- <Text
- style={{color: '#ECC385', fontWeight: 'bold', fontSize: 25}}>
- <Text style={{fontSize: 16}}>¥</Text>
- {this.state.paySelect.discount}
- </Text>
- <Text
- style={{
- color: '#AAAAAA',
- textDecorationLine: 'line-through',
- }}>
- ¥{this.state.paySelect.amount}
- </Text>
- </View>
- </View>
- <Radio
- checked={true}
- onChange={(event) => {
- if (event.target.checked) {
- console.log(123);
- }
- }}
- style={{
- borderWidth: 1,
- borderColor: '#999',
- margin: 10,
- backgroundColor: 'red',
- }}
- />
- <Radio
- checked={false}
- onChange={(event) => {
- if (event.target.checked) {
- this.setState({part1Value: 1});
- }
- }}
- style={{borderWidth: 1, borderColor: '#999', margin: 10}}>
- Support
- </Radio>
- <View
- style={{
- backgroundColor: '#ffffff',
- height: 60,
- justifyContent: 'center',
- }}>
- <TouchableOpacity
- onPress={() => {
- this.setState({
- isShowPay: true,
- });
- }}
- style={{
- height: 40,
- backgroundColor: '#2A2C44',
- alignItems: 'center',
- justifyContent: 'center',
- marginLeft: 10,
- marginRight: 10,
- borderRadius: 500,
- }}>
- <Text
- style={{color: '#ECC385', fontWeight: 'bold', fontSize: 16}}>
- 立即支付{this.state.discount}元
- <Text
- style={{
- fontSize: 13,
- textDecorationLine: 'line-through',
- }}>
- ¥{this.state.amount}
- </Text>
- </Text>
- </TouchableOpacity>
- </View>
- </View>
- {/*<Button type="primary" onPress={this.onClose2}>*/}
- {/* close modal*/}
- {/*</Button>*/}
- </Modal>
- </SafeAreaView>
- );
- }
- //页面渲染完成后加载
- async componentDidMount(): void {
- pageNo = 1;
- this.setState({
- messageList: [],
- showFoot: 1,
- });
- this.getSignIn();
- await this.getProductList();
- await this.getMessageList();
- await this.getMessageNumber();
- }
- //tab变化事件
- onChanges = (i, l) => {
- if (this.state.tab !== l) {
- this.setState({
- tab: l,
- });
- this.initData();
- }
- };
- //获取登录信息
- getSignIn = async () => {
- let userHeadImg = JSON.parse(await RetrieveData('userHeadImg'));
- let userName = await RetrieveData('userName');
- let company = await RetrieveData('company');
- if (company) {
- company = JSON.parse(company);
- }
- if (userName && company) {
- this.setState({
- userName: userName,
- companyName: company.entName,
- });
- }
- if (userHeadImg) {
- this.setState({
- headImage: userHeadImg.headImage,
- sex: userHeadImg.sex,
- });
- } else {
- this.setState({
- headImage: '',
- sex: '',
- });
- }
- };
- //初始化数据
- initData = async () => {
- pageNo = 1;
- this.setState({
- messageList: [],
- showFoot: 1,
- isLoading: true,
- hideStatusText: '更多',
- hideStatus: false,
- flexStyle: 'column',
- });
- await this.getMessageList();
- await this.getProductList();
- };
- //获取短信产品列表
- getMessageList = async () => {
- let token = await RetrieveData('token');
- if (token) {
- const url = '/marketing/feature/product/findPage';
- let res = await RequestNetwork(
- url,
- token,
- {
- featureId: 'F0000001',
- featureName: '短信服务',
- enable: true,
- pageNum: pageNo,
- pageSize: pageSize,
- },
- false,
- 2,
- );
- if (res) {
- if (res.code === 0) {
- totalPage = res.data.pages;
- this.setList(res.data.records);
- } else {
- this.setState({
- showFoot: 0,
- });
- await this.abnormalMessage(res);
- }
- }
- }
- };
- //获取短信数量
- getMessageNumber = async () => {
- let company = JSON.parse(await RetrieveData('company'));
- let token = await RetrieveData('token');
- if (token && company) {
- const url = '/marketing/ent/features/findPage';
- let res = await RequestNetwork(
- url,
- token,
- {
- entTaxId: company.entTaxId,
- featureId: 'F0000001',
- featureName: '短信服务',
- pageNum: 1,
- pageSize: 10,
- },
- false,
- 2,
- );
- if (res) {
- if (res.code === 0) {
- console.log(res);
- res.data.records.map((item) => {
- if (item.featureId === 'F0000001') {
- this.messageNumber = parseFloat(item.surplus);
- }
- });
- } else {
- await this.abnormalMessage(res);
- }
- }
- }
- };
- //加载产品列表
- setList = (data) => {
- let listData = {};
- let list = [];
- data.map((_, i) => {
- if (i === 0) {
- listData = {
- key: data[i].productId,
- title: data[i].productName,
- tags: data[i].tags,
- desc: data[i].productDesc,
- amount: data[i].oriPrice,
- discount: data[i].favouredPrice,
- isSelect: true,
- };
- this.setState({
- paySelect: listData,
- amount: listData.amount,
- discount: listData.discount,
- });
- } else {
- listData = {
- key: data[i].productId,
- title: data[i].productName,
- tags: data[i].tags,
- desc: data[i].productDesc,
- amount: data[i].oriPrice,
- discount: data[i].favouredPrice,
- isSelect: false,
- };
- }
- list = list.concat(listData);
- });
- if (list.length > 0) {
- this.setState({
- showFoot: 2,
- isLoading: false,
- messageList: list,
- });
- } else {
- this.setState({
- showFoot: 0,
- isLoading: false,
- messageList: list,
- });
- }
- };
- //显示短信列表
- renderItem = (data) => (
- <List.Item
- onPress={() => {
- this.messageChange(data);
- }}
- style={{display: 'flex', backgroundColor: '#ffffff'}}>
- {data.item.isSelect === true ? (
- <View
- style={{
- flex: 1,
- backgroundColor: 'rgba(236, 195, 133, 0.13)',
- flexDirection: 'row',
- height: 80,
- borderWidth: 1,
- borderColor: '#DDDDDD',
- borderRadius: 6,
- }}>
- <View style={{flex: 1, flexDirection: 'column'}}>
- <View style={{flex: 1}}>
- <Text
- style={{
- color: '#2B2B2B',
- fontWeight: 'bold',
- fontSize: 18,
- marginTop: 10,
- marginLeft: 10,
- }}>
- {data.item.title}
- </Text>
- </View>
- <View style={{flex: 1}}>
- <Text
- style={{
- color: '#777777',
- fontSize: 16,
- marginTop: 10,
- marginLeft: 10,
- }}>
- {data.item.desc}
- </Text>
- </View>
- </View>
- <View
- style={{
- width: 120,
- justifyContent: 'center',
- alignItems: 'center',
- }}>
- <Text style={{color: '#ECC385', fontWeight: 'bold', fontSize: 25}}>
- <Text style={{fontSize: 16}}>¥</Text>
- {data.item.discount}
- </Text>
- <Text
- style={{color: '#AAAAAA', textDecorationLine: 'line-through'}}>
- ¥{data.item.amount}
- </Text>
- </View>
- </View>
- ) : (
- <View
- style={{
- flex: 1,
- backgroundColor: '#ffffff',
- flexDirection: 'row',
- height: 80,
- borderWidth: 1,
- borderColor: '#DDDDDD',
- borderRadius: 6,
- }}>
- <View style={{flex: 1}}>
- <Text
- style={{
- color: '#2B2B2B',
- fontWeight: 'bold',
- fontSize: 18,
- marginTop: 10,
- marginLeft: 10,
- }}>
- {data.item.title}
- </Text>
- <Text
- style={{
- color: '#777777',
- fontSize: 16,
- marginTop: 10,
- marginLeft: 10,
- }}>
- {data.item.desc}
- </Text>
- </View>
- <View
- style={{
- width: 120,
- justifyContent: 'center',
- alignItems: 'center',
- }}>
- <Text style={{color: '#ECC385', fontWeight: 'bold', fontSize: 25}}>
- <Text style={{fontSize: 16}}>¥</Text>
- {data.item.discount}
- </Text>
- <Text
- style={{color: '#AAAAAA', textDecorationLine: 'line-through'}}>
- ¥{data.item.amount}
- </Text>
- </View>
- </View>
- )}
- </List.Item>
- );
- // 处理短信选择
- messageChange = (data) => {
- this.state.messageList.map((item) => {
- if (item.key === data.item.key) {
- item.isSelect = true;
- } else {
- item.isSelect = false;
- }
- });
- this.setState({
- paySelect: data.item,
- amount: data.item.amount,
- discount: data.item.discount,
- });
- };
- //列表上拉加载
- onEndReached = async () => {
- if (this.state.showFoot === 2) {
- if (pageNo >= totalPage) {
- this.setState({showFoot: 0});
- return;
- } else {
- pageNo++;
- this.setState({showFoot: 1});
- await this.getMessageList();
- }
- }
- };
- // 支付弹出层点击阴影关闭
- showModal = () => {
- this.setState({
- isShowPay: false,
- });
- };
- // 字段隐藏切换
- hideChange = () => {
- this.setState({
- hideStatus: !this.state.hideStatus,
- hideStatusText: '收起',
- });
- if (this.state.hideStatus) {
- this.setState({
- flexStyle: 'column',
- });
- } else {
- this.setState({
- flexStyle: 'row',
- });
- }
- };
- //获取产品列表
- getProductList = async () => {
- let token = await RetrieveData('token');
- if (token) {
- const url = '/marketing/feature/product/findPage';
- let res = await RequestNetwork(
- url,
- token,
- {
- enable: true,
- },
- false,
- 2,
- );
- if (res) {
- console.log('产品信息');
- console.log(res);
- if (res.code === 0) {
- this.setState({
- productNumber: res.data.total,
- });
- this.setProductList(res.data.records);
- } else {
- await this.abnormalMessage(res);
- }
- }
- }
- };
- // 处理产品的列表信息
- setProductList = (list) => {
- let listData = [];
- list.map((item, index) => {
- let data = {};
- if (index === 0) {
- data = {
- id: item.productId,
- productName: item.productName,
- tags: item.tags,
- oriPrice: item.oriPrice,
- favouredPrice: item.favouredPrice,
- productDesc: item.productDesc,
- imgid: item.imgid,
- imgUrl: item.imgUrl,
- enable: item.enable,
- ispId: item.ispId,
- featureItemList: item.featureItemList,
- isSelect: true,
- };
- let listInfo = [];
- if (item.featureItemList) {
- listInfo = item.featureItemList;
- }
- this.setState({
- itemList: listInfo,
- productDiscount: item.favouredPrice,
- productAmount: item.oriPrice,
- });
- } else {
- data = {
- id: item.productId,
- productName: item.productName,
- tags: item.tags,
- oriPrice: item.oriPrice,
- favouredPrice: item.favouredPrice,
- productDesc: item.productDesc,
- imgid: item.imgid,
- imgUrl: item.imgUrl,
- enable: item.enable,
- ispId: item.ispId,
- featureItemList: item.featureItemList,
- isSelect: false,
- };
- }
- listData = listData.concat(data);
- });
- this.setState({
- productList: listData,
- });
- };
- // 选择数据
- selectData = (data) => {
- this.state.productList.map((item) => {
- if (item.id === data.id) {
- item.isSelect = true;
- } else {
- item.isSelect = false;
- }
- });
- if (data.featureItemList) {
- this.setState({
- itemList: data.featureItemList,
- });
- } else {
- this.setState({
- itemList: [],
- productDiscount: data.favouredPrice,
- productAmount: data.oriPrice,
- });
- }
- console.log(data);
- };
- // 处理网络请求数据
- abnormalMessage = async (jason) => {
- if (jason.code === 401) {
- await Alert.alert(
- '登录失效',
- '登录状态已失效,请重新登录!',
- [
- {
- text: '确定',
- onPress: () => {
- CleanAll();
- this.props.navigation.popToTop();
- },
- },
- ],
- {cancelable: false},
- );
- }
- if (jason.code === 403) {
- Alert.alert(
- '权限',
- '暂无权限操作此模块!',
- [
- {
- text: '确定',
- onPress: () => {
- this.props.navigation.goBack();
- },
- },
- ],
- {cancelable: false},
- );
- }
- if (jason.code !== 401 && jason.code !== 403) {
- ToastShow(1, jason.msg);
- }
- };
- }
|