PointOrderDetail.js
6.87 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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
import React from "react"
import {View, StyleSheet, Text, Image, TouchableOpacity, Alert, ScrollView,Platform,PixelRatio,Dimensions} from "react-native"
import {observer} from 'mobx-react/native'
import Header from '../../components/Header';
import pointOrderDetailLogic from '../../../logic/pointOrderDetailLogic'
import {CarItem} from "../tabs/ShoppingCar";
import ActivePage from "../../components/ActivePage";
import { zoomW, zoomH } from '../../../../utils/getSize';
const width = Dimensions.get("window").width;
const line = 1 / PixelRatio.get();
const styles = StyleSheet.create({
backWrap: {
justifyContent: 'center',
paddingLeft: 15 / zoomW,
paddingRight: 15 / zoomW,
height: 44 / zoomH,
},
container: {
flex: 1,
backgroundColor: "#f4f4f4"
},
addressView: {
paddingRight: 15,
justifyContent: 'center',
paddingBottom: 15,
},
addressViewContent: {
flex: 1,
},
name: {
marginLeft: 22,
fontSize: 16,
color: "#333333",
fontWeight: "600",
marginBottom: 10,
marginTop: 10
},
addressView1: {
flexDirection: 'row',
paddingRight: 15,
},
addressIcon: {
height: 13,
width: 13,
marginRight: 10,
marginTop: 2,
},
address: {
fontSize: 14,
color: "#333333",
width: width - 80,
},
icon: {
height: 12,
width: 12,
},
titleView: {
backgroundColor: "white",
paddingLeft: 15,
marginBottom: 10,
},
row: {
borderBottomColor: "#f4f4f4",
borderBottomWidth: line,
alignItems: 'center',
flexDirection: 'row',
paddingRight: 15,
height: 40,
},
rowIcon: {
height: 12,
width: 12,
},
rowText: {
marginHorizontal: 7,
fontSize: 14,
flex: 1,
},
content: {
backgroundColor: "white",
borderBottomColor: "#f4f4f4",
borderBottomWidth: line,
},
contentTitleView: {
height: 45,
alignItems: 'center',
paddingHorizontal: 15,
flexDirection: 'row',
borderBottomColor: "#f4f4f4",
borderBottomWidth: line,
},
title: {
fontSize: 12,
flex: 1,
color: "#333333"
},
status: {
fontSize: 14,
},
countView: {
paddingHorizontal: 15,
paddingTop: 10,
flexDirection: 'row',
backgroundColor: "white",
},
countName: {
fontSize: 12,
flex: 1,
color: "#333333",
lineHeight: 18,
},
count: {
fontSize: 12,
color: "#333333",
lineHeight: 18,
textAlign: 'right',
},
priceView: {
paddingBottom: 10,
backgroundColor: "white",
flexDirection: "row",
},
countName1: {
fontSize: 14,
flex: 1,
color: "#333333",
paddingLeft: 15,
},
count1: {
fontSize: 14,
color: "#ea281a",
paddingRight: 15,
},
bottomBar: {
marginTop: 10,
padding: 15,
backgroundColor: 'white',
},
bottomText: {
fontSize: 12,
color: "#666666",
lineHeight: 20
},
statusFont: {
fontSize: 12,
},
markButton: {
height: 26,
width: 75,
alignItems: "center",
justifyContent: "center",
borderWidth: line,
borderColor: "#ea281a",
borderRadius: 2,
position: "absolute",
right: 15,
bottom: 12,
},
markButtonText: {
fontSize: 14,
color: "#ea281a"
},
})
export const pointDetailStatus = (status,isVirtual) => {
if(isVirtual){
return <Text style={[styles.statusFont, {color: "#52c26e"}]}>已完成</Text>
}
if (status === "UN_PAID") {
return <Text style={styles.statusFont}>待付款</Text>
}
if (status === "UN_SHIPMENT") {
return <Text style={styles.statusFont}>待发货</Text>
}
if (status === "UN_SIGNED") {
return <Text style={styles.statusFont}>待签收</Text>
}
return <Text style={[styles.statusFont, {color: "#52c26e"}]}>已完成</Text>
}
@observer
export default class PointOrderDetail extends React.Component {
static navigationOptions=({ navigation, screenProps }) => ({
title: '兑换详情',
headerLeft: (
<TouchableOpacity style={styles.backWrap} onPress={() => navigation.goBack(null)}>
<Image source={require('../../../../img/back_gray.png')} resizeMode="contain" />
</TouchableOpacity>
),
headerRight: (
<View />
),
});
logic = new pointOrderDetailLogic()
async componentWillMount() {
const {id} = this.props.navigation.state.params
this.logic.id = id
await this.logic.get()
}
address() {
const {status} = this.logic
return (
<View style={styles.titleView}>
{(status !== "UN_PAID" && status !== "UN_SHIPMENT"&&!this.logic.isVirtual) && <TouchableOpacity style={styles.row}
onPress={() => this.props.navigation.navigate("Express", {
id: this.props.navigation.state.params.id,
address: `${this.logic.address} ${this.logic.name} ${this.logic.phone}`
})}>
<Image style={styles.rowIcon} resizeMode={"contain"} source={require("./imgs/car1.png")}/>
<Text style={styles.rowText}>查看物流信息</Text>
<Image style={styles.rowIcon} resizeMode={"contain"} source={require("../ShoppingCar/imgs/right.png")}/>
</TouchableOpacity>}
<View style={styles.addressView}>
<Text style={styles.name}>{`${this.logic.name} ${this.logic.phone}`}</Text>
<View style={styles.addressView1}>
<Image resizeMode='contain' style={styles.addressIcon} source={require("../product/imgs/address.png")}/>
<Text style={styles.address}>{this.logic.address}</Text>
</View>
</View>
</View>
)
}
content1() {
// const status=this.logic.isReturn?"退货退款":statusToString(this.logic.orderStatus)
return (
<View style={styles.content}>
<View style={styles.contentTitleView}>
<Text style={styles.title}>订单编号:{this.logic.orderNum}</Text>
{pointDetailStatus(this.logic.status,this.logic.isVirtual)}
</View>
{this.logic.items.map((v, i) => <CarItem
key={i}
data={v}
nodel={true}
noView={true}
navigation={this.props.navigation}
showPoint={v.pointValue}
phone={this.logic.phone}
getData={async () => {
}}/>)}
{this.logic.status==="UN_SIGNED"&&<TouchableOpacity style={styles.markButton} onPress={this.sign}>
<Text style={styles.markButtonText}>确认收货</Text>
</TouchableOpacity>}
</View>
)
}
sign = async () => {
Alert.alert('注意', "确定签收吗?", [
{text: '取消', onPress: () => console.log('Cancel Pressed!')},
{
text: '确定', onPress: async () => {
const data = await this.logic.sign();
if(data){
await this.logic.get()
}
}
},
])
}
content(){
if(this.logic.loading){
return <ActivePage/>
}
return (
<ScrollView>
<View style={styles.container}>
{this.address()}
{this.content1()}
</View>
</ScrollView>
)
}
render() {
const {params}=this.props.navigation.state
return (
<View style={styles.container}>
<View style={styles.container}>
{this.content()}
</View>
</View>
)
}
}