Authored by 盖剑秋

Change code format. reviewed by Kai.

... ... @@ -33,20 +33,13 @@ export default class Detail extends Component {
renderRow(rowData, sectionID, rowID, highlightRow) {
switch (sectionID) {
case 'address':
return (<AddressCell
channel={this.props.channel}
data={rowData}
/>)
break;
return (<AddressCell channel={this.props.channel} data={rowData}/>);
break
case 'orderInfo':
return (<OrderInfoCell
data={rowData}
/>)
return (<OrderInfoCell data={rowData}/>);
break
case 'paymentInfo':
return (<PaymentInfoCell
data={rowData}
/>)
return (<PaymentInfoCell data={rowData}/>);
break;
}
return null;
... ... @@ -63,25 +56,32 @@ export default class Detail extends Component {
let addressBlob = {
'name': data && data.get('user_name'),
'mobile': data && data.get('mobile'),
'address': data && data.get('area') + data.get('address'),
'address': data && data.get('area') + data.get('address')
}
let orderInfoBlob = {
orderCode: order_code,
orderStatus: data && data.get('status_str'),
orderTime: data && data.get('create_time'),
payWay: data && data.get('payment_name'),
payWay: data && data.get('payment_name')
}
let paymentInfoBlob = {
promotionAry: data && data.get('promotion_formulas'),
total: data && data.get('payment_amount'),
type: data && data.get('payment_type'),
}
let dataSource = {
'address': data?[addressBlob]:[],
'orderInfo': data? [orderInfoBlob] : [],
'paymentInfo': data ? [paymentInfoBlob] : [],
'address': data
? [addressBlob]
: [],
'orderInfo': data
? [orderInfoBlob]
: [],
'paymentInfo': data
? [paymentInfoBlob]
: []
};
let buttonArray = data
... ... @@ -91,15 +91,15 @@ export default class Detail extends Component {
<View style={styles.container}>
{!isFetching
? <View style={styles.container}>
<ListView
contentContainerStyle={styles.contentContainer}
enableEmptySections={true}
showsVerticalScrollIndicator={false}
dataSource={this.dataSource.cloneWithRowsAndSections(dataSource)}
renderRow={this.renderRow}
/>
{buttonArray.length?<Footer/>:null}
</View>
<ListView
contentContainerStyle={styles.contentContainer}
enableEmptySections={true}
showsVerticalScrollIndicator={false}
dataSource={this.dataSource.cloneWithRowsAndSections(dataSource)}
renderRow={this.renderRow}
/>
{buttonArray.length? <Footer/>: null}
</View>
: <LoadingIndicator isVisible={isFetching}/>}
</View>
);
... ... @@ -112,7 +112,7 @@ let styles = StyleSheet.create({
container: {
flex: 1,
width: width,
backgroundColor: '#f0f0f0',
backgroundColor: '#f0f0f0'
},
contentContainer: {
backgroundColor: 'white',
... ...
... ... @@ -41,7 +41,8 @@ export default class PaymentInfoCell extends Component {
}
render() {
let {promotionAry, total} = this.props.data;
let {promotionAry, total, type} = this.props.data;
let payment_desc = type == '2' ? '应付金额' : '实付金额' ;
return (
<View style={styles.container}>
{promotionAry.toJS().map((item, i) => {
... ... @@ -61,7 +62,7 @@ export default class PaymentInfoCell extends Component {
</View>
)
})}
{this.renderCell('实付金额', '¥' + total, true)}
{this.renderCell(payment_desc, '¥' + total, true)}
</View>
);
}
... ...