GroupDetailProduct.js
4.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
'use strict';
import React from 'react';
import Immutable, {Map} from 'immutable';
import YH_Image from '../../common/components/YH_Image';
import {getSlicedUrl} from '../../classify/utils/Utils';
import DeleteLineText from '../../common/components/DeleteLineText';
import ReactNative, {
View,
Text,
Image,
StyleSheet,
Dimensions,
TouchableOpacity,
Platform,
} from 'react-native';
export default class GroupDetailProduct extends React.Component {
constructor(props) {
super(props);
}
render() {
let { resource ,perpleNum} = this.props;
if(!resource) return null;
let productIcon = resource.productIcon ? getSlicedUrl(resource.productIcon,109*DEVICE_WIDTH_RATIO, 141*DEVICE_WIDTH_RATIO, 2) : '';
let productGroupPrice = resource.productGroupPrice;
let productName = resource.productName;
let productSalePrice = resource.productSalePrice;
let productSkn = resource.productSkn;
return (
<View style={styles.container}>
<YH_Image style={styles.image} url={productIcon}></YH_Image>
<View style={styles.right}>
<View style={styles.titleView}>
<Text style={styles.title} numberOfLines={2}>{productName}</Text>
</View>
<View style={styles.priceView}>
<Text style={styles.iconText}>{perpleNum}人团</Text>
<Text style={styles.price1}>{productGroupPrice}</Text>
</View>
<View style={styles.subPriceView}>
<Text style={styles.subPrice1}>单人购买:</Text>
<DeleteLineText
style={styles.oldPriceContainer}
textStyle={styles.price2}
lineStyle={styles.deleteLine}
text={productSalePrice}
/>
</View>
</View>
</View>
);
}
}
let {width, height} = Dimensions.get('window');
const DEVICE_WIDTH_RATIO = width / 375;
let styles = StyleSheet.create({
container: {
width: 300*DEVICE_WIDTH_RATIO,
height: 141*DEVICE_WIDTH_RATIO,
shadowColor: 'rgba(0,0,0,0.4)',
shadowOffset: {width: 0, height: 5},
shadowOpacity: 0.5,
shadowRadius: 5,
elevation: 4,
flexDirection: 'row',
backgroundColor: 'white',
},
image: {
width: 109*DEVICE_WIDTH_RATIO,
height: 141*DEVICE_WIDTH_RATIO,
},
right: {
width: 191*DEVICE_WIDTH_RATIO,
height: 141*DEVICE_WIDTH_RATIO,
flexDirection: 'column',
},
titleView: {
width: 174*DEVICE_WIDTH_RATIO,
height: 32*DEVICE_WIDTH_RATIO,
marginTop: 17*DEVICE_WIDTH_RATIO,
marginLeft: 10*DEVICE_WIDTH_RATIO,
},
title: {
fontSize: 12,
color: '#444444',
lineHeight: 19,
},
subPriceView: {
width: 174*DEVICE_WIDTH_RATIO,
height: 14*DEVICE_WIDTH_RATIO,
marginLeft: 10*DEVICE_WIDTH_RATIO,
marginTop: 5*DEVICE_WIDTH_RATIO,
flexDirection: 'row',
alignItems: 'center',
},
subPrice1: {
fontSize: 10,
color: '#B0B0B0',
lineHeight: 10*DEVICE_WIDTH_RATIO,
},
priceView: {
width: 174*DEVICE_WIDTH_RATIO,
height: 21*DEVICE_WIDTH_RATIO,
marginLeft: 10*DEVICE_WIDTH_RATIO,
marginTop: 33*DEVICE_WIDTH_RATIO,
flexDirection: 'row',
alignItems: 'center',
},
iconText: {
width: 40*DEVICE_WIDTH_RATIO,
height: 14*DEVICE_WIDTH_RATIO,
backgroundColor: '#D0021B',
color: 'white',
fontSize: 9,
textAlign: 'center',
lineHeight: 14*DEVICE_WIDTH_RATIO,
},
price1: {
fontSize: 18,
marginLeft: 10*DEVICE_WIDTH_RATIO,
color: '#444444',
lineHeight: 18*DEVICE_WIDTH_RATIO,
fontWeight: 'bold',
},
oldPriceContainer: {
flexDirection: 'row',
height: 12,
marginTop: 2,
},
price2: {
fontSize: 12,
lineHeight: 12,
color: '#B0B0B0',
alignItems: 'center',
},
deleteLine: {
position: 'absolute',
top: (16 / 2) - 3,
left: 0,
right: 0,
height: 1,
backgroundColor: '#b0b0b0',
},
});