123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872 |
- import React, { Component } from 'react'
- import {
- StyleSheet,
- View,
- Text,
- ActivityIndicator,
- Dimensions,
- StatusBar,
- TouchableOpacity,
- PixelRatio,
- FlatList,
- DatePickerAndroid,
- RefreshControl,
- Platform,
- } from 'react-native'
- import { connect } from 'react-redux'
- import Input from '../../../components/input/index'
- import Icon from '../../../components/Iconfont/Iconfont'
- import { NavigationActions, createAction } from '../../../utils'
- import { accAdd, ReturnDate } from '../../../utils/utils'
- import Collapsible from 'react-native-collapsible'
- import SelectTime from '../../common/SelectTime'
- const { width, height } = Dimensions.get('window')
- @connect(({ theme, mine_header, mine_payment }) => ({
- ...theme,
- ...mine_header,
- ...mine_payment,
- }))
- class ReconciliationDetail extends Component {
- constructor(props) {
- const date = new Date()
- super(props)
- this.state = {
- dateActive: true,
- listActive: 'asdasd',
- showSearch: false,
- detailList: [],
- // 开始时间
- startTime: props.navigation.state.params.startTime,
- // 结束时间
- endTime: props.navigation.state.params.endTime,
- // 财务组织
- Search_FinaOrg: props.navigation.state.params.Search_FinaOrg,
- saleId: props.navigation.state.params.saleId,
- }
- this.page = 0
- this.size = 5
- }
- componentDidMount = () => {
- this.props.navigation.state.params.comeFrom == 'Cost'
- ? this.props.dispatch(
- createAction('mine_header/CastAmountSaga')({
- pageInfo: { size: 5, page: 0 },
- searchInfo: this.searchInfo(),
- castAmt: [],
- })
- )
- : this.props.dispatch(
- createAction('mine_payment/PayDetailListSagas')({
- payActionData: [],
- pageInfo: { page: this.page, size: this.size },
- searchInfo: this.statsticInfo(),
- })
- )
- }
- // 费用对账请求参数
- searchInfo() {
- postInfo = {
- search_IN_financeOrg: this.state.Search_FinaOrg,
- search_IN_customer: CUSTOMERINFO.id,
- // search_GTE_billDate_date: new Date(this.state.startTime).getTime(),
- // search_LT_billDate_date: new Date(this.state.endTime).getTime()
- }
- if (this.state.startTime) {
- postInfo.search_GTE_billDate_date = new Date(
- this.state.startTime
- ).getTime()
- }
- if (this.state.endTime) {
- postInfo.search_LT_billDate_date = new Date(this.state.endTime).getTime()
- }
- return postInfo
- }
- // 应付对账请求参数
- statsticInfo() {
- let search = {
- search_EQ_financeOrg: this.state.Search_FinaOrg,
- }
- if (this.state.saleId) {
- search.search_EQ_saleOrg = this.state.saleId
- }
- if (this.state.startTime && this.state.endTime) {
- search.search_GTE_creationTime_date = this.state.startTime
- search.search_LT_creationTime_date = this.state.endTime
- }
- // if (this.state.searchText) {
- // search.search_LIKE_code = this.state.searchText;
- // }
- return search
- }
- onRefresh() {
- this.props.dispatch(
- createAction('mine_header/CastAmountSaga')({
- castAmt: [],
- pageInfo: { page: 0, size: this.size },
- searchInfo: this.searchInfo(),
- })
- )
- this.page = 0
- }
- // 头部
- header() {
- return (
- <View
- style={{
- height: HEADERSTYLE.height,
- paddingTop: HEADERSTYLE.paddingTop + 5,
- backgroundColor: '#fff',
- borderBottomColor: '#eee',
- borderBottomWidth: 1 / PixelRatio.get(),
- }}
- >
- <View
- style={{
- flex: 1,
- justifyContent: 'center',
- }}
- >
- <TouchableOpacity
- style={{ position: 'absolute', left: 10, flexDirection: 'row' }}
- onPress={() => this.props.dispatch(NavigationActions.back())}
- >
- <Icon
- name="icon-icon-fanhui"
- size={20}
- color={'#666'}
- style={{ marginTop: 4 }}
- />
- <Text
- style={{
- fontSize: 14,
- lineHeight: 20,
- color: '#666',
- alignSelf: 'center',
- }}
- >
- 返回
- </Text>
- </TouchableOpacity>
- {this.props.navigation.state.params.comeFrom == 'Cost' ? (
- <Text
- style={{
- alignSelf: 'center',
- fontSize: 18,
- lineHeight: 25,
- letterSpacing: 0.19,
- color: '#333',
- }}
- >
- 费用对账
- </Text>
- ) : this.state.showSearch ? (
- <Input
- autoFocus={this.state.showSearch}
- style={{
- marginLeft: 25,
- marginTop: 8,
- height: 28,
- width: width / 1.6,
- borderRadius: width / 2,
- alignSelf: 'center',
- marginBottom: 8,
- paddingLeft: 14,
- }}
- textStyle={{
- paddingLeft: 10,
- height: 32,
- fontSize: 11,
- padding: 0,
- }}
- iconSize={14}
- blurOnSubmit={true}
- textInputBacg={'#F5F5F5'}
- iconColor={'#CCC'}
- placeholderTextColor={'#CCC'}
- placeholderSize={8}
- onchangeFn={e => {
- this.setState({ activeSection: true })
- }}
- />
- ) : (
- <Text
- style={{
- alignSelf: 'center',
- fontSize: 18,
- lineHeight: 25,
- letterSpacing: 0.19,
- color: '#333',
- }}
- >
- 应付对账
- </Text>
- )}
- {/* {this.props.navigation.state.params == "Cost" ? (
- <View
- style={{ position: "absolute", right: 10, flexDirection: "row" }}
- >
- <TouchableOpacity
- onPress={() =>
- this.setState({ dateActive: !this.state.dateActive })
- }
- >
- <Icon name="icon-icon-rili" size={24} color={"#666"} />
- </TouchableOpacity>
- </View>
- ) : this.state.showSearch ? (
- <TouchableOpacity
- onPress={() =>
- this.setState({ showSearch: false, activeSection: true })
- }
- style={{ position: "absolute", right: 10, flexDirection: "row" }}
- >
- <Text style={{ fontSize: 14, lineHeight: 20, color: "#666" }}>
- 取消
- </Text>
- </TouchableOpacity>
- ) : (
- <View
- style={{ position: "absolute", right: 10, flexDirection: "row" }}
- >
- <TouchableOpacity
- style={{ marginRight: 10 }}
- onPress={() =>
- this.setState({ showSearch: true, activeSection: true })
- }
- >
- <Icon name="icon-icon-sousuo" size={24} color={"#666"} />
- </TouchableOpacity>
- <TouchableOpacity
- onPress={() =>
- this.setState({ dateActive: !this.state.dateActive })
- }
- >
- <Icon name="icon-icon-rili" size={24} color={"#666"} />
- </TouchableOpacity>
- </View>
- )} */}
- </View>
- </View>
- )
- }
- async TimeAndroid(mark) {
- const { action, year, month, day } = await DatePickerAndroid.open({
- date: new Date(),
- // minDate: new Date(),
- mode: 'spinner',
- })
- if (action !== DatePickerAndroid.dismissedAction) {
- let newDate = `${year}-${month + 1}-${day}`
- if (mark == 'start') {
- if (newDate <= this.state.endTime) {
- this.setState({
- startTime: newDate,
- })
- }
- } else if (mark == 'end') {
- if (this.state.startTime <= newDate) {
- this.setState({
- endTime: newDate,
- })
- }
- }
- // 这里开始可以处理用户选好的年月日三个参数:year, month (0-11), day
- }
- }
- ReconciliationList(item, index) {
- return (
- <View>
- <TouchableOpacity
- onPress={() => {
- if (this.state.listActive == index) {
- this.setState({ listActive: 'asdasd' })
- } else {
- this.props.dispatch(
- createAction('mine_header/CastDetailSaga')({ id: item.id })
- )
- this.setState({ listActive: index })
- }
- }}
- style={{ marginTop: 10, padding: 10, backgroundColor: '#FFF' }}
- >
- <View
- style={{
- flexDirection: 'row',
- justifyContent: 'space-between',
- }}
- >
- <View style={{ flexDirection: 'row' }}>
- <Text
- style={{
- fontSize: 13,
- lineHeight: 18,
- letterSpacing: 0.16,
- color: '#333',
- marginRight: 10,
- }}
- >
- {item.billCode || item.code}
- </Text>
- {this.props.navigation.state.params.comeFrom == 'Cost' ? (
- <Text
- style={{
- fontSize: 13,
- lineHeight: 18,
- letterSpacing: 0.16,
- color: '#333',
- }}
- >
- {item.castTypeName}
- </Text>
- ) : null}
- </View>
- <Text style={{ fontSize: 12, lineHeight: 17, color: '#999' }}>
- {ReturnDate(item.billDate || item.creationTime, true)}
- </Text>
- </View>
- <View
- style={{
- marginTop: 5,
- paddingBottom: 5,
- borderBottomColor: '#DDD',
- borderBottomWidth: 1 / PixelRatio.get(),
- }}
- >
- <Text
- style={{
- fontSize: 14,
- lineHeight: 20,
- letterSpacing: 0.17,
- color: '#333',
- }}
- >
- {item.customerName || item.saleOrgName}
- </Text>
- </View>
- {this.props.navigation.state.params.comeFrom == 'Cost' ? (
- <View style={{ flexDirection: 'row', paddingTop: 10 }}>
- <View style={{ flex: 1 }}>
- <Text
- style={{
- fontSize: 13,
- lineHeight: 18,
- letterSpacing: 0.16,
- color: '#999',
- }}
- >
- 费用金额
- </Text>
- <Text
- style={{
- fontSize: 15,
- lineHeight: 21,
- letterSpacing: 0.16,
- color: '#333',
- marginTop: 10,
- }}
- >
- {item.castAmount}
- </Text>
- </View>
- <View style={{ flex: 1 }}>
- <Text
- style={{
- fontSize: 13,
- lineHeight: 18,
- letterSpacing: 0.16,
- color: '#999',
- }}
- >
- 订单冲抵
- </Text>
- <Text
- style={{
- fontSize: 15,
- lineHeight: 21,
- letterSpacing: 0.16,
- color: '#333',
- marginTop: 10,
- }}
- >
- {accAdd(
- item.actualFlushAmount,
- item.actualGoodssupplementAmount
- )}
- </Text>
- </View>
- <View style={{ flex: 1 }}>
- <Text
- style={{
- fontSize: 13,
- lineHeight: 18,
- letterSpacing: 0.16,
- color: '#999',
- }}
- >
- 余额
- </Text>
- <Text
- style={{
- fontSize: 15,
- lineHeight: 21,
- letterSpacing: 0.16,
- color: '#E70013',
- marginTop: 10,
- }}
- >
- {item.castBalance}
- </Text>
- </View>
- </View>
- ) : (
- <View style={{ flexDirection: 'row', paddingTop: 10 }}>
- <View style={{ flex: 1 }}>
- <Text
- style={{
- fontSize: 13,
- lineHeight: 18,
- letterSpacing: 0.16,
- color: '#999',
- }}
- >
- 应付金额
- </Text>
- <Text
- style={{
- fontSize: 15,
- lineHeight: 21,
- letterSpacing: 0.16,
- color: '#333',
- marginTop: 10,
- }}
- >
- {item.receivableMoney}
- </Text>
- </View>
- <View style={{ flex: 1 }}>
- <Text
- style={{
- fontSize: 13,
- lineHeight: 18,
- letterSpacing: 0.16,
- color: '#999',
- }}
- >
- 核销金额
- </Text>
- <Text
- style={{
- fontSize: 15,
- lineHeight: 21,
- letterSpacing: 0.16,
- color: '#333',
- marginTop: 10,
- }}
- >
- {item.cancellationMoney}
- </Text>
- </View>
- <View style={{ flex: 1 }}>
- <Text
- style={{
- fontSize: 13,
- lineHeight: 18,
- letterSpacing: 0.16,
- color: '#999',
- }}
- >
- 付款核销额
- </Text>
- <Text
- style={{
- fontSize: 15,
- lineHeight: 21,
- letterSpacing: 0.16,
- color: '#333',
- marginTop: 10,
- }}
- >
- {item.payMoney}
- </Text>
- </View>
- <View style={{ flex: 1 }}>
- <Text
- style={{
- fontSize: 13,
- lineHeight: 18,
- letterSpacing: 0.16,
- color: '#999',
- }}
- >
- 退款核销额
- </Text>
- <Text
- style={{
- fontSize: 15,
- lineHeight: 21,
- letterSpacing: 0.16,
- color: '#333',
- marginTop: 10,
- }}
- >
- {item.backMoney}
- </Text>
- </View>
- </View>
- )}
- </TouchableOpacity>
- <Collapsible collapsed={index !== this.state.listActive}>
- <View
- style={{
- marginHorizontal: 10,
- marginBottom: 10,
- backgroundColor: '#FFFBF2',
- padding: 10,
- }}
- >
- {this.props.navigation.state.params.comeFrom == 'Cost' ? (
- <View style={{ flexDirection: 'row' }}>
- <View style={{ flex: 1 }}>
- <Text style={{ fontSize: 13, lineHeight: 18, color: '#666' }}>
- 订货单编码
- </Text>
- </View>
- <View style={{ flex: 1 }}>
- <Text style={{ fontSize: 13, lineHeight: 18, color: '#666' }}>
- 订单日期
- </Text>
- </View>
- <View style={{ flex: 1 }}>
- <Text style={{ fontSize: 13, lineHeight: 18, color: '#666' }}>
- 冲抵金额
- </Text>
- </View>
- </View>
- ) : (
- <View>
- <View
- style={{
- paddingBottom: 10,
- borderBottomColor: '#DDD',
- borderBottomWidth: 1,
- }}
- >
- <Text style={{ fontSize: 13, lineHeight: 22, color: '#666' }}>
- 核销金额:{CURRENCY.currencySign}
- {item.cancellationMoney}
- </Text>
- <Text style={{ fontSize: 13, lineHeight: 22, color: '#666' }}>
- 关联订单号:{item.srcOrderCode}
- </Text>
- <Text style={{ fontSize: 13, lineHeight: 22, color: '#666' }}>
- 关联出库单号:{item.srcBillcode}
- </Text>
- </View>
- <View style={{ flexDirection: 'row', paddingTop: 10 }}>
- <View style={{ flex: 1 }}>
- <Text
- style={{ fontSize: 13, lineHeight: 18, color: '#666' }}
- >
- 收款单号
- </Text>
- </View>
- <View style={{ flex: 1, alignItems: 'center' }}>
- <Text
- style={{ fontSize: 13, lineHeight: 18, color: '#666' }}
- >
- 收款核销日
- </Text>
- </View>
- <View style={{ flex: 1 }}>
- <Text
- style={{ fontSize: 13, lineHeight: 18, color: '#666' }}
- >
- 收款核销额
- </Text>
- </View>
- </View>
- </View>
- )}
- {this.props.navigation.state.params.comeFrom == 'Cost'
- ? this.props.castDetail.map((item, key) => (
- <View key={key} style={{ flexDirection: 'row' }}>
- <View style={{ flex: 1 }}>
- <Text
- numberOfLines={1}
- style={{ fontSize: 13, lineHeight: 22, color: '#666' }}
- >
- {item.customerOrderCode}
- </Text>
- </View>
- <View style={{ flex: 1 }}>
- <Text
- style={{ fontSize: 13, lineHeight: 22, color: '#666' }}
- >
- {ReturnDate(item.billDate, true)}
- </Text>
- </View>
- <View style={{ flex: 1 }}>
- <Text
- style={{ fontSize: 13, lineHeight: 22, color: '#666' }}
- >
- {item.flushAmount}
- </Text>
- </View>
- </View>
- ))
- : item.billlistPaymentAccount.map((itempay, key) => (
- <View key={key} style={{ flexDirection: 'row' }}>
- <View style={{ flex: 1 }}>
- <Text
- numberOfLines={1}
- style={{
- fontSize: 13,
- lineHeight: 22,
- color: '#666',
- }}
- >
- {itempay.paymentCode}
- </Text>
- </View>
- <View style={{ flex: 1, alignItems: 'center' }}>
- <Text
- style={{
- fontSize: 13,
- lineHeight: 22,
- color: '#666',
- }}
- >
- {ReturnDate(itempay.paymentTime, true)}
- </Text>
- </View>
- <View style={{ flex: 1 }}>
- <Text
- style={{
- fontSize: 13,
- lineHeight: 22,
- color: '#666',
- }}
- >
- {itempay.paymentMoney}
- </Text>
- </View>
- </View>
- ))}
- {this.props.navigation.state.params.comeFrom == 'Cost' ? null : (
- <View
- style={{
- marginTop: 10,
- paddingTop: 10,
- borderTopColor: '#DDD',
- borderTopWidth: 1,
- }}
- >
- <View style={{ flexDirection: 'row' }}>
- <View style={{ flex: 1 }}>
- <Text
- style={{ fontSize: 13, lineHeight: 18, color: '#666' }}
- >
- 退款单号
- </Text>
- </View>
- <View style={{ flex: 1, alignItems: 'center' }}>
- <Text
- style={{ fontSize: 13, lineHeight: 18, color: '#666' }}
- >
- 退款核销日期
- </Text>
- </View>
- <View style={{ flex: 1 }}>
- <Text
- style={{ fontSize: 13, lineHeight: 18, color: '#666' }}
- >
- 退款核销额
- </Text>
- </View>
- </View>
- {item.billlistRefundAccount.map((itemrefund, key) => (
- <View key={key} style={{ flexDirection: 'row' }}>
- <View style={{ flex: 1 }}>
- <Text
- numberOfLines={1}
- style={{
- fontSize: 13,
- lineHeight: 22,
- color: '#666',
- }}
- >
- {itemrefund.refundCode}
- </Text>
- </View>
- <View style={{ flex: 1, alignItems: 'center' }}>
- <Text
- style={{
- fontSize: 13,
- lineHeight: 22,
- color: '#666',
- }}
- >
- {itemrefund.refundTime}
- </Text>
- </View>
- <View style={{ flex: 1 }}>
- <Text
- style={{
- fontSize: 13,
- lineHeight: 22,
- color: '#666',
- }}
- >
- {itemrefund.refundMoney}
- </Text>
- </View>
- </View>
- ))}
- </View>
- )}
- </View>
- </Collapsible>
- </View>
- )
- }
- // 底部
- footerCom() {
- if (this.props.showFoot == 0) {
- return <View />
- } else if (this.props.showFoot == 1) {
- return (
- <View style={styles.footer}>
- <Text
- style={{
- fontSize: 14,
- lineHeight: 20,
- letterSpacing: 0.17,
- color: '#999',
- }}
- >
- 没有更多数据
- </Text>
- </View>
- )
- } else if (this.props.showFoot == 2) {
- return (
- <View style={styles.footer}>
- <ActivityIndicator />
- <Text>正在加载更多数据...</Text>
- </View>
- )
- }
- }
- render() {
- const { appTheme, castAmtContent, totalPages, payDetailData } = this.props
- return (
- <View
- style={[
- styles.container,
- { backgroundColor: appTheme.backgroundColor },
- ]}
- >
- <StatusBar
- animated={true}
- barStyle={appTheme.barStyle}
- // barStyle={"dark-content"}
- backgroundColor={'transparent'}
- translucent={true}
- />
- {this.header()}
- {/* 列表 */}
- <FlatList
- keyExtractor={item => item.id}
- data={
- this.props.navigation.state.params.comeFrom == 'Cost'
- ? castAmtContent
- : payDetailData
- }
- extraData={this.state.listActive}
- renderItem={({ item, index }) => this.ReconciliationList(item, index)}
- ListFooterComponent={this.footerCom.bind(this)}
- // initialNumToRender={5}
- onEndReachedThreshold={0.1}
- onEndReached={e => {
- if (this.props.showFoot != 0) {
- return
- }
- if (this.page != 1 && this.page >= totalPages) {
- return
- } else {
- this.page++
- }
- this.props.navigation.state.params.comeFrom == 'Cost'
- ? this.props.dispatch(
- createAction('mine_header/CastAmountSaga')({
- castAmt: castAmtContent,
- pageInfo: { page: this.page, size: this.size },
- searchInfo: this.searchInfo(),
- forUse: 'slipOn',
- })
- )
- : this.props.dispatch(
- createAction('mine_payment/PayDetailListSagas')({
- payActionData: payDetailData,
- pageInfo: { page: this.page, size: this.size },
- searchInfo: this.statsticInfo(),
- forUse: 'slipOn',
- })
- )
- }}
- refreshControl={
- <RefreshControl
- refreshing={this.props.isRefreshing}
- onRefresh={this.onRefresh.bind(this)} //(()=>this.onRefresh)或者通过bind来绑定this引用来调用方法
- tintColor="red"
- title={this.props.isRefreshing ? '刷新中....' : '下拉刷新'}
- />
- }
- />
- {/* 下拉遮罩 */}
- {!this.state.dateActive ? (
- <View
- style={{
- position: 'absolute',
- width: width,
- height: height,
- backgroundColor: '#000',
- opacity: 0.5,
- top: 101,
- }}
- />
- ) : null}
- </View>
- )
- }
- }
- const styles = StyleSheet.create({
- container: {
- flex: 1,
- },
- footer: {
- flexDirection: 'row',
- height: 24,
- justifyContent: 'center',
- alignItems: 'center',
- marginBottom: 10,
- marginTop: 10,
- },
- })
- export default ReconciliationDetail
|