GroupDetailProduct.js
5.15 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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
'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,pageGo} = 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;
let tipIcon = '';
let needShowTioIcon = false;
if (pageGo == 4) {
needShowTioIcon = true;
tipIcon = require('../images/success_tab.png');
}else if (pageGo == 6 || pageGo == 7) {
needShowTioIcon = true;
tipIcon = require('../images/lost_tab.png');
}
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}>
<View style={styles.iconTextView}>
<Text style={styles.iconText}>{perpleNum}人团</Text>
</View>
<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>
{needShowTioIcon ?
<View style={styles.styleBtn}>
<Image source={tipIcon} style={styles.styleBtnicon} resizeMode={'contain'}/>
</View>
: null
}
</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',
},
iconTextView: {
width: 40*DEVICE_WIDTH_RATIO,
height: 14*DEVICE_WIDTH_RATIO,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#D0021B',
},
iconText: {
color: 'white',
fontSize: 9,
textAlign: 'center',
},
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',
},
styleBtn: {
position: 'absolute',
width: 52*DEVICE_WIDTH_RATIO,
height: 20*DEVICE_WIDTH_RATIO,
top: 111*DEVICE_WIDTH_RATIO,
right: -10*DEVICE_WIDTH_RATIO,
},
styleBtnicon: {
width: 52*DEVICE_WIDTH_RATIO,
height: 20*DEVICE_WIDTH_RATIO,
},
});